zangguocen 4 лет назад
Родитель
Сommit
f11fd56717
19 измененных файлов с 661 добавлено и 78 удалено
  1. 32 0
      yijia-label/pom.xml
  2. 104 0
      yijia-label/src/main/java/com/yijia/label/controller/CustomerLabelController.java
  3. 92 55
      yijia-label/src/main/java/com/yijia/label/controller/LabelRuleController.java
  4. 30 0
      yijia-label/src/main/java/com/yijia/label/controller/LabelRuleDetailController.java
  5. 19 9
      yijia-label/src/main/java/com/yijia/label/domain/CustomerLabel.java
  6. 7 8
      yijia-label/src/main/java/com/yijia/label/domain/LabelRuleDetail.java
  7. 65 0
      yijia-label/src/main/java/com/yijia/label/domain/RequsetSysDept.java
  8. 33 0
      yijia-label/src/main/java/com/yijia/label/domain/RequstCustomerLabel.java
  9. 33 0
      yijia-label/src/main/java/com/yijia/label/domain/ResponeCustomerLabel.java
  10. 9 0
      yijia-label/src/main/java/com/yijia/label/mapper/CustomerLabelMapper.java
  11. 9 0
      yijia-label/src/main/java/com/yijia/label/mapper/LabelRuleDetailMapper.java
  12. 21 0
      yijia-label/src/main/java/com/yijia/label/service/ICustomerLabelService.java
  13. 9 0
      yijia-label/src/main/java/com/yijia/label/service/ILabelRuleDetailService.java
  14. 45 0
      yijia-label/src/main/java/com/yijia/label/service/impl/CustomerLabelServiceImpl.java
  15. 11 0
      yijia-label/src/main/java/com/yijia/label/service/impl/LabelRuleDetailServiceImpl.java
  16. 29 4
      yijia-label/src/main/resources/mapper/label/CustomerLabelMapper.xml
  17. 15 1
      yijia-label/src/main/resources/mapper/label/LabelRuleDetailMapper.xml
  18. 4 1
      yijia-label/src/main/resources/mapper/label/LabelRuleMapper.xml
  19. 94 0
      yijia-label/yijia-label.iml

+ 32 - 0
yijia-label/pom.xml

@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>yijia</artifactId>
+        <groupId>com.yijia</groupId>
+        <version>1.0.1</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>yijia-label</artifactId>
+    <description>营销管理模块</description>
+
+    <dependencies>
+
+        <!-- 通用工具-->
+        <dependency>
+            <groupId>com.yijia</groupId>
+            <artifactId>yijia-common</artifactId>
+        </dependency>
+        <!--定时任务-->
+        <dependency>
+            <groupId>com.yijia</groupId>
+            <artifactId>yijia-quartz</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.yijia</groupId>
+            <artifactId>yijia-system</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

+ 104 - 0
yijia-label/src/main/java/com/yijia/label/controller/CustomerLabelController.java

@@ -4,9 +4,12 @@ import java.util.List;
 
 import com.yijia.common.core.domain.model.LoginUser;
 import com.yijia.common.utils.SecurityUtils;
+import com.yijia.label.domain.RequstCustomerLabel;
+import com.yijia.label.domain.ResponeCustomerLabel;
 import com.yijia.system.service.ISysDeptService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -72,6 +75,69 @@ public class CustomerLabelController extends BaseController
     }
 
     /**
+     * 获取用户标签详细信息
+     */
+    @GetMapping(value = "/selectCustomerLabelInfo")
+    public AjaxResult selectCustomerLabelInfo(CustomerLabel customerLabel)
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        customerLabel.setStationId(currentUser.getUser().getDeptId());
+        ResponeCustomerLabel responeCustomerLabel =new ResponeCustomerLabel();
+        List<CustomerLabel> notlist = customerLabelService.selectNotCustomerLabelInfo(customerLabel);
+        List<String> list = customerLabelService.selectPhoneList(customerLabel);
+        responeCustomerLabel.setNotCustomerLabelList(notlist);
+        responeCustomerLabel.setPhoneList(list);
+        return AjaxResult.success(responeCustomerLabel);
+    }
+
+    /**
+     * 查询没有绑定标签的客户
+     * @param customerLabel
+     * @return
+     */
+    @GetMapping(value = "/selectNotCustomerLabelInfo")
+    public TableDataInfo selectNotCustomerLabelInfo(CustomerLabel customerLabel)
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        customerLabel.setStationId(currentUser.getUser().getDeptId());
+        List<CustomerLabel> notlist = customerLabelService.selectNotCustomerLabelInfo(customerLabel);
+
+        return getDataTable(notlist);
+    }
+
+    /**
+     * 查询以绑定标签的客户信息
+     * @param customerLabel
+     * @return
+     */
+    @GetMapping(value = "/selectPhoneList")
+    public TableDataInfo selectPhoneList(CustomerLabel customerLabel)
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        customerLabel.setStationId(currentUser.getUser().getDeptId());
+        List<String> list = customerLabelService.selectPhoneList(customerLabel);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询标签是否绑定了人
+     * @param customerLabel
+     * @return
+     */
+    @GetMapping(value = "/selectLabel")
+    public AjaxResult selectLabel(CustomerLabel customerLabel)
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        customerLabel.setStationId(currentUser.getUser().getDeptId());
+        List<String> list = customerLabelService.selectPhoneList(customerLabel);
+        boolean flag =true;
+        if(list!=null && list.size()>0){
+            flag=false;
+        }
+        return AjaxResult.success(flag);
+    }
+
+    /**
      * 新增用户标签
      */
     @Log(title = "用户标签", businessType = BusinessType.INSERT)
