wangguozhong 1 year ago
parent
commit
9eec24f690

+ 9 - 0
huike-admin/src/main/java/com/huike/web/controller/clues/TbActivityController.java

@@ -1,5 +1,8 @@
 package com.huike.web.controller.clues;
 
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -60,6 +63,12 @@ public class TbActivityController extends BaseController {
         TbActivity tbActivity =new TbActivity();
         tbActivity.setChannel(channel);
         tbActivity.setStatus("2");
+//        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//        String date = sdf.format(new Date());
+//        HashMap<String, Object> map = new HashMap<>();
+//        map.put("wgz",date);
+//        tbActivity.setParams(map);
+
         return AjaxResult.success(tbActivityService.selectTbActivityList(tbActivity));
     }
 

+ 2 - 0
huike-business/src/main/resources/mapper/business/TbBusinessMapper.xml

@@ -106,6 +106,7 @@
             <if test="level != null  and level != ''"> and level = #{level}</if>
             <if test="subject != null  and subject != ''"> and subject = #{subject}</if>
             <if test="courseId != null "> and course_id = #{courseId}</if>
+            <if test="params.beginCreateTime != null and params.endCreateTime != null"> and create_time between #{beginCreateTime} and #{endCreateTime}</if>
             <if test="occupation != null  and occupation != ''"> and occupation = #{occupation}</if>
             <if test="education != null  and education != ''"> and education = #{education}</if>
             <if test="job != null  and job != ''"> and job = #{job}</if>
@@ -149,6 +150,7 @@
             <if test="planTime != null "> and b.plan_time = #{planTime}</if>
             <if test="otherIntention != null  and otherIntention != ''"> and b.other_intention = #{otherIntention}</if>
             <if test="nextTime != null "> and b.next_time = #{nextTime}</if>
+            <if test="status != null and status != ''"> and status=#{status}</if>
             <if test="beginCreateTime != null and endCreateTime != null "> and DATE_FORMAT(b.create_time,'%Y-%m-%d')  BETWEEN #{beginCreateTime} AND #{endCreateTime}</if>
             AND (r.latest = '1' OR r.id IS NULL)
             AND (r.type = '1' OR r.id IS NULL)

+ 5 - 1
huike-clues/pom.xml

@@ -36,7 +36,11 @@
             <artifactId>huike-system</artifactId>
         </dependency>
 
-
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.4.2</version>
+        </dependency>
 
     </dependencies>
 </project>

+ 4 - 0
huike-clues/src/main/java/com/huike/clues/mapper/TbActivityMapper.java

@@ -1,8 +1,10 @@
 package com.huike.clues.mapper;
 
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.huike.clues.domain.TbActivity;
 import org.apache.ibatis.annotations.Param;
 
@@ -70,4 +72,6 @@ public interface TbActivityMapper {
 
 
     public Map getCountByStatus();
+
+    public List<TbActivity> selectList(String date);
 }

+ 2 - 1
huike-clues/src/main/java/com/huike/clues/service/ITbActivityService.java

@@ -3,13 +3,14 @@ package com.huike.clues.service;
 import java.util.List;
 import java.util.Map;
 
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.huike.clues.domain.TbActivity;
 
 /**
  * 活动管理Service接口
  * @date 2021-04-01
  */
-public interface ITbActivityService 
+public interface ITbActivityService
 {
     /**
      * 查询活动管理

+ 11 - 5
huike-clues/src/main/java/com/huike/clues/service/impl/TbActivityServiceImpl.java

@@ -1,10 +1,10 @@
 package com.huike.clues.service.impl;
 
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.huike.clues.task.ActivityTask;
 import com.huike.common.utils.uuid.UUIDUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -30,7 +30,8 @@ public class TbActivityServiceImpl implements ITbActivityService {
     @Autowired
     private RedisCache redisCache;
 
-
+    @Autowired
+    private ActivityTask activityTask;
     /**
      * 查询活动管理
      * 
@@ -59,6 +60,11 @@ public class TbActivityServiceImpl implements ITbActivityService {
      */
     @Override
     public List<TbActivity> selectTbActivityList(TbActivity tbActivity) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        List<TbActivity> activities = tbActivityMapper.selectList(sdf.format(new Date()));
+        for (TbActivity activity : activities) {
+            activityTask.finish(Long.toString(activity.getId()));
+        }
         return tbActivityMapper.selectTbActivityList(tbActivity);
     }
 

+ 1 - 1
huike-clues/src/main/java/com/huike/clues/service/impl/TbClueServiceImpl.java

@@ -294,7 +294,7 @@ public class TbClueServiceImpl implements ITbClueService {
 		// 统计当前分配人所有线索
 		int asignRecords = assignRecordMapper.countAssignCluesByUser(userId);
 		if (asignRecords >= rulePool.getMaxNunmber()) {
-			throw new CustomException("捞取失败!最大保有量(" + rulePool.getMaxNunmber() + "),剩余可以捞取"+(rulePool.getMaxNunmber()-asignRecords)+"条线索");
+			throw new CustomException("捞取失败!最大保有量(" + rulePool.getMaxNunmber() + "),剩余可以捞取"+ Math.abs(rulePool.getMaxNunmber() - asignRecords)+"条线索");
 		}
 		for (int i = 0; i < clueIds.length; i++) {
 			Long clueId = clueIds[i];

+ 6 - 1
huike-clues/src/main/resources/mapper/clues/TbActivityMapper.xml

@@ -43,13 +43,18 @@
             <if test="params.beginTime != null and params.beginTime != ''"><!-- 活动开始时间 -->
                 and date_format(begin_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
             </if>
+<!--            <if test="params.wgz != null and params.wgz != ''">-->
+<!--                and #{params.wgz} between begin_time and end_time-->
+<!--            </if>-->
             <if test="params.endTime != null and params.endTime != ''"><!-- 活动结束时间 -->
                 and date_format(end_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
             </if>
         </where>
         ORDER BY `create_time` DESC
     </select>
-
+    <select id="selectList" resultType="com.huike.clues.domain.TbActivity">
+        select * from tb_activity where date_format(end_time,'%y%m%d') &lt; date_format(#{date},'%y%m%d')
+    </select>
     <select id="selectAllCode" resultType="String">
         select code from tb_activity
     </select>

+ 1 - 1
huike-clues/src/main/resources/mapper/clues/TbClueMapper.xml

@@ -92,7 +92,7 @@
         <where>
             <if test="id != null  and id != ''"> and clue.id = #{id}</if>
             <if test="name != null  and name != ''"> and clue.name like concat('%', #{name}, '%')</if>
-            <if test="phone != null  and phone != ''"> and clue.phone = #{phone}</if>
+            <if test="phone != null  and phone != ''"> and clue.phone like concat('%',#{phone},'%')</if>
             <if test="channel != null  and channel != ''"> and clue.channel = #{channel}</if>
             <if test="activityId != null  and activityId != ''"> and clue.activity_id = #{activityId}</if>
             <if test="sex != null  and sex != ''"> and clue.sex = #{sex}</if>

+ 3 - 0
huike-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -65,6 +65,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		<if test="status != null and status != ''">
 			AND u.status = #{status}
 		</if>
+		<if test="phonenumber != null and phonenumber != ''">
+			and u.phonenumber like concat('%',#{phonenumber},'%')
+		</if>
 		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
 			AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
 		</if>