Przeglądaj źródła

Merge branch 'dev_v1.3.8_20221209'

Eric 2 lat temu
rodzic
commit
fec18cb5da

+ 3 - 7
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/CustomerServiceBatchSendingController.java

@@ -31,7 +31,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.List;
 import java.util.Objects;
 
 @Slf4j
@@ -70,15 +69,12 @@ public class CustomerServiceBatchSendingController extends BaseController {
 	 */
     @ApiOperation(value = "查询分页", notes = "客服群发- 传入 CustomerServiceBatchSendingVo.CustomerServiceBatchSendingQuery") 
     @PostMapping("/page")
-    public HttpResponseResult<PageInfo<CustomerServiceBatchSendingVo.CustomerServiceBatchSending>> page(@RequestBody CustomerServiceBatchSendingWrapper.CustomerServiceBatchSendingQuery query) {
+    public HttpResponseResult<PageInfo<CustomerServiceBatchSendingWrapper.CustomerServiceBatchSending>> page(@RequestBody CustomerServiceBatchSendingWrapper.CustomerServiceBatchSendingQuery query) {
     
         // 查询数据
         IPage<CustomerServiceBatchSendingWrapper.CustomerServiceBatchSending> pages = customerServiceBatchSendingService.selectPage(PageUtil.getPage(query), query);
-        // 数据类型转换
-        List<CustomerServiceBatchSendingVo.CustomerServiceBatchSending> records = JSON.parseArray(JSON.toJSONString(pages.getRecords()),
-        	CustomerServiceBatchSendingVo.CustomerServiceBatchSending.class);
-        
-        return HttpResponseResult.succeed(PageUtil.getPageInfo(pages, records));
+
+        return HttpResponseResult.succeed(PageUtil.pageInfo(pages));
 	}
     
     /**

+ 12 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/CustomerServiceBatchSendingServiceImpl.java

@@ -200,7 +200,7 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
 
        // 发送推送消息
         if (EImSendType.IMMEDIATELY == info.getSendType()) {
-            sendMessage(info.getId());
+            asyncBatchSendingMessage(sending);
         }
 
         return true;
@@ -338,6 +338,16 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
             throw new BizException("无效的群发消息ID");
         }
 
+        // 发送消息
+        asyncBatchSendingMessage(info);
+
+    }
+
+    /**
+     * 异步发送消息
+     * @param info CustomerServiceBatchSending
+     */
+    private void asyncBatchSendingMessage(CustomerServiceBatchSending info) {
         String lockName = MessageFormat.format("batchSending:{0}", String.valueOf(info.getId()));
         // 消息状态判定,且不能重复发送
         DistributedLock.of(redissonClient).runIfLockCanGet(lockName, () -> {
@@ -428,13 +438,12 @@ public class CustomerServiceBatchSendingServiceImpl extends ServiceImpl<Customer
                             .update();
 
                 } catch (Exception e) {
-                    log.error("sendMessage id={}", id, e);
+                    log.error("sendMessage id={}", info.getId(), e);
                 }
 
             });
 
         });
-
     }
 
     /**

+ 10 - 4
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/wrapper/im/CustomerServiceBatchSendingWrapper.java

@@ -45,11 +45,17 @@ public class CustomerServiceBatchSendingWrapper {
         @ApiModelProperty("发送方式")
         private EImSendType sendType;
 
-        @ApiModelProperty("创建时间")
-        private Date createTime;
+        @ApiModelProperty("创建开始时间")
+        private Date startTime;
 
-        @ApiModelProperty("发送时间")
-        private Date sendTime;
+        @ApiModelProperty("创建结束时间")
+        private Date endTime;
+
+        @ApiModelProperty("发送开始时间")
+        private Date sendStartTime;
+
+        @ApiModelProperty("发送结束时间")
+        private Date sendEndTime;
 
         @ApiModelProperty("发送状态")
         private EImSendStatus sendStatus;

+ 23 - 0
cooleshow-user/user-biz/src/main/resources/config/mybatis/CustomerServiceBatchSendingMapper.xml

@@ -29,6 +29,29 @@
 		SELECT         
         	<include refid="baseColumns" />
 		FROM customer_service_batch_sending t
+		<where>
+            <if test="param.keyword != null">
+                AND t.id_ = #{param.keyword}
+            </if>
+		    <if test="param.sendSubject != null">
+                AND FIND_IN_SET(#{param.sendSubject}, t.send_subject_)
+            </if>
+		    <if test="param.targetGroup != null">
+                AND FIND_IN_SET(#{param.targetGroup}, t.target_group_)
+            </if>
+		    <if test="param.sendType != null">
+                AND t.send_type_ = #{param.sendType}
+            </if>
+		    <if test="param.sendStatus != null">
+                AND t.send_status_ = #{param.sendStatus}
+            </if>
+            <if test="param.startTime != null and param.endTime != null">
+                AND (#{param.startTime} &lt;= t.create_time_ AND t.create_time_ &lt;= #{param.endTime})
+            </if>
+		    <if test="param.sendStartTime != null and param.sendEndTime != null">
+                AND (#{param.sendStartTime} &lt;= t.send_time_ ADN t.send_time_ &lt;= #{param.sendEndTime})
+            </if>
+        </where>
         ORDER BY t.id_ DESC
 	</select>