@@ -97,6 +163,44 @@ public class CustomerLabelController extends BaseController
     }
 
     /**
+     * 修改用户标签
+     */
+    @Log(title = "用户标签", businessType = BusinessType.UPDATE)
+    @PostMapping("/addAndDelCustomerLabel")
+    @Transactional
+    public AjaxResult addCustomerLabel(@RequestBody RequstCustomerLabel requstCustomerLabel)
+    {
+        int i =0;
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        if(requstCustomerLabel!=null && requstCustomerLabel.getFlag()!=null && requstCustomerLabel.getFlag().equals("0")){
+            if(requstCustomerLabel.getPhoneList()!=null && requstCustomerLabel.getPhoneList().size()>0){
+                for(String phone:requstCustomerLabel.getPhoneList()){
+                    CustomerLabel customerLabel =new CustomerLabel();
+                    customerLabel.setStationId(currentUser.getUser().getDeptId());
+                    customerLabel.setDelFlag("0");
+                    customerLabel.setPhone(phone);
+                    customerLabel.setLabelId(requstCustomerLabel.getLabelId());
+                    customerLabel.setCreateBy(currentUser.getUser().getUserId()+"");
+                  i=  customerLabelService.insertCustomerLabel(customerLabel);
+                }
+            }
+        }else if(requstCustomerLabel!=null && requstCustomerLabel.getFlag()!=null && requstCustomerLabel.getFlag().equals("1")){
+            if(requstCustomerLabel.getPhoneList()!=null && requstCustomerLabel.getPhoneList().size()>0){
+                for(String phone:requstCustomerLabel.getPhoneList()){
+                    CustomerLabel customerLabel =new CustomerLabel();
+                    customerLabel.setStationId(currentUser.getUser().getDeptId());
+                    customerLabel.setDelFlag("1");
+                    customerLabel.setPhone(phone);
+                    customerLabel.setLabelId(requstCustomerLabel.getLabelId());
+                    customerLabel.setUpdateBy(currentUser.getUser().getUserId()+"");
+                    i=  customerLabelService.editCustomerLabel(customerLabel);
+                }
+            }
+        }
+        return toAjax(i);
+    }
+
+    /**
      * 删除用户标签
      */
     @Log(title = "用户标签", businessType = BusinessType.DELETE)

+ 92 - 55
yijia-label/src/main/java/com/yijia/label/controller/LabelRuleController.java

@@ -1,24 +1,17 @@
 package com.yijia.label.controller;
-
 import java.util.List;
-
 import com.yijia.common.core.domain.entity.SysDept;
 import com.yijia.common.core.domain.model.LoginUser;
 import com.yijia.common.utils.DateUtils;
 import com.yijia.common.utils.SecurityUtils;
-import com.yijia.common.utils.bean.BeanUtils;
-import com.yijia.station.domain.SysDeptDemo;
+import com.yijia.label.domain.LabelRuleDetail;
+import com.yijia.label.domain.RequsetSysDept;
+import com.yijia.label.service.ILabelRuleDetailService;
 import com.yijia.system.service.ISysDeptService;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.yijia.common.annotation.Log;
 import com.yijia.common.core.controller.BaseController;
 import com.yijia.common.core.domain.AjaxResult;
@@ -44,12 +37,18 @@ public class LabelRuleController extends BaseController
 
     @Autowired
     private ISysDeptService deptService;
+
+    @Autowired
+    private ILabelRuleDetailService labelRuleDetailService;
     /**
      * 查询标签规则列表
      */
     @GetMapping("/list")
     public TableDataInfo list(LabelRule labelRule)
     {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        labelRule.setStationId(currentUser.getUser().getDeptId());
+        labelRule.setDelFlag("0");
         startPage();
         List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
         return getDataTable(list);
@@ -76,51 +75,89 @@ public class LabelRuleController extends BaseController
         return AjaxResult.success(labelRuleService.selectLabelRuleById(id));
     }
 
