Bläddra i källkod

【赫拉前台】个微管理-账号列表优化后端

lqc 4 år sedan
förälder
incheckning
5ac73f2395

+ 6 - 0
src/main/java/com/mokamrp/privates/entity/pangu/GetForsterwxMobileHandle.java

@@ -27,6 +27,12 @@ public class GetForsterwxMobileHandle {
     private String prop;
     private String order;
     private Integer type;
+    private String mobileCodes;
+    private List<String> mobileCodeList;
+    private List<String> mobileNoList;
+    private String workWxCorpId;
+    private String custserviceName;
+    private String teamId;
 
     public Integer getPage() {
         return page;

+ 24 - 3
src/main/java/com/mokamrp/privates/mapper/pangu/FosterwxMobileMapper.xml

@@ -29,6 +29,8 @@
         <result column="work_wx_corp" property="workWxCorp"/>
         <result column="work_wx_register_at" property="workWxRegisterAt"/>
         <result column="work_wx_status" property="workWxStatus"/>
+        <result column="custservice_name" property="custserviceName"/>
+        <result column="team_id" property="teamId"/>
         <result column="in_pool" property="inPool"/>
         <result column="task_start_at" property="taskStartAt"/>
         <result column="code_url" property="codeUrl"/>
@@ -45,17 +47,36 @@
         SELECT A.* FROM pan_fosterwx_mobile as A
         <where>
             <if test="param.id != null">and A.id = #{param.id}</if>
-            <if test="param.mobileCode != null">and A.mobile_code = #{param.mobileCode}</if>
-            <if test="param.mobileNo != null">and A.mobile_no = #{param.mobileNo}</if>
+            <if test="param.mobileCodeList != null and param.mobileCodeList.size > 0">
+                and (
+                <foreach item="item" index="index" collection="param.mobileCodeList">
+                    A.mobile_code like CONCAT('%' , #{item} , '%') or
+                </foreach>
+                1 != 1
+                )
+            </if>
+            <if test="param.mobileNoList != null and param.mobileNoList.size > 0">
+                and (
+                <foreach item="item" index="index" collection="param.mobileNoList">
+                    A.mobile_no like CONCAT('%' , #{item} , '%') or
+                </foreach>
+                1 != 1
+                )
+            </if>
             <if test="param.workWxStatus != null">and A.work_wx_status = #{param.workWxStatus}</if>
             <if test="param.mobileOperator != null">and A.mobile_operator = #{param.mobileOperator}</if>
             <if test="param.wxStatus != null">and A.wx_status = #{param.wxStatus}</if>
             <if test="param.status != null">and A.status = #{param.status}</if>
             <if test="param.inPool != null">and A.in_pool = #{param.inPool}</if>
             <if test="param.stationId != null">and A.station_id = #{param.stationId}</if>
+            <if test="param.workWxCorpId != null">and A.work_wx_corp_id = #{param.workWxCorpId}</if>
+            <if test="param.custserviceName != null">and A.custservice_name like CONCAT('%' , #{param.custserviceName} ,
+                '%')
+            </if>
+            <if test="param.teamId != null">and A.team_id like CONCAT('%' , #{param.teamId} , '%')
+            </if>
             <if test="param.createDate != null">and left(A.create_at,10) = #{param.createDate}</if>
             <if test="param.updateDate != null">and left(A.update_at,10) = #{param.updateDate}</if>
-
             <if test="param.ids != null and param.ids.size() > 0">and id in
                 <foreach item="item" index="index" collection="param.ids" open="(" separator="," close=")">
                     #{item}

+ 25 - 20
src/main/java/com/mokamrp/privates/service/pangu/impl/FosterwxMobileServiceImpl.java

@@ -20,10 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -77,6 +74,12 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
         Integer pagesize = handle.getPagesize();
         Integer page = handle.getPage();
         Page<FosterwxMobileVo> pageObj = new Page<>(page, pagesize);
+        if (null != handle.getMobileCodes() && !handle.getMobileCodes().isEmpty()) {
+            handle.setMobileCodeList(Arrays.asList(handle.getMobileCodes().split(",")));
+        }
+        if (null != handle.getMobileNo() && !handle.getMobileNo().isEmpty()) {
+            handle.setMobileNoList(Arrays.asList(handle.getMobileNo().split(",")));
+        }
         List<FosterwxMobileVo> list = fosterwxMobileMapper.getList(pageObj, handle);
         list.forEach(fosterwxMobile -> {
             // 获取企微主体信息
@@ -160,11 +163,13 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
             fosterwxMobile.setMobileCombo(row.get(i).get("mobileCombo"));
             fosterwxMobile.setMobileComboFlow(row.get(i).get("mobileComboFlow"));
             fosterwxMobile.setMobileRealName(row.get(i).get("mobileRealName"));
-            if (row.get(i).get("mobileIdentityCardNo") != null) fosterwxMobile.setMobileIdentityCardNo(row.get(i).get("mobileIdentityCardNo"));
+            if (row.get(i).get("mobileIdentityCardNo") != null)
+                fosterwxMobile.setMobileIdentityCardNo(row.get(i).get("mobileIdentityCardNo"));
             fosterwxMobile.setWxPassword(row.get(i).get("wxPassword"));
             fosterwxMobile.setWxRegisterAt(LocalDateTime.parse(row.get(i).get("wxRegisterAt") + " 08:00:00", df));
             fosterwxMobile.setWxRealName(row.get(i).get("wxRealName"));
-            if (row.get(i).get("wxIdentityCardNo") != null) fosterwxMobile.setWxIdentityCardNo(row.get(i).get("wxIdentityCardNo"));
+            if (row.get(i).get("wxIdentityCardNo") != null)
+                fosterwxMobile.setWxIdentityCardNo(row.get(i).get("wxIdentityCardNo"));
             if (row.get(i).get("bankCardNo") != null) fosterwxMobile.setBankCardNo(row.get(i).get("bankCardNo"));
             fosterwxMobile.setBankCardMobileNo(row.get(i).get("bankCardMobileNo"));
             if (row.get(i).get("workWxCorp") != null && !row.get(i).get("workWxCorp").isEmpty() && null != corp) {
@@ -266,19 +271,19 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
         LocalDateTime now = LocalDateTime.now();
         for (Integer id : setIdsHandle.getIds()) {
             FosterwxMobile fosterwxMobile = this.getOne(new QueryWrapper<FosterwxMobile>().eq("id", id));
-            FosterwxCashMobile fosterwxCashMobile = fosterwxCashMobileService.getOne(new QueryWrapper<FosterwxCashMobile>().eq("mobile_id",id));
-            if (fosterwxCashMobile != null){
+            FosterwxCashMobile fosterwxCashMobile = fosterwxCashMobileService.getOne(new QueryWrapper<FosterwxCashMobile>().eq("mobile_id", id));
+            if (fosterwxCashMobile != null) {
                 continue;
             }
-            List<FosterwxDomain> domainList = fosterwxDomainService.list(new QueryWrapper<FosterwxDomain>().eq("station_id",fosterwxMobile.getStationId()));
+            List<FosterwxDomain> domainList = fosterwxDomainService.list(new QueryWrapper<FosterwxDomain>().eq("station_id", fosterwxMobile.getStationId()));
             FosterwxCashMobile add = new FosterwxCashMobile();
             //.站点域名不存在则不插入域名信息
-            if (domainList.size() > 0){
+            if (domainList.size() > 0) {
                 Integer rand;
-                if (domainList.size() == 1){
+                if (domainList.size() == 1) {
                     rand = 0;
-                }else{
-                    rand = (int)(0+Math.random()*((domainList.size()-1)-0+1));
+                } else {
+                    rand = (int) (0 + Math.random() * ((domainList.size() - 1) - 0 + 1));
                 }
                 add.setDomainId(rand);
             }
@@ -302,19 +307,19 @@ public class FosterwxMobileServiceImpl extends ServiceImpl<FosterwxMobileMapper,
         LocalDateTime now = LocalDateTime.now();
         for (Integer id : setIdsHandle.getIds()) {
             FosterwxMobile fosterwxMobile = this.getOne(new QueryWrapper<FosterwxMobile>().eq("id", id));
-            FosterwxCashWorkwxMobile fosterwxCashMobile = fosterwxCashWorkwxMobileService.getOne(new QueryWrapper<FosterwxCashWorkwxMobile>().eq("mobile_id",id));
-            if (fosterwxCashMobile != null){
+            FosterwxCashWorkwxMobile fosterwxCashMobile = fosterwxCashWorkwxMobileService.getOne(new QueryWrapper<FosterwxCashWorkwxMobile>().eq("mobile_id", id));
+            if (fosterwxCashMobile != null) {
                 continue;
             }
-            List<FosterwxDomain> domainList = fosterwxDomainService.list(new QueryWrapper<FosterwxDomain>().eq("station_id",fosterwxMobile.getStationId()));
+            List<FosterwxDomain> domainList = fosterwxDomainService.list(new QueryWrapper<FosterwxDomain>().eq("station_id", fosterwxMobile.getStationId()));
             FosterwxCashWorkwxMobile add = new FosterwxCashWorkwxMobile();
             //.站点域名不存在则不插入域名信息
-            if (domainList.size() > 0){
+            if (domainList.size() > 0) {
                 Integer rand;
-                if (domainList.size() == 1){
+                if (domainList.size() == 1) {
                     rand = 0;
-                }else{
-                    rand = (int)(0+Math.random()*((domainList.size()-1)-0+1));
+                } else {
+                    rand = (int) (0 + Math.random() * ((domainList.size() - 1) - 0 + 1));
                 }
                 add.setDomainId(rand);
             }

+ 19 - 0
src/test/java/com/mokamrp/WebTest.java

@@ -1,12 +1,17 @@
 package com.mokamrp;
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.mokamrp.privates.PrivateServerStart;
+import com.mokamrp.privates.constant.RedisKey;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobilePool;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxMobileTaskTimeList;
 import com.mokamrp.privates.mapper.pangu.pojo.FosterwxTaskSchedule;
+import com.mokamrp.privates.mapper.pojo.WorkComplainH5Type;
 import com.mokamrp.privates.service.CoralApiService;
 import com.mokamrp.privates.service.CorpService;
+import com.mokamrp.privates.service.WorkComplainH5TypeService;
 import com.mokamrp.privates.service.pangu.FosterwxMobilePoolService;
 import com.mokamrp.privates.service.pangu.FosterwxMobileService;
 import com.mokamrp.privates.service.pangu.FosterwxMobileTaskTimeListService;
@@ -19,9 +24,11 @@ import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import java.time.LocalDateTime;
+import java.util.List;
 
 @Slf4j
 @SpringBootTest(classes = PrivateServerStart.class)
@@ -54,6 +61,12 @@ public class WebTest {
     @Autowired
     private CoralApiService coralApiService;
 
+    @Autowired
+    private WorkComplainH5TypeService workComplainH5TypeService;
+
+    @Autowired
+    private StringRedisTemplate stringRedisTemplate;
+
     @Test
     public void test1() {
         // 清洗数据
@@ -112,4 +125,10 @@ public class WebTest {
     public void test4() throws Exception {
         syncCreateCashTask.syncCreateCashTask();
     }
+
+    @Test
+    public void test5() {
+        List<WorkComplainH5Type> list = workComplainH5TypeService.list(new QueryWrapper<WorkComplainH5Type>().orderByAsc("seq"));
+        stringRedisTemplate.opsForValue().set(RedisKey.WorkComplainType, JSONObject.toJSONString(list));
+    }
 }