haungxing
11 months ago
73 changed files with 2515 additions and 568 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,59 @@
|
||||
package com.hnac.hzims.safeproduct.dto; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Data |
||||
@ExcelIgnoreUnannotated |
||||
@ApiModel(value = "会议数据导出DTO类") |
||||
public class ConferenceExportDTO { |
||||
|
||||
@ApiModelProperty("单位") |
||||
@ExcelProperty(value = "单位", index = 0) |
||||
private String unit; |
||||
|
||||
@ApiModelProperty("会议计划开始时间") |
||||
@ExcelProperty(value = "会议计划开始时间", index = 1) |
||||
private Date scheduledStartTime; |
||||
|
||||
@ApiModelProperty("会议计划结束时间") |
||||
@ExcelProperty(value = "会议计划结束时间", index = 2) |
||||
private Date scheduledEndTime; |
||||
|
||||
@ApiModelProperty("会议主题") |
||||
@ExcelProperty(value = "会议主题", index = 3) |
||||
private String theme; |
||||
|
||||
@ApiModelProperty("会议地点") |
||||
@ExcelProperty(value = "会议地点", index = 4) |
||||
private String location; |
||||
|
||||
@ApiModelProperty("会议方式") |
||||
@ExcelProperty(value = "会议方式", index = 5) |
||||
private String conferenceMethod; |
||||
|
||||
@ApiModelProperty("主持人") |
||||
@ExcelProperty(value = "主持人", index = 6) |
||||
private String host; |
||||
|
||||
@ApiModelProperty("会议实际开始时间") |
||||
@ExcelProperty(value = "会议实际开始时间", index = 7) |
||||
private Date actualStartTime; |
||||
|
||||
@ApiModelProperty("会议实际结束时间") |
||||
@ExcelProperty(value = "会议实际结束时间", index = 8) |
||||
private Date actualEndTime; |
||||
|
||||
@ApiModelProperty("会议状态") |
||||
@ExcelProperty(value = "会议状态", index = 9) |
||||
private String conferenceStatus; |
||||
} |
@ -0,0 +1,55 @@
|
||||
package com.hnac.hzims.safeproduct.dto; |
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
||||
import com.alibaba.excel.annotation.ExcelProperty; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Data |
||||
@ExcelIgnoreUnannotated |
||||
@ApiModel(value = "演练数据导出DTO类") |
||||
public class RehearsalExportDTO { |
||||
|
||||
@ApiModelProperty("单位") |
||||
@ExcelProperty(value = "单位", index = 0) |
||||
private String unit; |
||||
|
||||
@ApiModelProperty("演练科目") |
||||
@ExcelProperty(value = "演练科目", index = 1) |
||||
private String subject; |
||||
|
||||
@ApiModelProperty("演练计划开始时间") |
||||
@ExcelProperty(value = "演练计划开始时间", index = 2) |
||||
private Date scheduledStartTime; |
||||
|
||||
@ApiModelProperty("演练计划结束时间") |
||||
@ExcelProperty(value = "演练计划结束时间", index = 3) |
||||
private Date scheduledEndTime; |
||||
|
||||
@ApiModelProperty("演练地点") |
||||
@ExcelProperty(value = "演练地点", index = 4) |
||||
private String location; |
||||
|
||||
@ApiModelProperty("参演人数") |
||||
@ExcelProperty(value = "参演人数", index = 5) |
||||
private Integer peopleNum; |
||||
|
||||
@ApiModelProperty("演练实际开始时间") |
||||
@ExcelProperty(value = "演练实际开始时间", index = 6) |
||||
private Date actualStartTime; |
||||
|
||||
@ApiModelProperty("演练实际结束时间") |
||||
@ExcelProperty(value = "演练实际结束时间", index = 7) |
||||
private Date actualEndTime; |
||||
|
||||
@ApiModelProperty("演练状态") |
||||
@ExcelProperty(value = "演练状态", index = 8) |
||||
private String rehearsalStatus; |
||||
} |
@ -0,0 +1,60 @@
|
||||
package com.hnac.hzims.safeproduct.entity; |
||||
|
||||
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.base.BaseEntity; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
import javax.validation.constraints.Size; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@TableName("hzims_conference_plan") |
||||
@ApiModel(value = "会议计划实体类") |
||||
public class ConferencePlanEntity extends BaseEntity { |
||||
|
||||
@NotNull |
||||
@Size(max = 50, message = "单位字段长度不能超过50") |
||||
@ApiModelProperty("单位") |
||||
private String unit; |
||||
|
||||
@NotNull |
||||
@Size(max = 50, message = "会议主题字段长度不能超过50") |
||||
@ApiModelProperty("会议主题") |
||||
private String theme; |
||||
|
||||
@NotNull |
||||
@ApiModelProperty("会议计划开始时间") |
||||
private Date scheduledStartTime; |
||||
|
||||
@NotNull |
||||
@ApiModelProperty("会议计划结束时间") |
||||
private Date scheduledEndTime; |
||||
|
||||
@NotNull |
||||
@Size(max = 255, message = "演练地点字段长度不能超过255") |
||||
@ApiModelProperty("会议地点") |
||||
private String location; |
||||
|
||||
@NotNull |
||||
@Size(max = 10, message = "总指挥字段长度不能超过10") |
||||
@ApiModelProperty("主持人") |
||||
private String host; |
||||
|
||||
@Size(max = 20, message = "会议方式字段长度不能超过20") |
||||
@ApiModelProperty("会议方式") |
||||
private String conferenceMethod; |
||||
|
||||
@NotNull |
||||
@Size(max = 20, message = "会议状态字段长度不能超过20") |
||||
@ApiModelProperty("会议状态") |
||||
private String conferenceStatus; |
||||
} |
@ -0,0 +1,55 @@
|
||||
package com.hnac.hzims.safeproduct.entity; |
||||
|
||||
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.base.BaseEntity; |
||||
|
||||
import javax.validation.constraints.Size; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@TableName("hzims_conference_record") |
||||
@ApiModel(value = "会议记录实体类") |
||||
public class ConferenceRecordEntity extends BaseEntity { |
||||
|
||||
@ApiModelProperty("会议计划id") |
||||
private Long conferencePlanId; |
||||
|
||||
@Size(max = 50, message = "编码字段长度不能超过50") |
||||
@ApiModelProperty("编码") |
||||
private String code; |
||||
|
||||
@Size(max = 5000, message = "参会人员字段长度超出限制范围") |
||||
@ApiModelProperty("参会人员") |
||||
private String peopleName; |
||||
|
||||
@ApiModelProperty("会议实际开始时间") |
||||
private Date actualStartTime; |
||||
|
||||
@ApiModelProperty("会议实际结束时间") |
||||
private Date actualEndTime; |
||||
|
||||
@Size(max = 20, message = "记录人字段长度不能超过20") |
||||
@ApiModelProperty("记录人") |
||||
private String recorder; |
||||
|
||||
@Size(max = 250, message = "会议内容字段长度不能超过250") |
||||
@ApiModelProperty("会议内容") |
||||
private String content; |
||||
|
||||
@Size(max = 1000, message = "会议图片字段长度不能超过1000") |
||||
@ApiModelProperty("会议图片") |
||||
private String imgPath; |
||||
|
||||
@Size(max = 1000, message = "会议附件字段长度不能超过1000") |
||||
@ApiModelProperty("会议附件") |
||||
private String filePath; |
||||
} |
@ -0,0 +1,60 @@
|
||||
package com.hnac.hzims.safeproduct.entity; |
||||
|
||||
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.base.BaseEntity; |
||||
|
||||
import javax.validation.constraints.NotNull; |
||||
import javax.validation.constraints.Size; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = true) |
||||
@TableName("hzims_rehearsal_plan") |
||||
@ApiModel(value = "演练计划实体类") |
||||
public class RehearsalPlanEntity extends BaseEntity { |
||||
|
||||
@NotNull |
||||
@Size(max = 50, message = "单位字段长度不能超过50") |
||||
@ApiModelProperty("单位") |
||||
private String unit; |
||||
|
||||
@NotNull |
||||
@Size(max = 50, message = "演练科目字段长度不能超过50") |
||||
@ApiModelProperty("演练科目") |
||||
private String subject; |
||||
|
||||
@NotNull |
||||
@ApiModelProperty("演练计划开始时间") |
||||
private Date scheduledStartTime; |
||||
|
||||
@NotNull |
||||
@ApiModelProperty("演练计划结束时间") |
||||
private Date scheduledEndTime; |
||||
|
||||
@NotNull |
||||
@Size(max = 255, message = "演练地点字段长度不能超过255") |
||||
@ApiModelProperty("演练地点") |
||||
private String location; |
||||
|
||||
@NotNull |
||||
@Size(max = 10, message = "总指挥字段长度不能超过10") |
||||
@ApiModelProperty("总指挥") |
||||
private String commander; |
||||
|
||||
@Size(max = 20, message = "演练方式字段长度不能超过20") |
||||
@ApiModelProperty("演练方式") |
||||
private String rehearsalMethod; |
||||
|
||||
@NotNull |
||||
@Size(max = 20, message = "演练状态字段长度不能超过20") |
||||
@ApiModelProperty("演练状态") |
||||
private String rehearsalStatus; |
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.hnac.hzims.safeproduct.enums; |
||||
|
||||
/** |
||||
* 会议方式枚举类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
public enum ConferenceMethodEnum { |
||||
|
||||
ONLINE("ONLINE", "线上"), |
||||
OFFLINE("OFFLINE", "线下"), |
||||
MIXED("MIXED", "线上+线下"); |
||||
|
||||
private final String value; |
||||
|
||||
private final String desc; |
||||
|
||||
ConferenceMethodEnum(String value, String desc) { |
||||
this.value = value; |
||||
this.desc = desc; |
||||
} |
||||
|
||||
public String getValue() { |
||||
return value; |
||||
} |
||||
|
||||
public String getDesc() { |
||||
return desc; |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.hnac.hzims.safeproduct.enums; |
||||
|
||||
/** |
||||
* 会议状态枚举类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
public enum ConferenceStatusEnum { |
||||
|
||||
WAITING("WAITING", "未开始"), |
||||
UNFINISHED("UNFINISHED", "未完成"), |
||||
FINISHED("FINISHED", "已完成"); |
||||
|
||||
private final String value; |
||||
|
||||
private final String desc; |
||||
|
||||
ConferenceStatusEnum(String value, String desc) { |
||||
this.value = value; |
||||
this.desc = desc; |
||||
} |
||||
|
||||
public String getValue() { |
||||
return value; |
||||
} |
||||
|
||||
public String getDesc() { |
||||
return desc; |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.hnac.hzims.safeproduct.enums; |
||||
|
||||
/** |
||||
* 培训计划状态枚举类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
public enum TrainStatusEnum { |
||||
|
||||
WAITING("WAITING", "未开始"), |
||||
UNFINISHED("UNFINISHED", "未完成"), |
||||
FINISHED("FINISHED", "已完成"); |
||||
|
||||
private final String value; |
||||
|
||||
private final String desc; |
||||
|
||||
TrainStatusEnum(String value, String desc) { |
||||
this.value = value; |
||||
this.desc = desc; |
||||
} |
||||
|
||||
public String getValue() { |
||||
return value; |
||||
} |
||||
|
||||
public String getDesc() { |
||||
return desc; |
||||
} |
||||
} |
@ -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 { |
||||
} |
@ -0,0 +1,56 @@
|
||||
package com.hnac.hzims.safeproduct.controller; |
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.hnac.hzims.safeproduct.constants.SafeProductConstant; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import org.apache.commons.lang3.StringUtils; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.secure.BladeUser; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springblade.system.feign.ISysClient; |
||||
import org.springblade.system.user.entity.User; |
||||
import org.springblade.system.user.feign.IUserClient; |
||||
import org.springframework.web.bind.annotation.GetMapping; |
||||
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; |
||||
|
||||
/** |
||||
* 公用业务接口类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-28 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/base") |
||||
@Api(value = "公用业务", tags = "公用业务接口") |
||||
public class BaseController extends BladeController { |
||||
|
||||
private final ISysClient sysClient; |
||||
|
||||
private final IUserClient userClient; |
||||
|
||||
@GetMapping("/getDeptName") |
||||
@ApiOperation(value = "获取所属机构名") |
||||
@ApiOperationSupport(order = 1) |
||||
public R<String> getDeptName() { |
||||
BladeUser bladeUser = getUser(); |
||||
String deptId = bladeUser.getDeptId(); |
||||
if (StringUtils.isNotBlank(deptId)) { |
||||
return sysClient.getDeptName(Long.valueOf(deptId)); |
||||
} |
||||
return R.data(null, "所属机构为空"); |
||||
} |
||||
|
||||
@GetMapping("/getUserList") |
||||
@ApiOperation(value = "获取用户列表") |
||||
@ApiOperationSupport(order = 2) |
||||
public R<List<User>> getUserList(@RequestParam String name) { |
||||
return userClient.userListByCodeAndNameAndAccount(SafeProductConstant.TENANT_ID, null, name, null); |
||||
} |
||||
} |
@ -0,0 +1,133 @@
|
||||
package com.hnac.hzims.safeproduct.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||
import com.hnac.hzims.common.utils.Condition; |
||||
import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; |
||||
import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; |
||||
import com.hnac.hzims.safeproduct.service.IConferencePlanService; |
||||
import com.hnac.hzims.safeproduct.service.IConferenceRecordService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiImplicitParam; |
||||
import io.swagger.annotations.ApiImplicitParams; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.AllArgsConstructor; |
||||
import org.springblade.core.boot.ctrl.BladeController; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springblade.core.tool.api.R; |
||||
import org.springframework.web.bind.annotation.*; |
||||
import springfox.documentation.annotations.ApiIgnore; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
import javax.validation.Valid; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 会议管理接口类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@RestController |
||||
@AllArgsConstructor |
||||
@RequestMapping("/conference") |
||||
@Api(value = "会议管理", tags = "会议管理接口") |
||||
public class ConferenceController extends BladeController { |
||||
|
||||
private final IConferencePlanService conferencePlanService; |
||||
|
||||
private final IConferenceRecordService conferenceRecordService; |
||||
|
||||
@PostMapping("/savePlan") |
||||
@ApiOperation(value = "新增会议计划") |
||||
@ApiOperationSupport(order = 1) |
||||
public R savePlan(@Valid @RequestBody ConferencePlanEntity conferencePlan) { |
||||
return R.status(conferencePlanService.save(conferencePlan)); |
||||
} |
||||
|
||||
@PostMapping("/updatePlan") |
||||
@ApiOperation(value = "修改会议计划") |
||||
@ApiOperationSupport(order = 2) |
||||
public R updatePlan(@Valid @RequestBody ConferencePlanEntity conferencePlan) { |
||||
return R.status(conferencePlanService.updateById(conferencePlan)); |
||||
} |
||||
|
||||
@PostMapping("/removePlan") |
||||
@ApiOperation(value = "删除会议计划") |
||||
@ApiOperationSupport(order = 3) |
||||
public R removePlan(@RequestParam Long id) { |
||||
return R.status(conferencePlanService.removePlan(id)); |
||||
} |
||||
|
||||
@GetMapping("/planDetail") |
||||
@ApiOperation(value = "会议计划详情") |
||||
@ApiOperationSupport(order = 4) |
||||
public R<ConferencePlanEntity> planDetail(@RequestParam Long id) { |
||||
return R.data(conferencePlanService.getById(id)); |
||||
} |
||||
|
||||
@GetMapping("/planPage") |
||||
@ApiImplicitParams({ |
||||
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), |
||||
@ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), |
||||
@ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string") |
||||
}) |
||||
@ApiOperation(value = "会议计划分页") |
||||
@ApiOperationSupport(order = 5) |
||||
public R<IPage<ConferencePlanEntity>> planPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { |
||||
IPage<ConferencePlanEntity> page = conferencePlanService.planPage(param, query); |
||||
return R.data(page); |
||||
} |
||||
|
||||
@PostMapping("/saveRecord") |
||||
@ApiOperation(value = "新增会议记录") |
||||
@ApiOperationSupport(order = 6) |
||||
public R saveRecord(@Valid @RequestBody ConferenceRecordEntity conferenceRecord) { |
||||
return R.status(conferenceRecordService.saveRecord(conferenceRecord)); |
||||
} |
||||
|
||||
@PostMapping("/updateRecord") |
||||
@ApiOperation(value = "修改会议记录") |
||||
@ApiOperationSupport(order = 7) |
||||
public R updateRecord(@Valid @RequestBody ConferenceRecordEntity conferenceRecord) { |
||||
return R.status(conferenceRecordService.updateById(conferenceRecord)); |
||||
} |
||||
|
||||
@PostMapping("/removeRecord") |
||||
@ApiOperation(value = "删除会议记录") |
||||
@ApiOperationSupport(order = 8) |
||||
public R removeRecord(@RequestParam Long id) { |
||||
return R.status(conferenceRecordService.removeById(id)); |
||||
} |
||||
|
||||
@GetMapping("/recordDetail") |
||||
@ApiOperation(value = "会议记录详情") |
||||
@ApiOperationSupport(order = 9) |
||||
public R<ConferenceRecordEntity> recordDetail(@RequestParam Long id) { |
||||
return R.data(conferenceRecordService.getById(id)); |
||||
} |
||||
|
||||
@GetMapping("/recordPage") |
||||
@ApiImplicitParams({ |
||||
@ApiImplicitParam(name = "conferencePlanId", value = "会议计划id", dataType = "query", paramType = "string") |
||||
}) |
||||
@ApiOperation(value = "会议记录分页") |
||||
@ApiOperationSupport(order = 10) |
||||
public R<IPage<ConferenceRecordEntity>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { |
||||
IPage<ConferenceRecordEntity> page = conferenceRecordService.page(Condition.getPage(query), |
||||
Condition.getQueryWrapper(param, ConferenceRecordEntity.class)); |
||||
return R.data(page); |
||||
} |
||||
|
||||
@GetMapping("/exportConferenceData") |
||||
@ApiImplicitParams({ |
||||
@ApiImplicitParam(name = "unit", value = "单位", dataType = "query", paramType = "string"), |
||||
@ApiImplicitParam(name = "scheduledStartTime", value = "计划开始时间", dataType = "query", paramType = "string"), |
||||
@ApiImplicitParam(name = "scheduledEndTime", value = "计划结束时间", dataType = "query", paramType = "string") |
||||
}) |
||||
@ApiOperation(value = "会议数据导出") |
||||
@ApiOperationSupport(order = 11) |
||||
public void exportConferenceData(@ApiIgnore @RequestParam Map<String, Object> param, HttpServletResponse response) { |
||||
conferencePlanService.exportConferenceData(param, response); |
||||
} |
||||
} |
@ -0,0 +1,43 @@
|
||||
package com.hnac.hzims.safeproduct.jobs; |
||||
|
||||
import com.hnac.hzims.safeproduct.entity.TrainPlanEntity; |
||||
import com.hnac.hzims.safeproduct.enums.TrainStatusEnum; |
||||
import com.hnac.hzims.safeproduct.service.ITrainPlanService; |
||||
import com.xxl.job.core.biz.model.ReturnT; |
||||
import com.xxl.job.core.handler.annotation.XxlJob; |
||||
import org.springblade.core.tool.utils.DateUtil; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 演练模块定时任务 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Component |
||||
public class TrainJob { |
||||
|
||||
@Autowired |
||||
ITrainPlanService trainPlanService; |
||||
|
||||
@XxlJob("autoChangeTrainPlanStatus") |
||||
public ReturnT<String> autoChangeTrainPlanStatus(String param) { |
||||
// 获取时间范围
|
||||
Date current = DateUtil.now(); |
||||
Date before = DateUtil.minusDays(current, 1); |
||||
String today = DateUtil.format(current, "yyyy-mm-dd hh:MM:ss"); |
||||
String yesterday = DateUtil.format(before, "yyyy-mm-dd hh:MM:ss"); |
||||
// 查询前一天的超时未完成培训计划
|
||||
List<TrainPlanEntity> list = trainPlanService.getWaitingTrainPlanInTimeRange(yesterday, today); |
||||
list.forEach(x -> { |
||||
x.setTrainStatus(TrainStatusEnum.UNFINISHED.getValue()); |
||||
}); |
||||
// 将状态置为未完成
|
||||
boolean flag = trainPlanService.updateBatchById(list); |
||||
return flag ? ReturnT.SUCCESS : ReturnT.FAIL; |
||||
} |
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.hnac.hzims.safeproduct.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzims.safeproduct.dto.ConferenceExportDTO; |
||||
import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 会议计划Mapper类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Mapper |
||||
public interface ConferencePlanMapper extends BaseMapper<ConferencePlanEntity> { |
||||
|
||||
/** |
||||
* 根据单位和计划时间查询会议记录 |
||||
* @param unit 单位 |
||||
* @param startTime 计划开始时间 |
||||
* @param endTime 计划结束时间 |
||||
* @return 会议记录列表 |
||||
*/ |
||||
List<ConferenceExportDTO> getConferenceByUnitAndDate(String unit, String startTime, String endTime); |
||||
} |
@ -0,0 +1,23 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.hnac.hzims.safeproduct.mapper.ConferencePlanMapper"> |
||||
|
||||
<select id="getConferenceByUnitAndDate" resultType="com.hnac.hzims.safeproduct.dto.ConferenceExportDTO"> |
||||
SELECT |
||||
t1.unit, t1.scheduled_start_time, t1.scheduled_end_time, t1.theme, t1.location, t1.conference_method, |
||||
t1.host, t2.actual_start_time, t2.actual_end_time, t1.conference_status |
||||
FROM |
||||
hzims_conference_plan t1 |
||||
LEFT JOIN hzims_conference_record t2 ON t1.id = t2.conference_plan_id |
||||
WHERE |
||||
t1.is_deleted = 0 |
||||
<if test="unit != 'null' and unit != ''"> |
||||
AND t1.unit like concat('%', #{unit}, '%') |
||||
</if> |
||||
<if test="startTime != 'null' and startTime != ''"> |
||||
AND t1.scheduled_start_time >= #{startTime} |
||||
</if> |
||||
<if test="endTime != 'null' and endTime != ''"> |
||||
AND t1.scheduled_end_time < #{endTime} |
||||
</if> |
||||
</select> |
||||
</mapper> |
@ -0,0 +1,16 @@
|
||||
package com.hnac.hzims.safeproduct.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
/** |
||||
* 会议记录Mapper类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Mapper |
||||
public interface ConferenceRecordMapper extends BaseMapper<ConferenceRecordEntity> { |
||||
|
||||
} |
@ -0,0 +1,4 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.hnac.hzims.safeproduct.mapper.ConferenceRecordMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,64 @@
|
||||
package com.hnac.hzims.safeproduct.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.hnac.hzims.safeproduct.dto.AnalysisYearDTO; |
||||
import com.hnac.hzims.safeproduct.dto.RehearsalExportDTO; |
||||
import com.hnac.hzims.safeproduct.entity.RehearsalPlanEntity; |
||||
import com.hnac.hzims.safeproduct.vo.RehearsalMonthVO; |
||||
import com.hnac.hzims.safeproduct.vo.RehearsalYearVO; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 演练计划Mapper类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Mapper |
||||
public interface RehearsalPlanMapper extends BaseMapper<RehearsalPlanEntity> { |
||||
|
||||
/** |
||||
* 查询当月各单位的演练总数 |
||||
* @param page 分页类 |
||||
* @param month 月份 |
||||
* @return 当月的演练总数据 |
||||
*/ |
||||
IPage<RehearsalMonthVO> selectByMonth(IPage<RehearsalMonthVO> page, String month); |
||||
|
||||
/** |
||||
* 查询当月各单位已完成的演练数据 |
||||
* @param page 分页类 |
||||
* @param month 月份 |
||||
* @return 当月的已完成数据 |
||||
*/ |
||||
IPage<RehearsalMonthVO> selectFinishedDataByMonth(IPage<RehearsalMonthVO> page, String month); |
||||
|
||||
/** |
||||
* 查询当年的所有单位 |
||||
* @param page 分页类 |
||||
* @param year 年份 |
||||
* @return 年度单位数据 |
||||
*/ |
||||
IPage<RehearsalYearVO> selectUnitByYear(IPage<RehearsalYearVO> page, @Param("year") String year); |
||||
|
||||
/** |
||||
* 查询各单位全年已完成的演练数据 |
||||
* @param unitList 单元列表 |
||||
* @param year 年份 |
||||
* @return 单位各月的数据列表 |
||||
*/ |
||||
List<AnalysisYearDTO> selectFinishedDataByUnit(@Param("unitList") List<String> unitList, @Param("year") String year); |
||||
|
||||
/** |
||||
* 根据单位和计划时间查询演练数据 |
||||
* @param unit 单位 |
||||
* @param startTime 计划开始时间 |
||||
* @param endTime 计划结束时间 |
||||
* @return 演练数据列表 |
||||
*/ |
||||
List<RehearsalExportDTO> getRehearsalByUnitAndDate(String unit, String startTime, String endTime); |
||||
} |
@ -0,0 +1,84 @@
|
||||
<?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.safeproduct.mapper.RehearsalPlanMapper"> |
||||
|
||||
<select id="selectByMonth" resultType="com.hnac.hzims.safeproduct.vo.RehearsalMonthVO"> |
||||
SELECT |
||||
unit, count(1) as scheduled_task_num |
||||
FROM |
||||
hzims_rehearsal_plan |
||||
WHERE |
||||
is_deleted = 0 |
||||
AND scheduled_end_time like concat('%', #{month}, '%') |
||||
GROUP BY |
||||
unit |
||||
ORDER BY |
||||
unit |
||||
</select> |
||||
|
||||
<select id="selectFinishedDataByMonth" resultType="com.hnac.hzims.safeproduct.vo.RehearsalMonthVO"> |
||||
SELECT |
||||
unit, count(1) as finished_task_num |
||||
FROM |
||||
hzims_rehearsal_plan |
||||
WHERE |
||||
is_deleted = 0 |
||||
AND scheduled_end_time like concat('%', #{month}, '%') |
||||
AND rehearsal_status = 'FINISHED' |
||||
GROUP BY |
||||
unit |
||||
ORDER BY |
||||
unit |
||||
</select> |
||||
|
||||
<select id="selectUnitByYear" resultType="com.hnac.hzims.safeproduct.vo.RehearsalYearVO"> |
||||
SELECT |
||||
distinct unit |
||||
FROM |
||||
hzims_rehearsal_plan |
||||
WHERE |
||||
is_deleted = 0 |
||||
AND scheduled_end_time like concat('%', #{year}, '%') |
||||
ORDER BY |
||||
unit |
||||
</select> |
||||
|
||||
<select id="selectFinishedDataByUnit" resultType="com.hnac.hzims.safeproduct.dto.AnalysisYearDTO"> |
||||
SELECT |
||||
unit, DATE_FORMAT(scheduled_end_time, '%m') as dateTime, count(1) as finished_num |
||||
FROM |
||||
hzims_rehearsal_plan |
||||
WHERE |
||||
is_deleted = 0 |
||||
AND scheduled_end_time like concat('%', #{year}, '%') |
||||
AND rehearsal_status = 'FINISHED' |
||||
AND unit in |
||||
<foreach collection="unitList" item="unit" open="(" close=")" separator=","> |
||||
#{unit} |
||||
</foreach> |
||||
GROUP BY |
||||
unit, DATE_FORMAT(scheduled_end_time, '%m') |
||||
ORDER BY |
||||
unit |
||||
</select> |
||||
|
||||
<select id="getRehearsalByUnitAndDate" resultType="com.hnac.hzims.safeproduct.dto.RehearsalExportDTO"> |
||||
SELECT |
||||
t1.unit, t1.subject, t1.scheduled_start_time, t1.scheduled_end_time, t1.location, |
||||
t2.people_num, t2.actual_start_time, t2.actual_end_time, t1.rehearsal_status |
||||
FROM |
||||
hzims_rehearsal_plan t1 |
||||
LEFT JOIN hzims_rehearsal_record t2 ON t1.id = t2.rehearsal_plan_id |
||||
WHERE |
||||
t1.is_deleted = 0 |
||||
<if test="unit != 'null' and unit != ''"> |
||||
AND t1.unit like concat('%', #{unit}, '%') |
||||
</if> |
||||
<if test="startTime != 'null' and startTime != ''"> |
||||
AND t1.scheduled_start_time >= #{startTime} |
||||
</if> |
||||
<if test="endTime != 'null' and endTime != ''"> |
||||
AND t1.scheduled_end_time < #{endTime} |
||||
</if> |
||||
</select> |
||||
</mapper> |
@ -0,0 +1,40 @@
|
||||
package com.hnac.hzims.safeproduct.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; |
||||
import org.springblade.core.mp.support.Query; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 会议计划服务类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
public interface IConferencePlanService extends IService<ConferencePlanEntity> { |
||||
|
||||
/** |
||||
* 删除会议计划 |
||||
* @param id 会议计划id |
||||
* @return true-成功,false-失败 |
||||
*/ |
||||
boolean removePlan(Long id); |
||||
|
||||
/** |
||||
* 会议计划分页 |
||||
* @param param 入参 |
||||
* @param query 分页类 |
||||
* @return 会议计划数据 |
||||
*/ |
||||
IPage<ConferencePlanEntity> planPage(Map<String, Object> param, Query query); |
||||
|
||||
/** |
||||
* 会议数据导出 |
||||
* @param param 入参 |
||||
* @param response 响应类 |
||||
*/ |
||||
void exportConferenceData(Map<String, Object> param, HttpServletResponse response); |
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.hnac.hzims.safeproduct.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; |
||||
|
||||
/** |
||||
* 会议记录服务类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
public interface IConferenceRecordService extends IService<ConferenceRecordEntity> { |
||||
|
||||
/** |
||||
* 删除关联会议记录 |
||||
* @param conferencePlanId 会议计划id |
||||
* @return true-成功,false-失败 |
||||
*/ |
||||
boolean removeReferenceRecord(Long conferencePlanId); |
||||
|
||||
/** |
||||
* 新增会议记录 |
||||
* @param conferenceRecord 会议记录实体类 |
||||
* @return true-成功,false-失败 |
||||
*/ |
||||
boolean saveRecord(ConferenceRecordEntity conferenceRecord); |
||||
} |
@ -0,0 +1,67 @@
|
||||
package com.hnac.hzims.safeproduct.service; |
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.hnac.hzims.safeproduct.entity.RehearsalPlanEntity; |
||||
import com.hnac.hzims.safeproduct.vo.RehearsalMonthVO; |
||||
import com.hnac.hzims.safeproduct.vo.RehearsalYearVO; |
||||
import org.springblade.core.mp.support.Query; |
||||
|
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 演练计划服务类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
public interface IRehearsalPlanService extends IService<RehearsalPlanEntity> { |
||||
|
||||
/** |
||||
* 删除演练计划 |
||||
* @param id 演练计划id |
||||
* @return true-成功,false-失败 |
||||
*/ |
||||
boolean removeRehearsalPlan(Long id); |
||||
|
||||
/** |
||||
* 演练月度数据 |
||||
* @param month 月份 |
||||
* @param query 分页类 |
||||
* @return 月度统计分页 |
||||
*/ |
||||
IPage<RehearsalMonthVO> dataByMonth(String month, Query query); |
||||
|
||||
/** |
||||
* 演练年度数据 |
||||
* @param year 年份 |
||||
* @param query 分页类 |
||||
* @return 年度统计分页 |
||||
*/ |
||||
IPage<RehearsalYearVO> dataByYear(String year, Query query); |
||||
|
||||
/** |
||||
* 演练计划数据导出 |
||||
* @param param 入参 |
||||
* @param response 响应类 |
||||
*/ |
||||
void exportRehearsalPlanData(Map<String, Object> param, HttpServletResponse response); |
||||
|
||||
/** |
||||
* 查询时间范围内未开始的演练数据 |
||||
* @param startTime 开始时间 |
||||
* @param endTime 结束时间 |
||||
* @return 演练数据 |
||||
*/ |
||||
List<RehearsalPlanEntity> getWaitingRehearsalInTimeRange(String startTime, String endTime); |
||||
|
||||
/** |
||||
* 演练计划分页 |
||||
* @param param 入参 |
||||
* @param query 分页类 |
||||
* @return 演练计划数据 |
||||
*/ |
||||
IPage<RehearsalPlanEntity> rehearsalPlanPage(Map<String, Object> param, Query query); |
||||
} |
@ -0,0 +1,158 @@
|
||||
package com.hnac.hzims.safeproduct.service.impl; |
||||
|
||||
import com.alibaba.excel.EasyExcel; |
||||
import com.alibaba.excel.ExcelWriter; |
||||
import com.alibaba.excel.converters.longconverter.LongStringConverter; |
||||
import com.alibaba.excel.write.metadata.WriteSheet; |
||||
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.hnac.hzims.common.utils.Condition; |
||||
import com.hnac.hzims.safeproduct.dto.ConferenceExportDTO; |
||||
import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; |
||||
import com.hnac.hzims.safeproduct.enums.ConferenceMethodEnum; |
||||
import com.hnac.hzims.safeproduct.enums.ConferenceStatusEnum; |
||||
import com.hnac.hzims.safeproduct.mapper.ConferencePlanMapper; |
||||
import com.hnac.hzims.safeproduct.service.IConferencePlanService; |
||||
import com.hnac.hzims.safeproduct.service.IConferenceRecordService; |
||||
import org.springblade.core.log.exception.ServiceException; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import javax.servlet.ServletOutputStream; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.net.URLEncoder; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* 会议计划服务实现类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Service |
||||
public class ConferencePlanServiceImpl extends ServiceImpl<ConferencePlanMapper, ConferencePlanEntity> implements IConferencePlanService { |
||||
|
||||
@Autowired |
||||
IConferenceRecordService conferenceRecordService; |
||||
|
||||
/** |
||||
* 删除会议计划 |
||||
*/ |
||||
@Transactional(rollbackFor = Exception.class) |
||||
@Override |
||||
public boolean removePlan(Long id) { |
||||
boolean remove = this.removeById(id); |
||||
// 若成功删除会议计划,删除关联的会议记录
|
||||
if (remove) { |
||||
return conferenceRecordService.removeReferenceRecord(id); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 会议计划分页 |
||||
*/ |
||||
@Override |
||||
public IPage<ConferencePlanEntity> planPage(Map<String, Object> param, Query query) { |
||||
QueryWrapper<ConferencePlanEntity> queryWrapper = new QueryWrapper<>(); |
||||
String unit = String.valueOf(param.get("unit")); |
||||
String startTime = String.valueOf(param.get("startTime")); |
||||
String endTime = String.valueOf((param.get("endTime"))); |
||||
if (!unit.equals("null") && !unit.equals("")) { |
||||
queryWrapper.lambda().like(ConferencePlanEntity::getUnit, unit); |
||||
} |
||||
if (!startTime.equals("null") && !startTime.equals("")) { |
||||
queryWrapper.lambda().ge(ConferencePlanEntity::getScheduledStartTime, startTime); |
||||
} |
||||
if (!endTime.equals("null") && !endTime.equals("")) { |
||||
queryWrapper.lambda().le(ConferencePlanEntity::getScheduledEndTime, endTime); |
||||
} |
||||
return this.page(Condition.getPage(query), queryWrapper); |
||||
} |
||||
|
||||
/** |
||||
* 会议数据导出 |
||||
*/ |
||||
@Override |
||||
public void exportConferenceData(Map<String, Object> param, HttpServletResponse response) { |
||||
ServletOutputStream outputStream = null; |
||||
try { |
||||
outputStream = response.getOutputStream(); |
||||
String unit = String.valueOf(param.get("unit")); |
||||
String startTime = String.valueOf(param.get("scheduledStartTime")); |
||||
String endTime = String.valueOf(param.get("scheduledEndTime")); |
||||
List<ConferenceExportDTO> conferenceList = getConferenceByUnitAndDate(unit, startTime, endTime); |
||||
// 处理会议数据信息
|
||||
conferenceList.forEach(conference -> { |
||||
// 会议方式
|
||||
String method; |
||||
if (conference.getConferenceMethod().equals(ConferenceMethodEnum.ONLINE.getValue())) { |
||||
method = ConferenceMethodEnum.ONLINE.getDesc(); |
||||
} else if (conference.getConferenceMethod().equals(ConferenceMethodEnum.OFFLINE.getValue())) { |
||||
method = ConferenceMethodEnum.OFFLINE.getDesc(); |
||||
} else { |
||||
method = ConferenceMethodEnum.MIXED.getDesc(); |
||||
} |
||||
conference.setConferenceMethod(method); |
||||
// 会议状态
|
||||
String status; |
||||
if (conference.getConferenceStatus().equals(ConferenceStatusEnum.WAITING.getValue())) { |
||||
status = ConferenceStatusEnum.WAITING.getDesc(); |
||||
} else if (conference.getConferenceStatus().equals(ConferenceStatusEnum.UNFINISHED.getValue())) { |
||||
status = ConferenceStatusEnum.UNFINISHED.getDesc(); |
||||
} else { |
||||
status = ConferenceStatusEnum.FINISHED.getDesc(); |
||||
} |
||||
conference.setConferenceStatus(status); |
||||
}); |
||||
// 设置响应头
|
||||
// URLEncoder.encode防止中文乱码
|
||||
String fileName = URLEncoder.encode("会议数据表", "UTF-8"); |
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
||||
response.setContentType("application/vnd.ms-excel"); |
||||
response.setCharacterEncoding("UTF-8"); |
||||
// ExcelWriter初始化
|
||||
ExcelWriter excelWriter = EasyExcel |
||||
.write(response.getOutputStream()) |
||||
.autoCloseStream(Boolean.TRUE) |
||||
.registerConverter(new LongStringConverter()) |
||||
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) |
||||
.build(); |
||||
WriteSheet writeSheet = EasyExcel.writerSheet(1, "会议数据表").head(ConferenceExportDTO.class) |
||||
.build(); |
||||
excelWriter.write(conferenceList, writeSheet); |
||||
excelWriter.finish(); |
||||
} catch (Exception e) { |
||||
// 重置response
|
||||
response.reset(); |
||||
response.setContentType("application/json"); |
||||
response.setCharacterEncoding("utf-8"); |
||||
throw new ServiceException("会议数据导出异常: " + e.getMessage()); |
||||
} finally { |
||||
if (outputStream != null) { |
||||
try { |
||||
outputStream.close(); |
||||
} catch (IOException e) { |
||||
log.error("会议导出响应头输出流关闭异常: " + e.getMessage()); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 根据单位和计划时间查询会议记录 |
||||
* @param unit 单位 |
||||
* @param startTime 计划开始时间 |
||||
* @param endTime 计划结束时间 |
||||
* @return 会议记录列表 |
||||
*/ |
||||
public List<ConferenceExportDTO> getConferenceByUnitAndDate(String unit, String startTime, String endTime) { |
||||
return baseMapper.getConferenceByUnitAndDate(unit, startTime, endTime); |
||||
} |
||||
} |
@ -0,0 +1,113 @@
|
||||
package com.hnac.hzims.safeproduct.service.impl; |
||||
|
||||
import cn.hutool.core.date.DatePattern; |
||||
import com.alibaba.excel.util.CollectionUtils; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.hnac.hzims.common.logs.utils.StringUtils; |
||||
import com.hnac.hzims.safeproduct.constants.SafeProductConstant; |
||||
import com.hnac.hzims.safeproduct.entity.ConferencePlanEntity; |
||||
import com.hnac.hzims.safeproduct.entity.ConferenceRecordEntity; |
||||
import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum; |
||||
import com.hnac.hzims.safeproduct.mapper.ConferencePlanMapper; |
||||
import com.hnac.hzims.safeproduct.mapper.ConferenceRecordMapper; |
||||
import com.hnac.hzims.safeproduct.service.IConferenceRecordService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import javax.annotation.Resource; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* 会议记录服务实现类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Service |
||||
public class ConferenceRecordServiceImpl extends ServiceImpl<ConferenceRecordMapper, ConferenceRecordEntity> implements IConferenceRecordService { |
||||
|
||||
@Resource |
||||
ConferencePlanMapper conferencePlanMapper; |
||||
|
||||
/** |
||||
* 删除关联会议记录 |
||||
*/ |
||||
@Override |
||||
public boolean removeReferenceRecord(Long conferencePlanId) { |
||||
// 查询关联会议记录
|
||||
QueryWrapper<ConferenceRecordEntity> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.lambda().eq(ConferenceRecordEntity::getConferencePlanId, conferencePlanId); |
||||
List<ConferenceRecordEntity> rehearsalRecordList = this.list(queryWrapper); |
||||
// 若无关联会议记录,直接返回true
|
||||
if (CollectionUtils.isEmpty(rehearsalRecordList)) { |
||||
return true; |
||||
} |
||||
// 删除关联会议记录
|
||||
List<Long> ids = rehearsalRecordList.stream().map(ConferenceRecordEntity::getId).collect(Collectors.toList()); |
||||
return this.removeByIds(ids); |
||||
} |
||||
|
||||
/** |
||||
* 新增会议记录 |
||||
*/ |
||||
@Override |
||||
public boolean saveRecord(ConferenceRecordEntity conferenceRecord) { |
||||
// 获取当月时间(yyyymm)
|
||||
String currentMonth = DatePattern.SIMPLE_MONTH_FORMAT.format(new Date()); |
||||
// 查询是否存在同月编号
|
||||
String lastCode = getLastCode(currentMonth); |
||||
// 若不存在,新增编号
|
||||
String code; |
||||
if (StringUtils.isNull(lastCode)) { |
||||
code = "HYJL" + currentMonth + "001"; |
||||
} else { // 若存在,编号递增
|
||||
String oldNum = lastCode.substring(lastCode.length() - 3); |
||||
int value = Integer.parseInt(oldNum) + 1; |
||||
// 根据数位拼接编号
|
||||
if (value < 10) { |
||||
code = "HYJL" + currentMonth + "00" + value; |
||||
} else if (value < 100) { |
||||
code = "HYJL" + currentMonth + "0" + value; |
||||
} else { |
||||
code = "HYJL" + currentMonth + value; |
||||
} |
||||
} |
||||
conferenceRecord.setCode(code); |
||||
boolean save = this.save(conferenceRecord); |
||||
// 若会议记录新增成功,修改会议计划状态为已完成
|
||||
if (save) { |
||||
ConferencePlanEntity conferencePlanEntity = conferencePlanMapper.selectById(conferenceRecord.getConferencePlanId()); |
||||
conferencePlanEntity.setConferenceStatus(RehearsalStatusEnum.FINISHED.getValue()); |
||||
return conferencePlanMapper.updateById(conferencePlanEntity) == SafeProductConstant.SUCCESS; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 查询是否存在同月编号 |
||||
* @param currentMonth 当月 |
||||
* @return 存在则返回上一编号,否则返回null |
||||
*/ |
||||
private String getLastCode(String currentMonth) { |
||||
String month = currentMonth.substring(currentMonth.length() - 2); |
||||
List<ConferenceRecordEntity> list = getConferenceByMonth(month); |
||||
if (CollectionUtils.isEmpty(list)) { |
||||
return null; |
||||
} |
||||
return list.get(0).getCode(); |
||||
} |
||||
|
||||
/** |
||||
* 查询当月会议记录 |
||||
* @param month 当月 |
||||
* @return 当月会议数据表 |
||||
*/ |
||||
public List<ConferenceRecordEntity> getConferenceByMonth(String month) { |
||||
QueryWrapper<ConferenceRecordEntity> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.lambda().like(ConferenceRecordEntity::getCreateTime, month) |
||||
.orderByDesc(ConferenceRecordEntity::getCode); |
||||
return this.list(queryWrapper); |
||||
} |
||||
} |
@ -0,0 +1,259 @@
|
||||
package com.hnac.hzims.safeproduct.service.impl; |
||||
|
||||
import com.alibaba.excel.EasyExcel; |
||||
import com.alibaba.excel.ExcelWriter; |
||||
import com.alibaba.excel.converters.longconverter.LongStringConverter; |
||||
import com.alibaba.excel.write.metadata.WriteSheet; |
||||
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; |
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.hnac.hzims.common.utils.Condition; |
||||
import com.hnac.hzims.safeproduct.dto.AnalysisYearDTO; |
||||
import com.hnac.hzims.safeproduct.dto.RehearsalExportDTO; |
||||
import com.hnac.hzims.safeproduct.entity.RehearsalPlanEntity; |
||||
import com.hnac.hzims.safeproduct.enums.RehearsalStatusEnum; |
||||
import com.hnac.hzims.safeproduct.mapper.RehearsalPlanMapper; |
||||
import com.hnac.hzims.safeproduct.service.IRehearsalPlanService; |
||||
import com.hnac.hzims.safeproduct.service.IRehearsalRecordService; |
||||
import com.hnac.hzims.safeproduct.vo.RehearsalMonthVO; |
||||
import com.hnac.hzims.safeproduct.vo.RehearsalYearVO; |
||||
import org.springblade.core.log.exception.ServiceException; |
||||
import org.springblade.core.mp.support.Query; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import javax.servlet.ServletOutputStream; |
||||
import javax.servlet.http.HttpServletResponse; |
||||
import java.io.IOException; |
||||
import java.math.BigDecimal; |
||||
import java.math.RoundingMode; |
||||
import java.net.URLEncoder; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
import java.util.Optional; |
||||
import java.util.stream.Collectors; |
||||
|
||||
/** |
||||
* 演练计划服务实现类 |
||||
* |
||||
* @author liwen |
||||
* @date 2023-12-27 |
||||
*/ |
||||
@Service |
||||
public class RehearsalPlanServiceImpl extends ServiceImpl<RehearsalPlanMapper, RehearsalPlanEntity> |
||||
implements IRehearsalPlanService { |
||||
|
||||
@Autowired |
||||
IRehearsalRecordService rehearsalRecordService; |
||||
|
||||
/** |
||||
* 删除演练计划 |
||||
*/ |
||||
@Transactional(rollbackFor = Exception.class) |
||||
@Override |
||||
public boolean removeRehearsalPlan(Long id) { |
||||
boolean remove = this.removeById(id); |
||||
// 若演练计划删除成功,删除关联演练记录
|
||||
if (remove) { |
||||
return rehearsalRecordService.removeRelativeRehearsalRecord(id); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 演练月度数据 |
||||
*/ |
||||
@Override |
||||
public IPage<RehearsalMonthVO> dataByMonth(String month, Query query) { |
||||
// 查询当月各单位的演练总数
|
||||
IPage<RehearsalMonthVO> page = new Page<>(query.getCurrent(), query.getSize()); |
||||
IPage<RehearsalMonthVO> unitPage = baseMapper.selectByMonth(page, month); |
||||
List<RehearsalMonthVO> unitList = unitPage.getRecords(); |
||||
// 查询当月各单位已完成的演练数据
|
||||
IPage<RehearsalMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize()); |
||||
IPage<RehearsalMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month); |
||||
List<RehearsalMonthVO> finishedList = finishedPage.getRecords(); |
||||
// 处理统计数据
|
||||
for (RehearsalMonthVO unit : unitList) { |
||||
Long taskNum = unit.getScheduledTaskNum(); |
||||
Optional<RehearsalMonthVO> finishedRehearsal = finishedList.stream().filter(x -> x.getUnit().equals(unit.getUnit())).findFirst(); |
||||
Long finishedTaskNum = finishedRehearsal.isPresent() ? finishedRehearsal.get().getFinishedTaskNum() : 0L; |
||||
unit.setFinishedTaskNum(finishedTaskNum); |
||||
unit.setUnfinishedTaskNum(taskNum - finishedTaskNum); |
||||
BigDecimal taskDecimal = new BigDecimal(taskNum); |
||||
BigDecimal finishedDecimal = new BigDecimal(finishedTaskNum); |
||||
unit.setTaskCompletionRate(finishedDecimal.divide(taskDecimal, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")) |
||||
.setScale(2, RoundingMode.HALF_UP)); |
||||
} |
||||
unitPage.setRecords(unitList); |
||||
return unitPage; |
||||
} |
||||
|
||||
/** |
||||
* 演练年度数据 |
||||
*/ |
||||
@Override |
||||
public IPage<RehearsalYearVO> dataByYear(String year, Query query) { |
||||
IPage<RehearsalYearVO> page = new Page<>(query.getCurrent(), query.getSize()); |
||||
// 查询当年的所有单位
|
||||
IPage<RehearsalYearVO> unitPage = baseMapper.selectUnitByYear(page, year); |
||||
List<RehearsalYearVO> records = unitPage.getRecords(); |
||||
// 若无数据,返回空页面
|
||||
if (org.springframework.util.CollectionUtils.isEmpty(records)) { |
||||
return unitPage; |
||||
} |
||||
List<String> unitList = records.stream().map(RehearsalYearVO::getUnit).collect(Collectors.toList()); |
||||
// 查询各单位全年已完成的演练数据
|
||||
List<AnalysisYearDTO> unitMonthDataList = baseMapper.selectFinishedDataByUnit(unitList, year); |
||||
// 将各单位每个月的演练数据写入统计列表
|
||||
unitMonthDataList.forEach(data -> { |
||||
RehearsalYearVO rehearsalYearVO = records.stream().filter(x -> x.getUnit().equals(data.getUnit())) |
||||
.collect(Collectors.toList()).get(0); |
||||
// 根据月份匹配写入对应字段
|
||||
switch (data.getDateTime()) { |
||||
case "01": |
||||
rehearsalYearVO.setJanuaryNum(data.getFinishedNum()); |
||||
break; |
||||
case "02": |
||||
rehearsalYearVO.setFebruaryNum(data.getFinishedNum()); |
||||
break; |
||||
case "03": |
||||
rehearsalYearVO.setMarchNum(data.getFinishedNum()); |
||||
break; |
||||
case "04": |
||||
rehearsalYearVO.setAprilNum(data.getFinishedNum()); |
||||
break; |
||||
case "05": |
||||
rehearsalYearVO.setMayNum(data.getFinishedNum()); |
||||
break; |
||||
case "06": |
||||
rehearsalYearVO.setJuneNum(data.getFinishedNum()); |
||||
break; |
||||
case "07": |
||||
rehearsalYearVO.setJulyNum(data.getFinishedNum()); |
||||
break; |
||||
case "08": |
||||
rehearsalYearVO.setAugustNum(data.getFinishedNum()); |
||||
break; |
||||
case "09": |
||||
rehearsalYearVO.setSeptemberNum(data.getFinishedNum()); |
||||
break; |
||||
case "10": |
||||
rehearsalYearVO.setOctoberNum(data.getFinishedNum()); |
||||
break; |
||||
case "11": |
||||
rehearsalYearVO.setNovemberNum(data.getFinishedNum()); |
||||
break; |
||||
case "12": |
||||
rehearsalYearVO.setDecemberNum(data.getFinishedNum()); |
||||
} |
||||
}); |
||||
unitPage.setRecords(records); |
||||
return unitPage; |
||||
} |
||||
|
||||
/** |
||||
* 演练计划数据导出 |
||||
*/ |
||||
@Override |
||||
public void exportRehearsalPlanData(Map<String, Object> param, HttpServletResponse response) { |
||||
ServletOutputStream outputStream = null; |
||||
try { |
||||
outputStream = response.getOutputStream(); |
||||
String unit = String.valueOf(param.get("unit")); |
||||
String startTime = String.valueOf(param.get("scheduledStartTime")); |
||||
String endTime = String.valueOf(param.get("scheduledEndTime")); |
||||
List<RehearsalExportDTO> rehearsalList = getRehearsalByUnitAndDate(unit, startTime, endTime); |
||||
// 处理演练状态信息
|
||||
rehearsalList.forEach(record -> { |
||||
String status; |
||||
if (record.getRehearsalStatus().equals(RehearsalStatusEnum.WAITING.getValue())) { |
||||
status = RehearsalStatusEnum.WAITING.getDesc(); |
||||
} else if (record.getRehearsalStatus().equals(RehearsalStatusEnum.UNFINISHED.getValue())) { |
||||
status = RehearsalStatusEnum.UNFINISHED.getDesc(); |
||||
} else { |
||||
status = RehearsalStatusEnum.FINISHED.getDesc(); |
||||
} |
||||
record.setRehearsalStatus(status); |
||||
}); |
||||
// 设置响应头
|
||||
// URLEncoder.encode防止中文乱码
|
||||
String fileName = URLEncoder.encode("演练数据表", "UTF-8"); |
||||
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
||||
response.setContentType("application/vnd.ms-excel"); |
||||
response.setCharacterEncoding("UTF-8"); |
||||
// ExcelWriter初始化
|
||||
ExcelWriter excelWriter = EasyExcel |
||||
.write(response.getOutputStream()) |
||||
.autoCloseStream(Boolean.TRUE) |
||||
.registerConverter(new LongStringConverter()) |
||||
.registerWriteHandler(new SimpleColumnWidthStyleStrategy(25)) |
||||
.build(); |
||||
WriteSheet writeSheet = EasyExcel.writerSheet(1, "演练数据表").head(RehearsalExportDTO.class) |
||||
.build(); |
||||
excelWriter.write(rehearsalList, writeSheet); |
||||
excelWriter.finish(); |
||||
} catch (Exception e) { |
||||
// 重置response
|
||||
response.reset(); |
||||
response.setContentType("application/json"); |
||||
response.setCharacterEncoding("utf-8"); |
||||
throw new ServiceException("演练数据导出异常: " + e.getMessage()); |
||||
} finally { |
||||
if (outputStream != null) { |
||||
try { |
||||
outputStream.close(); |
||||
} catch (IOException e) { |
||||
log.error("演练导出响应头输出流关闭异常: " + e.getMessage()); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 根据单位和计划时间查询演练记录 |
||||
* @param unit 单位 |
||||
* @param startTime 计划开始时间 |
||||
* @param endTime 计划结束时间 |
||||
* @return 演练记录列表 |
||||
*/ |
||||
public List<RehearsalExportDTO> getRehearsalByUnitAndDate(String unit, String startTime, String endTime) { |
||||
return baseMapper.getRehearsalByUnitAndDate(unit, startTime, endTime); |
||||
} |
||||
|
||||
/** |
||||
* 查询时间范围内未开始的演练数据 |
||||
*/ |
||||
@Override |
||||
public List<RehearsalPlanEntity> getWaitingRehearsalInTimeRange(String startTime, String endTime) { |
||||
QueryWrapper<RehearsalPlanEntity> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.lambda().eq(RehearsalPlanEntity::getRehearsalStatus, RehearsalStatusEnum.WAITING.getValue()) |
||||
.ge(RehearsalPlanEntity::getScheduledEndTime, startTime) |
||||
.lt(RehearsalPlanEntity::getScheduledEndTime, endTime); |
||||
return this.list(queryWrapper); |
||||
} |
||||
|
||||
/** |
||||
* 演练计划分页 |
||||
*/ |
||||
@Override |
||||
public IPage<RehearsalPlanEntity> rehearsalPlanPage(Map<String, Object> param, Query query) { |
||||
QueryWrapper<RehearsalPlanEntity> queryWrapper = new QueryWrapper<>(); |
||||
String unit = String.valueOf(param.get("unit")); |
||||
String startTime = String.valueOf(param.get("scheduledStartTime")); |
||||
String endTime = String.valueOf((param.get("scheduledEndTime"))); |
||||
if (!unit.equals("null") && !unit.equals("")) { |
||||
queryWrapper.lambda().like(RehearsalPlanEntity::getUnit, unit); |
||||
} |
||||
if (!startTime.equals("null") && !startTime.equals("")) { |
||||
queryWrapper.lambda().ge(RehearsalPlanEntity::getScheduledStartTime, startTime); |
||||
} |
||||
if (!endTime.equals("null") && !endTime.equals("")) { |
||||
queryWrapper.lambda().le(RehearsalPlanEntity::getScheduledEndTime, endTime); |
||||
} |
||||
return this.page(Condition.getPage(query), queryWrapper); |
||||
} |
||||
} |
Loading…
Reference in new issue