-//    @GetMapping("/sysDeptDemoList")
-//    public AjaxResult sysDeptDemoList()
-//    {
-//        LoginUser currentUser = SecurityUtils.getLoginUser();
-//        SysDeptDemo sysDeptDemo = new SysDeptDemo();
-//        SysDept dept = deptService.selectDeptById(currentUser.getUser().getDeptId());
-//        BeanUtils.copyProperties(sysDeptDemo, dept);
-//        LabelRule labelRule =new LabelRule();
-//        labelRule.setStationId(currentUser.getUser().getDeptId());
-//        List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
-//        sysDeptDemo.setLabelArr(list);
-//        return AjaxResult.success(sysDeptDemo);
-//    }
     /**
-     * 新增标签规则
+     *标签功能是否开启,标签名
      */
-//    @Log(title = "标签规则", businessType = BusinessType.INSERT)
-//    @PostMapping
-//    @Transactional
-//    public AjaxResult add(@RequestBody SysDeptDemo sysDeptDemo)
-//    {
-//        int i =0;
-//        LoginUser currentUser = SecurityUtils.getLoginUser();
-//        //根据demo获取添加数据
-//        if(sysDeptDemo!=null){
-//            SysDept dept =new SysDept();
-//            dept.setDeptId(sysDeptDemo.getDeptId());
-//            dept.setLabelFlag(sysDeptDemo.getLabelFlag());
-//            dept.setUpdateBy(currentUser.getUser().getUserId()+"");
-//            dept.setUpdateTime(DateUtils.getNowDate());
-//            i =  deptService.updateDeptInfo(dept);
-//            if(sysDeptDemo.getLabelArr()!=null && sysDeptDemo.getLabelArr().size()>0){
-//                for(LabelRule labelRule : sysDeptDemo.getLabelArr()) {
-//                    if(labelRule.getId()!=null){
-//                        labelRule.setUpdateBy(currentUser.getUser().getUserId()+"");
-//                        i=labelRuleService.updateLabelRule(labelRule);
-//                    }else{
-//                        labelRule.setCreateBy(currentUser.getUser().getUserId()+"");
-//                        i=labelRuleService.insertLabelRule(labelRule);
-//                    }
-//                }
-//            }
-//        }
-//        return toAjax(i);
-//    }
+
+    @GetMapping("/sysDeptDemoList")
+    public AjaxResult sysDeptDemoList()
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        SysDept dept = deptService.selectDeptById(currentUser.getUser().getDeptId());
+        RequsetSysDept requsetSysDept = new RequsetSysDept();
+        BeanUtils.copyProperties(dept,requsetSysDept);
+        LabelRule labelRule =new LabelRule();
+        labelRule.setStationId(currentUser.getUser().getDeptId());
+        labelRule.setDelFlag("0");
+        List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
+        requsetSysDept.setLabelArr(list);
+        return AjaxResult.success(requsetSysDept);
+    }
+
+    @GetMapping("/selectLabelList")
+    public AjaxResult selectLabelList()
+    {
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        SysDept dept = deptService.selectDeptById(currentUser.getUser().getDeptId());
+        RequsetSysDept requsetSysDept = new RequsetSysDept();
+        BeanUtils.copyProperties(dept,requsetSysDept);
+        if(requsetSysDept!=null && requsetSysDept.getLabelFlag()!=null && requsetSysDept.getLabelFlag().equals("1")){
+            LabelRule labelRule =new LabelRule();
+            labelRule.setStationId(currentUser.getUser().getDeptId());
+            labelRule.setDelFlag("0");
+            startPage();
+            List<LabelRule> list = labelRuleService.selectLabelRuleList(labelRule);
+            if(list!=null && list.size()>0){
+                for(LabelRule rule:list){
+                    LabelRuleDetail detail =new LabelRuleDetail();
+                    detail.setParentId(rule.getId());
+                    detail.setDelFlag("0");
+                    List<LabelRuleDetail> labelRuleDetailList = labelRuleDetailService.selectLabelRuleDetailList(detail);
+                    if(labelRuleDetailList!=null && labelRuleDetailList.size()>0){
+                        rule.setLabelRuleDetailList(labelRuleDetailList);
+                    }
+                }
+            }
+            requsetSysDept.setLabelArr(list);
+        }
+        return AjaxResult.success(requsetSysDept);
+    }
+    @Log(title = "标签规则", businessType = BusinessType.INSERT)
+    @PostMapping("/addlabel")
+    @Transactional
+    public AjaxResult addlabel(@RequestBody RequsetSysDept requsetSysDept)
+    {
+        int i =0;
+        LoginUser currentUser = SecurityUtils.getLoginUser();
+        //根据demo获取添加数据
+        if(requsetSysDept!=null){
+            SysDept dept =new SysDept();
+            dept.setDeptId(currentUser.getUser().getDeptId());
+            dept.setLabelFlag(requsetSysDept.getLabelFlag());
+            dept.setUpdateBy(currentUser.getUser().getUserId()+"");
+            dept.setUpdateTime(DateUtils.getNowDate());
+            i =  deptService.updateDeptInfo(dept);
+            if(requsetSysDept.getLabelArr()!=null && requsetSysDept.getLabelArr().size()>0){
+                for(LabelRule labelRule : requsetSysDept.getLabelArr()) {
+                    if(labelRule.getId()!=null){
+                        labelRule.setUpdateBy(currentUser.getUser().getUserId()+"");
+                        i=labelRuleService.updateLabelRule(labelRule);
+                    }else{
+                        labelRule.setStationId(currentUser.getUser().getDeptId());
+                        labelRule.setCreateBy(currentUser.getUser().getUserId()+"");
+                        labelRule.setDelFlag("0");
+                        i=labelRuleService.insertLabelRule(labelRule);
+                    }
+                }
+            }
+            if(requsetSysDept.getDelArr()!=null &&requsetSysDept.getDelArr().size()>0){
+                List<Integer> idlist =requsetSysDept.getDelArr();
+                Integer[] ints = idlist.toArray(new Integer[0]);
+                labelRuleService.deleteLabelRuleByIds(ints);
+            }
+        }
+        return toAjax(i);
+    }
 
     /**
      * 修改标签规则

+ 30 - 0
yijia-label/src/main/java/com/yijia/label/controller/LabelRuleDetailController.java

@@ -3,7 +3,9 @@ package com.yijia.label.controller;
 import java.util.List;
 
 import com.yijia.common.core.domain.model.LoginUser;
+import com.yijia.common.utils.DateUtils;
 import com.yijia.common.utils.SecurityUtils;
+import com.yijia.label.domain.LabelRule;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -47,6 +49,14 @@ public class LabelRuleDetailController extends BaseController
         return getDataTable(list);
     }
 
+    @GetMapping("/detailList")
+    public TableDataInfo detailList(LabelRuleDetail labelRuleDetail)
+    {
+        labelRuleDetail.setDelFlag("0");
+        List<LabelRuleDetail> list = labelRuleDetailService.selectLabelRuleDetailList(labelRuleDetail);
+        return getDataTable(list);
+    }
+
     /**
      * 导出标签规则明细列表
      */
