|
|
|
@ -236,8 +236,12 @@ public class DepositoryRecordController { |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
// 定义列表用于储存入库单id
|
|
|
|
List<Integer> recordIds = new ArrayList<>(); |
|
|
|
// 定义列表用于存储入库仓库id
|
|
|
|
// 定义列表用于存储入库物料类型id
|
|
|
|
List<Long> mtIdList = new ArrayList<>(); |
|
|
|
// 定义列表用于存储入库仓库id
|
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<String> typeList = new ArrayList<>(); |
|
|
|
|
|
|
|
if (params.size() < 1 && map.size() > 3) { |
|
|
|
|
|
|
|
@ -250,6 +254,8 @@ public class DepositoryRecordController { |
|
|
|
integer += addSplitInventory; |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(map.get("mtId"))); |
|
|
|
typeList.add((String) map.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 获取库位id
|
|
|
|
@ -259,12 +265,16 @@ public class DepositoryRecordController { |
|
|
|
integer += depositoryRecordService.applicationInPlace(map, false); |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(map.get("mtId"))); |
|
|
|
typeList.add((String) map.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
} else { // 如果具体到库位
|
|
|
|
Integer flag = depositoryRecordService.applicationInPlace(map, false); |
|
|
|
if (flag != -1) { |
|
|
|
integer += flag; |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(map.get("mtId"))); |
|
|
|
typeList.add((String) map.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -294,6 +304,8 @@ public class DepositoryRecordController { |
|
|
|
integer += addSplitInventory; |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(insert.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(map.get("mtId"))); |
|
|
|
typeList.add((String) map.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
successMsg.add(insert); |
|
|
|
} else { |
|
|
|
errMsg.add(insert); |
|
|
|
@ -309,6 +321,8 @@ public class DepositoryRecordController { |
|
|
|
successMsg.add(insert); |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(insert.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(map.get("mtId"))); |
|
|
|
typeList.add((String) map.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
|
|
|
|
} |
|
|
|
} else {// 如果具体到库位
|
|
|
|
@ -321,6 +335,8 @@ public class DepositoryRecordController { |
|
|
|
integer += flag; |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(insert.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(map.get("mtId"))); |
|
|
|
typeList.add((String) map.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
@ -335,6 +351,8 @@ public class DepositoryRecordController { |
|
|
|
successMsg.add(map); |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(map.get("mtId"))); |
|
|
|
typeList.add((String) map.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
} else { |
|
|
|
errMsg.add(map); |
|
|
|
} |
|
|
|
@ -351,6 +369,8 @@ public class DepositoryRecordController { |
|
|
|
successMsg.add(map); |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(map.get("mtId"))); |
|
|
|
typeList.add((String) map.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
|
|
|
|
} |
|
|
|
} else { // 如果具体到库位
|
|
|
|
@ -362,6 +382,8 @@ public class DepositoryRecordController { |
|
|
|
integer += flag; |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(map.get("mtId"))); |
|
|
|
typeList.add((String) map.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -375,10 +397,13 @@ public class DepositoryRecordController { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
Map<Long, List<Integer>> MtIdToRecordId = new HashMap<>(); |
|
|
|
Map<Integer, List<Integer>> depositoryIdToRecordId = new HashMap<>(); |
|
|
|
for (int i = 0; i < recordIds.size(); i++) { |
|
|
|
Integer recordId = recordIds.get(i); |
|
|
|
if (recordId != null) { |
|
|
|
// 如果当前id不是空 获取对应的入库仓库id
|
|
|
|
String type = typeList.get(i); |
|
|
|
if("mt".equals(type)){ |
|
|
|
Long mtId = mtIdList.get(i); |
|
|
|
// 将对应仓库与订单id添加映射关系
|
|
|
|
List<Integer> integers = MtIdToRecordId.get(mtId); |
|
|
|
@ -391,12 +416,28 @@ public class DepositoryRecordController { |
|
|
|
integers.add(recordId); |
|
|
|
MtIdToRecordId.put(mtId, integers); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
Integer did = depositoryIdList.get(i); |
|
|
|
// 将对应仓库与订单id添加映射关系
|
|
|
|
List<Integer> integers = depositoryIdToRecordId.get(did); |
|
|
|
if (integers != null) { |
|
|
|
// 如果有对应关系
|
|
|
|
integers.add(recordId); |
|
|
|
} else { |
|
|
|
// 如果没有
|
|
|
|
integers = new ArrayList<>(); |
|
|
|
integers.add(recordId); |
|
|
|
depositoryIdToRecordId.put(did, integers); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 获取遍历器
|
|
|
|
Iterator<Long> iterator = MtIdToRecordId.keySet().iterator(); |
|
|
|
if (iterator.hasNext()) { |
|
|
|
// 获取当前仓库
|
|
|
|
// 获取当前类别
|
|
|
|
Long next = iterator.next(); |
|
|
|
// 获取入库到当前仓库的订单id
|
|
|
|
List<Integer> integerList = MtIdToRecordId.get(next); |
|
|
|
@ -424,6 +465,37 @@ public class DepositoryRecordController { |
|
|
|
redisTemplateForHash.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Iterator<Integer> iterator1 = depositoryIdToRecordId.keySet().iterator(); |
|
|
|
if (iterator1.hasNext()) { |
|
|
|
// 获取当前类别
|
|
|
|
Integer next = iterator1.next(); |
|
|
|
// 获取入库到当前仓库的订单id
|
|
|
|
List<Integer> integerList = depositoryIdToRecordId.get(next); |
|
|
|
// 获取当前类型的管理员
|
|
|
|
List<RoleAndDepository> materialTypeIdForIn = roleService.findRoleAndDepositoryByDid(next); |
|
|
|
// 用于存储当前仓库的管理员企业微信userId
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
for (RoleAndDepository mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), userToken); |
|
|
|
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()); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
|
redisTemplateForHash.opsForHash().putAll(sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisTemplateForHash.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}).start(); |
|
|
|
if (integer != 0 && params.size() < 1 && integer != -1) { |
|
|
|
@ -1236,16 +1308,136 @@ public class DepositoryRecordController { |
|
|
|
String type = (String) map.get("type"); |
|
|
|
Integer success = 0; |
|
|
|
if ("in".equals(type)) { |
|
|
|
List<String> typeList = new ArrayList<>(); |
|
|
|
List<Long> mtIdList = new ArrayList<>(); |
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
|
List<Integer> recordIds = new ArrayList<>(); |
|
|
|
String unit = (String) (map.get("unit")); |
|
|
|
if (!"-1".equals(unit)) { |
|
|
|
map.put("type", "in"); |
|
|
|
Integer addSplitInventory = splitUnitService.addSplitInventory(map); |
|
|
|
if (addSplitInventory != -1) { |
|
|
|
success += addSplitInventory; |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(map.get("mtId"))); |
|
|
|
typeList.add((String) map.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
success += depositoryRecordService.applicationInPlace(map, false); |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(map.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(map.get("mtId"))); |
|
|
|
typeList.add((String) map.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(map.get("depositoryId"))); |
|
|
|
} |
|
|
|
// 开启一个线程用于发送入库申请
|
|
|
|
new Thread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
Map<Long, List<Integer>> MtIdToRecordId = new HashMap<>(); |
|
|
|
Map<Integer, List<Integer>> depositoryIdToRecordId = new HashMap<>(); |
|
|
|
for (int i = 0; i < recordIds.size(); i++) { |
|
|
|
Integer recordId = recordIds.get(i); |
|
|
|
if (recordId != null) { |
|
|
|
// 如果当前id不是空 获取对应的入库仓库id
|
|
|
|
String type = typeList.get(i); |
|
|
|
if("mt".equals(type)){ |
|
|
|
Long mtId = mtIdList.get(i); |
|
|
|
// 将对应仓库与订单id添加映射关系
|
|
|
|
List<Integer> integers = MtIdToRecordId.get(mtId); |
|
|
|
if (integers != null) { |
|
|
|
// 如果有对应关系
|
|
|
|
integers.add(recordId); |
|
|
|
} else { |
|
|
|
// 如果没有
|
|
|
|
integers = new ArrayList<>(); |
|
|
|
integers.add(recordId); |
|
|
|
MtIdToRecordId.put(mtId, integers); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
Integer did = depositoryIdList.get(i); |
|
|
|
// 将对应仓库与订单id添加映射关系
|
|
|
|
List<Integer> integers = depositoryIdToRecordId.get(did); |
|
|
|
if (integers != null) { |
|
|
|
// 如果有对应关系
|
|
|
|
integers.add(recordId); |
|
|
|
} else { |
|
|
|
// 如果没有
|
|
|
|
integers = new ArrayList<>(); |
|
|
|
integers.add(recordId); |
|
|
|
depositoryIdToRecordId.put(did, integers); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 获取遍历器
|
|
|
|
Iterator<Long> iterator = MtIdToRecordId.keySet().iterator(); |
|
|
|
if (iterator.hasNext()) { |
|
|
|
// 获取当前类别
|
|
|
|
Long next = iterator.next(); |
|
|
|
// 获取入库到当前仓库的订单id
|
|
|
|
List<Integer> integerList = MtIdToRecordId.get(next); |
|
|
|
// 获取当前类型的管理员
|
|
|
|
List<RoleAndMaterialType> materialTypeIdForIn = roleService.findRoleAndMaterialTypeByMtId(next); |
|
|
|
// 用于存储当前仓库的管理员企业微信userId
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
for (RoleAndMaterialType mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), userToken); |
|
|
|
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()); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
|
redisTemplateForHash.opsForHash().putAll(sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisTemplateForHash.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Iterator<Integer> iterator1 = depositoryIdToRecordId.keySet().iterator(); |
|
|
|
if (iterator1.hasNext()) { |
|
|
|
// 获取当前类别
|
|
|
|
Integer next = iterator1.next(); |
|
|
|
// 获取入库到当前仓库的订单id
|
|
|
|
List<Integer> integerList = depositoryIdToRecordId.get(next); |
|
|
|
// 获取当前类型的管理员
|
|
|
|
List<RoleAndDepository> materialTypeIdForIn = roleService.findRoleAndDepositoryByDid(next); |
|
|
|
// 用于存储当前仓库的管理员企业微信userId
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
for (RoleAndDepository mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), userToken); |
|
|
|
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()); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
|
redisTemplateForHash.opsForHash().putAll(sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisTemplateForHash.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}).start(); |
|
|
|
|
|
|
|
} else if ("out".equals(type)) { |
|
|
|
// 获取部门负责人
|
|
|
|
List<UserByPort> departmentHeadByUsers = LinkInterfaceUtil.findDepartmentHeadByUser(userToken); |
|
|
|
@ -1344,6 +1536,10 @@ public class DepositoryRecordController { |
|
|
|
StringBuilder errMsg = new StringBuilder(); |
|
|
|
Integer id = 0; |
|
|
|
if ("in".equals(type)) { |
|
|
|
List<String> typeList = new ArrayList<>(); |
|
|
|
List<Long> mtIdList = new ArrayList<>(); |
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
|
List<Integer> recordIds = new ArrayList<>(); |
|
|
|
for (int i = 0; i < mids.size(); i++) { |
|
|
|
// 获取库位
|
|
|
|
String placeCode = placeCodes.get(i); |
|
|
|
@ -1375,12 +1571,129 @@ public class DepositoryRecordController { |
|
|
|
Integer addSplitInventory = splitUnitService.addSplitInventory(inRecord); |
|
|
|
if (addSplitInventory != -1) { |
|
|
|
success += addSplitInventory; |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(inRecord.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(inRecord.get("mtId"))); |
|
|
|
typeList.add((String) inRecord.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(inRecord.get("depositoryId"))); |
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
success += depositoryRecordService.applicationInPlace(inRecord, false); |
|
|
|
recordIds.add(ObjectFormatUtil.toInteger(inRecord.get("applicationInId"))); |
|
|
|
mtIdList.add(ObjectFormatUtil.toLong(inRecord.get("mtId"))); |
|
|
|
typeList.add((String) inRecord.get("inType")); |
|
|
|
depositoryIdList.add(ObjectFormatUtil.toInteger(inRecord.get("depositoryId"))); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else if ("out".equals(type)) { |
|
|
|
// 开启一个线程用于发送入库申请
|
|
|
|
new Thread(new Runnable() { |
|
|
|
@Override |
|
|
|
public void run() { |
|
|
|
Map<Long, List<Integer>> MtIdToRecordId = new HashMap<>(); |
|
|
|
Map<Integer, List<Integer>> depositoryIdToRecordId = new HashMap<>(); |
|
|
|
for (int i = 0; i < recordIds.size(); i++) { |
|
|
|
Integer recordId = recordIds.get(i); |
|
|
|
if (recordId != null) { |
|
|
|
// 如果当前id不是空 获取对应的入库仓库id
|
|
|
|
String type = typeList.get(i); |
|
|
|
if("mt".equals(type)){ |
|
|
|
Long mtId = mtIdList.get(i); |
|
|
|
// 将对应仓库与订单id添加映射关系
|
|
|
|
List<Integer> integers = MtIdToRecordId.get(mtId); |
|
|
|
if (integers != null) { |
|
|
|
// 如果有对应关系
|
|
|
|
integers.add(recordId); |
|
|
|
} else { |
|
|
|
// 如果没有
|
|
|
|
integers = new ArrayList<>(); |
|
|
|
integers.add(recordId); |
|
|
|
MtIdToRecordId.put(mtId, integers); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
Integer did = depositoryIdList.get(i); |
|
|
|
// 将对应仓库与订单id添加映射关系
|
|
|
|
List<Integer> integers = depositoryIdToRecordId.get(did); |
|
|
|
if (integers != null) { |
|
|
|
// 如果有对应关系
|
|
|
|
integers.add(recordId); |
|
|
|
} else { |
|
|
|
// 如果没有
|
|
|
|
integers = new ArrayList<>(); |
|
|
|
integers.add(recordId); |
|
|
|
depositoryIdToRecordId.put(did, integers); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 获取遍历器
|
|
|
|
Iterator<Long> iterator = MtIdToRecordId.keySet().iterator(); |
|
|
|
if (iterator.hasNext()) { |
|
|
|
// 获取当前类别
|
|
|
|
Long next = iterator.next(); |
|
|
|
// 获取入库到当前仓库的订单id
|
|
|
|
List<Integer> integerList = MtIdToRecordId.get(next); |
|
|
|
// 获取当前类型的管理员
|
|
|
|
List<RoleAndMaterialType> materialTypeIdForIn = roleService.findRoleAndMaterialTypeByMtId(next); |
|
|
|
// 用于存储当前仓库的管理员企业微信userId
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
for (RoleAndMaterialType mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), userToken); |
|
|
|
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()); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
|
redisTemplateForHash.opsForHash().putAll(sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisTemplateForHash.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Iterator<Integer> iterator1 = depositoryIdToRecordId.keySet().iterator(); |
|
|
|
if (iterator1.hasNext()) { |
|
|
|
// 获取当前类别
|
|
|
|
Integer next = iterator1.next(); |
|
|
|
// 获取入库到当前仓库的订单id
|
|
|
|
List<Integer> integerList = depositoryIdToRecordId.get(next); |
|
|
|
// 获取当前类型的管理员
|
|
|
|
List<RoleAndDepository> materialTypeIdForIn = roleService.findRoleAndDepositoryByDid(next); |
|
|
|
// 用于存储当前仓库的管理员企业微信userId
|
|
|
|
StringBuilder sb = new StringBuilder(); |
|
|
|
for (RoleAndDepository mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), userToken); |
|
|
|
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()); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
QyWxApprovalMap.put("mainId", integerList.toString()); |
|
|
|
redisTemplateForHash.opsForHash().putAll(sp_no, QyWxApprovalMap); |
|
|
|
// 设置过期为7天
|
|
|
|
redisTemplateForHash.expire(sp_no, 7, TimeUnit.DAYS); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}).start(); |
|
|
|
} |
|
|
|
else if ("out".equals(type)) { |
|
|
|
Map<String, Object> mainRecord = new HashMap<>(); |
|
|
|
Integer sumQuantity = 0; |
|
|
|
for (Object o : quantitys) { |
|
|
|
|