Browse Source

将LinkInterfaceUtil类中的方法合并到PublicConfig中

lwx_dev
erdanergou 2 years ago
parent
commit
2df7e3bbd4
  1. 484
      src/main/java/com/dreamchaser/depository_manage/config/PublicConfig.java
  2. 11
      src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java
  3. 7
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java
  4. 32
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  5. 2
      src/main/java/com/dreamchaser/depository_manage/controller/GroupController.java
  6. 72
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  7. 7
      src/main/java/com/dreamchaser/depository_manage/controller/QyWxOperationController.java
  8. 12
      src/main/java/com/dreamchaser/depository_manage/controller/UserController.java
  9. 5
      src/main/java/com/dreamchaser/depository_manage/service/impl/CompanyServiceImpl.java
  10. 74
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  11. 9
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryServiceImpl.java
  12. 7
      src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java
  13. 6
      src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java
  14. 9
      src/main/java/com/dreamchaser/depository_manage/service/impl/NoticeServiceImpl.java
  15. 48
      src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java
  16. 6
      src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java
  17. 14
      src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java
  18. 378
      src/main/java/com/dreamchaser/depository_manage/utils/LinkInterfaceUtil.java
  19. 5
      src/test/java/com/dreamchaser/depository_manage/BarChartTest.java
  20. 21
      src/test/java/com/dreamchaser/depository_manage/InterfaceTest.java
  21. 4
      src/test/java/com/dreamchaser/depository_manage/InventoryLineChartTest.java
  22. 6
      src/test/java/com/dreamchaser/depository_manage/InventorySunburstDataTest.java
  23. 6
      src/test/java/com/dreamchaser/depository_manage/LineChartTest.java

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

