Переглянути джерело

查询客户公司功能调整

fans 4 роки тому
батько
коміт
d312fbb89f

+ 63 - 2
tnc-sms/src/main/java/org/jeecg/modules/smscheck/controller/SmsCheckCustomerInfoController.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
@@ -24,6 +25,7 @@ import org.jeecg.modules.smscheck.configs.CheckStateCode;
 import org.jeecg.modules.smscheck.entity.*;
 import org.jeecg.modules.smscheck.service.ISmsCheckCustomerInfoLogService;
 import org.jeecg.modules.smscheck.service.ISmsCheckCustomerInfoService;
+import org.jeecg.modules.smscheck.service.ISmsCheckTaskService;
 import org.jeecg.modules.smscheck.service.ISmsCheckWorkLogService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -32,8 +34,7 @@ import org.springframework.web.servlet.ModelAndView;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
 
 /**
  * @author jeecg-boot
@@ -58,6 +59,9 @@ public class SmsCheckCustomerInfoController extends JeecgController<SmsCheckCust
     @Autowired
     private ISmsCheckCustomerInfoService smsCheckCustomerInfoService;
 
+    @Autowired
+    private ISmsCheckTaskService taskService;
+
     /**
      * 分页列表查询
      *
@@ -418,4 +422,61 @@ public class SmsCheckCustomerInfoController extends JeecgController<SmsCheckCust
         List<SmsCheckTaskVo> smsCheckTaskVos = smsCheckCustomerInfoService.checkInfoWarningCountStaff(smsCheckCustomerInfo);
         return Result.ok(smsCheckTaskVos);
     }
+
+    /**
+     * 查询客户公司
+     * @param smsCheckCustomerInfo
+     * @param pageNo
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/selectCompanyList")
+    public Result<IPage<SmsCheckCustomerInfo>> selectCompanyList (SmsCheckCustomerInfo smsCheckCustomerInfo,
+                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize){
+        List<SmsCheckCustomerInfo> smsCheckCustomerInfos = smsCheckCustomerInfoService.selectCompanyList(smsCheckCustomerInfo);
+        Page<SmsCheckCustomerInfo> page = new Page<>();
+        page.setRecords(smsCheckCustomerInfos);
+        return Result.ok(page);
+    }
+
+    /**
+     * 获取稽核任务
+     * @param smsCheckCustomerInfo
+     * @return
+     */
+    @GetMapping("/selectTaskList")
+    public Result<IPage<SmsCheckTask>> selectTaskList (SmsCheckCustomerInfo smsCheckCustomerInfo,
+                                                       @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                       @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize){
+        Set<String> TaskIdSet = this.selectTaskId(smsCheckCustomerInfo);
+        ArrayList<SmsCheckTask> list = new ArrayList<>();
+        for (String taskId: TaskIdSet) {
+            list.add(taskService.getById(taskId));
+        }
+        return Result.ok(new Page<SmsCheckTask>(pageNo,pageSize).setRecords(list));
+    }
+
+    /**
+     * 获取稽核任务id
+     * @param smsCheckCustomerInfo
+     * @return
+     */
+    private Set<String> selectTaskId(SmsCheckCustomerInfo smsCheckCustomerInfo){
+        QueryWrapper<SmsCheckCustomerInfo> queryWrapper = new QueryWrapper<>();
+        String customerNo = smsCheckCustomerInfo.getCustomerNo();
+        String customerName = smsCheckCustomerInfo.getCustomerName();
+        if (!StringUtils.isEmpty(customerNo)){
+            queryWrapper.eq("customer_no",customerNo);
+        }
+        if (!StringUtils.isEmpty(customerName)){
+            queryWrapper.eq("customer_name",customerName);
+        }
+        List<SmsCheckCustomerInfo> list = smsCheckCustomerInfoService.getBaseMapper().selectList(queryWrapper);
+        Set<String> set = new HashSet<>();
+        for (SmsCheckCustomerInfo info:list) {
+            set.add(info.getTaskId());
+        }
+        return set;
+    }
  }