@@ -77,6 +87,7 @@ public class LabelRuleDetailController extends BaseController
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
         labelRuleDetail.setCreateBy(currentUser.getUser().getUserId()+"");
+        labelRuleDetail.setDelFlag("0");
         return toAjax(labelRuleDetailService.insertLabelRuleDetail(labelRuleDetail));
     }
 
@@ -89,9 +100,28 @@ public class LabelRuleDetailController extends BaseController
     {
         LoginUser currentUser = SecurityUtils.getLoginUser();
         labelRuleDetail.setUpdateBy(currentUser.getUser().getUserId()+"");
+        labelRuleDetail.setDelFlag("1");
         return toAjax(labelRuleDetailService.updateLabelRuleDetail(labelRuleDetail));
     }
 
+    @Log(title = "积分商品管理", businessType = BusinessType.UPDATE)
+    @PostMapping(value ="/deleteLabelRuleDetail")
+    public AjaxResult deleteLabelRuleDetail(@RequestBody LabelRuleDetail labelRuleDetail)
+    {
+        int i=0;
+        try {
+            System.out.println("------------------------------------"+labelRuleDetail.getId());
+            LoginUser currentUser = SecurityUtils.getLoginUser();
+            labelRuleDetail.setDelFlag("1");
+            labelRuleDetail.setUpdateBy(currentUser.getUser().getUserId()+"");
+           i= labelRuleDetailService.updateLabelRuleDetail(labelRuleDetail);
+        }catch (Exception e){
+            System.out.println("------------------------------------"+e.getLocalizedMessage()+"");
+            e.printStackTrace();
+        }
+        return toAjax(i);
+
+    }
     /**
      * 删除标签规则明细
      */

+ 19 - 9
yijia-label/src/main/java/com/yijia/label/domain/CustomerLabel.java

@@ -28,12 +28,22 @@ public class CustomerLabel extends BaseEntity
 
     /** 油站id */
     @Excel(name = "油站id")
-    private Integer stationId;
+    private Long stationId;
+
+    private String customerName;
 
     /** 删除 1是 0否 */
     private String delFlag;
 
-    public void setId(Integer id) 
+    public String getCustomerName() {
+        return customerName;
+    }
+
+    public void setCustomerName(String customerName) {
+        this.customerName = customerName;
+    }
+
+    public void setId(Integer id)
     {
         this.id = id;
     }
@@ -60,16 +70,16 @@ public class CustomerLabel extends BaseEntity
     {
         return labelId;
     }
-    public void setStationId(Integer stationId) 
-    {
-        this.stationId = stationId;
-    }
 
