Browse Source

feat: 完善维修养护记录审批

master_tdsql
hxh 9 months ago
parent
commit
d723c256c7
  1. 58
      shuili-system/src/main/java/com/kms/yxgh/df/dto/DfYhRecordApprovalDto.java
  2. 7
      shuili-system/src/main/java/com/kms/yxgh/df/mapper/DfYhRecordMapper.java
  3. 19
      shuili-system/src/main/java/com/kms/yxgh/df/service/DfYhRecordService.java
  4. 7
      shuili-system/src/main/resources/mapper/yxgh/DfYhPlanMapper.xml
  5. 73
      shuili-system/src/main/resources/mapper/yxgh/DfYhRecordMapper.xml

58
shuili-system/src/main/java/com/kms/yxgh/df/dto/DfYhRecordApprovalDto.java

@ -0,0 +1,58 @@
package com.kms.yxgh.df.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.kms.yxgh.common.dto.OperatorDto;
import com.kms.yxgh.common.dto.SupplementDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 堤防维修养护记录
*
* @author sy
* @date 2023-11-20
*/
@Data
@ApiModel("堤防维修养护记录验收列表")
public class DfYhRecordApprovalDto {
@ApiModelProperty("养护记录id")
private String id;
@ApiModelProperty("堤防代码")
private String dikeCode;
@ApiModelProperty("堤防名称")
private String dikeName;
@ApiModelProperty("堤防类型")
private Integer dikeType;
@ApiModelProperty("维修养护类型")
private String type;
@ApiModelProperty("计划代码")
private String planId;
@ApiModelProperty("计划名称")
private String planName;
@ApiModelProperty("资金")
private List<SupplementDto> supplements;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty("完成时间")
private Date finishedTime;
@ApiModelProperty("维修养护负责人")
private OperatorDto responsiblePerson;
@ApiModelProperty("工程单位")
private String engineeringUnit;
}

7
shuili-system/src/main/java/com/kms/yxgh/df/mapper/DfYhRecordMapper.java

@ -2,7 +2,11 @@ package com.kms.yxgh.df.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kms.yxgh.common.dto.ApprovalDetailDto;
import com.kms.yxgh.common.dto.ApprovalSearchDto;
import com.kms.yxgh.df.domain.DfYhRecord;
import com.kms.yxgh.df.dto.DfYhRecordApprovalDto;
import com.kms.yxgh.df.dto.DfYhRecordDetailDto;
import com.kms.yxgh.df.dto.DfYhRecordSearchDto;
import org.apache.ibatis.annotations.Param;
@ -57,7 +61,10 @@ public interface DfYhRecordMapper extends BaseMapper<DfYhRecord> {
IPage<DfYhRecordDetailDto> searchPage(IPage<DfYhRecordDetailDto> page, @Param("searchDto") DfYhRecordSearchDto searchDto);
@Select("SELECT MAX(create_time) FROM bs_sgc_df_yhjl WHERE dike_code = #{dikeCode} ")
Date getLastInsertTimeByDikeCode(@Param("dikeCode") String dikeCode);
IPage<ApprovalDetailDto<DfYhRecordApprovalDto>> approvalSearchPage(Page<DfYhRecordSearchDto> page,@Param("dto") ApprovalSearchDto<DfYhRecordSearchDto> data);
}

19
shuili-system/src/main/java/com/kms/yxgh/df/service/DfYhRecordService.java

