Browse Source

修改可视化界面

lwx_dev
erdanergou 3 years ago
parent
commit
a24928dc54
  1. 5
      src/main/java/com/dreamchaser/depository_manage/config/PortConfig.java
  2. 38
      src/main/java/com/dreamchaser/depository_manage/controller/CompanyController.java
  3. 13
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryController.java
  4. 4
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  5. 213
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  6. 7
      src/main/java/com/dreamchaser/depository_manage/controller/QyWxOperationController.java
  7. 17
      src/main/java/com/dreamchaser/depository_manage/controller/UserController.java
  8. 37
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java
  9. 10
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryServiceImpl.java
  10. 27
      src/main/java/com/dreamchaser/depository_manage/service/impl/QyWxOperationService.java
  11. 30
      src/main/java/com/dreamchaser/depository_manage/service/impl/StockTakingServiceImpl.java
  12. 182
      src/main/java/com/dreamchaser/depository_manage/utils/LinkInterfaceUtil.java
  13. 474
      src/main/resources/templates/pages/chart/chart-in.html
  14. 51
      src/main/resources/templates/pages/chart/chart-in_back.html
  15. 430
      src/main/resources/templates/pages/chart/chart-out.html
  16. 35
      src/main/resources/templates/pages/chart/chart-out_back.html
  17. 35
      src/main/resources/templates/pages/chart/chart-stock_back.html
  18. 8
      src/main/resources/templates/pages/other/welcome.html
  19. 9
      src/test/java/com/dreamchaser/depository_manage/TestForThisWeekInventory.java
  20. 6
      src/test/java/com/dreamchaser/depository_manage/TestForgetMapData.java
  21. 7
      src/test/java/com/dreamchaser/depository_manage/TestForgetShowData.java

5
src/main/java/com/dreamchaser/depository_manage/config/PortConfig.java

@ -3,15 +3,14 @@ package com.dreamchaser.depository_manage.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.controller.PageController;
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.utils.HttpUtils;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import lombok.Data;
import org.apache.http.protocol.HTTP;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
@ -66,7 +65,7 @@ public class PortConfig {
Map<String,Object> param = new HashMap<>();
Post userPost = userPostList.get(i);
param.put("position",userPost.getId());
List<UserByPort> userByPorts = PageController.FindUserByMap(param,userToken);
List<UserByPort> userByPorts = LinkInterfaceUtil.FindUserByMap(param,userToken);
userByPortList.addAll(userByPorts);
}
return userByPortList;

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

