Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
haungxing 11 months ago
parent
commit
72753e2bca
  1. 6
      hzims-service-api/basic-api/pom.xml
  2. 7
      hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/CertificatetNoticeEntity.java
  3. 6
      hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/PersonManagemetEntity.java
  4. 122
      hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/vo/PersonManagemetExportVo.java
  5. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalYearVO.java
  6. 3
      hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainYearVO.java
  7. 22
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/CertificatetNoticeController.java
  8. 66
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/PresonManagementController.java
  9. 6
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java
  10. 47
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.xml
  11. 8
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/IImsPresonManagementService.java
  12. 58
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/impl/PresonManagementServiceImpl.java
  13. 41
      hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/utils/CertificatetType.java
  14. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java
  15. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java
  16. 12
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java
  17. 14
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java
  18. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/ConferencePlanMapper.xml
  19. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml
  20. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.java
  21. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.java
  22. 11
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml
  23. 4
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml
  24. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.java
  25. 9
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml
  26. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneZoneService.java
  27. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalPlanService.java
  28. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java
  29. 1
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java
  30. 1
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java
  31. 3
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java
  32. 6
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneZoneServiceImpl.java
  33. 43
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java
  34. 45
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java
  35. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java

6
hzims-service-api/basic-api/pom.xml

@ -7,6 +7,12 @@
<groupId>com.hnac.hzims</groupId> <groupId>com.hnac.hzims</groupId>
<version>4.0.0-SNAPSHOT</version> <version>4.0.0-SNAPSHOT</version>
</parent> </parent>
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
</dependency>
</dependencies>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>basic-api</artifactId> <artifactId>basic-api</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>

7
hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/CertificatetNoticeEntity.java

@ -1,6 +1,7 @@
package com.hnac.hzims.basic.entity; package com.hnac.hzims.basic.entity;
import com.baomidou.mybatisplus.annotation.SqlCondition; import com.baomidou.mybatisplus.annotation.SqlCondition;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -41,4 +42,10 @@ public class CertificatetNoticeEntity extends TenantEntity {
@ApiModelProperty(value = "通知用户") @ApiModelProperty(value = "通知用户")
@QueryField(condition = SqlCondition.LIKE) @QueryField(condition = SqlCondition.LIKE)
private String noticeUsers; private String noticeUsers;
/**
* 通知用户
*/
@TableField(exist = false)
@ApiModelProperty(value = "通知用户")
private String noticeUserNames;
} }

6
hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/entity/PersonManagemetEntity.java

@ -9,6 +9,8 @@ import lombok.EqualsAndHashCode;
import org.springblade.core.mp.support.QueryField; import org.springblade.core.mp.support.QueryField;
import org.springblade.core.tenant.mp.TenantEntity; import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
/** /**
* 实体类 * 实体类
@ -18,9 +20,7 @@ import org.springblade.core.tenant.mp.TenantEntity;
@TableName("hzims_person_managemet") @TableName("hzims_person_managemet")
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@ApiModel(value = "人员管理表", description = "人员管理表") @ApiModel(value = "人员管理表", description = "人员管理表")
public class PersonManagemetEntity extends TenantEntity { public class PersonManagemetEntity extends TenantEntity implements Serializable {
private static final long serialVersionUID = 1L;
/** /**
* 用户ID * 用户ID

122
hzims-service-api/basic-api/src/main/java/com/hnac/hzims/basic/vo/PersonManagemetExportVo.java

@ -0,0 +1,122 @@
package com.hnac.hzims.basic.vo;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 实体类
* @author Chill
*/
@Data
@ApiModel(value = "档案管理导出类",description = "档案管理导出类")
public class PersonManagemetExportVo{
private static final long serialVersionUID = 1L;
@ExcelIgnore()
@ColumnWidth(value = 20)
@ApiModelProperty(value = "用户ID")
private String userId;
/**
* 单位名称
*/
@ExcelProperty(value = "单位名称", index = 0)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "单位名称")
private String unitName;
/**
* 用户名称
*/
@ExcelProperty(value = "用户名称", index = 1)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "用户名称")
private String name;
/**
* 性别
*/
@ExcelProperty(value = "性别", index = 2)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "性别")
private String sex;
/**
* 职位
*/
@ExcelProperty(value = "职位", index = 3)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "职位")
private String job;
/**
* 职称
*/
@ExcelProperty(value = "职称", index = 4)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "职称")
private String academicTitle;
/**
* 电话号码
*/
@ExcelProperty(value = "电话号码", index = 5)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "电话号码")
private String phone;
/**
* 档案类型
*/
@ExcelProperty(value = "档案类型", index = 6)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "档案类型")
private String type;
/**
* 到期时间
*/
@ExcelProperty(value = "到期时间", index = 7)
@ColumnWidth(value = 20)
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty(value = "到期时间")
private Date deadTime;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间", index = 8)
@ColumnWidth(value = 20)
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty(value = "创建时间")
private Date createTime;
/**
* 是否过期
*/
@ExcelProperty(value = "是否过期", index = 9)
@ColumnWidth(value = 20)
@ApiModelProperty(value = "是否过期")
private String isDead;
}

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/RehearsalYearVO.java

@ -50,4 +50,7 @@ public class RehearsalYearVO {
@ApiModelProperty("12月完成数") @ApiModelProperty("12月完成数")
private Long decemberNum; private Long decemberNum;
@ApiModelProperty("合计完成数")
private Long sum;
} }

3
hzims-service-api/safeproduct-api/src/main/java/com/hnac/hzims/safeproduct/vo/TrainYearVO.java

@ -50,4 +50,7 @@ public class TrainYearVO {
@ApiModelProperty("12月完成数") @ApiModelProperty("12月完成数")
private Long decemberNum; private Long decemberNum;
@ApiModelProperty("合计完成数")
private Long sum;
} }

22
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/CertificatetNoticeController.java

@ -1,5 +1,6 @@
package com.hnac.hzims.basic.controller; package com.hnac.hzims.basic.controller;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.basic.entity.CertificatetNoticeEntity; import com.hnac.hzims.basic.entity.CertificatetNoticeEntity;
@ -10,8 +11,14 @@ import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
/** /**
* 控制器 * 控制器
@ -46,7 +53,7 @@ public class CertificatetNoticeController extends BladeController {
/** /**
* 新增或修改 * 新增或修改
*/ */
@PostMapping("/getCertificatetNotice") @GetMapping("/getCertificatetNotice")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "增加", notes = "传入imsDutyClass") @ApiOperation(value = "增加", notes = "传入imsDutyClass")
public R getCertificatetNotice() { public R getCertificatetNotice() {
@ -54,10 +61,21 @@ public class CertificatetNoticeController extends BladeController {
.eq(CertificatetNoticeEntity::getIsDeleted, 0) .eq(CertificatetNoticeEntity::getIsDeleted, 0)
.last("limit 1;")); .last("limit 1;"));
if (ObjectUtil.isNotEmpty(res)) { if (ObjectUtil.isNotEmpty(res)) {
if (StringUtils.isNotBlank(res.getNoticeUsers())) {
String noticeUsers = res.getNoticeUsers();
List<String> list = Arrays.asList(noticeUsers.split(","));
String names = list.stream().map(s -> {
if (ObjectUtil.isNotEmpty(UserCache.getUser(Long.valueOf(s)))) {
return UserCache.getUser(Long.valueOf(s));
}else {
return new User();
}
}).filter(s->ObjectUtil.isNotEmpty(s)).map(User::getName).collect(Collectors.joining(","));
res.setNoticeUserNames(names);
}
return R.data(res); return R.data(res);
} }
return R.data(""); return R.data("");
} }
} }

