1.迁移资质预警代码到自助平台
parent
9037b42fb6
commit
de03676edf
@ -0,0 +1,71 @@
|
|||||||
|
package com.glxp.api.controller.purchase;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.glxp.api.common.enums.ResultEnum;
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.common.util.ResultVOUtils;
|
||||||
|
import com.glxp.api.req.purchase.FilterCertRemindMsgRequest;
|
||||||
|
import com.glxp.api.res.purchase.SupCertRemindMsgResponse;
|
||||||
|
import com.glxp.api.service.purchase.SupCertRemindMsgService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资质预警信息接口
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
public class SupCertRemindMsgController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SupCertRemindMsgService supCertRemindMsgService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询资质预警信息列表
|
||||||
|
*
|
||||||
|
* @param filterCertRemindMsgRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/sup/cert/remind/msg/filter")
|
||||||
|
public BaseResponse filterList(FilterCertRemindMsgRequest filterCertRemindMsgRequest) {
|
||||||
|
List<SupCertRemindMsgResponse> list = supCertRemindMsgService.filterList(filterCertRemindMsgRequest);
|
||||||
|
PageInfo<SupCertRemindMsgResponse> pageInfo = new PageInfo<>(list);
|
||||||
|
return ResultVOUtils.page(pageInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认消息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param handleMsg 处理方式
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/sup/cert/remind/msg/confirmMsg")
|
||||||
|
public BaseResponse confirmMsg(Integer id, String handleMsg) {
|
||||||
|
if (null == id || StrUtil.isBlank(handleMsg)) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
return supCertRemindMsgService.confirmMsg(id, handleMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略消息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param ignoreStatus 忽略状态
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/sup/cert/remind/msg/ignoreMsg")
|
||||||
|
public BaseResponse ignoreMsg(Integer id, Integer ignoreStatus) {
|
||||||
|
if (null == id || null == ignoreStatus) {
|
||||||
|
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
|
||||||
|
}
|
||||||
|
return supCertRemindMsgService.ignoreMsg(id, ignoreStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.glxp.api.dao.purchase;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.glxp.api.entity.purchase.SupCertRemindMsgEntity;
|
||||||
|
import com.glxp.api.req.purchase.FilterCertRemindMsgRequest;
|
||||||
|
import com.glxp.api.res.purchase.SupCertRemindMsgResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SupCertRemindMsgDao extends BaseMapper<SupCertRemindMsgEntity> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询供应商资质预警信息
|
||||||
|
*
|
||||||
|
* @param filterCertRemindMsgRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SupCertRemindMsgResponse> selectSupRemindMsgList(FilterCertRemindMsgRequest filterCertRemindMsgRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询生产企业资质预警信息
|
||||||
|
*
|
||||||
|
* @param filterCertRemindMsgRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SupCertRemindMsgResponse> selectManufactureRemindMsgList(FilterCertRemindMsgRequest filterCertRemindMsgRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询产品资质预警信息
|
||||||
|
*
|
||||||
|
* @param filterCertRemindMsgRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SupCertRemindMsgResponse> selectProductRemindMsgList(FilterCertRemindMsgRequest filterCertRemindMsgRequest);
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
package com.glxp.api.service.purchase;
|
||||||
|
|
||||||
|
import com.glxp.api.common.res.BaseResponse;
|
||||||
|
import com.glxp.api.req.purchase.FilterCertRemindMsgRequest;
|
||||||
|
import com.glxp.api.res.purchase.SupCertRemindMsgResponse;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资质预警信息Service
|
||||||
|
*/
|
||||||
|
public interface SupCertRemindMsgService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询资质预警信息列表
|
||||||
|
*
|
||||||
|
* @param filterCertRemindMsgRequest
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<SupCertRemindMsgResponse> filterList(FilterCertRemindMsgRequest filterCertRemindMsgRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确认消息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param handleMsg
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse confirmMsg(Integer id, String handleMsg);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 忽略消息
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param ignoreStatus
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
BaseResponse ignoreMsg(Integer id, Integer ignoreStatus);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成预警信息
|
||||||
|
*/
|
||||||
|
void createRemindMsg();
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,47 @@
|
|||||||
|
package com.glxp.api.task;
|
||||||
|
|
||||||
|
import com.glxp.api.dao.schedule.ScheduledDao;
|
||||||
|
import com.glxp.api.entity.system.ScheduledEntity;
|
||||||
|
import com.glxp.api.req.system.ScheduledRequest;
|
||||||
|
import com.glxp.api.service.purchase.SupCertRemindMsgService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.SchedulingConfigurer;
|
||||||
|
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
|
||||||
|
import org.springframework.scheduling.support.CronTrigger;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 资质证书定时任务
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class SupCertRemindMsgTask implements SchedulingConfigurer {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ScheduledDao scheduledDao;
|
||||||
|
@Resource
|
||||||
|
private SupCertRemindMsgService supCertRemindMsgService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
|
||||||
|
taskRegistrar.addTriggerTask(this::process, triggerContext -> {
|
||||||
|
ScheduledRequest scheduledRequest = new ScheduledRequest();
|
||||||
|
scheduledRequest.setCronName("supCertRemindMsgTask");
|
||||||
|
ScheduledEntity scheduled = scheduledDao.findScheduled(scheduledRequest);
|
||||||
|
if (null == scheduled) {
|
||||||
|
log.error("资质预警预警定时任务未配置,请注意!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String cron = scheduled.getCron();
|
||||||
|
return new CronTrigger(cron).nextExecutionTime(triggerContext);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void process() {
|
||||||
|
log.info("开始扫描资质证书信息,生成资质预警消息");
|
||||||
|
supCertRemindMsgService.createRemindMsg();
|
||||||
|
log.info("资质证书预警信息生成结束");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,81 @@
|
|||||||
|
<?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.glxp.api.dao.purchase.SupCertRemindMsgDao">
|
||||||
|
<select id="selectSupRemindMsgList" resultType="com.glxp.api.res.purchase.SupCertRemindMsgResponse">
|
||||||
|
select m.*,
|
||||||
|
c.companyName `name`,
|
||||||
|
(select `name` from sup_cert s where s.code = m.code and s.CustomerId = m.idFk) certName
|
||||||
|
from sup_cert_remind_msg m
|
||||||
|
left join sup_company c on m.idFk = c.customerId
|
||||||
|
<where>
|
||||||
|
<if test="supId != null and supId != ''">
|
||||||
|
AND m.idFk = #{supId}
|
||||||
|
</if>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
AND c.companyName like concat('%', #{name}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
AND m.status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="ignoreStatus != null">
|
||||||
|
AND m.ignoreStatus = #{ignoreStatus}
|
||||||
|
</if>
|
||||||
|
<if test="type != null">
|
||||||
|
AND m.type = #{type}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by m.updateTime desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectManufactureRemindMsgList" resultType="com.glxp.api.res.purchase.SupCertRemindMsgResponse">
|
||||||
|
select m.*,
|
||||||
|
c.companyName `name`,
|
||||||
|
(select `name` from sup_cert s where s.code = m.code and s.manufacturerIdFk = m.idFk) certName
|
||||||
|
from sup_cert_remind_msg m
|
||||||
|
left join sup_manufacturer c on m.idFk = c.customerId
|
||||||
|
<where>
|
||||||
|
<if test="supId != null and supId != ''">
|
||||||
|
AND c.customerId = #{supId}
|
||||||
|
</if>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
AND c.companyName like concat('%', #{name}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
AND m.status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="ignoreStatus != null">
|
||||||
|
AND m.ignoreStatus = #{ignoreStatus}
|
||||||
|
</if>
|
||||||
|
<if test="type != null">
|
||||||
|
AND m.type = #{type}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by m.updateTime desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectProductRemindMsgList" resultType="com.glxp.api.res.purchase.SupCertRemindMsgResponse">
|
||||||
|
select m.*,
|
||||||
|
c.recordProductName `name`,
|
||||||
|
(select `name` from sup_cert s where s.code = m.code and s.productIdFk = m.idFk) certName
|
||||||
|
from sup_cert_remind_msg m
|
||||||
|
left join sup_product c on m.idFk = c.productId
|
||||||
|
<where>
|
||||||
|
<if test="supId != null and supId != ''">
|
||||||
|
AND c.customerId = #{supId}
|
||||||
|
</if>
|
||||||
|
<if test="name != null and name != ''">
|
||||||
|
AND c.recordProductName like concat('%', #{name}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="status != null">
|
||||||
|
AND m.status = #{status}
|
||||||
|
</if>
|
||||||
|
<if test="ignoreStatus != null">
|
||||||
|
AND m.ignoreStatus = #{ignoreStatus}
|
||||||
|
</if>
|
||||||
|
<if test="type != null">
|
||||||
|
AND m.type = #{type}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by m.updateTime desc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue