|
|
@ -732,10 +732,26 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
flagForApproval = true; |
|
|
flagForApproval = true; |
|
|
StringBuilder approverId = new StringBuilder(); |
|
|
StringBuilder approverId = new StringBuilder(); |
|
|
for (RoleAndDepository roleAndDepository : roleAndDepositoryByDid) { |
|
|
for (RoleAndDepository roleAndDepository : roleAndDepositoryByDid) { |
|
|
approverId.append(roleAndDepository.getUserId()).append(","); |
|
|
// 获取该权限类型
|
|
|
|
|
|
int classes = roleAndDepository.getClasses(); |
|
|
|
|
|
// 获取userid
|
|
|
|
|
|
Integer userId = roleAndDepository.getUserId(); |
|
|
|
|
|
if (classes == 1) { |
|
|
|
|
|
// 如果是对人设置权限
|
|
|
|
|
|
approverId.append(userId).append(","); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果是对岗位
|
|
|
|
|
|
|
|
|
|
|
|
// 定义用于获取当前岗位下的人的参数map
|
|
|
|
|
|
Map<String, Object> paramForGetUserByPost = new HashMap<>(); |
|
|
|
|
|
paramForGetUserByPost.put("position", roleAndDepository.getUserId()); |
|
|
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, null, null); |
|
|
|
|
|
for (UserByPort userByPort : userByPortList) { |
|
|
|
|
|
approverId.append(userByPort.getId()).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
map.put("approverId", approverId.toString()); |
|
|
map.put("approverId", approverId.toString()); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
if (isApprovalPass) { |
|
|
if (isApprovalPass) { |
|
|
if (flagForApproval) { |
|
|
if (flagForApproval) { |
|
|
@ -752,12 +768,23 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
map.put("inType", "mt"); |
|
|
map.put("inType", "mt"); |
|
|
// 获取当前类别物料是否需要审批
|
|
|
// 获取当前类别物料是否需要审批
|
|
|
List<RoleAndMaterialType> roleAndMaterials = roleService.findRoleAndMaterialTypeByMtId(materialById.getMaterialTypeId()); |
|
|
List<RoleAndMaterialType> roleAndMaterials = roleService.findRoleAndMaterialTypeByMtId(materialById.getMaterialTypeId()); |
|
|
|
|
|
|
|
|
if (roleAndMaterials.size() > 0) { |
|
|
if (roleAndMaterials.size() > 0) { |
|
|
flagForApproval = true; |
|
|
flagForApproval = true; |
|
|
StringBuilder approverId = new StringBuilder(); |
|
|
StringBuilder approverId = new StringBuilder(); |
|
|
for (RoleAndMaterialType roleAndMaterialType : roleAndMaterials) { |
|
|
for (RoleAndMaterialType roleAndMaterialType : roleAndMaterials) { |
|
|
approverId.append(roleAndMaterialType.getUid()).append(","); |
|
|
Integer classes = roleAndMaterialType.getClasses(); |
|
|
|
|
|
Integer uid = roleAndMaterialType.getUid(); |
|
|
|
|
|
if (classes == 1) { |
|
|
|
|
|
approverId.append(uid).append(","); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 定义用于获取当前岗位下的人的参数map
|
|
|
|
|
|
Map<String, Object> paramForGetUserByPost = new HashMap<>(); |
|
|
|
|
|
paramForGetUserByPost.put("position", uid); |
|
|
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, null, null); |
|
|
|
|
|
for (UserByPort userByPort : userByPortList) { |
|
|
|
|
|
approverId.append(userByPort.getId()).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
map.put("approverId", approverId.toString()); |
|
|
map.put("approverId", approverId.toString()); |
|
|
} |
|
|
} |
|
|
@ -2277,6 +2304,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
if (!flagForMtOrDepository) { |
|
|
if (!flagForMtOrDepository) { |
|
|
// 如果是通过类型
|
|
|
// 如果是通过类型
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
|
|
|
|
|
// 获取当前仓库下的子订单
|
|
|
// 获取当前仓库下的子订单
|
|
|
Long materialTypeId = inventory.getMaterialTypeId(); |
|
|
Long materialTypeId = inventory.getMaterialTypeId(); |
|
|
if (!findThisIdIsExistForMaterialType(materialTypeIdList, materialTypeId)) { |
|
|
if (!findThisIdIsExistForMaterialType(materialTypeIdList, materialTypeId)) { |
|
|
@ -2292,26 +2321,46 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
minIdList.add(applicationOutRecordMin.getId()); |
|
|
minIdList.add(applicationOutRecordMin.getId()); |
|
|
minIdByMaterialType.put("materialType" + materialTypeId, minIdList); |
|
|
minIdByMaterialType.put("materialType" + materialTypeId, minIdList); |
|
|
|
|
|
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
// 获取该物料所处类型的管理员
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
userIdByDid = roleService.findUserIdByMtId(inventory.getMaterialTypeId()); |
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
// 用于查询对应的管理员权限
|
|
|
|
|
|
Map<String, Object> paramForUserManager = new HashMap<>(); |
|
|
|
|
|
paramForUserManager.put("mtid", materialTypeId); |
|
|
|
|
|
|
|
|
|
|
|
List<RoleAndMaterialType> roleAndMaterialTypeByCondition = roleService.findRoleAndMaterialTypeByCondition(paramForUserManager); |
|
|
|
|
|
for (RoleAndMaterialType roleAndMaterialType : roleAndMaterialTypeByCondition) { |
|
|
|
|
|
int classes = roleAndMaterialType.getClasses(); |
|
|
|
|
|
if (classes == 1) { |
|
|
|
|
|
// 如果是对人设置的权限
|
|
|
|
|
|
userIdByDid.add(roleAndMaterialType.getUid()); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果是对岗位
|
|
|
|
|
|
|
|
|
|
|
|
// 定义用于获取当前岗位下的人的参数map
|
|
|
|
|
|
Map<String, Object> paramForGetUserByPost = new HashMap<>(); |
|
|
|
|
|
paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); |
|
|
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); |
|
|
|
|
|
for (UserByPort userByPort1 : userByPortList) { |
|
|
|
|
|
Integer userId1 = userByPort1.getId(); |
|
|
|
|
|
// 修改redis中用户的数据
|
|
|
|
|
|
updateRedisDataForUserManager(userId1, minRecordKey); |
|
|
|
|
|
minRecordManage.append(userId1).append(","); |
|
|
|
|
|
// 获取企业微信id或微信id
|
|
|
|
|
|
String userByPortWorkwechat = userByPort1.getWorkwechat(); |
|
|
|
|
|
if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { |
|
|
|
|
|
userByPortWorkwechat = userByPort1.getWechat(); |
|
|
|
|
|
} |
|
|
|
|
|
QyWxUid.append(userByPortWorkwechat).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Integer integer : userIdByDid) { |
|
|
for (Integer integer : userIdByDid) { |
|
|
// 获取仓库管理员信息
|
|
|
// 获取仓库管理员信息
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, null, null); |
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); |
|
|
// 仓库管理员订单信息
|
|
|
updateRedisDataForUserManager(integer, minRecordKey); |
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
|
|
// 用户当前子订单
|
|
|
|
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
|
|
|
StringBuilder minRecordList = new StringBuilder(userMinRecord); // 转为stringbuilder类型
|
|
|
|
|
|
minRecordList.insert(1, minRecordKey + ",");// 将当前子订单插入头部
|
|
|
|
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
// 更新redis中用户记录
|
|
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
|
|
|
minRecordManage.append(integer).append(","); |
|
|
minRecordManage.append(integer).append(","); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
@ -2335,6 +2384,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果是通过仓库
|
|
|
// 如果是通过仓库
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
|
|
|
|
|
if (!findThisIdIsExistForDepository(depositoryIdList, depositoryId)) { |
|
|
if (!findThisIdIsExistForDepository(depositoryIdList, depositoryId)) { |
|
|
// 如果当前仓库id没有存入过
|
|
|
// 如果当前仓库id没有存入过
|
|
|
depositoryIdList.add(depositoryId); |
|
|
depositoryIdList.add(depositoryId); |
|
|
@ -2350,24 +2401,45 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
userIdByDid = roleService.findUserIdByDid(depositoryId); |
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
// 用于查询对应的管理员权限
|
|
|
|
|
|
Map<String, Object> paramForUserManager = new HashMap<>(); |
|
|
|
|
|
paramForUserManager.put("depositoryId", depositoryId); |
|
|
|
|
|
|
|
|
|
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(paramForUserManager); |
|
|
|
|
|
for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { |
|
|
|
|
|
int classes = roleAndDepository.getClasses(); |
|
|
|
|
|
if (classes == 1) { |
|
|
|
|
|
// 如果是对人设置的权限
|
|
|
|
|
|
userIdByDid.add(roleAndDepository.getUserId()); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果是对岗位
|
|
|
|
|
|
|
|
|
|
|
|
// 定义用于获取当前岗位下的人的参数map
|
|
|
|
|
|
Map<String, Object> paramForGetUserByPost = new HashMap<>(); |
|
|
|
|
|
paramForGetUserByPost.put("position", roleAndDepository.getUserId()); |
|
|
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); |
|
|
|
|
|
for (UserByPort userByPort1 : userByPortList) { |
|
|
|
|
|
Integer userId1 = userByPort1.getId(); |
|
|
|
|
|
// 修改redis中用户的数据
|
|
|
|
|
|
updateRedisDataForUserManager(userId1, minRecordKey); |
|
|
|
|
|
minRecordManage.append(userId1).append(","); |
|
|
|
|
|
// 获取企业微信id或微信id
|
|
|
|
|
|
String userByPortWorkwechat = userByPort1.getWorkwechat(); |
|
|
|
|
|
if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { |
|
|
|
|
|
userByPortWorkwechat = userByPort1.getWechat(); |
|
|
|
|
|
} |
|
|
|
|
|
QyWxUid.append(userByPortWorkwechat).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Integer integer : userIdByDid) { |
|
|
for (Integer integer : userIdByDid) { |
|
|
|
|
|
// 修改redis中用户的数据
|
|
|
|
|
|
updateRedisDataForUserManager(integer, minRecordKey); |
|
|
// 获取仓库管理员信息
|
|
|
// 获取仓库管理员信息
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, null, null); |
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); |
|
|
// 仓库管理员订单信息
|
|
|
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
|
|
// 用户当前子订单
|
|
|
|
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
|
|
|
StringBuilder minRecordList = new StringBuilder(userMinRecord); // 转为stringbuilder类型
|
|
|
|
|
|
minRecordList.insert(1, minRecordKey + ",");// 将当前子订单插入头部
|
|
|
|
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
// 更新redis中用户记录
|
|
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
|
|
|
minRecordManage.append(integer).append(","); |
|
|
minRecordManage.append(integer).append(","); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
@ -2421,8 +2493,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 将当前redis中存储的spno删除
|
|
|
// 将当前redis中存储的spno删除
|
|
|
redisPool.getRedisTemplateByDb(14).delete("wms_QyWxMessage_" + spNo); |
|
|
redisPool.getRedisTemplateByDb(14).delete("wms_QyWxMessage_" + spNo); |
|
|
} |
|
|
} |
|
|
} |
|
|
} else { |
|
|
else { |
|
|
|
|
|
// 如果是部门负责人
|
|
|
// 如果是部门负责人
|
|
|
|
|
|
|
|
|
String departmentheadTime = recordP.getDepartmentheadTime(); |
|
|
String departmentheadTime = recordP.getDepartmentheadTime(); |
|
|
@ -2779,6 +2850,28 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 修改redis中用户当前的子订单数据 |
|
|
|
|
|
* |
|
|
|
|
|
* @param integer 用户id |
|
|
|
|
|
* @param minRecordKey |
|
|
|
|
|
*/ |
|
|
|
|
|
private void updateRedisDataForUserManager(Integer integer, String minRecordKey) { |
|
|
|
|
|
// 仓库管理员订单信息
|
|
|
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
|
|
// 用户当前子订单
|
|
|
|
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
|
|
|
StringBuilder minRecordList = new StringBuilder(userMinRecord); // 转为stringbuilder类型
|
|
|
|
|
|
minRecordList.insert(1, minRecordKey + ",");// 将当前子订单插入头部
|
|
|
|
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
// 更新redis中用户记录
|
|
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 审核申请 |
|
|
* 审核申请 |
|
|
* |
|
|
* |
|
|
@ -3019,6 +3112,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
if (!flagForMtOrDepository) { |
|
|
if (!flagForMtOrDepository) { |
|
|
// 如果是通过类型
|
|
|
// 如果是通过类型
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于存储企业微信uid
|
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
// 获取具体物料类型
|
|
|
// 获取具体物料类型
|
|
|
Long materialTypeId = inventory.getMaterialTypeId(); |
|
|
Long materialTypeId = inventory.getMaterialTypeId(); |
|
|
if (!findThisIdIsExistForMaterialType(materialTypeIdList, materialTypeId)) { |
|
|
if (!findThisIdIsExistForMaterialType(materialTypeIdList, materialTypeId)) { |
|
|
@ -3034,26 +3130,46 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
minIdList.add(applicationOutRecordMin.getId()); |
|
|
minIdList.add(applicationOutRecordMin.getId()); |
|
|
minIdByMaterialType.put("materialType" + materialTypeId, minIdList); |
|
|
minIdByMaterialType.put("materialType" + materialTypeId, minIdList); |
|
|
|
|
|
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
// 获取该物料所处类型的管理员
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
userIdByDid = roleService.findUserIdByMtId(inventory.getMaterialTypeId()); |
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
// 用于查询对应的管理员权限
|
|
|
|
|
|
Map<String, Object> paramForUserManager = new HashMap<>(); |
|
|
|
|
|
paramForUserManager.put("mtid", materialTypeId); |
|
|
|
|
|
|
|
|
|
|
|
List<RoleAndMaterialType> roleAndMaterialTypeByCondition = roleService.findRoleAndMaterialTypeByCondition(paramForUserManager); |
|
|
|
|
|
for (RoleAndMaterialType roleAndMaterialType : roleAndMaterialTypeByCondition) { |
|
|
|
|
|
int classes = roleAndMaterialType.getClasses(); |
|
|
|
|
|
if (classes == 1) { |
|
|
|
|
|
// 如果是对人设置的权限
|
|
|
|
|
|
userIdByDid.add(roleAndMaterialType.getUid()); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果是对岗位
|
|
|
|
|
|
|
|
|
|
|
|
// 定义用于获取当前岗位下的人的参数map
|
|
|
|
|
|
Map<String, Object> paramForGetUserByPost = new HashMap<>(); |
|
|
|
|
|
paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); |
|
|
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); |
|
|
|
|
|
for (UserByPort userByPort : userByPortList) { |
|
|
|
|
|
Integer userId = userByPort.getId(); |
|
|
|
|
|
// 修改redis中用户的数据
|
|
|
|
|
|
updateRedisDataForUserManager(userId, minRecordKey); |
|
|
|
|
|
minRecordManage.append(userId).append(","); |
|
|
|
|
|
// 获取企业微信id或微信id
|
|
|
|
|
|
String userByPortWorkwechat = userByPort.getWorkwechat(); |
|
|
|
|
|
if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { |
|
|
|
|
|
userByPortWorkwechat = userByPort.getWechat(); |
|
|
|
|
|
} |
|
|
|
|
|
QyWxUid.append(userByPortWorkwechat).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Integer integer : userIdByDid) { |
|
|
for (Integer integer : userIdByDid) { |
|
|
// 获取仓库管理员信息
|
|
|
// 获取仓库管理员信息
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); |
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); |
|
|
// 仓库管理员订单信息
|
|
|
updateRedisDataForUserManager(integer, minRecordKey); |
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
|
|
// 用户当前子订单
|
|
|
|
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
|
|
|
StringBuilder minRecordList = new StringBuilder(userMinRecord); // 转为stringbuilder类型
|
|
|
|
|
|
minRecordList.insert(1, minRecordKey + ",");// 将当前子订单插入头部
|
|
|
|
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
// 更新redis中用户记录
|
|
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
|
|
|
minRecordManage.append(integer).append(","); |
|
|
minRecordManage.append(integer).append(","); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
@ -3076,6 +3192,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
} else { |
|
|
} else { |
|
|
// 如果是通过仓库
|
|
|
// 如果是通过仓库
|
|
|
|
|
|
|
|
|
|
|
|
// 用于存储企业微信uid
|
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
|
|
|
|
|
if (!findThisIdIsExistForDepository(depositoryIdList, depositoryId)) { |
|
|
if (!findThisIdIsExistForDepository(depositoryIdList, depositoryId)) { |
|
|
// 如果当前仓库id没有存入过
|
|
|
// 如果当前仓库id没有存入过
|
|
|
@ -3092,24 +3210,45 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
userIdByDid = roleService.findUserIdByDid(depositoryId); |
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
// 用于查询对应的管理员权限
|
|
|
|
|
|
Map<String, Object> paramForUserManager = new HashMap<>(); |
|
|
|
|
|
paramForUserManager.put("depositoryId", depositoryId); |
|
|
|
|
|
|
|
|
|
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(paramForUserManager); |
|
|
|
|
|
for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { |
|
|
|
|
|
int classes = roleAndDepository.getClasses(); |
|
|
|
|
|
if (classes == 1) { |
|
|
|
|
|
// 如果是对人设置的权限
|
|
|
|
|
|
userIdByDid.add(roleAndDepository.getUserId()); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果是对岗位
|
|
|
|
|
|
|
|
|
|
|
|
// 定义用于获取当前岗位下的人的参数map
|
|
|
|
|
|
Map<String, Object> paramForGetUserByPost = new HashMap<>(); |
|
|
|
|
|
paramForGetUserByPost.put("position", roleAndDepository.getUserId()); |
|
|
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); |
|
|
|
|
|
for (UserByPort userByPort : userByPortList) { |
|
|
|
|
|
Integer userId = userByPort.getId(); |
|
|
|
|
|
// 修改redis中用户的数据
|
|
|
|
|
|
updateRedisDataForUserManager(userId, minRecordKey); |
|
|
|
|
|
minRecordManage.append(userId).append(","); |
|
|
|
|
|
// 获取企业微信id或微信id
|
|
|
|
|
|
String userByPortWorkwechat = userByPort.getWorkwechat(); |
|
|
|
|
|
if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { |
|
|
|
|
|
userByPortWorkwechat = userByPort.getWechat(); |
|
|
|
|
|
} |
|
|
|
|
|
QyWxUid.append(userByPortWorkwechat).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Integer integer : userIdByDid) { |
|
|
for (Integer integer : userIdByDid) { |
|
|
|
|
|
// 修改redis中用户的数据
|
|
|
|
|
|
updateRedisDataForUserManager(integer, minRecordKey); |
|
|
// 获取仓库管理员信息
|
|
|
// 获取仓库管理员信息
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); |
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); |
|
|
// 仓库管理员订单信息
|
|
|
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
|
|
// 用户当前子订单
|
|
|
|
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
|
|
|
StringBuilder minRecordList = new StringBuilder(userMinRecord); // 转为stringbuilder类型
|
|
|
|
|
|
minRecordList.insert(1, minRecordKey + ",");// 将当前子订单插入头部
|
|
|
|
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
// 更新redis中用户记录
|
|
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
|
|
|
minRecordManage.append(integer).append(","); |
|
|
minRecordManage.append(integer).append(","); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
@ -3453,6 +3592,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
// 获取具体物料类型
|
|
|
// 获取具体物料类型
|
|
|
Long materialTypeId = inventory.getMaterialTypeId(); |
|
|
Long materialTypeId = inventory.getMaterialTypeId(); |
|
|
|
|
|
|
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
if (!findThisIdIsExistForMaterialType(materialTypeIdList, materialTypeId)) { |
|
|
if (!findThisIdIsExistForMaterialType(materialTypeIdList, materialTypeId)) { |
|
|
// 如果当前仓库id没有存入过
|
|
|
// 如果当前仓库id没有存入过
|
|
|
materialTypeIdList.add(materialTypeId); |
|
|
materialTypeIdList.add(materialTypeId); |
|
|
@ -3466,26 +3607,46 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
minIdList.add(applicationOutRecordMin.getId()); |
|
|
minIdList.add(applicationOutRecordMin.getId()); |
|
|
minIdByMaterialType.put("materialType" + materialTypeId, minIdList); |
|
|
minIdByMaterialType.put("materialType" + materialTypeId, minIdList); |
|
|
|
|
|
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
// 获取该物料所处类型的管理员
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
userIdByDid = roleService.findUserIdByMtId(inventory.getMaterialTypeId()); |
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
// 用于查询对应的管理员权限
|
|
|
|
|
|
Map<String, Object> paramForUserManager = new HashMap<>(); |
|
|
|
|
|
paramForUserManager.put("mtid", materialTypeId); |
|
|
|
|
|
|
|
|
|
|
|
List<RoleAndMaterialType> roleAndMaterialTypeByCondition = roleService.findRoleAndMaterialTypeByCondition(paramForUserManager); |
|
|
|
|
|
for (RoleAndMaterialType roleAndMaterialType : roleAndMaterialTypeByCondition) { |
|
|
|
|
|
int classes = roleAndMaterialType.getClasses(); |
|
|
|
|
|
if (classes == 1) { |
|
|
|
|
|
// 如果是对人设置的权限
|
|
|
|
|
|
userIdByDid.add(roleAndMaterialType.getUid()); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果是对岗位
|
|
|
|
|
|
|
|
|
|
|
|
// 定义用于获取当前岗位下的人的参数map
|
|
|
|
|
|
Map<String, Object> paramForGetUserByPost = new HashMap<>(); |
|
|
|
|
|
paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); |
|
|
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); |
|
|
|
|
|
for (UserByPort userByPort1 : userByPortList) { |
|
|
|
|
|
Integer userId = userByPort1.getId(); |
|
|
|
|
|
// 修改redis中用户的数据
|
|
|
|
|
|
updateRedisDataForUserManager(userId, minRecordKey); |
|
|
|
|
|
minRecordManage.append(userId).append(","); |
|
|
|
|
|
// 获取企业微信id或微信id
|
|
|
|
|
|
String userByPortWorkwechat = userByPort1.getWorkwechat(); |
|
|
|
|
|
if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { |
|
|
|
|
|
userByPortWorkwechat = userByPort1.getWechat(); |
|
|
|
|
|
} |
|
|
|
|
|
QyWxUid.append(userByPortWorkwechat).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Integer integer : userIdByDid) { |
|
|
for (Integer integer : userIdByDid) { |
|
|
// 获取仓库管理员信息
|
|
|
// 获取仓库管理员信息
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); |
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); |
|
|
// 仓库管理员订单信息
|
|
|
updateRedisDataForUserManager(integer, minRecordKey); |
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
|
|
// 用户当前子订单
|
|
|
|
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
|
|
|
StringBuilder minRecordList = new StringBuilder(userMinRecord); // 转为stringbuilder类型
|
|
|
|
|
|
minRecordList.insert(1, minRecordKey + ",");// 将当前子订单插入头部
|
|
|
|
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
// 更新redis中用户记录
|
|
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
|
|
|
minRecordManage.append(integer).append(","); |
|
|
minRecordManage.append(integer).append(","); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
@ -3509,6 +3670,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果是通过仓库
|
|
|
// 如果是通过仓库
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
if (!findThisIdIsExistForDepository(depositoryIdList, depositoryId)) { |
|
|
if (!findThisIdIsExistForDepository(depositoryIdList, depositoryId)) { |
|
|
// 如果当前仓库id没有存入过
|
|
|
// 如果当前仓库id没有存入过
|
|
|
depositoryIdList.add(depositoryId); |
|
|
depositoryIdList.add(depositoryId); |
|
|
@ -3524,24 +3686,45 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
userIdByDid = roleService.findUserIdByDid(depositoryId); |
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
// 用于查询对应的管理员权限
|
|
|
|
|
|
Map<String, Object> paramForUserManager = new HashMap<>(); |
|
|
|
|
|
paramForUserManager.put("depositoryId", depositoryId); |
|
|
|
|
|
|
|
|
|
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(paramForUserManager); |
|
|
|
|
|
for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { |
|
|
|
|
|
int classes = roleAndDepository.getClasses(); |
|
|
|
|
|
if (classes == 1) { |
|
|
|
|
|
// 如果是对人设置的权限
|
|
|
|
|
|
userIdByDid.add(roleAndDepository.getUserId()); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果是对岗位
|
|
|
|
|
|
|
|
|
|
|
|
// 定义用于获取当前岗位下的人的参数map
|
|
|
|
|
|
Map<String, Object> paramForGetUserByPost = new HashMap<>(); |
|
|
|
|
|
paramForGetUserByPost.put("position", roleAndDepository.getUserId()); |
|
|
|
|
|
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); |
|
|
|
|
|
for (UserByPort userByPort1 : userByPortList) { |
|
|
|
|
|
Integer userId = userByPort1.getId(); |
|
|
|
|
|
// 修改redis中用户的数据
|
|
|
|
|
|
updateRedisDataForUserManager(userId, minRecordKey); |
|
|
|
|
|
minRecordManage.append(userId).append(","); |
|
|
|
|
|
// 获取企业微信id或微信id
|
|
|
|
|
|
String userByPortWorkwechat = userByPort1.getWorkwechat(); |
|
|
|
|
|
if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { |
|
|
|
|
|
userByPortWorkwechat = userByPort1.getWechat(); |
|
|
|
|
|
} |
|
|
|
|
|
QyWxUid.append(userByPortWorkwechat).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (Integer integer : userIdByDid) { |
|
|
for (Integer integer : userIdByDid) { |
|
|
|
|
|
// 修改redis中用户的数据
|
|
|
|
|
|
updateRedisDataForUserManager(integer, minRecordKey); |
|
|
// 获取仓库管理员信息
|
|
|
// 获取仓库管理员信息
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); |
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); |
|
|
// 仓库管理员订单信息
|
|
|
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
|
|
// 用户当前子订单
|
|
|
|
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
|
|
|
StringBuilder minRecordList = new StringBuilder(userMinRecord); // 转为stringbuilder类型
|
|
|
|
|
|
minRecordList.insert(1, minRecordKey + ",");// 将当前子订单插入头部
|
|
|
|
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
// 更新redis中用户记录
|
|
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
|
|
|
minRecordManage.append(integer).append(","); |
|
|
minRecordManage.append(integer).append(","); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
String workwechat = manager.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|