23 changed files with 556 additions and 12 deletions
@ -0,0 +1,44 @@ |
|||||||
|
package com.hnac.hzims.basic.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.SqlCondition; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.core.mp.support.QueryField; |
||||||
|
import org.springblade.core.tenant.mp.TenantEntity; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 实体类 |
||||||
|
* @author Chill |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@TableName("hzims_certificatet_notice") |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
@ApiModel(value = "证书通知配置表", description = "证书通知配置表") |
||||||
|
public class CertificatetNoticeEntity extends TenantEntity { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* 通知类型 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "通知类型") |
||||||
|
@QueryField(condition = SqlCondition.EQUAL) |
||||||
|
private String sendType; |
||||||
|
/** |
||||||
|
* 距离过期前几天通知 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "距离过期前几天通知") |
||||||
|
@QueryField(condition = SqlCondition.EQUAL) |
||||||
|
private Integer safeTime; |
||||||
|
/** |
||||||
|
* 通知用户 |
||||||
|
*/ |
||||||
|
@ApiModelProperty(value = "通知用户") |
||||||
|
@QueryField(condition = SqlCondition.LIKE) |
||||||
|
private String noticeUsers; |
||||||
|
} |
@ -0,0 +1,63 @@ |
|||||||
|
package com.hnac.hzims.basic.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; |
||||||
|
import com.hnac.hzims.basic.service.IImsCertificatetNoticeService; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import org.springblade.core.boot.ctrl.BladeController; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.core.tool.utils.ObjectUtil; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 控制器 |
||||||
|
* |
||||||
|
* @author Chill |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@AllArgsConstructor |
||||||
|
@RequestMapping("/certificatetNotice") |
||||||
|
@Api(value = "档案通知配置页面", tags = "档案通知配置页面") |
||||||
|
public class CertificatetNoticeController extends BladeController { |
||||||
|
|
||||||
|
|
||||||
|
private final IImsCertificatetNoticeService iImsCertificatetNoticeService; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 新增或修改 |
||||||
|
*/ |
||||||
|
@PostMapping("/submit") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "增加", notes = "传入imsDutyClass") |
||||||
|
public R submit(@RequestBody CertificatetNoticeEntity certificatetNoticeEntity) { |
||||||
|
Boolean submit = iImsCertificatetNoticeService.saveOrUpdate(certificatetNoticeEntity); |
||||||
|
if (submit) { |
||||||
|
return R.success("保存成功"); |
||||||
|
} |
||||||
|
return R.fail("保存失败"); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 新增或修改 |
||||||
|
*/ |
||||||
|
@PostMapping("/getCertificatetNotice") |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "增加", notes = "传入imsDutyClass") |
||||||
|
public R getCertificatetNotice() { |
||||||
|
CertificatetNoticeEntity res = iImsCertificatetNoticeService.getOne(Wrappers.<CertificatetNoticeEntity>lambdaQuery() |
||||||
|
.eq(CertificatetNoticeEntity::getIsDeleted, 0) |
||||||
|
.last("limit 1;")); |
||||||
|
if (ObjectUtil.isNotEmpty(res)) { |
||||||
|
return R.data(res); |
||||||
|
} |
||||||
|
return R.data(""); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
package com.hnac.hzims.basic.mapper; |
||||||
|
|
||||||
|
import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mapper 接口 |
||||||
|
* |
||||||
|
* @author Chill |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface CertificatetNoticeMapper extends UserDataScopeBaseMapper<CertificatetNoticeEntity> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
<?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.hnac.hzims.basic.mapper.CertificatetNoticeMapper"> |
||||||
|
|
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,13 @@ |
|||||||
|
package com.hnac.hzims.basic.service; |
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; |
||||||
|
|
||||||
|
/** |
||||||
|
* 服务类 |
||||||
|
* |
||||||
|
* @author Chill |
||||||
|
*/ |
||||||
|
public interface IImsCertificatetNoticeService extends IService<CertificatetNoticeEntity> { |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.hnac.hzims.basic.service.impl; |
||||||
|
|
||||||
|
import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; |
||||||
|
import com.hnac.hzims.basic.mapper.CertificatetNoticeMapper; |
||||||
|
import com.hnac.hzims.basic.service.IImsCertificatetNoticeService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 证书实现类 |
||||||
|
* @author ty |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
@Slf4j |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class CertificatetNoticeServiceImpl extends BaseServiceImpl<CertificatetNoticeMapper, CertificatetNoticeEntity> implements IImsCertificatetNoticeService { |
||||||
|
} |
@ -0,0 +1,15 @@ |
|||||||
|
package com.hnac.hzims.scheduled.mapper.basic; |
||||||
|
|
||||||
|
import com.hnac.hzims.basic.entity.CertificatetEntity; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mapper 接口 |
||||||
|
* |
||||||
|
* @author Chill |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface CertificatetMapper extends UserDataScopeBaseMapper<CertificatetEntity> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
<?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.hnac.hzims.scheduled.mapper.basic.CertificatetMapper"> |
||||||
|
|
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,15 @@ |
|||||||
|
package com.hnac.hzims.scheduled.mapper.basic; |
||||||
|
|
||||||
|
import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mapper 接口 |
||||||
|
* |
||||||
|
* @author Chill |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface CertificatetNoticeMapper extends UserDataScopeBaseMapper<CertificatetNoticeEntity> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
<?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.hnac.hzims.scheduled.mapper.basic.CertificatetNoticeMapper"> |
||||||
|
|
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,29 @@ |
|||||||
|
package com.hnac.hzims.scheduled.mapper.basic; |
||||||
|
|
||||||
|
import com.hnac.hzims.basic.entity.PersonManagemetEntity; |
||||||
|
import com.hnac.hzims.basic.vo.PersonManagemetVo; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mapper 接口 |
||||||
|
* |
||||||
|
* @author Chill |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface PersonManagemetMapper extends UserDataScopeBaseMapper<PersonManagemetEntity> { |
||||||
|
|
||||||
|
List<PersonManagemetVo> getPersonManagemetEntity( |
||||||
|
@Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, |
||||||
|
@Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, |
||||||
|
@Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "current")Integer current, @Param(value = "size")Integer size) ; |
||||||
|
Integer getCountByPersonManagemetEntity( |
||||||
|
@Param(value = "type")String type, @Param(value = "deadStartTime") Date deadStartTime, @Param(value = "deadTime")Date deadTime, |
||||||
|
@Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, |
||||||
|
@Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "current")Integer current, @Param(value = "size")Integer size) ; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,97 @@ |
|||||||
|
<?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.hnac.hzims.scheduled.mapper.basic.PersonManagemetMapper"> |
||||||
|
|
||||||
|
<!--嵌套结果的 resultMap--> |
||||||
|
<resultMap id="PersonManagemetMap" type="com.hnac.hzims.basic.vo.PersonManagemetVo"> |
||||||
|
<id property="id" column="id" jdbcType="VARCHAR" /> |
||||||
|
<result property="name" column="name" jdbcType="VARCHAR" /> |
||||||
|
<result property="unitName" column="unitName" jdbcType="VARCHAR" /> |
||||||
|
<result property="sex" column="sex" jdbcType="VARCHAR" /> |
||||||
|
<result property="job" column="job" jdbcType="VARCHAR" /> |
||||||
|
<result property="academicTitle" column="academic_title" jdbcType="VARCHAR"/> |
||||||
|
<result property="phone" column="phone" jdbcType="VARCHAR"/> |
||||||
|
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/> |
||||||
|
<collection property="certificatetEntityList" ofType="com.hnac.hzims.basic.entity.CertificatetEntity"> |
||||||
|
<id property="id" column="certificatetId" /> |
||||||
|
<result property="personId" column="person_id" /> |
||||||
|
<result property="type" column="type" /> |
||||||
|
<result property="deadTime" column="dead_time" /> |
||||||
|
<result property="pic" column="pic" /> |
||||||
|
<result property="status" column="status" /> |
||||||
|
<result property="isDead" column="isDead" /> |
||||||
|
</collection> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<!--嵌套查询--> |
||||||
|
<select id="getPersonManagemetEntity" resultMap="PersonManagemetMap"> |
||||||
|
select a.id ,a.name,a.unit_name ,a.sex,a.job ,a.academic_title,a.phone ,a.CREATE_TIME, |
||||||
|
b.id as certificatetId,b.person_id,b.type,b.dead_time,b.pic,b.CREATE_TIME,b.status,b.create_dept, |
||||||
|
case when b.dead_time < NOW() then "过期" else "未过期" end as isDead |
||||||
|
from hzims_person_managemet as a |
||||||
|
left join hzims_certificatet as b |
||||||
|
on a.id=b.person_id |
||||||
|
where a.is_deleted = 0 and b.is_deleted = 0 |
||||||
|
<if test="type != null and type != ''"> |
||||||
|
and b.type = #{type} |
||||||
|
</if> |
||||||
|
<if test="deadStartTime != null and type != ''"> |
||||||
|
and b.dead_time >= #{deadStartTime} |
||||||
|
</if> |
||||||
|
<if test="deadTime != null and type != ''"> |
||||||
|
and b.dead_time <= #{deadTime} |
||||||
|
</if> |
||||||
|
<if test="name != null and name != ''"> |
||||||
|
and a.name like CONCAT('%',#{name},'%') |
||||||
|
</if> |
||||||
|
<if test="unitName != null and unitName != ''"> |
||||||
|
and a.unit_name like CONCAT('%',#{unitName},'%') |
||||||
|
</if> |
||||||
|
<if test="sex != null and sex != ''"> |
||||||
|
and a.sex = #{sex} |
||||||
|
</if> |
||||||
|
<if test="job != null and job != ''"> |
||||||
|
and a.job like CONCAT('%',#{job},'%') |
||||||
|
</if> |
||||||
|
<if test="academicTitle != null and academicTitle != ''"> |
||||||
|
and a.academic_title like CONCAT('%',#{academic_title},'%') |
||||||
|
</if> |
||||||
|
LIMIT #{current}, #{size} |
||||||
|
</select> |
||||||
|
<!--嵌套查询--> |
||||||
|
<select id="getCountByPersonManagemetEntity" resultType="Integer"> |
||||||
|
select count(*) |
||||||
|
from hzims_person_managemet as a |
||||||
|
left join hzims_certificatet as b |
||||||
|
on a.id=b.person_id |
||||||
|
where a.is_deleted = 0 and b.is_deleted = 0 |
||||||
|
<if test="type != null and type != ''"> |
||||||
|
and b.type = #{type} |
||||||
|
</if> |
||||||
|
<if test="deadStartTime != null and type != ''"> |
||||||
|
and b.dead_time >= #{deadStartTime} |
||||||
|
</if> |
||||||
|
<if test="deadTime != null and type != ''"> |
||||||
|
and b.dead_time <= #{deadTime} |
||||||
|
</if> |
||||||
|
<if test="name != null and name != ''"> |
||||||
|
and a.name like CONCAT('%',#{name},'%') |
||||||
|
</if> |
||||||
|
<if test="unitName != null and unitName != ''"> |
||||||
|
and a.unit_name like CONCAT('%',#{unitName},'%') |
||||||
|
</if> |
||||||
|
<if test="sex != null and sex != ''"> |
||||||
|
and a.sex = #{sex} |
||||||
|
</if> |
||||||
|
<if test="job != null and job != ''"> |
||||||
|
and a.job like CONCAT('%',#{job},'%') |
||||||
|
</if> |
||||||
|
<if test="academicTitle != null and academicTitle != ''"> |
||||||
|
and a.academic_title like CONCAT('%',#{academic_title},'%') |
||||||
|
</if> |
||||||
|
<if test="status != null and status != ''"> |
||||||
|
and b.status =#{status} |
||||||
|
</if> |
||||||
|
</select> |
||||||
|
</mapper> |
||||||
|
|
@ -0,0 +1,141 @@ |
|||||||
|
package com.hnac.hzims.scheduled.scheduled; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.hnac.hzims.basic.entity.CertificatetEntity; |
||||||
|
import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; |
||||||
|
import com.hnac.hzims.basic.entity.PersonManagemetEntity; |
||||||
|
import com.hnac.hzims.message.MessageConstants; |
||||||
|
import com.hnac.hzims.message.dto.BusinessMessageDTO; |
||||||
|
import com.hnac.hzims.message.entity.config.SmsConfigEntity; |
||||||
|
import com.hnac.hzims.message.fegin.IMessageClient; |
||||||
|
import com.hnac.hzims.message.fegin.IMessageConfigClient; |
||||||
|
import com.hnac.hzims.scheduled.mapper.basic.PersonManagemetMapper; |
||||||
|
import com.hnac.hzims.scheduled.service.basic.IImsCertificatetNoticeService; |
||||||
|
import com.hnac.hzims.scheduled.service.basic.IImsCertificatetService; |
||||||
|
import com.xxl.job.core.biz.model.ReturnT; |
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.core.tool.utils.CollectionUtil; |
||||||
|
import org.springblade.core.tool.utils.DateUtil; |
||||||
|
import org.springblade.core.tool.utils.Func; |
||||||
|
import org.springblade.core.tool.utils.ObjectUtil; |
||||||
|
import org.springblade.system.feign.ISysClient; |
||||||
|
import org.springblade.system.user.cache.UserCache; |
||||||
|
import org.springblade.system.user.entity.User; |
||||||
|
import org.springblade.system.user.feign.IUserClient; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import java.text.ParseException; |
||||||
|
import java.text.SimpleDateFormat; |
||||||
|
import java.util.*; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
import static com.hnac.hzims.operational.main.constant.MainConstants.*; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 排班到期定时任务通知 |
||||||
|
* |
||||||
|
* @author ty |
||||||
|
*/ |
||||||
|
@Slf4j |
||||||
|
@Component |
||||||
|
public class basicScheduledTask { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IImsCertificatetService iImsCertificatetService; |
||||||
|
@Autowired |
||||||
|
private IImsCertificatetNoticeService iImsCertificatetNoticeService; |
||||||
|
@Autowired |
||||||
|
private ISysClient sysClient; |
||||||
|
@Autowired |
||||||
|
private IUserClient userClient; |
||||||
|
@Autowired |
||||||
|
private IMessageClient messageClient; |
||||||
|
@Autowired |
||||||
|
private PersonManagemetMapper personManagemetMapper; |
||||||
|
@Autowired |
||||||
|
private IMessageConfigClient messageConfigClient; |
||||||
|
|
||||||
|
/** |
||||||
|
* realId刷新 |
||||||
|
*/ |
||||||
|
@XxlJob(CERTIFICATET_DEAD_LINE_NOTICE) |
||||||
|
// @Scheduled(cron = "0 */1 * * * ? ")
|
||||||
|
public ReturnT<String> certificatetDeadLineNotice(String param) throws ParseException { |
||||||
|
Date endTime = new Date(); |
||||||
|
if (Func.isBlank(param)) { |
||||||
|
endTime = new SimpleDateFormat("yyyy-MM-dd").parse(param); |
||||||
|
} |
||||||
|
CertificatetNoticeEntity noticeEntity = iImsCertificatetNoticeService.getOne(Wrappers.<CertificatetNoticeEntity>lambdaQuery() |
||||||
|
.eq(CertificatetNoticeEntity::getIsDeleted, 0) |
||||||
|
.last("limit 1;")); |
||||||
|
//用户档案过期截止时间
|
||||||
|
Date date = DateUtil.plusDays(endTime, noticeEntity.getSafeTime()); |
||||||
|
List<CertificatetEntity> list = iImsCertificatetService.list(Wrappers.<CertificatetEntity>lambdaQuery() |
||||||
|
.le(CertificatetEntity::getDeadTime, date)); |
||||||
|
String noticeUsers = noticeEntity.getNoticeUsers(); |
||||||
|
List<String> userList = Arrays.asList(noticeUsers.split(",")); |
||||||
|
if (CollectionUtil.isNotEmpty(userList) && CollectionUtil.isNotEmpty(list)) { |
||||||
|
List<String> personIds = list.stream().map(CertificatetEntity::getPersonId).collect(Collectors.toList()); |
||||||
|
List<PersonManagemetEntity> personManagemetEntities = personManagemetMapper.selectList(Wrappers.<PersonManagemetEntity>query().lambda().in(PersonManagemetEntity::getId, personIds)); |
||||||
|
String personNotice=""; |
||||||
|
if (CollectionUtil.isNotEmpty(personManagemetEntities)) { |
||||||
|
personNotice = personManagemetEntities.stream().map(PersonManagemetEntity::getName).collect(Collectors.joining(",")); |
||||||
|
} |
||||||
|
if ("1".equals(noticeEntity.getSendType())) { |
||||||
|
sendSmsByUserList(userList, date,personNotice); |
||||||
|
} |
||||||
|
sendMessage(list.get(0), noticeEntity.getSafeTime(), noticeEntity.getNoticeUsers(),personNotice); |
||||||
|
} |
||||||
|
return new ReturnT<>("SUCCESS"); |
||||||
|
} |
||||||
|
|
||||||
|
private void sendSmsByUserList(List<String> userList, Date date,String personNotice) { |
||||||
|
//区分用户
|
||||||
|
for (String s : userList) { |
||||||
|
User user = UserCache.getUser(Long.valueOf(s)); |
||||||
|
String phone = ""; |
||||||
|
if (ObjectUtil.isNotEmpty(user)) { |
||||||
|
phone = user.getPhone(); |
||||||
|
} |
||||||
|
//短信推送
|
||||||
|
String code = "certificatetNotice"; |
||||||
|
SmsConfigEntity smsConfigEntity = messageConfigClient.getSmsConfigByBusinessKey(code); |
||||||
|
Map<String, String> contentParams = new HashMap<>(2); |
||||||
|
contentParams.put("one", personNotice); |
||||||
|
String deadLine = DateUtil.format(date, "yyyy-MM-dd"); |
||||||
|
contentParams.put("two", deadLine); |
||||||
|
smsConfigEntity.setTemplateParam(JSONObject.toJSONString(contentParams)); |
||||||
|
smsConfigEntity.setPhones(phone); |
||||||
|
messageConfigClient.pushSmsMessageByConfig(smsConfigEntity); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void sendMessage(CertificatetEntity certificatetEntity, Integer date, String users,String personNotice) { |
||||||
|
// //注意:通知人是创建人所在机构
|
||||||
|
BusinessMessageDTO message = new BusinessMessageDTO(); |
||||||
|
message.setBusinessClassify("system"); |
||||||
|
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.CERTIFICATETNOTICE.getKey()); |
||||||
|
message.setSubject(MessageConstants.BusinessClassifyEnum.CERTIFICATETNOTICE.getDescription()); |
||||||
|
message.setTaskId(System.currentTimeMillis()); |
||||||
|
message.setTenantId("200000"); |
||||||
|
String countent = |
||||||
|
personNotice + "的证书即将到期,请提交新的证书资料"; |
||||||
|
message.setContent(countent); |
||||||
|
message.setDeptId(certificatetEntity.getCreateDept()); |
||||||
|
R<String> deptName = sysClient.getDeptName(certificatetEntity.getCreateDept()); |
||||||
|
if (deptName.isSuccess()) { |
||||||
|
message.setDeptName(deptName.getData()); |
||||||
|
} |
||||||
|
message.setUserIds(users); |
||||||
|
User admin = userClient.userByAccount("200000", "admin").getData(); |
||||||
|
message.setCreateUser(admin.getId()); |
||||||
|
messageClient.sendAppAndWsMsgByUsers(message); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.hnac.hzims.scheduled.service.basic; |
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; |
||||||
|
|
||||||
|
/** |
||||||
|
* 服务类 |
||||||
|
* |
||||||
|
* @author Chill |
||||||
|
*/ |
||||||
|
public interface IImsCertificatetNoticeService extends IService<CertificatetNoticeEntity> { |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.hnac.hzims.scheduled.service.basic; |
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
import com.hnac.hzims.basic.entity.CertificatetEntity; |
||||||
|
|
||||||
|
/** |
||||||
|
* 服务类 |
||||||
|
* |
||||||
|
* @author Chill |
||||||
|
*/ |
||||||
|
public interface IImsCertificatetService extends IService<CertificatetEntity> { |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.hnac.hzims.scheduled.service.basic.impl; |
||||||
|
|
||||||
|
import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; |
||||||
|
import com.hnac.hzims.scheduled.mapper.basic.CertificatetNoticeMapper; |
||||||
|
import com.hnac.hzims.scheduled.service.basic.IImsCertificatetNoticeService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
|
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 证书实现类 |
||||||
|
* @author ty |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
@Slf4j |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class CertificatetNoticeServiceImpl extends BaseServiceImpl<CertificatetNoticeMapper, CertificatetNoticeEntity> implements IImsCertificatetNoticeService { |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.hnac.hzims.scheduled.service.basic.impl; |
||||||
|
|
||||||
|
import com.hnac.hzims.basic.entity.CertificatetEntity; |
||||||
|
import com.hnac.hzims.scheduled.mapper.basic.CertificatetMapper; |
||||||
|
import com.hnac.hzims.scheduled.service.basic.IImsCertificatetService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 证书实现类 |
||||||
|
* @author ty |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
@Slf4j |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class CertificatetServiceImpl extends BaseServiceImpl<CertificatetMapper, CertificatetEntity> implements IImsCertificatetService { |
||||||
|
} |
Loading…
Reference in new issue