年检到期提醒

master
xiepeng 2024-04-01 18:53:07 +08:00
parent 89ff35ed44
commit cd30826fcf
11 changed files with 636 additions and 2 deletions

View File

@ -0,0 +1,29 @@
package com.zcloud.mapper.datasource.inspectAnnually;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2021-06-19
* www.zcloudchina.com
*/
public interface InspectAnnuallyMapper {
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
List<PageData> getYestoday(PageData pd);
}

View File

@ -0,0 +1,19 @@
package com.zcloud.mapper.datasource.inspectAnnually;
import com.zcloud.entity.PageData;
/**
*
* luoxiaobao
* 2021-06-19
* www.zcloudchina.com
*/
public interface InspectAnnuallyWxMapper {
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
}

View File

@ -0,0 +1,69 @@
package com.zcloud.scheduled.trafficRemind;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.hiddenDangerCheckStandard.CustomHiddenService;
import com.zcloud.service.inspectAnnually.InspectAnnuallyService;
import com.zcloud.service.notice.NoticeManagementService;
import com.zcloud.service.system.UsersService;
import com.zcloud.util.SendMessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Component
public class TrafficRemindScheduled {
@Autowired
private InspectAnnuallyService inspectAnnuallyService;
@Autowired
private SendMessageUtil sendMessageUtil;
@Autowired
private NoticeManagementService noticeManagementService;
//@Scheduled(cron ="0 0 8 * * ?") // 每天8点
@Scheduled(cron ="0/10 * * * * ?")
public void scheduled(){
try {
System.out.println( "============定时发送今日年检到期提醒==========");
PageData pd = new PageData();
pd.put("NOTICE_MANAGEMENT_ID", "a2c54741cbc24f2aba85943ec628eeab");
PageData annualNotice = noticeManagementService.findById(pd);
List<String> notifierId = Arrays.asList(annualNotice.getString("ADDRESSEE").split(","));
List<PageData> varList = inspectAnnuallyService.getYestoday(pd);
if(varList != null && varList.size() > 0) {
for (String userId : notifierId){
for(PageData h : varList) {
// 发送年检到期通知
PageData mes = new PageData();
mes.put("RECEIVER_ID", userId);// 收信人 userid
mes.put("templateCode", "TRAFFIC_NJ_N01");// 通知模板编码
mes.put("CORPINFO_ID", h.get("CORPINFO_ID"));// 企业id
// 参数集合
List<PageData> paramsList = new ArrayList<PageData>();
// 第1个参数
PageData params1 = new PageData();
params1.put("name", "plate_number");// 存入短信模板中的参数名称
params1.put("value", h.get("PLATE_NUMBER").toString());// 存入上面参数名称所传递的值
paramsList.add(params1);
// 第2个参数
PageData params2 = new PageData();
params2.put("name", "vehicle_model");// 存入短信模板中的参数名称
params2.put("value", h.get("VEHICLEMODEL").toString());// 存入上面参数名称所传递的值
paramsList.add(params2);
sendMessageUtil.sendTrafficNotice(mes, paramsList);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,34 @@
package com.zcloud.service.inspectAnnually;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2021-06-19
* www.zcloudchina.com
*/
public interface InspectAnnuallyService {
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception;
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception;
/**
*
* @param pd
* @return
*/
List<PageData> getYestoday(PageData pd);
}

View File

@ -0,0 +1,20 @@
package com.zcloud.service.inspectAnnually;
import com.zcloud.entity.PageData;
/**
*
* luoxiaobao
* 2021-06-19
* www.zcloudchina.com
*/
public interface InspectAnnuallyWxService {
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception;
}

View File

@ -0,0 +1,49 @@
package com.zcloud.service.inspectAnnually.impl;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.inspectAnnually.InspectAnnuallyMapper;
import com.zcloud.mapper.datasource.speEquip.SpecialEquipmentMapper;
import com.zcloud.service.inspectAnnually.InspectAnnuallyService;
import com.zcloud.service.speEquip.SpecialEquipmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
*
* luoxiaobao
* 2021-06-19
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class InspectAnnuallyServiceImpl implements InspectAnnuallyService {
@Autowired
private InspectAnnuallyMapper inspectAnnuallyMapper;
/**
* @param pd
* @throws Exception
*/
public void edit(PageData pd)throws Exception{
inspectAnnuallyMapper.edit(pd);
}
/**()
* @param pd
* @throws Exception
*/
public List<PageData> listAll(PageData pd)throws Exception{
return inspectAnnuallyMapper.listAll(pd);
}
@Override
public List<PageData> getYestoday(PageData pd) {
return inspectAnnuallyMapper.getYestoday(pd);
}
}

View File

@ -0,0 +1,32 @@
package com.zcloud.service.inspectAnnually.impl;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.speEquip.SpecialEquipmentWxjMapper;
import com.zcloud.service.inspectAnnually.InspectAnnuallyWxService;
import com.zcloud.service.speEquip.SpecialEquipmentWxjService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
*
* luoxiaobao
* 2021-06-19
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class InspectAnnuallyWxServiceImpl implements InspectAnnuallyWxService {
@Autowired
private SpecialEquipmentWxjMapper specialequipmentwxjMapper;
/**
* @param pd
* @throws Exception
*/
public void save(PageData pd)throws Exception{
specialequipmentwxjMapper.save(pd);
}
}

View File

@ -159,7 +159,7 @@ public class SendMessageUtil {
* @return * @return
* @throws Exception * @throws Exception
*/ */
private void sendNotice(PageData pd, List<PageData> paramsList) throws Exception{ public void sendNotice(PageData pd, List<PageData> paramsList) throws Exception{
PageData nm = new PageData(); PageData nm = new PageData();
nm.put("CORPINFO_ID", pd.getString("CORPINFO_ID")); nm.put("CORPINFO_ID", pd.getString("CORPINFO_ID"));
nm.put("ISENABLE", "1"); nm.put("ISENABLE", "1");
@ -229,6 +229,46 @@ public class SendMessageUtil {
} }
} }
public void sendTrafficNotice(PageData pd, List<PageData> paramsList) throws Exception{
PageData nm = new PageData();
nm.put("CORPINFO_ID", pd.getString("CORPINFO_ID"));
nm.put("ISENABLE", "1");
nm.put("SMSCODE", pd.get("templateCode"));
List<PageData> nmList =noticemanagementService.listAll(nm);
if(nmList==null || nmList.size()==0){//未开启该提醒
return;
}
PageData template = new PageData();
template.put("TEMPLATE_CODE",pd.get("templateCode"));
template = this.noticeTemplateService.findByCode(template);
String content = template.getString("TEMPLATE_STR");
if(paramsList != null && paramsList.size() > 0) {
StringBuffer parStr = new StringBuffer();
for(PageData par: paramsList) {
content = content.replace(("${" + par.getString("name") + "}"),par.getString("value"));
}
}
PageData pd1 = new PageData();
pd1.put("NOTICECORP_ID", UuidUtil.get32UUID());
pd1.put("USERNAME","秦安双控");
pd1.put("CREATOR", "秦安双控"); //添加人
pd1.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd1.put("SYNOPSIS",template.getString("NAME"));
pd1.put("CONTENT","<p>"+content+"</p>");
pd1.put("ISALL","yes");
pd1.put("ISREPLY",0);
pd1.put("ISDELETE",0);
pd1.put("ISTOP",0);
pd1.put("STATUS",1);
pd1.put("CORP_INFO_ID",pd.getString("CORPINFO_ID"));
noticeCorpService.save(pd1);
pd1.put("NOTICECORPUSERID_ID",UuidUtil.get32UUID());
pd1.put("USER_ID",pd.getString("RECEIVER_ID"));
pd1.put("TYPE",0);
noticeCorpUserService.save(pd1);
}
/* /*
* *
* */ * */

View File

@ -0,0 +1,262 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.datasource.inspectAnnually.InspectAnnuallyMapper">
<!--表名 -->
<sql id="tableName">
BUS_TRAFFIC_MECHANICAL_INSPECT_ANNUALLY
</sql>
<!-- 字段 -->
<sql id="Field">
INSPECTANNUALLY_ID,
CORPINFO_ID,
NUM,
VEHICLE_MODEL,
VEHICLE,
CAR_OWNERS,
TELEPHONE,
REGISTRANT,
PROCESSING_DATE,
ANNUAL_INSPECTION_CYCLE,
DUE_DATE,
INSPECTFEES,
ACTUAL_COLLECTION,
ADDRESS,
REMINDER_DAYS,
REMINDER_DATE,
REMINDER_STATUS,
INSPECTINFO,
NOTES,
ARCHIVES_TYPE,
ISDELETE,
CREATOR,
CREATORNAME,
CREATTIME
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{INSPECTANNUALLY_ID},
#{CORPINFO_ID},
#{NUM},
#{VEHICLE_MODEL},
#{VEHICLE},
#{CAR_OWNERS},
#{TELEPHONE},
#{REGISTRANT},
#{PROCESSING_DATE},
#{ANNUAL_INSPECTION_CYCLE},
#{DUE_DATE},
#{INSPECTFEES},
#{ACTUAL_COLLECTION},
#{ADDRESS},
#{REMINDER_DAYS},
#{REMINDER_DATE},
#{REMINDER_STATUS},
#{INSPECTINFO},
#{NOTES},
#{ARCHIVES_TYPE},
#{ISDELETE},
#{CREATOR},
#{CREATORNAME},
#{CREATTIME}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 删除-->
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set
ISDELETE = '1',
DELETEOR = #{DELETEOR},
DELETEORNAME = #{DELETEORNAME},
DELETTIME = #{DELETTIME}
where
INSPECTANNUALLY_ID = #{INSPECTANNUALLY_ID}
</delete>
<!-- 修改 -->
<update id="edit" parameterType="pd">
update
<include refid="tableName"></include>
set
NUM = #{NUM},
VEHICLE_MODEL = #{VEHICLE_MODEL},
VEHICLE = #{VEHICLE},
CAR_OWNERS = #{CAR_OWNERS},
TELEPHONE = #{TELEPHONE},
REGISTRANT = #{REGISTRANT},
PROCESSING_DATE = #{PROCESSING_DATE},
ANNUAL_INSPECTION_CYCLE = #{ANNUAL_INSPECTION_CYCLE},
DUE_DATE = #{DUE_DATE},
INSPECTFEES = #{INSPECTFEES},
ACTUAL_COLLECTION = #{ACTUAL_COLLECTION},
ADDRESS = #{ADDRESS},
REMINDER_DAYS = #{REMINDER_DAYS},
REMINDER_DATE = #{REMINDER_DATE},
REMINDER_STATUS = #{REMINDER_STATUS},
INSPECTINFO = #{INSPECTINFO},
NOTES = #{NOTES},
ARCHIVES_TYPE = #{ARCHIVES_TYPE},
OPERATOR = #{OPERATOR},
OPERATORNAME = #{OPERATORNAME},
OPERATTIME = #{OPERATTIME}
where
INSPECTANNUALLY_ID = #{INSPECTANNUALLY_ID}
</update>
<!-- 修改 -->
<update id="edit2" parameterType="pd">
update
<include refid="tableName"></include>
set
<if test="REMINDER_STATUS != null">
REMINDER_STATUS = #{REMINDER_STATUS},
</if>
OPERATOR = #{OPERATOR},
OPERATORNAME = #{OPERATORNAME},
OPERATTIME = #{OPERATTIME}
where
INSPECTANNUALLY_ID = #{INSPECTANNUALLY_ID}
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
f.INSPECTANNUALLY_ID,
f.CORPINFO_ID,
f.NUM,
f.VEHICLE_MODEL,
f.VEHICLE,
f.CAR_OWNERS,
f.TELEPHONE,
f.REGISTRANT,
f.PROCESSING_DATE,
f.ANNUAL_INSPECTION_CYCLE,
f.DUE_DATE,
f.INSPECTFEES,
f.ACTUAL_COLLECTION,
f.ADDRESS,
f.REMINDER_DAYS,
f.REMINDER_DATE,
f.REMINDER_STATUS,
f.INSPECTINFO,
f.NOTES,
f.ARCHIVES_TYPE,
f.ISDELETE,
f.CREATOR,
f.CREATORNAME,
f.CREATTIME,
(SELECT sd.NAME FROM sys_dictionaries sd where sd.DICTIONARIES_ID=f.ANNUAL_INSPECTION_CYCLE) as ANNUAL_INSPECTION_CYCLE_NAME,
v.COMPANY_AREA as AREA
from
<include refid="tableName"></include> f
left join v_traffic v on f.VEHICLE = v.ID
where
f.INSPECTANNUALLY_ID = #{INSPECTANNUALLY_ID}
</select>
<!-- 列表
BASICINFO_LICENSE_PLATE 车牌号
CAR_OWNERS 车主业户
REGISTRANT 登记人
DUE_DATE 到期日期
VEHICLE_MODEL 营运车型
REMINDER_STATUS 提醒状态
-->
<select id="datalistPage" parameterType="page" resultType="pd">
select
b.NAME,
f.*,
case when f.DUE_DATE &lt; NOW() then 0 else 1 end as DUE_DATE_TYPE,
v1.PLATE_NUMBER
from
<include refid="tableName"></include> f
left join sys_dictionaries b on f.ANNUAL_INSPECTION_CYCLE = b.DICTIONARIES_ID AND b.PARENT_ID = '8b7dea3977fd4360a3cc8112368b90ff'
INNER JOIN v_traffic v1 on f.VEHICLE = v1.ID
LEFT JOIN bus_traffic_operatingvehicle bto on bto.OPERATING_ID = f.VEHICLE
LEFT JOIN bus_traffic_mechanical_freighttrailer btmf on btmf.FREIGHTTRAILER_ID = f.VEHICLE
where f.ISDELETE = '0' and f.CORPINFO_ID = #{pd.CORPINFO_ID} and (bto.ISSCRAP = '0' OR btmf.ISSCRAP = '0')
<if test="pd.PLATE_NUMBER != null and pd.PLATE_NUMBER != ''">
and v1.PLATE_NUMBER LIKE CONCAT(CONCAT('%', #{pd.PLATE_NUMBER}),'%')
</if>
<if test="pd.CAR_OWNERS != null and pd.CAR_OWNERS != ''">
and f.CAR_OWNERS LIKE CONCAT(CONCAT('%', #{pd.CAR_OWNERS}),'%')
</if>
<if test="pd.REGISTRANT != null and pd.REGISTRANT != ''">
and f.REGISTRANT LIKE CONCAT(CONCAT('%', #{pd.REGISTRANT}),'%')
</if>
<if test="pd.DUE_DATE != null and pd.DUE_DATE != ''">
and f.DUE_DATE = #{pd.DUE_DATE}
</if>
<if test="pd.VEHICLE_MODEL != null and pd.VEHICLE_MODEL != ''">
and f.VEHICLE_MODEL LIKE CONCAT(CONCAT('%', #{pd.VEHICLE_MODEL}),'%')
</if>
<if test="pd.REMINDER_STATUS != null and pd.REMINDER_STATUS != ''">
and f.REMINDER_STATUS = #{pd.REMINDER_STATUS}
</if>
<if test="pd.DUE_DATE_TYPE != null and pd.DUE_DATE_TYPE != ''">
and case when f.DUE_DATE &lt; NOW() then 0 else 1 end = #{pd.DUE_DATE_TYPE}
</if>
ORDER BY f.CREATTIME DESC
</select>
<select id="annuallyList" parameterType="page" resultType="pd">
select
*
from
<include refid="tableName"></include> f
where
f.ISDELETE = '0'
AND
f.CORPINFO_ID = #{pd.CORPINFO_ID}
</select>
<select id="listOut" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where f.ISDELETE = '0'
and f.INSPECTANNUALLY_ID in
<foreach item="item" index="index" open="(" separator="," close=")" collection="ArrayDATA_IDS">
#{item}
</foreach>
</select>
<select id="getYestoday" parameterType="pd" resultType="pd">
select
b.NAME,
case when f.VEHICLE_MODEL = '1' then '营运车辆' else '货运挂车' end as VEHICLEMODEL,
f.*,
v1.PLATE_NUMBER
from
<include refid="tableName"></include> f
LEFT JOIN sys_dictionaries b on f.ANNUAL_INSPECTION_CYCLE = b.DICTIONARIES_ID AND b.PARENT_ID = '8b7dea3977fd4360a3cc8112368b90ff'
INNER JOIN v_traffic v1 on f.VEHICLE = v1.ID
LEFT JOIN bus_traffic_operatingvehicle bto on bto.OPERATING_ID = f.VEHICLE
LEFT JOIN bus_traffic_mechanical_freighttrailer btmf on btmf.FREIGHTTRAILER_ID = f.VEHICLE
where f.ISDELETE = '0'
AND (bto.ISSCRAP = '0' OR btmf.ISSCRAP = '0')
AND f.DUE_DATE != ''
AND TO_DAYS( NOW() ) - TO_DAYS( f.DUE_DATE ) = 0
AND f.REMINDER_STATUS = '1'
</select>
</mapper>

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.datasource.inspectAnnually.InspectAnnuallyWxMapper">
<!--表名 -->
<sql id="tableName">
BUS_SPECIALEQUIPMENTWXJ
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.SPECIALEQUIPMENT_ID,
f.INSPECTOR,
f.INSPECTIONTIME,
f.INSPECTIONCONTENT,
f.ISFAULT,
f.PERIOD_START_DATE,
f.PERIOD_END_DATE,
f.CREATOR,
f.CREATTIME,
f.OPERATOR,
f.OPERATTIME,
f.ISDELETE,
f.CORPINFO_ID,
f.SPECIALEQUIPMENTWXJ_ID
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
SPECIALEQUIPMENT_ID,
INSPECTOR,
INSPECTIONTIME,
INSPECTIONCONTENT,
ISFAULT,
PERIOD_START_DATE,
PERIOD_END_DATE,
CREATOR,
CREATTIME,
OPERATOR,
OPERATTIME,
ISDELETE,
CORPINFO_ID,
SPECIALEQUIPMENTWXJ_ID
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{SPECIALEQUIPMENT_ID},
#{INSPECTOR},
#{INSPECTIONTIME},
#{INSPECTIONCONTENT},
#{ISFAULT},
#{PERIOD_START_DATE},
#{PERIOD_END_DATE},
#{CREATOR},
#{CREATTIME},
#{OPERATOR},
#{OPERATTIME},
#{ISDELETE},
#{CORPINFO_ID},
#{SPECIALEQUIPMENTWXJ_ID}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
</mapper>

View File

@ -18,7 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
p.NAME AS POST_NAME, p.NAME AS POST_NAME,
d.NAME AS DEPARTMENT_NAME d.NAME AS DEPARTMENT_NAME
from from
sys_suer f sys_user f
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=f.DEPARTMENT_ID left join OA_DEPARTMENT d on d.DEPARTMENT_ID=f.DEPARTMENT_ID
left join SYS_POST p on p.POST_ID=f.POST_ID left join SYS_POST p on p.POST_ID=f.POST_ID
where where