From 197dd8160fb3c1270e2d11b14eabd8e55c35ef70 Mon Sep 17 00:00:00 2001 From: LSH Date: 星期二, 10 十月 2023 17:02:18 +0800 Subject: [PATCH] # --- src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java | 123 +++++++++++++++++++++++++++++++--------- 1 files changed, 94 insertions(+), 29 deletions(-) diff --git a/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java b/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java index 42d337b..b140a93 100644 --- a/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java +++ b/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java @@ -56,6 +56,8 @@ @Autowired private UserService userService; + String PZH=" 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�� "; + @RequestMapping(value = "/priOnline2/{id}/auth") @ManagerAuth public R get(@PathVariable("id") String id) { @@ -144,24 +146,28 @@ priOnline2.setItemId(Long.parseLong(map.get("itemId").toString())); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); priOnline2.setOrderNum(format.format(new Date())); - //鍒涘缓浜哄憳 - priOnline2.setUserId(getUserId()); - //鍒涘缓浜哄憳閮ㄩ棬 - priOnline2.setDeptId(getDeptId()); - //鏇存柊鏃堕棿 - priOnline2.setUpdateTime(new Date()); - //鏇存柊浜哄憳 - priOnline2.setUpdateUserId(getUserId()); - //鐘舵�侊紝鏈畬鎴� - priOnline2.setStatus(0); //涓氬姟鍛� // Item item = itemService.selectById(priOnline.getItemId()); Plan plan = planService.selectById(priOnline2.getItemId()); + User userUp = userService.selectById(plan.getUserId()); + + //涓氬姟鍛� + priOnline2.setUserId(userUp.getId()); + //涓氬姟鍛橀儴闂� + priOnline2.setDeptId(userUp.getDeptId()); + //鏇存柊浜哄憳 + priOnline2.setUpdateUserId(getUserId()); + //鏇存柊鏃堕棿 + priOnline2.setUpdateTime(new Date()); + + //鐘舵�侊紝鏈畬鎴� + priOnline2.setStatus(0); + if (plan.getStatus()!=1){ return R.error("姝よ鍒掑崟鐘舵�佹敼鍙橈紝璇峰埛鏂伴〉闈㈤噸鏂伴�夋嫨锛�"); } - priOnline2.setMemberId(plan.getUserId()); + priOnline2.setMemberId(getUserId()); Cstmr cstmr = cstmrService.selectById(plan.getCstmrId()); priOnline2.setTemplateName(cstmr.getName()); //鐢叉柟鍗曚綅鍚嶇О @@ -179,10 +185,10 @@ PlanType planType = planTypeService.selectById(plan.getPlanType()); node = node+planType.getType(); - ProcessPermissions processPermissions = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 5).eq("process", node));//2锛氭姤浠锋祦绋� - User manager = userService.selectById(processPermissions.getUserId()); // 鑾峰彇鎶ヤ环娴佺▼鑺傜偣2纭浜� + ProcessPermissions processPermissions = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 5).eq("process", node));//2锛氭牳浠锋祦绋� + User manager = userService.selectById(processPermissions.getUserId()); // 鑾峰彇鏍镐环娴佺▼鑺傜偣2纭浜� - User userUp = userService.selectById(plan.getUserId()); // 鑾峰彇涓氬姟鍛� + // 鑾峰彇涓氬姟鍛� List<String> initNames = new ArrayList<>(); initNames.add("鎺ュ彇鏍镐环浠诲姟"); initNames.add("瀹屾垚鏍镐环"); @@ -403,7 +409,7 @@ map.put("id", priOnline2.getId()); // map.put("value", priOnline2.getOrderNum() + "/" + priOnline2.getPlanId$() + "/" + priOnline2.getMemberId$()); // map.put("value", priOnline2.getOrderNum() + "/" + priOnline2.getTemplateName()); - map.put("value", priOnline2.getOrderNum() + "/" + priOnline2.getPlanId$() + "/" + priOnline2.getMemberId$() + "/" + priOnline2.getTemplateName()); + map.put("value", priOnline2.getOrderNum() + "/" + priOnline2.getPlanId$() + "/" + priOnline2.getUser$() + "/" + priOnline2.getTemplateName()); result.add(map); } @@ -429,6 +435,48 @@ return R.ok().add(vos); } + @PostMapping(value = "/priOnline2/approvalEnd/auth") + @ManagerAuth(memo = "鎷掔粷鐢宠鍗�") + public R approvalEnd(@RequestParam Long priOnlineId, + @RequestParam(required = false) Long plannerId) { + PriOnline2 priOnline2 = priOnline2Service.selectById(priOnlineId); + Date now = new Date(); + Long memberId = priOnline2.getMemberId(); + User member = userService.selectById(memberId); + if (!member.getId().equals(getUserId())){ + return R.error("鎶辨瓑锛屾偍娌℃湁瀹℃牳鐨勬潈闄�"); + } + List<SettleDto> planDtos = JSON.parseArray(priOnline2.getSettleMsg(), SettleDto.class); + List<SettleDto> planDtoList = new ArrayList<>(); + boolean sign = true; + for (SettleDto dto : planDtos) { + if (dto.getStep().equals(1)){ + priOnline2.setMemberId(dto.getUserId()); + } + if (sign && dto.getUserId().equals(memberId) && priOnline2.getSettle()+1==dto.getStep()){ + if (Cools.isEmpty(dto.getMsg())){ + dto.setMsg(DateUtils.convert(now)+" "+member.getNickname()+"鍥為��瀹℃壒"); + }else { + dto.setMsg(dto.getMsg()+PZH+DateUtils.convert(now)+" "+member.getNickname()+"鍥為��瀹℃壒"); + } + sign = false; + } + if (sign){ + dto.setMsg(dto.getMsg()+PZH+DateUtils.convert(now)+" "+member.getNickname()+"鍥為��瀹℃壒"); + } + + planDtoList.add(dto); + } + priOnline2.setStatus(0); + priOnline2.setSettle(0); + priOnline2.setUpdateUserId(getUserId()); + priOnline2.setUpdateTime(now); + + priOnline2.setSettleMsg(JSON.toJSONString(planDtoList)); + priOnline2Service.updateById(priOnline2); + return R.ok("鍥為��鎴愬姛"); + } + @PostMapping(value = "/priOnline2/approval/auth") @ManagerAuth public R approvalBusinessTrip(@RequestParam Long priOnlineId, @@ -439,16 +487,18 @@ switch (priOnline2.getSettle()) { case 0: // 鏈儴闂ㄧ粡鐞嗗鏍� 鑺傜偣璐熻矗浜� + User user = userService.selectById(priOnline2.getMemberId()); + Plan plan1 = planService.selectById(priOnline2.getItemId()); PlanType planType1 = planTypeService.selectById(plan1.getPlanType()); - ProcessPermissions processPermissions1 = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 5).eq("process", "2-"+planType1.getType()));//2锛氭姤浠锋祦绋� + ProcessPermissions processPermissions1 = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 5).eq("process", "2-"+planType1.getType()));//2锛氭牳浠锋祦绋� User manager1 = userService.selectById(processPermissions1.getUserId()); // 鑾峰彇鎶ヤ环娴佺▼鑺傜偣2纭浜� if (Cools.isEmpty(getUser())) { return R.error("鎶辨瓑锛屾偍娌℃湁鎻愪氦鐨勬潈闄�"); } - if (!getUserId().equals(getUser().getId())) { + if (!getUserId().equals(user.getId())) { return R.error("鎶辨瓑锛屾偍娌℃湁鎻愪氦鐨勬潈闄�"); } // 淇敼 settle 姝ラ鏁版嵁 @@ -460,7 +510,11 @@ break; case 1: dto.setCurr(Boolean.TRUE); - dto.setMsg(getUser().getNickname() + "鎻愪氦瀹屾垚"); + if (Cools.isEmpty(dto.getMsg())){ + dto.setMsg(user.getNickname() + "鎻愪氦瀹屾垚"); + }else { + dto.setMsg(dto.getMsg()+PZH+DateUtils.convert(new Date())+" " + user.getNickname() + "鎻愪氦瀹屾垚"); + } dto.setTime(DateUtils.convert(now)); break; default: @@ -503,7 +557,11 @@ break; case 2: dto.setCurr(Boolean.TRUE); - dto.setMsg(manager.getNickname() + "瀹℃壒閫氳繃"); + if (Cools.isEmpty(dto.getMsg())){ + dto.setMsg(manager.getNickname() + "瀹℃壒閫氳繃"); + }else { + dto.setMsg(dto.getMsg()+PZH+DateUtils.convert(new Date())+" " + manager.getNickname() + "瀹℃壒閫氳繃"); + } dto.setTime(DateUtils.convert(now)); break; default: @@ -515,6 +573,8 @@ // 淇敼瑙勫垝鍗曠姸鎬� priOnline2.setSettle(2); // 鐢宠閫氳繃 priOnline2.setUpdateTime(now); + priOnline2.setUpdateUserId(getUserId()); + priOnline2.setMemberId(plan.getUserId()); if (!priOnline2Service.updateById(priOnline2)) { throw new CoolException("瀹℃牳澶辫触锛岃鑱旂郴绠$悊鍛�"); } @@ -537,7 +597,11 @@ break; case 3: dto.setCurr(Boolean.TRUE); - dto.setMsg("涓氬姟鍛�" + salesman0.getNickname() + "浠ョ‘璁�"); + if (Cools.isEmpty(dto.getMsg())){ + dto.setMsg("涓氬姟鍛�" + salesman0.getNickname() + "瀹℃壒閫氳繃"); + }else { + dto.setMsg(dto.getMsg()+PZH+DateUtils.convert(new Date())+" "+"涓氬姟鍛�" + salesman0.getNickname() + "瀹℃壒閫氳繃"); + } dto.setTime(DateUtils.convert(new Date())); break; default: @@ -549,6 +613,7 @@ priOnline2.setSettle(3); // 瀹℃壒閫氳繃 priOnline2.setStatus(1); priOnline2.setUpdateTime(new Date()); + priOnline2.setUpdateUserId(getUserId()); if (!priOnline2Service.updateById(priOnline2)) { throw new CoolException("纭澶辫触锛岃鑱旂郴绠$悊鍛�"); @@ -585,25 +650,23 @@ priQuote.setOrderNum(priOnline2.getOrderNum()); SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss"); priQuote.setInOrderNum(format.format(new Date())); - - //鍒涘缓浜哄憳 - priQuote.setUserId(getUserId()); + //涓氬姟鍛� + Plan plan = planService.selectById(priQuote.getItemId()); + User userUp = userService.selectById(plan.getUserId()); + //涓氬姟鍛� + priQuote.setUserId(userUp.getId()); //鏇存柊浜哄憳 priQuote.setUpdateUserId(getUserId()); //鎵�灞為儴闂� - priQuote.setDeptId(getDeptId()); + priQuote.setDeptId(userUp.getDeptId()); //鏇存柊鏃堕棿 priQuote.setUpdateTime(new Date()); //妯℃澘 Integer i = priType == 1L ? 1 : 2; priQuote.setTemplate(i.toString()); - //涓氬姟鍛� - Plan plan = planService.selectById(priQuote.getItemId()); - priQuote.setMemberId(plan.getUserId()); - //璁剧疆椤圭洰娴佺▼ - plan.setStep(5); + plan.setStep(3); // priQuote.setForm(JSON.toJSONString(map)); // 鑷畾涔夎〃鍗曞唴瀹� priQuote.setSettle(1); // 1.寮�濮� @@ -613,6 +676,8 @@ }catch (Exception e){ manager = getUser(); } + priQuote.setMemberId(manager.getId()); + ProcessPermissions processPermissions = processPermissionsService.selectOne(new EntityWrapper<ProcessPermissions>().eq("process_memo", 2).eq("process", "3-1"));//2锛氭姤浠锋祦绋� User president = userService.selectById(processPermissions.getUserId()); // 鑾峰彇鎶ヤ环娴佺▼鑺傜偣3-1纭浜� priQuote.setSettleMsg(JSON.toJSONString(SettleDto.initPriQuote(plan, manager,president,getUser()))); -- Gitblit v1.9.1