66
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/controller/PresonManagementController.java

@ -1,31 +1,30 @@
package com.hnac.hzims.basic.controller; package com.hnac.hzims.basic.controller;
import com.alibaba.spring.util.BeanUtils; import com.alibaba.druid.support.json.JSONUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.basic.entity.PersonManagemetEntity;
import com.hnac.hzims.basic.service.IImsPresonManagementService; import com.hnac.hzims.basic.service.IImsPresonManagementService;
import com.hnac.hzims.basic.vo.PersonManagemetExportVo;
import com.hnac.hzims.basic.vo.PersonManagemetVo; import com.hnac.hzims.basic.vo.PersonManagemetVo;
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; import com.hnac.hzims.common.logs.annotation.OperationAnnotation;
import com.hnac.hzims.common.logs.enums.BusinessType; import com.hnac.hzims.common.logs.enums.BusinessType;
import com.hnac.hzims.common.logs.enums.OperatorType; import com.hnac.hzims.common.logs.enums.OperatorType;
import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.mp.support.Condition; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid; import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
@ -61,12 +60,8 @@ public class PresonManagementController extends BladeController {
@PostMapping ("/submit") @PostMapping ("/submit")
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "增加", notes = "传入imsDutyClass") @ApiOperation(value = "增加", notes = "传入imsDutyClass")
public R submit(@RequestBody PersonManagemetVo personManagemetVo) { public R submit(@RequestBody PersonManagemetVo personManagemetVo) throws IllegalAccessException {
Boolean submit = iImsPresonManagementService.submit(personManagemetVo); return iImsPresonManagementService.submit(personManagemetVo);
if (submit){
return R.success("保存成功");
}
return R.fail("保存失败");
} }
/** /**
@ -83,5 +78,44 @@ public class PresonManagementController extends BladeController {
return R.fail("删除失败"); return R.fail("删除失败");
} }
/**
* 分页 代码自定义代号
*/
@GetMapping("/exportPersonManagemetVo")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入imsDutyClass")
@OperationAnnotation(moduleName = "档案管理",title = "档案管理",operatorType = OperatorType.MOBILE,businessType =
BusinessType.GENCODE,action
= "档案管理")
public void exportPersonManagemetVo(HttpServletResponse response,PersonManagemetVo personManagemetVo) {
try {
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("UTF-8");
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
String fileName = URLEncoder.encode("档案管理报表", "UTF-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
List<PersonManagemetExportVo> list=iImsPresonManagementService.exportPersonManagemet(personManagemetVo);
if(list!=null && list.size()>0){
System.out.println("---------------- size = " + list.size());
// 这里需要设置不关闭流
EasyExcel.write(response.getOutputStream(), PersonManagemetExportVo.class).autoCloseStream(Boolean.FALSE).sheet("档案管理报表")
.doWrite(list);
}
} catch (Exception e) {
System.out.println("exportExcel = " + e.toString());
// 重置response
response.reset();
response.setContentType("application/json");
response.setCharacterEncoding("utf-8");
Map<String, String> map = new HashMap<>();
map.put("isSuccess", "false");
map.put("msg", "档案管理报表导出失败" + e.getMessage());
try {
response.getWriter().println(JSONUtils.toJSONString(map));
} catch (IOException e3) {
throw new ServiceException( "发生异常 :" + e.toString());
}
}
}
} }

6
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.java

@ -2,6 +2,7 @@ package com.hnac.hzims.basic.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.basic.entity.PersonManagemetEntity; import com.hnac.hzims.basic.entity.PersonManagemetEntity;
import com.hnac.hzims.basic.vo.PersonManagemetExportVo;
import com.hnac.hzims.basic.vo.PersonManagemetVo; import com.hnac.hzims.basic.vo.PersonManagemetVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -27,4 +28,9 @@ public interface PersonManagemetMapper extends UserDataScopeBaseMapper<PersonMan
@Param(value = "name")String name, @Param(value = "unitName")String unitName, @Param(value = "sex")String sex, @Param(value = "job")String job, @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) ; @Param(value = "academicTitle")String academicTitle, @Param(value = "status")Integer status, @Param(value = "current")Integer current, @Param(value = "size")Integer size) ;
List<PersonManagemetExportVo> exportPersonManagemet(
@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) ;
} }

47
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/mapper/PersonManagemetMapper.xml

