From 30350cae29ec19082a9810080e32fcddd4d9df17 Mon Sep 17 00:00:00 2001 From: lsh <lsh@163.com> Date: 星期五, 19 四月 2024 14:26:54 +0800 Subject: [PATCH] # --- src/main/java/com/zy/crm/manager/controller/CstmrController.java | 42 ++++++++++++++++++++++-------------------- 1 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/main/java/com/zy/crm/manager/controller/CstmrController.java b/src/main/java/com/zy/crm/manager/controller/CstmrController.java index 554a0c2..bbe0dd8 100644 --- a/src/main/java/com/zy/crm/manager/controller/CstmrController.java +++ b/src/main/java/com/zy/crm/manager/controller/CstmrController.java @@ -13,14 +13,8 @@ import com.core.exception.CoolException; import com.zy.crm.common.web.BaseController; import com.zy.crm.manager.controller.result.FollowerTableVo; -import com.zy.crm.manager.entity.Cstmr; -import com.zy.crm.manager.entity.CstmrFoll; -import com.zy.crm.manager.entity.CstmrType; -import com.zy.crm.manager.entity.Order; -import com.zy.crm.manager.service.CstmrFollService; -import com.zy.crm.manager.service.CstmrService; -import com.zy.crm.manager.service.CstmrTypeService; -import com.zy.crm.manager.service.OrderService; +import com.zy.crm.manager.entity.*; +import com.zy.crm.manager.service.*; import com.zy.crm.manager.utils.CompanySearchUtils; import com.zy.crm.system.entity.Dept; import com.zy.crm.system.entity.Dic; @@ -55,6 +49,8 @@ private CstmrService cstmrService; @Autowired private CstmrTypeService cstmrTypeService; + @Autowired + private CstmrGradeService cstmrGradeService; @Autowired private DicService dicService; @Autowired @@ -198,7 +194,7 @@ } @RequestMapping(value = "/cstmr/add/auth") - @ManagerAuth(memo = "娣诲姞鐢叉柟鍗曚綅淇℃伅鍏捣") + @ManagerAuth(memo = "娣诲姞瀹㈡埛淇℃伅鍏捣") public R add(Cstmr cstmr) { if (getUser().getRoleId()!=1){ if (!getUser().getNickname().equals("闄堢嚂")){ @@ -232,7 +228,7 @@ } @RequestMapping(value = "/cstmr/add2/auth") - @ManagerAuth(memo = "娣诲姞鐢叉柟鍗曚綅淇℃伅鍏捣") + @ManagerAuth(memo = "娣诲姞瀹㈡埛淇℃伅鍏捣") public R add22(Cstmr cstmr) { Long hostId = getHostId(); if (cstmrService.selectByUuid(hostId, cstmr.getUuid()) != null) { @@ -261,23 +257,23 @@ } @RequestMapping(value = "/cstmr2/add/auth") - @ManagerAuth(memo = "鎺ュ彇鐢叉柟鍗曚綅") + @ManagerAuth(memo = "鎺ュ彇瀹㈡埛淇℃伅") public R add2(Cstmr cstmr) { Cstmr cstmr1 = cstmrService.selectByName(getHostId(),cstmr.getName()); if (Cools.isEmpty(cstmr1) || cstmr1.getDirector()!=null){ - return R.error("浣犳棤娉曟帴鍙栨鐢叉柟鍗曚綅!"); + return R.error("浣犳棤娉曟帴鍙栨瀹㈡埛淇℃伅!"); } cstmr1.setDirector(getUserId()); - cstmr.setDeptId(getDeptId()); // 鎵�灞為儴闂� - cstmr.setUserId(getUserId()); // 鎵�灞炰汉鍛� - cstmr.setUpdateBy(getUserId()); - cstmr.setUpdateTime(new Date()); + cstmr1.setDeptId(getDeptId()); // 鎵�灞為儴闂� + cstmr1.setUserId(getUserId()); // 鎵�灞炰汉鍛� + cstmr1.setUpdateBy(getUserId()); + cstmr1.setUpdateTime(new Date()); cstmrService.updateById(cstmr1); return R.ok(); } @RequestMapping(value = "/cstmr/update/auth") - @ManagerAuth(memo = "鏇存柊鐢叉柟鍗曚綅") + @ManagerAuth(memo = "鏇存柊瀹㈡埛淇℃伅") public R update(Cstmr cstmr){ if (Cools.isEmpty(cstmr) || null==cstmr.getId()){ return R.error(); @@ -294,7 +290,7 @@ } @RequestMapping(value = "/cstmr/delete/auth") - @ManagerAuth(memo = "鍒犻櫎鐢叉柟鍗曚綅") + @ManagerAuth(memo = "鍒犻櫎瀹㈡埛淇℃伅") public R delete(@RequestParam(value="ids[]") Long[] ids){ for (Long id : ids){ int order = orderService.selectCount(new EntityWrapper<Order>().eq("cstmr_id", id)); @@ -307,7 +303,7 @@ } @RequestMapping(value = "/cstmr/delete/one/{id}") - @ManagerAuth(memo = "鍒犻櫎鐢叉柟鍗曚綅") + @ManagerAuth(memo = "鍒犻櫎瀹㈡埛淇℃伅") public R deleteOne(@PathVariable Long id) { int cstmr_id = orderService.selectCount(new EntityWrapper<Order>().eq("cstmr_id", id)); if (cstmr_id!=0){ @@ -357,7 +353,7 @@ * excel瀵煎叆 */ @PostMapping(value = "/cstmr/excel/import/auth") - @ManagerAuth(memo = "鐢叉柟鍗曚綅Excel瀵煎叆") + @ManagerAuth(memo = "瀹㈡埛淇℃伅Excel瀵煎叆") // @Transactional public R cstmrExcelImport(MultipartFile file) throws IOException { InputStream inStream = file.getInputStream(); @@ -411,6 +407,12 @@ throw new CoolException("绗�" + i + "琛屽鎴风被鍒笉鍚堟硶锛岃閲嶆柊瀵煎叆"); } cstmr.setCstmrType(cstmrType.getId()); + + CstmrGrade cstmrGrade = cstmrGradeService.selectByName(hostId, type); + if (null == cstmrGrade) { + throw new CoolException("绗�" + i + "琛屽鎴风瓑绾т笉鍚堟硶锛岃閲嶆柊瀵煎叆"); + } + cstmr.setCstmrGrade(cstmrGrade.getId()); // 瀹㈡埛鍏崇郴 cstmr.setRela(dataFormatter.formatCellValue(row.getCell(3))); // 鐢佃瘽 -- Gitblit v1.9.1