From 32c866f14944984278731a1bb847652eaedc308f Mon Sep 17 00:00:00 2001 From: erdanergou Date: Thu, 25 May 2023 09:38:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A5=E5=BA=93=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DepositoryRecordController.java | 94 ++++++++++++++----- 1 file changed, 69 insertions(+), 25 deletions(-) diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java index 31f785e7..929d325f 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -453,13 +453,35 @@ public class DepositoryRecordController { StringBuilder sb = new StringBuilder(); for (RoleAndMaterialType mt : materialTypeIdForIn ) { - // 获取管理员数据 - UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), finalUserKey, finalToken); - String workwechat = userByPort.getWorkwechat(); - if (workwechat == null || "".equals(workwechat)) { - workwechat = userByPort.getWechat(); + + int classes = mt.getClasses(); + Integer uid = mt.getUid(); + if (classes == 1) { + // 如果是个人 + + // 获取管理员数据 + UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserKey, finalToken); + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } else { + // 如果是岗位 + + // 定义用于获取当前岗位下的人的参数map + Map paramForGetUserByPost = new HashMap<>(); + paramForGetUserByPost.put("position", uid); + List userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, null, null); + for (UserByPort userByPort : userByPortList) { + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } } - sb.append(workwechat).append(","); + } JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserKey, finalToken); String sp_no = jsonObject.getString("sp_no"); @@ -484,13 +506,35 @@ public class DepositoryRecordController { StringBuilder sb = new StringBuilder(); for (RoleAndDepository mt : materialTypeIdForIn ) { - // 获取管理员数据 - UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), finalUserKey, finalToken); - String workwechat = userByPort.getWorkwechat(); - if (workwechat == null || "".equals(workwechat)) { - workwechat = userByPort.getWechat(); + + + int classes = mt.getClasses(); + Integer uid = mt.getUserId(); + if (classes == 1) { + // 如果是个人 + + // 获取管理员数据 + UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserKey, finalToken); + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } else { + // 如果是岗位 + + // 定义用于获取当前岗位下的人的参数map + Map paramForGetUserByPost = new HashMap<>(); + paramForGetUserByPost.put("position", uid); + List userByPortList = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, finalUserKey, finalToken); + for (UserByPort userByPort : userByPortList) { + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } } - sb.append(workwechat).append(","); } JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(crypt, userToken, integerList, sb.toString(), finalUserKey, finalToken); String sp_no = jsonObject.getString("sp_no"); @@ -677,16 +721,16 @@ public class DepositoryRecordController { Object userId = map.get("userId"); if (userId != null) { UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(userId), userkey, usertoken); - map.put("departmenthead",userByPort.getId()); - map.put("depositoryManager",userToken.getId()); + map.put("departmenthead", userByPort.getId()); + map.put("depositoryManager", userToken.getId()); } else { List departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toInteger(map.get("adminorgId")), userkey, usertoken); StringBuilder departmentHeadId = new StringBuilder(); for (UserByPort departmentHeadByUser : departmentHeadByUsers) { departmentHeadId.append(departmentHeadByUser.getId()).append(","); } - map.put("departmenthead",userToken.getId()); - map.put("depositoryManager",departmentHeadId.toString()); + map.put("departmenthead", userToken.getId()); + map.put("depositoryManager", departmentHeadId.toString()); } List params = (List) map.get("params"); Integer integer = 0; @@ -995,26 +1039,26 @@ public class DepositoryRecordController { inventory.setBrand(""); brand = ""; } - if(version == null){ + if (version == null) { inventory.setVersion(""); version = ""; } // 获取出库物料仓库Id Integer depositoryId = applicationOutRecordMin.getDepositoryId(); - if(!depositoryIdList.contains(depositoryId)){ + if (!depositoryIdList.contains(depositoryId)) { depositoryIdList.add(depositoryId); } String inventoryMname = inventory.getMname(); mname.append(inventoryMname).append(","); mcode.append(inventory.getCode()).append(","); - String mversionItem = brand + " "+version; + String mversionItem = brand + " " + version; mversion.append(mversionItem).append(","); - mnameForMobiles.add(inventoryMname+":"+mversionItem); + mnameForMobiles.add(inventoryMname + ":" + mversionItem); sumQuantity += applicationOutRecordMin.getQuantity(); String unit = applicationOutRecordMin.getUnit(); if ("-1".equals(unit)) { - double amounts = ObjectFormatUtil.multiply(inventory.getPrice(),applicationOutRecordMin.getQuantity()); - sumPrice = ObjectFormatUtil.sum(sumPrice,amounts); + double amounts = ObjectFormatUtil.multiply(inventory.getPrice(), applicationOutRecordMin.getQuantity()); + sumPrice = ObjectFormatUtil.sum(sumPrice, amounts); } else { // 获取当前对应的拆单记录 Map paramForSplitInfo = new HashMap<>(); @@ -1025,15 +1069,15 @@ public class DepositoryRecordController { int splitInfoScaleQuantity = splitUnitService.findSplitInfoScaleQuantity(splitInfo, -1); BigDecimal bg = new BigDecimal(inventory.getPrice() / splitInfoScaleQuantity * applicationOutRecordMin.getQuantity()); double newprice = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); - sumPrice = ObjectFormatUtil.sum(sumPrice,newprice); + sumPrice = ObjectFormatUtil.sum(sumPrice, newprice); } } outRecordP.setMcode(mcode.toString()); outRecordP.setMname(mname.toString()); outRecordP.setMversion(mversion.toString()); List depositoryList = depositoryService.findDepositoryByIds(depositoryIdList); - for (Depository depository:depositoryList - ) { + for (Depository depository : depositoryList + ) { depositoryName.append(depository.getDname()).append(","); } outRecordP.setDepositoryName(depositoryName.toString());