Browse Source

Merge remote-tracking branch 'origin/dev' into dev

pull/6/head
吴远 1 month ago
parent
commit
344d15a734
  1. 1
      dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java
  2. 24
      dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml
  3. 7
      dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteNoticeServiceImpl.java

1
dk-modules/business/src/main/java/org/dromara/business/controller/BusinessAlertController.java

@ -108,6 +108,7 @@ public class BusinessAlertController extends BaseController {
@PostMapping("/saveAlert") @PostMapping("/saveAlert")
public R saveAlert(@RequestBody BusinessAlertVo vo) { public R saveAlert(@RequestBody BusinessAlertVo vo) {
vo.setBusinessType(2); vo.setBusinessType(2);
vo.setHandleType("verify");
BusinessAlert businessAlert = businessAlertService.addBusinessAlert(vo); BusinessAlert businessAlert = businessAlertService.addBusinessAlert(vo);
return R.ok(); return R.ok();
} }

24
dk-modules/business/src/main/resources/mapper/business/BusinessAlertMapper.xml

@ -111,51 +111,51 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="listMonthAlert" resultType="java.util.Map"> <select id="listMonthAlert" resultType="java.util.Map">
SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -11 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -11 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 0 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -11 MONTH), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
union all union all
SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -10 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -10 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 1 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -10 MONTH), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
union all union all
SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -9 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -9 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 2 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -9 MONTH), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
union all union all
SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -8 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -8 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 3 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -8 MONTH), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
union all union all
SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -7 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -7 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 4 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -7 MONTH), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
union all union all
SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -6 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -6 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 5 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -6 MONTH), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
union all union all
SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -5 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -5 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 6 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -5 MONTH), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
union all union all
SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -4 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -4 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 7 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -4 MONTH), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
union all union all
SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -3 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -3 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 8 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -3 MONTH), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
union all union all
SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -2 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -2 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 9 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -2 MONTH), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
union all union all
SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -1 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -1 MONTH), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 10 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(CURDATE(), INTERVAL -1 MONTH), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
union all union all
SELECT DATE_FORMAT(CURDATE(), '%Y-%m') AS dateMonth,count(1) total from business_alert ba SELECT DATE_FORMAT(CURDATE(), '%Y-%m') AS dateMonth,count(1) total from business_alert ba
where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(DATE_ADD(DATE_FORMAT(CURDATE(), '%Y-01-01'), INTERVAL 11 MONTH), '%Y-%m') where DATE_FORMAT(ba.create_time, '%Y-%m' ) = DATE_FORMAT(CURDATE(), '%Y-%m')
<include refid="searchSql"></include> <include refid="searchSql"></include>
</select> </select>

7
dk-modules/system/src/main/java/org/dromara/system/dubbo/RemoteNoticeServiceImpl.java

@ -16,6 +16,8 @@ import org.dromara.system.service.ISysDictTypeService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
/** /**
@ -33,6 +35,8 @@ public class RemoteNoticeServiceImpl implements RemoteNoticeService {
private final RemoteMessageService remoteMessageService; private final RemoteMessageService remoteMessageService;
private final ISysDictTypeService dictTypeService; private final ISysDictTypeService dictTypeService;
private final ScheduledExecutorService scheduledExecutorService;
@Override @Override
public int saveNotice(RemoteNoticeBo bo) { public int saveNotice(RemoteNoticeBo bo) {
SysNotice notice = MapstructUtils.convert(bo, SysNotice.class); SysNotice notice = MapstructUtils.convert(bo, SysNotice.class);
@ -40,7 +44,10 @@ public class RemoteNoticeServiceImpl implements RemoteNoticeService {
List<SysDictDataVo> data = dictTypeService.selectDictDataByType("ai_push"); List<SysDictDataVo> data = dictTypeService.selectDictDataByType("ai_push");
List<Long> list = data.stream().map(SysDictDataVo::getDictValue).distinct().toList().stream().map(Long::parseLong).toList(); List<Long> list = data.stream().map(SysDictDataVo::getDictValue).distinct().toList().stream().map(Long::parseLong).toList();
//获取字典值 //获取字典值
scheduledExecutorService.schedule(() -> {
remoteMessageService.publishMessage(list, bo.getParam()); remoteMessageService.publishMessage(list, bo.getParam());
}, 3, TimeUnit.SECONDS);
return sysNoticeMapper.insert(notice); return sysNoticeMapper.insert(notice);
} }
} }

Loading…
Cancel
Save