-    public Integer getStationId() 
-    {
+    public Long getStationId() {
         return stationId;
     }
-    public void setDelFlag(String delFlag) 
+
+    public void setStationId(Long stationId) {
+        this.stationId = stationId;
+    }
+
+    public void setDelFlag(String delFlag)
     {
         this.delFlag = delFlag;
     }

+ 7 - 8
yijia-label/src/main/java/com/yijia/label/domain/LabelRuleDetail.java

@@ -16,7 +16,7 @@ public class LabelRuleDetail extends BaseEntity
     private static final long serialVersionUID = 1L;
 
     /** 标签规则明细id */
-    private Integer id;
+    private Long id;
 
     /** 标签主表id */
     @Excel(name = "标签主表id")
@@ -41,16 +41,15 @@ public class LabelRuleDetail extends BaseEntity
     /** 删除标识 1是 0 否 */
     private String delFlag;
 
-    public void setId(Integer id) 
-    {
-        this.id = id;
+    public Long getId() {
+        return id;
     }
 
-    public Integer getId() 
-    {
-        return id;
+    public void setId(Long id) {
+        this.id = id;
     }
-    public void setParentId(Integer parentId) 
+
+    public void setParentId(Integer parentId)
     {
         this.parentId = parentId;
     }

+ 65 - 0
yijia-label/src/main/java/com/yijia/label/domain/RequsetSysDept.java

@@ -0,0 +1,65 @@
+package com.yijia.label.domain;
+
+import com.yijia.common.core.domain.BaseEntity;
+import com.yijia.common.core.domain.entity.SysDept;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class RequsetSysDept extends BaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /** 部门ID */
+    private Long deptId;
+    /** 部门名称 */
+    private String deptName;
+    /**
+     * 标签是否启用
+     */
+    private String labelFlag;
+
+    public String getLabelFlag() {
+        return labelFlag;
+    }
+
+    public void setLabelFlag(String labelFlag) {
+        this.labelFlag = labelFlag;
+    }
+
+    private List<LabelRule> labelArr;
+    private List<Integer> delArr;
+
+    public List<Integer> getDelArr() {
+        return delArr;
+    }
+
+    public void setDelArr(List<Integer> delArr) {
+        this.delArr = delArr;
+    }
+
+    public List<LabelRule> getLabelArr() {
+        return labelArr;
+    }
+
+    public void setLabelArr(List<LabelRule> labelArr) {
+        this.labelArr = labelArr;
+    }
+
+    public Long getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(Long deptId) {
+        this.deptId = deptId;
+    }
+
+    public String getDeptName() {
+        return deptName;
+    }
+
+    public void setDeptName(String deptName) {
+        this.deptName = deptName;
+    }
+
+}

+ 33 - 0
yijia-label/src/main/java/com/yijia/label/domain/RequstCustomerLabel.java

@@ -0,0 +1,33 @@
+package com.yijia.label.domain;
+
+import java.util.List;
+
+public class RequstCustomerLabel {
+    private Integer labelId;
+    private List<String> phoneList;
+    private String flag;
+
+    public Integer getLabelId() {
+        return labelId;
+    }
+
+    public void setLabelId(Integer labelId) {
+        this.labelId = labelId;
+    }
+
+    public String getFlag() {
+        return flag;
+    }
+
+    public void setFlag(String flag) {
+        this.flag = flag;
+    }
+
+    public List<String> getPhoneList() {
+        return phoneList;
+    }
+
+    public void setPhoneList(List<String> phoneList) {
+        this.phoneList = phoneList;
+    }
+}

+ 33 - 0
yijia-label/src/main/java/com/yijia/label/domain/ResponeCustomerLabel.java

@@ -0,0 +1,33 @@
+package com.yijia.label.domain;
+
+import java.util.List;
+
+public class ResponeCustomerLabel {
+    private List<CustomerLabel> notCustomerLabelList;
+    private List<CustomerLabel> customerLabelList;
+    private List<String> phoneList;
+
+    public List<String> getPhoneList() {
+        return phoneList;
+    }
+
+    public void setPhoneList(List<String> phoneList) {
+        this.phoneList = phoneList;
+    }
+
+    public List<CustomerLabel> getNotCustomerLabelList() {
+        return notCustomerLabelList;
+    }
+
+    public void setNotCustomerLabelList(List<CustomerLabel> notCustomerLabelList) {
+        this.notCustomerLabelList = notCustomerLabelList;
+    }
+
+    public List<CustomerLabel> getCustomerLabelList() {
+        return customerLabelList;
+    }
+
+    public void setCustomerLabelList(List<CustomerLabel> customerLabelList) {
+        this.customerLabelList = customerLabelList;
+    }
+}

+ 9 - 0
yijia-label/src/main/java/com/yijia/label/mapper/CustomerLabelMapper.java

@@ -58,4 +58,13 @@ public interface CustomerLabelMapper
      * @return 结果
      */
     public int deleteCustomerLabelByIds(Integer[] ids);
+
+    public List<CustomerLabel> selectNotCustomerLabelInfo(CustomerLabel customerLabel);
+
+    /**
+     * 根据手机号和labelId查询唯一的数据
+     * @param labelInfo
+     * @return
+     */
+    public CustomerLabel selectCustomerLabelInfo(CustomerLabel labelInfo);
 }

+ 9 - 0
yijia-label/src/main/java/com/yijia/label/mapper/LabelRuleDetailMapper.java

@@ -1,6 +1,8 @@
 package com.yijia.label.mapper;
 
 import java.util.List;
+
+import com.yijia.label.domain.LabelRule;
 import com.yijia.label.domain.LabelRuleDetail;
 
 /**
@@ -58,4 +60,11 @@ public interface LabelRuleDetailMapper
      * @return 结果
      */
     public int deleteLabelRuleDetailByIds(Integer[] ids);
+
+    /**
+     * 查询规则明细
+     * @param labelRule
+     * @return
+     */
+    public List<LabelRuleDetail> labelRuleDetailList(LabelRule labelRule);
 }