+ 24 - 3
tnc-sms/src/main/java/org/jeecg/modules/smscheck/mapper/SmsCheckCustomerInfoMapper.java

@@ -17,8 +17,9 @@ import java.util.List;
  * @version V1.0
  */
 public interface SmsCheckCustomerInfoMapper extends BaseMapper<SmsCheckCustomerInfo> {
-    @Select("SELECT any_value(id) id, any_value(customer_no) customer_no,`customer_name` FROM `sms_check_customer_info` GROUP BY `customer_name`")
-    List<SmsCheckCustomerInfo> selectCompanyList();
+
+    @SelectProvider(type = ProviderClass.class,method = "selectCompanyList")
+    List<SmsCheckCustomerInfo> selectCompanyList(SmsCheckCustomerInfo smsCheckCustomerInfo);
 
     @SelectProvider(type = ProviderClass.class,method = "checkInfoWarningCount")
     Integer checkInfoWarningCount(SmsCheckCustomerInfo smsCheckCustomerInfo);
@@ -90,6 +91,26 @@ public interface SmsCheckCustomerInfoMapper extends BaseMapper<SmsCheckCustomerI
 
         }
 
-
+        public String selectCompanyList(SmsCheckCustomerInfo smsCheckCustomerInfo){
+            StringBuilder sql = new StringBuilder();
+            sql.append("SELECT any_value(id) id, any_value(customer_no) customer_no,`customer_name` FROM `sms_check_customer_info`");
+            String customerNo = smsCheckCustomerInfo.getCustomerNo();
+            String customerName = smsCheckCustomerInfo.getCustomerName();
+            if (!StringUtils.isEmpty(customerNo)){
+                String customerNoNow = customerNo.replace("*", "%");
+                sql.append(" WHERE `customer_no` like '"+customerNoNow+"'");
+                if (!StringUtils.isEmpty(customerName)){
+                    String customerNameNow = customerName.replace("*", "%");
+                    sql.append(" AND `customer_name` like '"+customerNameNow+"'");
+                }
+            }else{
+                if (!StringUtils.isEmpty(customerName)){
+                    String customerNameNow = customerName.replace("*", "%");
+                    sql.append(" WHERE `customer_name` like '"+customerNameNow+"'");
+                }
+            }
+            sql.append(" GROUP BY `customer_name`");
+            return sql.toString();
+        }
     }
 }

+ 1 - 1
tnc-sms/src/main/java/org/jeecg/modules/smscheck/service/ISmsCheckCustomerInfoService.java

@@ -15,7 +15,7 @@ import java.util.List;
  */
 public interface ISmsCheckCustomerInfoService extends IService<SmsCheckCustomerInfo> {
 
-    List<SmsCheckCustomerInfo> selectCompanyList();
+    List<SmsCheckCustomerInfo> selectCompanyList(SmsCheckCustomerInfo smsCheckCustomerInfo);
 
     Integer checkInfoWarningCount(SmsCheckCustomerInfo smsCheckCustomerInfo);
 

+ 2 - 2
tnc-sms/src/main/java/org/jeecg/modules/smscheck/service/impl/SmsCheckCustomerInfoServiceImpl.java

@@ -43,7 +43,7 @@ public class SmsCheckCustomerInfoServiceImpl extends ServiceImpl<SmsCheckCustome
     }
 
     @Override
-    public List<SmsCheckCustomerInfo> selectCompanyList() {
-        return smsCheckCustomerInfoMapper.selectCompanyList();
+    public List<SmsCheckCustomerInfo> selectCompanyList(SmsCheckCustomerInfo smsCheckCustomerInfo) {
+        return smsCheckCustomerInfoMapper.selectCompanyList(smsCheckCustomerInfo);
     }
 }