@ -5,17 +5,21 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kms.system.service.SysUserService;
import com.kms.yxgh.base.DfException;
import com.kms.yxgh.base.enums.YhRecordStatus;
import com.kms.yxgh.common.ApprovalStatusEnum;
import com.kms.yxgh.common.dto.*;
import com.kms.yxgh.common.service.ApprovalBusinessService;
import com.kms.yxgh.df.domain.DfYhRecord;
import com.kms.yxgh.df.dto.DfYhPlanSearchDto;
import com.kms.yxgh.df.dto.DfYhRecordApprovalDto;
import com.kms.yxgh.df.dto.DfYhRecordDetailDto;
import com.kms.yxgh.df.dto.DfYhRecordSearchDto;
import com.kms.yxgh.df.mapper.DfYhRecordMapper;
import com.kms.yxgh.util.BeanCopyUtils;
import com.shuili.common.core.domain.SearchParam;
import com.shuili.common.core.domain.entity.SysUser;
import com.shuili.common.core.service.BaseService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
@ -33,9 +37,10 @@ import java.util.Optional;
*/
@AllArgsConstructor
@Service
public class DfYhRecordService extends BaseService<DfYhRecordMapper, DfYhRecord> implements ApprovalBusinessService<DfYhRecordSearchDto, DfYhRecordDetailDto> {
public class DfYhRecordService extends BaseService<DfYhRecordMapper, DfYhRecord> implements ApprovalBusinessService<DfYhRecordSearchDto, DfYhRecordApprovalDto> {
private final DfYhPlanService dfYhPlanService;
private final SysUserService sysUserService;
public DfYhRecordDetailDto getDetailById(String id) {
DfYhRecord record = this.getBaseMapper().selectById(id);
@ -120,12 +125,20 @@ public class DfYhRecordService extends BaseService<DfYhRecordMapper, DfYhRecord>
}
@Override
public IPage<ApprovalDetailDto<DfYhRecordDetailDto>> approvalSearch(SearchParam<ApprovalSearchDto<DfYhRecordSearchDto>> sp) {
return null;
public IPage<ApprovalDetailDto<DfYhRecordApprovalDto>> approvalSearch(SearchParam<ApprovalSearchDto<DfYhRecordSearchDto>> sp) {
Page<DfYhRecordSearchDto> page = new Page<>(sp.getPageNum(), sp.getPageSize());
return this.getBaseMapper().approvalSearchPage(page, sp.getData());
}
@Override
public List<OperatorDto> getOperatorList(String formId) {
SysUser user = sysUserService.getById("1");
if (user != null) {
OperatorDto operatorDto = new OperatorDto();
operatorDto.setUid(user.getId());
operatorDto.setName(user.getNickName());
return Collections.singletonList(operatorDto);
}
return Collections.emptyList();
}

7
shuili-system/src/main/resources/mapper/yxgh/DfYhPlanMapper.xml

@ -12,7 +12,7 @@
<result property="operator" column="operator" typeHandler="com.kms.yxgh.common.mapper.handler.OperatorHandler"/>
<result property="doc" column="ts_doc" typeHandler="com.kms.yxgh.common.mapper.handler.ListDocHandler"/>
<association property="detail" javaType="com.kms.yxgh.df.dto.DfYhPlanDetailDto">
<id property="id" column="dike_id"/>
<id property="id" column="yh_id"/>
<result property="dikeCode" column="dike_code"/>
<result property="dikeName" column="dike_name"/>
<result property="dikeType" column="dike_type"/>
@ -35,7 +35,8 @@
SELECT ts.id id, ts.form_id formId, ts.create_time submit_time, ts.approval_time approval_time, ts.status
status,
ts.operator operator, ts.comment comment, ts.doc ts_doc,
yh.dike_code dike_code, yh.dike_name dike_name, yh.name plan_name, yh.start_date start_date, yh.end_date
yh.id yh_id, yh.dike_code dike_code, yh.dike_name dike_name, yh.name plan_name, yh.start_date start_date,
yh.end_date
end_date,
yh.supplement supplement, yh.doc doc, yh.engineering_unit engineering_unit, yh.responsible_person
responsible_person,
@ -46,7 +47,7 @@
LEFT JOIN att_dike_base jb ON yh.dike_code = jb.dike_code and jb.expr_date is null
WHERE ts.business_type = #{dto.businessType}
<if test='dto.status != null'>
<if test='dto.status != null and dto.status != ""'>
AND ts.status = #{dto.status}
</if>
<if test='dto.condition.dikeCode != null and dto.condition.dikeCode != ""'>

73
shuili-system/src/main/resources/mapper/yxgh/DfYhRecordMapper.xml

@ -0,0 +1,73 @@
<?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.kms.yxgh.df.mapper.DfYhRecordMapper">
<resultMap id="approvalMap" type="com.kms.yxgh.common.dto.ApprovalDetailDto">
<id property="id" column="id"/>
<result property="formId" column="formId"/>
<result property="submitTime" column="submit_time"/>
<result property="approvalTime" column="approval_time"/>
<result property="status" column="status"/>
<result property="comment" column="comment"/>
<result property="operator" column="operator" typeHandler="com.kms.yxgh.common.mapper.handler.OperatorHandler"/>
<result property="doc" column="ts_doc" typeHandler="com.kms.yxgh.common.mapper.handler.ListDocHandler"/>
<association property="detail" javaType="com.kms.yxgh.df.dto.DfYhRecordApprovalDto">
<id property="id" column="jl_id"/>
<result property="dikeCode" column="dike_code"/>
<result property="dikeName" column="dike_name"/>
<result property="dikeType" column="dike_type"/>
<result property="planName" column="plan_name"/>
<result property="planId" column="plan_id"/>
<result property="finishedTime" column="start_date"/>
<result property="supplements" column="supplement"
typeHandler="com.kms.yxgh.common.mapper.handler.ListSupplementHandler"/>
<result property="engineeringUnit" column="engineering_unit"/>
<result property="responsiblePerson" column="responsible_person"
typeHandler="com.kms.yxgh.common.mapper.handler.OperatorHandler"/>
<result property="type" column="type"/>
</association>
</resultMap>
<select id="approvalSearchPage" resultMap="approvalMap">
SELECT ts.id id, ts.form_id formId, ts.create_time submit_time, ts.approval_time approval_time, ts.status
status,
ts.operator operator, ts.comment comment, ts.doc ts_doc,
jl.id jl_id, jl.create_time finished_time,
yh.id plan_id,yh.dike_code dike_code, yh.dike_name dike_name, yh.name plan_name, yh.start_date start_date,
yh.end_date
end_date,
yh.supplement supplement, yh.doc doc, yh.engineering_unit engineering_unit, yh.responsible_person
responsible_person,
yh.type type
FROM bs_sgc_sp_task ts
LEFT JOIN bs_sgc_sp_operator op ON ts.id = op.task_id and op.uid = #{dto.userId}
LEFT JOIN bs_sgc_df_yhjl jl ON jl.id = ts.form_id
LEFT JOIN bs_sgc_df_yhjh yh ON yh.id = jl.plan_id
LEFT JOIN att_dike_base jb ON yh.dike_code = jb.dike_code and jb.expr_date is null
WHERE ts.business_type = #{dto.businessType}
<if test='dto.status != null and dto.status != ""'>
AND ts.status = #{dto.status}
</if>
<if test='dto.condition.dikeCode != null and dto.condition.dikeCode != ""'>
AND yh.dike_code = #{dto.condition.dikeCode}
</if>
<if test='dto.condition.name != null'>
AND yh.name LIKE CONCAT('%',#{dto.condition.name},'%')
</if>
<if test='dto.condition.adcd != null and dto.condition.adcd != ""'>
AND jb.adcd LIKE CONCAT(#{dto.condition.adcd},'%')
</if>
<if test='dto.condition.dikeName != null and dto.condition.dikeName != ""'>
AND yh.dike_name LIKE CONCAT('%',#{dto.condition.dikeName},'%')
</if>
<if test='dto.condition.startDate != null'>
AND yh.start_date &gt;= #{dto.condition.startDate}
</if>
<if test='dto.condition.endDate != null'>
AND yh.end_date &lt;= #{dto.condition.endDate}
</if>
ORDER BY yh.create_time DESC
</select>
</mapper>
Loading…
Cancel
Save