|
|
|
@ -224,7 +224,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Integer insertApplicationOutRecord(Map<String, Object> map, UserByPort userToken) { |
|
|
|
public Integer insertApplicationOutRecord(Map<String, Object> map, UserByPort userToken,String userKey,String token) { |
|
|
|
String placeId = ""; |
|
|
|
Object temp = map.get("placeId"); |
|
|
|
String depositoryId = (String) map.get("depositoryId"); |
|
|
|
@ -263,7 +263,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(materialById.getDepositoryId()); |
|
|
|
dname = depositoryRecordById.getDname(); |
|
|
|
} |
|
|
|
Administration company = LinkInterfaceUtil.getCompany(userToken.getMaindeparment(), userToken); |
|
|
|
Administration company = LinkInterfaceUtil.getCompany(userToken.getMaindeparment(), userKey,token); |
|
|
|
String code = createCode(dname, "outOrderNumber", "out", company.getName()); |
|
|
|
map.put("code", code); |
|
|
|
map.put("pass", 3); |
|
|
|
@ -985,7 +985,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public RestResponse completeApplicationOutMinRecord(Map<String, Object> param, UserByPort userByPort, String userAgent) { |
|
|
|
public RestResponse completeApplicationOutMinRecord(Map<String, Object> param, UserByPort userByPort, String userAgent,String userKey,String token) { |
|
|
|
// 最终返回值
|
|
|
|
RestResponse restResponse = new RestResponse(); |
|
|
|
|
|
|
|
@ -1096,7 +1096,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
restResponse.setStatusInfo(new StatusInfo("出库成功", "出库成功")); |
|
|
|
|
|
|
|
// 进行子订单的相关处理
|
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent,userKey,token); |
|
|
|
|
|
|
|
// 更新入库批次中的物料数量
|
|
|
|
HandlesOtherFunctionalThreadPool.execute(() -> { |
|
|
|
@ -1181,7 +1181,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} |
|
|
|
|
|
|
|
// 进行子订单的相关处理
|
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent,userKey,token); |
|
|
|
|
|
|
|
|
|
|
|
restResponse.setStatus(200); |
|
|
|
@ -1239,7 +1239,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
splitUnitMapper.updateSplitInventory(splitInventory); |
|
|
|
} |
|
|
|
|
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent,userKey,token); |
|
|
|
} else { |
|
|
|
// 如果当前拆单没有父级
|
|
|
|
|
|
|
|
@ -1314,7 +1314,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent,userKey,token); |
|
|
|
|
|
|
|
restResponse.setStatus(200); |
|
|
|
restResponse.setData(""); |
|
|
|
@ -1399,7 +1399,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
transferMaterial(map); |
|
|
|
} |
|
|
|
|
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent,userKey,token); |
|
|
|
|
|
|
|
restResponse.setStatus(200); |
|
|
|
restResponse.setData(""); |
|
|
|
@ -1474,7 +1474,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
transferMaterial(map); |
|
|
|
} |
|
|
|
|
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent); |
|
|
|
updateApplicationMinOutInfo(id, applicationOutMinById, record, trueOut, userByPort, placeId, userAgent,userKey,token); |
|
|
|
|
|
|
|
restResponse.setStatus(200); |
|
|
|
restResponse.setData(""); |
|
|
|
@ -1756,7 +1756,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
public Integer updateOutMinRecordInfo(Map<String, Object> map, UserByPort userToken, String userAgent) { |
|
|
|
public Integer updateOutMinRecordInfo(Map<String, Object> map, UserByPort userToken, String userAgent,String userKey,String token) { |
|
|
|
Integer result = 0; |
|
|
|
|
|
|
|
Integer id = ObjectFormatUtil.toInteger(map.get("id")); |
|
|
|
@ -1808,21 +1808,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 如果是基础单位
|
|
|
|
|
|
|
|
|
|
|
|
/* 不进行审核 |
|
|
|
|
|
|
|
// 设置库存数量
|
|
|
|
inventoryById.setQuantity(inventoryById.getQuantity() + (int) (returnQuantity * 100)); |
|
|
|
// 设置库位数量
|
|
|
|
placeById.setQuantity(placeById.getQuantity() + (int) (returnQuantity * 100)); |
|
|
|
// 设置新映射数量
|
|
|
|
placeAndMaterialByMidAndPid.setQuantity(placeAndMaterialByMidAndPid.getQuantity() + (int) (returnQuantity * 100)); |
|
|
|
// 修改
|
|
|
|
materialMapper.updateInventory(inventoryById); |
|
|
|
placeMapper.updateMaterialAndPlace(placeAndMaterialByMidAndPid); |
|
|
|
placeMapper.UpdatePlace(placeById); |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
Map<String, Object> paramForUpdateSplitInventory = new HashMap<>(); |
|
|
|
paramForUpdateSplitInventory.put("placeId", outRecordMin.getPlaceId()); |
|
|
|
paramForUpdateSplitInventory.put("depositoryId", outRecordMin.getDepositoryId()); |
|
|
|
@ -1844,29 +1829,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} else { |
|
|
|
// 如果是拆单
|
|
|
|
|
|
|
|
/* 不进行审核 |
|
|
|
Map<String, Object> paramForSplitInfo = new HashMap<>(); |
|
|
|
paramForSplitInfo.put("mid", inventoryById.getMid()); |
|
|
|
paramForSplitInfo.put("newUnit", unit); |
|
|
|
// 获取拆单记录
|
|
|
|
SplitInfo splitInfo = splitUnitMapper.findSplitInfoByMidAndUnit(paramForSplitInfo); |
|
|
|
|
|
|
|
Map<String, Object> paramForSplitInventory = new HashMap<>(); |
|
|
|
paramForSplitInventory.put("sid", splitInfo.getId()); |
|
|
|
paramForSplitInventory.put("iid", placeAndMaterialByMidAndPid.getId()); |
|
|
|
// 获取拆单库存记录
|
|
|
|
SplitInventory splitInventory = splitUnitMapper.findSplitInventoryByIidAndSid(paramForSplitInventory); |
|
|
|
|
|
|
|
Map<String, Object> paramForUpdateSplitInventory = new HashMap<>(); |
|
|
|
paramForUpdateSplitInventory.put("placeId", outRecordMin.getPlaceId()); |
|
|
|
paramForUpdateSplitInventory.put("depositoryId", outRecordMin.getDepositoryId()); |
|
|
|
paramForUpdateSplitInventory.put("quantity", returnQuantity); |
|
|
|
paramForUpdateSplitInventory.put("mid", inventoryById.getMid()); |
|
|
|
paramForUpdateSplitInventory.put("unit", unit); |
|
|
|
result = splitUnitService.realInInventoryToDepository(returnQuantity, splitInventory, paramForUpdateSplitInventory, splitInfo, placeAndMaterialByMidAndPid, true); |
|
|
|
if (paramForUpdateSplitInventory.containsKey("applicationInId")) { |
|
|
|
depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(paramForUpdateSplitInventory.get("applicationInId"))); |
|
|
|
}*/ |
|
|
|
Map<String, Object> paramForUpdateSplitInventory = new HashMap<>(); |
|
|
|
paramForUpdateSplitInventory.put("placeId", outRecordMin.getPlaceId()); |
|
|
|
paramForUpdateSplitInventory.put("applicantId", userToken.getId()); |
|
|
|
@ -1903,10 +1865,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 强行完成出库
|
|
|
|
|
|
|
|
// 获取当前出库人员
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(outRecordMin.getCheckId(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(outRecordMin.getCheckId(), userKey,token); |
|
|
|
|
|
|
|
outRecord.setPass(1); |
|
|
|
updateApplicationMinOutInfo(id, outRecordMin, outRecord, (double) (quantity), userByPort, placeById.getId(), userAgent); |
|
|
|
updateApplicationMinOutInfo(id, outRecordMin, outRecord, (double) (quantity), userByPort, placeById.getId(), userAgent,userKey,token); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@ -1922,7 +1884,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
for (RoleAndMaterialType mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), userKey,token); |
|
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
@ -1935,7 +1897,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
for (RoleAndDepository mt : materialTypeIdForIn |
|
|
|
) { |
|
|
|
// 获取管理员数据
|
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), userKey,token); |
|
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
@ -1946,7 +1908,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
List<Integer> integerList = new ArrayList<>(); |
|
|
|
integerList.add(ObjectFormatUtil.toInteger(applicationInId)); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(userAgent, userToken, integerList, sb.toString()); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(userAgent, userToken, integerList, sb.toString(),userKey,token); |
|
|
|
String sp_no = jsonObject.getString("sp_no"); |
|
|
|
Map<String, Object> QyWxApprovalMap = new HashMap<>(); |
|
|
|
QyWxApprovalMap.put("sp_no", sp_no); |
|
|
|
@ -2053,7 +2015,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @param userAgent user-agent |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Double trueOut, UserByPort userByPort, Integer placeId, String userAgent) { |
|
|
|
void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Double trueOut, UserByPort userByPort, Integer placeId, String userAgent,String userKey,String token) { |
|
|
|
String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值
|
|
|
|
// 修改当前已经出库的数量
|
|
|
|
applicationOutMinById.setTrueOut((int) ((trueOut * 100) + applicationOutMinById.getTrueOut())); |
|
|
|
@ -2115,9 +2077,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取主订单单号
|
|
|
|
StringBuilder code = new StringBuilder(record.getCode()); |
|
|
|
// 获取申请用户信息
|
|
|
|
UserByPort applicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userByPort); |
|
|
|
UserByPort applicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey,token); |
|
|
|
// 获取申请用户行政组织
|
|
|
|
Administration company = LinkInterfaceUtil.getCompany(applicantUser.getMaindeparment(), userByPort); |
|
|
|
Administration company = LinkInterfaceUtil.getCompany(applicantUser.getMaindeparment(), userKey,token); |
|
|
|
// 获取部门名称简写
|
|
|
|
String conpanyName = WordUtil.getPinYinHeadChar(company.getName()); |
|
|
|
// 获取仓库名称简写
|
|
|
|
@ -2175,7 +2137,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
continue; |
|
|
|
} |
|
|
|
Integer uid = ObjectFormatUtil.toInteger(s); |
|
|
|
UserByPort depositoryManager = LinkInterfaceUtil.FindUserById(uid, userByPort); |
|
|
|
UserByPort depositoryManager = LinkInterfaceUtil.FindUserById(uid, userKey,token); |
|
|
|
String workwechat = depositoryManager.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
@ -2183,7 +2145,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// depositoryManagerByQyWx.append(workwechat+",");
|
|
|
|
} |
|
|
|
depositoryManagerByQyWx.append("PangFuZhen,"); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendCcMessageToUsers(depositoryManagerByQyWx.toString(), record.getId(), userAgent); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendCcMessageToUsers(depositoryManagerByQyWx.toString(), record.getId(), userAgent,userKey,token); |
|
|
|
|
|
|
|
// 删除redis中本订单
|
|
|
|
redisPool.getRedisTemplateByDb(15).delete("record:" + record.getId()); |
|
|
|
@ -2217,6 +2179,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取审批人
|
|
|
|
Map<String, Object> portInfo = PublicConfig.findUserByQyWxUserId(userId); |
|
|
|
UserByPort userByPort = (UserByPort) portInfo.get("user"); |
|
|
|
String userKey = (String) portInfo.get("key"); |
|
|
|
String token = (String) portInfo.get("token"); |
|
|
|
|
|
|
|
// 用于标志是否更新当前申请明细
|
|
|
|
boolean flag = true; |
|
|
|
@ -2322,7 +2286,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
for (Integer integer : userIdByDid) { |
|
|
|
// 获取仓库管理员信息
|
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, null); |
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, null,null); |
|
|
|
// 仓库管理员订单信息
|
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
// 用户当前子订单
|
|
|
|
@ -2349,7 +2313,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll(minRecordKey, minRecord); |
|
|
|
// 开启线程向仓库管理员发送消息
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent,userKey,token); |
|
|
|
}); |
|
|
|
} else { |
|
|
|
// 如果是通过仓库
|
|
|
|
@ -2374,7 +2338,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
for (Integer integer : userIdByDid) { |
|
|
|
// 获取仓库管理员信息
|
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, null); |
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, null,null); |
|
|
|
// 仓库管理员订单信息
|
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
// 用户当前子订单
|
|
|
|
@ -2402,7 +2366,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 开启线程向仓库管理员发送消息
|
|
|
|
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent,userKey,token); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@ -2459,7 +2423,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(recordP.getDepositoryId()); |
|
|
|
// 获取当前仓库所属的部门
|
|
|
|
String adminorg = depositoryById.getAdminorg(); |
|
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(adminorg),null); |
|
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(adminorg),null,null); |
|
|
|
for (UserByPort departmentHead:departmentHeadByUser |
|
|
|
) { |
|
|
|
depositoryManager.append(departmentHead.getId()).append(","); |
|
|
|
@ -2708,7 +2672,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Integer transferApply(Map<String, Object> map, UserByPort userByPort) { |
|
|
|
public Integer transferApply(Map<String, Object> map, UserByPort userByPort,String userKey,String token) { |
|
|
|
Integer mid = ObjectFormatUtil.toInteger(map.get("mid")); |
|
|
|
double quantity = Double.parseDouble((String) map.get("quantity")); |
|
|
|
Inventory material = materialMapper.findInventoryById(mid); |
|
|
|
@ -2742,7 +2706,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
map.put("transferId", transferId); |
|
|
|
// 获取当前转移物料仓库
|
|
|
|
Depository depositoryRecordById = depositoryMapper.findDepositoryById(material.getDepositoryId()); |
|
|
|
Administration company = LinkInterfaceUtil.getCompany(userByPort.getMaindeparment(), userByPort); |
|
|
|
Administration company = LinkInterfaceUtil.getCompany(userByPort.getMaindeparment(), userKey,token); |
|
|
|
// 生成出库订单
|
|
|
|
map.put("code", createCode(depositoryRecordById.getDname(), "outOrderNumber", "out", company.getName())); |
|
|
|
Object placeId = map.get("fromPlaceId"); |
|
|
|
@ -2803,14 +2767,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Integer review(Map<String, Object> map, Integer userid, UserByPort userToken, String userAgent) { |
|
|
|
public Integer review(Map<String, Object> map, Integer userid, UserByPort userToken, String userAgent,String userKey,String token) { |
|
|
|
Object id = map.get("id"); // 主订单编号
|
|
|
|
ApplicationOutRecord record = depositoryRecordMapper.findApplicationOutRecordPById(ObjectFormatUtil.toInteger(id)); |
|
|
|
map.remove("id"); |
|
|
|
|
|
|
|
List<ApplicationOutRecordMin> minByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(record.getId()); |
|
|
|
// 获取申请用户
|
|
|
|
UserByPort applicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userToken); |
|
|
|
UserByPort applicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey,token); |
|
|
|
// 用于标志该仓库是否为前置仓下的仓库
|
|
|
|
boolean flagForHasOtherDepository = true; //默认是前置仓下的仓库
|
|
|
|
// 获取当前出库是否为开放出库
|
|
|
|
@ -2863,7 +2827,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取当前仓库所属的部门
|
|
|
|
String adminorg = depositoryById.getAdminorg(); |
|
|
|
|
|
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(adminorg),null); |
|
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(adminorg),null,null); |
|
|
|
for (UserByPort departmentHead:departmentHeadByUser |
|
|
|
) { |
|
|
|
depositoryManager.append(departmentHead.getId()).append(","); |
|
|
|
@ -2878,7 +2842,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
|
|
|
// 获取仓储中心负责人
|
|
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(361,userToken); |
|
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(361,userKey,token); |
|
|
|
|
|
|
|
for (UserByPort userByPort : departmentHeadByUser) { |
|
|
|
depositoryManager.append(userByPort.getId()).append(","); |
|
|
|
@ -2896,7 +2860,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toInteger(id), false, userAgent); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toInteger(id), false, userAgent,userKey,token); |
|
|
|
// 将当前返回结果保存到redis中
|
|
|
|
Map<String, Object> QyWxMessageMap = new HashMap<>(); |
|
|
|
QyWxMessageMap.put("MsgId", jsonObject.getString("msgid")); |
|
|
|
@ -2936,7 +2900,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
if ("".equals(s)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userKey,token); |
|
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
@ -2945,7 +2909,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} |
|
|
|
String s = QyWxUid.toString(); |
|
|
|
s = "PangFuZhen,"; |
|
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1); |
|
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1,userKey,token); |
|
|
|
}); |
|
|
|
} |
|
|
|
else { |
|
|
|
@ -3035,7 +2999,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
for (Integer integer : userIdByDid) { |
|
|
|
// 获取仓库管理员信息
|
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, null); |
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey,token); |
|
|
|
// 仓库管理员订单信息
|
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
// 用户当前子订单
|
|
|
|
@ -3062,7 +3026,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll(minRecordKey, minRecord); |
|
|
|
// 开启线程向仓库管理员发送消息
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent,userKey,token); |
|
|
|
}); |
|
|
|
} |
|
|
|
else { |
|
|
|
@ -3088,7 +3052,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
for (Integer integer : userIdByDid) { |
|
|
|
// 获取仓库管理员信息
|
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, null); |
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey,token); |
|
|
|
// 仓库管理员订单信息
|
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
// 用户当前子订单
|
|
|
|
@ -3115,7 +3079,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll(minRecordKey, minRecord); |
|
|
|
// 开启线程向仓库管理员发送消息
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent,userKey,token); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -3130,7 +3094,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
if ("".equals(s)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userKey,token); |
|
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = userByPort.getWechat(); |
|
|
|
@ -3139,7 +3103,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} |
|
|
|
String s = QyWxUid.toString(); |
|
|
|
s = "PangFuZhen,"; |
|
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1); |
|
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1,userKey,token); |
|
|
|
}); |
|
|
|
|
|
|
|
// 将主订单插入到redis中
|
|
|
|
@ -3173,7 +3137,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
// 获取responseCode(key为申请人number)
|
|
|
|
//获取部门负责人信息
|
|
|
|
UserByPort departHead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(record.getDepartmenthead()), userToken); |
|
|
|
UserByPort departHead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(record.getDepartmenthead()), userKey,token); |
|
|
|
String key = "user:" + departHead.getNumber() + ":QyWxOutId:" + id; |
|
|
|
String responseCode = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(key, "responseCode"); |
|
|
|
qyWxOperationService.updateButtonTemplateCardToUnEnable(responseCode, userToken.getName(), finalResult, userAgent); |
|
|
|
@ -3308,6 +3272,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 根据userId获取处理人
|
|
|
|
Map<String, Object> portInfo = PublicConfig.findUserByQyWxUserId(fromUserName); |
|
|
|
UserByPort userByPort = (UserByPort) portInfo.get("user"); |
|
|
|
String userKey = (String) portInfo.get("key"); |
|
|
|
String token = (String) portInfo.get("token"); |
|
|
|
// 获取点击的按钮
|
|
|
|
String eventKey = templateCard.getEventKey(); |
|
|
|
// 将其进行分割
|
|
|
|
@ -3333,7 +3299,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
map.put("departmentheadPass", 1); |
|
|
|
map.put("state", "待仓储中心负责人审核"); |
|
|
|
// 获取仓储中心负责人
|
|
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(361,null); |
|
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(361,null,null); |
|
|
|
StringBuilder depositoryManager = new StringBuilder(); |
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
// for (int i = 0; i < departmentHeadByUser.size(); i++) {
|
|
|
|
@ -3347,7 +3313,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
QyWxUid.append("PangFuZhen" + ","); |
|
|
|
map.put("depositoryManager", depositoryManager.toString()); |
|
|
|
// 向仓储中心负责人发送新的消息
|
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toInteger(outId), false, userAgent); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toInteger(outId), false, userAgent,userKey,token); |
|
|
|
// 将当前返回结果保存到redis中
|
|
|
|
Map<String, Object> QyWxMessageMap = new HashMap<>(); |
|
|
|
QyWxMessageMap.put("MsgId", jsonObject.getString("msgid")); |
|
|
|
@ -3418,13 +3384,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
|
userIdByDid = roleService.findUserIdByMtId(materialById.getMaterialTypeId()); |
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
for (int j = 0; j < userIdByDid.size(); j++) { |
|
|
|
for (Integer integer : userIdByDid) { |
|
|
|
// 获取仓库管理员信息
|
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(userIdByDid.get(j), userByPort); |
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey,token); |
|
|
|
// 仓库管理员订单信息
|
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
// 用户当前子订单
|
|
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + userIdByDid.get(j), "minRecord"); |
|
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
|
@ -3433,8 +3399,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
|
} |
|
|
|
// 更新redis中用户记录
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + userIdByDid.get(j), userRecord); |
|
|
|
minRecordManage.append(userIdByDid.get(j)).append(","); |
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
|
minRecordManage.append(integer).append(","); |
|
|
|
String workwechat = manager.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = manager.getWechat(); |
|
|
|
@ -3447,7 +3413,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll(minRecordKey, minRecord); |
|
|
|
// 开启线程向仓库管理员发送消息
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent,userKey,token); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@ -3902,64 +3868,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据id修改仓库调度记录 |
|
|
|
* |
|
|
|
* @param map 参数map |
|
|
|
* @return 受影响的行数 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Integer updateDepositoryRecord(Map<String, Object> map) { |
|
|
|
return depositoryRecordMapper.updateDepositoryRecord(map); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据id主键查询数据 |
|
|
|
* |
|
|
|
* @param id id |
|
|
|
* @return 该id的数据记录 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public DepositoryRecordP findDepositoryRecordById(Integer id, UserByPort userToken) { |
|
|
|
DepositoryRecord depositoryRecordById = depositoryRecordMapper.findDepositoryRecordById(id); |
|
|
|
return singlePack(depositoryRecordById, userToken); |
|
|
|
} |
|
|
|
|
|
|
|
public Integer checkPass() { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查找所有仓库调度记录 |
|
|
|
* |
|
|
|
* @return 所有的仓库调度记录集合 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<DepositoryRecord> findDepositoryRecordAll() { |
|
|
|
return depositoryRecordMapper.findDepositoryRecordAll(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据条件查询仓库调度记录,同时支持分页查询(需要begin和size参数) |
|
|
|
* |
|
|
|
* @param map 查询参数 |
|
|
|
* @return 符合条件的仓库调度记录集合 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<DepositoryRecordP> findDepositoryRecordPByCondition(Map<String, Object> map, UserByPort userToken) { |
|
|
|
Integer size = 8, page = 1; |
|
|
|
if (map.containsKey("size")) { |
|
|
|
size = ObjectFormatUtil.toInteger(map.get("size")); |
|
|
|
map.put("size", size); |
|
|
|
} |
|
|
|
if (map.containsKey("page")) { |
|
|
|
page = ObjectFormatUtil.toInteger(map.get("page")); |
|
|
|
map.put("begin", (page - 1) * size); |
|
|
|
} |
|
|
|
List<DepositoryRecord> depositoryRecordByCondition = depositoryRecordMapper.findDepositoryRecordByCondition(map); |
|
|
|
return pack(depositoryRecordByCondition, userToken); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据条件查询入库记录,同时支持分页查询 |
|
|
|
* |
|
|
|
@ -3967,7 +3875,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ApplicationInRecordP> findApplicationInRecordPByCondition(Map<String, Object> map, UserByPort userToken) { |
|
|
|
public List<ApplicationInRecordP> findApplicationInRecordPByCondition(Map<String, Object> map, UserByPort userToken,String userKey,String token) { |
|
|
|
Integer size = 10, page = 1; |
|
|
|
if (map.containsKey("size")) { |
|
|
|
size = ObjectFormatUtil.toInteger(map.get("size")); |
|
|
|
@ -3985,7 +3893,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
List<ApplicationInRecordP> result = new ArrayList<>(); |
|
|
|
|
|
|
|
for (ApplicationInRecord applicationInRecord : list) { |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(applicationInRecord.getApplicantId(), userToken); |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(applicationInRecord.getApplicantId(), userKey,token); |
|
|
|
String time = DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecord.getApplicantTime())); |
|
|
|
applicationInRecord.setApplicantName(userByPortById.getName()); |
|
|
|
applicationInRecord.setApplicantTime(time); |
|
|
|
@ -4012,7 +3920,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ApplicationInRecordP> findApplicationInRecordPByUser(UserByPort userByPort, Map<String, Object> map) { |
|
|
|
public List<ApplicationInRecordP> findApplicationInRecordPByUser(UserByPort userByPort, Map<String, Object> map,String userKey,String token) { |
|
|
|
Integer size = 10, page = 1; |
|
|
|
if (map.containsKey("size")) { |
|
|
|
size = ObjectFormatUtil.toInteger(map.get("size")); |
|
|
|
@ -4039,7 +3947,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
List<ApplicationInRecord> list = depositoryRecordMapper.findApplicationInRecordPByUser(map); |
|
|
|
List<ApplicationInRecordP> result = new ArrayList<>(); |
|
|
|
for (ApplicationInRecord applicationInRecord : list) { |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(applicationInRecord.getApplicantId(), userByPort); |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(applicationInRecord.getApplicantId(), userKey,token); |
|
|
|
String time = DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecord.getApplicantTime())); |
|
|
|
applicationInRecord.setApplicantName(userByPortById.getName()); |
|
|
|
applicationInRecord.setApplicantTime(time); |
|
|
|
@ -4081,7 +3989,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ApplicationOutRecordP> findApplicationOutRecordPByUser(UserByPort userByPort, Map<String, Object> map) { |
|
|
|
public List<ApplicationOutRecordP> findApplicationOutRecordPByUser(UserByPort userByPort, Map<String, Object> map,String userKey,String token) { |
|
|
|
if (map.containsKey("applyTime")) { |
|
|
|
String applyTime = (String) map.get("applyTime"); |
|
|
|
map.put("applicantTime", DateUtil.DateTimeByDayToTimeStamp(applyTime)); |
|
|
|
@ -4109,7 +4017,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
List<ApplicationOutRecord> list = depositoryRecordMapper.findApplicationOutRecordPByUser(map); |
|
|
|
List<ApplicationOutRecordP> result = new ArrayList<>(); |
|
|
|
for (ApplicationOutRecord record : list) { |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userByPort); |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey,token); |
|
|
|
String time = DateUtil.TimeStampToDateTime(Long.valueOf(record.getApplicantTime())); |
|
|
|
record.setApplicantName(userByPortById.getName()); |
|
|
|
record.setApplicantTime(time); |
|
|
|
@ -4162,7 +4070,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<ApplicationOutRecordP> findApplicationOutRecordPByCondition(Map<String, Object> map, UserByPort userToken) { |
|
|
|
public List<ApplicationOutRecordP> findApplicationOutRecordPByCondition(Map<String, Object> map, UserByPort userToken,String userKey,String token) { |
|
|
|
Integer size = 10, page = 1; |
|
|
|
if (map.containsKey("size")) { |
|
|
|
size = ObjectFormatUtil.toInteger(map.get("size")); |
|
|
|
@ -4179,7 +4087,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
List<ApplicationOutRecord> list = depositoryRecordMapper.findApplicationOutRecordPByCondition(map); |
|
|
|
List<ApplicationOutRecordP> result = new ArrayList<>(); |
|
|
|
for (ApplicationOutRecord recordP : list) { |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(recordP.getApplicantId(), userToken); |
|
|
|
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(recordP.getApplicantId(), userKey,token); |
|
|
|
String time = DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getApplicantTime())); |
|
|
|
recordP.setApplicantName(userByPortById.getName()); |
|
|
|
recordP.setApplicantTime(time); |
|
|
|
@ -4267,7 +4175,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return 我的任务 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SimpleApplicationOutOrInRecordP> findMyTaskOut(Map<String, Object> map, UserByPort userToken) { |
|
|
|
public List<SimpleApplicationOutOrInRecordP> findMyTaskOut(Map<String, Object> map, String userKey,String token) { |
|
|
|
Integer size = 10, page = 1; |
|
|
|
if (map.containsKey("size")) { |
|
|
|
size = ObjectFormatUtil.toInteger(map.get("size")); |
|
|
|
@ -4278,7 +4186,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
map.put("begin", (page - 1) * size); |
|
|
|
} |
|
|
|
List<SimpleApplicationOutRecord> myTaskOut = depositoryRecordMapper.findMyTaskOut(map); |
|
|
|
return simplePackOut(myTaskOut, userToken); |
|
|
|
return simplePackOut(myTaskOut, userKey,token); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -4288,7 +4196,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @return 我的任务 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<SimpleApplicationOutOrInRecordP> findMyTaskIn(Map<String, Object> map, UserByPort userToken) { |
|
|
|
public List<SimpleApplicationOutOrInRecordP> findMyTaskIn(Map<String, Object> map, String userKey,String token) { |
|
|
|
Integer size = 10, page = 1; |
|
|
|
if (map.containsKey("size")) { |
|
|
|
size = ObjectFormatUtil.toInteger(map.get("size")); |
|
|
|
@ -4299,7 +4207,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
map.put("begin", (page - 1) * size); |
|
|
|
} |
|
|
|
List<SimpleApplicationInRecord> myTaskIn = depositoryRecordMapper.findMyTaskIn(map); |
|
|
|
return simplePackIn(myTaskIn, userToken); |
|
|
|
return simplePackIn(myTaskIn, userKey,token); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -4375,59 +4283,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
return depositoryRecordMapper.findCountByCondition(map); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 计算物料总数 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Double CalculateAllCount(Integer type, String state) { |
|
|
|
List<DepositoryRecord> depositoryRecordAll = depositoryRecordMapper.findDepositoryRecordAll(); |
|
|
|
Double sum = 0.0; |
|
|
|
if (state.isEmpty()) { |
|
|
|
for (int i = 0; i < depositoryRecordAll.size(); i++) { |
|
|
|
if (Integer.compare(depositoryRecordAll.get(i).getType(), type) == 0) { |
|
|
|
sum += depositoryRecordAll.get(i).getQuantity(); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
for (int i = 0; i < depositoryRecordAll.size(); i++) { |
|
|
|
if (Integer.compare(depositoryRecordAll.get(i).getType(), type) == 0 && state.equals(depositoryRecordAll.get(i).getState())) { |
|
|
|
sum += depositoryRecordAll.get(i).getQuantity(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BigDecimal bg = new BigDecimal(sum); |
|
|
|
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
return sum; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 计算物料总额 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Double CalculateAllPrice(Integer type, String state) { |
|
|
|
List<DepositoryRecord> depositoryRecordAll = depositoryRecordMapper.findDepositoryRecordAll(); |
|
|
|
Double sum = 0.0; |
|
|
|
if (state.isEmpty()) { |
|
|
|
for (int i = 0; i < depositoryRecordAll.size(); i++) { |
|
|
|
if (Integer.compare(depositoryRecordAll.get(i).getType(), type) == 0) { |
|
|
|
sum += (depositoryRecordAll.get(i).getPrice() / 100); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
for (int i = 0; i < depositoryRecordAll.size(); i++) { |
|
|
|
if (Integer.compare(depositoryRecordAll.get(i).getType(), type) == 0 && state.equals(depositoryRecordAll.get(i).getState())) { |
|
|
|
sum += (depositoryRecordAll.get(i).getPrice() / 100); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BigDecimal bg = new BigDecimal(sum); |
|
|
|
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
return sum; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 计算入库物料总额 |
|
|
|
@ -4461,77 +4316,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 计算出库物料总额 |
|
|
|
* |
|
|
|
* @param state |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Double CalculateAllApplicationOutPrice(String state) { |
|
|
|
List<ApplicationOutRecord> applicationOutRecordPAll = depositoryRecordMapper.findApplicationOutRecordPAll(); |
|
|
|
double sum = 0.0; |
|
|
|
if (state.isEmpty()) { |
|
|
|
// 如果要获取所有待出库的金额
|
|
|
|
for (ApplicationOutRecord applicationOutRecordP : applicationOutRecordPAll) { |
|
|
|
// 获取所有子物料
|
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("parentId", applicationOutRecordP.getId()); |
|
|
|
List<ApplicationOutRecordMin> minByCondition = depositoryRecordMapper.findApplicationOutMinByCondition(map); |
|
|
|
for (ApplicationOutRecordMin applicationOutRecordMin : minByCondition) { |
|
|
|
Integer mid = applicationOutRecordMin.getMid(); |
|
|
|
Material materialById = materialMapper.findMaterialById(mid); |
|
|
|
if (materialById.getPrice() != null) { |
|
|
|
|
|
|
|
sum += (materialById.getPrice() / 100) * ((double) applicationOutRecordMin.getQuantity() / 100); |
|
|
|
} else { |
|
|
|
sum += 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
// 如果要获取已完成的金额
|
|
|
|
List<ApplicationOutRecordMin> applicationOutMinForComplete = depositoryRecordMapper.findApplicationOutMinForComplete(null); |
|
|
|
for (int i = 0; i < applicationOutMinForComplete.size(); i++) { |
|
|
|
ApplicationOutRecordMin recordMin = applicationOutMinForComplete.get(i); |
|
|
|
Integer mid = recordMin.getMid(); |
|
|
|
Material materialById = materialMapper.findMaterialById(mid); |
|
|
|
if (materialById.getPrice() != null) { |
|
|
|
sum += (materialById.getPrice() / 100) * recordMin.getQuantity(); |
|
|
|
} else { |
|
|
|
sum += 0; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
BigDecimal bg = new BigDecimal(sum); |
|
|
|
sum = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
return sum; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取一段时间内的库存额度 |
|
|
|
* |
|
|
|
* @param start |
|
|
|
* @param end |
|
|
|
* @param type |
|
|
|
* @param depositoryId |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Double findDepositoryRecordByDate(Long end, Long start, Integer type, Integer depositoryId) { |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
map.put("start", start); |
|
|
|
map.put("end", end); |
|
|
|
map.put("type", type); |
|
|
|
map.put("depositoryId", depositoryId); |
|
|
|
if (type == 1) { |
|
|
|
map.put("state", "已入库"); |
|
|
|
} else if (type == 2) { |
|
|
|
map.put("state", "已出库"); |
|
|
|
} |
|
|
|
return depositoryRecordMapper.findDepositoryRecordByDate(map); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取一段时间内的库存额度 |
|
|
|
@ -4594,16 +4378,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
return depositoryRecordMapper.findApplicationOutRecordByDate(map); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据条件获取月份中物料的总额 |
|
|
|
* |
|
|
|
* @param map |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Integer findMaterialCountByMonth(Map<String, Object> map) { |
|
|
|
return depositoryRecordMapper.findMaterialCountByMonth(map); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 根据条件获取月份中的仓库库存数 |
|
|
|
@ -4633,16 +4408,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
return sumCount; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询仓库当天流水 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public Integer findWarehouseRecord(Map<String, Object> map) { |
|
|
|
return depositoryRecordMapper.findWarehouseRecord(map); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据id查询入库记录 |
|
|
|
* |
|
|
|
@ -4975,11 +4740,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @param list SimpleDepositoryRecord集合 |
|
|
|
* @return 包装好的集合 |
|
|
|
*/ |
|
|
|
private List<SimpleApplicationOutOrInRecordP> simplePackOut(List<SimpleApplicationOutRecord> list, UserByPort userToken) { |
|
|
|
private List<SimpleApplicationOutOrInRecordP> simplePackOut(List<SimpleApplicationOutRecord> list, String userKey,String token) { |
|
|
|
List<SimpleApplicationOutOrInRecordP> result = new ArrayList<>(list.size()); |
|
|
|
for (SimpleApplicationOutRecord record : list) { |
|
|
|
SimpleApplicationOutOrInRecordP d = new SimpleApplicationOutOrInRecordP(record); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey,token); |
|
|
|
d.setApplyRemark(d.getApplyRemark() == null ? "" : d.getApplyRemark()); |
|
|
|
d.setApplicantName(userByPort.getName()); |
|
|
|
result.add(d); |
|
|
|
@ -4987,11 +4752,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
private List<SimpleApplicationOutOrInRecordP> simplePackIn(List<SimpleApplicationInRecord> list, UserByPort userToken) { |
|
|
|
private List<SimpleApplicationOutOrInRecordP> simplePackIn(List<SimpleApplicationInRecord> list,String userKey,String token) { |
|
|
|
List<SimpleApplicationOutOrInRecordP> result = new ArrayList<>(list.size()); |
|
|
|
for (SimpleApplicationInRecord record : list) { |
|
|
|
SimpleApplicationOutOrInRecordP d = new SimpleApplicationOutOrInRecordP(record); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userToken); |
|
|
|
UserByPort userByPort = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey,token); |
|
|
|
d.setApplyRemark(d.getApplyRemark() == null ? "" : d.getApplyRemark()); |
|
|
|
d.setApplicantName(userByPort.getName()); |
|
|
|
result.add(d); |
|
|
|
@ -5005,25 +4770,25 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
* @param list DepositoryRecord集合 |
|
|
|
* @return 包装好的集合 |
|
|
|
*/ |
|
|
|
private List<DepositoryRecordP> pack(List<DepositoryRecord> list, UserByPort userByPort) { |
|
|
|
private List<DepositoryRecordP> pack(List<DepositoryRecord> list,String userKey,String token) { |
|
|
|
List<DepositoryRecordP> result = new ArrayList<>(list.size()); |
|
|
|
for (DepositoryRecord record : list) { |
|
|
|
result.add(singlePack(record, userByPort)); |
|
|
|
result.add(singlePack(record, userKey,token)); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
private DepositoryRecordP singlePack(DepositoryRecord record, UserByPort userByPort) { |
|
|
|
private DepositoryRecordP singlePack(DepositoryRecord record,String userKey,String token) { |
|
|
|
DepositoryRecordP d = new DepositoryRecordP(record); |
|
|
|
UserByPort getApplicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userByPort); |
|
|
|
UserByPort getApplicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey,token); |
|
|
|
d.setApplicantName(getApplicantUser.getName()); |
|
|
|
d.setDepositoryName(depositoryMapper.findDepositoryNameById(record.getDepositoryId())); |
|
|
|
if (record.getReviewerId() != null) { |
|
|
|
UserByPort reviewerUser = LinkInterfaceUtil.FindUserById(record.getReviewerId(), userByPort); |
|
|
|
UserByPort reviewerUser = LinkInterfaceUtil.FindUserById(record.getReviewerId(), userKey,token); |
|
|
|
d.setReviewerName(reviewerUser.getName()); |
|
|
|
} |
|
|
|
if (record.getCheckerId() != null) { |
|
|
|
UserByPort checkerUser = LinkInterfaceUtil.FindUserById(record.getCheckerId(), userByPort); |
|
|
|
UserByPort checkerUser = LinkInterfaceUtil.FindUserById(record.getCheckerId(), userKey,token); |
|
|
|
d.setCheckerName(checkerUser.getName()); |
|
|
|
} |
|
|
|
return d; |
|
|
|
|