@ -3,14 +3,16 @@ package com.dreamchaser.depository_manage.config;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.entity.Administration;
import com.dreamchaser.depository_manage.entity.Post;
import com.dreamchaser.depository_manage.entity.UserByPort; import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.pojo.AdministrationP;
import com.dreamchaser.depository_manage.utils.HttpUtils; import com.dreamchaser.depository_manage.utils.HttpUtils;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import lombok.Data; import lombok.Data;
import lombok.extern.log4j.Log4j;
import lombok.extern.log4j.Log4j2;
import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HTTP;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
@ -26,11 +28,11 @@ public class PublicConfig {
// 接口地址 // 接口地址
public static String external_url = "http://172.20.2.87:39168"; public static String external_url = "http://172.20.2.87:39168";
// public static String external_url = "http://127.0.0.1:39168"; // public static String external_url = "http://127.0.0.1:39168";
public static String external_url_6666 = "http://kpi.hxgk.group/kpiapi"; public static String external_url_6666 = "http://kpi.hxgk.group/kpiapi";
// 高权限部门列表 // 高权限部门列表
public static List<Integer> roleAdminorgList = Arrays.asList(361,102,268); public static List<Integer> roleAdminorgList = Arrays.asList(361, 102, 268);
// 定义登录存储在redis中的前缀 // 定义登录存储在redis中的前缀
public static String LoginRedisPrefix = "HXGK_GO_ZhixingCollege:ScanCode:Authentication:LoginApi_dev_"; public static String LoginRedisPrefix = "HXGK_GO_ZhixingCollege:ScanCode:Authentication:LoginApi_dev_";
@ -41,58 +43,106 @@ public class PublicConfig {
/** /**
* 获取相应部门的部门负责人 * 获取相应部门的部门负责人
*
* @param userToken 待获取人员 * @param userToken 待获取人员
* @return * @return
*/ */
public static List<UserByPort> findDepartmentHeadByUser(Integer maindeparment,String userKey,String userToken){ public static List<UserByPort> findDepartmentHeadByUser(Integer maindeparment, String userKey, String userToken) {
List<UserByPort> userByPortList = new ArrayList<>(); List<UserByPort> userByPortList = new ArrayList<>();
if (Integer.compare(maindeparment, 361) == 0) { if (Integer.compare(maindeparment, 361) == 0) {
// 如果申请人部门为仓储 // 如果申请人部门为仓储
UserByPort userByPort = LinkInterfaceUtil.FindUserById(119, userKey,userToken); UserByPort userByPort = FindUserById(119, userKey, userToken);
userByPortList.add(userByPort); userByPortList.add(userByPort);
return userByPortList; return userByPortList;
} }
String url = PublicConfig.external_url + "/staff/archiveslist"; String url = PublicConfig.external_url + "/staff/archiveslist";
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("adminorg",maindeparment); map.put("adminorg", maindeparment);
map.put("role",""); map.put("role", "");
String jsonString = JSONObject.toJSONString(map); String jsonString = JSONObject.toJSONString(map);
JSONObject paramObject = JSONObject.parseObject(jsonString); JSONObject paramObject = JSONObject.parseObject(jsonString);
String post = null; String post = null;
try { try {
post = HttpUtils.send(url, paramObject, HTTP.UTF_8,userKey,userToken); post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userKey, userToken);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
JSONObject jsonObject = JSONObject.parseObject(post); JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data"); JSONObject data = (JSONObject) jsonObject.get("data");
JSONArray list = (JSONArray) data.get("list"); JSONArray list = (JSONArray) data.get("list");
if(list == null){ if (list == null) {
list = new JSONArray(); list = new JSONArray();
} }
for (Object obj:list for (Object obj : list
) { ) {
JSONObject jsonObject1 = (JSONObject) obj; JSONObject jsonObject1 = (JSONObject) obj;
int personincharge = jsonObject1.getInteger("personincharge"); int personincharge = jsonObject1.getInteger("personincharge");
if(1 == personincharge){ if (1 == personincharge) {
userByPortList.add(JSONObject.toJavaObject(jsonObject1, UserByPort.class)); userByPortList.add(JSONObject.toJavaObject(jsonObject1, UserByPort.class));
} }
} }
return userByPortList; return userByPortList;
} }
/**
* 获取当前部门下的对应职位的下的人员
*
* @param maindepartment 查询部门
* @param positionName 查询职位
* @return
*/
public static List<UserByPort> findUserByAdminorgAndPosition(Integer maindepartment, String positionName, String userKey, String userToken) {
List<UserByPort> userByPortList = new ArrayList<>();
String url = PublicConfig.external_url + "/org/positionlist";
Map<String, Object> map = new HashMap<>();
map.put("organization", maindepartment.toString());
map.put("name", positionName);
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();
}
// 定义获取的岗位
Post position = null;
for (Object o : list) {
position = JSONObject.toJavaObject((JSONObject) o, Post.class);
}
// 获取当前部门下的所有人员
if (position != null) {
List<UserByPort> allUserByMainDepartment = FindUserByAdminorg(maindepartment, userKey, userToken);
for (UserByPort userByPort : allUserByMainDepartment) {
if (Integer.compare(userByPort.getPosition(), position.getId()) == 0) {
userByPortList.add(userByPort);
}
}
}
return userByPortList;
}
// 通过获取的企业微信UserId获取数据库中的用户以及对应key与token // 通过获取的企业微信UserId获取数据库中的用户以及对应key与token
public static Map<String,Object> findUserByQyWxUserId(String userId){ public static Map<String, Object> findUserByQyWxUserId(String userId) {
String url = external_url +"/staff/wechat_give_uscont"; String url = external_url + "/staff/wechat_give_uscont";
Map<String,Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>();
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("openid",userId); map.put("openid", userId);
String jsonString = JSONObject.toJSONString(map); String jsonString = JSONObject.toJSONString(map);
JSONObject paramObject = JSONObject.parseObject(jsonString); JSONObject paramObject = JSONObject.parseObject(jsonString);
String post = null; String post = null;
try { try {
post = HttpUtils.send(url,paramObject, HTTP.UTF_8,null,null); post = HttpUtils.send(url, paramObject, HTTP.UTF_8, null, null);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -101,32 +151,32 @@ public class PublicConfig {
UserByPort userByPort = JSONObject.toJavaObject((JSONObject) data.get("userinfo"), UserByPort.class); UserByPort userByPort = JSONObject.toJavaObject((JSONObject) data.get("userinfo"), UserByPort.class);
String userKey = data.getString("key"); String userKey = data.getString("key");
String userToken = data.getString("token"); String userToken = data.getString("token");
result.put("key",userKey); result.put("key", userKey);
result.put("token",userToken); result.put("token", userToken);
result.put("user",userByPort); result.put("user", userByPort);
return result; return result;
} }
// 修改员工微信或企业微信UserId // 修改员工微信或企业微信UserId
public static void editUserWechatOpenid(Map<String,String> map,String userKey,String userToken){ public static void editUserWechatOpenid(Map<String, String> map, String userKey, String userToken) {
String url = external_url+"/staff/edit_us_wechat_openid"; String url = external_url + "/staff/edit_us_wechat_openid";
String jsonString = JSONObject.toJSONString(map); String jsonString = JSONObject.toJSONString(map);
JSONObject paramObject = JSONObject.parseObject(jsonString); JSONObject paramObject = JSONObject.parseObject(jsonString);
String post = null; String post = null;
try { try {
post = HttpUtils.send(url, paramObject, HTTP.UTF_8,userKey,userToken); post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userKey, userToken);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
// 获取当前登录用户所在部门的企业微信id // 获取当前登录用户所在部门的企业微信id
public static JSONObject getUserPortByQyWx(Integer mainPortId){ public static JSONObject getUserPortByQyWx(Integer mainPortId) {
String url = external_url+"/org/getgovcont"; String url = external_url + "/org/getgovcont";
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("id",mainPortId); map.put("id", mainPortId);
map.put("idstr",String.valueOf(mainPortId)); map.put("idstr", String.valueOf(mainPortId));
String jsonString = JSONObject.toJSONString(map); String jsonString = JSONObject.toJSONString(map);
String s = HttpUtils.doPost(url, jsonString); String s = HttpUtils.doPost(url, jsonString);
JSONObject jsonObject = JSONObject.parseObject(s); JSONObject jsonObject = JSONObject.parseObject(s);
@ -137,13 +187,14 @@ public class PublicConfig {
/** /**
* 通过工号获取用户 * 通过工号获取用户
*
* @param number 工号 * @param number 工号
* @return * @return
*/ */
public static UserByPort findUserByPortByNumber(String number){ public static UserByPort findUserByPortByNumber(String number) {
String url = PublicConfig.external_url + "/staff/archiveslist"; String url = PublicConfig.external_url + "/staff/archiveslist";
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("number",number); map.put("number", number);
String jsonString = JSONObject.toJSONString(map); String jsonString = JSONObject.toJSONString(map);
String s = HttpUtils.doPost(url, jsonString); String s = HttpUtils.doPost(url, jsonString);
JSONObject jsonObject = JSONObject.parseObject(s); JSONObject jsonObject = JSONObject.parseObject(s);
@ -162,9 +213,10 @@ public class PublicConfig {
/** /**
* 用于关闭线程池 * 用于关闭线程池
*
* @param exs 待关闭的线程池 * @param exs 待关闭的线程池
*/ */
public static void closeThreadPool(ExecutorService exs){ public static void closeThreadPool(ExecutorService exs) {
exs.shutdown(); // 禁止提交新任务 exs.shutdown(); // 禁止提交新任务
// 设定最大重试次数 // 设定最大重试次数
try { try {
@ -185,15 +237,371 @@ public class PublicConfig {
/** /**
* 用于获取Map<String,String> * 用于获取Map<String,String>
*
* @param jsonObject * @param jsonObject
* @return * @return
*/ */
public static Map<String,String> returnMapString(JSONObject jsonObject){ public static Map<String, String> returnMapString(JSONObject jsonObject) {
Map<String,String> stringObjectMap = new HashMap<>(); Map<String, String> stringObjectMap = new HashMap<>();
for (String next : jsonObject.keySet()) { for (String next : jsonObject.keySet()) {
String value = String.valueOf(jsonObject.get(next)); String value = String.valueOf(jsonObject.get(next));
stringObjectMap.put(next,value); stringObjectMap.put(next, value);
} }
return stringObjectMap; return stringObjectMap;
} }
/**
* 根据条件查询用户
*
* @param map 条件
* @param userToken 当前登录用户
* @return 查询结果
*/
public static List<UserByPort> FindUserByMap(Map<String, Object> map, String userKey, String userToken) {
String url = external_url + "/staff/archiveslist";
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");
List<UserByPort> result = new ArrayList<>();
if (list == null) {
list = new JSONArray();
}
for (Object o : list) {
UserByPort userByPort = JSONObject.toJavaObject((JSONObject) o, UserByPort.class);
result.add(userByPort);
}
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查询对应用户
*
* @param id 待查讯用户id
* @param userToken 登录用户
* @return 查询结果
*/
public static UserByPort FindUserById(Integer id, String userKey, String userToken) {
String url = external_url + "/staff/archivescont";
Map<String, Object> map = new HashMap<>();
map.put("id", id);
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");
UserByPort userByPort = JSONObject.toJavaObject(data, UserByPort.class);
if ("302299".equals(userByPort.getNumber())) {
userByPort.setMaindeparment(280);
}
return userByPort;
}
/**
* 查询当前部门下的用户
*
* @param id 待查讯部门id
* @param userToken 登录用户
* @return 查询结果
*/
public static List<UserByPort> FindUserByAdminorg(Integer id, String userKey, String userToken) {
String url = external_url + "/staff/archiveslist";
Map<String, Object> map = new HashMap<>();
map.put("adminorg", id);
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.getJSONObject("data");
JSONArray jsonArray = data.getJSONArray("list");
List<UserByPort> list = new ArrayList<>();
for (Object o : jsonArray
) {
UserByPort userByPort = JSONObject.toJavaObject((JSONObject) o, UserByPort.class);
list.add(userByPort);
}
return list;
}
/**
* 根据id查询对应的行政组织
*
* @param id 待查讯组织id
* @param
* @return 查询结果
*/
public static Administration getCompany(Integer id, String userKey, String userToken) {
String url = external_url + "/org/getgovcont";
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");
return JSONObject.toJavaObject(data, Administration.class);
}
/**
* 根据上级查询对应的行政组织
*
* @param superior 上级编号
* @param
* @return 查询结果
*/
public static List<AdministrationP> findCompanyBySuperior(String superior, String userKey, String userToken) {
String url = external_url + "/org/govthree";
Map<String, Object> map = new HashMap<>();
map.put("idstr", superior);
map.put("level", 0);
map.put("all", 1);
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);
JSONArray list = (JSONArray) jsonObject.get("data");
if (list == null) {
list = new JSONArray();
}
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查询对应的岗位信息
*
* @param id 岗位id
* @param
* @return 查询结果
*/
public static Post findPostById(Integer 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;
}
/**
* 获取对应的验证码信息
*
* @param request 请求体
* @return 结果
*/
public static JSONObject Captcha(HttpServletRequest request) {
String token = request.getHeader("user-token");
String userKey = request.getHeader("user-key");
if (token == null) {
token = (String) request.getSession().getAttribute("userToken");
userKey = (String) request.getSession().getAttribute("userKey");
}
String url = external_url_6666 + "/base/captcha";
JSONObject param = new JSONObject();
String post = null;
try {
post = HttpUtils.send(url, param, HTTP.UTF_8, userKey, token);
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data");
return data;
}
/**
* 获取当前行政组织列表
*
* @return
*/
public static Map<String, Object> findAdministration(String userKey, String userToken) {
Map<String, Object> map = new HashMap<>();
String url = external_url + "/org/govlist";
String superior = "313";
map.put("superior", superior);
map.put("state", 1);
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"));
Map<String, Object> result = new HashMap();
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);
}
result.put("administrationPList", administrationPList);
result.put("total", total);
return result;
}
/**
* 用于获取行政组织树
*
* @param userByPort
* @return
*/
public static JSONArray getPostTree(UserByPort userByPort, String userKey, String userToken) {
String url = external_url + "/org/govthreeing";
Map<String, Object> param = new HashMap<>();
param.put("id", userByPort.getCompany());
param.put("idstr", "");
param.put("level", 0);
param.put("all", 1);
String jsonString = JSONObject.toJSONString(param);
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);
return (JSONArray) jsonObject.get("data");
}
/**
* 获取当前用户可见的菜单集
*
* @param userToken 当前登录用户
* @return
*/
public static List<String> getUserAccessToAddresses(String userKey, String userToken) {
//定义链接地址
String url = external_url_6666 + "/system_authorizing/obtain_authorization";
System.out.println(url);
Map<String, Object> param = new HashMap<>();
param.put("system", "cangchu");
String jsonString = JSONObject.toJSONString(param);
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 powerid = (JSONArray) data.get("powerid");
if (powerid == null) {
powerid = new JSONArray();
}
List<String> stringList = JSONObject.parseArray(powerid.toJSONString(), String.class);
return stringList;
}
public static JSONArray getOrgAndPostThree(String userKey, String userToken) {
//定义链接地址
String url = external_url + "/org/get_organdpost_three";
Map<String, Object> param = new HashMap<>();
param.put("id", "309");
param.put("level", 0);
param.put("all", 0);
String jsonString = JSONObject.toJSONString(param);
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");
return data.getJSONArray("list");
}
} }

11
src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java

@ -17,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -109,7 +108,7 @@ public class CompanyController {
token = (String) request.getSession().getAttribute("userToken"); token = (String) request.getSession().getAttribute("userToken");
userKey = (String) request.getSession().getAttribute("userKey"); userKey = (String) request.getSession().getAttribute("userKey");
} }
Map<String, Object> administration = LinkInterfaceUtil.findAdministration(userKey,token); Map<String, Object> administration = PublicConfig.findAdministration(userKey,token);
List<AdministrationP> administrationPList = (List<AdministrationP>) administration.get("administrationPList"); List<AdministrationP> administrationPList = (List<AdministrationP>) administration.get("administrationPList");
return new RestResponse(administrationPList); return new RestResponse(administrationPList);
} }
@ -129,7 +128,7 @@ public class CompanyController {
token = (String) request.getSession().getAttribute("userToken"); token = (String) request.getSession().getAttribute("userToken");
userKey = (String) request.getSession().getAttribute("userKey"); userKey = (String) request.getSession().getAttribute("userKey");
} }
List<AdministrationP> administrationPList = LinkInterfaceUtil.findCompanyBySuperior(company, token,userKey); List<AdministrationP> administrationPList = PublicConfig.findCompanyBySuperior(company, token,userKey);
int size = administrationPList.size(); int size = administrationPList.size();
return new RestResponse(administrationPList, size, 200); return new RestResponse(administrationPList, size, 200);
} }
@ -256,7 +255,7 @@ public class CompanyController {
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
Map<String, Object> userParam = new HashMap<>(); Map<String, Object> userParam = new HashMap<>();
userParam.put("position", ObjectFormatUtil.toInteger(map.get("userid"))); userParam.put("position", ObjectFormatUtil.toInteger(map.get("userid")));
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(userParam, userKey,token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(userParam, userKey,token);
Integer success = 0; Integer success = 0;
if (map.containsKey("depositoryId")) { if (map.containsKey("depositoryId")) {
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
@ -383,8 +382,8 @@ public class CompanyController {
Map<String, Object> userParam = new HashMap<>(); Map<String, Object> userParam = new HashMap<>();
Integer postId = ObjectFormatUtil.toInteger(map.get("postId")); Integer postId = ObjectFormatUtil.toInteger(map.get("postId"));
userParam.put("position", postId); userParam.put("position", postId);
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(userParam, userKey,token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(userParam, userKey,token);
Post postById = LinkInterfaceUtil.findPostById(postId, userKey,token); Post postById = PublicConfig.findPostById(postId, userKey,token);
List<RoleAndDepository> roleAndDepositoryByCondition = new ArrayList<>(); List<RoleAndDepository> roleAndDepositoryByCondition = new ArrayList<>();
if (userByPortList.size() != 0) { if (userByPortList.size() != 0) {
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();

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

@ -1,6 +1,5 @@
package com.dreamchaser.depository_manage.controller; package com.dreamchaser.depository_manage.controller;
import com.alibaba.excel.util.ListUtils;
import com.dreamchaser.depository_manage.config.PublicConfig; 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;
@ -80,7 +79,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 = LinkInterfaceUtil.getCompany(depository.getCid(), userKey, token); Administration company = PublicConfig.getCompany(depository.getCid(), userKey, token);
depository.setCname(company.getName()); depository.setCname(company.getName());
} }
return new RestResponse(list, depositoryService.findCountByCondition(map), 200); return new RestResponse(list, depositoryService.findCountByCondition(map), 200);
@ -113,7 +112,7 @@ public class DepositoryController {
} }
List<Depository> list = depositoryService.findDepositoryByCondition(map, userKey, token); List<Depository> list = depositoryService.findDepositoryByCondition(map, userKey, token);
// 获取所有行政单位 // 获取所有行政单位
Map<String, Object> administration = LinkInterfaceUtil.findAdministration(userKey, token); Map<String, Object> administration = PublicConfig.findAdministration(userKey, token);
List<AdministrationP> administrationPList = (List<AdministrationP>) administration.get("administrationPList"); List<AdministrationP> administrationPList = (List<AdministrationP>) administration.get("administrationPList");
Integer total = (Integer) administration.get("total"); Integer total = (Integer) administration.get("total");
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
@ -996,7 +995,7 @@ public class DepositoryController {
List<Integer> userIdByDid = roleService.findUserIdByDid(did); List<Integer> userIdByDid = roleService.findUserIdByDid(did);
List<UserByPortP> list = new ArrayList<>(); List<UserByPortP> list = new ArrayList<>();
for (Integer integer : userIdByDid) { for (Integer integer : userIdByDid) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(integer, userKey, token); UserByPort userByPort = PublicConfig.FindUserById(integer, userKey, token);
UserByPortP user = new UserByPortP(userByPort); UserByPortP user = new UserByPortP(userByPort);
list.add(user); list.add(user);
} }

32
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -461,7 +461,7 @@ public class DepositoryRecordController {
// 如果是个人 // 如果是个人
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserKey, finalToken); UserByPort userByPort = PublicConfig.FindUserById(uid, finalUserKey, finalToken);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -473,7 +473,7 @@ public class DepositoryRecordController {
// 定义用于获取当前岗位下的人的参数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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, null, null); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
@ -513,7 +513,7 @@ public class DepositoryRecordController {
// 如果是个人 // 如果是个人
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserKey, finalToken); UserByPort userByPort = PublicConfig.FindUserById(uid, finalUserKey, finalToken);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -525,7 +525,7 @@ public class DepositoryRecordController {
// 定义用于获取当前岗位下的人的参数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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, finalUserKey, finalToken); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserKey, finalToken);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
@ -721,7 +721,7 @@ public class DepositoryRecordController {
Object userId = map.get("userId"); Object userId = map.get("userId");
if (userId != null) { if (userId != null) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(userId), userkey, usertoken); UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(userId), userkey, usertoken);
map.put("departmenthead", userByPort.getId()); map.put("departmenthead", userByPort.getId());
map.put("depositoryManager", userToken.getId()); map.put("depositoryManager", userToken.getId());
} else { } else {
@ -937,7 +937,7 @@ public class DepositoryRecordController {
ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId()); ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId());
// 获取申请人 // 获取申请人
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationOutRecordPById.getApplicantId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(applicationOutRecordPById.getApplicantId(), userKey, token);
// 创建展示对象 // 创建展示对象
SimpleApplicationOutMinRecordP simpleApplicationOutMinRecordP = new SimpleApplicationOutMinRecordP(applicationOutMinById); SimpleApplicationOutMinRecordP simpleApplicationOutMinRecordP = new SimpleApplicationOutMinRecordP(applicationOutMinById);
// 设置展示时的数量为申请数-已出库数 // 设置展示时的数量为申请数-已出库数
@ -968,7 +968,7 @@ public class DepositoryRecordController {
if (checkId != null) { if (checkId != null) {
// 如果该订单已经处理 // 如果该订单已经处理
// 获取处理人 // 获取处理人
UserByPort checker = LinkInterfaceUtil.FindUserById(checkId, userKey, token); UserByPort checker = PublicConfig.FindUserById(checkId, userKey, token);
simpleApplicationOutMinRecordP.setCheckerName(checker.getName()); simpleApplicationOutMinRecordP.setCheckerName(checker.getName());
simpleApplicationOutMinRecordP.setPcode(placeByDid.getCode()); simpleApplicationOutMinRecordP.setPcode(placeByDid.getCode());
// 当已经完成出库时设置数量为出库数 // 当已经完成出库时设置数量为出库数
@ -1114,7 +1114,7 @@ public class DepositoryRecordController {
if ("".equals(value)) { if ("".equals(value)) {
continue; continue;
} }
UserByPort departmenthead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(value), userKey, token); UserByPort departmenthead = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(value), userKey, token);
if ("".equals(useAdminorgName)) { if ("".equals(useAdminorgName)) {
useAdminorgName = departmenthead.getMaindeparmentname(); useAdminorgName = departmenthead.getMaindeparmentname();
} else { } else {
@ -1597,7 +1597,7 @@ public class DepositoryRecordController {
// 如果是针对人 // 如果是针对人
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserkey, finalUsertoken); UserByPort userByPort = PublicConfig.FindUserById(uid, finalUserkey, finalUsertoken);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -1610,7 +1610,7 @@ public class DepositoryRecordController {
// 定义用于获取当前岗位下的人的参数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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
@ -1653,7 +1653,7 @@ public class DepositoryRecordController {
// 如果是对人 // 如果是对人
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserkey, finalUsertoken); UserByPort userByPort = PublicConfig.FindUserById(uid, finalUserkey, finalUsertoken);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -1665,7 +1665,7 @@ public class DepositoryRecordController {
// 定义用于获取当前岗位下的人的参数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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
@ -1881,7 +1881,7 @@ public class DepositoryRecordController {
Integer uid = mt.getUid(); Integer uid = mt.getUid();
if (classes == 1) { if (classes == 1) {
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserkey, finalUsertoken); UserByPort userByPort = PublicConfig.FindUserById(uid, finalUserkey, finalUsertoken);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -1891,7 +1891,7 @@ public class DepositoryRecordController {
// 定义用于获取当前岗位下的人的参数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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
@ -1931,7 +1931,7 @@ public class DepositoryRecordController {
Integer uid = mt.getUserId(); Integer uid = mt.getUserId();
if (classes == 1) { if (classes == 1) {
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(uid, finalUserkey, finalUsertoken); UserByPort userByPort = PublicConfig.FindUserById(uid, finalUserkey, finalUsertoken);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -1941,7 +1941,7 @@ public class DepositoryRecordController {
// 定义用于获取当前岗位下的人的参数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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, finalUserkey, finalUsertoken);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {

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

@ -856,7 +856,7 @@ public class GroupController {
// 执行结果 // 执行结果
Integer integer = 0; Integer integer = 0;
// 实际结果 // 实际结果
Integer result = 0; int result = 0;
// 获取当前出库类型 // 获取当前出库类型
String type = (String) map.get("type"); String type = (String) map.get("type");

72
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -108,7 +108,7 @@ public class PageController {
@GetMapping("/login") @GetMapping("/login")
public ModelAndView login(HttpServletRequest request) { public ModelAndView login(HttpServletRequest request) {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
JSONObject captcha = LinkInterfaceUtil.Captcha(request); JSONObject captcha = PublicConfig.Captcha(request);
String picPath = (String) captcha.get("picPath"); String picPath = (String) captcha.get("picPath");
String captchaid = (String) captcha.get("captchaid"); String captchaid = (String) captcha.get("captchaid");
mv.addObject("picPath", picPath); mv.addObject("picPath", picPath);
@ -320,7 +320,7 @@ public class PageController {
UserByPort userByPort = AuthenticationTokenPool.getUserToken(token); UserByPort userByPort = AuthenticationTokenPool.getUserToken(token);
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/warehouse/depository_add"); mv.setViewName("pages/warehouse/depository_add");
Map<String, Object> administration = LinkInterfaceUtil.findAdministration(userKey, token); Map<String, Object> administration = PublicConfig.findAdministration(userKey, token);
List<AdministrationP> administrationPList = (List<AdministrationP>) administration.get("administrationPList"); List<AdministrationP> administrationPList = (List<AdministrationP>) administration.get("administrationPList");
mv.addObject("administrationPList", administrationPList); mv.addObject("administrationPList", administrationPList);
return mv; return mv;
@ -1014,7 +1014,7 @@ public class PageController {
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/user/table-user"); mv.setViewName("pages/user/table-user");
List<AdministrationP> administrationPList = LinkInterfaceUtil.findAllCompany(userKey, token); List<AdministrationP> administrationPList = PublicConfig.findAllCompany(userKey, token);
mv.addObject("administrationPList", administrationPList); mv.addObject("administrationPList", administrationPList);
return mv; return mv;
} }
@ -1452,7 +1452,7 @@ public class PageController {
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/user/user-add"); mv.setViewName("pages/user/user-add");
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userKey, token); UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token);
UserByPortP userByPortP = new UserByPortP(userByPort); UserByPortP userByPortP = new UserByPortP(userByPort);
mv.addObject("userByPort", userByPortP); mv.addObject("userByPort", userByPortP);
mv.addObject("classes", classes); mv.addObject("classes", classes);
@ -1478,7 +1478,7 @@ public class PageController {
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/user/user-addForIn"); mv.setViewName("pages/user/user-addForIn");
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userKey, token); UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token);
UserByPortP userByPortP = new UserByPortP(userByPort); UserByPortP userByPortP = new UserByPortP(userByPort);
mv.addObject("userByPort", userByPortP); mv.addObject("userByPort", userByPortP);
mv.addObject("classes", classes); mv.addObject("classes", classes);
@ -1507,7 +1507,7 @@ public class PageController {
RoleAndDepository roleAndDepositoryById = roleService.findRoleAndDepositoryById(id); RoleAndDepository roleAndDepositoryById = roleService.findRoleAndDepositoryById(id);
UserByPortP userByPortP = null; UserByPortP userByPortP = null;
if (roleAndDepositoryById != null) { if (roleAndDepositoryById != null) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndDepositoryById.getUserId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(roleAndDepositoryById.getUserId(), userKey, token);
userByPortP = new UserByPortP(userByPort); userByPortP = new UserByPortP(userByPort);
userByPortP.setDepositoryName(roleAndDepositoryById.getDepositoryName()); userByPortP.setDepositoryName(roleAndDepositoryById.getDepositoryName());
} }
@ -1538,7 +1538,7 @@ public class PageController {
RoleAndMaterialType roleAndMaterialTypeById = roleService.findRoleAndMaterialTypeById(id); RoleAndMaterialType roleAndMaterialTypeById = roleService.findRoleAndMaterialTypeById(id);
UserByPortP userByPortP = null; UserByPortP userByPortP = null;
if (roleAndMaterialTypeById != null) { if (roleAndMaterialTypeById != null) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndMaterialTypeById.getUid(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(roleAndMaterialTypeById.getUid(), userKey, token);
userByPortP = new UserByPortP(userByPort); userByPortP = new UserByPortP(userByPort);
userByPortP.setMaterialTypeName(roleAndMaterialTypeById.getTname()); userByPortP.setMaterialTypeName(roleAndMaterialTypeById.getTname());
} }
@ -1570,8 +1570,8 @@ public class PageController {
mv.setViewName("pages/post/postRole_edit"); mv.setViewName("pages/post/postRole_edit");
Map<String, Object> userParam = new HashMap<>(); Map<String, Object> userParam = new HashMap<>();
userParam.put("position", id); userParam.put("position", id);
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(userParam, userKey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(userParam, userKey, token);
Post postById = LinkInterfaceUtil.findPostById(id, userKey, token); Post postById = PublicConfig.findPostById(id, userKey, token);
PostP pp = new PostP(postById); PostP pp = new PostP(postById);
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
param.put("depositoryId", depositoryId); param.put("depositoryId", depositoryId);
@ -1606,7 +1606,7 @@ public class PageController {
mv.addObject("depositories", depositoryService.findDepositoryAll()); mv.addObject("depositories", depositoryService.findDepositoryAll());
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("number", id.toString()); map.put("number", id.toString());
UserByPort userByPort = LinkInterfaceUtil.FindUserByMap(map, userKey, token).get(0); UserByPort userByPort = PublicConfig.FindUserByMap(map, userKey, token).get(0);
mv.addObject("user", userByPort); mv.addObject("user", userByPort);
return mv; return mv;
} }
@ -1636,8 +1636,8 @@ public class PageController {
mv.addObject("record", depositoryRecordById); mv.addObject("record", depositoryRecordById);
Integer cid = depositoryRecordById.getCid(); Integer cid = depositoryRecordById.getCid();
List<AdministrationP> postList = LinkInterfaceUtil.findCompanyBySuperior(cid.toString(), userKey, token); List<AdministrationP> postList = PublicConfig.findCompanyBySuperior(cid.toString(), userKey, token);
List<AdministrationP> administrationPList = LinkInterfaceUtil.findAllCompany(userKey, token); List<AdministrationP> administrationPList = PublicConfig.findAllCompany(userKey, token);
// 部门列表 // 部门列表
mv.addObject("postList", postList); mv.addObject("postList", postList);
// 公司列表 // 公司列表
@ -2005,7 +2005,7 @@ public class PageController {
} }
} }
// 申请人 // 申请人
UserByPort userByPort = LinkInterfaceUtil.FindUserById(recordP.getApplicantId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(recordP.getApplicantId(), userKey, token);
// 部门负责人 // 部门负责人
String departmentheads = recordP.getDepartmenthead(); String departmentheads = recordP.getDepartmenthead();
String[] split = departmentheads.split(","); String[] split = departmentheads.split(",");
@ -2014,7 +2014,7 @@ public class PageController {
if ("".equals(value)) { if ("".equals(value)) {
continue; continue;
} }
UserByPort departmenthead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(value.trim()), userKey, token); UserByPort departmenthead = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(value.trim()), userKey, token);
departmentHeadName.append(departmenthead.getName()).append(","); departmentHeadName.append(departmenthead.getName()).append(",");
} }
@ -2032,7 +2032,7 @@ public class PageController {
continue; continue;
} }
Integer managerid = ObjectFormatUtil.toInteger(s.trim()); Integer managerid = ObjectFormatUtil.toInteger(s.trim());
UserByPort user = LinkInterfaceUtil.FindUserById(managerid, userKey, token); UserByPort user = PublicConfig.FindUserById(managerid, userKey, token);
depositoryManager.add(user); depositoryManager.add(user);
depositoryManagerNames.append(user.getName()).append(","); depositoryManagerNames.append(user.getName()).append(",");
} }
@ -2043,7 +2043,7 @@ public class PageController {
String[] strings = balancePoster.split(","); String[] strings = balancePoster.split(",");
for (String string : strings) { for (String string : strings) {
if (!"".equals(string)) { if (!"".equals(string)) {
UserByPort user = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(string), userKey, token); UserByPort user = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(string), userKey, token);
balancePosterName.append(user.getName()).append(","); balancePosterName.append(user.getName()).append(",");
} }
} }
@ -2134,7 +2134,7 @@ public class PageController {
for (String approverId : airapproverId for (String approverId : airapproverId
) { ) {
if (!"".equals(approverId)) { if (!"".equals(approverId)) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(approverId), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(approverId), userKey, token);
airapproverName.append(userByPort.getName()).append(","); airapproverName.append(userByPort.getName()).append(",");
} }
} }
@ -2143,7 +2143,7 @@ public class PageController {
if (Integer.compare(flagForGroup, 2) != 0) { if (Integer.compare(flagForGroup, 2) != 0) {
// 如果不是组合 // 如果不是组合
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationInRecordPById.getApplicantId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(applicationInRecordPById.getApplicantId(), userKey, token);
applicationInRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName()); applicationInRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName());
applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordPById.getApplicantTime()))); applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordPById.getApplicantTime())));
if (applicationInRecordPById.getPrice() != null) { if (applicationInRecordPById.getPrice() != null) {
@ -2213,7 +2213,7 @@ public class PageController {
for (String approverId : airapproverId for (String approverId : airapproverId
) { ) {
if (!"".equals(approverId)) { if (!"".equals(approverId)) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(approverId), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(approverId), userKey, token);
airapproverName.append(userByPort.getName()).append(","); airapproverName.append(userByPort.getName()).append(",");
} }
} }
@ -2223,7 +2223,7 @@ public class PageController {
mv.addObject("placeCode", placeCode); mv.addObject("placeCode", placeCode);
if (Integer.compare(flagForGroup, 2) != 0) { if (Integer.compare(flagForGroup, 2) != 0) {
// 如果不是组合 // 如果不是组合
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationInRecordPById.getApplicantId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(applicationInRecordPById.getApplicantId(), userKey, token);
applicationInRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName()); applicationInRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName());
applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordPById.getApplicantTime()))); applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordPById.getApplicantTime())));
if (applicationInRecordPById.getPrice() != null) { if (applicationInRecordPById.getPrice() != null) {
@ -2281,7 +2281,7 @@ public class PageController {
// 获取处理人 // 获取处理人
Integer checkId = recordMinP.getCheckId(); Integer checkId = recordMinP.getCheckId();
if (checkId != null) { if (checkId != null) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(checkId, userKey, token); UserByPort userByPort = PublicConfig.FindUserById(checkId, userKey, token);
// 设置处理人姓名 // 设置处理人姓名
recordMinP.setCheckerName(userByPort.getName()); recordMinP.setCheckerName(userByPort.getName());
@ -2386,7 +2386,7 @@ public class PageController {
String[] split = balancePoster.split(","); String[] split = balancePoster.split(",");
for (String s : split) { for (String s : split) {
if (!"".equals(s)) { if (!"".equals(s)) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(Integer.parseInt(s), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(Integer.parseInt(s), userKey, token);
balancePosterName.append(userByPort.getName()).append(","); balancePosterName.append(userByPort.getName()).append(",");
} }
} }
@ -2486,7 +2486,7 @@ public class PageController {
if (outDisPoserIdList.size() > 0) { if (outDisPoserIdList.size() > 0) {
for (Integer outDispositorId : outDisPoserIdList for (Integer outDispositorId : outDisPoserIdList
) { ) {
UserByPort disposer = LinkInterfaceUtil.FindUserById(outDispositorId, userKey, token); UserByPort disposer = PublicConfig.FindUserById(outDispositorId, userKey, token);
outDisposer.append(disposer.getName()).append(","); outDisposer.append(disposer.getName()).append(",");
} }
} }
@ -2504,7 +2504,7 @@ public class PageController {
// 申请人Id // 申请人Id
Integer applicantId = applicationOutRecordPById.getApplicantId(); Integer applicantId = applicationOutRecordPById.getApplicantId();
// 获取申请人信息 // 获取申请人信息
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicantId, userKey, token); UserByPort userByPort = PublicConfig.FindUserById(applicantId, userKey, token);
// 部门负责人 // 部门负责人
String departmentHead = applicationOutRecordPById.getDepartmenthead(); String departmentHead = applicationOutRecordPById.getDepartmenthead();
String[] split = departmentHead.split(","); String[] split = departmentHead.split(",");
@ -2518,7 +2518,7 @@ public class PageController {
if ("".equals(value)) { if ("".equals(value)) {
continue; continue;
} }
UserByPort departmenthead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(value), userKey, token); UserByPort departmenthead = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(value), userKey, token);
departmentHeadName.append(departmenthead.getName()).append(","); departmentHeadName.append(departmenthead.getName()).append(",");
useAdminorgName = departmenthead.getMaindeparmentname(); useAdminorgName = departmenthead.getMaindeparmentname();
} }
@ -2535,7 +2535,7 @@ public class PageController {
continue; continue;
} }
Integer managerid = ObjectFormatUtil.toInteger(s); Integer managerid = ObjectFormatUtil.toInteger(s);
UserByPort user = LinkInterfaceUtil.FindUserById(managerid, userKey, token); UserByPort user = PublicConfig.FindUserById(managerid, userKey, token);
depositoryManager.add(user); depositoryManager.add(user);
depositoryManagerNames.append(user.getName()); depositoryManagerNames.append(user.getName());
} }
@ -2547,7 +2547,7 @@ public class PageController {
Integer adminorgId = applicationOutRecordPById.getAdminorgId(); Integer adminorgId = applicationOutRecordPById.getAdminorgId();
Integer constructionUnitId = applicationOutRecordPById.getConstructionUnitId(); Integer constructionUnitId = applicationOutRecordPById.getConstructionUnitId();
if (adminorgId != null) { if (adminorgId != null) {
Administration company = LinkInterfaceUtil.getCompany(adminorgId, userKey, token); Administration company = PublicConfig.getCompany(adminorgId, userKey, token);
applicationOutRecordPById.setAdminorgName(company.getName()); applicationOutRecordPById.setAdminorgName(company.getName());
mv.addObject("adisplay", "table-row"); mv.addObject("adisplay", "table-row");
} else { } else {
@ -2681,7 +2681,7 @@ public class PageController {
stp.setCreateTime(DateUtil.TimeStampToDateTime(stockTaking.getCreateTime())); stp.setCreateTime(DateUtil.TimeStampToDateTime(stockTaking.getCreateTime()));
// 获取申请人 // 获取申请人
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(stockTaking.getOriginator(), userKey, token);
// 设置盘点发起人姓名 // 设置盘点发起人姓名
stp.setOriginatorName(userByPort.getName()); stp.setOriginatorName(userByPort.getName());
@ -2759,7 +2759,7 @@ public class PageController {
// 获取申请人 // 获取申请人
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(stockTaking.getOriginator(), userKey, token);
// 设置盘点发起人姓名 // 设置盘点发起人姓名
stp.setOriginatorName(userByPort.getName()); stp.setOriginatorName(userByPort.getName());
@ -2802,7 +2802,7 @@ public class PageController {
userKey = (String) request.getSession().getAttribute("userKey"); userKey = (String) request.getSession().getAttribute("userKey");
} }
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
Administration company = LinkInterfaceUtil.getCompany(userToken.getMaindeparment(), userKey, token); Administration company = PublicConfig.getCompany(userToken.getMaindeparment(), userKey, token);
userToken.setMaindeparmentname(company.getName()); userToken.setMaindeparmentname(company.getName());
mv.addObject("userInfo", userToken); mv.addObject("userInfo", userToken);
return mv; return mv;
@ -2861,7 +2861,7 @@ public class PageController {
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/company/company-out_back"); mv.setViewName("pages/company/company-out_back");
List<AdministrationP> administrationPList = LinkInterfaceUtil.findAllCompany(userKey, token); List<AdministrationP> administrationPList = PublicConfig.findAllCompany(userKey, token);
mv.addObject("administrationPList", administrationPList); mv.addObject("administrationPList", administrationPList);
mv.addObject("level", 3); mv.addObject("level", 3);
mv.addObject("parentId", "313"); mv.addObject("parentId", "313");
@ -2917,7 +2917,7 @@ public class PageController {
JSONObject jsonObject = JSONObject.parseObject(post); JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data"); JSONObject data = (JSONObject) jsonObject.get("data");
Administration administration = JSONObject.toJavaObject(data, Administration.class); Administration administration = JSONObject.toJavaObject(data, Administration.class);
String SuperiorName = LinkInterfaceUtil.getCompany(administration.getSuperior(), userKey, token).getName(); String SuperiorName = PublicConfig.getCompany(administration.getSuperior(), userKey, token).getName();
mv.addObject("record", administration); mv.addObject("record", administration);
mv.addObject("SuperiorName", SuperiorName); mv.addObject("SuperiorName", SuperiorName);
} else { } else {
@ -2948,7 +2948,7 @@ public class PageController {
if (parentId != null) { if (parentId != null) {
mv.addObject("parentId", parentId); mv.addObject("parentId", parentId);
mv.addObject("level", level + 1); mv.addObject("level", level + 1);
List<AdministrationP> administrationPList = LinkInterfaceUtil.findCompanyBySuperior(parentId.toString(), userKey, token); List<AdministrationP> administrationPList = PublicConfig.findCompanyBySuperior(parentId.toString(), userKey, token);
if (administrationPList.size() > 0) { if (administrationPList.size() > 0) {
mv.addObject("administrationPList", administrationPList); mv.addObject("administrationPList", administrationPList);
mv.setViewName("pages/company/company-out"); mv.setViewName("pages/company/company-out");
@ -3030,7 +3030,7 @@ public class PageController {
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/post/post-view"); mv.setViewName("pages/post/post-view");
if (id != null) { if (id != null) {
Post object = LinkInterfaceUtil.findPostById(id, userKey, token); Post object = PublicConfig.findPostById(id, userKey, token);
mv.addObject("record", object); mv.addObject("record", object);
} else { } else {
throw new MyException("缺少必要参数!"); throw new MyException("缺少必要参数!");
@ -3099,7 +3099,7 @@ public class PageController {
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
ModelAndView mv = new ModelAndView(); ModelAndView mv = new ModelAndView();
mv.setViewName("pages/post/postRole_add"); mv.setViewName("pages/post/postRole_add");
Post postById = LinkInterfaceUtil.findPostById(id, userKey, token); Post postById = PublicConfig.findPostById(id, userKey, token);
mv.addObject("post", postById); mv.addObject("post", postById);
mv.addObject("classes", classes); mv.addObject("classes", classes);
return mv; return mv;
@ -3748,7 +3748,7 @@ public class PageController {
Integer minRecordId = ObjectFormatUtil.toInteger(s.split(":")[1].trim()); Integer minRecordId = ObjectFormatUtil.toInteger(s.split(":")[1].trim());
ApplicationOutRecordMinP applicationOutMinById = depositoryRecordService.findApplicationOutMinById(minRecordId); ApplicationOutRecordMinP applicationOutMinById = depositoryRecordService.findApplicationOutMinById(minRecordId);
ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId()); ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId());
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationOutRecordPById.getApplicantId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(applicationOutRecordPById.getApplicantId(), userKey, token);
applicationOutRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName()); applicationOutRecordPById.setApplicantName(userByPort.getMaindeparmentname() + "_" + userByPort.getName());
SimpleTaskP simpleTaskP = new SimpleTaskP(applicationOutRecordPById, applicationOutMinById); SimpleTaskP simpleTaskP = new SimpleTaskP(applicationOutRecordPById, applicationOutMinById);
list.add(simpleTaskP); list.add(simpleTaskP);

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

@ -19,7 +19,6 @@ import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.DepositoryService; import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.StockTakingService; 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.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.Md5; import com.dreamchaser.depository_manage.utils.Md5;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import com.dreamchaser.depository_manage.utils.QyWxXMLUtils; import com.dreamchaser.depository_manage.utils.QyWxXMLUtils;
@ -290,7 +289,7 @@ public class QyWxOperationController {
e.printStackTrace(); e.printStackTrace();
} }
} else { } else {
JSONObject captcha = LinkInterfaceUtil.Captcha(request); JSONObject captcha = PublicConfig.Captcha(request);
String picPath = (String) captcha.get("picPath"); String picPath = (String) captcha.get("picPath");
String captchaid = (String) captcha.get("captchaid"); String captchaid = (String) captcha.get("captchaid");
mv.addObject("picPath", picPath); mv.addObject("picPath", picPath);
@ -298,14 +297,14 @@ public class QyWxOperationController {
mv.addObject("userWxId", userId); mv.addObject("userWxId", userId);
} }
} else { } else {
JSONObject captcha = LinkInterfaceUtil.Captcha(request); JSONObject captcha = PublicConfig.Captcha(request);
String picPath = (String) captcha.get("picPath"); String picPath = (String) captcha.get("picPath");
String captchaid = (String) captcha.get("captchaid"); String captchaid = (String) captcha.get("captchaid");
mv.addObject("picPath", picPath); mv.addObject("picPath", picPath);
mv.addObject("captchaid", captchaid); mv.addObject("captchaid", captchaid);
} }
} else { } else {
JSONObject captcha = LinkInterfaceUtil.Captcha(request); JSONObject captcha = PublicConfig.Captcha(request);
String picPath = (String) captcha.get("picPath"); String picPath = (String) captcha.get("picPath");
String captchaid = (String) captcha.get("captchaid"); String captchaid = (String) captcha.get("captchaid");
mv.addObject("picPath", picPath); mv.addObject("picPath", picPath);

12
src/main/java/com/dreamchaser/depository_manage/controller/UserController.java

@ -217,7 +217,7 @@ public class UserController {
// 如果是部门级别 // 如果是部门级别
paramForUser.put("adminorg", userToken.getMaindeparment()); paramForUser.put("adminorg", userToken.getMaindeparment());
} }
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(paramForUser, userkey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForUser, userkey, token);
List<UserByPortP> userByPortP = new ArrayList<>(); List<UserByPortP> userByPortP = new ArrayList<>();
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
// 获取当前用户的用工关系 // 获取当前用户的用工关系
@ -406,7 +406,7 @@ public class UserController {
@GetMapping("/getCaptchaid") @GetMapping("/getCaptchaid")
public JSONObject getCaptchaid(HttpServletRequest httpServletRequest, HttpServletResponse response) { public JSONObject getCaptchaid(HttpServletRequest httpServletRequest, HttpServletResponse response) {
response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Origin", "*");
JSONObject captcha = LinkInterfaceUtil.Captcha(httpServletRequest); JSONObject captcha = PublicConfig.Captcha(httpServletRequest);
return captcha; return captcha;
} }
@ -434,7 +434,7 @@ public class UserController {
String classes = (String) map.get("classes"); String classes = (String) map.get("classes");
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(map); List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(map);
for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndDepository.getUserId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(roleAndDepository.getUserId(), userKey, token);
UserByPortP up = new UserByPortP(userByPort); UserByPortP up = new UserByPortP(userByPort);
up.setId(roleAndDepository.getId()); up.setId(roleAndDepository.getId());
up.setDepositoryName(roleAndDepository.getDepositoryName()); up.setDepositoryName(roleAndDepository.getDepositoryName());
@ -457,7 +457,7 @@ public class UserController {
List<RoleAndMaterialType> roleAndMaterialTypeByCondition = roleService.findRoleAndMaterialTypeByCondition(map); List<RoleAndMaterialType> roleAndMaterialTypeByCondition = roleService.findRoleAndMaterialTypeByCondition(map);
for (RoleAndMaterialType roleAndMaterialType : roleAndMaterialTypeByCondition for (RoleAndMaterialType roleAndMaterialType : roleAndMaterialTypeByCondition
) { ) {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndMaterialType.getUid(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(roleAndMaterialType.getUid(), userKey, token);
UserByPortP up = new UserByPortP(userByPort); UserByPortP up = new UserByPortP(userByPort);
up.setId(roleAndMaterialType.getId()); up.setId(roleAndMaterialType.getId());
up.setMaterialTypeName(roleAndMaterialType.getTname()); up.setMaterialTypeName(roleAndMaterialType.getTname());
@ -483,7 +483,7 @@ public class UserController {
userKey = (String) request.getSession().getAttribute("userKey"); userKey = (String) request.getSession().getAttribute("userKey");
} }
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
List<String> stringList = LinkInterfaceUtil.getUserAccessToAddresses(userKey, token); List<String> stringList = PublicConfig.getUserAccessToAddresses(userKey, token);
List<AccesstoAddress> accessToAddressByList = accessAddressService.findAccessToAddressByList(stringList); List<AccesstoAddress> accessToAddressByList = accessAddressService.findAccessToAddressByList(stringList);
// 获取顶级菜单 // 获取顶级菜单
List<AccesstoAddress> menusByNoParent = new ArrayList<>(); List<AccesstoAddress> menusByNoParent = new ArrayList<>();
@ -589,7 +589,7 @@ public class UserController {
} }
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
// 获取当前用户可见的菜单id // 获取当前用户可见的菜单id
List<String> stringList = LinkInterfaceUtil.getUserAccessToAddresses(userKey, token); List<String> stringList = PublicConfig.getUserAccessToAddresses(userKey, token);
// 根据菜单id获取菜单信息 // 根据菜单id获取菜单信息
List<AccesstoAddress> accessToAddressByList = accessAddressService.findAccessToAddressByList(stringList); List<AccesstoAddress> accessToAddressByList = accessAddressService.findAccessToAddressByList(stringList);
List<AccesstoAddress> result = new ArrayList<>(); List<AccesstoAddress> result = new ArrayList<>();

5
src/main/java/com/dreamchaser/depository_manage/service/impl/CompanyServiceImpl.java

@ -10,7 +10,6 @@ import com.dreamchaser.depository_manage.mapper.CompanyMapper;
import com.dreamchaser.depository_manage.mapper.ConstructionUnitMapper; import com.dreamchaser.depository_manage.mapper.ConstructionUnitMapper;
import com.dreamchaser.depository_manage.service.CompanyService; import com.dreamchaser.depository_manage.service.CompanyService;
import com.dreamchaser.depository_manage.utils.HttpUtils; import com.dreamchaser.depository_manage.utils.HttpUtils;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import org.apache.http.protocol.HTTP; import org.apache.http.protocol.HTTP;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -266,7 +265,7 @@ public class CompanyServiceImpl implements CompanyService {
@Override @Override
public JSONArray BuildOrgAndPostThree(String userKey,String token) { public JSONArray BuildOrgAndPostThree(String userKey,String token) {
JSONArray orgAndPostThree = LinkInterfaceUtil.getOrgAndPostThree(userKey,token); JSONArray orgAndPostThree = PublicConfig.getOrgAndPostThree(userKey,token);
// 将获取到的json字符串进行修改为使用的结构 // 将获取到的json字符串进行修改为使用的结构
String replace = JSONObject.toJSONString(orgAndPostThree).replace("name", "title").replace("child", "children"); String replace = JSONObject.toJSONString(orgAndPostThree).replace("name", "title").replace("child", "children");
// 将其变回json格式 // 将其变回json格式
@ -282,7 +281,7 @@ public class CompanyServiceImpl implements CompanyService {
* @return * @return
*/ */
public List<Object> buildPostTree(UserByPort userByPort,String userKey,String token){ public List<Object> buildPostTree(UserByPort userByPort,String userKey,String token){
JSONArray postTree = LinkInterfaceUtil.getPostTree(userByPort,userKey,token); JSONArray postTree = PublicConfig.getPostTree(userByPort,userKey,token);
// 定义线程数量 // 定义线程数量
int threadSize = postTree.size(); int threadSize = postTree.size();
// 开启对应数量的线程 // 开启对应数量的线程

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

@ -266,7 +266,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 = LinkInterfaceUtil.getCompany(userToken.getMaindeparment(), userKey, token); Administration company = PublicConfig.getCompany(userToken.getMaindeparment(), userKey, token);
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);
@ -748,7 +748,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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, null, null); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
approverId.append(userByPort.getId()).append(","); approverId.append(userByPort.getId()).append(",");
} }
@ -783,7 +783,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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, null, null); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
approverId.append(userByPort.getId()).append(","); approverId.append(userByPort.getId()).append(",");
} }
@ -1904,7 +1904,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 强行完成出库 // 强行完成出库
// 获取当前出库人员 // 获取当前出库人员
UserByPort userByPort = LinkInterfaceUtil.FindUserById(outRecordMin.getCheckId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(outRecordMin.getCheckId(), userKey, token);
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);
@ -1923,7 +1923,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (RoleAndMaterialType mt : materialTypeIdForIn for (RoleAndMaterialType mt : materialTypeIdForIn
) { ) {
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(mt.getUid(), userKey, token);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -1936,7 +1936,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (RoleAndDepository mt : materialTypeIdForIn for (RoleAndDepository mt : materialTypeIdForIn
) { ) {
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(mt.getUserId(), userKey, token);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -2206,7 +2206,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
continue; continue;
} }
Integer uid = ObjectFormatUtil.toInteger(s); Integer uid = ObjectFormatUtil.toInteger(s);
UserByPort depositoryManager = LinkInterfaceUtil.FindUserById(uid, userKey, token); UserByPort depositoryManager = PublicConfig.FindUserById(uid, userKey, token);
String workwechat = depositoryManager.getWorkwechat(); String workwechat = depositoryManager.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = depositoryManager.getWechat(); workwechat = depositoryManager.getWechat();
@ -2374,7 +2374,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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token);
for (UserByPort userByPort1 : userByPortList) { for (UserByPort userByPort1 : userByPortList) {
Integer userId1 = userByPort1.getId(); Integer userId1 = userByPort1.getId();
// 修改redis中用户的数据 // 修改redis中用户的数据
@ -2393,7 +2393,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (Integer integer : userIdByDid) { for (Integer integer : userIdByDid) {
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); UserByPort manager = PublicConfig.FindUserById(integer, userKey, token);
updateRedisDataForUserManager(integer, minRecordKey); updateRedisDataForUserManager(integer, minRecordKey);
minRecordManage.append(integer).append(","); minRecordManage.append(integer).append(",");
String workwechat = manager.getWorkwechat(); String workwechat = manager.getWorkwechat();
@ -2453,7 +2453,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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token);
for (UserByPort userByPort1 : userByPortList) { for (UserByPort userByPort1 : userByPortList) {
Integer userId1 = userByPort1.getId(); Integer userId1 = userByPort1.getId();
// 修改redis中用户的数据 // 修改redis中用户的数据
@ -2474,7 +2474,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 修改redis中用户的数据 // 修改redis中用户的数据
updateRedisDataForUserManager(integer, minRecordKey); updateRedisDataForUserManager(integer, minRecordKey);
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); UserByPort manager = PublicConfig.FindUserById(integer, userKey, token);
minRecordManage.append(integer).append(","); minRecordManage.append(integer).append(",");
String workwechat = manager.getWorkwechat(); String workwechat = manager.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
@ -2919,7 +2919,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 = LinkInterfaceUtil.getCompany(userByPort.getMaindeparment(), userKey, token); Administration company = PublicConfig.getCompany(userByPort.getMaindeparment(), userKey, token);
// 生成出库订单 // 生成出库订单
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");
@ -3009,7 +3009,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<ApplicationOutRecordMin> minByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(record.getId()); List<ApplicationOutRecordMin> minByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(record.getId());
// 获取申请用户 // 获取申请用户
UserByPort applicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey, token); UserByPort applicantUser = PublicConfig.FindUserById(record.getApplicantId(), userKey, token);
// 用于标志该仓库是否为前置仓下的仓库 // 用于标志该仓库是否为前置仓下的仓库
boolean flagForHasOtherDepository = true; //默认是前置仓下的仓库 boolean flagForHasOtherDepository = true; //默认是前置仓下的仓库
// 获取当前出库是否为开放出库 // 获取当前出库是否为开放出库
@ -3160,7 +3160,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(depositorymanager)) { if ("".equals(depositorymanager)) {
continue; continue;
} }
UserByPort depositoryManage = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(depositorymanager), userKey, token); UserByPort depositoryManage = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(depositorymanager), userKey, token);
String departmentHeadWorkwechat = depositoryManage.getWorkwechat(); String departmentHeadWorkwechat = depositoryManage.getWorkwechat();
if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) { if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) {
departmentHeadWorkwechat = depositoryManage.getWechat(); departmentHeadWorkwechat = depositoryManage.getWechat();
@ -3214,7 +3214,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(s), userKey, token);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -3267,7 +3267,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(depositorymanager)) { if ("".equals(depositorymanager)) {
continue; continue;
} }
UserByPort depositoryManage = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(depositorymanager), userKey, token); UserByPort depositoryManage = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(depositorymanager), userKey, token);
String departmentHeadWorkwechat = depositoryManage.getWorkwechat(); String departmentHeadWorkwechat = depositoryManage.getWorkwechat();
if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) { if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) {
departmentHeadWorkwechat = depositoryManage.getWechat(); departmentHeadWorkwechat = depositoryManage.getWechat();
@ -3321,7 +3321,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(s), userKey, token);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -3436,7 +3436,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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
Integer userId = userByPort.getId(); Integer userId = userByPort.getId();
// 修改redis中用户的数据 // 修改redis中用户的数据
@ -3455,7 +3455,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (Integer integer : userIdByDid) { for (Integer integer : userIdByDid) {
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); UserByPort manager = PublicConfig.FindUserById(integer, userKey, token);
updateRedisDataForUserManager(integer, minRecordKey); updateRedisDataForUserManager(integer, minRecordKey);
minRecordManage.append(integer).append(","); minRecordManage.append(integer).append(",");
String workwechat = manager.getWorkwechat(); String workwechat = manager.getWorkwechat();
@ -3514,7 +3514,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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
Integer userId = userByPort.getId(); Integer userId = userByPort.getId();
// 修改redis中用户的数据 // 修改redis中用户的数据
@ -3535,7 +3535,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 修改redis中用户的数据 // 修改redis中用户的数据
updateRedisDataForUserManager(integer, minRecordKey); updateRedisDataForUserManager(integer, minRecordKey);
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); UserByPort manager = PublicConfig.FindUserById(integer, userKey, token);
minRecordManage.append(integer).append(","); minRecordManage.append(integer).append(",");
String workwechat = manager.getWorkwechat(); String workwechat = manager.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
@ -3568,7 +3568,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(s), userKey, token);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -3610,7 +3610,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
// 获取responseCode(key为申请人number) // 获取responseCode(key为申请人number)
//获取部门负责人信息 //获取部门负责人信息
UserByPort departHead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(record.getDepartmenthead()), userKey, token); UserByPort departHead = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(record.getDepartmenthead()), userKey, token);
String key = "user:" + departHead.getNumber() + ":QyWxOutId:" + id; String key = "user:" + departHead.getNumber() + ":QyWxOutId:" + id;
String responseCode = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(key, "responseCode"); String responseCode = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get(key, "responseCode");
qyWxOperationService.updateButtonTemplateCardToUnEnable(responseCode, userToken.getName(), finalResult, userAgent); qyWxOperationService.updateButtonTemplateCardToUnEnable(responseCode, userToken.getName(), finalResult, userAgent);
@ -3796,7 +3796,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort userById = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null, null); UserByPort userById = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(s), null, null);
String workwechat = userById.getWorkwechat(); String workwechat = userById.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userById.getWechat(); workwechat = userById.getWechat();
@ -3914,7 +3914,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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token);
for (UserByPort userByPort1 : userByPortList) { for (UserByPort userByPort1 : userByPortList) {
Integer userId = userByPort1.getId(); Integer userId = userByPort1.getId();
// 修改redis中用户的数据 // 修改redis中用户的数据
@ -3933,7 +3933,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (Integer integer : userIdByDid) { for (Integer integer : userIdByDid) {
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); UserByPort manager = PublicConfig.FindUserById(integer, userKey, token);
updateRedisDataForUserManager(integer, minRecordKey); updateRedisDataForUserManager(integer, minRecordKey);
minRecordManage.append(integer).append(","); minRecordManage.append(integer).append(",");
String workwechat = manager.getWorkwechat(); String workwechat = manager.getWorkwechat();
@ -3991,7 +3991,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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token);
for (UserByPort userByPort1 : userByPortList) { for (UserByPort userByPort1 : userByPortList) {
Integer userId = userByPort1.getId(); Integer userId = userByPort1.getId();
// 修改redis中用户的数据 // 修改redis中用户的数据
@ -4012,7 +4012,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 修改redis中用户的数据 // 修改redis中用户的数据
updateRedisDataForUserManager(integer, minRecordKey); updateRedisDataForUserManager(integer, minRecordKey);
// 获取仓库管理员信息 // 获取仓库管理员信息
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); UserByPort manager = PublicConfig.FindUserById(integer, userKey, token);
minRecordManage.append(integer).append(","); minRecordManage.append(integer).append(",");
String workwechat = manager.getWorkwechat(); String workwechat = manager.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
@ -4521,7 +4521,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<ApplicationInRecordP> result = new ArrayList<>(); List<ApplicationInRecordP> result = new ArrayList<>();
for (ApplicationInRecord applicationInRecord : list) { for (ApplicationInRecord applicationInRecord : list) {
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(applicationInRecord.getApplicantId(), userKey, token); UserByPort userByPortById = PublicConfig.FindUserById(applicationInRecord.getApplicantId(), userKey, token);
String time = DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecord.getApplicantTime())); String time = DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecord.getApplicantTime()));
applicationInRecord.setApplicantName(userByPortById.getName()); applicationInRecord.setApplicantName(userByPortById.getName());
applicationInRecord.setApplicantTime(time); applicationInRecord.setApplicantTime(time);
@ -4576,7 +4576,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<ApplicationInRecord> list = depositoryRecordMapper.findApplicationInRecordPByUser(map); List<ApplicationInRecord> list = depositoryRecordMapper.findApplicationInRecordPByUser(map);
List<ApplicationInRecordP> result = new ArrayList<>(); List<ApplicationInRecordP> result = new ArrayList<>();
for (ApplicationInRecord applicationInRecord : list) { for (ApplicationInRecord applicationInRecord : list) {
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(applicationInRecord.getApplicantId(), userKey, token); UserByPort userByPortById = PublicConfig.FindUserById(applicationInRecord.getApplicantId(), userKey, token);
String time = DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecord.getApplicantTime())); String time = DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecord.getApplicantTime()));
applicationInRecord.setApplicantName(userByPortById.getName()); applicationInRecord.setApplicantName(userByPortById.getName());
applicationInRecord.setApplicantTime(time); applicationInRecord.setApplicantTime(time);
@ -4652,7 +4652,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<ApplicationOutRecord> list = depositoryRecordMapper.findApplicationOutRecordPByUser(map); List<ApplicationOutRecord> list = depositoryRecordMapper.findApplicationOutRecordPByUser(map);
List<ApplicationOutRecordP> result = new ArrayList<>(); List<ApplicationOutRecordP> result = new ArrayList<>();
for (ApplicationOutRecord record : list) { for (ApplicationOutRecord record : list) {
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey, token); UserByPort userByPortById = PublicConfig.FindUserById(record.getApplicantId(), userKey, token);
String time = DateUtil.TimeStampToDateTime(Long.valueOf(record.getApplicantTime())); String time = DateUtil.TimeStampToDateTime(Long.valueOf(record.getApplicantTime()));
record.setApplicantName(userByPortById.getName()); record.setApplicantName(userByPortById.getName());
record.setApplicantTime(time); record.setApplicantTime(time);
@ -4731,7 +4731,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if (recordP.getQuantity() == null || 0 == recordP.getQuantity()) { if (recordP.getQuantity() == null || 0 == recordP.getQuantity()) {
continue; continue;
} }
UserByPort userByPortById = LinkInterfaceUtil.FindUserById(recordP.getApplicantId(), userKey, token); UserByPort userByPortById = PublicConfig.FindUserById(recordP.getApplicantId(), userKey, token);
String time = DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getApplicantTime())); String time = DateUtil.TimeStampToDateTime(Long.valueOf(recordP.getApplicantTime()));
recordP.setApplicantName(userByPortById.getName()); recordP.setApplicantName(userByPortById.getName());
recordP.setApplicantTime(time); recordP.setApplicantTime(time);
@ -5392,7 +5392,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 = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(record.getApplicantId(), userKey, token);
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());
@ -5405,7 +5405,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 = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(record.getApplicantId(), userKey, token);
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);
@ -5429,15 +5429,15 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
private DepositoryRecordP singlePack(DepositoryRecord record, String userKey, String token) { private DepositoryRecordP singlePack(DepositoryRecord record, String userKey, String token) {
DepositoryRecordP d = new DepositoryRecordP(record); DepositoryRecordP d = new DepositoryRecordP(record);
UserByPort getApplicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey, token); UserByPort getApplicantUser = PublicConfig.FindUserById(record.getApplicantId(), userKey, token);
d.setApplicantName(getApplicantUser.getName()); d.setApplicantName(getApplicantUser.getName());
d.setDepositoryName(depositoryMapper.findDepositoryNameById(record.getDepositoryId())); d.setDepositoryName(depositoryMapper.findDepositoryNameById(record.getDepositoryId()));
if (record.getReviewerId() != null) { if (record.getReviewerId() != null) {
UserByPort reviewerUser = LinkInterfaceUtil.FindUserById(record.getReviewerId(), userKey, token); UserByPort reviewerUser = PublicConfig.FindUserById(record.getReviewerId(), userKey, token);
d.setReviewerName(reviewerUser.getName()); d.setReviewerName(reviewerUser.getName());
} }
if (record.getCheckerId() != null) { if (record.getCheckerId() != null) {
UserByPort checkerUser = LinkInterfaceUtil.FindUserById(record.getCheckerId(), userKey, token); UserByPort checkerUser = PublicConfig.FindUserById(record.getCheckerId(), userKey, token);
d.setCheckerName(checkerUser.getName()); d.setCheckerName(checkerUser.getName());
} }
return d; return d;

9
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryServiceImpl.java

@ -11,7 +11,6 @@ import com.dreamchaser.depository_manage.pojo.InventoryByMTAndDepository;
import com.dreamchaser.depository_manage.pojo.RoleAndDepository; import com.dreamchaser.depository_manage.pojo.RoleAndDepository;
import com.dreamchaser.depository_manage.service.DepositoryService; import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.RoleService; import com.dreamchaser.depository_manage.service.RoleService;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import com.dreamchaser.depository_manage.utils.WordUtil; import com.dreamchaser.depository_manage.utils.WordUtil;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
@ -62,12 +61,12 @@ public class DepositoryServiceImpl implements DepositoryService {
List<Depository> condition = depositoryMapper.findDepositoryByCondition(temp); List<Depository> condition = depositoryMapper.findDepositoryByCondition(temp);
// 公司编号 // 公司编号
Integer cid = ObjectFormatUtil.toInteger(map.get("cid")); Integer cid = ObjectFormatUtil.toInteger(map.get("cid"));
String companyName = LinkInterfaceUtil.getCompany(cid, userKey, token).getName(); String companyName = PublicConfig.getCompany(cid, userKey, token).getName();
String adminorgName = ""; String adminorgName = "";
// 部门编号 // 部门编号
if (!"".equals(map.get("adminorg"))) { if (!"".equals(map.get("adminorg"))) {
Integer adminorg = ObjectFormatUtil.toInteger(map.get("adminorg")); Integer adminorg = ObjectFormatUtil.toInteger(map.get("adminorg"));
adminorgName = LinkInterfaceUtil.getCompany(adminorg, userKey, token).getName(); adminorgName = PublicConfig.getCompany(adminorg, userKey, token).getName();
} }
// 公司简称 // 公司简称
companyName = WordUtil.getPinYinHeadChar(companyName); companyName = WordUtil.getPinYinHeadChar(companyName);
@ -99,7 +98,7 @@ public class DepositoryServiceImpl implements DepositoryService {
// 部门编号 // 部门编号
if (!"".equals(map.get("adminorg"))) { if (!"".equals(map.get("adminorg"))) {
Integer adminorg = ObjectFormatUtil.toInteger(map.get("adminorg")); Integer adminorg = ObjectFormatUtil.toInteger(map.get("adminorg"));
adminorgName = LinkInterfaceUtil.getCompany(adminorg, userKey, token).getName(); adminorgName = PublicConfig.getCompany(adminorg, userKey, token).getName();
adminorgName = WordUtil.getPinYinHeadChar(adminorgName).substring(0, 2); adminorgName = WordUtil.getPinYinHeadChar(adminorgName).substring(0, 2);
} }
// 获取父仓库编码 // 获取父仓库编码
@ -151,7 +150,7 @@ public class DepositoryServiceImpl implements DepositoryService {
List<Depository> list = depositoryMapper.findDepositoryByCondition(map); List<Depository> list = depositoryMapper.findDepositoryByCondition(map);
for (Depository depository : list) { for (Depository depository : list) {
if (!depository.getAdminorg().isEmpty()) { if (!depository.getAdminorg().isEmpty()) {
Administration company = LinkInterfaceUtil.getCompany(ObjectFormatUtil.toInteger(depository.getAdminorg()), userKey, token); Administration company = PublicConfig.getCompany(ObjectFormatUtil.toInteger(depository.getAdminorg()), userKey, token);
depository.setAdminorgName(company.getName()); depository.setAdminorgName(company.getName());
} }
} }

7
src/main/java/com/dreamchaser/depository_manage/service/impl/ExcelServiceImpl.java

@ -1,6 +1,5 @@
package com.dreamchaser.depository_manage.service.impl; package com.dreamchaser.depository_manage.service.impl;
import cn.hutool.core.thread.ThreadFactoryBuilder;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.enums.WriteDirectionEnum; import com.alibaba.excel.enums.WriteDirectionEnum;
@ -486,7 +485,7 @@ public class ExcelServiceImpl implements ExcelService {
// 设置单号 // 设置单号
excelInfoByWrite.setCode(record.getCode()); excelInfoByWrite.setCode(record.getCode());
// 获取当前出库单申请人 // 获取当前出库单申请人
UserByPort applicanter = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userKey, token); UserByPort applicanter = PublicConfig.FindUserById(record.getApplicantId(), userKey, token);
// 设置申请人名称 // 设置申请人名称
excelInfoByWrite.setApplicantName(applicanter.getName()); excelInfoByWrite.setApplicantName(applicanter.getName());
// 获取施工单位Id // 获取施工单位Id
@ -507,7 +506,7 @@ public class ExcelServiceImpl implements ExcelService {
if ("".equals(s)) { if ("".equals(s)) {
continue; continue;
} }
UserByPort checker = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userKey, token); UserByPort checker = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(s), userKey, token);
sb.append(checker.getName()); sb.append(checker.getName());
} }
// 设置审核人名称 // 设置审核人名称
@ -521,7 +520,7 @@ public class ExcelServiceImpl implements ExcelService {
Integer adminorgId = record.getAdminorgId(); Integer adminorgId = record.getAdminorgId();
if (adminorgId != null) { if (adminorgId != null) {
Administration company = LinkInterfaceUtil.getCompany(adminorgId, userKey, token); Administration company = PublicConfig.getCompany(adminorgId, userKey, token);
// 设置部门名称 // 设置部门名称
excelInfoByWrite.setAdminorgName(company.getName()); excelInfoByWrite.setAdminorgName(company.getName());
} else { } else {

6
src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java

@ -12,13 +12,11 @@ import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.GroupService; import com.dreamchaser.depository_manage.service.GroupService;
import com.dreamchaser.depository_manage.service.SplitUnitService; import com.dreamchaser.depository_manage.service.SplitUnitService;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import com.dreamchaser.depository_manage.utils.WordUtil; import com.dreamchaser.depository_manage.utils.WordUtil;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -713,7 +711,7 @@ public class GroupServiceImpl implements GroupService {
paramForOut.put("state", "待部门负责人审核"); paramForOut.put("state", "待部门负责人审核");
paramForOut.put("applyRemark", map.get("applyRemark")); paramForOut.put("applyRemark", map.get("applyRemark"));
// 获取当前部门名称 // 获取当前部门名称
Administration company = LinkInterfaceUtil.getCompany(userToken.getMaindeparment(), userKey, token); Administration company = PublicConfig.getCompany(userToken.getMaindeparment(), userKey, token);
// 构造出库订单编码 // 构造出库订单编码
String code = createOutCode("outOrderNumber", company.getName()); String code = createOutCode("outOrderNumber", company.getName());
paramForOut.put("code", code); paramForOut.put("code", code);
@ -862,7 +860,7 @@ public class GroupServiceImpl implements GroupService {
for (RoleAndMaterialType mt : materialTypeIdForIn for (RoleAndMaterialType mt : materialTypeIdForIn
) { ) {
// 获取管理员数据 // 获取管理员数据
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(mt.getUid(), userKey, token);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();

9
src/main/java/com/dreamchaser/depository_manage/service/impl/NoticeServiceImpl.java

@ -9,7 +9,6 @@ import com.dreamchaser.depository_manage.mapper.NoticeMapper;
import com.dreamchaser.depository_manage.pojo.NoticeP; import com.dreamchaser.depository_manage.pojo.NoticeP;
import com.dreamchaser.depository_manage.service.NoticeService; import com.dreamchaser.depository_manage.service.NoticeService;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -96,7 +95,7 @@ public class NoticeServiceImpl implements NoticeService {
JSONObject userPortByQyWx = PublicConfig.getUserPortByQyWx(userByPort.getMaindeparment()); JSONObject userPortByQyWx = PublicConfig.getUserPortByQyWx(userByPort.getMaindeparment());
Integer portByQyWxInteger = userPortByQyWx.getInteger("wechatorganizationid"); Integer portByQyWxInteger = userPortByQyWx.getInteger("wechatorganizationid");
for (Notice value : notice) { for (Notice value : notice) {
UserByPort user = LinkInterfaceUtil.FindUserById(value.getUserId(), userKey,token); UserByPort user = PublicConfig.FindUserById(value.getUserId(), userKey,token);
// 获取可见范围的 // 获取可见范围的
String viewRangeId = value.getViewRangeId(); String viewRangeId = value.getViewRangeId();
// 分割 // 分割
@ -157,7 +156,7 @@ public class NoticeServiceImpl implements NoticeService {
List<Notice> notice = noticeMapper.findNoticeByUser(map); List<Notice> notice = noticeMapper.findNoticeByUser(map);
List<NoticeP> result = new ArrayList<>(); List<NoticeP> result = new ArrayList<>();
for (Notice value : notice) { for (Notice value : notice) {
UserByPort user = LinkInterfaceUtil.FindUserById(value.getUserId(), userKey,token); UserByPort user = PublicConfig.FindUserById(value.getUserId(), userKey,token);
NoticeP np = new NoticeP(value); NoticeP np = new NoticeP(value);
np.setUserName(user.getName()); np.setUserName(user.getName());
result.add(np); result.add(np);
@ -183,7 +182,7 @@ public class NoticeServiceImpl implements NoticeService {
List<Notice> noticeByUser = noticeMapper.findNoticeByUser(map); List<Notice> noticeByUser = noticeMapper.findNoticeByUser(map);
List<NoticeP> result = new ArrayList<>(); List<NoticeP> result = new ArrayList<>();
for (Notice value : noticeByUser) { for (Notice value : noticeByUser) {
UserByPort user = LinkInterfaceUtil.FindUserById(value.getUserId(), userKey,token); UserByPort user = PublicConfig.FindUserById(value.getUserId(), userKey,token);
// 获取可见范围的 // 获取可见范围的
NoticeP np = new NoticeP(value); NoticeP np = new NoticeP(value);
np.setUserName(user.getName()); np.setUserName(user.getName());
@ -204,7 +203,7 @@ public class NoticeServiceImpl implements NoticeService {
Notice noticeById = noticeMapper.findNoticeById(id); Notice noticeById = noticeMapper.findNoticeById(id);
NoticeP noticeP = new NoticeP(noticeById); NoticeP noticeP = new NoticeP(noticeById);
// 获取发起人 // 获取发起人
UserByPort user = LinkInterfaceUtil.FindUserById(noticeById.getUserId(), userKey,token); UserByPort user = PublicConfig.FindUserById(noticeById.getUserId(), userKey,token);
noticeP.setUserName(user.getName()); noticeP.setUserName(user.getName());
return noticeP; return noticeP;
} }

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

@ -14,12 +14,10 @@ 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.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.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import sun.net.PortConfig;
import java.util.*; import java.util.*;
@ -69,7 +67,7 @@ public class QyWxOperationService {
// 申请人id // 申请人id
Integer applicantId = applicationOutRecordPById.getApplicantId(); Integer applicantId = applicationOutRecordPById.getApplicantId();
// 申请人 // 申请人
UserByPort applicant = LinkInterfaceUtil.FindUserById(applicantId, userKey, token); UserByPort applicant = PublicConfig.FindUserById(applicantId, userKey, token);
// 获取所有子订单 // 获取所有子订单
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(outId); List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(outId);
@ -264,7 +262,7 @@ public class QyWxOperationService {
// 申请人id // 申请人id
Integer getOriginator = mainRecord.getOriginator(); Integer getOriginator = mainRecord.getOriginator();
// 申请人 // 申请人
UserByPort originator = LinkInterfaceUtil.FindUserById(getOriginator, userKey, token); UserByPort originator = PublicConfig.FindUserById(getOriginator, userKey, token);
// 盘点物料名称 // 盘点物料名称
StringBuilder mname = new StringBuilder(); StringBuilder mname = new StringBuilder();
@ -501,7 +499,7 @@ public class QyWxOperationService {
// 申请人id // 申请人id
Integer getOriginator = mainRecord.getOriginator(); Integer getOriginator = mainRecord.getOriginator();
// 申请人 // 申请人
UserByPort originator = LinkInterfaceUtil.FindUserById(getOriginator, userKey, token); UserByPort originator = PublicConfig.FindUserById(getOriginator, userKey, token);
// 盘点物料名称 // 盘点物料名称
StringBuilder mname = new StringBuilder(); StringBuilder mname = new StringBuilder();
@ -730,7 +728,7 @@ public class QyWxOperationService {
// 申请人id // 申请人id
Integer applicantId = recordP.getApplicantId(); Integer applicantId = recordP.getApplicantId();
// 申请人 // 申请人
UserByPort applicant = LinkInterfaceUtil.FindUserById(applicantId, userKey, token); UserByPort applicant = PublicConfig.FindUserById(applicantId, userKey, token);
// 获取所有子订单 // 获取所有子订单
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(outId); List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(outId);
@ -764,7 +762,7 @@ public class QyWxOperationService {
// 获取仓库信息 // 获取仓库信息
Depository depositoryRecordById = depositoryMapper.findDepositoryById(recordMin.getDepositoryId()); Depository depositoryRecordById = depositoryMapper.findDepositoryById(recordMin.getDepositoryId());
// 获取处理人信息 // 获取处理人信息
UserByPort userByPort = LinkInterfaceUtil.FindUserById(recordMin.getCheckId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(recordMin.getCheckId(), userKey, token);
// 获取对应出库单位 // 获取对应出库单位
String unit = recordMin.getUnit(); String unit = recordMin.getUnit();
@ -835,7 +833,7 @@ public class QyWxOperationService {
// 抄送内容 // 抄送内容
StringBuilder content = new StringBuilder("## `抄送信息:`%n"); StringBuilder content = new StringBuilder("## `抄送信息:`%n");
// 获取发起人信息 // 获取发起人信息
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userKey, token); UserByPort originator = PublicConfig.FindUserById(mainRecord.getOriginator(), userKey, token);
// 设置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");
@ -945,7 +943,7 @@ public class QyWxOperationService {
// 抄送内容 // 抄送内容
StringBuilder content = new StringBuilder("## `盘点发生错误:`%n"); StringBuilder content = new StringBuilder("## `盘点发生错误:`%n");
// 获取发起人信息 // 获取发起人信息
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userKey, token); UserByPort originator = PublicConfig.FindUserById(mainRecord.getOriginator(), userKey, token);
// 设置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");
@ -1043,7 +1041,7 @@ public class QyWxOperationService {
// 抄送内容 // 抄送内容
StringBuilder content = new StringBuilder("## `抄送信息:`%n"); StringBuilder content = new StringBuilder("## `抄送信息:`%n");
// 获取发起人信息 // 获取发起人信息
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userKey, token); UserByPort originator = PublicConfig.FindUserById(mainRecord.getOriginator(), userKey, token);
// 设置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");
@ -1154,7 +1152,7 @@ public class QyWxOperationService {
// 申请人id // 申请人id
Integer applicantId = outRecordP.getApplicantId(); Integer applicantId = outRecordP.getApplicantId();
// 申请人 // 申请人
UserByPort applicant = LinkInterfaceUtil.FindUserById(applicantId, userKey, token); UserByPort applicant = PublicConfig.FindUserById(applicantId, userKey, token);
// 定义卡片模板 // 定义卡片模板
TemplateCard_text_notice text_notice = new TemplateCard_text_notice(); TemplateCard_text_notice text_notice = new TemplateCard_text_notice();
@ -1418,7 +1416,7 @@ public class QyWxOperationService {
if (flagForAgency == 1) { if (flagForAgency == 1) {
// 如果是代领 // 如果是代领
applicantUser = LinkInterfaceUtil.FindUserById(mainRecord.getApplicantId(), userKey, token); applicantUser = PublicConfig.FindUserById(mainRecord.getApplicantId(), userKey, token);
} }
// 事先定义其他部门负责人列表 // 事先定义其他部门负责人列表
@ -1885,7 +1883,7 @@ public class QyWxOperationService {
Integer userId = roleAndMaterialType.getUid(); Integer userId = roleAndMaterialType.getUid();
if (classes == 1) { if (classes == 1) {
// 如果是对人设置的权限 // 如果是对人设置的权限
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userKey, token); UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token);
String user = userByPort.getWorkwechat(); String user = userByPort.getWorkwechat();
if (user == null || "".equals(user)) { if (user == null || "".equals(user)) {
user = userByPort.getWechat(); user = userByPort.getWechat();
@ -1897,7 +1895,7 @@ 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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
// 获取企业微信id或微信id // 获取企业微信id或微信id
String userByPortWorkwechat = userByPort.getWorkwechat(); String userByPortWorkwechat = userByPort.getWorkwechat();
@ -1935,7 +1933,7 @@ public class QyWxOperationService {
Integer userId = roleAndDepository.getUserId(); Integer userId = roleAndDepository.getUserId();
if (classes == 1) { if (classes == 1) {
// 如果是对人设置的权限 // 如果是对人设置的权限
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userKey, token); UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token);
String user = userByPort.getWorkwechat(); String user = userByPort.getWorkwechat();
if (user == null || "".equals(user)) { if (user == null || "".equals(user)) {
user = userByPort.getWechat(); user = userByPort.getWechat();
@ -1947,7 +1945,7 @@ 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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
// 获取企业微信id或微信id // 获取企业微信id或微信id
@ -2037,7 +2035,7 @@ public class QyWxOperationService {
if ("".equals(department)) { if ("".equals(department)) {
continue; continue;
} }
UserByPort departmentHead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(department), userKey, token); UserByPort departmentHead = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(department), userKey, token);
String departmentHeadWorkwechat = departmentHead.getWorkwechat(); String departmentHeadWorkwechat = departmentHead.getWorkwechat();
if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) { if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) {
departmentHeadWorkwechat = departmentHead.getWechat(); departmentHeadWorkwechat = departmentHead.getWechat();
@ -2364,7 +2362,7 @@ public class QyWxOperationService {
if ("".equals(depositorymanager)) { if ("".equals(depositorymanager)) {
continue; continue;
} }
UserByPort depositoryManage = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(depositorymanager), userKey, token); UserByPort depositoryManage = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(depositorymanager), userKey, token);
String departmentHeadWorkwechat = depositoryManage.getWorkwechat(); String departmentHeadWorkwechat = depositoryManage.getWorkwechat();
if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) { if (departmentHeadWorkwechat == null || "".equals(departmentHeadWorkwechat)) {
departmentHeadWorkwechat = depositoryManage.getWechat(); departmentHeadWorkwechat = depositoryManage.getWechat();
@ -2402,7 +2400,7 @@ 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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
String userByPortWorkwechat = userByPort.getWorkwechat(); String userByPortWorkwechat = userByPort.getWorkwechat();
if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) {
@ -2416,7 +2414,7 @@ public class QyWxOperationService {
for (Integer userId : userIdByMtId for (Integer userId : userIdByMtId
) { ) {
// 获取对应管理员信息 // 获取对应管理员信息
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userKey, token); UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token);
String user = userByPort.getWorkwechat(); String user = userByPort.getWorkwechat();
if (user == null || "".equals(user)) { if (user == null || "".equals(user)) {
user = userByPort.getWechat(); user = userByPort.getWechat();
@ -2460,7 +2458,7 @@ 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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, userKey, token); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
String userByPortWorkwechat = userByPort.getWorkwechat(); String userByPortWorkwechat = userByPort.getWorkwechat();
if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) { if (userByPortWorkwechat == null || "".equals(userByPortWorkwechat)) {
@ -2475,7 +2473,7 @@ public class QyWxOperationService {
for (Integer userId : userIdByDid for (Integer userId : userIdByDid
) { ) {
// 获取对应管理员信息 // 获取对应管理员信息
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userKey, token); UserByPort userByPort = PublicConfig.FindUserById(userId, userKey, token);
String user = userByPort.getWorkwechat(); String user = userByPort.getWorkwechat();
if (user == null || "".equals(user)) { if (user == null || "".equals(user)) {
user = userByPort.getWechat(); user = userByPort.getWechat();
@ -2533,7 +2531,7 @@ public class QyWxOperationService {
// 获取申请人的userId // 获取申请人的userId
UserByPort userByPort = LinkInterfaceUtil.FindUserById(minRecordList.get(0).getApplicantId(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(minRecordList.get(0).getApplicantId(), userKey, token);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -3314,7 +3312,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'>" +
LinkInterfaceUtil.FindUserById(noticeById.getUserId(), userKey, token).getName() + "</div>"; PublicConfig.FindUserById(noticeById.getUserId(), userKey, token).getName() + "</div>";
// 设置内容 // 设置内容
textCardContent.setDescription(noticeContent); textCardContent.setDescription(noticeContent);
// 设置点击后跳转的链接 // 设置点击后跳转的链接
@ -3399,7 +3397,7 @@ public class QyWxOperationService {
applicantTime = stockTaking.getCreateTime(); applicantTime = stockTaking.getCreateTime();
tempMessageTitle = "库存盘点审批"; tempMessageTitle = "库存盘点审批";
} }
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicantId, userKey, token); UserByPort userByPort = PublicConfig.FindUserById(applicantId, userKey, token);
// 设置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");

6
src/main/java/com/dreamchaser/depository_manage/service/impl/SplitUnitServiceImpl.java

@ -1,5 +1,6 @@
package com.dreamchaser.depository_manage.service.impl; package com.dreamchaser.depository_manage.service.impl;
import com.dreamchaser.depository_manage.config.PublicConfig;
import com.dreamchaser.depository_manage.entity.*; import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.mapper.*; import com.dreamchaser.depository_manage.mapper.*;
import com.dreamchaser.depository_manage.pojo.RoleAndDepository; import com.dreamchaser.depository_manage.pojo.RoleAndDepository;
@ -7,7 +8,6 @@ import com.dreamchaser.depository_manage.pojo.RoleAndMaterialType;
import com.dreamchaser.depository_manage.pojo.SplitInfoP; import com.dreamchaser.depository_manage.pojo.SplitInfoP;
import com.dreamchaser.depository_manage.service.DepositoryRecordService; import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.SplitUnitService; import com.dreamchaser.depository_manage.service.SplitUnitService;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -135,7 +135,7 @@ public class SplitUnitServiceImpl implements SplitUnitService {
// 定义用于获取当前岗位下的人的参数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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, null, null); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
approverId.append(userByPort.getId()).append(","); approverId.append(userByPort.getId()).append(",");
} }
@ -167,7 +167,7 @@ public class SplitUnitServiceImpl implements SplitUnitService {
// 定义用于获取当前岗位下的人的参数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 = LinkInterfaceUtil.FindUserByMap(paramForGetUserByPost, null, null); List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, null, null);
for (UserByPort userByPort : userByPortList) { for (UserByPort userByPort : userByPortList) {
approverId.append(userByPort.getId()).append(","); approverId.append(userByPort.getId()).append(",");
} }

14
src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java

@ -15,13 +15,11 @@ import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.SplitUnitService; import com.dreamchaser.depository_manage.service.SplitUnitService;
import com.dreamchaser.depository_manage.service.StockTakingService; import com.dreamchaser.depository_manage.service.StockTakingService;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import com.dreamchaser.depository_manage.utils.WordUtil; import com.dreamchaser.depository_manage.utils.WordUtil;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -257,7 +255,7 @@ public class StockTakingServiceImpl implements StockTakingService {
SimpleStockTakingP ssp = new SimpleStockTakingP(stockTaking); SimpleStockTakingP ssp = new SimpleStockTakingP(stockTaking);
Depository depositoryRecordById = depositoryMapper.findDepositoryById(stockTaking.getDepositoryId()); Depository depositoryRecordById = depositoryMapper.findDepositoryById(stockTaking.getDepositoryId());
ssp.setDepositoryName(depositoryRecordById.getDname()); ssp.setDepositoryName(depositoryRecordById.getDname());
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(stockTaking.getOriginator(), userKey, token);
ssp.setOriginatorName(userByPort.getMaindeparmentname() + "_" + userByPort.getName()); ssp.setOriginatorName(userByPort.getMaindeparmentname() + "_" + userByPort.getName());
stockTakingPS.add(ssp); stockTakingPS.add(ssp);
} }
@ -299,7 +297,7 @@ public class StockTakingServiceImpl implements StockTakingService {
SimpleStockTakingP ssp = new SimpleStockTakingP(stockTaking); SimpleStockTakingP ssp = new SimpleStockTakingP(stockTaking);
Depository depositoryRecordById = depositoryMapper.findDepositoryById(stockTaking.getDepositoryId()); Depository depositoryRecordById = depositoryMapper.findDepositoryById(stockTaking.getDepositoryId());
ssp.setDepositoryName(depositoryRecordById.getDname()); ssp.setDepositoryName(depositoryRecordById.getDname());
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(stockTaking.getOriginator(), userKey, token);
ssp.setOriginatorName(userByPort.getName()); ssp.setOriginatorName(userByPort.getName());
stockTakingPS.add(ssp); stockTakingPS.add(ssp);
} }
@ -1124,7 +1122,7 @@ public class StockTakingServiceImpl implements StockTakingService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
// 获取responseCode(key为申请人number) // 获取responseCode(key为申请人number)
Integer originator = mainRecord.getOriginator(); Integer originator = mainRecord.getOriginator();
UserByPort userByPort = LinkInterfaceUtil.FindUserById(originator, userKey, token); UserByPort userByPort = PublicConfig.FindUserById(originator, userKey, token);
//获取申请人信息 //获取申请人信息
String key = "user:" + userByPort.getNumber() + ":QyWxStockTakingCompleteId:" + mainId; String key = "user:" + userByPort.getNumber() + ":QyWxStockTakingCompleteId:" + mainId;
String responseCode = (String) redisPool.getRedisTemplateByDb(14).opsForHash().get(key, "responseCode"); String responseCode = (String) redisPool.getRedisTemplateByDb(14).opsForHash().get(key, "responseCode");
@ -2719,7 +2717,7 @@ public class StockTakingServiceImpl implements StockTakingService {
Integer originator = finalMainRecord.getOriginator(); Integer originator = finalMainRecord.getOriginator();
map.put("minIds", minIds); map.put("minIds", minIds);
StringBuilder departMentHeadQyWxName = new StringBuilder(); StringBuilder departMentHeadQyWxName = new StringBuilder();
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(originator), userKey, token); UserByPort userByPort = PublicConfig.FindUserById(ObjectFormatUtil.toInteger(originator), userKey, token);
String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
@ -2907,7 +2905,7 @@ public class StockTakingServiceImpl implements StockTakingService {
// 抄送盘点调账记录给盘点人员 // 抄送盘点调账记录给盘点人员
SendQyWxMessageThreadPool.execute((Runnable) () -> { SendQyWxMessageThreadPool.execute((Runnable) () -> {
// 获取盘点人员 // 获取盘点人员
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userkey, token); UserByPort originator = PublicConfig.FindUserById(mainRecord.getOriginator(), userkey, token);
// String workwechat = originator.getWorkwechat(); // String workwechat = originator.getWorkwechat();
// if(workwechat == null || "".equals(workwechat)){ // if(workwechat == null || "".equals(workwechat)){
// workwechat = originator.getWechat(); // workwechat = originator.getWechat();
@ -2931,7 +2929,7 @@ public class StockTakingServiceImpl implements StockTakingService {
// 发送错误消息提醒负责人 // 发送错误消息提醒负责人
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
// 获取盘点人员 // 获取盘点人员
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userkey, token); UserByPort originator = PublicConfig.FindUserById(mainRecord.getOriginator(), userkey, token);
// String workwechat = originator.getWorkwechat(); // String workwechat = originator.getWorkwechat();
// if(workwechat == null || "".equals(workwechat)){ // if(workwechat == null || "".equals(workwechat)){
// workwechat = originator.getWechat(); // workwechat = originator.getWechat();

378
src/main/java/com/dreamchaser/depository_manage/utils/LinkInterfaceUtil.java

@ -1,378 +0,0 @@
package com.dreamchaser.depository_manage.utils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PublicConfig;
import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.pojo.AdministrationP;
import com.dreamchaser.depository_manage.security.pool.AuthenticationTokenPool;
import org.apache.http.protocol.HTTP;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 用于对接HR系统的工具类
*/
public class LinkInterfaceUtil {
/**
* 根据条件查询用户
*
* @param map 条件
* @param userToken 当前登录用户
* @return 查询结果
*/
public static List<UserByPort> FindUserByMap(Map<String, Object> map,String userKey,String userToken) {
String url = PublicConfig.external_url + "/staff/archiveslist";
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");
List<UserByPort> result = new ArrayList<>();
if (list == null) {
list = new JSONArray();
}
for (Object o : list) {
UserByPort userByPort = JSONObject.toJavaObject((JSONObject) o, UserByPort.class);
result.add(userByPort);
}
return result;
}
/**
* 获取恒信集团下的所有公司
* @param
* @return
*/
public static List<AdministrationP> findAllCompany(String userKey,String userToken) {
String url = PublicConfig.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查询对应用户
*
* @param id 待查讯用户id
* @param userToken 登录用户
* @return 查询结果
*/
public static UserByPort FindUserById(Integer id, String userKey,String userToken) {
String url = PublicConfig.external_url + "/staff/archivescont";
Map<String, Object> map = new HashMap<>();
map.put("id", id);
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");
UserByPort userByPort = JSONObject.toJavaObject(data, UserByPort.class);
if("302299".equals(userByPort.getNumber())){
userByPort.setMaindeparment(280);
}
return userByPort;
}
/**
* 查询当前部门下的用户
*
* @param id 待查讯部门id
* @param userToken 登录用户
* @return 查询结果
*/
public static List<UserByPort> FindUserByAdminorg(Integer id, String userKey,String userToken) {
String url = PublicConfig.external_url + "/staff/archivescont";
Map<String, Object> map = new HashMap<>();
map.put("adminorg", id);
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);
JSONArray data = (JSONArray) jsonObject.get("list");
List<UserByPort> list = new ArrayList<>();
for (Object o : data
) {
UserByPort userByPort = JSONObject.toJavaObject((JSONObject) o, UserByPort.class);
list.add(userByPort);
}
return list;
}
/**
* 根据id查询对应的行政组织
*
* @param id 待查讯组织id
* @param
* @return 查询结果
*/
public static Administration getCompany(Integer id, String userKey,String userToken) {
String url = PublicConfig.external_url + "/org/getgovcont";
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");
return JSONObject.toJavaObject(data, Administration.class);
}
/**
* 根据上级查询对应的行政组织
*
* @param superior 上级编号
* @param
* @return 查询结果
*/
public static List<AdministrationP> findCompanyBySuperior(String superior, String userKey,String userToken) {
String url = PublicConfig.external_url + "/org/govthree";
Map<String, Object> map = new HashMap<>();
map.put("idstr", superior);
map.put("level", 0);
map.put("all", 1);
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);
JSONArray list = (JSONArray) jsonObject.get("data");
if (list == null) {
list = new JSONArray();
}
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查询对应的岗位信息
*
* @param id 岗位id
* @param
* @return 查询结果
*/
public static Post findPostById(Integer id, String userKey,String userToken) {
String url = PublicConfig.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;
}
/**
* 获取对应的验证码信息
*
* @param request 请求体
* @return 结果
*/
public static JSONObject Captcha(HttpServletRequest request) {
String token = request.getHeader("user-token");
String userKey = request.getHeader("user-key");
if (token == null) {
token = (String) request.getSession().getAttribute("userToken");
userKey = (String) request.getSession().getAttribute("userKey");
}
String url = PublicConfig.external_url_6666 + "/base/captcha";
JSONObject param = new JSONObject();
String post = null;
try {
post = HttpUtils.send(url, param, HTTP.UTF_8,userKey,token);
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data");
return data;
}
/**
* 获取当前行政组织列表
*
* @return
*/
public static Map<String, Object> findAdministration(String userKey,String userToken) {
Map<String, Object> map = new HashMap<>();
String url = PublicConfig.external_url + "/org/govlist";
String superior = "313";
map.put("superior", superior);
map.put("state", 1);
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"));
Map<String, Object> result = new HashMap();
List<AdministrationP> administrationPList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
Administration administration = JSONObject.toJavaObject((JSONObject) list.get(i), Administration.class);
AdministrationP administrationP = new AdministrationP(administration);
administrationPList.add(administrationP);
}
result.put("administrationPList", administrationPList);
result.put("total", total);
return result;
}
/**
* 用于获取行政组织树
*
* @param userByPort
* @return
*/
public static JSONArray getPostTree(UserByPort userByPort,String userKey,String userToken) {
String url = PublicConfig.external_url + "/org/govthreeing";
Map<String, Object> param = new HashMap<>();
param.put("id", userByPort.getCompany());
param.put("idstr", "");
param.put("level", 0);
param.put("all", 1);
String jsonString = JSONObject.toJSONString(param);
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);
return (JSONArray) jsonObject.get("data");
}
/**
* 获取当前用户可见的菜单集
* @param userToken 当前登录用户
* @return
*/
public static List<String> getUserAccessToAddresses(String userKey,String userToken) {
//定义链接地址
String url = PublicConfig.external_url_6666 + "/system_authorizing/obtain_authorization";
System.out.println(url);
Map<String, Object> param = new HashMap<>();
param.put("system", "cangchu");
String jsonString = JSONObject.toJSONString(param);
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 powerid = (JSONArray) data.get("powerid");
if (powerid == null) {
powerid = new JSONArray();
}
List<String> stringList = JSONObject.parseArray(powerid.toJSONString(), String.class);
return stringList;
}
public static JSONArray getOrgAndPostThree(String userKey,String userToken){
//定义链接地址
String url = PublicConfig.external_url + "/org/get_organdpost_three";
Map<String, Object> param = new HashMap<>();
param.put("id", "309");
param.put("level", 0);
param.put("all", 0);
String jsonString = JSONObject.toJSONString(param);
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");
return data.getJSONArray("list");
}
}

5
src/test/java/com/dreamchaser/depository_manage/BarChartTest.java

@ -1,13 +1,12 @@
package com.dreamchaser.depository_manage; package com.dreamchaser.depository_manage;
import com.alibaba.fastjson.JSONObject; import com.dreamchaser.depository_manage.config.PublicConfig;
import com.dreamchaser.depository_manage.entity.UserByPort; import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.service.DepositoryRecordService; import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.DepositoryService; import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.MaterialService; import com.dreamchaser.depository_manage.service.MaterialService;
import com.dreamchaser.depository_manage.service.MaterialTypeService; import com.dreamchaser.depository_manage.service.MaterialTypeService;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import lombok.Data; import lombok.Data;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -72,7 +71,7 @@ public class BarChartTest {
@Test @Test
public void main() { public void main() {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(87, null,null); UserByPort userByPort = PublicConfig.FindUserById(87, null,null);
} }

21
src/test/java/com/dreamchaser/depository_manage/InterfaceTest.java

@ -0,0 +1,21 @@
package com.dreamchaser.depository_manage;
import com.dreamchaser.depository_manage.config.PublicConfig;
import com.dreamchaser.depository_manage.entity.UserByPort;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@RunWith(SpringRunner.class)
public class InterfaceTest {
@Test
public void run() {
List<UserByPort> userByPortList = PublicConfig.findUserByAdminorgAndPosition(116, "设备员", null, null);
System.out.println(userByPortList);
}
}

4
src/test/java/com/dreamchaser/depository_manage/InventoryLineChartTest.java

@ -1,6 +1,7 @@
package com.dreamchaser.depository_manage; package com.dreamchaser.depository_manage;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PublicConfig;
import com.dreamchaser.depository_manage.entity.UserByPort; import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.pojo.InventoryByDname; import com.dreamchaser.depository_manage.pojo.InventoryByDname;
import com.dreamchaser.depository_manage.service.DepositoryRecordService; import com.dreamchaser.depository_manage.service.DepositoryRecordService;
@ -8,7 +9,6 @@ import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.MaterialService; import com.dreamchaser.depository_manage.service.MaterialService;
import com.dreamchaser.depository_manage.service.MaterialTypeService; import com.dreamchaser.depository_manage.service.MaterialTypeService;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -72,7 +72,7 @@ public class InventoryLineChartTest {
@Test @Test
public void main() { public void main() {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(87, null,null); UserByPort userByPort = PublicConfig.FindUserById(87, null,null);
Map<String, Integer> depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort); Map<String, Integer> depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort);
Map<Object, Object> barChartData = getInventoryLineChartData(depositoryAllNameAndId); Map<Object, Object> barChartData = getInventoryLineChartData(depositoryAllNameAndId);
System.out.println(JSONObject.toJSONString(barChartData)); System.out.println(JSONObject.toJSONString(barChartData));

6
src/test/java/com/dreamchaser/depository_manage/InventorySunburstDataTest.java

@ -1,17 +1,15 @@
package com.dreamchaser.depository_manage; package com.dreamchaser.depository_manage;
import com.alibaba.fastjson.JSONObject; import com.dreamchaser.depository_manage.config.PublicConfig;
import com.dreamchaser.depository_manage.entity.Depository; import com.dreamchaser.depository_manage.entity.Depository;
import com.dreamchaser.depository_manage.entity.MaterialType; import com.dreamchaser.depository_manage.entity.MaterialType;
import com.dreamchaser.depository_manage.entity.UserByPort; import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.pojo.InventoryByDname;
import com.dreamchaser.depository_manage.pojo.InventoryByMTAndDepository; import com.dreamchaser.depository_manage.pojo.InventoryByMTAndDepository;
import com.dreamchaser.depository_manage.service.DepositoryRecordService; import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.DepositoryService; import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.MaterialService; import com.dreamchaser.depository_manage.service.MaterialService;
import com.dreamchaser.depository_manage.service.MaterialTypeService; import com.dreamchaser.depository_manage.service.MaterialTypeService;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -77,7 +75,7 @@ public class InventorySunburstDataTest {
@Test @Test
public void main() { public void main() {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(78, null,null); UserByPort userByPort = PublicConfig.FindUserById(78, null,null);
} }

6
src/test/java/com/dreamchaser/depository_manage/LineChartTest.java

@ -1,15 +1,13 @@
package com.dreamchaser.depository_manage; package com.dreamchaser.depository_manage;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.entity.MaterialType; import com.dreamchaser.depository_manage.config.PublicConfig;
import com.dreamchaser.depository_manage.entity.UserByPort; import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.service.DepositoryRecordService; import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.DepositoryService; import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.MaterialService; import com.dreamchaser.depository_manage.service.MaterialService;
import com.dreamchaser.depository_manage.service.MaterialTypeService; import com.dreamchaser.depository_manage.service.MaterialTypeService;
import com.dreamchaser.depository_manage.utils.DateUtil; import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import lombok.Data; import lombok.Data;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -74,7 +72,7 @@ public class LineChartTest {
@Test @Test
public void main() { public void main() {
UserByPort userByPort = LinkInterfaceUtil.FindUserById(87, null,null); UserByPort userByPort = PublicConfig.FindUserById(87, null,null);
Map<String, Integer> depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort); Map<String, Integer> depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort);
Map<Object, Object> barChartData = getBarChartData(depositoryAllNameAndId, "1"); Map<Object, Object> barChartData = getBarChartData(depositoryAllNameAndId, "1");
System.out.println(JSONObject.toJSONString(barChartData)); System.out.println(JSONObject.toJSONString(barChartData));

Loading…
Cancel
Save