@ -9,14 +9,13 @@ import com.dreamchaser.depository_manage.pojo.*;
import com.dreamchaser.depository_manage.service.CompanyService;
import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.RoleService;
import com.dreamchaser.depository_manage.service.impl.CompanyServiceImpl;
import com.dreamchaser.depository_manage.utils.CrudUtil;
import com.dreamchaser.depository_manage.utils.HttpUtils;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import org.apache.http.protocol.HTTP;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@ -40,7 +39,8 @@ public class CompanyController {
/**
* 查询组织架构
* @param
* @param map 查询条件
* @param request 请求体
* @return
*/
@PostMapping("/allCompanyByParent")
@ -85,8 +85,8 @@ public class CompanyController {
/**
* 根据条件查询公司
* @param map
* @return
* @param map 查询条件
* @return 返回结果
*/
@PostMapping("/companyByCondition")
public RestResponse findcompanyByCondition(@RequestParam Map<String,Object> map,HttpServletRequest request){
@ -125,8 +125,8 @@ public class CompanyController {
}
/**
* 获取所有岗位
* @param map
* 根据条件查询岗位
* @param map 查询条件
* @return
*/
@PostMapping("/allPostByOrganization")
@ -183,12 +183,18 @@ public class CompanyController {
return new RestResponse(postList,total,200);
}
/**
* 给岗位设置权限
* @param map 条件
* @return 设置结果
*/
@PostMapping("/post_role")
public RestResponse addUser(@RequestBody Map<String, Object> map,HttpServletRequest request) {
UserByPort userToken = (UserByPort) request.getAttribute("userToken");
Map<String,Object> userParam = new HashMap<>();
userParam.put("position",ObjectFormatUtil.toInteger(map.get("userid")));
List<UserByPort> userByPortList = PageController.FindUserByMap(userParam,userToken);
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(userParam,userToken);
Integer success = 0;
if(map.containsKey("depositoryId")) {
for (int i = 0; i < userByPortList.size(); i++) {
@ -233,6 +239,11 @@ public class CompanyController {
return CrudUtil.postHandle(success,success);
}
/**
* 修改岗位的权限
* @param map 修改条件
* @return
*/
@PostMapping("/postRole_edit")
public RestResponse editPostRole(@RequestBody Map<String, Object> map) {
Map<String,Object> userParam = new HashMap<>();
@ -256,7 +267,7 @@ public class CompanyController {
}
/**
* 根据主键删除权限类型
* @param map
* @param map 删除条件
* @return
*/
@PostMapping("/postRole_del")
@ -295,13 +306,18 @@ public class CompanyController {
}
}
/**
* 查询岗位对应的权限
* @param postId 要查询的岗位id
* @return
*/
@GetMapping("/findPostRole")
public RestResponse findPostRole(@RequestParam("postId") Integer postId,HttpServletRequest request){
UserByPort userToken = (UserByPort) request.getAttribute("userToken");
Map<String,Object> userParam = new HashMap<>();
userParam.put("position",postId);
List<UserByPort> userByPortList = PageController.FindUserByMap(userParam,userToken);
Post postById = PageController.findPostById(postId,userToken);
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(userParam,userToken);
Post postById = LinkInterfaceUtil.findPostById(postId,userToken);
List<RoleAndDepository> roleAndDepositoryByCondition = new ArrayList<>();
if(userByPortList.size() != 0){
Map<String,Object> param = new HashMap<>();

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

@ -8,12 +8,7 @@ import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.exception.MyException;
import com.dreamchaser.depository_manage.pojo.*;
import com.dreamchaser.depository_manage.service.*;
import com.dreamchaser.depository_manage.service.impl.DepositoryRecordServiceImpl;
import com.dreamchaser.depository_manage.service.impl.DepositoryServiceImpl;
import com.dreamchaser.depository_manage.utils.CrudUtil;
import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.HttpUtils;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import com.dreamchaser.depository_manage.utils.*;
import lombok.Data;
import org.apache.http.protocol.HTTP;
import org.springframework.beans.factory.annotation.Autowired;
@ -401,7 +396,7 @@ public class DepositoryController {
List<Depository> list = depositoryService.findDepositoryRecordPByCondition(map, userByPort);
for (int i = 0; i < list.size(); i++) {
Depository depository = list.get(i);
Administration company = PageController.getCompany(depository.getCid(), userByPort);
Administration company = LinkInterfaceUtil.getCompany(depository.getCid(), userByPort);
list.get(i).setCname(company.getName());
}
return new RestResponse(list, depositoryService.findCountByCondition(map), 200);
@ -1593,7 +1588,7 @@ public class DepositoryController {
List<Integer> userIdByDid = roleService.findUserIdByDid(did);
List<UserByPort> userByPortList = new ArrayList<>();
for (int i = 0; i < userIdByDid.size(); i++) {
UserByPort userByPort = PageController.FindUserById(userIdByDid.get(i), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userIdByDid.get(i), userToken);
userByPortList.add(userByPort);
}
return new RestResponse(userByPortList, userByPortList.size(), 200);
@ -1603,7 +1598,7 @@ public class DepositoryController {
@GetMapping("/findPostByCompany")
public RestResponse findPostByCompany(@RequestParam("company") String company, HttpServletRequest request) {
UserByPort userToken = (UserByPort) request.getAttribute("userToken");
List<AdministrationP> administrationPList = PageController.findCompanyBySuperior(company, userToken);
List<AdministrationP> administrationPList = LinkInterfaceUtil.findCompanyBySuperior(company, userToken);
int size = administrationPList.size();
return new RestResponse(administrationPList, size, 200);
}

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

@ -496,7 +496,7 @@ public class DepositoryRecordController {
ApplicationOutRecordP applicationOutRecordPById = depositoryRecordService.findApplicationOutRecordPById(applicationOutMinById.getParentId());
// 获取申请人
UserByPort userByPort = PageController.FindUserById(applicationOutRecordPById.getApplicantId(),userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationOutRecordPById.getApplicantId(),userToken);
// 创建展示对象
SimpleApplicationOutMinRecordP simpleApplicationOutMinRecordP = new SimpleApplicationOutMinRecordP(applicationOutMinById);
// 获取申请的物料信息
@ -508,7 +508,7 @@ public class DepositoryRecordController {
if(checkId != null){
// 如果该订单已经处理
// 获取处理人
UserByPort checker = PageController.FindUserById(checkId,userToken);
UserByPort checker = LinkInterfaceUtil.FindUserById(checkId,userToken);
simpleApplicationOutMinRecordP.setCheckerName(checker.getName());
}
List<MaterialAndProducedDate> materialAndProducedDateByMid = materialService.findMaterialAndProducedDateByMid(materialById.getId());

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

@ -1,43 +1,27 @@
package com.dreamchaser.depository_manage.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.JM_3DES;
import com.dreamchaser.depository_manage.config.PortConfig;
import com.dreamchaser.depository_manage.config.QyWxConfig;
import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.exception.MyException;
import com.dreamchaser.depository_manage.pojo.*;
import com.dreamchaser.depository_manage.security.bean.UserToken;
import com.dreamchaser.depository_manage.security.pool.AuthenticationTokenPool;
import com.dreamchaser.depository_manage.security.pool.UserKeyAndTokenPool;
import com.dreamchaser.depository_manage.service.*;
import com.dreamchaser.depository_manage.utils.*;
import com.sun.org.apache.xpath.internal.operations.Mod;
import javafx.geometry.Pos;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.http.protocol.HTTP;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.mobile.device.Device;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
* 专门用来展示页面的controller
@ -84,22 +68,6 @@ public class PageController {
private StockTakingService stockTakingService;
public static JSONObject Captcha(HttpServletRequest request) {
UserByPort userByPort = (UserByPort) request.getAttribute("userToken");
String url = PortConfig.external_url_6666 + "/base/captcha";
JSONObject param = new JSONObject();
String post = null;
try {
post = HttpUtils.send(url, param, HTTP.UTF_8, userByPort);
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data");
return data;
}
@GetMapping("/")
public ModelAndView Init(HttpServletRequest request) {
ModelAndView mv = new ModelAndView();
@ -126,7 +94,7 @@ public class PageController {
@GetMapping("/login")
public ModelAndView login(HttpServletRequest request) {
ModelAndView mv = new ModelAndView();
JSONObject captcha = Captcha(request);
JSONObject captcha = LinkInterfaceUtil.Captcha(request);
String picPath = (String) captcha.get("picPath");
String captchaid = (String) captcha.get("captchaid");
mv.addObject("picPath", picPath);
@ -666,13 +634,15 @@ public class PageController {
public ModelAndView chart_in() {
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/chart/chart-in");
mv.addObject("depositories", depositoryService.findDepositoryAll());
mv.addObject("reviewers", userService.findReviewers());
mv.addObject("materials", materialService.findMaterialAll());
mv.addObject("InCount", depositoryRecordService.CalculateAllCount(1, "已入库"));
mv.addObject("allInCount", depositoryRecordService.CalculateAllCount(1, ""));
mv.addObject("InPrice", depositoryRecordService.CalculateAllPrice(1, "已入库"));
mv.addObject("allInPrice", depositoryRecordService.CalculateAllPrice(1, ""));
// 转入物料数量
mv.addObject("InCount", depositoryRecordService.CalculateAllApplicationInCount());
// 转入物料总额
mv.addObject("allInCount", depositoryRecordService.CalculateAllApplicationInCount());
// 购入物料数量
mv.addObject("InPrice", depositoryRecordService.CalculateAllApplicationInPrice());
// 购入物料总额
mv.addObject("allInPrice", depositoryRecordService.CalculateAllApplicationInPrice());
return mv;
}
@ -731,62 +701,13 @@ public class PageController {
return mv;
}
/**
* 根据条件查询用户
*
* @param map
* @return
*/
public static List<UserByPort> FindUserByMap(Map<String, Object> map, UserByPort userToken) {
String url = PortConfig.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, 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 (int i = 0; i < list.size(); i++) {
UserByPort userByPort = JSONObject.toJavaObject((JSONObject) list.get(i), UserByPort.class);
result.add(userByPort);
}
return result;
}
public static UserByPort FindUserById(Integer id, UserByPort userToken) {
String url = PortConfig.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, userToken);
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data");
UserByPort userByPort = JSONObject.toJavaObject(data, UserByPort.class);
return userByPort;
}
@GetMapping("/user_add")
public ModelAndView user_add(Integer userId, HttpServletRequest request) {
UserByPort userToken = (UserByPort) request.getAttribute("userToken");
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/user/user-add");
UserByPort userByPort = FindUserById(userId, userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userId, userToken);
UserByPortP userByPortP = new UserByPortP(userByPort);
mv.addObject("userByPort", userByPortP);
mv.addObject("roles", roleService.findAllRole());
@ -802,7 +723,7 @@ public class PageController {
RoleAndDepository roleAndDepositoryById = roleService.findRoleAndDepositoryById(id);
UserByPortP userByPortP = null;
if (roleAndDepositoryById != null) {
UserByPort userByPort = FindUserById(roleAndDepositoryById.getUserId(), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndDepositoryById.getUserId(), userToken);
userByPortP = new UserByPortP(userByPort);
userByPortP.setRolename(roleAndDepositoryById.getRoleName());
userByPortP.setDepositoryName(roleAndDepositoryById.getDepositoryName());
@ -822,8 +743,8 @@ public class PageController {
mv.setViewName("pages/post/postRole_edit");
Map<String, Object> userParam = new HashMap<>();
userParam.put("position", id);
List<UserByPort> userByPortList = PageController.FindUserByMap(userParam, userToken);
Post postById = findPostById(id, userToken);
List<UserByPort> userByPortList = LinkInterfaceUtil.FindUserByMap(userParam, userToken);
Post postById = LinkInterfaceUtil.findPostById(id, userToken);
PostP pp = new PostP(postById);
Map<String, Object> param = new HashMap<>();
param.put("depositoryId", depositoryId);
@ -846,7 +767,7 @@ public class PageController {
mv.addObject("depositories", depositoryService.findDepositoryAll());
Map<String, Object> map = new HashMap<>();
map.put("number", id.toString());
UserByPort userByPort = FindUserByMap(map, userToken).get(0);
UserByPort userByPort = LinkInterfaceUtil.FindUserByMap(map, userToken).get(0);
mv.addObject("user", userByPort);
return mv;
}
@ -863,7 +784,7 @@ public class PageController {
mv.addObject("record", depositoryRecordById);
Integer cid = depositoryRecordById.getCid();
List<AdministrationP> postList = findCompanyBySuperior(cid.toString(), userToken);
List<AdministrationP> postList = LinkInterfaceUtil.findCompanyBySuperior(cid.toString(), userToken);
List<AdministrationP> administrationPList = findAllCompany(userToken);
// 部门列表
mv.addObject("postList", postList);
@ -1084,13 +1005,13 @@ public class PageController {
sumPrice += (materialById.getPrice());
}
// 申请人
UserByPort userByPort = FindUserById(recordP.getApplicantId(), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(recordP.getApplicantId(), userToken);
// 部门负责人
String departmentheads = recordP.getDepartmenthead();
String[] split = departmentheads.split(",");
StringBuilder departmentHeadName = new StringBuilder();
for (int i = 0; i < split.length; i++) {
UserByPort departmenthead = FindUserById(ObjectFormatUtil.toInteger(split[i]), userToken);
UserByPort departmenthead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(split[i]), userToken);
departmentHeadName.append(departmenthead.getName()).append(",");
}
@ -1104,7 +1025,7 @@ public class PageController {
String depositoryManagerNames = "";
for (int i = 0; i < depositoryManagerId.length; i++) {
Integer managerid = ObjectFormatUtil.toInteger(depositoryManagerId[i]);
UserByPort user = FindUserById(managerid, userToken);
UserByPort user = LinkInterfaceUtil.FindUserById(managerid, userToken);
depositoryManager.add(user);
depositoryManagerNames += user.getName() + ",";
}
@ -1133,7 +1054,7 @@ public class PageController {
mv.setViewName("pages/application/form-step-look");
if (id != null) {
ApplicationInRecordP applicationInRecordPById = depositoryRecordService.findApplicationInRecordPById(id);
UserByPort userByPort = FindUserById(applicationInRecordPById.getApplicantId(), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationInRecordPById.getApplicantId(), userToken);
applicationInRecordPById.setApplicantName(userByPort.getName());
applicationInRecordPById.setApplicantTime(DateUtil.TimeStampToDateTime(Long.valueOf(applicationInRecordPById.getApplicantTime())));
applicationInRecordPById.setPrice(applicationInRecordPById.getPrice() / 100);
@ -1161,7 +1082,7 @@ public class PageController {
// 获取出库库位
Place placeById = placeService.findPlaceById(recordMin.getPlaceId());
// 获取处理人
UserByPort userByPort = FindUserById(recordMin.getCheckId(), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(recordMin.getCheckId(), userToken);
// 设置处理人姓名
recordMinP.setCheckerName(userByPort.getName());
recordMinP.setDepositoryName(depository.getDname());
@ -1231,7 +1152,7 @@ public class PageController {
if (checkId != null) {
// 如果当前子订单已经处理
// 获取当前处理人
UserByPort disposer = FindUserById(checkId, userToken);
UserByPort disposer = LinkInterfaceUtil.FindUserById(checkId, userToken);
outDisposer.append(disposer.getName() + ",");
recordMinP.setCheckerName(disposer.getName());
} else {
@ -1247,7 +1168,7 @@ public class PageController {
recordMinPList.add(recordMinP);
}
// 申请人
UserByPort userByPort = FindUserById(applicationOutRecordPById.getApplicantId(), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicationOutRecordPById.getApplicantId(), userToken);
// 部门负责人
String departmentHead = applicationOutRecordPById.getDepartmenthead();
String[] split = departmentHead.split(",");
@ -1257,7 +1178,7 @@ public class PageController {
}
StringBuilder departmentHeadName = new StringBuilder();
for (int i = 0; i < split.length; i++) {
UserByPort departmenthead = FindUserById(ObjectFormatUtil.toInteger(split[i]), userToken);
UserByPort departmenthead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(split[i]), userToken);
departmentHeadName.append(departmenthead.getName()).append(",");
}
// 仓储中心负责人
@ -1270,7 +1191,7 @@ public class PageController {
String depositoryManagerNames = "";
for (int i = 0; i < depositoryManagerId.length; i++) {
Integer managerid = ObjectFormatUtil.toInteger(depositoryManagerId[i]);
UserByPort user = FindUserById(managerid, userToken);
UserByPort user = LinkInterfaceUtil.FindUserById(managerid, userToken);
depositoryManager.add(user);
depositoryManagerNames += user.getName();
}
@ -1311,7 +1232,7 @@ public class PageController {
stp.setCreateTime(DateUtil.TimeStampToDateTime(stockTaking.getCreateTime()));
// 获取申请人
UserByPort userByPort = FindUserById(stockTaking.getOriginator(), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userToken);
// 设置盘点发起人姓名
stp.setOriginatorName(userByPort.getName());
@ -1323,7 +1244,7 @@ public class PageController {
if ("".equals(s)) {
continue;
}
UserByPort manager = FindUserById(ObjectFormatUtil.toInteger(s), userToken);
UserByPort manager = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userToken);
managerName.append(manager.getName() + ",");
}
stp.setDepartmentManagerName(managerName.toString());
@ -1390,7 +1311,7 @@ public class PageController {
// 获取申请人
UserByPort userByPort = FindUserById(stockTaking.getOriginator(), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userToken);
// 设置盘点发起人姓名
stp.setOriginatorName(userByPort.getName());
@ -1402,7 +1323,7 @@ public class PageController {
if ("".equals(s)) {
continue;
}
UserByPort manager = FindUserById(ObjectFormatUtil.toInteger(s), userToken);
UserByPort manager = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userToken);
managerName.append(manager.getName() + ",");
}
stp.setDepartmentManagerName(managerName.toString());
@ -1534,7 +1455,7 @@ public class PageController {
JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data");
Administration administration = JSONObject.toJavaObject(data, Administration.class);
String SuperiorName = getCompany(administration.getSuperior(), userByPort).getName();
String SuperiorName = LinkInterfaceUtil.getCompany(administration.getSuperior(), userByPort).getName();
mv.addObject("record", administration);
mv.addObject("SuperiorName", SuperiorName);
} else {
@ -1543,53 +1464,6 @@ public class PageController {
return mv;
}
public static Administration getCompany(Integer id, UserByPort userByPort) {
String url = PortConfig.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, userByPort);
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data");
Administration administration = JSONObject.toJavaObject(data, Administration.class);
return administration;
}
public static List<AdministrationP> findCompanyBySuperior(String superior, UserByPort userByPort) {
String url = PortConfig.external_url + "/org/govlist";
Map<String, Object> map = new HashMap<>();
map.put("superior", superior);
String jsonString = JSONObject.toJSONString(map);
JSONObject paramObject = JSONObject.parseObject(jsonString);
String post = null;
try {
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userByPort);
} 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 (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);
}
return administrationPList;
}
@GetMapping("/findCompanyByParentId")
public ModelAndView findCompanyByParentId(Integer parentId,Integer level, HttpServletRequest request) {
@ -1598,7 +1472,7 @@ public class PageController {
if (parentId != null) {
mv.addObject("parentId", parentId);
mv.addObject("level", level+1);
List<AdministrationP> administrationPList = findCompanyBySuperior(parentId.toString(), userToken);
List<AdministrationP> administrationPList = LinkInterfaceUtil.findCompanyBySuperior(parentId.toString(), userToken);
if (administrationPList.size() > 0) {
mv.addObject("administrationPList", administrationPList);
mv.setViewName("pages/company/company-out");
@ -1655,7 +1529,7 @@ public class PageController {
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/post/post-view");
if (id != null) {
Post object = findPostById(id, userToken);
Post object = LinkInterfaceUtil.findPostById(id, userToken);
mv.addObject("record", object);
} else {
throw new MyException("缺少必要参数!");
@ -1663,25 +1537,6 @@ public class PageController {
return mv;
}
public static Post findPostById(Integer id, UserByPort userByPort) {
String url = PortConfig.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, userByPort);
} 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;
}
@GetMapping("/findPostByParentId")
public ModelAndView findPostByParentId(Integer parentId, HttpServletRequest request) {
@ -1731,7 +1586,7 @@ public class PageController {
UserByPort userToken = (UserByPort) request.getAttribute("userToken");
ModelAndView mv = new ModelAndView();
mv.setViewName("pages/post/postRole_add");
Post postById = findPostById(id, userToken);
Post postById = LinkInterfaceUtil.findPostById(id, userToken);
mv.addObject("post", postById);
mv.addObject("roles", roleService.findAllRole());
mv.addObject("depositories", depositoryService.findDepositoryAll());
@ -1948,7 +1803,7 @@ public class PageController {
UserByPort userToken = (UserByPort) request.getAttribute("userToken");
ModelAndView mv = new ModelAndView();
// 获取仓储中心详情
Administration company = PageController.getCompany(361, userToken);
Administration company = LinkInterfaceUtil.getCompany(361, userToken);
// 获取仓储中心负责人
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(company, userToken);
StringBuilder departmentHeadName = new StringBuilder();

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

@ -19,6 +19,7 @@ import com.dreamchaser.depository_manage.service.CallBackLogService;
import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.StockTakingService;
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.ObjectFormatUtil;
import com.dreamchaser.depository_manage.utils.QyWxXMLUtils;
@ -302,7 +303,7 @@ public class QyWxOperationController {
e.printStackTrace();
}
} else {
JSONObject captcha = PageController.Captcha(request);
JSONObject captcha = LinkInterfaceUtil.Captcha(request);
String picPath = (String) captcha.get("picPath");
String captchaid = (String) captcha.get("captchaid");
mv.addObject("picPath", picPath);
@ -310,14 +311,14 @@ public class QyWxOperationController {
mv.addObject("userWxId", userId);
}
} else {
JSONObject captcha = PageController.Captcha(request);
JSONObject captcha = LinkInterfaceUtil.Captcha(request);
String picPath = (String) captcha.get("picPath");
String captchaid = (String) captcha.get("captchaid");
mv.addObject("picPath", picPath);
mv.addObject("captchaid", captchaid);
}
} else {
JSONObject captcha = PageController.Captcha(request);
JSONObject captcha = LinkInterfaceUtil.Captcha(request);
String picPath = (String) captcha.get("picPath");
String captchaid = (String) captcha.get("captchaid");
mv.addObject("picPath", picPath);

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

@ -1,6 +1,5 @@
package com.dreamchaser.depository_manage.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PortConfig;
@ -22,19 +21,9 @@ import com.dreamchaser.depository_manage.security.pool.VerificationCodePool;
import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.RoleService;
import com.dreamchaser.depository_manage.service.UserService;
import com.dreamchaser.depository_manage.utils.CrudUtil;
import com.dreamchaser.depository_manage.utils.HttpUtils;
import com.dreamchaser.depository_manage.utils.Md5;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import com.fasterxml.jackson.core.sym.NameN;
import com.dreamchaser.depository_manage.utils.*;
import org.apache.http.protocol.HTTP;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.repository.query.ReactiveQueryByExampleExecutor;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mobile.device.Device;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@ -488,7 +477,7 @@ public class UserController {
*/
@GetMapping("/getCaptchaid")
public JSONObject getCaptchaid(HttpServletRequest httpServletRequest){
JSONObject captcha = PageController.Captcha(httpServletRequest);
JSONObject captcha = LinkInterfaceUtil.Captcha(httpServletRequest);
return captcha;
}
@ -501,7 +490,7 @@ public class UserController {
List<UserByPortP> userByPortPList = new ArrayList<>();
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(param);
for (int i = 0; i < roleAndDepositoryByCondition.size(); i++) {
UserByPort userByPort = PageController.FindUserById(roleAndDepositoryByCondition.get(i).getUserId(),userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(roleAndDepositoryByCondition.get(i).getUserId(),userToken);
UserByPortP up = new UserByPortP(userByPort);
up.setId(roleAndDepositoryByCondition.get(i).getId());
up.setDepositoryName(roleAndDepositoryByCondition.get(i).getDepositoryName());

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

@ -2,7 +2,6 @@ package com.dreamchaser.depository_manage.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PortConfig;
import com.dreamchaser.depository_manage.controller.PageController;
import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.exception.MyException;
import com.dreamchaser.depository_manage.mapper.*;
@ -205,7 +204,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
dname = depositoryRecordById.getDname();
}
Administration company = PageController.getCompany(userToken.getMaindeparment(), userToken);
Administration company = LinkInterfaceUtil.getCompany(userToken.getMaindeparment(), userToken);
String code = createCode(dname, "outOrderNumber", "out", company.getName());
map.put("code", code);
map.put("pass", 3);
@ -615,9 +614,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取主订单单号
StringBuilder code = new StringBuilder(record.getCode());
// 获取申请用户信息
UserByPort applicantUser = PageController.FindUserById(record.getApplicantId(), userByPort);
UserByPort applicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userByPort);
// 获取申请用户行政组织
Administration company = PageController.getCompany(applicantUser.getMaindeparment(), userByPort);
Administration company = LinkInterfaceUtil.getCompany(applicantUser.getMaindeparment(), userByPort);
// 获取部门名称简写
String conpanyName = WordUtil.getPinYinHeadChar(company.getName());
// 获取仓库名称简写
@ -667,7 +666,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
StringBuilder depositoryManagerByQyWx = new StringBuilder();
for (int i = 0; i < depositoryManagers.length; i++) {
Integer uid = ObjectFormatUtil.toInteger(depositoryManagers[i]);
UserByPort depositoryManager = PageController.FindUserById(uid, userByPort);
UserByPort depositoryManager = LinkInterfaceUtil.FindUserById(uid, userByPort);
// depositoryManagerByQyWx.append(depositoryManager.getWorkwechat()+",");
}
depositoryManagerByQyWx.append("PangFuZhen,");
@ -817,7 +816,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
StringBuilder QyWxUid = new StringBuilder();
for (int j = 0; j < userIdByDid.size(); j++) {
// 获取仓库管理员信息
UserByPort manager = PageController.FindUserById(userIdByDid.get(j), null);
UserByPort manager = LinkInterfaceUtil.FindUserById(userIdByDid.get(j), null);
// 仓库管理员订单信息
Map<String, Object> userRecord = new HashMap<>();
// 用户当前子订单
@ -854,7 +853,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<Integer> userIdByDid = roleService.findUserIdByDid(depositoryIdList.get(i));
StringBuilder QyWxUid = new StringBuilder();
for (int j = 0; j < userIdByDid.size(); j++) {
UserByPort manager = PageController.FindUserById(userIdByDid.get(j), userByPort);
UserByPort manager = LinkInterfaceUtil.FindUserById(userIdByDid.get(j), userByPort);
// QyWxUid.append(manager.getWorkwechat()+",");
}
QyWxUid.append("PangFuZhen,");
@ -905,7 +904,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("departmentheadPass", 1);
map.put("state", "待仓储中心负责人审核");
// 获取仓储中心详情
Administration company = PageController.getCompany(361, null);
Administration company = LinkInterfaceUtil.getCompany(361, null);
// 获取仓储中心负责人
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(company, null);
StringBuilder depositoryManager = new StringBuilder();
@ -973,7 +972,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("transferId", transferId);
// 获取当前转移物料仓库
Depository depositoryRecordById = depositoryMapper.findDepositoryById(material.getDepositoryId());
Administration company = PageController.getCompany(userByPort.getMaindeparment(), userByPort);
Administration company = LinkInterfaceUtil.getCompany(userByPort.getMaindeparment(), userByPort);
// 生成出库订单
map.put("code", createCode(depositoryRecordById.getDname(), "outOrderNumber", "out", company.getName()));
Object placeId = map.get("fromPlaceId");
@ -1018,7 +1017,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 获取仓储中心详情
Administration company = PageController.getCompany(361, userToken);
Administration company = LinkInterfaceUtil.getCompany(361, userToken);
// 获取仓储中心负责人
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(company, userToken);
StringBuilder depositoryManager = new StringBuilder();
@ -1060,7 +1059,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
public void run() {
// 获取responseCode(key为申请人number)
//获取申请人信息
UserByPort applicantUser = PageController.FindUserById(record.getApplicantId(), userToken);
UserByPort applicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userToken);
String key = "user:" + applicantUser.getNumber() + ":QyWxOutId:" + id;
String responseCode = (String) redisTemplate.opsForHash().get(key, "responseCode");
qyWxOperationService.updateTemplateCard(responseCode, userToken.getName(), finalResult, userAgent);
@ -1079,7 +1078,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(s)) {
continue;
}
UserByPort userByPort = PageController.FindUserById(ObjectFormatUtil.toInteger(s), null);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null);
QyWxUid.append(userByPort.getWorkwechat()).append(",");
}
String s = QyWxUid.toString();
@ -1152,7 +1151,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
for (int j = 0; j < userIdByDid.size(); j++) {
// 获取当前用户信息
UserByPort userByPort = PageController.FindUserById(userIdByDid.get(j), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(userIdByDid.get(j), userToken);
// 仓库管理员订单信息
Map<String, Object> userRecord = new HashMap<>();
// 用户当前子订单
@ -1191,7 +1190,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<Integer> userIdByDid = roleService.findUserIdByDid(depositoryIdList.get(i));
StringBuilder QyWxUid = new StringBuilder();
for (int j = 0; j < userIdByDid.size(); j++) {
UserByPort manager = PageController.FindUserById(userIdByDid.get(j), userToken);
UserByPort manager = LinkInterfaceUtil.FindUserById(userIdByDid.get(j), userToken);
// QyWxUid.append(manager.getWorkwechat()+",");
}
QyWxUid.append("PangFuZhen,");
@ -1225,7 +1224,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
if ("".equals(s)) {
continue;
}
UserByPort userByPort = PageController.FindUserById(ObjectFormatUtil.toInteger(s), null);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null);
QyWxUid.append(userByPort.getWorkwechat()).append(",");
}
String s = QyWxUid.toString();
@ -1249,7 +1248,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
public void run() {
// 获取responseCode(key为申请人number)
//获取部门负责人信息
UserByPort departHead = PageController.FindUserById(ObjectFormatUtil.toInteger(record.getDepartmenthead()), userToken);
UserByPort departHead = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(record.getDepartmenthead()), userToken);
String key = "user:" + departHead.getNumber() + ":QyWxOutId:" + id;
String responseCode = (String) redisTemplate.opsForHash().get(key, "responseCode");
qyWxOperationService.updateTemplateCard(responseCode, userToken.getName(), finalResult, userAgent);
@ -1302,7 +1301,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
map.put("departmentheadPass", 1);
map.put("state", "待仓储中心负责人审核");
// 获取仓储中心详情
Administration company = PageController.getCompany(361, null);
Administration company = LinkInterfaceUtil.getCompany(361, null);
// 获取仓储中心负责人
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(company, null);
StringBuilder depositoryManager = new StringBuilder();
@ -1386,7 +1385,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
StringBuilder QyWxUid = new StringBuilder();
for (int j = 0; j < userIdByDid.size(); j++) {
// 获取仓库管理员信息
UserByPort manager = PageController.FindUserById(userIdByDid.get(j), userByPort);
UserByPort manager = LinkInterfaceUtil.FindUserById(userIdByDid.get(j), userByPort);
// 仓库管理员订单信息
Map<String, Object> userRecord = new HashMap<>();
// 用户当前子订单
@ -1423,7 +1422,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
List<Integer> userIdByDid = roleService.findUserIdByDid(depositoryIdList.get(i));
StringBuilder QyWxUid = new StringBuilder();
for (int j = 0; j < userIdByDid.size(); j++) {
UserByPort manager = PageController.FindUserById(userIdByDid.get(j), userByPort);
UserByPort manager = LinkInterfaceUtil.FindUserById(userIdByDid.get(j), userByPort);
// QyWxUid.append(manager.getWorkwechat()+",");
}
QyWxUid.append("PangFuZhen,");

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

@ -1,6 +1,5 @@
package com.dreamchaser.depository_manage.service.impl;
import com.dreamchaser.depository_manage.controller.PageController;
import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.mapper.DepositoryMapper;
import com.dreamchaser.depository_manage.mapper.PlaceMapper;
@ -9,6 +8,7 @@ import com.dreamchaser.depository_manage.mapper.RoleMapper;
import com.dreamchaser.depository_manage.pojo.InventoryByDname;
import com.dreamchaser.depository_manage.pojo.RoleAndDepository;
import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import com.dreamchaser.depository_manage.utils.WordUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -55,12 +55,12 @@ public class DepositoryServiceImpl implements DepositoryService {
List<Depository> condition = depositoryMapper.findDepositoryRecordPByCondition(temp);
// 公司编号
Integer cid = ObjectFormatUtil.toInteger(map.get("cid"));
String companyName = PageController.getCompany(cid, userByPort).getName();
String companyName = LinkInterfaceUtil.getCompany(cid, userByPort).getName();
String adminorgName = "";
// 部门编号
if (!"".equals(map.get("adminorg"))) {
Integer adminorg = ObjectFormatUtil.toInteger(map.get("adminorg"));
adminorgName = PageController.getCompany(adminorg, userByPort).getName();
adminorgName = LinkInterfaceUtil.getCompany(adminorg, userByPort).getName();
}
// 公司简称
companyName = WordUtil.getPinYinHeadChar(companyName);
@ -92,7 +92,7 @@ public class DepositoryServiceImpl implements DepositoryService {
// 部门编号
if (!"".equals(map.get("adminorg"))) {
Integer adminorg = ObjectFormatUtil.toInteger(map.get("adminorg"));
adminorgName = PageController.getCompany(adminorg, userByPort).getName();
adminorgName = LinkInterfaceUtil.getCompany(adminorg, userByPort).getName();
adminorgName = WordUtil.getPinYinHeadChar(adminorgName).substring(0, 2);
}
// 获取父仓库编码
@ -134,7 +134,7 @@ public class DepositoryServiceImpl implements DepositoryService {
for (int i = 0; i < list.size(); i++) {
Depository depository = list.get(i);
if (!depository.getAdminorg().isEmpty()) {
Administration company = PageController.getCompany(ObjectFormatUtil.toInteger(depository.getAdminorg()), userByPort);
Administration company = LinkInterfaceUtil.getCompany(ObjectFormatUtil.toInteger(depository.getAdminorg()), userByPort);
depository.setAdminorgName(company.getName());
}
}

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

@ -7,14 +7,13 @@ import com.dreamchaser.depository_manage.config.PortConfig;
import com.dreamchaser.depository_manage.config.QyWxConfig;
import com.dreamchaser.depository_manage.config.QyWx_approval_template.*;
import com.dreamchaser.depository_manage.config.QyWx_template_card.*;
import com.dreamchaser.depository_manage.controller.PageController;
import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.mapper.*;
import com.dreamchaser.depository_manage.pojo.ApplicationOutRecordP;
import com.dreamchaser.depository_manage.pojo.StockTakingChildP;
import com.dreamchaser.depository_manage.service.MaterialTypeService;
import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.HttpUtils;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
@ -66,7 +65,7 @@ public class QyWxOperationService {
// 申请人id
Integer applicantId = applicationOutRecordPById.getApplicantId();
// 申请人
UserByPort applicant = PageController.FindUserById(applicantId, null);
UserByPort applicant = LinkInterfaceUtil.FindUserById(applicantId, null);
// 获取所有子订单
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(outId);
@ -260,7 +259,7 @@ public class QyWxOperationService {
// 申请人id
Integer getOriginator = mainRecord.getOriginator();
// 申请人
UserByPort originator = PageController.FindUserById(getOriginator, null);
UserByPort originator = LinkInterfaceUtil.FindUserById(getOriginator, null);
// 盘点物料名称
StringBuilder mname = new StringBuilder();
@ -510,7 +509,7 @@ public class QyWxOperationService {
// 申请人id
Integer getOriginator = mainRecord.getOriginator();
// 申请人
UserByPort originator = PageController.FindUserById(getOriginator, null);
UserByPort originator = LinkInterfaceUtil.FindUserById(getOriginator, null);
// 盘点物料名称
StringBuilder mname = new StringBuilder();
@ -745,7 +744,7 @@ public class QyWxOperationService {
// 申请人id
Integer applicantId = recordP.getApplicantId();
// 申请人
UserByPort applicant = PageController.FindUserById(applicantId, null);
UserByPort applicant = LinkInterfaceUtil.FindUserById(applicantId, null);
// 获取所有子订单
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(outId);
@ -778,7 +777,7 @@ public class QyWxOperationService {
// 获取仓库信息
Depository depositoryRecordById = depositoryMapper.findDepositoryById(recordMin.getDepositoryId());
// 获取处理人信息
UserByPort userByPort = PageController.FindUserById(recordMin.getCheckId(), null);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(recordMin.getCheckId(), null);
content.append(">- 物料名称:").append(materialById.getMname()).append("%n");
content.append(">- 申请数量:").append(recordMin.getQuantity()).append("%n");
content.append(">- 所处仓库:").append(depositoryRecordById.getDname()).append("%n");
@ -842,7 +841,7 @@ public class QyWxOperationService {
// 抄送内容
StringBuilder content = new StringBuilder("## `抄送信息:`%n");
// 获取发起人信息
UserByPort originator = PageController.FindUserById(mainRecord.getOriginator(), userToken);
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userToken);
// 设置content
content.append(">### **" + originator.getName() + "的物料调账记录** %n<font color='warning'>时间:" + DateUtil.TimeStampToDateTime(mainRecord.getCreateTime()) + "</font> %n");
@ -946,7 +945,7 @@ public class QyWxOperationService {
// 抄送内容
StringBuilder content = new StringBuilder("## `盘点发生错误:`%n");
// 获取发起人信息
UserByPort originator = PageController.FindUserById(mainRecord.getOriginator(), userToken);
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userToken);
// 设置content
content.append(">### **" + originator.getName() + "的物料盘点记录** %n<font color='warning'>时间:" + DateUtil.TimeStampToDateTime(mainRecord.getCreateTime()) + "</font> %n");
@ -1044,7 +1043,7 @@ public class QyWxOperationService {
// 抄送内容
StringBuilder content = new StringBuilder("## `抄送信息:`%n");
// 获取发起人信息
UserByPort originator = PageController.FindUserById(mainRecord.getOriginator(), userToken);
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userToken);
// 设置content
content.append(">### **" + originator.getName() + "的物料转移记录** %n<font color='warning'>时间:" + DateUtil.TimeStampToDateTime(mainRecord.getCreateTime()) + "</font> %n");
@ -1162,7 +1161,7 @@ public class QyWxOperationService {
// 申请人id
Integer applicantId = outRecordP.getApplicantId();
// 申请人
UserByPort applicant = PageController.FindUserById(applicantId, null);
UserByPort applicant = LinkInterfaceUtil.FindUserById(applicantId, null);
// 定义文本通知型卡片
TextNotice textNotice = new TextNotice();
@ -1658,7 +1657,7 @@ public class QyWxOperationService {
// 获取申请人的userId
UserByPort userByPort = PageController.FindUserById(mainRecord.getApplicantId(), null);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(mainRecord.getApplicantId(), null);
String workwechat = userByPort.getWorkwechat();
if(workwechat == null || "".equals(workwechat)){
workwechat = userByPort.getWechat();
@ -2083,7 +2082,7 @@ public class QyWxOperationService {
continue;
}
// 获取负责人信息
UserByPort userByPort = PageController.FindUserById(ObjectFormatUtil.toInteger(departmentManagers[i]), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(departmentManagers[i]), userToken);
Map<String,String> contact_principal = new HashMap<>();
contact_principal.put("userid",userByPort.getWorkwechat());
contact_principal.put("name",userByPort.getName());
@ -2433,7 +2432,7 @@ public class QyWxOperationService {
applicantTime = stockTaking.getCreateTime();
tempMessageTitle = "库存盘点审批";
}
UserByPort userByPort = PageController.FindUserById(applicantId, null);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(applicantId, null);
// 设置content
content.append(">### **%n<font color='warning'>对于"+userByPort.getName()+"在"+DateUtil.TimeStampToDateTime(applicantTime)+"提起"+tempMessageTitle+"的转至应用发送的消息进行审批,审批应用中的流程请忽略</font> %n**");
content.append("%n---%n");

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

@ -2,7 +2,6 @@ package com.dreamchaser.depository_manage.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PortConfig;
import com.dreamchaser.depository_manage.controller.PageController;
import com.dreamchaser.depository_manage.entity.*;
import com.dreamchaser.depository_manage.exception.MyException;
import com.dreamchaser.depository_manage.mapper.DepositoryMapper;
@ -17,6 +16,7 @@ import com.dreamchaser.depository_manage.pojo.callBackXml.callBackXml_button_tem
import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.StockTakingService;
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.WordUtil;
import org.redisson.api.RLock;
@ -159,7 +159,7 @@ public class StockTakingServiceImpl implements StockTakingService {
SimpleStockTakingP ssp = new SimpleStockTakingP(stockTaking);
Depository depositoryRecordById = depositoryMapper.findDepositoryById(stockTaking.getDepositoryId());
ssp.setDepositoryName(depositoryRecordById.getDname());
UserByPort userByPort = PageController.FindUserById(stockTaking.getOriginator(), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userToken);
ssp.setOriginatorName(userByPort.getName());
stockTakingPS.add(ssp);
}
@ -203,7 +203,7 @@ public class StockTakingServiceImpl implements StockTakingService {
SimpleStockTakingP ssp = new SimpleStockTakingP(stockTaking);
Depository depositoryRecordById = depositoryMapper.findDepositoryById(stockTaking.getDepositoryId());
ssp.setDepositoryName(depositoryRecordById.getDname());
UserByPort userByPort = PageController.FindUserById(stockTaking.getOriginator(), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(stockTaking.getOriginator(), userToken);
ssp.setOriginatorName(userByPort.getName());
stockTakingPS.add(ssp);
}
@ -318,7 +318,7 @@ public class StockTakingServiceImpl implements StockTakingService {
if ("".equals(s)) {
continue;
}
UserByPort userByPort = PageController.FindUserById(ObjectFormatUtil.toInteger(s), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userToken);
QyWxUid.append(userByPort.getWorkwechat()).append(",");
}
// 如果同意
@ -461,7 +461,7 @@ public class StockTakingServiceImpl implements StockTakingService {
@Override
public void run() {
// 获取盘点人员
UserByPort originator = PageController.FindUserById(mainRecord.getOriginator(), userToken);
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), userToken);
String workwechat = originator.getWorkwechat();
JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage("PangFuZhen,", mainId, normalMinId, userAgent);
// JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage(workwechat, mainId,normalMinId);
@ -500,7 +500,7 @@ public class StockTakingServiceImpl implements StockTakingService {
// 获取responseCode(key为申请人number)
//获取申请人信息
Integer originator = mainRecord.getOriginator();
UserByPort userByPort = PageController.FindUserById(originator, userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(originator, userToken);
String key = "user:" + userByPort.getNumber() + ":QyWxStockTakingId:" + mainId;
String responseCode = (String) redisTemplate.opsForHash().get(key, "responseCode");
qyWxOperationService.updateTemplateCard(responseCode, userToken.getName(), finalStockTakingResult, userAgent);
@ -519,7 +519,7 @@ public class StockTakingServiceImpl implements StockTakingService {
if("".equals(s)){
continue;
}
UserByPort userByPort = PageController.FindUserById(ObjectFormatUtil.toInteger(s), null);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null);
QyWxUid.append(userByPort.getWorkwechat()).append(",");
}
String s = QyWxUid.toString();
@ -568,7 +568,7 @@ public class StockTakingServiceImpl implements StockTakingService {
if ("".equals(s)) {
continue;
}
UserByPort userByPort = PageController.FindUserById(ObjectFormatUtil.toInteger(s), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), userToken);
QyWxUid.append(userByPort.getWorkwechat()).append(",");
}
@ -800,7 +800,7 @@ public class StockTakingServiceImpl implements StockTakingService {
public void run() {
// 获取responseCode(key为申请人number)
Integer originator = mainRecord.getOriginator();
UserByPort userByPort = PageController.FindUserById(originator, userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(originator, userToken);
//获取申请人信息
String key = "user:" + userByPort.getNumber() + ":QyWxStockTakingCompleteId:" + mainId;
String responseCode = (String) redisTemplate.opsForHash().get(key, "responseCode");
@ -1106,7 +1106,7 @@ public class StockTakingServiceImpl implements StockTakingService {
if ("".equals(s)) {
continue;
}
UserByPort userByPort1 = PageController.FindUserById(ObjectFormatUtil.toInteger(s), null);
UserByPort userByPort1 = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null);
QyWxUid.append(userByPort1.getWorkwechat()).append(",");
}
String s = QyWxUid.toString();
@ -1168,7 +1168,7 @@ public class StockTakingServiceImpl implements StockTakingService {
if ("".equals(s)) {
continue;
}
UserByPort userByPort = PageController.FindUserById(ObjectFormatUtil.toInteger(s), null);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null);
QyWxUid.append(userByPort.getWorkwechat()).append(",");
}
if ("2".equals(spStatus)) {
@ -1311,7 +1311,7 @@ public class StockTakingServiceImpl implements StockTakingService {
@Override
public void run() {
// 获取盘点人员
UserByPort originator = PageController.FindUserById(mainRecord.getOriginator(), null);
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), null);
String workwechat = originator.getWorkwechat();
JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage("PangFuZhen,", ObjectFormatUtil.toInteger(mainId), normalMinId, userAgent);
// JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage(workwechat, mainId,normalMinId);
@ -1548,7 +1548,7 @@ public class StockTakingServiceImpl implements StockTakingService {
Integer originator = finalMainRecord.getOriginator();
map.put("minIds", minRecorIds);
StringBuilder departMentHeadQyWxName = new StringBuilder();
UserByPort userByPort = PageController.FindUserById(ObjectFormatUtil.toInteger(originator), userToken);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(originator), userToken);
// departMentHeadQyWxName.append(userByPort.getWorkwechat()+",");
departMentHeadQyWxName.append("PangFuZhen,");
JSONObject jsonObject = qyWxOperationService.sendCcStockTakingTransferMessageToHead(departMentHeadQyWxName.toString(), map, userToken, finalMainRecord, userAgent);
@ -1752,7 +1752,7 @@ public class StockTakingServiceImpl implements StockTakingService {
@Override
public void run() {
// 获取盘点人员
UserByPort originator = PageController.FindUserById(mainRecord.getOriginator(), null);
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), null);
// String workwechat = originator.getWorkwechat();
JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage("PangFuZhen,", mainId, normalMinIds, userAgent);
// JSONObject jsonObject = qyWxOperationService.sendQyWxToStockTakingMessage(workwechat, mainId, normalMinIds);
@ -1776,7 +1776,7 @@ public class StockTakingServiceImpl implements StockTakingService {
@Override
public void run() {
// 获取盘点人员
UserByPort originator = PageController.FindUserById(mainRecord.getOriginator(), null);
UserByPort originator = LinkInterfaceUtil.FindUserById(mainRecord.getOriginator(), null);
// String workwechat = originator.getWorkwechat();
qyWxOperationService.sendStockTakingErrMessageToHead("PangFuZhen,", errIds, mainRecord, null, userAgent);
// qyWxOperationService.sendStockTakingErrMessageToHead(workwechat, errIds, mainRecord,null);

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

@ -0,0 +1,182 @@
package com.dreamchaser.depository_manage.utils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.config.PortConfig;
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.pojo.AdministrationP;
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, UserByPort userToken) {
String url = PortConfig.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, 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 (int i = 0; i < list.size(); i++) {
UserByPort userByPort = JSONObject.toJavaObject((JSONObject) list.get(i), UserByPort.class);
result.add(userByPort);
}
return result;
}
/**
* 根据用户id查询对应用户
* @param id 待查讯用户id
* @param userToken 登录用户
* @return 查询结果
*/
public static UserByPort FindUserById(Integer id, UserByPort userToken) {
String url = PortConfig.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, userToken);
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data");
UserByPort userByPort = JSONObject.toJavaObject(data, UserByPort.class);
return userByPort;
}
/**
* 根据id查询对应的行政组织
* @param id 待查讯组织id
* @param userByPort 登录用户
* @return 查询结果
*/
public static Administration getCompany(Integer id, UserByPort userByPort) {
String url = PortConfig.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, userByPort);
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data");
Administration administration = JSONObject.toJavaObject(data, Administration.class);
return administration;
}
/**
* 根据上级查询对应的行政组织
* @param superior 上级编号
* @param userByPort 登录用户
* @return 查询结果
*/
public static List<AdministrationP> findCompanyBySuperior(String superior, UserByPort userByPort) {
String url = PortConfig.external_url + "/org/govlist";
Map<String, Object> map = new HashMap<>();
map.put("superior", superior);
String jsonString = JSONObject.toJSONString(map);
JSONObject paramObject = JSONObject.parseObject(jsonString);
String post = null;
try {
post = HttpUtils.send(url, paramObject, HTTP.UTF_8, userByPort);
} 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 (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);
}
return administrationPList;
}
/**
* 根据岗位id查询对应的岗位信息
* @param id 岗位id
* @param userByPort 登录用户
* @return 查询结果
*/
public static Post findPostById(Integer id, UserByPort userByPort) {
String url = PortConfig.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, userByPort);
} 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) {
UserByPort userByPort = (UserByPort) request.getAttribute("userToken");
String url = PortConfig.external_url_6666 + "/base/captcha";
JSONObject param = new JSONObject();
String post = null;
try {
post = HttpUtils.send(url, param, HTTP.UTF_8, userByPort);
} catch (IOException e) {
e.printStackTrace();
}
JSONObject jsonObject = JSONObject.parseObject(post);
JSONObject data = (JSONObject) jsonObject.get("data");
return data;
}
}

474
src/main/resources/templates/pages/chart/chart-in.html

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>首页三</title>
@ -15,18 +15,23 @@
border-radius: 5px;
text-align: center;
}
.top-panel > .layui-card-body{
.top-panel > .layui-card-body {
height: 60px;
}
.top-panel-number{
line-height:60px;
.top-panel-number {
line-height: 60px;
font-size: 30px;
border-right:1px solid #eceff9;
border-right: 1px solid #eceff9;
}
.top-panel-tips{
line-height:30px;
.top-panel-tips {
line-height: 30px;
font-size: 12px
}
</style>
</head>
<body>
@ -44,8 +49,8 @@
<span th:text="${allInCount}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
比昨天 <a style="color: #1aa094">▲0.12</a><br>
比七日 <a style="color: #bd3004">▼0.06</a>
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
</div>
</div>
</div>
@ -62,8 +67,8 @@
<span th:text="${allInPrice}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
比昨天 <a style="color: #1aa094">▲0.12</a><br>
比七日 <a style="color: #bd3004">▼0.06</a>
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
</div>
</div>
</div>
@ -80,8 +85,8 @@
<span th:text="${InCount}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
比昨天 <a style="color: #1aa094">▲0.12</a><br>
比七日 <a style="color: #bd3004">▼0.06</a>
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
</div>
</div>
</div>
@ -98,8 +103,8 @@
<span th:text="${InPrice}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
比昨天 <a style="color: #1aa094">▲0.12</a><br>
比七日 <a style="color: #bd3004">▼0.06</a>
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
</div>
</div>
</div>
@ -109,25 +114,45 @@
</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-md9">
<div id="echarts-records" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
<div class="layui-collapse" lay-accordion>
<div class="layui-colla-item">
<h2 class="layui-colla-title">折线图</h2>
<div class="layui-colla-content layui-show">
<button class="layui-btn" lay-submit lay-filter="thisWeek">
&emsp;本周&emsp;
</button>
<button class="layui-btn" lay-submit lay-filter="lastWeek">
&emsp;上周&emsp;
</button>
<div id="echarts-records" style="background-color:#ffffff;min-height:1000px;padding: 10px">
</div>
</div>
<div class="layui-col-xs12 layui-col-md3">
<div id="echarts-pies" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
</div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">饼图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-pies" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-md6">
<div id="echarts-dataset" style="background-color:#ffffff;min-height:300px;padding: 10px"></div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">柱状图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-dataset" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
</div>
<div class="layui-col-xs12 layui-col-md6">
<div id="echarts-map" style="background-color:#ffffff;min-height:300px;padding: 10px"></div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">折线比例图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-map" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
</div>
</div>
</div>
<!--</div>-->
@ -135,19 +160,20 @@
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
layui.use(['layer', 'echarts'], function () {
layui.use(['layer', 'echarts', 'element'], function () {
var $ = layui.jquery,
layer = layui.layer,
echarts = layui.echarts,
element = layui.element,
form = layui.form;
/**
* 报表功能
* 折线图
*/
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
var optionRecords = {
title: {
text: '入库仓库-报表图'
text: '入库仓库-报表图',
},
tooltip: {
trigger: 'axis',
@ -159,7 +185,7 @@
}
},
legend: {
data: ['外芯仓库', '义乌仓库', '宁波仓库', '杭州仓库', '北京仓库']
data: []
},
toolbox: {
feature: {
@ -176,7 +202,7 @@
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
data: []
}
],
yAxis: [
@ -185,33 +211,6 @@
}
],
series: [
{
name: '外芯仓库',
type: 'line',
stack: '金额',
areaStyle: {},
data: [120]
},
{
name: '义乌仓库',
type: 'line',
areaStyle: {},
data: [220]
},
{
name: '宁波仓库',
type: 'line',
stack: '金额',
areaStyle: {},
data: [150]
},
{
name: '杭州仓库',
type: 'line',
stack: '金额',
areaStyle: {},
data: [320]
},
{
name: '北京仓库',
type: 'line',
@ -223,12 +222,10 @@
}
},
areaStyle: {},
data: [820]
data: []
}
]
};
echartsRecords.setOption(optionRecords);
/**
* 玫瑰图表
@ -246,7 +243,7 @@
legend: {
orient: 'vertical',
left: 'left',
data: ['外芯仓库', '义乌仓库', '宁波仓库', '杭州仓库', '北京仓库']
data: []
},
series: [
{
@ -272,104 +269,373 @@
}
]
};
echartsPies.setOption(optionPies);
/**
* 柱状图
*/
var echartsDataset = echarts.init(document.getElementById('echarts-dataset'), 'walden');
var optionDataset = {
legend: {},
tooltip: {},
dataset: {
// dimensions: ['product', '3月', '4月', '5月'],
dimensions: ['month', "家电",'小商品', '小零食', '海产品类',"电子元器件","芯片类"],
source: [
// {product: '电子产品类', '3月': 43.3, '4月': 85.8, '5月': 93.7},
// {product: '食品类', '3月': 83.1, '4月': 73.4, '5月': 55.1},
// {product: '饮品类', '3月': 86.4, '4月': 65.2, '5月': 82.5},
// {product: '海产品类', '3月': 72.4, '4月': 53.9, '5月': 39.1}
{month: '2022-07-01','家电':32,'小商品':312,'小零食':432,'海产品类':131,'电子元器件':23,'芯片类':213},
{month: '2022-08-01','家电':120,'小商品':150,'小零食':200,'海产品类':219,'电子元器件':135,'芯片类':123}
]
dimensions: [],
source: []
},
xAxis: {type: 'category'},
yAxis: {},
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
series: [
{type: 'bar'},
{type: 'bar'},
{type: 'bar'},
{type:'bar'}
{type: 'bar'}
]
};
echartsDataset.setOption(optionDataset);
/**
* 中国地图
*/
var echartsMap = echarts.init(document.getElementById('echarts-map'), 'walden');
var optionMap = {
legend: {},
tooltip: {
trigger: 'axis',
showContent: false
showContent: true
},
dataset: {
source: [
// ['month', "家电",'小商品', '小零食', '海产品类',"电子元器件","芯片类"],
['product', '3月', '4月', '5月', '6月', '7月', '8月'],
['电子产品类', 41.1, 30.4, 65.1, 53.3, 83.8, 98.7],
['食品类', 86.5, 92.1, 85.7, 83.1, 73.4, 55.1],
['饮品类', 24.1, 67.2, 79.5, 86.4, 65.2, 82.5],
['海产品类', 55.2, 67.1, 69.2, 72.4, 53.9, 39.1]
]
source: []
},
xAxis: {type: 'category'},
yAxis: {gridIndex: 0},
grid: {top: '55%'},
series: [
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
series: []
};
//动态加载相关数据
$.ajax({
url: '/repository/layui/echart_back?type=1',
type: 'get',
async: true,
dataType: "json",
complete: function (XHR, TS) {
if (XHR.status !== 200) {
layer.alert("系统繁忙,稍后重试");
}
},
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (result) {
layer.close(this.layerIndex);
if (result.code === 0) {
echartsRecords.setOption(optionRecords);
echartsPies.setOption(optionPies);
echartsDataset.setOption(optionDataset);
echartsMap.setOption(optionMap);
// 折线图
var optionRecordsSeries = [];
// 饼状图
var optionPiesSeries = {
name: '昨日占比',
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
roseType: 'radius',
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
data: []
};
// 柱状图
optionDataset = {
legend: {},
tooltip: {},
dataset: {
dimensions: [],
source: []
},
xAxis: {type: 'category'},
yAxis: {},
series: []
};
for (let i = 0; i < result.data.depository_name.length; i++) {
optionRecordsSeries.push({
name: result.data.depository_name[i],
type: 'line',
stack: '金额',
data: result.data.depository_data.data[result.data.depository_name[i]],
areaStyle: {}
});
optionPiesSeries.data.push({
value: result.data.depository_data.yesterdayData[result.data.depository_name[i]],
name: result.data.depository_name[i]
})
}
var dimensions = result.data.depository_data.sourceList[result.data.depository_data.sourceList.length - 1]
optionDataset.dataset.dimensions = dimensions;
for (let i = result.data.depository_data.sourceList.length - 2; i >= 0; i--) {
optionDataset.dataset.source.push(result.data.depository_data.sourceList[i])
}
for (let i = 0; i < dimensions.length - 1; i++) {
optionDataset.series.push({type: 'bar'})
}
for (let i = 0; i < result.data.depository_data.mapData.mapDataList.length; i++) {
optionMap.dataset.source.push(result.data.depository_data.mapData.mapDataList[i]);
if (i < result.data.depository_data.mapData.mapDataList.length - 1) {
optionMap.series.push({type: 'line', smooth: true, seriesLayoutBy: 'row'})
}
}
var month = new Date().getMonth() + 1;
optionMap.series.push(
{
type: 'pie',
id: 'pie',
// id: 'pie',
radius: '30%',
center: ['50%', '25%'],
label: {
formatter: '{b}: {@3月} ({d}%)'
formatter: '{b}: {@' + month + '月} ({d}%)'
},
encode: {
itemName: 'product',
value: '3月',
tooltip: '3月'
value: month + '月',
tooltip: month + '月'
}
}
]
);
optionRecords = {
title: {
text: '入库仓库-报表图'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: result.data.depository_name
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: result.data.depository_data.week
}
],
yAxis: [
{
type: 'value'
}
],
series: optionRecordsSeries
};
optionPies = {
title: {
text: '仓库分布图',
left: 'center'
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
orient: 'vertical',
left: 'left',
data: result.data.depository_name
},
series: optionPiesSeries
};
echartsRecords.setOption(optionRecords);
echartsPies.setOption(optionPies);
echartsDataset.setOption(optionDataset);
echartsMap.setOption(optionMap);
}
}
});
// echarts 窗口缩放自适应
window.onresize = function () {
echartsRecords.resize();
};
form.on('submit(thisWeek)', function () {
$.ajax({
url: '/repository/layui/echart_back_thisWeek?type=1',
type: 'get',
async: true,
dataType: "json",
complete: function (XHR, TS) {
if (XHR.status != 200) {
layer.alert("系统繁忙,稍后重试");
}
},
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (result) {
layer.close(this.layerIndex);
echartsRecords.setOption(optionRecords);
// 折线图
var optionRecordsSeries = [];
for (let i = 0; i < result.depository_name.length; i++) {
optionRecordsSeries.push({
name: result.depository_name[i],
type: 'line',
stack: '金额',
data: result.data[result.depository_name[i]],
areaStyle: {}
});
}
optionRecords = {
title: {
text: '入库仓库-报表图'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: result.depository_name
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: result.week
}
],
yAxis: [
{
type: 'value'
}
],
series: optionRecordsSeries
};
echartsRecords.setOption(optionRecords);
}
})
});
form.on('submit(lastWeek)', function () {
$.ajax({
url: '/repository/layui/echart_back_lastWeek?type=1',
type: 'get',
async: true,
dataType: "json",
complete: function (XHR, TS) {
if (XHR.status !== 200) {
layer.alert("系统繁忙,稍后重试");
}
},
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (result) {
layer.close(this.layerIndex);
echartsRecords.setOption(optionRecords);
// 折线图
var optionRecordsSeries = [];
for (let i = 0; i < result.depository_name.length; i++) {
optionRecordsSeries.push({
name: result.depository_name[i],
type: 'line',
stack: '金额',
data: result.data[result.depository_name[i]],
areaStyle: {}
});
}
optionRecords = {
title: {
text: '入库仓库-报表图'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: result.depository_name
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: result.week
}
],
yAxis: [
{
type: 'value'
}
],
series: optionRecordsSeries
};
echartsRecords.setOption(optionRecords);
}
})
})
});
</script>
</body>
</html>

51
src/main/resources/templates/pages/chart/chart-in_back.html

@ -30,6 +30,8 @@
line-height: 30px;
font-size: 12px
}
</style>
</head>
<body>
@ -112,32 +114,45 @@
</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-md9">
<div class="layui-collapse" lay-accordion>
<div class="layui-colla-item">
<h2 class="layui-colla-title">折线图</h2>
<div class="layui-colla-content layui-show">
<button class="layui-btn" lay-submit lay-filter="thisWeek">
&emsp;本周&emsp;
</button>
<button class="layui-btn" lay-submit lay-filter="lastWeek">
&emsp;上周&emsp;
</button>
<div id="echarts-records" style="background-color:#ffffff;min-height:400px;padding: 10px">
<div id="echarts-records" style="background-color:#ffffff;min-height:1000px;padding: 10px">
</div>
</div>
<div class="layui-col-xs12 layui-col-md3">
<div id="echarts-pies" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
</div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">饼图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-pies" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-md6">
<div id="echarts-dataset" style="background-color:#ffffff;min-height:300px;padding: 10px"></div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">柱状图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-dataset" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
<div class="layui-col-xs12 layui-col-md6">
<div id="echarts-map" style="background-color:#ffffff;min-height:300px;padding: 10px"></div>
</div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">折线比例图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-map" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
</div>
</div>
</div>
<!--</div>-->
@ -145,10 +160,11 @@
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
layui.use(['layer', 'echarts'], function () {
layui.use(['layer', 'echarts', 'element'], function () {
var $ = layui.jquery,
layer = layui.layer,
echarts = layui.echarts,
element = layui.element,
form = layui.form;
/**
* 折线图
@ -292,8 +308,7 @@
xAxis: {type: 'category'},
yAxis: {gridIndex: 0},
grid: {top: '55%'},
series: [
]
series: []
};
@ -375,14 +390,12 @@
for (let i = 0; i < result.data.depository_data.mapData.mapDataList.length; i++) {
optionMap.dataset.source.push(result.data.depository_data.mapData.mapDataList[i]);
if(i < result.data.depository_data.mapData.mapDataList.length - 1) {
if (i < result.data.depository_data.mapData.mapDataList.length - 1) {
optionMap.series.push({type: 'line', smooth: true, seriesLayoutBy: 'row'})
}
}
var month = new Date().getMonth() + 1;
optionMap.series.push(
@ -392,12 +405,12 @@
radius: '30%',
center: ['50%', '25%'],
label: {
formatter: '{b}: {@'+month+'月} ({d}%)'
formatter: '{b}: {@' + month + '月} ({d}%)'
},
encode: {
itemName: 'product',
value: month+'月',
tooltip: month+'月'
value: month + '月',
tooltip: month + '月'
}
}
);

430
src/main/resources/templates/pages/chart/chart-out.html

@ -1,5 +1,5 @@
<!DOCTYPE html>
<html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>首页三</title>
@ -15,16 +15,19 @@
border-radius: 5px;
text-align: center;
}
.top-panel > .layui-card-body{
.top-panel > .layui-card-body {
height: 60px;
}
.top-panel-number{
line-height:60px;
.top-panel-number {
line-height: 60px;
font-size: 30px;
border-right:1px solid #eceff9;
border-right: 1px solid #eceff9;
}
.top-panel-tips{
line-height:30px;
.top-panel-tips {
line-height: 30px;
font-size: 12px
}
</style>
@ -41,11 +44,11 @@
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
9,054,056
<span th:text="${allOutCount}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
比昨天 <a style="color: #1aa094">▲0.12</a><br>
比七日 <a style="color: #bd3004">▼0.06</a>
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
</div>
</div>
</div>
@ -59,11 +62,11 @@
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
9,054,056
<span th:text="${allOutPrice}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
比昨天 <a style="color: #1aa094">▲0.12</a><br>
比七日 <a style="color: #bd3004">▼0.06</a>
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
</div>
</div>
</div>
@ -73,15 +76,15 @@
<div class="layui-col-xs12 layui-col-md3">
<div class="layui-card top-panel">
<div class="layui-card-header">出物料数量</div>
<div class="layui-card-header">物料数量</div>
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
9,054,056
<span th:text="${OutCount}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
比昨天 <a style="color: #1aa094">▲0.12</a><br>
比七日 <a style="color: #bd3004">▼0.06</a>
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
</div>
</div>
</div>
@ -95,11 +98,11 @@
<div class="layui-card-body">
<div class="layui-row layui-col-space5">
<div class="layui-col-xs7 layui-col-md7 top-panel-number">
9,054,056
<span th:text="${OutPrice}"></span>
</div>
<div class="layui-col-xs5 layui-col-md5 top-panel-tips">
比昨天 <a style="color: #1aa094">▲0.12</a><br>
比七日 <a style="color: #bd3004">▼0.06</a>
<!-- 比昨天 <a style="color: #1aa094">▲0.12</a><br>-->
<!-- 比七日 <a style="color: #bd3004">▼0.06</a>-->
</div>
</div>
</div>
@ -111,6 +114,12 @@
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-md9">
<button class="layui-btn" lay-submit lay-filter="thisWeek">
&emsp;本周&emsp;
</button>
<button class="layui-btn" lay-submit lay-filter="lastWeek">
&emsp;上周&emsp;
</button>
<div id="echarts-records" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
</div>
<div class="layui-col-xs12 layui-col-md3">
@ -131,22 +140,23 @@
</div>
<!--</div>-->
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script>
<script>
layui.use(['layer', 'echarts'], function () {
var $ = layui.jquery,
layer = layui.layer,
echarts = layui.echarts;
echarts = layui.echarts,
form = layui.form;
/**
* 报表功能
* 折线图
*/
var echartsRecords = echarts.init(document.getElementById('echarts-records'), 'walden');
var optionRecords = {
title: {
text: '入库仓库-报表图'
text: '仓库总量-报表图'
},
tooltip: {
trigger: 'axis',
@ -158,7 +168,7 @@
}
},
legend: {
data: ['外芯仓库', '义乌仓库', '宁波仓库', '杭州仓库', '北京仓库']
data: []
},
toolbox: {
feature: {
@ -175,7 +185,7 @@
{
type: 'category',
boundaryGap: false,
data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
data: []
}
],
yAxis: [
@ -184,33 +194,6 @@
}
],
series: [
{
name: '外芯仓库',
type: 'line',
stack: '金额',
areaStyle: {},
data: [120, 132, 101, 134, 90, 230, 210]
},
{
name: '义乌仓库',
type: 'line',
areaStyle: {},
data: [220, 182, 191, 234, 290, 330, 310]
},
{
name: '宁波仓库',
type: 'line',
stack: '金额',
areaStyle: {},
data: [150, 232, 201, 154, 190, 330, 410]
},
{
name: '杭州仓库',
type: 'line',
stack: '金额',
areaStyle: {},
data: [320, 332, 301, 334, 390, 330, 320]
},
{
name: '北京仓库',
type: 'line',
@ -222,12 +205,10 @@
}
},
areaStyle: {},
data: [820, 932, 901, 934, 1290, 1330, 1320]
data: []
}
]
};
echartsRecords.setOption(optionRecords);
/**
* 玫瑰图表
@ -271,30 +252,21 @@
}
]
};
echartsPies.setOption(optionPies);
/**
* 柱状图
*/
var echartsDataset = echarts.init(document.getElementById('echarts-dataset'), 'walden');
var optionDataset = {
legend: {},
tooltip: {},
dataset: {
dimensions: ['product', '3月', '4月', '5月'],
source: [
{product: '电子产品类', '3月': 43.3, '4月': 85.8, '5月': 93.7},
{product: '食品类', '3月': 83.1, '4月': 73.4, '5月': 55.1},
{product: '饮品类', '3月': 86.4, '4月': 65.2, '5月': 82.5},
{product: '海产品类', '3月': 72.4, '4月': 53.9, '5月': 39.1}
]
dimensions: [],
source: []
},
xAxis: {type: 'category'},
yAxis: {},
// Declare several bar series, each will be mapped
// to a column of dataset.source by default.
series: [
{type: 'bar'},
{type: 'bar'},
@ -302,15 +274,11 @@
]
};
echartsDataset.setOption(optionDataset);
/**
* 中国地图
*/
var echartsMap = echarts.init(document.getElementById('echarts-map'), 'walden');
var optionMap = {
legend: {},
tooltip: {
@ -318,46 +286,332 @@
showContent: false
},
dataset: {
source: [
['product', '3月', '4月', '5月', '6月', '7月', '8月'],
['电子产品类', 41.1, 30.4, 65.1, 53.3, 83.8, 98.7],
['食品类', 86.5, 92.1, 85.7, 83.1, 73.4, 55.1],
['饮品类', 24.1, 67.2, 79.5, 86.4, 65.2, 82.5],
['海产品类', 55.2, 67.1, 69.2, 72.4, 53.9, 39.1]
]
source: []
},
xAxis: {type: 'category'},
yAxis: {gridIndex: 0},
grid: {top: '55%'},
series: [
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
{type: 'line', smooth: true, seriesLayoutBy: 'row'},
]
};
//动态加载相关数据
$.ajax({
url: '/repository/layui/echart_back?type=2',
type: 'get',
async: true,
dataType: "json",
complete: function (XHR, TS) {
if (XHR.status !== 200) {
layer.alert("系统繁忙,稍后重试");
}
},
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (result) {
layer.close(this.layerIndex);
if (result.code === 0) {
echartsRecords.setOption(optionRecords);
echartsPies.setOption(optionPies);
echartsDataset.setOption(optionDataset);
echartsMap.setOption(optionMap);
// 折线图
var optionRecordsSeries = [];
// 饼状图
var optionPiesSeries = {
name: '昨日占比',
type: 'pie',
radius: '55%',
center: ['50%', '60%'],
roseType: 'radius',
emphasis: {
itemStyle: {
shadowBlur: 10,
shadowOffsetX: 0,
shadowColor: 'rgba(0, 0, 0, 0.5)'
}
},
data: []
}
// 柱状图
optionDataset = {
legend: {},
tooltip: {},
dataset: {
dimensions: [],
source: []
},
series: []
};
for (let i = 0; i < result.data.depository_name.length; i++) {
optionRecordsSeries.push({
name: result.data.depository_name[i],
type: 'line',
stack: '金额',
data: result.data.depository_data.data[result.data.depository_name[i]],
areaStyle: {}
});
optionPiesSeries.data.push({
value: result.data.depository_data.yesterdayData[result.data.depository_name[i]],
name: result.data.depository_name[i]
})
}
var dimensions = result.data.depository_data.sourceList[result.data.depository_data.sourceList.length - 1];
optionDataset.dataset.dimensions = dimensions;
for (let i = result.data.depository_data.sourceList.length - 2; i >= 0; i--) {
optionDataset.dataset.source.push(result.data.depository_data.sourceList[i])
}
for (let i = 0; i < dimensions.length - 1; i++) {
optionDataset.series.push({type: 'bar'})
}
for (let i = 0; i < result.data.depository_data.mapData.mapDataList.length; i++) {
optionMap.dataset.source.push(result.data.depository_data.mapData.mapDataList[i]);
if(i < result.data.depository_data.mapData.mapDataList.length - 1) {
optionMap.series.push({type: 'line', smooth: true, seriesLayoutBy: 'row'});
}
}
var month = new Date().getMonth() + 1;
optionMap.series.push(
{
type: 'pie',
id: 'pie',
// id: 'pie',
radius: '30%',
center: ['50%', '25%'],
label: {
formatter: '{b}: {@3月} ({d}%)'
formatter: '{b}: {@'+month+'月} ({d}%)'
},
encode: {
itemName: 'product',
value: '3月',
tooltip: '3月'
value: month+'月',
tooltip: month+'月'
}
}
]
);
optionRecords = {
title: {
text: '出库仓库-报表图'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: result.data.depository_name
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: result.data.depository_data.week
}
],
yAxis: [
{
type: 'value'
}
],
series: optionRecordsSeries
};
optionPies = {
title: {
text: '仓库分布图',
left: 'center'
},
tooltip: {
trigger: 'item',
formatter: '{a} <br/>{b} : {c} ({d}%)'
},
legend: {
orient: 'vertical',
left: 'left',
data: result.data.depository_name
},
series: optionPiesSeries
};
echartsRecords.setOption(optionRecords);
echartsPies.setOption(optionPies);
echartsDataset.setOption(optionDataset);
echartsMap.setOption(optionMap);
}
}
});
// echarts 窗口缩放自适应
window.onresize = function () {
echartsRecords.resize();
};
// 获取本周
form.on('submit(thisWeek)', function () {
$.ajax({
url: '/repository/layui/echart_back_thisWeek?type=2',
type: 'get',
async: true,
dataType: "json",
complete: function (XHR, TS) {
if (XHR.status != 200) {
layer.alert("系统繁忙,稍后重试");
}
},
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (result) {
layer.close(this.layerIndex);
echartsRecords.setOption(optionRecords);
// 折线图
var optionRecordsSeries = [];
for (let i = 0; i < result.depository_name.length; i++) {
optionRecordsSeries.push({
name: result.depository_name[i],
type: 'line',
stack: '金额',
data: result.data[result.depository_name[i]],
areaStyle: {}
});
}
optionRecords = {
title: {
text: '出库仓库-报表图'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: result.depository_name
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: result.week
}
],
yAxis: [
{
type: 'value'
}
],
series: optionRecordsSeries
};
echartsRecords.setOption(optionRecords);
}
})
})
// 获取上周
form.on('submit(lastWeek)', function () {
$.ajax({
url: '/repository/layui/echart_back_lastWeek?type=2',
type: 'get',
async: true,
dataType: "json",
complete: function (XHR, TS) {
if (XHR.status != 200) {
layer.alert("系统繁忙,稍后重试");
}
},
beforeSend: function () {
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']});
},
success: function (result) {
layer.close(this.layerIndex);
echartsRecords.setOption(optionRecords);
// 折线图
var optionRecordsSeries = [];
for (let i = 0; i < result.depository_name.length; i++) {
optionRecordsSeries.push({
name: result.depository_name[i],
type: 'line',
stack: '金额',
data: result.data[result.depository_name[i]],
areaStyle: {}
});
}
optionRecords = {
title: {
text: '出库仓库-报表图'
},
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'cross',
label: {
backgroundColor: '#6a7985'
}
}
},
legend: {
data: result.depository_name
},
toolbox: {
feature: {
saveAsImage: {}
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
boundaryGap: false,
data: result.week
}
],
yAxis: [
{
type: 'value'
}
],
series: optionRecordsSeries
};
echartsRecords.setOption(optionRecords);
}
})
})
});
</script>

35
src/main/resources/templates/pages/chart/chart-out_back.html

@ -112,31 +112,46 @@
</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-md9">
<div class="layui-collapse" lay-accordion>
<div class="layui-colla-item">
<h2 class="layui-colla-title">折线图</h2>
<div class="layui-colla-content layui-show">
<button class="layui-btn" lay-submit lay-filter="thisWeek">
&emsp;本周&emsp;
</button>
<button class="layui-btn" lay-submit lay-filter="lastWeek">
&emsp;上周&emsp;
</button>
<div id="echarts-records" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
<div id="echarts-records" style="background-color:#ffffff;min-height:1000px;padding: 10px">
</div>
<div class="layui-col-xs12 layui-col-md3">
<div id="echarts-pies" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
</div>
</div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">饼图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-pies" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-md6">
<div id="echarts-dataset" style="background-color:#ffffff;min-height:300px;padding: 10px"></div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">柱状图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-dataset" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
</div>
<div class="layui-col-xs12 layui-col-md6">
<div id="echarts-map" style="background-color:#ffffff;min-height:300px;padding: 10px"></div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">折线比例图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-map" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
</div>
</div>
</div>
<!--</div>-->

35
src/main/resources/templates/pages/chart/chart-stock_back.html

@ -36,29 +36,44 @@
<!--<div class="layuimini-container">-->
<div class="layuimini-main">
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-md9">
<div class="layui-collapse" lay-accordion>
<div class="layui-colla-item">
<h2 class="layui-colla-title">折线图</h2>
<div class="layui-colla-content layui-show">
<button class="layui-btn" lay-submit lay-filter="thisWeek">
&emsp;本周&emsp;
</button>
<button class="layui-btn" lay-submit lay-filter="lastWeek">
&emsp;上周&emsp;
</button>
<div id="echarts-records" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
<div id="echarts-records" style="background-color:#ffffff;min-height:1000px;padding: 10px">
</div>
</div>
<div class="layui-col-xs12 layui-col-md3">
<div id="echarts-pies" style="background-color:#ffffff;min-height:400px;padding: 10px"></div>
</div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">饼图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-pies" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
</div>
<div class="layui-row layui-col-space15">
<div class="layui-col-xs12 layui-col-md6">
<div id="echarts-dataset" style="background-color:#ffffff;min-height:300px;padding: 10px"></div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">柱状图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-dataset" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
<div class="layui-col-xs12 layui-col-md6">
<div id="echarts-map" style="background-color:#ffffff;min-height:300px;padding: 10px"></div>
</div>
<div class="layui-colla-item">
<h2 class="layui-colla-title">折线比例图</h2>
<div class="layui-colla-content layui-show">
<div id="echarts-map" style="background-color:#ffffff;min-height:1000px;padding: 10px"></div>
</div>
</div>
</div>

8
src/main/resources/templates/pages/other/welcome.html

@ -55,7 +55,7 @@
</div>
<div class="panel-content">
<h1 class="no-margins" th:text="${depositoryCount}" >4</h1>
<small>当前分类总记录数</small>
<small>当前仓库总记录数</small>
</div>
</div>
</div>
@ -69,7 +69,7 @@
</div>
<div class="panel-content">
<h1 class="no-margins" th:text="${allPrice}" >12032</h1>
<small>当前分类总记录</small>
<small>当前库存总</small>
</div>
</div>
</div>
@ -83,7 +83,7 @@
</div>
<div class="panel-content">
<h1 class="no-margins" th:text="${allMaterial}"></h1>
<small>当前分类总记录数</small>
<small>当前物料总记录数</small>
</div>
</div>
</div>
@ -97,7 +97,7 @@
</div>
<div class="panel-content">
<h1 class="no-margins" th:text="${warehouseRecord}"></h1>
<small>当前分类总记录数</small>
<small>当前流水总记录数</small>
</div>
</div>
</div>

9
src/test/java/com/dreamchaser/depository_manage/TestForThisWeekInventory.java

@ -1,21 +1,17 @@
package com.dreamchaser.depository_manage;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.controller.PageController;
import com.dreamchaser.depository_manage.entity.Depository;
import com.dreamchaser.depository_manage.entity.MaterialType;
import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.mapper.DepositoryMapper;
import com.dreamchaser.depository_manage.mapper.DepositoryRecordMapper;
import com.dreamchaser.depository_manage.mapper.MaterialTypeMapper;
import com.dreamchaser.depository_manage.mapper.RoleMapper;
import com.dreamchaser.depository_manage.pojo.InventoryByDname;
import com.dreamchaser.depository_manage.pojo.RoleAndDepository;
import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.MaterialTypeService;
import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,7 +20,6 @@ import org.springframework.test.context.junit4.SpringRunner;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.*;
@SpringBootTest
@RunWith(SpringRunner.class)
@ -55,7 +50,7 @@ public class TestForThisWeekInventory {
public void test(){
UserByPort userByPort = PageController.FindUserById(78, null);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(78, null);
Map<String, Object> beforeInventoryOnMap = getThisWeekInventoryByDName(depositoryService, depositoryRecordService, userByPort);
System.out.println(JSONObject.toJSONString(beforeInventoryOnMap));

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

@ -1,14 +1,12 @@
package com.dreamchaser.depository_manage;
import com.dreamchaser.depository_manage.controller.DepositoryController;
import com.dreamchaser.depository_manage.controller.PageController;
import com.dreamchaser.depository_manage.entity.MaterialType;
import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.MaterialTypeService;
import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.ObjectFormatUtil;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@ -33,7 +31,7 @@ public class TestForgetMapData {
@Test
public void Test(){
UserByPort userByPort = PageController.FindUserById(78, null);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(78, null);
Map<String, Integer> depositoryAllNameAndId = depositoryService.findDepositoryAllNameAndId(userByPort);
Iterator it = depositoryAllNameAndId.keySet().iterator();
List<String> depositoryName = new ArrayList<>();

7
src/test/java/com/dreamchaser/depository_manage/TestForgetShowData.java

@ -1,9 +1,6 @@
package com.dreamchaser.depository_manage;
import com.alibaba.fastjson.JSONObject;
import com.dreamchaser.depository_manage.controller.DepositoryController;
import com.dreamchaser.depository_manage.controller.PageController;
import com.dreamchaser.depository_manage.entity.MaterialType;
import com.dreamchaser.depository_manage.entity.UserByPort;
import com.dreamchaser.depository_manage.mapper.DepositoryMapper;
import com.dreamchaser.depository_manage.mapper.DepositoryRecordMapper;
@ -13,8 +10,8 @@ import com.dreamchaser.depository_manage.service.DepositoryRecordService;
import com.dreamchaser.depository_manage.service.DepositoryService;
import com.dreamchaser.depository_manage.service.MaterialTypeService;
import com.dreamchaser.depository_manage.utils.DateUtil;
import com.dreamchaser.depository_manage.utils.LinkInterfaceUtil;
import lombok.Data;
import org.apache.xmlbeans.impl.jam.mutable.MPackage;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@ -53,7 +50,7 @@ public class TestForgetShowData {
@Test
public void Test() {
UserByPort userByPort = PageController.FindUserById(78, null);
UserByPort userByPort = LinkInterfaceUtil.FindUserById(78, null);
Map<String,Integer> yesterdayData = new HashMap<>();
List<String> depositoryName = new ArrayList<>();
Map<String, Object> showData = getShowData("1", userByPort, yesterdayData, depositoryName);

Loading…
Cancel
Save