From af1e1d14318a6354819108b84205a15f21380748 Mon Sep 17 00:00:00 2001 From: LSH Date: 星期五, 24 十一月 2023 15:12:58 +0800 Subject: [PATCH] # --- src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java | 68 ++++++++++++++++++++++++++++++--- 1 files changed, 61 insertions(+), 7 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 ddc1a0a..f7ba377 100644 --- a/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java +++ b/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java @@ -12,6 +12,7 @@ import com.core.common.R; import com.core.domain.KeyValueVo; import com.core.exception.CoolException; +import com.zy.crm.common.entity.PhoneCodeTypeParam; import com.zy.crm.common.model.SettleDto; import com.zy.crm.common.web.BaseController; import com.zy.crm.manager.entity.*; @@ -57,6 +58,12 @@ @Autowired private UserService userService; + @Autowired + private PriOnline2FollService priOnline2FollService; + + @Autowired + private SmsCodeService smsCodeService; + String PZH = " 鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�� "; @RequestMapping(value = "/priOnline2/{id}/auth") @@ -86,12 +93,22 @@ @RequestParam(defaultValue = "10") Integer limit, @RequestParam(required = false) String orderByField, @RequestParam(required = false) String orderByType, + @RequestParam(required = false) String allSwitch, @RequestParam(required = false) String condition, - @RequestParam Map<String, Object> param) { + @RequestParam Map<String, Object> paramSou) { EntityWrapper<PriOnline2> wrapper = new EntityWrapper<>(); wrapper.setSqlSelect("id,title,create_time as createTime,assistant_plan_id as assistantPlanId,host_plan_id as hostPlanId,assistant_host_sign as assistantHostSign,filepath,settle,settle_size as settleSize,item_id as itemId,order_num as orderNum,template_name as templateName,user_id as userId,dept_id as deptId,status,update_time as updateTime,check_data as checkData,update_user_id as updateUserId,member_id as memberId"); // wrapper.in("member_id", getUserRoleBelongsToUserId("allopen")); - excludeTrash(param); + excludeTrash(paramSou); + Map<String, Object> param = convertallSwitch(paramSou); + + if (!Cools.isEmpty(allSwitch)){ + List<PriOnline2> priOnline2List = priOnline2Service.listByAll(getUserId()); + Page<PriOnline2> page1 = new Page<PriOnline2>(curr, limit).setRecords(priOnline2List); + page1.setTotal(priOnline2Service.listByAllTotal(getUserId())); + return R.ok(page1); + } + convert(param, wrapper); allLike(PriOnline2.class, param.keySet(), wrapper, condition); wrapper.or().eq("member_id", getUserId()); @@ -101,6 +118,14 @@ return R.ok(priOnline2Service.selectPage(new Page<>(curr, limit), wrapper)); } + private Map<String, Object> convertallSwitch(Map<String, Object> map) { + for (Map.Entry<String, Object> entry : map.entrySet()) { + if (entry.getKey().equals("allSwitch")) { + map.remove("allSwitch"); + } + } + return map; + } private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { boolean signUserId = false; boolean signDeptId = false; @@ -225,7 +250,10 @@ User userUp = userService.selectById(plan.getUserId()); priOnline2.setAssistantHostSign(plan.getAssistantHostSign()); priOnline2.setAssistantPlanId(plan.getAssistantPlanId()); - priOnline2.setHostPlanId(plan.getHostPlanId()); + priOnline2.setHostPlanId(plan.getId()); + if (plan.getAssistantHostSign()==1){ + priOnline2.setHostPlanId(plan.getHostPlanId()); + } //涓氬姟鍛� @@ -246,7 +274,7 @@ priOnline2.setMemberId(getUserId()); Cstmr cstmr = cstmrService.selectById(plan.getCstmrId()); - priOnline2.setTemplateName(cstmr.getName()); //鐢叉柟鍗曚綅鍚嶇О + priOnline2.setTemplateName(cstmr.getName()); //瀹㈡埛淇℃伅鍚嶇О priOnline2.setSettle(0); @@ -283,6 +311,19 @@ planService.updateById(plan); priOnline2Service.insert(priOnline2); + + // 鑷姩娣诲姞璺熻繘浜� + for (User user:users){ + List<PriOnline2Foll> priOnline2Folls = priOnline2FollService.selectList(new EntityWrapper<PriOnline2Foll>().eq("pri_online2_id", priOnline2.getId()).eq("user_id", user.getId())); + if (Cools.isEmpty(priOnline2Folls) || priOnline2Folls.size()==0){ + PriOnline2Foll priOnline2Foll = new PriOnline2Foll(); + priOnline2Foll.setPriOnline2Id(priOnline2.getId()); + priOnline2Foll.setUserId(user.getId()); + if (!priOnline2FollService.insert(priOnline2Foll)) { + throw new CoolException("淇濆瓨澶辫触锛岃閲嶈瘯"); + } + } + } if (plan.getAssistantHostSign()==1){ @@ -635,10 +676,19 @@ if (user.getId().equals(priOnline2.getUserId())) { if (priOnline2.getAssistantHostSign()==0){ + User manager = new User(); + try { + manager = userService.getDeptManager(getHostId(), getUser().getDeptId()); // 鑾峰彇閮ㄩ棬棰嗗 + } catch (Exception e) { + manager = getUser(); + } try { priQuoteAdd(priOnline2.getId(), plannerId); } catch (Exception e) { return R.error("鑷姩鐢熸垚鎶ヤ环鍗曞け璐�"); + } + if (!smsCodeService.sendSmsCodeText(manager.getMobile(), PhoneCodeTypeParam.ALIYUN_M1ABAC630E)) { + return R.ok("瀹℃壒鎴愬姛浣嗙煭淇″彂閫佸け璐�!"); } }else { try { @@ -649,7 +699,11 @@ return R.error("鏇存柊涓昏〃澶辫触"); } } - + }else { + User phoneUser = userService.selectById(nextUserId); + if (!smsCodeService.sendSmsCodeText(phoneUser.getMobile(), PhoneCodeTypeParam.ALIYUN_M1ABAC630E)) { + return R.ok("瀹℃壒鎴愬姛浣嗙煭淇″彂閫佸け璐�!"); + } } return R.ok("瀹℃壒鎴愬姛"); @@ -716,8 +770,8 @@ @ManagerAuth public R priOnline2priQuoteAdd(@RequestParam Long planId) { List<KeyValueVo> vos = new ArrayList<>(); - vos.add(new KeyValueVo("鎶ヤ环妯℃澘1", 1L)); - vos.add(new KeyValueVo("鎶ヤ环妯℃澘2", 2L)); + vos.add(new KeyValueVo("璐ф灦妯℃澘", 1L)); + vos.add(new KeyValueVo("闆嗘垚妯℃澘", 2L)); return R.ok().add(vos); } -- Gitblit v1.9.1