|
|
|
@ -66,14 +66,14 @@ public class DepositoryRecordController { |
|
|
|
} |
|
|
|
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); |
|
|
|
map.put("applicantId", userToken.getId()); |
|
|
|
List<ApplicationInRecordP> applicationInRecordPlist = depositoryRecordService.findApplicationInRecordPByCondition(map, userToken,userKey,token); |
|
|
|
List<ApplicationInRecordP> applicationInRecordPlist = depositoryRecordService.findApplicationInRecordPByCondition(map, userToken, userKey, token); |
|
|
|
Integer InCount = depositoryRecordService.findApplicationInRecordPCountByCondition(map); |
|
|
|
for (ApplicationInRecordP applicationInRecordP : applicationInRecordPlist) { |
|
|
|
if (applicationInRecordP.getPrice() != null) { |
|
|
|
applicationInRecordP.setPrice(applicationInRecordP.getPrice() / 100); |
|
|
|
} |
|
|
|
} |
|
|
|
List<ApplicationOutRecordP> applicationOutRecordPlist = depositoryRecordService.findApplicationOutRecordPByCondition(map, userToken,userKey,token); |
|
|
|
List<ApplicationOutRecordP> applicationOutRecordPlist = depositoryRecordService.findApplicationOutRecordPByCondition(map, userToken, userKey, token); |
|
|
|
Integer OutCount = depositoryRecordService.findApplicationOutRecordPCountByCondition(map); |
|
|
|
for (ApplicationOutRecordP recordP : applicationOutRecordPlist) { |
|
|
|
if (recordP.getPrice() != null) { |
|
|
|
@ -98,7 +98,7 @@ public class DepositoryRecordController { |
|
|
|
} |
|
|
|
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); |
|
|
|
map.put("userId", userToken.getId()); |
|
|
|
List<SimpleApplicationOutOrInRecordP> myTask = depositoryRecordService.findMyTaskOut(map,userKey,token); |
|
|
|
List<SimpleApplicationOutOrInRecordP> myTask = depositoryRecordService.findMyTaskOut(map, userKey, token); |
|
|
|
|
|
|
|
return new RestResponse(myTask |
|
|
|
, depositoryRecordService.findMyTaskOutCount(map), 200); |
|
|
|
@ -115,7 +115,7 @@ public class DepositoryRecordController { |
|
|
|
} |
|
|
|
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); |
|
|
|
map.put("userId", userToken.getId()); |
|
|
|
List<SimpleApplicationOutOrInRecordP> myTask = depositoryRecordService.findMyTaskIn(map,userKey,token); |
|
|
|
List<SimpleApplicationOutOrInRecordP> myTask = depositoryRecordService.findMyTaskIn(map, userKey, token); |
|
|
|
|
|
|
|
return new RestResponse(myTask |
|
|
|
, depositoryRecordService.findMyTaskInCount(map), 200); |
|
|
|
@ -461,14 +461,14 @@ public class DepositoryRecordController { |
|
|
|
} |
|
|
|
sb.append(workwechat).append(","); |
|
|
|
} |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(),finalUserKey,finalToken); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserKey, finalToken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -485,21 +485,21 @@ public class DepositoryRecordController { |
|
|
|
for (RoleAndDepository mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), finalUserKey,finalToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), finalUserKey, finalToken); |
|
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
} |
|
|
|
sb.append(workwechat).append(","); |
|
|
|
} |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(),finalUserKey,finalToken); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserKey, finalToken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
@ -532,7 +532,7 @@ public class DepositoryRecordController { |
|
|
|
String crypt = Md5.crypt(header); |
|
|
|
map.put("applicantId", userToken.getId()); |
|
|
|
// 获取当前部门负责人
|
|
|
|
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(userToken.getMaindeparment(), userkey,usertoken); |
|
|
|
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(userToken.getMaindeparment(), userkey, usertoken); |
|
|
|
StringBuilder departmentHeadId = new StringBuilder(); |
|
|
|
StringBuilder departMentHeadQyWxName = new StringBuilder(); |
|
|
|
// for (int i = 0; i < departmentHeadByUsers.size(); i++) {
|
|
|
|
@ -566,7 +566,7 @@ public class DepositoryRecordController { |
|
|
|
String finalUserkey = userkey; |
|
|
|
String finalUsertoken = usertoken; |
|
|
|
if (params.size() < 1 && map.size() > 3) { |
|
|
|
Integer res = depositoryRecordService.insertApplicationOutRecord(map, userToken,userkey,usertoken); // 插入主订单
|
|
|
|
Integer res = depositoryRecordService.insertApplicationOutRecord(map, userToken, userkey, usertoken); // 插入主订单
|
|
|
|
Object id = map.get("id"); // 获取主订单编号
|
|
|
|
if (res == 1) { // 如果插入成功
|
|
|
|
if (id != null) { |
|
|
|
@ -586,9 +586,9 @@ public class DepositoryRecordController { |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("otherDepartmentIdList", jsonObject.getString("otherDepartmentIdList")); |
|
|
|
QyWxApprovalMap.put("mainId", id.toString()); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
@ -608,7 +608,7 @@ public class DepositoryRecordController { |
|
|
|
} |
|
|
|
String keyNumber = key.split("mid")[1]; |
|
|
|
} |
|
|
|
Integer res = depositoryRecordService.insertApplicationOutRecord(map, userToken,userkey,usertoken); |
|
|
|
Integer res = depositoryRecordService.insertApplicationOutRecord(map, userToken, userkey, usertoken); |
|
|
|
if (res == 1) { |
|
|
|
// 获取主订单编号
|
|
|
|
Object id = map.get("id"); |
|
|
|
@ -636,13 +636,145 @@ public class DepositoryRecordController { |
|
|
|
|
|
|
|
// 开启一个线程开启审批
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplate(crypt, userToken, ObjectFormatUtil.toInteger(id),finalUserkey,finalUsertoken); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplate(crypt, userToken, ObjectFormatUtil.toInteger(id), finalUserkey, finalUsertoken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("otherDepartmentIdList", jsonObject.getString("otherDepartmentIdList")); |
|
|
|
QyWxApprovalMap.put("mainId", id.toString()); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire(sp_no, 7, TimeUnit.DAYS); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (integer != 0 && params.size() < 1) { |
|
|
|
return CrudUtil.insertHandle(integer, 1); |
|
|
|
} else if (integer != 0 && params.size() >= 1) { |
|
|
|
return CrudUtil.insertHandle(integer, params.size() + 1); |
|
|
|
} else { |
|
|
|
return new RestResponse("", 666, new StatusInfo("出库失败", "请联系管理员进行操作")); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 出库申请用于立刻提交
|
|
|
|
@PostMapping("/applicationOutForImmediately") |
|
|
|
public RestResponse insertApplicationOutRecordForImmediately(@RequestBody Map<String, Object> map, HttpServletRequest request) { |
|
|
|
String usertoken = request.getHeader("user-token"); |
|
|
|
String userkey = request.getHeader("user-key"); |
|
|
|
if (usertoken == null) { |
|
|
|
usertoken = (String) request.getSession().getAttribute("userToken"); |
|
|
|
userkey = (String) request.getSession().getAttribute("userKey"); |
|
|
|
} |
|
|
|
UserByPort userToken = AuthenticationTokenPool.getUserToken(usertoken); |
|
|
|
String header = request.getHeader("user-agent"); |
|
|
|
String crypt = Md5.crypt(header); |
|
|
|
map.put("applicantId", userToken.getId()); |
|
|
|
|
|
|
|
Object userId = map.get("userId"); |
|
|
|
if (userId != null) { |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(userId), userkey, usertoken); |
|
|
|
map.put("departmenthead",userByPort.getId()); |
|
|
|
map.put("depositoryManager",userToken.getId()); |
|
|
|
} else { |
|
|
|
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(map.get("adminorgId")), userkey, usertoken); |
|
|
|
StringBuilder departmentHeadId = new StringBuilder(); |
|
|
|
for (UserByPort departmentHeadByUser : departmentHeadByUsers) { |
|
|
|
departmentHeadId.append(departmentHeadByUser.getId()).append(","); |
|
|
|
} |
|
|
|
map.put("departmenthead",userToken.getId()); |
|
|
|
map.put("depositoryManager",departmentHeadId.toString()); |
|
|
|
} |
|
|
|
List<Integer> params = (List<Integer>) map.get("params"); |
|
|
|
Integer integer = 0; |
|
|
|
if (map.containsKey("constructionUnitId")) { |
|
|
|
String constructionUnitId = map.get("constructionUnitId").toString(); |
|
|
|
if ("".equals(constructionUnitId)) { |
|
|
|
map.remove("constructionUnitId"); |
|
|
|
} |
|
|
|
} |
|
|
|
String finalUserkey = userkey; |
|
|
|
String finalUsertoken = usertoken; |
|
|
|
if (params.size() < 1 && map.size() > 3) { |
|
|
|
Integer res = depositoryRecordService.insertApplicationOutRecord(map, userToken, userkey, usertoken); // 插入主订单
|
|
|
|
Object id = map.get("id"); // 获取主订单编号
|
|
|
|
if (res == 1) { // 如果插入成功
|
|
|
|
if (id != null) { |
|
|
|
map.remove("id"); |
|
|
|
map.put("parentId", id); |
|
|
|
} |
|
|
|
integer += depositoryRecordService.insertApplicationOutMin(map); |
|
|
|
|
|
|
|
// 开启一个线程执行发送信息操作
|
|
|
|
|
|
|
|
// 开启一个线程开启审批
|
|
|
|
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplateForImmediately(crypt, userToken, ObjectFormatUtil.toInteger(id), finalUserkey, finalUsertoken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("otherDepartmentIdList", jsonObject.getString("otherDepartmentIdList")); |
|
|
|
QyWxApprovalMap.put("mainId", id.toString()); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
// 插入主订单
|
|
|
|
if (!map.containsKey("mid")) { |
|
|
|
// 如果不包含初始的第一个卡片
|
|
|
|
Set<String> strings = map.keySet(); |
|
|
|
String key = ""; |
|
|
|
for (String tempKey : |
|
|
|
strings) { |
|
|
|
if (tempKey.contains("mid")) { |
|
|
|
key = tempKey; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
String keyNumber = key.split("mid")[1]; |
|
|
|
} |
|
|
|
Integer res = depositoryRecordService.insertApplicationOutRecord(map, userToken, userkey, usertoken); |
|
|
|
if (res == 1) { |
|
|
|
// 获取主订单编号
|
|
|
|
Object id = map.get("id"); |
|
|
|
for (Integer temp : params) { |
|
|
|
Map<String, Object> insert = new HashMap<>(); |
|
|
|
insert.put("applicantId", userToken.getId()); |
|
|
|
insert.put("mid", map.get("mid" + temp)); |
|
|
|
insert.put("quantity", (int) (ObjectFormatUtil.toDouble(map.get("quantity" + temp)) * 100)); |
|
|
|
insert.put("code", map.get("code")); |
|
|
|
insert.put("placeId", map.get("placeId")); |
|
|
|
insert.put("unit", map.get("unit" + temp)); |
|
|
|
insert.put("project", map.get("project" + temp)); |
|
|
|
// 获取主订单编号
|
|
|
|
insert.put("parentId", id); |
|
|
|
// 插入子订单
|
|
|
|
integer += depositoryRecordService.insertApplicationOutMin(insert); |
|
|
|
} |
|
|
|
|
|
|
|
// 插入子订单
|
|
|
|
map.put("parentId", id); |
|
|
|
map.remove("id"); |
|
|
|
// 插入子订单
|
|
|
|
integer += depositoryRecordService.insertApplicationOutMin(map); |
|
|
|
|
|
|
|
|
|
|
|
// 开启一个线程开启审批
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplateForImmediately(crypt, userToken, ObjectFormatUtil.toInteger(id), finalUserkey, finalUsertoken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("otherDepartmentIdList", jsonObject.getString("otherDepartmentIdList")); |
|
|
|
QyWxApprovalMap.put("mainId", id.toString()); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire(sp_no, 7, TimeUnit.DAYS); |
|
|
|
}); |
|
|
|
@ -674,11 +806,11 @@ public class DepositoryRecordController { |
|
|
|
Integer recordPCount = 0; |
|
|
|
Integer maindeparment = userToken.getMaindeparment(); |
|
|
|
if (PublicConfig.roleAdminorgList.contains(maindeparment)) { |
|
|
|
list = depositoryRecordService.findApplicationInRecordPByCondition(map, userToken,userKey,token); |
|
|
|
list = depositoryRecordService.findApplicationInRecordPByCondition(map, userToken, userKey, token); |
|
|
|
recordPCount = depositoryRecordService.findApplicationInRecordPCountByCondition(map); |
|
|
|
} else { |
|
|
|
|
|
|
|
list = depositoryRecordService.findApplicationInRecordPByUser(userToken, map,userKey,token); |
|
|
|
list = depositoryRecordService.findApplicationInRecordPByUser(userToken, map, userKey, token); |
|
|
|
recordPCount = depositoryRecordService.findApplicationInRecordPCountByUser(userToken, map); |
|
|
|
} |
|
|
|
for (ApplicationInRecordP applicationInRecordP : list) { |
|
|
|
@ -750,7 +882,7 @@ public class DepositoryRecordController { |
|
|
|
ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId()); |
|
|
|
|
|
|
|
// 获取申请人
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationOutRecordPById.getApplicantId(), userKey,token); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationOutRecordPById.getApplicantId(), userKey, token); |
|
|
|
// 创建展示对象
|
|
|
|
SimpleApplicationOutMinRecordP simpleApplicationOutMinRecordP = new SimpleApplicationOutMinRecordP(applicationOutMinById); |
|
|
|
// 设置展示时的数量为申请数-已出库数
|
|
|
|
@ -781,7 +913,7 @@ public class DepositoryRecordController { |
|
|
|
if (checkId != null) { |
|
|
|
// 如果该订单已经处理
|
|
|
|
// 获取处理人
|
|
|
|
UserByPort checker = LinkInterfaceUtil.FindUserById(checkId, userKey,token); |
|
|
|
UserByPort checker = LinkInterfaceUtil.FindUserById(checkId, userKey, token); |
|
|
|
simpleApplicationOutMinRecordP.setCheckerName(checker.getName()); |
|
|
|
simpleApplicationOutMinRecordP.setPcode(placeByDid.getCode()); |
|
|
|
// 当已经完成出库时设置数量为出库数
|
|
|
|
@ -835,10 +967,10 @@ public class DepositoryRecordController { |
|
|
|
Integer countBy = 0; |
|
|
|
Integer maindeparment = userByPort.getMaindeparment(); |
|
|
|
if (PublicConfig.roleAdminorgList.contains(maindeparment)) { |
|
|
|
list = depositoryRecordService.findApplicationOutRecordPByCondition(map, userByPort,userKey,token); |
|
|
|
list = depositoryRecordService.findApplicationOutRecordPByCondition(map, userByPort, userKey, token); |
|
|
|
countBy = depositoryRecordService.findApplicationOutRecordPCountByCondition(map); |
|
|
|
} else { |
|
|
|
list = depositoryRecordService.findApplicationOutRecordPByUser(userByPort, map,userKey,token); |
|
|
|
list = depositoryRecordService.findApplicationOutRecordPByUser(userByPort, map, userKey, token); |
|
|
|
countBy = depositoryRecordService.findApplicationOutRecordPCountByUser(userByPort, map); |
|
|
|
} |
|
|
|
|
|
|
|
@ -981,7 +1113,7 @@ public class DepositoryRecordController { |
|
|
|
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); |
|
|
|
String header = request.getHeader("user-agent"); |
|
|
|
String crypt = Md5.crypt(header); |
|
|
|
Integer review = depositoryRecordService.review(map, userToken.getId(), userToken, crypt,userkey,token); |
|
|
|
Integer review = depositoryRecordService.review(map, userToken.getId(), userToken, crypt, userkey, token); |
|
|
|
if (review != -1) { |
|
|
|
return CrudUtil.insertHandle(review, 1); |
|
|
|
} else { |
|
|
|
@ -1020,7 +1152,7 @@ public class DepositoryRecordController { |
|
|
|
String header = request.getHeader("user-agent"); |
|
|
|
String crypt = Md5.crypt(header); |
|
|
|
UserByPort userToken = AuthenticationTokenPool.getUserToken(usertoken); |
|
|
|
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(userToken.getMaindeparment(), userkey,usertoken); |
|
|
|
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(userToken.getMaindeparment(), userkey, usertoken); |
|
|
|
StringBuilder departmentHeadId = new StringBuilder(); |
|
|
|
StringBuilder departMentHeadQyWxName = new StringBuilder(); |
|
|
|
// for (int i = 0; i < departmentHeadByUsers.size(); i++) {
|
|
|
|
@ -1057,7 +1189,7 @@ public class DepositoryRecordController { |
|
|
|
String finalUserkey = userkey; |
|
|
|
String finalUsertoken = usertoken; |
|
|
|
if (params.size() < 1 && map.size() > 4) { |
|
|
|
integer += depositoryRecordService.transferApply(map, userToken,userkey,usertoken); |
|
|
|
integer += depositoryRecordService.transferApply(map, userToken, userkey, usertoken); |
|
|
|
Object id = map.get("parentId"); |
|
|
|
|
|
|
|
// 开启一个线程开启审批
|
|
|
|
@ -1069,9 +1201,9 @@ public class DepositoryRecordController { |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", id.toString()); |
|
|
|
QyWxApprovalMap.put("otherDepartmentIdList", jsonObject.getString("otherDepartmentIdList")); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
}); |
|
|
|
|
|
|
|
} else if (params.size() > 0) { |
|
|
|
@ -1091,23 +1223,23 @@ public class DepositoryRecordController { |
|
|
|
if (parentId != null) { |
|
|
|
insert.put("parentId", parentId); |
|
|
|
} |
|
|
|
integer += depositoryRecordService.transferApply(insert, userToken,userkey,usertoken); |
|
|
|
integer += depositoryRecordService.transferApply(insert, userToken, userkey, usertoken); |
|
|
|
map.put("parentId", insert.get("parentId")); |
|
|
|
|
|
|
|
} |
|
|
|
integer += depositoryRecordService.transferApply(map, userToken,userkey,usertoken); |
|
|
|
integer += depositoryRecordService.transferApply(map, userToken, userkey, usertoken); |
|
|
|
Object id = map.get("parentId"); |
|
|
|
// 开启一个线程开启审批
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplate(crypt, userToken, ObjectFormatUtil.toInteger(id),finalUserkey,finalUsertoken); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplate(crypt, userToken, ObjectFormatUtil.toInteger(id), finalUserkey, finalUsertoken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", id.toString()); |
|
|
|
QyWxApprovalMap.put("otherDepartmentIdList", jsonObject.getString("otherDepartmentIdList")); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
@ -1213,11 +1345,11 @@ public class DepositoryRecordController { |
|
|
|
List<ApplicationModel> list = new ArrayList<>(); |
|
|
|
for (int i = start; i < end; i++) { |
|
|
|
// 获取物料编号
|
|
|
|
Integer mid = ObjectFormatUtil.toInteger( redisPool.getRedisTemplateByDb(15).opsForList().index("mids" + userToken.getId(), i)); |
|
|
|
Integer mid = ObjectFormatUtil.toInteger(redisPool.getRedisTemplateByDb(15).opsForList().index("mids" + userToken.getId(), i)); |
|
|
|
// 获取仓库编号
|
|
|
|
Integer depositoryId = ObjectFormatUtil.toInteger( redisPool.getRedisTemplateByDb(15).opsForList().index("depositoryIds" + userToken.getId(), i)); |
|
|
|
Integer depositoryId = ObjectFormatUtil.toInteger(redisPool.getRedisTemplateByDb(15).opsForList().index("depositoryIds" + userToken.getId(), i)); |
|
|
|
// 获取库位编码
|
|
|
|
String placeCode = (String) ( redisPool.getRedisTemplateByDb(15).opsForList().index("placeCodes" + userToken.getId(), i)); |
|
|
|
String placeCode = (String) (redisPool.getRedisTemplateByDb(15).opsForList().index("placeCodes" + userToken.getId(), i)); |
|
|
|
// 获取物料信息
|
|
|
|
Inventory materialById = materialService.findInventoryById(mid); |
|
|
|
// 获取仓库信息
|
|
|
|
@ -1368,14 +1500,14 @@ public class DepositoryRecordController { |
|
|
|
} |
|
|
|
sb.append(workwechat).append(","); |
|
|
|
} |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(),finalUserkey,finalUsertoken); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserkey, finalUsertoken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -1392,28 +1524,28 @@ public class DepositoryRecordController { |
|
|
|
for (RoleAndDepository mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), finalUserkey,finalUsertoken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), finalUserkey, finalUsertoken); |
|
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
} |
|
|
|
sb.append(workwechat).append(","); |
|
|
|
} |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(),finalUserkey,finalUsertoken); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserkey, finalUsertoken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} else if ("out".equals(type)) { |
|
|
|
// 获取部门负责人
|
|
|
|
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(userToken.getMaindeparment(), userkey,usertoken); |
|
|
|
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(userToken.getMaindeparment(), userkey, usertoken); |
|
|
|
StringBuilder departmentHeadId = new StringBuilder(); |
|
|
|
StringBuilder departMentHeadQyWxName = new StringBuilder(); |
|
|
|
// for (UserByPort departmentHeadByUser : departmentHeadByUsers) {
|
|
|
|
@ -1435,7 +1567,7 @@ public class DepositoryRecordController { |
|
|
|
return new RestResponse("", 666, new StatusInfo("申请失败", "超出最大存储容量")); |
|
|
|
} |
|
|
|
map.put("mid", mid); |
|
|
|
Integer res = depositoryRecordService.insertApplicationOutRecord(map, userToken,userkey,usertoken); // 插入主订单
|
|
|
|
Integer res = depositoryRecordService.insertApplicationOutRecord(map, userToken, userkey, usertoken); // 插入主订单
|
|
|
|
if (res == 1) { // 如果插入成功
|
|
|
|
Object id = map.get("id"); // 获取主订单编号
|
|
|
|
if (id != null) { |
|
|
|
@ -1448,15 +1580,15 @@ public class DepositoryRecordController { |
|
|
|
|
|
|
|
// 开启一个线程开启审批
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplate(crypt, userToken, ObjectFormatUtil.toInteger(id),finalUserkey,finalUsertoken); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplate(crypt, userToken, ObjectFormatUtil.toInteger(id), finalUserkey, finalUsertoken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", id.toString()); |
|
|
|
QyWxApprovalMap.put("otherDepartmentIdList", jsonObject.getString("otherDepartmentIdList")); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@ -1611,14 +1743,14 @@ public class DepositoryRecordController { |
|
|
|
} |
|
|
|
sb.append(workwechat).append(","); |
|
|
|
} |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(),finalUserkey,finalUsertoken); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserkey, finalUsertoken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -1635,21 +1767,21 @@ public class DepositoryRecordController { |
|
|
|
for (RoleAndDepository mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), finalUserkey,finalUsertoken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), finalUserkey, finalUsertoken); |
|
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
} |
|
|
|
sb.append(workwechat).append(","); |
|
|
|
} |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(),finalUserkey,finalUsertoken); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserkey, finalUsertoken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
}); |
|
|
|
@ -1661,7 +1793,7 @@ public class DepositoryRecordController { |
|
|
|
sumQuantity += integer; |
|
|
|
} |
|
|
|
// 获取部门负责人
|
|
|
|
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(userToken.getMaindeparment(), userkey,usertoken); |
|
|
|
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(userToken.getMaindeparment(), userkey, usertoken); |
|
|
|
StringBuilder departmentHeadId = new StringBuilder(); |
|
|
|
StringBuilder departMentHeadQyWxName = new StringBuilder(); |
|
|
|
// for (int i = 0; i < departmentHeadByUsers.size(); i++) {
|
|
|
|
@ -1679,7 +1811,7 @@ public class DepositoryRecordController { |
|
|
|
mainRecord.put("quantity", sumQuantity.toString()); |
|
|
|
mainRecord.put("departmenthead", departmentHeadId.toString()); |
|
|
|
// 插入主表
|
|
|
|
depositoryRecordService.insertApplicationOutRecord(mainRecord, userToken,userkey,usertoken); |
|
|
|
depositoryRecordService.insertApplicationOutRecord(mainRecord, userToken, userkey, usertoken); |
|
|
|
id = ObjectFormatUtil.toInteger(mainRecord.get("id")); |
|
|
|
for (int i = 0; i < iids.size(); i++) { |
|
|
|
// 出库物料
|
|
|
|
@ -1750,15 +1882,15 @@ public class DepositoryRecordController { |
|
|
|
Integer finalId = id; |
|
|
|
// 开启一个线程开启审批
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplate(crypt, userToken, ObjectFormatUtil.toInteger(finalId),finalUserkey,finalUsertoken); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendOutApprovalTemplate(crypt, userToken, ObjectFormatUtil.toInteger(finalId), finalUserkey, finalUsertoken); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", finalId.toString()); |
|
|
|
QyWxApprovalMap.put("otherDepartmentIdList", jsonObject.getString("otherDepartmentIdList")); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_"+sp_no, QyWxApprovalMap); |
|
|
|
redisPool.getRedisTemplateByDb(14).opsForHash().putAll("wms_QyWxMessage_" + sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_"+sp_no, 7, TimeUnit.DAYS); |
|
|
|
redisPool.getRedisTemplateByDb(14).expire("wms_QyWxMessage_" + sp_no, 7, TimeUnit.DAYS); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
@ -1798,7 +1930,7 @@ public class DepositoryRecordController { |
|
|
|
if (barCode != null) { |
|
|
|
map.put("barCode", barCode); |
|
|
|
} |
|
|
|
return depositoryRecordService.completeApplicationOutMinRecord(map, userToken, crypt,userKey,token); |
|
|
|
return depositoryRecordService.completeApplicationOutMinRecord(map, userToken, crypt, userKey, token); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1814,7 +1946,7 @@ public class DepositoryRecordController { |
|
|
|
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); |
|
|
|
if (map.containsKey("id")) { |
|
|
|
Integer id = ObjectFormatUtil.toInteger(map.get("id")); |
|
|
|
List<String> strings = excelService.writeExcelForPrint(id, 4, userToken,userKey,token); |
|
|
|
List<String> strings = excelService.writeExcelForPrint(id, 4, userToken, userKey, token); |
|
|
|
List<File> files = new ArrayList<>(); |
|
|
|
for (String string : strings) { |
|
|
|
File file = new File(string); |
|
|
|
@ -1860,7 +1992,7 @@ public class DepositoryRecordController { |
|
|
|
String header = request.getHeader("user-agent"); |
|
|
|
String crypt = Md5.crypt(header); |
|
|
|
|
|
|
|
Integer integer = depositoryRecordService.updateOutMinRecordInfo(map, userToken, crypt,userKey,token); |
|
|
|
Integer integer = depositoryRecordService.updateOutMinRecordInfo(map, userToken, crypt, userKey, token); |
|
|
|
return CrudUtil.updateHandle(integer, 1); |
|
|
|
} else { |
|
|
|
throw new MyException("缺少必要参数"); |
|
|
|
|