@ -19,7 +19,7 @@
<result property="deadTime" column="dead_time" /> <result property="deadTime" column="dead_time" />
<result property="pic" column="pic" /> <result property="pic" column="pic" />
<result property="status" column="status" /> <result property="status" column="status" />
<result property="createTime" column="CREATE_TIME" /> <result property="createTime" column="BCREATE_TIME" />
<result property="isDead" column="isDead" /> <result property="isDead" column="isDead" />
</collection> </collection>
</resultMap> </resultMap>
@ -27,8 +27,8 @@
<!--嵌套查询--> <!--嵌套查询-->
<select id="getPersonManagemetEntity" resultMap="PersonManagemetMap"> <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, 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, b.id as certificatetId,b.person_id,b.type,b.dead_time,b.pic,b.CREATE_TIME as BCREATE_TIME,b.status,b.create_dept,
case when b.dead_time is null then "" case when b.dead_time is null then null
when b.dead_time &lt; NOW() then "过期" else "未过期" end as isDead when b.dead_time &lt; NOW() then "过期" else "未过期" end as isDead
from hzims_person_managemet as a from hzims_person_managemet as a
left join hzims_certificatet as b left join hzims_certificatet as b
@ -58,6 +58,7 @@
<if test="academicTitle != null and academicTitle != ''"> <if test="academicTitle != null and academicTitle != ''">
and a.academic_title like CONCAT('%',#{academic_title},'%') and a.academic_title like CONCAT('%',#{academic_title},'%')
</if> </if>
ORDER BY a.CREATE_TIME,BCREATE_TIME DESC
LIMIT #{current}, #{size} LIMIT #{current}, #{size}
</select> </select>
<!--嵌套查询--> <!--嵌套查询-->
@ -95,5 +96,45 @@
and b.status =#{status} and b.status =#{status}
</if> </if>
</select> </select>
<select id="exportPersonManagemet" resultType="com.hnac.hzims.basic.vo.PersonManagemetExportVo">
select a.id as userId,a.name,a.unit_name as unitName, a.job ,a.academic_title,a.phone,
b.type,b.dead_time as deadTime,b.pic,b.CREATE_TIME as createTime,
case when a.sex=1 then "女" else "男" end as sex,
case when b.dead_time is null then null
when b.dead_time &lt; NOW() then "过期" else "未过期" end as isDead
from hzims_person_managemet as a
left join hzims_certificatet as b
on a.id=b.person_id and b.is_deleted = 0
where a.is_deleted = 0
<if test="type != null and type != ''">
and b.type = #{type}
</if>
<if test="deadStartTime != null and type != ''">
and b.dead_time &gt;= #{deadStartTime}
</if>
<if test="deadTime != null and type != ''">
and b.dead_time &lt;= #{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>
ORDER BY unitName,userId,b.type,createTime DESC
</select>
</mapper> </mapper>

8
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/IImsPresonManagementService.java

@ -3,8 +3,12 @@ package com.hnac.hzims.basic.service;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.basic.entity.PersonManagemetEntity; import com.hnac.hzims.basic.entity.PersonManagemetEntity;
import com.hnac.hzims.basic.vo.PersonManagemetExportVo;
import com.hnac.hzims.basic.vo.PersonManagemetVo; import com.hnac.hzims.basic.vo.PersonManagemetVo;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import java.util.List;
/** /**
* 服务类 * 服务类
@ -15,7 +19,9 @@ public interface IImsPresonManagementService extends IService<PersonManagemetEnt
IPage<PersonManagemetVo> getPersonManagemetEntity(PersonManagemetVo personManagemetVo, Query query); IPage<PersonManagemetVo> getPersonManagemetEntity(PersonManagemetVo personManagemetVo, Query query);
Boolean submit(PersonManagemetVo personManagemetVo); R submit(PersonManagemetVo personManagemetVo) throws IllegalAccessException;
Boolean removeByPersonManagemetVo(PersonManagemetVo personManagemetVo); Boolean removeByPersonManagemetVo(PersonManagemetVo personManagemetVo);
List<PersonManagemetExportVo> exportPersonManagemet(PersonManagemetVo personManagemetVo);
} }

58
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/service/impl/PresonManagementServiceImpl.java

@ -2,12 +2,15 @@ package com.hnac.hzims.basic.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.basic.entity.CertificatetEntity; import com.hnac.hzims.basic.entity.CertificatetEntity;
import com.hnac.hzims.basic.entity.PersonManagemetEntity; import com.hnac.hzims.basic.entity.PersonManagemetEntity;
import com.hnac.hzims.basic.mapper.PersonManagemetMapper; import com.hnac.hzims.basic.mapper.PersonManagemetMapper;
import com.hnac.hzims.basic.service.IImsCertificatetService; import com.hnac.hzims.basic.service.IImsCertificatetService;
import com.hnac.hzims.basic.service.IImsPresonManagementService; import com.hnac.hzims.basic.service.IImsPresonManagementService;
import com.hnac.hzims.basic.utils.CertificatetType;
import com.hnac.hzims.basic.vo.PersonManagemetExportVo;
import com.hnac.hzims.basic.vo.PersonManagemetVo; import com.hnac.hzims.basic.vo.PersonManagemetVo;
import com.hnac.hzims.common.logs.utils.StringUtils; import com.hnac.hzims.common.logs.utils.StringUtils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -22,6 +25,9 @@ import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.xml.ws.WebServiceException;
import java.lang.reflect.Field;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -37,7 +43,7 @@ import java.util.stream.Collectors;
public class PresonManagementServiceImpl extends BaseServiceImpl<PersonManagemetMapper, PersonManagemetEntity> implements IImsPresonManagementService { public class PresonManagementServiceImpl extends BaseServiceImpl<PersonManagemetMapper, PersonManagemetEntity> implements IImsPresonManagementService {
private ISysClient sysClient; private final ISysClient sysClient;
private final IImsCertificatetService certificatetService; private final IImsCertificatetService certificatetService;
@ -59,44 +65,51 @@ public class PresonManagementServiceImpl extends BaseServiceImpl<PersonManagemet
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean submit(PersonManagemetVo personManagemetVo) { public R submit(PersonManagemetVo personManagemetVo) throws IllegalAccessException {
try {
if (ObjectUtil.isNotEmpty(personManagemetVo)) { if (ObjectUtil.isNotEmpty(personManagemetVo)) {
PersonManagemetEntity personManagemetEntity = new PersonManagemetEntity(); PersonManagemetEntity personManagemetEntity = new PersonManagemetEntity();
BeanUtil.copy(personManagemetVo, personManagemetEntity); BeanUtil.copy(personManagemetVo, personManagemetEntity);
if (!allFieldsNull(personManagemetEntity)) {
if (StringUtils.isBlank(personManagemetEntity.getUnitName())){ if (StringUtils.isBlank(personManagemetEntity.getUnitName())){
String deptId = AuthUtil.getDeptId(); String deptId = AuthUtil.getDeptId();
R<String> deptName = sysClient.getDeptName(Long.valueOf(deptId)); R<String> deptName = sysClient.getDeptName(Long.valueOf(deptId));
if (deptName.isSuccess()&&StringUtils.isBlank(deptName.getData())){ if (deptName.isSuccess()&&StringUtils.isNotBlank(deptName.getData())){
personManagemetEntity.setUnitName(deptName.getData()); personManagemetEntity.setUnitName(deptName.getData());
} }
} }
if (ObjectUtil.isNotEmpty(personManagemetEntity)) { Integer count = baseMapper.selectCount(Wrappers.<PersonManagemetEntity>query().lambda()
.eq(PersonManagemetEntity::getUserId, personManagemetEntity.getUserId())
.eq(PersonManagemetEntity::getIsDeleted, 0));
if (count>0){
return R.fail("该用户已存在,请重新编辑!");
}
this.saveOrUpdate(personManagemetEntity); this.saveOrUpdate(personManagemetEntity);
} }
if (CollectionUtil.isNotEmpty(personManagemetVo.getCertificatetEntityList())) { if (CollectionUtil.isNotEmpty(personManagemetVo.getCertificatetEntityList())) {
List<CertificatetEntity> certificatetList = personManagemetVo.getCertificatetEntityList().stream().map( List<CertificatetEntity> certificatetList = personManagemetVo.getCertificatetEntityList().stream().map(
s -> { s -> {
if(StringUtils.isBlank(s.getPersonId())){
s.setPersonId(personManagemetEntity.getId().toString()); s.setPersonId(personManagemetEntity.getId().toString());
if (System.currentTimeMillis() > s.getDeadTime().getTime()){
s.setStatus(2);
}else {
s.setStatus(1);
} }
return s; return s;
} }
).collect(Collectors.toList()); ).collect(Collectors.toList());
certificatetService.saveOrUpdateBatch(certificatetList); certificatetService.saveOrUpdateBatch(certificatetList);
} }
return true; return R.success("保存成功");
} }
return false; return R.fail("保存失败");
} catch (Exception e) { }
log.error("入参 personManagemetVo" + personManagemetVo + ":" + e);
public static boolean allFieldsNull(Object obj) throws IllegalAccessException {
for (Field field : obj.getClass().getDeclaredFields()) {
field.setAccessible(true);
if (field.get(obj) != null) {
return false; return false;
} }
} }
return true;
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean removeByPersonManagemetVo(PersonManagemetVo personManagemetVo) { public Boolean removeByPersonManagemetVo(PersonManagemetVo personManagemetVo) {
@ -120,5 +133,22 @@ public class PresonManagementServiceImpl extends BaseServiceImpl<PersonManagemet
} }
} }
@Override
public List<PersonManagemetExportVo> exportPersonManagemet(PersonManagemetVo personManagemetVo) {
List<PersonManagemetExportVo> list = baseMapper.exportPersonManagemet(personManagemetVo.getType(), personManagemetVo.getDeadStartTime(), personManagemetVo.getDeadTime(),
personManagemetVo.getName(), personManagemetVo.getUnitName(), personManagemetVo.getSex(), personManagemetVo.getJob(),
personManagemetVo.getAcademicTitle(), personManagemetVo.getStatus());
list = list.stream().map(s -> {
CertificatetType[] types = CertificatetType.values();
for (int i = 0; i < types.length; i++) {
if (types[i].getValue().equals(s.getType())) {
s.setType(types[i].getKey());
}
}
return s;
}).collect(Collectors.toList());
return list;
}
} }

41
hzims-service/hzims-basic/src/main/java/com/hnac/hzims/basic/utils/CertificatetType.java

@ -0,0 +1,41 @@
package com.hnac.hzims.basic.utils;
import lombok.Getter;
/**
* 证书类型
* @author ty
*/
public enum CertificatetType
{
/**
* 电工证
*/
Electrician("1","电工证"),
/**
* 安全员证
*/
Safety("2","安全员证"),
/**
* 登高证
*/
Climbe("3","登高证"),
/**
* 桥机证
*/
Bridge("4","桥机证");
@Getter
private String value;
@Getter
private String key;
CertificatetType(String value, String key){
this.key = key;
this.value = value;
}
}

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/ConferenceController.java

@ -114,8 +114,8 @@ public class ConferenceController extends BladeController {
@ApiOperation(value = "会议记录分页") @ApiOperation(value = "会议记录分页")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public R<IPage<ConferenceRecordEntity>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<ConferenceRecordEntity>> recordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<ConferenceRecordEntity> page = conferenceRecordService.page(Condition.getPage(query), IPage<ConferenceRecordEntity> page = conferenceRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(
Condition.getQueryWrapper(param, ConferenceRecordEntity.class)); param, ConferenceRecordEntity.class).lambda().orderByDesc(ConferenceRecordEntity::getCreateTime));
return R.data(page); return R.data(page);
} }

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/HygieneController.java

