Jelajahi Sumber

修改商机、线索、拜访计划

zhouyy 4 bulan lalu
induk
melakukan
cf52110c6d

+ 11 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/BusinessOpportunityController.java

@@ -67,6 +67,8 @@ public class BusinessOpportunityController {
     private ActionLogMapper actionLogMapper;
     @Resource
     private BusinessOpportunityService businessOpportunityService;
+    @Autowired
+    private TaskMapper taskMapper;
 
     @RequestMapping("getAll")
     public Object getAll(HttpServletRequest request) {
@@ -193,6 +195,15 @@ public class BusinessOpportunityController {
             for (String id : ids1.split(",")) {
                 ids.add(Integer.parseInt(id));
             }
+            Integer taskCount = taskMapper.selectCount(new LambdaQueryWrapper<Task>()
+                    .ne(Task::getStatus, 2)
+                    .eq(Task::getIsDelete, 0)
+                    .in(Task::getBusinessOpportunityId, ids)
+            );
+            if(null!=taskCount&&taskCount>0){
+                msg.setError("选中商机仍有关联任务,无法删除");
+                return msg;
+            }
             bOservice.isDelete(ids);
             msg.setMsg("操作成功");
         } else {

+ 36 - 4
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/CustomController.java

@@ -6,10 +6,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.management.platform.entity.*;
-import com.management.platform.mapper.CustomMapper;
-import com.management.platform.mapper.SysDictMapper;
-import com.management.platform.mapper.SysFormMapper;
-import com.management.platform.mapper.UserMapper;
+import com.management.platform.mapper.*;
 import com.management.platform.service.ContactsService;
 import com.management.platform.service.CustomService;
 import com.management.platform.service.WxCorpInfoService;
@@ -60,6 +57,12 @@ public class CustomController {
     private WxCorpInfoService wxCorpInfoService;
     @Autowired
     private ContactsService contactsService;
+    @Autowired
+    private TaskMapper taskMapper;
+    @Autowired
+    private BusinessOpportunityMapper businessOpportunityMapper;
+    @Autowired
+    private SalesOrderMapper salesOrderMapper;
 
 
     @RequestMapping("list")
@@ -203,6 +206,35 @@ public class CustomController {
             for (String id : ids1.split(",")) {
                 ids.add(Integer.parseInt(id));
             }
+            //任务
+            Integer taskCount = taskMapper.selectCount(new LambdaQueryWrapper<Task>()
+                            .ne(Task::getStatus,2)
+                            .eq(Task::getIsDelete,0)
+                    .in(Task::getCustomId, ids));
+            if(null!=taskCount&&taskCount>0){
+                msg.setError("选中客户仍有任务,无法删除");
+                return msg;
+            }
+            //商机
+            Integer boCount = businessOpportunityMapper.selectCount(new LambdaQueryWrapper<BusinessOpportunity>()
+                            .eq(BusinessOpportunity::getIsDelete,0)
+                    .in(BusinessOpportunity::getCustomerId, ids)
+            );
+            if(null!=boCount&&boCount>0){
+                msg.setError("选中客户仍有商机,无法删除");
+                return msg;
+            }
+
+            //销售订单
+            Integer salesCount = salesOrderMapper.selectCount(new LambdaQueryWrapper<SalesOrder>()
+                            .eq(SalesOrder::getIsDelete,0)
+                    .in(SalesOrder::getCustomId, ids));
+            if(null!=salesCount&&salesCount>0){
+                msg.setError("选中客户仍有销售订单,无法删除");
+                return msg;
+            }
+
+
             customService.isDelete(ids);
             msg.setMsg("操作成功");
         } else {

+ 4 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/vo/VisitPlanVO.java

@@ -35,6 +35,9 @@ public class VisitPlanVO {
     /**完成状态 0未完成 1已完成*/
     private Integer finishState;
 
-    /**客户电话*/
+    /**客户电话[废弃]*/
     private String telPhone;
+
+    /**公司电话*/
+    private String companyPhone;
 }

+ 2 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/BusinessOpportunityServiceImpl.java

@@ -156,9 +156,11 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
                 // 折后价格
                 discountedPrice = discountedPrice.add(price.multiply(divide));
             }
+            if(0 >= finalPrice.compareTo(new BigDecimal(0))){
             BigDecimal divide = discountedPrice.divide(finalPrice, 2, BigDecimal.ROUND_UP);
             // 整单折扣率
             businessOpportunity.setFinalPrice(divide.multiply(new BigDecimal(100)));
+            }
         }
         businessOpportunity.setBusinessItemProducts(businessItemProducts);
 

+ 3 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/time/VisitPlanTask.java

@@ -11,6 +11,7 @@ import com.management.platform.service.impl.WxCorpInfoServiceImpl;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -35,7 +36,8 @@ public class VisitPlanTask {
     @Resource
     private UserMapper userMapper ;
 
-//    @Scheduled(cron = "0 0/1 * * * *")
+    @Scheduled(cron = "0 0/1 * * * *")
+    //TODO 需还原
     public void checkRemindMessage() {
         Date now = new Date();
         System.out.println("===开始检查该分钟需提醒的访客计划==="+now);

+ 1 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/VisitPlanMapper.xml

@@ -29,7 +29,7 @@
              , vs.visit_time, vs.remark
              , vs.remind_type, case remind_type when -1 then '自定义时间' else sd2.name end as remindTypeName
              ,vs.remind_time, vs.finish_state
-             , vs.create_by,c.tel_phone
+             , vs.create_by,c.tel_phone,c.company_phone
         from visit_plan vs
                  left join user u on vs.incharger_id = u.id
                  left join (select * from sys_dict where code = 'VisitGoal') sd1 on vs.visit_goal = sd1.id