+ 21 - 0
yijia-label/src/main/java/com/yijia/label/service/ICustomerLabelService.java

@@ -2,6 +2,7 @@ package com.yijia.label.service;
 
 import java.util.List;
 import com.yijia.label.domain.CustomerLabel;
+import com.yijia.label.domain.RequstCustomerLabel;
 
 /**
  * 用户标签Service接口
@@ -58,4 +59,24 @@ public interface ICustomerLabelService
      * @return 结果
      */
     public int deleteCustomerLabelById(Integer id);
+
+    /**
+     * 查询没有标签的客户信息
+     * @param customerLabel
+     * @return
+     */
+    public List<CustomerLabel> selectNotCustomerLabelInfo(CustomerLabel customerLabel);
+
+    /**
+     *
+     * @param customerLabel
+     * @return
+     */
+    public int editCustomerLabel(CustomerLabel customerLabel);
+    /**
+     * 查询本标签的客户手机号
+     * @param customerLabel
+     * @return
+     */
+    public List<String> selectPhoneList(CustomerLabel customerLabel);
 }

+ 9 - 0
yijia-label/src/main/java/com/yijia/label/service/ILabelRuleDetailService.java

@@ -1,6 +1,8 @@
 package com.yijia.label.service;
 
 import java.util.List;
+
+import com.yijia.label.domain.LabelRule;
 import com.yijia.label.domain.LabelRuleDetail;
 
 /**
@@ -58,4 +60,11 @@ public interface ILabelRuleDetailService
      * @return 结果
      */
     public int deleteLabelRuleDetailById(Integer id);
+
+    /**
+     * 查询规则明细
+     * @param labelRule
+     * @return
+     */
+    public List<LabelRuleDetail> labelRuleDetailList(LabelRule labelRule);
 }

+ 45 - 0
yijia-label/src/main/java/com/yijia/label/service/impl/CustomerLabelServiceImpl.java

@@ -1,5 +1,6 @@
 package com.yijia.label.service.impl;
 
+import java.util.ArrayList;
 import java.util.List;
 import com.yijia.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -93,4 +94,48 @@ public class CustomerLabelServiceImpl implements ICustomerLabelService
     {
         return customerLabelMapper.deleteCustomerLabelById(id);
     }
+
+    /**
+     * 查询 标签客户信息
+     * @param customerLabel
+     * @return
+     */
+    @Override
+    public List<CustomerLabel> selectNotCustomerLabelInfo(CustomerLabel customerLabel) {
+        return customerLabelMapper.selectNotCustomerLabelInfo(customerLabel);
+    }
+
+    @Override
+    public int editCustomerLabel(CustomerLabel customerLabel) {
+        //先查询再做修改
+        int i =0 ;
+        CustomerLabel labelInfo =new CustomerLabel();
+        labelInfo.setLabelId(customerLabel.getLabelId());
+        labelInfo.setPhone(customerLabel.getPhone());
+        labelInfo.setDelFlag("0");
+        CustomerLabel label =customerLabelMapper.selectCustomerLabelInfo(labelInfo);
+        if(label!=null&& label.getId()!=null){
+            label.setDelFlag("1");
+            label.setUpdateTime(DateUtils.getNowDate());
+            i=customerLabelMapper.updateCustomerLabel(label);
+        }
+        return i;
+    }
+
+    /**
+     * 查询本标签的客户手机号
+     * @param customerLabel
+     * @return
+     */
+    @Override
+    public List<String> selectPhoneList(CustomerLabel customerLabel) {
+        List<CustomerLabel> list= customerLabelMapper.selectCustomerLabelList(customerLabel);
+        List<String> stringList =new ArrayList<>();
+        if(list!=null && list.size()>0){
+            for(CustomerLabel label:list){
+                stringList.add(label.getPhone());
+            }
+        }
+        return stringList;
+    }
 }

+ 11 - 0
yijia-label/src/main/java/com/yijia/label/service/impl/LabelRuleDetailServiceImpl.java

@@ -2,6 +2,7 @@ package com.yijia.label.service.impl;
 
 import java.util.List;
 import com.yijia.common.utils.DateUtils;