@ -2,11 +2,9 @@ package com.hnac.hzims.safeproduct.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.common.utils.Condition;
import com.hnac.hzims.safeproduct.dto.HygienePlanDTO; import com.hnac.hzims.safeproduct.dto.HygienePlanDTO;
import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO; import com.hnac.hzims.safeproduct.dto.HygieneRecordDTO;
import com.hnac.hzims.safeproduct.entity.HygienePlanEntity; import com.hnac.hzims.safeproduct.entity.HygienePlanEntity;
import com.hnac.hzims.safeproduct.entity.HygieneRecordEntity;
import com.hnac.hzims.safeproduct.service.IHygienePlanService; import com.hnac.hzims.safeproduct.service.IHygienePlanService;
import com.hnac.hzims.safeproduct.service.IHygieneRecordService; import com.hnac.hzims.safeproduct.service.IHygieneRecordService;
import com.hnac.hzims.safeproduct.vo.HygienePlanDetailVO; import com.hnac.hzims.safeproduct.vo.HygienePlanDetailVO;

12
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/RehearsalController.java

@ -116,24 +116,24 @@ public class RehearsalController extends BladeController {
@ApiOperation(value = "演练记录分页") @ApiOperation(value = "演练记录分页")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public R<IPage<RehearsalRecordEntity>> rehearsalRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<RehearsalRecordEntity>> rehearsalRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<RehearsalRecordEntity> page = rehearsalRecordService.page(Condition.getPage(query), IPage<RehearsalRecordEntity> page = rehearsalRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(
Condition.getQueryWrapper(param, RehearsalRecordEntity.class)); param, RehearsalRecordEntity.class).lambda().orderByDesc(RehearsalRecordEntity::getCreateTime));
return R.data(page); return R.data(page);
} }
@GetMapping("/dataByMonth") @GetMapping("/dataByMonth")
@ApiOperation(value = "月度统计表") @ApiOperation(value = "月度统计表")
@ApiOperationSupport(order = 11) @ApiOperationSupport(order = 11)
public R<IPage<RehearsalMonthVO>> dataByMonth(@RequestParam String month, Query query) { public R<IPage<RehearsalMonthVO>> dataByMonth(@RequestParam String month, String unit, Query query) {
IPage<RehearsalMonthVO> page = rehearsalPlanService.dataByMonth(month, query); IPage<RehearsalMonthVO> page = rehearsalPlanService.dataByMonth(month, unit, query);
return R.data(page); return R.data(page);
} }
@GetMapping("/dataByYear") @GetMapping("/dataByYear")
@ApiOperation(value = "年度统计表") @ApiOperation(value = "年度统计表")
@ApiOperationSupport(order = 12) @ApiOperationSupport(order = 12)
public R<IPage<RehearsalYearVO>> dataByYear(@RequestParam String year, Query query) { public R<IPage<RehearsalYearVO>> dataByYear(@RequestParam String year, String unit, Query query) {
IPage<RehearsalYearVO> page = rehearsalPlanService.dataByYear(year, query); IPage<RehearsalYearVO> page = rehearsalPlanService.dataByYear(year, unit, query);
return R.data(page); return R.data(page);
} }

14
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/controller/TrainController.java

