Browse Source

再次取消个别接口的使用

lwx_dev
erdanergou 2 years ago
parent
commit
9afee6a95f
  1. 60
      src/main/java/com/dreamchaser/depository_manage/config/PublicConfig.java
  2. 53
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java
  3. 8
      src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java
  4. 5
      src/main/java/com/dreamchaser/depository_manage/controller/QyWxOperationController.java
  5. 13
      src/main/java/com/dreamchaser/depository_manage/controller/StockTakingController.java
  6. 113
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  7. 120
      src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java
  8. 40
      src/main/java/com/dreamchaser/depository_manage/service/impl/UserServiceImpl.java

60
src/main/java/com/dreamchaser/depository_manage/config/PublicConfig.java

@ -292,40 +292,6 @@ public class PublicConfig {
return result; return result;
} }
/**
* 获取恒信集团下的所有公司
*
* @param
* @return
*/
public static List<AdministrationP> findAllCompany(String userKey, String userToken) {
String url = external_url + "/org/govlist";
Map<String, Object> map = new HashMap<>();
map.put("superior", "313");
map.put("level", 3);
String jsonString = JSONObject.toJSONString(map);
JSONObject paramObject = JSONObject.parseObject(jsonString);
String post = null;
try {
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userKey, userToken);
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data");
JSONArray list = (JSONArray) data.get("list");
if (list == null) {
list = new JSONArray();
}
Integer total = ObjectFormatUtil.toInteger(data.get("total"));
List<AdministrationP> administrationPList = new ArrayList<>();
for (Object o : list) {
Administration administration = JSONObject.toJavaObject((JSONObject) o, Administration.class);
AdministrationP administrationP = new AdministrationP(administration);
administrationPList.add(administrationP);
}
return administrationPList;
}
/** /**
* 根据用户id查询对应用户 * 根据用户id查询对应用户
@ -451,32 +417,6 @@ public class PublicConfig {
return administrationPList; return administrationPList;
} }
/**
* 根据岗位id查询对应的岗位信息
*
* @param id 岗位id
* @param
* @return 查询结果
*/
public static Post findPostById(Long id, String userKey, String userToken) {
String url = external_url + "/org/getpositioncont";
Map<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("idstr", id.toString());
String jsonString = JSONObject.toJSONString(map);
JSONObject paramObject = JSONObject.parseObject(jsonString);
String post = null;
try {
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userKey, userToken);
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data");
Post object = JSONObject.toJavaObject(data, Post.class);
return object;
}
/** /**
* 获取对应的验证码信息 * 获取对应的验证码信息
* *

53
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java

@ -25,27 +25,32 @@ import java.util.concurrent.*;
@RequestMapping("/repository") @RequestMapping("/repository")
public class DepositoryController { public class DepositoryController {
@Autowired @Autowired
DepositoryService depositoryService; private DepositoryService depositoryService;
@Autowired @Autowired
DepositoryRecordService depositoryRecordService; private DepositoryRecordService depositoryRecordService;
@Autowired @Autowired
MaterialTypeService materialTypeService; private MaterialTypeService materialTypeService;
@Autowired @Autowired
MaterialService materialService; private MaterialService materialService;
@Autowired @Autowired
RoleService roleService; private RoleService roleService;
@Autowired @Autowired
StockTakingService stockTakingService; private StockTakingService stockTakingService;
@Autowired @Autowired
PlaceService placeService; private PlaceService placeService;
@Autowired
private AdministrativeService administrativeService;
@Autowired
private UserService userService;
/** /**
* 获取当前仓库下的库存 * 获取当前仓库下的库存
@ -79,7 +84,7 @@ public class DepositoryController {
} }
List<Depository> list = depositoryService.findDepositoryByCondition(map, userKey, token); List<Depository> list = depositoryService.findDepositoryByCondition(map, userKey, token);
for (Depository depository : list) { for (Depository depository : list) {
Administration company = PublicConfig.getCompany(depository.getCid(), userKey, token); Administration company = administrativeService.findAdministrationById(depository.getCid());
depository.setCname(company.getName()); depository.setCname(company.getName());
} }
return new RestResponse(list, depositoryService.findCountByCondition(map), 200); return new RestResponse(list, depositoryService.findCountByCondition(map), 200);
@ -106,24 +111,27 @@ public class DepositoryController {
token = (String) request.getSession().getAttribute("userToken"); token = (String) request.getSession().getAttribute("userToken");
userKey = (String) request.getSession().getAttribute("userKey"); userKey = (String) request.getSession().getAttribute("userKey");
} }
UserByPort userByPort = AuthenticationTokenPool.getUserToken(token);
if ("".equals(map.get("parentId")) || map.get("parentId") == null) { if ("".equals(map.get("parentId")) || map.get("parentId") == null) {
map.put("parentId", 0); map.put("parentId", 0);
} }
List<Depository> list = depositoryService.findDepositoryByCondition(map, userKey, token); List<Depository> list = depositoryService.findDepositoryByCondition(map, userKey, token);
// 获取所有行政单位 // 获取所有行政单位
Map<String, Object> administration = PublicConfig.findAdministration(userKey, token); Map<String,Object> paramForAdminitions = new HashMap<>();
List<AdministrationP> administrationPList = ObjectFormatUtil.objToList(administration.get("administrationPList"), AdministrationP.class); paramForAdminitions.put("superior", 313);
Integer total = (Integer) administration.get("total"); paramForAdminitions.put("state", 1);
for (int i = 0; i < list.size(); i++) { paramForAdminitions.put("level", 3);;
for (int j = 0; j < administrationPList.size(); j++) { // Map<String, Object> administration = PublicConfig.findAdministration(userKey, token);
if (list.get(i).getCid().compareTo(administrationPList.get(j).getId()) == 0) { // List<AdministrationP> administrationPList = ObjectFormatUtil.objToList(administration.get("administrationPList"), AdministrationP.class);
list.get(i).setCname(administrationPList.get(j).getName()); List<AdministrationP> administrationPList = administrativeService.findAdministrationPListByCondition(paramForAdminitions);
for (Depository depository : list) {
for (AdministrationP administrationP : administrationPList) {
if (depository.getCid().compareTo(administrationP.getId()) == 0) {
depository.setCname(administrationP.getName());
break; break;
} }
} }
} }
return new RestResponse(list, depositoryService.findCountByCondition(map), 200); return new RestResponse(list, administrativeService.findAdministrationPCountByCondition(paramForAdminitions), 200);
} }
@ -1008,7 +1016,7 @@ public class DepositoryController {
Long userId = roleAndDepository.getUserId(); Long userId = roleAndDepository.getUserId();
if (classes == 1) { if (classes == 1) {
// 如果是对人设置的权限 // 如果是对人设置的权限
UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token); UserByPort userByPort = userService.findUserByIdForNoPack(userId);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -1021,7 +1029,7 @@ public class DepositoryController {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", userId); paramForGetUserByPost.put("position", userId);
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
@ -1814,13 +1822,12 @@ public class DepositoryController {
Object obj = null; Object obj = null;
try { try {
obj = completionService.take().get(); obj = completionService.take().get();
} catch (InterruptedException e) { } catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace(); e.printStackTrace();
} }
result.add(obj); result.add(obj);
sum += ObjectFormatUtil.toDouble(((Map<String, Object>) obj).get("value")); Map<String, Object> stringObjectMap = ObjectFormatUtil.objToMap(obj, String.class, Object.class);
sum += ObjectFormatUtil.toDouble(stringObjectMap.get("value"));
} }
// 关闭线程池 // 关闭线程池
PublicConfig.closeThreadPool(exs); PublicConfig.closeThreadPool(exs);

8
src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java

@ -2,7 +2,6 @@ package com.dreamchaser.depository_manage.controller;
import cn.hutool.core.lang.Snowflake; import cn.hutool.core.lang.Snowflake;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PublicConfig;
import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.exception.MyException; import com.dreamchaser.depository_manage.exception.MyException;
import com.dreamchaser.depository_manage.pojo.GroupInfoP; import com.dreamchaser.depository_manage.pojo.GroupInfoP;
@ -49,6 +48,9 @@ public class GroupController {
@Autowired @Autowired
private SplitUnitService splitUnitService; private SplitUnitService splitUnitService;
@Autowired
private UserService userService;
/** /**
* 用于添加一条组合记录 * 用于添加一条组合记录
@ -670,7 +672,7 @@ public class GroupController {
map.put("applicantId", userToken.getId()); map.put("applicantId", userToken.getId());
// 获取当前部门负责人 // 获取当前部门负责人
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(userToken.getMaindeparment(), userkey, token); List<UserByPort> departmentHeadByUsers = userService.getDepartmentHeaderByIdForNoPack(userToken.getMaindeparment());
// 部门负责人id // 部门负责人id
StringBuilder departmentHeadId = new StringBuilder(); StringBuilder departmentHeadId = new StringBuilder();
// 部门负责人企业微信user // 部门负责人企业微信user
@ -830,7 +832,7 @@ public class GroupController {
String crypt = Md5.crypt(header); String crypt = Md5.crypt(header);
map.put("applicantId", userToken.getId()); map.put("applicantId", userToken.getId());
// 获取当前部门负责人 // 获取当前部门负责人
List<UserByPort> departmentHeadByUsers = PublicConfig.findDepartmentHeadByUser(userToken.getMaindeparment(), userkey, token); List<UserByPort> departmentHeadByUsers = userService.getDepartmentHeaderByIdForNoPack(userToken.getMaindeparment());
// 部门负责人id // 部门负责人id
StringBuilder departmentHeadId = new StringBuilder(); StringBuilder departmentHeadId = new StringBuilder();
// 部门负责人企业微信user // 部门负责人企业微信user

5
src/main/java/com/dreamchaser/depository_manage/controller/QyWxOperationController.java

@ -170,8 +170,9 @@ public class QyWxOperationController {
return; return;
} }
// 根据userId获取处理人 // 根据userId获取处理人
Map<String, Object> portInfo = PublicConfig.findUserByQyWxUserId(fromUserName); // Map<String, Object> portInfo = PublicConfig.findUserByQyWxUserId(fromUserName);
UserByPort userByPort = (UserByPort) portInfo.get("user"); // UserByPort userByPort = (UserByPort) portInfo.get("user");
UserByPort userByPort = userService.findUserByWorkWechat(fromUserName);
// 获取点击的按钮 // 获取点击的按钮
String clickKey = templateCard.getEventKey().split("_")[1]; String clickKey = templateCard.getEventKey().split("_")[1];

13
src/main/java/com/dreamchaser/depository_manage/controller/StockTakingController.java

@ -2,7 +2,6 @@ package com.dreamchaser.depository_manage.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PublicConfig;
import com.dreamchaser.depository_manage.entity.MaterialAndPlace; import com.dreamchaser.depository_manage.entity.MaterialAndPlace;
import com.dreamchaser.depository_manage.entity.Place; import com.dreamchaser.depository_manage.entity.Place;
import com.dreamchaser.depository_manage.entity.UserByPort; import com.dreamchaser.depository_manage.entity.UserByPort;
@ -12,10 +11,7 @@ import com.dreamchaser.depository_manage.pojo.StatusInfo;
import com.dreamchaser.depository_manage.security.pool.AuthenticationTokenPool; import com.dreamchaser.depository_manage.security.pool.AuthenticationTokenPool;
import com.dreamchaser.depository_manage.security.pool.RedisPool; import com.dreamchaser.depository_manage.security.pool.RedisPool;
import com.dreamchaser.depository_manage.security.pool.SendQyWxMessageThreadPool; import com.dreamchaser.depository_manage.security.pool.SendQyWxMessageThreadPool;
import com.dreamchaser.depository_manage.service.MaterialService; import com.dreamchaser.depository_manage.service.*;
import com.dreamchaser.depository_manage.service.MaterialTypeService;
import com.dreamchaser.depository_manage.service.PlaceService;
import com.dreamchaser.depository_manage.service.StockTakingService;
import com.dreamchaser.depository_manage.service.impl.QyWxOperationService; import com.dreamchaser.depository_manage.service.impl.QyWxOperationService;
import com.dreamchaser.depository_manage.utils.CrudUtil; import com.dreamchaser.depository_manage.utils.CrudUtil;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
@ -52,6 +48,9 @@ public class StockTakingController {
@Autowired @Autowired
private RedisPool redisPool; private RedisPool redisPool;
@Autowired
private UserService userService;
// 用于添加盘点记录 // 用于添加盘点记录
@PostMapping("/addStockTakingRecord") @PostMapping("/addStockTakingRecord")
public RestResponse addStockTakingRecord(@RequestBody Map<String, Object> map, HttpServletRequest request) { public RestResponse addStockTakingRecord(@RequestBody Map<String, Object> map, HttpServletRequest request) {
@ -77,7 +76,7 @@ public class StockTakingController {
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort departmentManager = PublicConfig.findUserByPortByNumber(s); UserByPort departmentManager = userService.findUserByNumberForNoPack(s);
int emptype = departmentManager.getEmptype(); int emptype = departmentManager.getEmptype();
if (emptype > 10) { if (emptype > 10) {
continue; continue;
@ -453,7 +452,7 @@ public class StockTakingController {
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort departmentManager = PublicConfig.findUserByPortByNumber(s); UserByPort departmentManager = userService.findUserByNumberForNoPack(s);
int emptype = departmentManager.getEmptype(); int emptype = departmentManager.getEmptype();
if (emptype > 10) { if (emptype > 10) {
continue; continue;

113
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -17,10 +17,7 @@ import com.dreamchaser.depository_manage.pojo.callBackXml.callBackXml_button_tem
import com.dreamchaser.depository_manage.security.pool.HandlesOtherFunctionalThreadPool; import com.dreamchaser.depository_manage.security.pool.HandlesOtherFunctionalThreadPool;
import com.dreamchaser.depository_manage.security.pool.RedisPool; import com.dreamchaser.depository_manage.security.pool.RedisPool;
import com.dreamchaser.depository_manage.security.pool.SendQyWxMessageThreadPool; import com.dreamchaser.depository_manage.security.pool.SendQyWxMessageThreadPool;
import com.dreamchaser.depository_manage.service.AdministrativeService; import com.dreamchaser.depository_manage.service.*;
import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.RoleService;
import com.dreamchaser.depository_manage.service.SplitUnitService;
import com.dreamchaser.depository_manage.utils.*; import com.dreamchaser.depository_manage.utils.*;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
@ -75,9 +72,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
@Autowired @Autowired
private GroupMapper groupMapper; private GroupMapper groupMapper;
@Autowired @Autowired
private UserMapper userMapper; private UserService userService;
@Autowired @Autowired
private AdministrativeService administrativeService; private AdministrativeService administrativeService;
@ -277,7 +274,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Depository depositoryRecordById = depositoryMapper.findDepositoryById(materialById.getDepositoryId()); Depository depositoryRecordById = depositoryMapper.findDepositoryById(materialById.getDepositoryId());
dname = depositoryRecordById.getDname(); dname = depositoryRecordById.getDname();
} }
Administration company = PublicConfig.getCompany(userToken.getMaindeparment(), userKey, token); Administration company = administrativeService.findAdministrationById(userToken.getMaindeparment());
String code = createCode(dname, "outOrderNumber", "out", company.getName()); String code = createCode(dname, "outOrderNumber", "out", company.getName());
map.put("code", code); map.put("code", code);
map.put("pass", 3); map.put("pass", 3);
@ -759,7 +756,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", roleAndDepository.getUserId()); paramForGetUserByPost.put("position", roleAndDepository.getUserId());
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -798,7 +795,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", uid); paramForGetUserByPost.put("position", uid);
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -1926,7 +1923,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 强行完成出库 // 强行完成出库
// 获取当前出库人员 // 获取当前出库人员
UserByPort userByPort = userMapper.findUserById(outRecordMin.getCheckId()); UserByPort userByPort = userService.findUserByIdForNoPack(outRecordMin.getCheckId());
outRecord.setPass(1); outRecord.setPass(1);
updateApplicationMinOutInfo(id, outRecordMin, outRecord, (double) (quantity), userByPort, placeById.getId(), userAgent, userKey, token); updateApplicationMinOutInfo(id, outRecordMin, outRecord, (double) (quantity), userByPort, placeById.getId(), userAgent, userKey, token);
@ -1945,7 +1942,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (RoleAndMaterialType mt : materialTypeIdForIn for (RoleAndMaterialType mt : materialTypeIdForIn
) { ) {
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = userMapper.findUserById(mt.getUid()); UserByPort userByPort = userService.findUserByIdForNoPack(mt.getUid());
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -1963,7 +1960,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (RoleAndDepository mt : materialTypeIdForIn for (RoleAndDepository mt : materialTypeIdForIn
) { ) {
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = userMapper.findUserById(mt.getUserId()); UserByPort userByPort = userService.findUserByIdForNoPack(mt.getUserId());
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2309,7 +2306,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取主订单单号 // 获取主订单单号
StringBuilder code = new StringBuilder(record.getCode()); StringBuilder code = new StringBuilder(record.getCode());
// 获取申请用户信息 // 获取申请用户信息
UserByPort applicantUser = userMapper.findUserById(record.getApplicantId()); UserByPort applicantUser = userService.findUserByIdForNoPack(record.getApplicantId());
// 获取申请用户行政组织 // 获取申请用户行政组织
Administration company = PublicConfig.getCompany(applicantUser.getMaindeparment(), userKey, token); Administration company = PublicConfig.getCompany(applicantUser.getMaindeparment(), userKey, token);
// 获取部门名称简写 // 获取部门名称简写
@ -2372,7 +2369,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
continue; continue;
} }
Long uid = ObjectFormatUtil.toLong(s); Long uid = ObjectFormatUtil.toLong(s);
UserByPort depositoryManager = userMapper.findUserById(uid); UserByPort depositoryManager = userService.findUserByIdForNoPack(uid);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = depositoryManager.getEmptype(); int emptype = depositoryManager.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2545,7 +2542,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); paramForGetUserByPost.put("position", roleAndMaterialType.getUid());
// 获取当前岗位对应的人员 // 获取当前岗位对应的人员
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort1 : userByPortList) { for (UserByPort userByPort1 : userByPortList) {
int emptype = userByPort1.getEmptype(); int emptype = userByPort1.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2568,7 +2565,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 将没有插入的用户进行插入 // 将没有插入的用户进行插入
for (Long integer : userIdByMtId) { for (Long integer : userIdByMtId) {
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = userMapper.findUserById(integer); UserByPort manager = userService.findUserByIdForNoPack(integer);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2628,7 +2625,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", roleAndDepository.getUserId()); paramForGetUserByPost.put("position", roleAndDepository.getUserId());
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort1 : userByPortList) { for (UserByPort userByPort1 : userByPortList) {
int emptype = userByPort1.getEmptype(); int emptype = userByPort1.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2653,7 +2650,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 修改redis中用户的数据 // 修改redis中用户的数据
updateRedisDataForUserManager(integer, minRecordKey); updateRedisDataForUserManager(integer, minRecordKey);
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = userMapper.findUserById(integer); UserByPort manager = userService.findUserByIdForNoPack(integer);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = manager.getEmptype(); int emptype = manager.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2779,7 +2776,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
Depository depositoryById = depositoryMapper.findDepositoryById(recordP.getDepositoryId()); Depository depositoryById = depositoryMapper.findDepositoryById(recordP.getDepositoryId());
// 获取当前仓库所属的部门 // 获取当前仓库所属的部门
String adminorg = depositoryById.getAdminorg(); String adminorg = depositoryById.getAdminorg();
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toLong(adminorg), null, null); List<UserByPort> departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(ObjectFormatUtil.toLong(adminorg));
for (UserByPort departmentHead : departmentHeadByUser for (UserByPort departmentHead : departmentHeadByUser
) { ) {
depositoryManager.append(departmentHead.getId()).append(","); depositoryManager.append(departmentHead.getId()).append(",");
@ -2788,8 +2785,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取仓储中心负责人标签的用户userId // 获取仓储中心负责人标签的用户userId
List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserListForLabelName(userAgent, "仓储中心负责人"); List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserListForLabelName(userAgent, "仓储中心负责人");
for (String s : qyWxLabelUserList) { for (String s : qyWxLabelUserList) {
Map<String, Object> userByQyWxUserId = PublicConfig.findUserByQyWxUserId(s); UserByPort user = userService.findUserByWorkWechat(s);
UserByPort user = (UserByPort) userByQyWxUserId.get("user");
depositoryManager.append(user.getId()).append(","); depositoryManager.append(user.getId()).append(",");
} }
} }
@ -2805,8 +2801,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 如果是第一个节点 // 如果是第一个节点
List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserListForLabelName(userAgent, "平衡岗"); List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserListForLabelName(userAgent, "平衡岗");
for (String s : qyWxLabelUserList) { for (String s : qyWxLabelUserList) {
Map<String, Object> userByQyWxUserId = PublicConfig.findUserByQyWxUserId(s); UserByPort user = userService.findUserByWorkWechat(s);
UserByPort user = (UserByPort) userByQyWxUserId.get("user");
balancePoster.append(user.getId()).append(","); balancePoster.append(user.getId()).append(",");
} }
map.put("departmentheadPass", 1); map.put("departmentheadPass", 1);
@ -2824,7 +2819,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("balancePosterTime", DateUtil.DateTimeToTimeStamp(simpleTime)); map.put("balancePosterTime", DateUtil.DateTimeToTimeStamp(simpleTime));
map.put("balancePoster", userByPort.getId()); map.put("balancePoster", userByPort.getId());
// 获取综合办负责人 // 获取综合办负责人
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(268L, userKey, token); List<UserByPort> departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(268L );
StringBuilder departmentId = new StringBuilder(); StringBuilder departmentId = new StringBuilder();
for (UserByPort byPort : departmentHeadByUser) { for (UserByPort byPort : departmentHeadByUser) {
departmentId.append(byPort.getId()).append(","); departmentId.append(byPort.getId()).append(",");
@ -2921,8 +2916,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取审批人userId // 获取审批人userId
String userId = approver.getUserId(); String userId = approver.getUserId();
// 获取审批人 // 获取审批人
Map<String, Object> portInfo = PublicConfig.findUserByQyWxUserId(userId); UserByPort userByPort = userService.findUserByWorkWechat(userId);
UserByPort userByPort = (UserByPort) portInfo.get("user");
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("approverId", userByPort.getId()); map.put("approverId", userByPort.getId());
map.put("approverTime", System.currentTimeMillis()); map.put("approverTime", System.currentTimeMillis());
@ -3102,7 +3096,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("transferId", transferId); map.put("transferId", transferId);
// 获取当前转移物料仓库 // 获取当前转移物料仓库
Depository depositoryRecordById = depositoryMapper.findDepositoryById(material.getDepositoryId()); Depository depositoryRecordById = depositoryMapper.findDepositoryById(material.getDepositoryId());
Administration company = PublicConfig.getCompany(userByPort.getMaindeparment(), userKey, token); Administration company = administrativeService.findAdministrationById(userByPort.getMaindeparment());
// 生成出库订单 // 生成出库订单
map.put("code", createCode(depositoryRecordById.getDname(), "outOrderNumber", "out", company.getName())); map.put("code", createCode(depositoryRecordById.getDname(), "outOrderNumber", "out", company.getName()));
Object placeId = map.get("fromPlaceId"); Object placeId = map.get("fromPlaceId");
@ -3192,7 +3186,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<ApplicationOutRecordMin> minByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(record.getId()); List<ApplicationOutRecordMin> minByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(record.getId());
// 获取申请用户 // 获取申请用户
UserByPort applicantUser = userMapper.findUserById(record.getApplicantId()); UserByPort applicantUser = userService.findUserByIdForNoPack(record.getApplicantId());
// 用于标志该仓库是否为前置仓下的仓库 // 用于标志该仓库是否为前置仓下的仓库
boolean flagForHasOtherDepository = true; //默认是前置仓下的仓库 boolean flagForHasOtherDepository = true; //默认是前置仓下的仓库
// 获取当前出库是否为开放出库 // 获取当前出库是否为开放出库
@ -3278,7 +3272,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取当前仓库所属的部门 // 获取当前仓库所属的部门
String adminorg = depositoryById.getAdminorg(); String adminorg = depositoryById.getAdminorg();
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toLong(adminorg), null, null); List<UserByPort> departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(ObjectFormatUtil.toLong(adminorg));
for (UserByPort departmentHead : departmentHeadByUser for (UserByPort departmentHead : departmentHeadByUser
) { ) {
depositoryManager.append(departmentHead.getId()).append(","); depositoryManager.append(departmentHead.getId()).append(",");
@ -3293,7 +3287,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取仓储中心负责人 // 获取仓储中心负责人
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(361L, userKey, token); List<UserByPort> departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(361L);
for (UserByPort userByPort : departmentHeadByUser) { for (UserByPort userByPort : departmentHeadByUser) {
depositoryManager.append(userByPort.getId()).append(","); depositoryManager.append(userByPort.getId()).append(",");
@ -3312,8 +3306,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 如果是第一个节点 // 如果是第一个节点
List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserListForLabelName(userAgent, "平衡岗"); List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserListForLabelName(userAgent, "平衡岗");
for (String s : qyWxLabelUserList) { for (String s : qyWxLabelUserList) {
Map<String, Object> userByQyWxUserId = PublicConfig.findUserByQyWxUserId(s); UserByPort user = userService.findUserByWorkWechat(s);
UserByPort user = (UserByPort) userByQyWxUserId.get("user");
String workwechat = user.getWorkwechat(); String workwechat = user.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = user.getWechat(); workwechat = user.getWechat();
@ -3343,7 +3336,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(depositorymanager)) { if ("".equals(depositorymanager)) {
continue; continue;
} }
UserByPort depositoryManage = userMapper.findUserById(ObjectFormatUtil.toLong(depositorymanager)); UserByPort depositoryManage = userService.findUserByIdForNoPack(ObjectFormatUtil.toLong(depositorymanager));
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = depositoryManage.getEmptype(); int emptype = depositoryManage.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -3360,7 +3353,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toLong(id), false, userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toLong(id), false, userAgent);
// 将当前返回结果保存到redis中 // 将当前返回结果保存到redis中
Map<String, Object> QyWxMessageMap = new HashMap<>(); Map<String, Object> QyWxMessageMap = new HashMap<>();
QyWxMessageMap.put("MsgId", jsonObject.getString("msgid")); QyWxMessageMap.put("MsgId", jsonObject.getString("msgid"));
@ -3402,7 +3395,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort userByPort = userMapper.findUserById(ObjectFormatUtil.toLong(s)); UserByPort userByPort = userService.findUserByIdForNoPack(ObjectFormatUtil.toLong(s));
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -3438,7 +3431,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取综合办负责人 // 获取综合办负责人
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(268L, userKey, token); List<UserByPort> departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(268L);
for (UserByPort userByPort : departmentHeadByUser) { for (UserByPort userByPort : departmentHeadByUser) {
depositoryManager.append(userByPort.getId()).append(","); depositoryManager.append(userByPort.getId()).append(",");
@ -3463,7 +3456,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(depositorymanager)) { if ("".equals(depositorymanager)) {
continue; continue;
} }
UserByPort depositoryManage = userMapper.findUserById(ObjectFormatUtil.toLong(depositorymanager)); UserByPort depositoryManage = userService.findUserByIdForNoPack(ObjectFormatUtil.toLong(depositorymanager));
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = depositoryManage.getEmptype(); int emptype = depositoryManage.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -3480,7 +3473,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toLong(id), false, userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toLong(id), false, userAgent);
// 将当前返回结果保存到redis中 // 将当前返回结果保存到redis中
Map<String, Object> QyWxMessageMap = new HashMap<>(); Map<String, Object> QyWxMessageMap = new HashMap<>();
QyWxMessageMap.put("MsgId", jsonObject.getString("msgid")); QyWxMessageMap.put("MsgId", jsonObject.getString("msgid"));
@ -3522,7 +3515,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort userByPort = userMapper.findUserById(ObjectFormatUtil.toLong(s)); UserByPort userByPort = userService.findUserByIdForNoPack(ObjectFormatUtil.toLong(s));
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -3641,7 +3634,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); paramForGetUserByPost.put("position", roleAndMaterialType.getUid());
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -3664,7 +3657,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (Long integer : userIdByDid) { for (Long integer : userIdByDid) {
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = userMapper.findUserById(integer); UserByPort manager = userService.findUserByIdForNoPack(integer);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = manager.getEmptype(); int emptype = manager.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -3728,7 +3721,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", roleAndDepository.getUserId()); paramForGetUserByPost.put("position", roleAndDepository.getUserId());
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -3753,7 +3746,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 修改redis中用户的数据 // 修改redis中用户的数据
updateRedisDataForUserManager(integer, minRecordKey); updateRedisDataForUserManager(integer, minRecordKey);
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = userMapper.findUserById(integer); UserByPort manager = userService.findUserByIdForNoPack(integer);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = manager.getEmptype(); int emptype = manager.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -3791,7 +3784,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort userByPort = userMapper.findUserById(ObjectFormatUtil.toLong(s)); UserByPort userByPort = userService.findUserByIdForNoPack(ObjectFormatUtil.toLong(s));
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -3838,7 +3831,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
// 获取responseCode(key为申请人number) // 获取responseCode(key为申请人number)
//获取部门负责人信息 //获取部门负责人信息
UserByPort departHead = userMapper.findUserById(ObjectFormatUtil.toLong(record.getDepartmenthead())); UserByPort departHead = userService.findUserByIdForNoPack(ObjectFormatUtil.toLong(record.getDepartmenthead()));
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = departHead.getEmptype(); int emptype = departHead.getEmptype();
if (emptype <= 10) { if (emptype <= 10) {
@ -4010,7 +4003,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
String depositoryManagerString = recordP.getDepositoryManager(); String depositoryManagerString = recordP.getDepositoryManager();
if (depositoryManagerString == null) { if (depositoryManagerString == null) {
// 获取仓储中心负责人 // 获取仓储中心负责人
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(361L, null, null); List<UserByPort> departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(361L);
StringBuilder depositoryManager = new StringBuilder(); StringBuilder depositoryManager = new StringBuilder();
// for (UserByPort byPort : departmentHeadByUser) { // for (UserByPort byPort : departmentHeadByUser) {
// int emptype = byPort.getEmptype(); // int emptype = byPort.getEmptype();
@ -4033,7 +4026,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort userById = userMapper.findUserById(ObjectFormatUtil.toLong(s)); UserByPort userById = userService.findUserByIdForNoPack(ObjectFormatUtil.toLong(s));
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userById.getEmptype(); int emptype = userById.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -4049,7 +4042,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} }
// 向仓储中心负责人发送新的消息 // 向仓储中心负责人发送新的消息
JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toLong(outId), false, userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toLong(outId), false, userAgent);
// 将当前返回结果保存到redis中 // 将当前返回结果保存到redis中
Map<String, Object> QyWxMessageMap = new HashMap<>(); Map<String, Object> QyWxMessageMap = new HashMap<>();
QyWxMessageMap.put("MsgId", jsonObject.getString("msgid")); QyWxMessageMap.put("MsgId", jsonObject.getString("msgid"));
@ -4156,7 +4149,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); paramForGetUserByPost.put("position", roleAndMaterialType.getUid());
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort1 : userByPortList) { for (UserByPort userByPort1 : userByPortList) {
int emptype = userByPort1.getEmptype(); int emptype = userByPort1.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -4179,7 +4172,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (Long integer : userIdByDid) { for (Long integer : userIdByDid) {
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = userMapper.findUserById(integer); UserByPort manager = userService.findUserByIdForNoPack(integer);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = manager.getEmptype(); int emptype = manager.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -4242,7 +4235,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", roleAndDepository.getUserId()); paramForGetUserByPost.put("position", roleAndDepository.getUserId());
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort1 : userByPortList) { for (UserByPort userByPort1 : userByPortList) {
int emptype = userByPort1.getEmptype(); int emptype = userByPort1.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -4267,7 +4260,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 修改redis中用户的数据 // 修改redis中用户的数据
updateRedisDataForUserManager(integer, minRecordKey); updateRedisDataForUserManager(integer, minRecordKey);
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = userMapper.findUserById(integer); UserByPort manager = userService.findUserByIdForNoPack(integer);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = manager.getEmptype(); int emptype = manager.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -4787,7 +4780,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (userByPortMap.containsKey(applicantId)) { if (userByPortMap.containsKey(applicantId)) {
userByPortById = userByPortMap.get(applicantId); userByPortById = userByPortMap.get(applicantId);
} else { } else {
userByPortById = userMapper.findUserById(applicantId); userByPortById = userService.findUserByIdForNoPack(applicantId);
Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById); Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById);
userByPortById.setMaindeparmentname(departmentByUser.getName()); userByPortById.setMaindeparmentname(departmentByUser.getName());
userByPortMap.put(applicantId, userByPortById); userByPortMap.put(applicantId, userByPortById);
@ -4852,7 +4845,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (userByPortMap.containsKey(applicantId)) { if (userByPortMap.containsKey(applicantId)) {
userByPortById = userByPortMap.get(applicantId); userByPortById = userByPortMap.get(applicantId);
} else { } else {
userByPortById = userMapper.findUserById(applicantId); userByPortById = userService.findUserByIdForNoPack(applicantId);
Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById); Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById);
userByPortById.setMaindeparmentname(departmentByUser.getName()); userByPortById.setMaindeparmentname(departmentByUser.getName());
userByPortMap.put(applicantId, userByPortById); userByPortMap.put(applicantId, userByPortById);
@ -4966,7 +4959,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
userByPortById = userByPortMap.get(applicantId); userByPortById = userByPortMap.get(applicantId);
} }
else { else {
userByPortById = userMapper.findUserById(applicantId); userByPortById = userService.findUserByIdForNoPack(applicantId);
Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById); Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById);
userByPortById.setMaindeparmentname(departmentByUser.getName()); userByPortById.setMaindeparmentname(departmentByUser.getName());
userByPortMap.put(applicantId, userByPortById); userByPortMap.put(applicantId, userByPortById);
@ -4990,7 +4983,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (userByPortMap.containsKey(departmentheadId)) { if (userByPortMap.containsKey(departmentheadId)) {
departmenthead = userByPortMap.get(departmentheadId); departmenthead = userByPortMap.get(departmentheadId);
} else { } else {
departmenthead = userMapper.findUserById(departmentheadId); departmenthead = userService.findUserByIdForNoPack(departmentheadId);
Administration departmentByUser = administrativeService.getDepartmentByUser(departmenthead); Administration departmentByUser = administrativeService.getDepartmentByUser(departmenthead);
departmenthead.setMaindeparmentname(departmentByUser.getName()); departmenthead.setMaindeparmentname(departmentByUser.getName());
userByPortMap.put(departmentheadId, departmenthead); userByPortMap.put(departmentheadId, departmenthead);
@ -5122,7 +5115,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
userByPortById = userByPortMap.get(applicantId); userByPortById = userByPortMap.get(applicantId);
} }
else { else {
userByPortById = userMapper.findUserById(applicantId); userByPortById = userService.findUserByIdForNoPack(applicantId);
Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById); Administration departmentByUser = administrativeService.getDepartmentByUser(userByPortById);
userByPortById.setMaindeparmentname(departmentByUser.getName()); userByPortById.setMaindeparmentname(departmentByUser.getName());
userByPortMap.put(applicantId, userByPortById); userByPortMap.put(applicantId, userByPortById);
@ -5146,7 +5139,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (userByPortMap.containsKey(departmentheadId)) { if (userByPortMap.containsKey(departmentheadId)) {
departmenthead = userByPortMap.get(departmentheadId); departmenthead = userByPortMap.get(departmentheadId);
} else { } else {
departmenthead = userMapper.findUserById(departmentheadId); departmenthead = userService.findUserByIdForNoPack(departmentheadId);
Administration departmentByUser = administrativeService.getDepartmentByUser(departmenthead); Administration departmentByUser = administrativeService.getDepartmentByUser(departmenthead);
departmenthead.setMaindeparmentname(departmentByUser.getName()); departmenthead.setMaindeparmentname(departmentByUser.getName());
userByPortMap.put(departmentheadId, departmenthead); userByPortMap.put(departmentheadId, departmenthead);
@ -5810,7 +5803,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<SimpleApplicationOutOrInRecordP> result = new ArrayList<>(list.size()); List<SimpleApplicationOutOrInRecordP> result = new ArrayList<>(list.size());
for (SimpleApplicationOutRecord record : list) { for (SimpleApplicationOutRecord record : list) {
SimpleApplicationOutOrInRecordP d = new SimpleApplicationOutOrInRecordP(record); SimpleApplicationOutOrInRecordP d = new SimpleApplicationOutOrInRecordP(record);
UserByPort userByPort = userMapper.findUserById(record.getApplicantId()); UserByPort userByPort = userService.findUserByIdForNoPack(record.getApplicantId());
d.setApplyRemark(d.getApplyRemark() == null ? "" : d.getApplyRemark()); d.setApplyRemark(d.getApplyRemark() == null ? "" : d.getApplyRemark());
d.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName()); d.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName());
@ -5823,7 +5816,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<SimpleApplicationOutOrInRecordP> result = new ArrayList<>(list.size()); List<SimpleApplicationOutOrInRecordP> result = new ArrayList<>(list.size());
for (SimpleApplicationInRecord record : list) { for (SimpleApplicationInRecord record : list) {
SimpleApplicationOutOrInRecordP d = new SimpleApplicationOutOrInRecordP(record); SimpleApplicationOutOrInRecordP d = new SimpleApplicationOutOrInRecordP(record);
UserByPort userByPort = userMapper.findUserById(record.getApplicantId()); UserByPort userByPort = userService.findUserByIdForNoPack(record.getApplicantId());
d.setApplyRemark(d.getApplyRemark() == null ? "" : d.getApplyRemark()); d.setApplyRemark(d.getApplyRemark() == null ? "" : d.getApplyRemark());
d.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName()); d.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName());
result.add(d); result.add(d);

120
src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java

@ -10,8 +10,11 @@ import com.dreamchaser.depository_manage.config.QyWx_template_card.*;
import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.exception.MyException; import com.dreamchaser.depository_manage.exception.MyException;
import com.dreamchaser.depository_manage.depository_mapper.*; import com.dreamchaser.depository_manage.depository_mapper.*;
import com.dreamchaser.depository_manage.hrNew_mapper.AdministrativeMapper;
import com.dreamchaser.depository_manage.hrNew_mapper.UserMapper;
import com.dreamchaser.depository_manage.pojo.RoleAndDepository; import com.dreamchaser.depository_manage.pojo.RoleAndDepository;
import com.dreamchaser.depository_manage.pojo.RoleAndMaterialType; import com.dreamchaser.depository_manage.pojo.RoleAndMaterialType;
import com.dreamchaser.depository_manage.service.UserService;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.HttpUtils; import com.dreamchaser.depository_manage.utils.HttpUtils;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
@ -28,28 +31,34 @@ public class QyWxOperationService {
@Autowired @Autowired
DepositoryRecordMapper depositoryRecordMapper; private DepositoryRecordMapper depositoryRecordMapper;
@Autowired @Autowired
MaterialMapper materialMapper; private MaterialMapper materialMapper;
@Autowired @Autowired
DepositoryMapper depositoryMapper; private DepositoryMapper depositoryMapper;
@Autowired @Autowired
StockTakingMapper stockTakingMapper; private StockTakingMapper stockTakingMapper;
@Autowired @Autowired
PlaceMapper placeMapper; private PlaceMapper placeMapper;
@Autowired @Autowired
MaterialTypeMapper materialTypeMapper; private MaterialTypeMapper materialTypeMapper;
@Autowired @Autowired
NoticeMapper noticeMapper; private NoticeMapper noticeMapper;
@Autowired @Autowired
RoleMapper roleMapper; private RoleMapper roleMapper;
@Autowired
private UserService userService;
@Autowired
private AdministrativeMapper administrativeMapper;
/** /**
@ -60,14 +69,14 @@ public class QyWxOperationService {
* @param flag 用于判断发送类型是部门负责人还是仓储负责人(true为部门false为仓储) * @param flag 用于判断发送类型是部门负责人还是仓储负责人(true为部门false为仓储)
* @return * @return
*/ */
public JSONObject sendQyWxToApplicationOutMessage(String uid, Long outId, Boolean flag, String userAgent, String userKey, String token) { public JSONObject sendQyWxToApplicationOutMessage(String uid, Long outId, Boolean flag, String userAgent) {
// 获取将要发送申请的订单记录 // 获取将要发送申请的订单记录
ApplicationOutRecord applicationOutRecordPById = depositoryRecordMapper.findApplicationOutRecordPById(outId); ApplicationOutRecord applicationOutRecordPById = depositoryRecordMapper.findApplicationOutRecordPById(outId);
// 申请人id // 申请人id
Long applicantId = applicationOutRecordPById.getApplicantId(); Long applicantId = applicationOutRecordPById.getApplicantId();
// 申请人 // 申请人
UserByPort applicant = PublicConfig.FindUserById(applicantId, userKey, token); UserByPort applicant = userService.findUserByIdForNoPack(applicantId);
// 获取所有子订单 // 获取所有子订单
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(outId); List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(outId);
@ -262,7 +271,7 @@ public class QyWxOperationService {
// 申请人id // 申请人id
Long getOriginator = mainRecord.getOriginator(); Long getOriginator = mainRecord.getOriginator();
// 申请人 // 申请人
UserByPort originator = PublicConfig.FindUserById(getOriginator, userKey, token); UserByPort originator = userService.findUserByIdForNoPack(getOriginator);
// 盘点物料名称 // 盘点物料名称
StringBuilder mname = new StringBuilder(); StringBuilder mname = new StringBuilder();
@ -498,8 +507,6 @@ public class QyWxOperationService {
// 申请人id // 申请人id
Long getOriginator = mainRecord.getOriginator(); Long getOriginator = mainRecord.getOriginator();
// 申请人
UserByPort originator = PublicConfig.FindUserById(getOriginator, userKey, token);
// 盘点物料名称 // 盘点物料名称
StringBuilder mname = new StringBuilder(); StringBuilder mname = new StringBuilder();
@ -728,7 +735,7 @@ public class QyWxOperationService {
// 申请人id // 申请人id
Long applicantId = recordP.getApplicantId(); Long applicantId = recordP.getApplicantId();
// 申请人 // 申请人
UserByPort applicant = PublicConfig.FindUserById(applicantId, userKey, token); UserByPort applicant = userService.findUserByIdForNoPack(applicantId);
// 获取所有子订单 // 获取所有子订单
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(outId); List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(outId);
@ -762,7 +769,7 @@ public class QyWxOperationService {
// 获取仓库信息 // 获取仓库信息
Depository depositoryRecordById = depositoryMapper.findDepositoryById(recordMin.getDepositoryId()); Depository depositoryRecordById = depositoryMapper.findDepositoryById(recordMin.getDepositoryId());
// 获取处理人信息 // 获取处理人信息
UserByPort userByPort = PublicConfig.FindUserById(recordMin.getCheckId(), userKey, token); UserByPort userByPort = userService.findUserByIdForNoPack(recordMin.getCheckId());
// 获取对应出库单位 // 获取对应出库单位
String unit = recordMin.getUnit(); String unit = recordMin.getUnit();
@ -811,7 +818,7 @@ public class QyWxOperationService {
/** /**
* 获取完成的订单 * 获取完成的订单
*/ */
List<Long> minIds = (List<Long>) map.get("minIds"); List<Long> minIds = ObjectFormatUtil.objToList(map.get("minIds"),Long.class);
MessageByMarkDown markDown = new MessageByMarkDown(); MessageByMarkDown markDown = new MessageByMarkDown();
//设置消息接收者 //设置消息接收者
@ -833,7 +840,7 @@ public class QyWxOperationService {
// 抄送内容 // 抄送内容
StringBuilder content = new StringBuilder("## `抄送信息:`%n"); StringBuilder content = new StringBuilder("## `抄送信息:`%n");
// 获取发起人信息 // 获取发起人信息
UserByPort originator = PublicConfig.FindUserById(mainRecord.getOriginator(), userKey, token); UserByPort originator = userService.findUserByIdForNoPack(mainRecord.getOriginator());
// 设置content // 设置content
content.append(">### **").append(originator.getName()).append("的物料调账记录** %n<font color='warning'>时间:").append(DateUtil.TimeStampToDateTime(mainRecord.getCreateTime())).append("</font> %n"); content.append(">### **").append(originator.getName()).append("的物料调账记录** %n<font color='warning'>时间:").append(DateUtil.TimeStampToDateTime(mainRecord.getCreateTime())).append("</font> %n");
@ -943,7 +950,7 @@ public class QyWxOperationService {
// 抄送内容 // 抄送内容
StringBuilder content = new StringBuilder("## `盘点发生错误:`%n"); StringBuilder content = new StringBuilder("## `盘点发生错误:`%n");
// 获取发起人信息 // 获取发起人信息
UserByPort originator = PublicConfig.FindUserById(mainRecord.getOriginator(), userKey, token); UserByPort originator = userService.findUserByIdForNoPack(mainRecord.getOriginator());
// 设置content // 设置content
content.append(">### **" + originator.getName() + "的物料盘点记录** %n<font color='warning'>时间:" + DateUtil.TimeStampToDateTime(mainRecord.getCreateTime()) + "</font> %n"); content.append(">### **" + originator.getName() + "的物料盘点记录** %n<font color='warning'>时间:" + DateUtil.TimeStampToDateTime(mainRecord.getCreateTime()) + "</font> %n");
@ -1041,7 +1048,7 @@ public class QyWxOperationService {
// 抄送内容 // 抄送内容
StringBuilder content = new StringBuilder("## `抄送信息:`%n"); StringBuilder content = new StringBuilder("## `抄送信息:`%n");
// 获取发起人信息 // 获取发起人信息
UserByPort originator = PublicConfig.FindUserById(mainRecord.getOriginator(), userKey, token); UserByPort originator = userService.findUserByIdForNoPack(mainRecord.getOriginator());
// 设置content // 设置content
content.append(">### **" + originator.getName() + "的物料转移记录** %n<font color='warning'>时间:" + DateUtil.TimeStampToDateTime(mainRecord.getCreateTime()) + "</font> %n"); content.append(">### **" + originator.getName() + "的物料转移记录** %n<font color='warning'>时间:" + DateUtil.TimeStampToDateTime(mainRecord.getCreateTime()) + "</font> %n");
@ -1152,7 +1159,7 @@ public class QyWxOperationService {
// 申请人id // 申请人id
Long applicantId = outRecordP.getApplicantId(); Long applicantId = outRecordP.getApplicantId();
// 申请人 // 申请人
UserByPort applicant = PublicConfig.FindUserById(applicantId, userKey, token); UserByPort applicant = userService.findUserByIdForNoPack(applicantId);
// 定义卡片模板 // 定义卡片模板
TemplateCard_text_notice text_notice = new TemplateCard_text_notice(); TemplateCard_text_notice text_notice = new TemplateCard_text_notice();
@ -1416,7 +1423,7 @@ public class QyWxOperationService {
if (flagForAgency == 1) { if (flagForAgency == 1) {
// 如果是代领 // 如果是代领
applicantUser = PublicConfig.FindUserById(mainRecord.getApplicantId(), userKey, token); applicantUser = userService.findUserById(mainRecord.getApplicantId());
} }
// 事先定义其他部门负责人列表 // 事先定义其他部门负责人列表
@ -1454,10 +1461,11 @@ public class QyWxOperationService {
List<Approval_template_approver> approval_template_approver_list = new ArrayList<>(); List<Approval_template_approver> approval_template_approver_list = new ArrayList<>();
// 获取当前登录用户部门与企业微信部门对照 // 获取当前登录用户部门具体信息
JSONObject userPortByQyWx = PublicConfig.getUserPortByQyWx(applicantUser.getMaindeparment()); Administration administrationById = administrativeMapper.findAdministrationById(applicantUser.getMaindeparment());
String portName = userPortByQyWx.getString("name");
Integer portByQyWxInteger = userPortByQyWx.getInteger("wechatorganizationid"); String portName = administrationById.getName();
Integer portByQyWxInteger = administrationById.getWechatorganizationid();
// 审批申请数据,可定义审批申请中各个控件的值,其中必填项必须有值,选填项可为空,数据结构同“获取审批申请详情”接口返回值中同名参数“apply_data” // 审批申请数据,可定义审批申请中各个控件的值,其中必填项必须有值,选填项可为空,数据结构同“获取审批申请详情”接口返回值中同名参数“apply_data”
@ -1789,7 +1797,7 @@ public class QyWxOperationService {
// 如果是办公用品库或中心仓 // 如果是办公用品库或中心仓
List<UserByPort> departmentHeadForUserToken = PublicConfig.findDepartmentHeadByUser(applicantUser.getMaindeparment(), userKey, token); List<UserByPort> departmentHeadForUserToken = userService.getDepartmentHeaderByIdForNoPack(applicantUser.getMaindeparment());
for (UserByPort departmentHead : departmentHeadForUserToken for (UserByPort departmentHead : departmentHeadForUserToken
) { ) {
String departmentHeadWorkwechat = departmentHead.getWorkwechat(); String departmentHeadWorkwechat = departmentHead.getWorkwechat();
@ -1806,7 +1814,7 @@ public class QyWxOperationService {
// 获取申请用户所在部门的设备员 // 获取申请用户所在部门的设备员
List<UserByPort> userByPortList = PublicConfig.findUserByAdminorgAndPosition(applicantUser.getMaindeparment(), "设备员", userKey, token); List<UserByPort> userByPortList = PublicConfig.findUserByAdminorgAndPosition(applicantUser.getMaindeparment(), "设备员", userKey, token);
List<UserByPort> departmentHeadForUserToken = PublicConfig.findDepartmentHeadByUser(applicantUser.getMaindeparment(), userKey, token); List<UserByPort> departmentHeadForUserToken = userService.getDepartmentHeaderByIdForNoPack(applicantUser.getMaindeparment());
if (userByPortList.size() > 0) { if (userByPortList.size() > 0) {
// 如果有设备员 // 如果有设备员
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
@ -1874,7 +1882,7 @@ public class QyWxOperationService {
approval_template_approver_list.add(approval_template_approver_Label); approval_template_approver_list.add(approval_template_approver_Label);
// 获取综合办部门负责人 // 获取综合办部门负责人
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(268L, userKey, token); List<UserByPort> departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(268L);
List<String> ZHBQyWxId = new ArrayList<>(); List<String> ZHBQyWxId = new ArrayList<>();
for (UserByPort userByPort : departmentHeadByUser) { for (UserByPort userByPort : departmentHeadByUser) {
String QyWxId = userByPort.getWorkwechat(); String QyWxId = userByPort.getWorkwechat();
@ -1917,7 +1925,7 @@ public class QyWxOperationService {
// 获取当前仓库所属的部门 // 获取当前仓库所属的部门
String adminorg = depositoryById.getAdminorg(); String adminorg = depositoryById.getAdminorg();
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(ObjectFormatUtil.toLong(adminorg), userKey, token); List<UserByPort> departmentHeadByUser = userService.getDepartmentHeaderByIdForNoPack(ObjectFormatUtil.toLong(adminorg));
for (UserByPort departmentHead : departmentHeadByUser for (UserByPort departmentHead : departmentHeadByUser
) { ) {
String departmentHeadWorkwechat = departmentHead.getWorkwechat(); String departmentHeadWorkwechat = departmentHead.getWorkwechat();
@ -1955,7 +1963,7 @@ public class QyWxOperationService {
Long userId = roleAndMaterialType.getUid(); Long userId = roleAndMaterialType.getUid();
if (classes == 1) { if (classes == 1) {
// 如果是对人设置的权限 // 如果是对人设置的权限
UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token); UserByPort userByPort = userService.findUserByIdForNoPack(userId);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -1972,10 +1980,10 @@ public class QyWxOperationService {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", userId); paramForGetUserByPost.put("position", userId);
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if(emptype > 10){ if (emptype > 10) {
continue; continue;
} }
// 获取企业微信id或微信id // 获取企业微信id或微信id
@ -2014,7 +2022,7 @@ public class QyWxOperationService {
Long userId = roleAndDepository.getUserId(); Long userId = roleAndDepository.getUserId();
if (classes == 1) { if (classes == 1) {
// 如果是对人设置的权限 // 如果是对人设置的权限
UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token); UserByPort userByPort = userService.findUserByIdForNoPack(userId);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2031,10 +2039,10 @@ public class QyWxOperationService {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", userId); paramForGetUserByPost.put("position", userId);
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if(emptype > 10){ if (emptype > 10) {
continue; continue;
} }
// 获取企业微信id或微信id // 获取企业微信id或微信id
@ -2124,7 +2132,7 @@ public class QyWxOperationService {
if ("".equals(department)) { if ("".equals(department)) {
continue; continue;
} }
UserByPort departmentHead = PublicConfig.FindUserById(ObjectFormatUtil.toLong(department), userKey, token); UserByPort departmentHead = userService.findUserByIdForNoPack(ObjectFormatUtil.toLong(department));
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = departmentHead.getEmptype(); int emptype = departmentHead.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2139,9 +2147,9 @@ public class QyWxOperationService {
// 获取当前登录用户部门与企业微信部门对照 // 获取当前登录用户部门与企业微信部门对照
JSONObject userPortByQyWx = PublicConfig.getUserPortByQyWx(userToken.getMaindeparment()); Administration administrationById = administrativeMapper.findAdministrationById(userToken.getMaindeparment());
String portName = userPortByQyWx.getString("name"); String portName = administrationById.getName();
Integer portByQyWxInteger = userPortByQyWx.getInteger("wechatorganizationid"); Integer portByQyWxInteger = administrationById.getWechatorganizationid();
// 用于设置部门负责人流程 // 用于设置部门负责人流程
Approval_template_approver approval_template_approver_departMentHeader = new Approval_template_approver(); Approval_template_approver approval_template_approver_departMentHeader = new Approval_template_approver();
@ -2456,7 +2464,7 @@ public class QyWxOperationService {
if ("".equals(depositorymanager)) { if ("".equals(depositorymanager)) {
continue; continue;
} }
UserByPort depositoryManage = PublicConfig.FindUserById(ObjectFormatUtil.toLong(depositorymanager), userKey, token); UserByPort depositoryManage = userService.findUserByIdForNoPack(ObjectFormatUtil.toLong(depositorymanager));
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = depositoryManage.getEmptype(); int emptype = depositoryManage.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2499,10 +2507,10 @@ public class QyWxOperationService {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); paramForGetUserByPost.put("position", roleAndMaterialType.getUid());
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList =userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if(emptype > 10){ if (emptype > 10) {
continue; continue;
} }
String userByPortWorkwechat = userByPort.getWorkwechat(); String userByPortWorkwechat = userByPort.getWorkwechat();
@ -2517,7 +2525,7 @@ public class QyWxOperationService {
for (Long userId : userIdByMtId for (Long userId : userIdByMtId
) { ) {
// 获取对应管理员信息 // 获取对应管理员信息
UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token); UserByPort userByPort = userService.findUserByIdForNoPack(userId);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2566,10 +2574,10 @@ public class QyWxOperationService {
// 定义用于获取当前岗位下的人的参数map // 定义用于获取当前岗位下的人的参数map
Map<String, Object> paramForGetUserByPost = new HashMap<>(); Map<String, Object> paramForGetUserByPost = new HashMap<>();
paramForGetUserByPost.put("position", roleAndDepository.getUserId()); paramForGetUserByPost.put("position", roleAndDepository.getUserId());
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = userService.findUserByConditionForNoPack(paramForGetUserByPost);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if(emptype > 10){ if (emptype > 10) {
continue; continue;
} }
String userByPortWorkwechat = userByPort.getWorkwechat(); String userByPortWorkwechat = userByPort.getWorkwechat();
@ -2585,7 +2593,7 @@ public class QyWxOperationService {
for (Long userId : userIdByDid for (Long userId : userIdByDid
) { ) {
// 获取对应管理员信息 // 获取对应管理员信息
UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token); UserByPort userByPort = userService.findUserByIdForNoPack(userId);
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2648,7 +2656,7 @@ public class QyWxOperationService {
// 获取申请人的userId // 获取申请人的userId
UserByPort userByPort = PublicConfig.FindUserById(minRecordList.get(0).getApplicantId(), userKey, token); UserByPort userByPort = userService.findUserByIdForNoPack(minRecordList.get(0).getApplicantId());
// 获取用户的用工关系 // 获取用户的用工关系
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
@ -2732,9 +2740,9 @@ public class QyWxOperationService {
approval_template_apply_data_contents_department.setId("Contact-1668152104847"); approval_template_apply_data_contents_department.setId("Contact-1668152104847");
// 获取当前登录用户部门与企业微信部门对照 // 获取当前登录用户部门与企业微信部门对照
JSONObject userPortByQyWx = PublicConfig.getUserPortByQyWx(userByPort.getMaindeparment()); Administration administrationById = administrativeMapper.findAdministrationById(userByPort.getMaindeparment());
String portName = userPortByQyWx.getString("name"); String portName = administrationById.getName();
Integer portByQyWxInteger = userPortByQyWx.getInteger("wechatorganizationid"); Integer portByQyWxInteger = administrationById.getWechatorganizationid();
// 部门控件值(control参数为Contact,且value参数为departments) // 部门控件值(control参数为Contact,且value参数为departments)
Map<String, Object> members_department = new HashMap<>(); Map<String, Object> members_department = new HashMap<>();
@ -3062,9 +3070,9 @@ public class QyWxOperationService {
approval_template_apply_data_contents_department.setId("Contact-1668152665831"); approval_template_apply_data_contents_department.setId("Contact-1668152665831");
// 获取当前登录用户部门与企业微信部门对照 // 获取当前登录用户部门与企业微信部门对照
JSONObject userPortByQyWx = PublicConfig.getUserPortByQyWx(userToken.getMaindeparment()); Administration administrationById = administrativeMapper.findAdministrationById(userToken.getMaindeparment());
String portName = userPortByQyWx.getString("name"); String portName = administrationById.getName();
Integer portByQyWxInteger = userPortByQyWx.getInteger("wechatorganizationid"); Integer portByQyWxInteger = administrationById.getWechatorganizationid();
// 部门控件值(control参数为Contact,且value参数为departments) // 部门控件值(control参数为Contact,且value参数为departments)
Map<String, Object> members_department = new HashMap<>(); Map<String, Object> members_department = new HashMap<>();
@ -3111,7 +3119,7 @@ public class QyWxOperationService {
continue; continue;
} }
// 获取负责人信息 // 获取负责人信息
UserByPort userByPort = PublicConfig.findUserByPortByNumber(manager); UserByPort userByPort = userService.findUserByNumberForNoPack(manager);
int emptype = userByPort.getEmptype(); int emptype = userByPort.getEmptype();
if (emptype > 10) { if (emptype > 10) {
continue; continue;
@ -3438,7 +3446,7 @@ public class QyWxOperationService {
textCardContent.setTitle(noticeById.getTitle()); textCardContent.setTitle(noticeById.getTitle());
String noticeContent = "<div class='gray'>" + DateUtil.TimeStampToDateTime(noticeById.getTime()) + String noticeContent = "<div class='gray'>" + DateUtil.TimeStampToDateTime(noticeById.getTime()) +
"</div><div class='normal'>" + noticeById.getContent() + "</div><div class='highlight'>" + "</div><div class='normal'>" + noticeById.getContent() + "</div><div class='highlight'>" +
PublicConfig.FindUserById(noticeById.getUserId(), userKey, token).getName() + "</div>"; userService.findUserByIdForNoPack(noticeById.getUserId()).getName() + "</div>";
// 设置内容 // 设置内容
textCardContent.setDescription(noticeContent); textCardContent.setDescription(noticeContent);
// 设置点击后跳转的链接 // 设置点击后跳转的链接
@ -3523,7 +3531,7 @@ public class QyWxOperationService {
applicantTime = stockTaking.getCreateTime(); applicantTime = stockTaking.getCreateTime();
tempMessageTitle = "库存盘点审批"; tempMessageTitle = "库存盘点审批";
} }
UserByPort userByPort = PublicConfig.FindUserById(applicantId, userKey, token); UserByPort userByPort = userService.findUserByIdForNoPack(applicantId);
// 设置content // 设置content
content.append(">### **%n<font color='warning'>对于" + userByPort.getName() + "在" + DateUtil.TimeStampToDateTime(applicantTime) + "提起" + tempMessageTitle + "的转至应用发送的消息进行审批,审批应用中的流程请忽略</font> %n**"); content.append(">### **%n<font color='warning'>对于" + userByPort.getName() + "在" + DateUtil.TimeStampToDateTime(applicantTime) + "提起" + tempMessageTitle + "的转至应用发送的消息进行审批,审批应用中的流程请忽略</font> %n**");
content.append("%n---%n"); content.append("%n---%n");

40
src/main/java/com/dreamchaser/depository_manage/service/impl/UserServiceImpl.java

@ -27,22 +27,34 @@ public class UserServiceImpl implements UserService {
/** /**
* 通过id获取用户信息(包装) * 通过id获取用户信息(包装)
*
* @param id 待获取用户id * @param id 待获取用户id
* @return * @return
*/ */
@Override @Override
public UserByPort findUserById(Long id) { public UserByPort findUserById(Long id) {
return packForOne(userMapper.findUserById(id)); UserByPort userById = userMapper.findUserById(id);
if ("300732".equals(userById.getNumber())) {
userById.setMaindeparment(361L);
userById.setMaindeparmentname("仓储中心");
}
return packForOne(userById);
} }
/** /**
* 通过id获取用户信息(未包装) * 通过id获取用户信息(未包装)
*
* @param id 待获取用户id * @param id 待获取用户id
* @return * @return
*/ */
@Override @Override
public UserByPort findUserByIdForNoPack(Long id) { public UserByPort findUserByIdForNoPack(Long id) {
return userMapper.findUserById(id); UserByPort userById = userMapper.findUserById(id);
if ("300732".equals(userById.getNumber())) {
userById.setMaindeparment(361L);
userById.setMaindeparmentname("仓储中心");
}
return userById;
} }
/** /**
@ -76,8 +88,15 @@ public class UserServiceImpl implements UserService {
public List<UserByPort> getDepartmentHeaderById(Administration administration) { public List<UserByPort> getDepartmentHeaderById(Administration administration) {
// 用于存储结果集 // 用于存储结果集
List<UserByPort> userByPortList = new ArrayList<>(); List<UserByPort> userByPortList = new ArrayList<>();
Long administrationId = administration.getId();
if (Long.compare(administrationId, 111) == 0) {
// 如果是获取保卫部的负责人,则直接获取该用户
UserByPort userByNumber = userMapper.findUserByNumber("200855");
userByPortList.add(userByNumber);
}
// 查询数据库中当前部门的负责人 // 查询数据库中当前部门的负责人
List<UserByPort> departmentHeaders = userMapper.findDepartmentHeaders(administration.getId()); List<UserByPort> departmentHeaders = userMapper.findDepartmentHeaders(administrationId);
for (UserByPort departmentHeader : departmentHeaders) { for (UserByPort departmentHeader : departmentHeaders) {
// 获取当前人员的雇佣关系 // 获取当前人员的雇佣关系
Integer emptype = departmentHeader.getEmptype(); Integer emptype = departmentHeader.getEmptype();
@ -98,8 +117,15 @@ public class UserServiceImpl implements UserService {
*/ */
@Override @Override
public List<UserByPort> getDepartmentHeaderByIdForNoPack(Long administrationId) { public List<UserByPort> getDepartmentHeaderByIdForNoPack(Long administrationId) {
// 保卫部负责人暂时没有,系统内部指定
// 用于存储结果集 // 用于存储结果集
List<UserByPort> userByPortList = new ArrayList<>(); List<UserByPort> userByPortList = new ArrayList<>();
if (Long.compare(administrationId, 111) == 0) {
// 如果是获取保卫部的负责人,则直接获取该用户
UserByPort userByNumber = userMapper.findUserByNumber("200855");
userByPortList.add(userByNumber);
}
// 查询数据库中当前部门的负责人 // 查询数据库中当前部门的负责人
List<UserByPort> departmentHeaders = userMapper.findDepartmentHeaders(administrationId); List<UserByPort> departmentHeaders = userMapper.findDepartmentHeaders(administrationId);
for (UserByPort departmentHeader : departmentHeaders) { for (UserByPort departmentHeader : departmentHeaders) {
@ -116,6 +142,7 @@ public class UserServiceImpl implements UserService {
/** /**
* 根据条件查询用户信息 * 根据条件查询用户信息
*
* @param map 待查询条件 * @param map 待查询条件
* @return * @return
*/ */
@ -126,6 +153,7 @@ public class UserServiceImpl implements UserService {
/** /**
* 根据条件查询用户信息未包装 * 根据条件查询用户信息未包装
*
* @param map 待查询条件 * @param map 待查询条件
* @return * @return
*/ */
@ -136,10 +164,11 @@ public class UserServiceImpl implements UserService {
/** /**
* 根据条件查询用户数量 * 根据条件查询用户数量
*
* @param map 待查询条件 * @param map 待查询条件
* @return * @return
*/ */
public Integer findUserCountByCondition(Map<String, Object> map){ public Integer findUserCountByCondition(Map<String, Object> map) {
return userMapper.findUserCountByCondition(map); return userMapper.findUserCountByCondition(map);
} }
@ -156,11 +185,12 @@ public class UserServiceImpl implements UserService {
/** /**
* 根据用户名称查询用户信息 * 根据用户名称查询用户信息
*
* @param name 待查询名称 * @param name 待查询名称
* @return * @return
*/ */
@Override @Override
public List<UserByPort> findUserByName(String name){ public List<UserByPort> findUserByName(String name) {
return userMapper.findUserByName(name); return userMapper.findUserByName(name);
} }

Loading…
Cancel
Save