+import com.yijia.label.domain.LabelRule;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.yijia.label.mapper.LabelRuleDetailMapper;
@@ -93,4 +94,14 @@ public class LabelRuleDetailServiceImpl implements ILabelRuleDetailService
     {
         return labelRuleDetailMapper.deleteLabelRuleDetailById(id);
     }
+
+    /**
+     * 查询规则明细
+     * @param labelRule
+     * @return
+     */
+    @Override
+    public List<LabelRuleDetail> labelRuleDetailList(LabelRule labelRule) {
+        return labelRuleDetailMapper.labelRuleDetailList(labelRule);
+    }
 }

+ 29 - 4
yijia-label/src/main/resources/mapper/label/CustomerLabelMapper.xml

@@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
         <result property="delFlag"    column="del_flag"    />
+        <result property="customerName"    column="customer_name"    />
     </resultMap>
 
     <sql id="selectCustomerLabelVo">
@@ -22,18 +23,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectCustomerLabelList" parameterType="CustomerLabel" resultMap="CustomerLabelResult">
         <include refid="selectCustomerLabelVo"/>
-        <where>  
-            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
+        <where>
+            <if test="phone != null  and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
             <if test="labelId != null "> and label_id = #{labelId}</if>
             <if test="stationId != null "> and station_id = #{stationId}</if>
         </where>
     </select>
