Guo1B0 1 year ago
parent
commit
3cff794919

+ 49 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ClueController.java

@@ -1,10 +1,18 @@
 package com.management.platform.controller;
 
 
+import com.management.platform.entity.Clue;
+import com.management.platform.service.ClueService;
+import com.management.platform.util.HttpRespMsg;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
+import java.util.List;
+
 /**
  * <p>
  *  前端控制器
@@ -16,6 +24,47 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/clue")
 public class ClueController {
+    @Resource
+    private ClueService clueService;
+
+//    @RequestMapping("listClue")
+//    public Object list(@RequestBody Clue clue){
+//        clueService.getList(clue);
+//        return
+//    }
+    @RequestMapping("/inserANdUpdate")
+    public Object inserANdUpdate(@RequestBody Clue clue){
+        HttpRespMsg msg = new HttpRespMsg();
+        //操作前校验
+        if (null == clue.getClueName() || "" == clue.getClueName()){
+            msg.setError("线索名称不能为空");
+            return msg;
+        }
+        if (null == clue.getClueSourceId()){
+            msg.setError("线索来源不能为空");
+            return msg;
+        }
+        clue.setIsDelete(0);
+        if (null != clue.getId()){
+            //修改
+            clueService.update(clue);
+            msg.setMsg("操作成功");
+        }else {
+            //新增
+            clueService.insert(clue);
+            msg.setMsg("操作成功");
+        }
+        return  msg;
+    }
+
+
+    @RequestMapping("delete")
+    public Object delete(@RequestBody List<Integer> ids){
+        HttpRespMsg msg = new HttpRespMsg();
+        msg.setMsg("操作成功");
+        clueService.isDelete(ids);
+        return msg;
+    }
 
 }
 

+ 18 - 4
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/Clue.java

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
 import java.io.Serializable;
+import java.util.Date;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -46,10 +48,15 @@ public class Clue extends Model<Clue> {
     private Integer clueSourceId;
 
     /**
-     * 联系方式
+     * 电话
+     */
+    @TableField("phone")
+    private String phone;
+    /**
+     * 邮箱
      */
-    @TableField("contact_information")
-    private String contactInformation;
+    @TableField("email")
+    private String email;
 
     /**
      * 客户行业
@@ -69,11 +76,12 @@ public class Clue extends Model<Clue> {
     @TableField("address")
     private String address;
 
+
     /**
      * 负责人id
      */
     @TableField("incharger_id")
-    private String inchargerId;
+    private Integer inchargerId;
 
     /**
      * 备注
@@ -117,6 +125,12 @@ public class Clue extends Model<Clue> {
     @TableField("plate5")
     private String plate5;
 
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
 
     @Override
     protected Serializable pkVal() {

+ 6 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ClueService.java

@@ -3,6 +3,8 @@ package com.management.platform.service;
 import com.management.platform.entity.Clue;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  *  服务类
@@ -13,4 +15,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ClueService extends IService<Clue> {
 
+    void insert(Clue clue);
+    void update(Clue clue);
+
+    void isDelete(List<Integer> ids);
 }

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

@@ -1,10 +1,19 @@
 package com.management.platform.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.management.platform.entity.Clue;
 import com.management.platform.mapper.ClueMapper;
 import com.management.platform.service.ClueService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.management.platform.service.SysFunctionService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.beans.Transient;
+import java.util.Date;
+import java.util.List;
 
 /**
  * <p>
@@ -17,4 +26,53 @@ import org.springframework.stereotype.Service;
 @Service
 public class ClueServiceImpl extends ServiceImpl<ClueMapper, Clue> implements ClueService {
 
+    @Autowired
+    private SysFunctionService sysFunctionService;
+    @Autowired
+    private ClueMapper clueMapper;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void insert(Clue clue) {
+        setNull(clue);
+        clue.setCreateTime(new Date());
+        clueMapper.insert(clue);
+
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void update(Clue clue) {
+        setNull(clue);
+        clueMapper.updateById(clue);
+    }
+
+    private Clue setNull(Clue clue) {
+        if (clue.getPlate1() == ""){
+            clue.setPlate1(null);
+        }
+        if (clue.getPlate2() == ""){
+            clue.setPlate2(null);
+        }
+        if (clue.getPlate3() == ""){
+            clue.setPlate3(null);
+        }
+        if (clue.getPlate4() == ""){
+            clue.setPlate4(null);
+        }
+        if (clue.getPlate5() == ""){
+            clue.setPlate5(null);
+        }
+    return clue;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void isDelete(List<Integer> ids) {
+        UpdateWrapper<Clue> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.in("id", ids);
+        Clue clue = new Clue();
+        clue.setIsDelete(1);
+        clueMapper.update(clue, updateWrapper);
+    }
 }

File diff suppressed because it is too large
+ 85730 - 0
fhKeeper/formulahousekeeper/management-crm/workTime.log