@ -128,7 +128,8 @@ public class TrainController extends BladeController {
@ApiOperation(value = "培训记录分页") @ApiOperation(value = "培训记录分页")
@ApiOperationSupport(order = 10) @ApiOperationSupport(order = 10)
public R<IPage<TrainRecordEntity>> trainRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<TrainRecordEntity>> trainRecordPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TrainRecordEntity> page = trainRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(param, TrainRecordEntity.class)); IPage<TrainRecordEntity> page = trainRecordService.page(Condition.getPage(query), Condition.getQueryWrapper(
param, TrainRecordEntity.class).lambda().orderByDesc(TrainRecordEntity::getCreateTime));
return R.data(page); return R.data(page);
} }
@ -176,7 +177,8 @@ public class TrainController extends BladeController {
@ApiOperation(value = "考试记录分页") @ApiOperation(value = "考试记录分页")
@ApiOperationSupport(order = 16) @ApiOperationSupport(order = 16)
public R<IPage<TestEntity>> testPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) { public R<IPage<TestEntity>> testPage(@ApiIgnore @RequestParam Map<String, Object> param, Query query) {
IPage<TestEntity> page = testService.page(Condition.getPage(query), Condition.getQueryWrapper(param, TestEntity.class)); IPage<TestEntity> page = testService.page(Condition.getPage(query), Condition.getQueryWrapper(param, TestEntity.class)
.lambda().orderByDesc(TestEntity::getCreateTime));
return R.data(page); return R.data(page);
} }
@ -206,16 +208,16 @@ public class TrainController extends BladeController {
@GetMapping("/trainDataByMonth") @GetMapping("/trainDataByMonth")
@ApiOperation(value = "培训月度统计表") @ApiOperation(value = "培训月度统计表")
@ApiOperationSupport(order = 20) @ApiOperationSupport(order = 20)
public R<IPage<TrainMonthVO>> trainDataByMonth(@RequestParam String month, Query query) { public R<IPage<TrainMonthVO>> trainDataByMonth(@RequestParam String month, String unit, Query query) {
IPage<TrainMonthVO> page = trainPlanService.dataByMonth(month, query); IPage<TrainMonthVO> page = trainPlanService.dataByMonth(month, unit, query);
return R.data(page); return R.data(page);
} }
@GetMapping("/trainDataByYear") @GetMapping("/trainDataByYear")
@ApiOperation(value = "培训年度统计表") @ApiOperation(value = "培训年度统计表")
@ApiOperationSupport(order = 21) @ApiOperationSupport(order = 21)
public R<IPage<TrainYearVO>> trainDataByYear(@RequestParam String year, Query query) { public R<IPage<TrainYearVO>> trainDataByYear(@RequestParam String year, String unit, Query query) {
IPage<TrainYearVO> page = trainPlanService.dataByYear(year, query); IPage<TrainYearVO> page = trainPlanService.dataByYear(year, unit, query);
return R.data(page); return R.data(page);
} }

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/ConferencePlanMapper.xml

@ -19,5 +19,7 @@
<if test="endTime != 'null' and endTime != ''"> <if test="endTime != 'null' and endTime != ''">
AND t1.scheduled_end_time &lt; #{endTime} AND t1.scheduled_end_time &lt; #{endTime}
</if> </if>
ORDER BY
t1.create_time DESC
</select> </select>
</mapper> </mapper>

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneRecordMapper.xml

@ -22,5 +22,7 @@
<if test="param.hygienePlanId != null and param.hygienePlanId != ''"> <if test="param.hygienePlanId != null and param.hygienePlanId != ''">
AND hygiene_plan_id = #{hygienePlanId} AND hygiene_plan_id = #{hygienePlanId}
</if> </if>
ORDER BY
create_time DESC
</select> </select>
</mapper> </mapper>

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/HygieneZoneMapper.java

@ -4,6 +4,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity; import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
/**
* 卫生自查责任区Mapper类
*
* @author liwen
* @date 2024-01-02
*/
@Mapper @Mapper
public interface HygieneZoneMapper extends BaseMapper<HygieneZoneEntity> { public interface HygieneZoneMapper extends BaseMapper<HygieneZoneEntity> {

9
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.java

@ -24,26 +24,29 @@ public interface RehearsalPlanMapper extends BaseMapper<RehearsalPlanEntity> {
/** /**
* 查询当月各单位的演练总数 * 查询当月各单位的演练总数
* @param page 分页类 * @param page 分页类
* @param unit 单位
* @param month 月份 * @param month 月份
* @return 当月的演练总数据 * @return 当月的演练总数据
*/ */
IPage<RehearsalMonthVO> selectByMonth(IPage<RehearsalMonthVO> page, String month); IPage<RehearsalMonthVO> selectByMonth(IPage<RehearsalMonthVO> page, String unit, String month);
/** /**
* 查询当月各单位已完成的演练数据 * 查询当月各单位已完成的演练数据
* @param page 分页类 * @param page 分页类
* @param unit 单位
* @param month 月份 * @param month 月份
* @return 当月的已完成数据 * @return 当月的已完成数据
*/ */
IPage<RehearsalMonthVO> selectFinishedDataByMonth(IPage<RehearsalMonthVO> page, String month); IPage<RehearsalMonthVO> selectFinishedDataByMonth(IPage<RehearsalMonthVO> page, String unit, String month);
/** /**
* 查询当年的所有单位 * 查询当年的所有单位
* @param page 分页类 * @param page 分页类
* @param unit 单位
* @param year 年份 * @param year 年份
* @return 年度单位数据 * @return 年度单位数据
*/ */
IPage<RehearsalYearVO> selectUnitByYear(IPage<RehearsalYearVO> page, @Param("year") String year); IPage<RehearsalYearVO> selectUnitByYear(IPage<RehearsalYearVO> page, String unit, @Param("year") String year);
/** /**
* 查询各单位全年已完成的演练数据 * 查询各单位全年已完成的演练数据

11
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/RehearsalPlanMapper.xml

@ -10,6 +10,9 @@
WHERE WHERE
is_deleted = 0 is_deleted = 0
AND scheduled_end_time like concat('%', #{month}, '%') AND scheduled_end_time like concat('%', #{month}, '%')
<if test="unit != null and unit != ''">
AND unit like concat('%', #{unit}, '%')
</if>
GROUP BY GROUP BY
unit unit
ORDER BY ORDER BY
@ -25,6 +28,9 @@
is_deleted = 0 is_deleted = 0
AND scheduled_end_time like concat('%', #{month}, '%') AND scheduled_end_time like concat('%', #{month}, '%')
AND rehearsal_status = 'FINISHED' AND rehearsal_status = 'FINISHED'
<if test="unit != null and unit != ''">
AND unit like concat('%', #{unit}, '%')
</if>
GROUP BY GROUP BY
unit unit
ORDER BY ORDER BY
@ -39,6 +45,9 @@
WHERE WHERE
is_deleted = 0 is_deleted = 0
AND scheduled_end_time like concat('%', #{year}, '%') AND scheduled_end_time like concat('%', #{year}, '%')
<if test="unit != null and unit != ''">
AND unit like concat('%', #{unit}, '%')
</if>
ORDER BY ORDER BY
unit unit
</select> </select>
@ -80,5 +89,7 @@
<if test="endTime != 'null' and endTime != ''"> <if test="endTime != 'null' and endTime != ''">
AND t1.scheduled_end_time &lt; #{endTime} AND t1.scheduled_end_time &lt; #{endTime}
</if> </if>
ORDER BY
t1.create_time DESC
</select> </select>
</mapper> </mapper>

4
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TestMapper.xml

@ -9,6 +9,10 @@
hzims_test hzims_test
WHERE WHERE
is_deleted = 0 is_deleted = 0
<if test="trainPlanId != null and trainPlanId != ''">
AND train_plan_id = #{trainPlanId} AND train_plan_id = #{trainPlanId}
</if>
ORDER BY
create_time DESC
</select> </select>
</mapper> </mapper>

9
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.java

@ -22,26 +22,29 @@ public interface TrainPlanMapper extends BaseMapper<TrainPlanEntity> {
/** /**
* 查询当月各单位的培训计划总数 * 查询当月各单位的培训计划总数
* @param page 分页类 * @param page 分页类
* @param unit 单位
* @param month 月份 * @param month 月份
* @return 当月培训计划总数 * @return 当月培训计划总数
*/ */
IPage<TrainMonthVO> selectByMonth(IPage<TrainMonthVO> page, String month); IPage<TrainMonthVO> selectByMonth(IPage<TrainMonthVO> page, String unit, String month);
/** /**
* 查询当月各单位已完成的培训计划数据 * 查询当月各单位已完成的培训计划数据
* @param page1 分页类 * @param page1 分页类
* @param unit 单位
* @param month 月份 * @param month 月份
* @return 当月已完成培训计划数 * @return 当月已完成培训计划数
*/ */
IPage<TrainMonthVO> selectFinishedDataByMonth(IPage<TrainMonthVO> page1, String month); IPage<TrainMonthVO> selectFinishedDataByMonth(IPage<TrainMonthVO> page1, String unit, String month);
/** /**
* 查询当年的所有单位 * 查询当年的所有单位
* @param page 分页类 * @param page 分页类
* @param unit 单位
* @param year 年份 * @param year 年份
* @return 年度单位数据 * @return 年度单位数据
*/ */
IPage<TrainYearVO> selectUnitByYear(IPage<TrainYearVO> page, String year); IPage<TrainYearVO> selectUnitByYear(IPage<TrainYearVO> page, String unit, String year);
/** /**
* 查询各单位全年已完成的培训计划数 * 查询各单位全年已完成的培训计划数

9
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/mapper/TrainPlanMapper.xml

@ -10,6 +10,9 @@
WHERE WHERE
is_deleted = 0 is_deleted = 0
AND scheduled_end_time like concat('%', #{month}, '%') AND scheduled_end_time like concat('%', #{month}, '%')
<if test="unit != null and unit != ''">
AND unit like concat('%', #{unit}, '%')
</if>
GROUP BY GROUP BY
unit unit
ORDER BY ORDER BY
@ -25,6 +28,9 @@
is_deleted = 0 is_deleted = 0
AND scheduled_end_time like concat('%', #{month}, '%') AND scheduled_end_time like concat('%', #{month}, '%')
AND train_status = 'FINISHED' AND train_status = 'FINISHED'
<if test="unit != null and unit != ''">
AND unit like concat('%', #{unit}, '%')
</if>
GROUP BY GROUP BY
unit unit
ORDER BY ORDER BY
@ -39,6 +45,9 @@
WHERE WHERE
is_deleted = 0 is_deleted = 0
AND scheduled_end_time like concat('%', #{year}, '%') AND scheduled_end_time like concat('%', #{year}, '%')
<if test="unit != null and unit != ''">
AND unit like concat('%', #{unit}, '%')
</if>
ORDER BY ORDER BY
unit unit
</select> </select>

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IHygieneZoneService.java

@ -5,6 +5,12 @@ import com.hnac.hzims.safeproduct.entity.HygieneZoneEntity;
import java.util.List; import java.util.List;
/**
* 卫生自查责任区服务类
*
* @author liwen
* @date 2024-01-02
*/
public interface IHygieneZoneService extends IService<HygieneZoneEntity> { public interface IHygieneZoneService extends IService<HygieneZoneEntity> {
/** /**

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/IRehearsalPlanService.java

@ -29,18 +29,20 @@ public interface IRehearsalPlanService extends IService<RehearsalPlanEntity> {
/** /**
* 演练月度数据 * 演练月度数据
* @param month 月份 * @param month 月份
* @param unit 单位
* @param query 分页类 * @param query 分页类
* @return 月度统计分页 * @return 月度统计分页
*/ */
IPage<RehearsalMonthVO> dataByMonth(String month, Query query); IPage<RehearsalMonthVO> dataByMonth(String month, String unit, Query query);
/** /**
* 演练年度数据 * 演练年度数据
* @param year 年份 * @param year 年份
* @param unit 单位
* @param query 分页类 * @param query 分页类
* @return 年度统计分页 * @return 年度统计分页
*/ */
IPage<RehearsalYearVO> dataByYear(String year, Query query); IPage<RehearsalYearVO> dataByYear(String year, String unit, Query query);
/** /**
* 演练计划数据导出 * 演练计划数据导出

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/ITrainPlanService.java

@ -22,18 +22,20 @@ public interface ITrainPlanService extends IService<TrainPlanEntity> {
/** /**
* 月度培训数据 * 月度培训数据
* @param month 月份 * @param month 月份
* @param unit 单位
* @param query 分页类 * @param query 分页类
* @return 月度培训分页 * @return 月度培训分页
*/ */
IPage<TrainMonthVO> dataByMonth(String month, Query query); IPage<TrainMonthVO> dataByMonth(String month, String unit, Query query);
/** /**
* 年度培训数据 * 年度培训数据
* @param year 年份 * @param year 年份
* @param unit 单位
* @param query 分页类 * @param query 分页类
* @return 年度培训分页 * @return 年度培训分页
*/ */
IPage<TrainYearVO> dataByYear(String year, Query query); IPage<TrainYearVO> dataByYear(String year, String unit, Query query);
/** /**
* 删除培训计划 * 删除培训计划

1
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/ConferencePlanServiceImpl.java

@ -73,6 +73,7 @@ public class ConferencePlanServiceImpl extends ServiceImpl<ConferencePlanMapper,
if (!endTime.equals("null") && !endTime.equals("")) { if (!endTime.equals("null") && !endTime.equals("")) {
queryWrapper.lambda().le(ConferencePlanEntity::getScheduledEndTime, endTime); queryWrapper.lambda().le(ConferencePlanEntity::getScheduledEndTime, endTime);
} }
queryWrapper.lambda().orderByDesc(ConferencePlanEntity::getCreateTime);
return this.page(Condition.getPage(query), queryWrapper); return this.page(Condition.getPage(query), queryWrapper);
} }

1
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygienePlanServiceImpl.java

@ -85,6 +85,7 @@ public class HygienePlanServiceImpl extends ServiceImpl<HygienePlanMapper, Hygie
if (!endTime.equals("null") && !endTime.equals("")) { if (!endTime.equals("null") && !endTime.equals("")) {
queryWrapper.lambda().le(HygienePlanEntity::getScheduledEndTime, endTime); queryWrapper.lambda().le(HygienePlanEntity::getScheduledEndTime, endTime);
} }
queryWrapper.lambda().orderByDesc(HygienePlanEntity::getCreateTime);
return this.page(Condition.getPage(query), queryWrapper); return this.page(Condition.getPage(query), queryWrapper);
} }

3
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java

@ -6,7 +6,6 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.converters.longconverter.LongStringConverter; import com.alibaba.excel.converters.longconverter.LongStringConverter;
import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.util.CollectionUtils;
import com.alibaba.excel.write.merge.LoopMergeStrategy;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy; import com.alibaba.excel.write.style.column.SimpleColumnWidthStyleStrategy;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -25,8 +24,6 @@ import com.hnac.hzims.safeproduct.utils.BaseUtil;
import com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO; import com.hnac.hzims.safeproduct.vo.HygieneRecordPageVO;
import com.hnac.hzims.safeproduct.vo.HygieneZoneDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneZoneDetailVO;
import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO; import com.hnac.hzims.safeproduct.vo.HygieneRecordDetailVO;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
import org.apache.poi.ss.usermodel.CellStyle;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;

6
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneZoneServiceImpl.java

@ -11,6 +11,12 @@ import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/**
* 卫生自查责任区服务实现类
*
* @author liwen
* @date 2024-01-02
*/
@Service @Service
public class HygieneZoneServiceImpl extends ServiceImpl<HygieneZoneMapper, HygieneZoneEntity> implements IHygieneZoneService { public class HygieneZoneServiceImpl extends ServiceImpl<HygieneZoneMapper, HygieneZoneEntity> implements IHygieneZoneService {

43
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalPlanServiceImpl.java

@ -32,6 +32,7 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
@ -68,10 +69,10 @@ public class RehearsalPlanServiceImpl extends ServiceImpl<RehearsalPlanMapper, R
* 演练月度数据 * 演练月度数据
*/ */
@Override @Override
public IPage<RehearsalMonthVO> dataByMonth(String month, Query query) { public IPage<RehearsalMonthVO> dataByMonth(String month, String unit, Query query) {
// 查询当月各单位的演练总数 // 查询当月各单位的演练总数
IPage<RehearsalMonthVO> page = new Page<>(query.getCurrent(), query.getSize()); IPage<RehearsalMonthVO> page = new Page<>(query.getCurrent(), query.getSize());
IPage<RehearsalMonthVO> unitPage = baseMapper.selectByMonth(page, month); IPage<RehearsalMonthVO> unitPage = baseMapper.selectByMonth(page, unit, month);
List<RehearsalMonthVO> unitList = unitPage.getRecords(); List<RehearsalMonthVO> unitList = unitPage.getRecords();
// 若无数据,返回空页面 // 若无数据,返回空页面
if (CollectionUtils.isEmpty(unitList)) { if (CollectionUtils.isEmpty(unitList)) {
@ -79,18 +80,18 @@ public class RehearsalPlanServiceImpl extends ServiceImpl<RehearsalPlanMapper, R
} }
// 查询当月各单位已完成的演练数据 // 查询当月各单位已完成的演练数据
IPage<RehearsalMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize()); IPage<RehearsalMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize());
IPage<RehearsalMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month); IPage<RehearsalMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, unit, month);
List<RehearsalMonthVO> finishedList = finishedPage.getRecords(); List<RehearsalMonthVO> finishedList = finishedPage.getRecords();
// 处理统计数据 // 处理统计数据
for (RehearsalMonthVO unit : unitList) { for (RehearsalMonthVO u : unitList) {
Long taskNum = unit.getScheduledTaskNum(); Long taskNum = u.getScheduledTaskNum();
Optional<RehearsalMonthVO> finishedRehearsal = finishedList.stream().filter(x -> x.getUnit().equals(unit.getUnit())).findFirst(); Optional<RehearsalMonthVO> finishedRehearsal = finishedList.stream().filter(x -> x.getUnit().equals(u.getUnit())).findFirst();
Long finishedTaskNum = finishedRehearsal.isPresent() ? finishedRehearsal.get().getFinishedTaskNum() : 0L; Long finishedTaskNum = finishedRehearsal.isPresent() ? finishedRehearsal.get().getFinishedTaskNum() : 0L;
unit.setFinishedTaskNum(finishedTaskNum); u.setFinishedTaskNum(finishedTaskNum);
unit.setUnfinishedTaskNum(taskNum - finishedTaskNum); u.setUnfinishedTaskNum(taskNum - finishedTaskNum);
BigDecimal taskDecimal = new BigDecimal(taskNum); BigDecimal taskDecimal = new BigDecimal(taskNum);
BigDecimal finishedDecimal = new BigDecimal(finishedTaskNum); BigDecimal finishedDecimal = new BigDecimal(finishedTaskNum);
unit.setTaskCompletionRate(finishedDecimal.divide(taskDecimal, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")) u.setTaskCompletionRate(finishedDecimal.divide(taskDecimal, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))
.setScale(2, RoundingMode.HALF_UP)); .setScale(2, RoundingMode.HALF_UP));
} }
unitPage.setRecords(unitList); unitPage.setRecords(unitList);
@ -101,10 +102,10 @@ public class RehearsalPlanServiceImpl extends ServiceImpl<RehearsalPlanMapper, R
* 演练年度数据 * 演练年度数据
*/ */
@Override @Override
public IPage<RehearsalYearVO> dataByYear(String year, Query query) { public IPage<RehearsalYearVO> dataByYear(String year, String unit, Query query) {
IPage<RehearsalYearVO> page = new Page<>(query.getCurrent(), query.getSize()); IPage<RehearsalYearVO> page = new Page<>(query.getCurrent(), query.getSize());
// 查询当年的所有单位 // 查询当年的所有单位
IPage<RehearsalYearVO> unitPage = baseMapper.selectUnitByYear(page, year); IPage<RehearsalYearVO> unitPage = baseMapper.selectUnitByYear(page, unit, year);
List<RehearsalYearVO> records = unitPage.getRecords(); List<RehearsalYearVO> records = unitPage.getRecords();
// 若无数据,返回空页面 // 若无数据,返回空页面
if (CollectionUtils.isEmpty(records)) { if (CollectionUtils.isEmpty(records)) {
@ -114,49 +115,66 @@ public class RehearsalPlanServiceImpl extends ServiceImpl<RehearsalPlanMapper, R
// 查询各单位全年已完成的演练数据 // 查询各单位全年已完成的演练数据
List<AnalysisYearDTO> unitMonthDataList = baseMapper.selectFinishedDataByUnit(unitList, year); List<AnalysisYearDTO> unitMonthDataList = baseMapper.selectFinishedDataByUnit(unitList, year);
// 将各单位每个月的演练数据写入统计列表 // 将各单位每个月的演练数据写入统计列表
List<RehearsalYearVO> res = new ArrayList<>();
unitMonthDataList.forEach(data -> { unitMonthDataList.forEach(data -> {
RehearsalYearVO rehearsalYearVO = records.stream().filter(x -> x.getUnit().equals(data.getUnit())) RehearsalYearVO rehearsalYearVO = records.stream().filter(x -> x.getUnit().equals(data.getUnit()))
.collect(Collectors.toList()).get(0); .collect(Collectors.toList()).get(0);
long sum = rehearsalYearVO.getSum() == null ? 0 : rehearsalYearVO.getSum();
// 根据月份匹配写入对应字段 // 根据月份匹配写入对应字段
switch (data.getDateTime()) { switch (data.getDateTime()) {
case "01": case "01":
rehearsalYearVO.setJanuaryNum(data.getFinishedNum()); rehearsalYearVO.setJanuaryNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "02": case "02":
rehearsalYearVO.setFebruaryNum(data.getFinishedNum()); rehearsalYearVO.setFebruaryNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "03": case "03":
rehearsalYearVO.setMarchNum(data.getFinishedNum()); rehearsalYearVO.setMarchNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "04": case "04":
rehearsalYearVO.setAprilNum(data.getFinishedNum()); rehearsalYearVO.setAprilNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "05": case "05":
rehearsalYearVO.setMayNum(data.getFinishedNum()); rehearsalYearVO.setMayNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "06": case "06":
rehearsalYearVO.setJuneNum(data.getFinishedNum()); rehearsalYearVO.setJuneNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "07": case "07":
rehearsalYearVO.setJulyNum(data.getFinishedNum()); rehearsalYearVO.setJulyNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "08": case "08":
rehearsalYearVO.setAugustNum(data.getFinishedNum()); rehearsalYearVO.setAugustNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "09": case "09":
rehearsalYearVO.setSeptemberNum(data.getFinishedNum()); rehearsalYearVO.setSeptemberNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "10": case "10":
rehearsalYearVO.setOctoberNum(data.getFinishedNum()); rehearsalYearVO.setOctoberNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "11": case "11":
rehearsalYearVO.setNovemberNum(data.getFinishedNum()); rehearsalYearVO.setNovemberNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "12": case "12":
rehearsalYearVO.setDecemberNum(data.getFinishedNum()); rehearsalYearVO.setDecemberNum(data.getFinishedNum());
rehearsalYearVO.setSum(sum + data.getFinishedNum());
}
if (rehearsalYearVO.getSum() != 0) {
res.add(rehearsalYearVO);
} }
}); });
unitPage.setRecords(records); unitPage.setRecords(res);
return unitPage; return unitPage;
} }
@ -259,6 +277,7 @@ public class RehearsalPlanServiceImpl extends ServiceImpl<RehearsalPlanMapper, R
if (!endTime.equals("null") && !endTime.equals("")) { if (!endTime.equals("null") && !endTime.equals("")) {
queryWrapper.lambda().le(RehearsalPlanEntity::getScheduledEndTime, endTime); queryWrapper.lambda().le(RehearsalPlanEntity::getScheduledEndTime, endTime);
} }
queryWrapper.lambda().orderByDesc(RehearsalPlanEntity::getCreateTime);
return this.page(Condition.getPage(query), queryWrapper); return this.page(Condition.getPage(query), queryWrapper);
} }
} }

45
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainPlanServiceImpl.java

@ -34,6 +34,7 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Optional; import java.util.Optional;
@ -58,10 +59,10 @@ public class TrainPlanServiceImpl extends ServiceImpl<TrainPlanMapper, TrainPlan
* 月度培训数据 * 月度培训数据
*/ */
@Override @Override
public IPage<TrainMonthVO> dataByMonth(String month, Query query) { public IPage<TrainMonthVO> dataByMonth(String month, String unit, Query query) {
// 查询当月各单位的培训计划总数 // 查询当月各单位的培训计划总数
IPage<TrainMonthVO> page = new Page<>(query.getCurrent(), query.getSize()); IPage<TrainMonthVO> page = new Page<>(query.getCurrent(), query.getSize());
IPage<TrainMonthVO> unitPage = baseMapper.selectByMonth(page, month); IPage<TrainMonthVO> unitPage = baseMapper.selectByMonth(page, unit, month);
List<TrainMonthVO> unitList = unitPage.getRecords(); List<TrainMonthVO> unitList = unitPage.getRecords();
// 若无数据,返回空页面 // 若无数据,返回空页面
if (CollectionUtils.isEmpty(unitList)) { if (CollectionUtils.isEmpty(unitList)) {
@ -69,18 +70,18 @@ public class TrainPlanServiceImpl extends ServiceImpl<TrainPlanMapper, TrainPlan
} }
// 查询当月各单位已完成的培训数据 // 查询当月各单位已完成的培训数据
IPage<TrainMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize()); IPage<TrainMonthVO> page1 = new Page<>(query.getCurrent(), query.getSize());
IPage<TrainMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, month); IPage<TrainMonthVO> finishedPage = baseMapper.selectFinishedDataByMonth(page1, unit, month);
List<TrainMonthVO> finishedList = finishedPage.getRecords(); List<TrainMonthVO> finishedList = finishedPage.getRecords();
// 处理统计数据 // 处理统计数据
for (TrainMonthVO unit : unitList) { for (TrainMonthVO u : unitList) {
Long taskNum = unit.getScheduledTrainNum(); Long taskNum = u.getScheduledTrainNum();
Optional<TrainMonthVO> finishedRehearsal = finishedList.stream().filter(x -> x.getUnit().equals(unit.getUnit())).findFirst(); Optional<TrainMonthVO> finishedRehearsal = finishedList.stream().filter(x -> x.getUnit().equals(u.getUnit())).findFirst();
Long finishedTaskNum = finishedRehearsal.isPresent() ? finishedRehearsal.get().getFinishedTrainNum() : 0L; Long finishedTaskNum = finishedRehearsal.isPresent() ? finishedRehearsal.get().getFinishedTrainNum() : 0L;
unit.setFinishedTrainNum(finishedTaskNum); u.setFinishedTrainNum(finishedTaskNum);
unit.setUnfinishedTrainNum(taskNum - finishedTaskNum); u.setUnfinishedTrainNum(taskNum - finishedTaskNum);
BigDecimal taskDecimal = new BigDecimal(taskNum); BigDecimal taskDecimal = new BigDecimal(taskNum);
BigDecimal finishedDecimal = new BigDecimal(finishedTaskNum); BigDecimal finishedDecimal = new BigDecimal(finishedTaskNum);
unit.setCompletionRate(finishedDecimal.divide(taskDecimal, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")) u.setCompletionRate(finishedDecimal.divide(taskDecimal, 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))
.setScale(2, RoundingMode.HALF_UP)); .setScale(2, RoundingMode.HALF_UP));
} }
unitPage.setRecords(unitList); unitPage.setRecords(unitList);
@ -91,10 +92,10 @@ public class TrainPlanServiceImpl extends ServiceImpl<TrainPlanMapper, TrainPlan
* 年度培训数据 * 年度培训数据
*/ */
@Override @Override
public IPage<TrainYearVO> dataByYear(String year, Query query) { public IPage<TrainYearVO> dataByYear(String year, String unit, Query query) {
IPage<TrainYearVO> page = new Page<>(query.getCurrent(), query.getSize()); IPage<TrainYearVO> page = new Page<>(query.getCurrent(), query.getSize());
// 查询当年的所有单位 // 查询当年的所有单位
IPage<TrainYearVO> unitPage = baseMapper.selectUnitByYear(page, year); IPage<TrainYearVO> unitPage = baseMapper.selectUnitByYear(page, unit, year);
List<TrainYearVO> records = unitPage.getRecords(); List<TrainYearVO> records = unitPage.getRecords();
// 若无数据,返回空页面 // 若无数据,返回空页面
if (CollectionUtils.isEmpty(records)) { if (CollectionUtils.isEmpty(records)) {
@ -104,49 +105,66 @@ public class TrainPlanServiceImpl extends ServiceImpl<TrainPlanMapper, TrainPlan
// 查询各单位全年已完成的培训计划数 // 查询各单位全年已完成的培训计划数
List<AnalysisYearDTO> unitMonthDataList = baseMapper.selectFinishedDataByUnit(unitList, year); List<AnalysisYearDTO> unitMonthDataList = baseMapper.selectFinishedDataByUnit(unitList, year);
// 将各单位每个月的培训计划数据写入统计列表 // 将各单位每个月的培训计划数据写入统计列表
List<TrainYearVO> res = new ArrayList<>();
unitMonthDataList.forEach(data -> { unitMonthDataList.forEach(data -> {
TrainYearVO trainYearVO = records.stream().filter(x -> x.getUnit().equals(data.getUnit())) TrainYearVO trainYearVO = records.stream().filter(x -> x.getUnit().equals(data.getUnit()))
.collect(Collectors.toList()).get(0); .collect(Collectors.toList()).get(0);
long sum = trainYearVO.getSum() == null ? 0 : trainYearVO.getSum();
// 根据月份匹配写入对应字段 // 根据月份匹配写入对应字段
switch (data.getDateTime()) { switch (data.getDateTime()) {
case "01": case "01":
trainYearVO.setJanuaryNum(data.getFinishedNum()); trainYearVO.setJanuaryNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "02": case "02":
trainYearVO.setFebruaryNum(data.getFinishedNum()); trainYearVO.setFebruaryNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "03": case "03":
trainYearVO.setMarchNum(data.getFinishedNum()); trainYearVO.setMarchNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "04": case "04":
trainYearVO.setAprilNum(data.getFinishedNum()); trainYearVO.setAprilNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "05": case "05":
trainYearVO.setMayNum(data.getFinishedNum()); trainYearVO.setMayNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "06": case "06":
trainYearVO.setJuneNum(data.getFinishedNum()); trainYearVO.setJuneNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "07": case "07":
trainYearVO.setJulyNum(data.getFinishedNum()); trainYearVO.setJulyNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "08": case "08":
trainYearVO.setAugustNum(data.getFinishedNum()); trainYearVO.setAugustNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "09": case "09":
trainYearVO.setSeptemberNum(data.getFinishedNum()); trainYearVO.setSeptemberNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "10": case "10":
trainYearVO.setOctoberNum(data.getFinishedNum()); trainYearVO.setOctoberNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "11": case "11":
trainYearVO.setNovemberNum(data.getFinishedNum()); trainYearVO.setNovemberNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
break; break;
case "12": case "12":
trainYearVO.setDecemberNum(data.getFinishedNum()); trainYearVO.setDecemberNum(data.getFinishedNum());
trainYearVO.setSum(sum + data.getFinishedNum());
}
if (trainYearVO.getSum() != 0) {
res.add(trainYearVO);
} }
}); });
unitPage.setRecords(records); unitPage.setRecords(res);
return unitPage; return unitPage;
} }
@ -256,6 +274,7 @@ public class TrainPlanServiceImpl extends ServiceImpl<TrainPlanMapper, TrainPlan
if (!endTime.equals("null") && !endTime.equals("")) { if (!endTime.equals("null") && !endTime.equals("")) {
queryWrapper.lambda().le(TrainPlanEntity::getScheduledEndTime, endTime); queryWrapper.lambda().le(TrainPlanEntity::getScheduledEndTime, endTime);
} }
queryWrapper.lambda().orderByDesc(TrainPlanEntity::getCreateTime);
return this.page(Condition.getPage(query), queryWrapper); return this.page(Condition.getPage(query), queryWrapper);
} }
@ -277,7 +296,7 @@ public class TrainPlanServiceImpl extends ServiceImpl<TrainPlanMapper, TrainPlan
if (!endTime.equals("null")) { if (!endTime.equals("null")) {
queryWrapper.lt(TrainPlanEntity::getScheduledEndTime, endTime); queryWrapper.lt(TrainPlanEntity::getScheduledEndTime, endTime);
} }
queryWrapper.orderByDesc(TrainPlanEntity::getScheduledEndTime); queryWrapper.orderByDesc(TrainPlanEntity::getCreateTime);
return this.list(queryWrapper); return this.list(queryWrapper);
} }
} }

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/TrainRecordServiceImpl.java

@ -213,7 +213,7 @@ public class TrainRecordServiceImpl extends ServiceImpl<TrainRecordMapper, Train
if (!trainPlanId.equals("null")) { if (!trainPlanId.equals("null")) {
queryWrapper.ge(TrainRecordEntity::getTrainPlanId, trainPlanId); queryWrapper.ge(TrainRecordEntity::getTrainPlanId, trainPlanId);
} }
queryWrapper.orderByDesc(TrainRecordEntity::getActualEndTime); queryWrapper.orderByDesc(TrainRecordEntity::getCreateTime);
return this.list(queryWrapper); return this.list(queryWrapper);
} }
} }

Loading…
Cancel
Save