-    
+
+    <select id="selectNotCustomerLabelInfo" parameterType="CustomerLabel" resultMap="CustomerLabelResult">
+        SELECT DISTINCT(phone_number) as phone,customer_name
+        from customer_manage m
+        join app_user_info a on a.mobile_phone =m.phone_number
+        <where>
+            <if test="stationId != null "> and m.station_id = #{stationId}</if>
+            <if test="phone != null  and phone != ''"> and m.phone_number like concat('%', #{phone}, '%')</if>
+        </where>
+        and phone_number  not in
+        ( select phone from customer_label b
+        <where>
+            <if test="labelId != null "> and label_id != #{labelId}</if>
+        </where>  )
+    </select>
     <select id="selectCustomerLabelById" parameterType="Integer" resultMap="CustomerLabelResult">
         <include refid="selectCustomerLabelVo"/>
         where id = #{id}
     </select>
-        
+
+    <select id="selectCustomerLabelInfo" parameterType="CustomerLabel" resultMap="CustomerLabelResult">
+        <include refid="selectCustomerLabelVo"/>
+        <where>
+            <if test="phone != null  and phone != ''"> and phone = #{phone}</if>
+            <if test="labelId != null "> and label_id = #{labelId}</if>
+            <if test="stationId != null "> and station_id = #{stationId}</if>
+        </where>
+         limit 1
+    </select>
+
     <insert id="insertCustomerLabel" parameterType="CustomerLabel" useGeneratedKeys="true" keyProperty="id">
         insert into customer_label
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 15 - 1
yijia-label/src/main/resources/mapper/label/LabelRuleDetailMapper.xml

@@ -19,7 +19,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectLabelRuleDetailVo">
-        select id, parent_id, oil_name, discount_term, discount_liters_amt, discount_amt, create_by, create_time, update_by, update_time, del_flag from label_rule_detail
+        select id, parent_id, oil_name, discount_term, discount_liters_amt, discount_amt, create_by, create_time, update_by, update_time, del_flag
+        from label_rule_detail
     </sql>
 
     <select id="selectLabelRuleDetailList" parameterType="LabelRuleDetail" resultMap="LabelRuleDetailResult">
@@ -30,6 +31,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="discountTerm != null  and discountTerm != ''"> and discount_term = #{discountTerm}</if>
             <if test="discountLitersAmt != null  and discountLitersAmt != ''"> and discount_liters_amt = #{discountLitersAmt}</if>
             <if test="discountAmt != null  and discountAmt != ''"> and discount_amt = #{discountAmt}</if>
+            <if test="delFlag != null  and delFlag != ''"> and del_flag = #{delFlag}</if>
+        </where>
+    </select>
+
+    <select id="labelRuleDetailList" parameterType="LabelRuleDetail" resultMap="LabelRuleDetailResult">
+        select d.*,dept_name as station_name,r.station_id from label_rule r join label_rule_detail d on r.id=d.parent_id
+        join sys_dept p on r.station_id = p.dept_id
+        <where>
+            <if test="parentId != null "> and parent_id = #{parentId}</if>
+            <if test="oilName != null  and oilName != ''"> and oil_name like concat('%', #{oilName}, '%')</if>
+            <if test="discountTerm != null  and discountTerm != ''"> and discount_term = #{discountTerm}</if>
+            <if test="discountLitersAmt != null  and discountLitersAmt != ''"> and discount_liters_amt = #{discountLitersAmt}</if>
+            <if test="discountAmt != null  and discountAmt != ''"> and discount_amt = #{discountAmt}</if>
         </where>
     </select>
     

+ 4 - 1
yijia-label/src/main/resources/mapper/label/LabelRuleMapper.xml

@@ -16,7 +16,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectLabelRuleVo">
-        select id, label_name, station_id, del_flag, create_by, create_time, update_by, update_time from label_rule
+        select id, label_name, station_id, del_flag, create_by, create_time, update_by, update_time
+        from label_rule
     </sql>
 
     <select id="selectLabelRuleList" parameterType="LabelRule" resultMap="LabelRuleResult">
@@ -24,7 +25,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>  
             <if test="labelName != null  and labelName != ''"> and label_name like concat('%', #{labelName}, '%')</if>
             <if test="stationId != null "> and station_id = #{stationId}</if>
+            <if test="delFlag != null "> and del_flag = #{delFlag}</if>
         </where>
+        order by create_time
     </select>
     
     <select id="selectLabelRuleById" parameterType="Integer" resultMap="LabelRuleResult">

+ 94 - 0
yijia-label/yijia-label.iml

@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
+  <component name="FacetManager">
+    <facet type="Spring" name="Spring">
+      <configuration />
+    </facet>
+  </component>
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
+    <output url="file://$MODULE_DIR$/target/classes" />
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
+    <content url="file://$MODULE_DIR$">
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
+      <excludeFolder url="file://$MODULE_DIR$/target" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+    <orderEntry type="module" module-name="yijia-common" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context-support:5.1.18.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.18.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.18.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.18.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.18.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.18.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.18.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-security:2.1.17.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.17.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.17.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.17.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.17.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.2" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.2" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.30" level="project" />
+    <orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.18.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.security:spring-security-config:5.1.12.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.security:spring-security-core:5.1.12.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.security:spring-security-web:5.1.12.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-starter:1.3.0" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-starter:2.1.3" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-jdbc:2.1.17.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: com.zaxxer:HikariCP:3.2.0" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:5.1.18.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis.spring.boot:mybatis-spring-boot-autoconfigure:2.1.3" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis:mybatis:3.5.5" level="project" />
+    <orderEntry type="library" name="Maven: org.mybatis:mybatis-spring:2.0.5" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper-spring-boot-autoconfigure:1.3.0" level="project" />
+    <orderEntry type="library" name="Maven: com.github.pagehelper:pagehelper:5.2.0" level="project" />
+    <orderEntry type="library" name="Maven: com.github.jsqlparser:jsqlparser:3.2" level="project" />
+    <orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.11" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.10.6" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.10" level="project" />
+    <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.10" level="project" />
+    <orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.74" level="project" />
+    <orderEntry type="library" name="Maven: commons-io:commons-io:2.5" level="project" />
+    <orderEntry type="library" name="Maven: commons-fileupload:commons-fileupload:1.3.3" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.17" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.poi:poi:3.17" level="project" />
+    <orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.1" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.17" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.6.0" level="project" />
+    <orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
+    <orderEntry type="library" name="Maven: com.github.virtuald:curvesapi:1.04" level="project" />
+    <orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.23" level="project" />
+    <orderEntry type="library" name="Maven: io.jsonwebtoken:jjwt:0.9.1" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-redis:2.1.17.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-redis:2.1.20.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-keyvalue:2.1.20.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:2.1.20.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-tx:5.1.18.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-oxm:5.1.18.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: io.lettuce:lettuce-core:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: io.netty:netty-common:4.1.52.Final" level="project" />
+    <orderEntry type="library" name="Maven: io.netty:netty-handler:4.1.52.Final" level="project" />
+    <orderEntry type="library" name="Maven: io.netty:netty-resolver:4.1.52.Final" level="project" />
+    <orderEntry type="library" name="Maven: io.netty:netty-buffer:4.1.52.Final" level="project" />
+    <orderEntry type="library" name="Maven: io.netty:netty-codec:4.1.52.Final" level="project" />
+    <orderEntry type="library" name="Maven: io.netty:netty-transport:4.1.52.Final" level="project" />
+    <orderEntry type="library" name="Maven: io.projectreactor:reactor-core:3.2.20.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.reactivestreams:reactive-streams:1.0.3" level="project" />
+    <orderEntry type="library" name="Maven: org.apache.commons:commons-pool2:2.6.2" level="project" />
+    <orderEntry type="library" name="Maven: eu.bitwalker:UserAgentUtils:1.19" level="project" />
+    <orderEntry type="library" name="Maven: javax.servlet:javax.servlet-api:4.0.1" level="project" />
+    <orderEntry type="module" module-name="yijia-quartz" />
+    <orderEntry type="library" name="Maven: org.quartz-scheduler:quartz:2.3.2" level="project" />
+    <orderEntry type="library" name="Maven: com.mchange:mchange-commons-java:0.2.15" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
+    <orderEntry type="module" module-name="yijia-system" />
+  </component>
+</module>