From caac62f1f080ee8db3aba698f7f67ce105ad9ffe Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期一, 09 十月 2023 13:30:58 +0800
Subject: [PATCH] #核价相关
---
src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java | 63 +++++++++++++++++++++++--------
1 files changed, 47 insertions(+), 16 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 b438822..7674537 100644
--- a/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java
+++ b/src/main/java/com/zy/crm/manager/controller/PriOnline2Controller.java
@@ -146,6 +146,9 @@
//涓氬姟鍛�
// Item item = itemService.selectById(priOnline.getItemId());
Plan plan = planService.selectById(priOnline2.getItemId());
+ if (plan.getStatus()!=1){
+ return R.error("姝よ鍒掑崟鐘舵�佹敼鍙橈紝璇峰埛鏂伴〉闈㈤噸鏂伴�夋嫨锛�");
+ }
priOnline2.setMemberId(plan.getUserId());
Cstmr cstmr = cstmrService.selectById(plan.getCstmrId());
@@ -153,16 +156,23 @@
priOnline2.setSettle(0);
- User manager = userService.getDeptManager(getHostId(), getUser().getDeptId()); // 鑾峰彇閮ㄩ棬棰嗗
+ User manager = new User();
+ try{
+ manager = userService.getDeptManager(getHostId(), getUser().getDeptId()); // 鑾峰彇閮ㄩ棬棰嗗
+ }catch (Exception e){
+ manager = getUser();
+ }
+ User userUp = userService.selectById(plan.getUserId()); // 鑾峰彇涓氬姟鍛�
List<String> initNames = new ArrayList<>();
- initNames.add("鍒涘缓鏍镐环鍗曟ā鏉�");
- initNames.add("鎻愪氦鏍镐环");
- initNames.add("閮ㄩ棬缁忕悊瀹℃牳");
+ initNames.add("鎺ュ彇鏍镐环浠诲姟");
+ initNames.add("瀹屾垚鏍镐环");
+ initNames.add("缁忕悊瀹℃牳");
initNames.add("涓氬姟鍛樼‘璁�");
- priOnline2.setSettleMsg(JSON.toJSONString(SettleDto.initSalesPricing(manager,getUser(),initNames,3)));
+ priOnline2.setSettleMsg(JSON.toJSONString(SettleDto.initSalesPricing(manager,getUser(),userUp,initNames,3)));
//璁剧疆椤圭洰娴佺▼
plan.setStep(2);
+ plan.setStatus(2);
planService.updateById(plan);
priOnline2Service.insert(priOnline2);
@@ -303,17 +313,28 @@
@RequestMapping(value = "/priOnline2/delete/auth")
@ManagerAuth(memo = "鍒犻櫎鏍镐环绠$悊")
public R delete(Long[] ids){
- if (Cools.isEmpty(ids)){
- return R.error();
- }
- for (Long id : ids){
- int priSales = priSalesService.selectCount(new EntityWrapper<PriSales>().eq("pri_online2_id", id));
- if (priSales!=0){
- return R.error("瀛樺湪鍏宠仈鐨勪骇鍝佽垂鐢ㄦ槑缁嗭紝绂佹鍒犻櫎锛侊紒锛�");
+ try{
+ if (Cools.isEmpty(ids) || ids.length==0){
+ return R.error();
}
+ for (Long id : ids){
+ int priSales = priSalesService.selectCount(new EntityWrapper<PriSales>().eq("pri_online2_id", id));
+ if (priSales!=0){
+ return R.error("瀛樺湪鍏宠仈鐨勪骇鍝佽垂鐢ㄦ槑缁嗭紝绂佹鍒犻櫎锛侊紒锛�");
+ }
+ }
+ for (Long id : ids) {
+ PriOnline2 priOnline2 = priOnline2Service.selectById(id);
+ Plan plan = planService.selectById(priOnline2.getItemId());
+ plan.setStatus(1);
+ planService.updateById(plan);
+ }
+
+ priOnline2Service.deleteBatchIds(Arrays.asList(ids));
+ return R.ok();
+ }catch (Exception e){
+ return R.error(e.getMessage());
}
- priOnline2Service.deleteBatchIds(Arrays.asList(ids));
- return R.ok();
}
@RequestMapping(value = "/priOnline2/export/auth")
@@ -374,7 +395,12 @@
switch (priOnline2.getSettle()) {
case 0:
User user2 = userService.selectById(priOnline2.getUserId());
- User manager1 = userService.getDeptManager(getHostId(), user2.getDeptId());
+ User manager1 = new User();
+ try{
+ manager1 = userService.getDeptManager(getHostId(), user2.getDeptId()); // 鑾峰彇閮ㄩ棬棰嗗
+ }catch (Exception e){
+ manager1 = user2;
+ }
if (Cools.isEmpty(getUser())) {
return R.error("鎶辨瓑锛屾偍娌℃湁鎻愪氦鐨勬潈闄�");
@@ -412,7 +438,12 @@
case 1:
// 鏈儴闂ㄧ粡鐞嗗鏍�
User user = userService.selectById(priOnline2.getUserId());
- User manager = userService.getDeptManager(getHostId(), user.getDeptId());
+ User manager = new User();
+ try{
+ manager = userService.getDeptManager(getHostId(), getUser().getDeptId()); // 鑾峰彇閮ㄩ棬棰嗗
+ }catch (Exception e){
+ manager = user;
+ }
if (manager.getId().equals(getUserId())) {
// 淇敼 settle 姝ラ鏁版嵁
--
Gitblit v1.9.1