refactor: 重写绑定零部件选择标准接口

This commit is contained in:
2024-04-19 17:28:51 +08:00
parent 5e7d1898b2
commit 319294cf0e
4 changed files with 91 additions and 64 deletions
@@ -1,10 +1,14 @@
package com.jero.modules.laws.bindPart.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.jero.common.aspect.annotation.Dict;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
@@ -12,7 +16,9 @@ import java.util.Date;
* @Date: 2024/4/18 10:09
*/
@Data
public class BindPartStandardVO {
@NoArgsConstructor
@AllArgsConstructor
public class BindPartStandardVO implements Serializable {
/**
* id
*/
@@ -38,7 +44,7 @@ public class BindPartStandardVO {
* 标准状态
*/
@ApiModelProperty(value = "企标标准状态")
@Dict(dicCode = "es_standard_state")
@Dict(dicCode = "es_status")
private String esStandardState;
/**
* 发布日期
@@ -58,4 +64,7 @@ public class BindPartStandardVO {
*/
@ApiModelProperty(value = "拆分条款记录Id(选择条款用)")
private String infoId;
@TableField(exist = false)
private static final long serialVersionUID = 1L;
}
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.modules.laws.bindPart.entity.BindPartStandardVO;
import com.jero.modules.laws.bindPart.entity.LawsBindPart;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jero.modules.laws.enterprise.entity.vo.EnterpriseStandardPlanVo;
import org.apache.ibatis.annotations.Param;
/**
@@ -16,8 +15,6 @@ import org.apache.ibatis.annotations.Param;
public interface LawsBindPartMapper extends BaseMapper<LawsBindPart> {
IPage<LawsBindPart> page(IPage<LawsBindPart> page, @Param("param") LawsBindPart lawsBindPart);
IPage<BindPartStandardVO> selectStandard(IPage<BindPartStandardVO> page, @Param("param") BindPartStandardVO bindPartStandardVO);
}
@@ -1,7 +1,5 @@
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jero.modules.laws.bindPart.mapper.LawsBindPartMapper">
<resultMap id="BaseResultMap" type="com.jero.modules.laws.bindPart.entity.LawsBindPart">
@@ -78,56 +76,4 @@
GROUP BY
bp.id
</select>
<select id="selectStandard" resultType="com.jero.modules.laws.bindPart.entity.BindPartStandardVO">
select
standard.id as id,
standard.standard_number as standardNumber,
standard.standard_name as standardName,
standard.release_date as releaseDate,
standard.standard_state as standardState,
standard.standard_state as esStandardState,
<choose>
<when test="param.standardType == '1' or param.standardType == '' or param.standardType == null">
1 AS standardType
</when>
<when test="param.standardType == '2'">
2 AS standardType
</when>
<when test="param.standardType == '3'">
3 AS standardType
</when>
</choose>
FROM
<choose>
<when test="param.standardType == '1' or param.standardType == '' or param.standardType == null">
laws_domestic_standard AS standard
</when>
<when test="param.standardType == '2'">
laws_overseas_standard AS standard
</when>
<when test="param.standardType == '3'">
laws_enterprise_standard AS standard
</when>
</choose>
<where>
standard.del_flag = 0
<!--标准号或标准名称-->
<if test="param.standardName != null and param.standardName != ''">
AND standard.standard_number LIKE CONCAT('%',#{param.standardName},'%') OR
standard.standard_name LIKE CONCAT('%',#{param.standardName},'%')
</if>
<choose>
<when test="param.standardType == '1' or param.standardType == '' or param.standardType == null">
AND standard.standard_state <![CDATA[<>]]> '7'
</when>
<when test="param.standardType == '2'">
AND standard.standard_state <![CDATA[<>]]> '7'
</when>
<when test="param.standardType == '3'">
AND standard.standard_state <![CDATA[<>]]> '9'
</when>
</choose>
</where>
</select>
</mapper>
@@ -5,16 +5,28 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.jero.common.constant.enums.TableEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.modules.activiti.process.common.enums.StandardStateEnum;
import com.jero.modules.laws.bindPart.entity.BindPartStandardVO;
import com.jero.modules.laws.bindPart.entity.LawsBindPart;
import com.jero.modules.laws.bindPart.entity.LawsBindPartDoc;
import com.jero.modules.laws.bindPart.service.ILawsBindPartDocService;
import com.jero.modules.laws.bindPart.service.ILawsBindPartService;
import com.jero.modules.laws.bindPart.mapper.LawsBindPartMapper;
import com.jero.modules.laws.enterprise.util.BeanCopyUtils;
import com.jero.modules.laws.standard.controller.LawsDomesticController;
import com.jero.modules.laws.standard.controller.LawsOverseasController;
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
import com.jero.modules.laws.standard.entity.LawsOverseasStandard;
import com.jero.modules.laws.standard.service.ILawsDomesticStandardService;
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
import com.jero.modules.laws.standard.service.ILawsOverseasStandardService;
import com.jero.modules.onlyoffice.entity.StandardFileType;
import com.jero.modules.split.entity.SarFileSplitInfoEO;
import com.jero.modules.split.service.ISarFileSplitInfoService;
import com.jero.modules.tag.enums.TableNameEnum;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -42,6 +54,15 @@ public class LawsBindPartServiceImpl extends ServiceImpl<LawsBindPartMapper, Law
@Resource
private ILawsBindPartDocService lawsBindPartDocService;
@Resource
private ILawsDomesticStandardService gbService;
@Resource
private ILawsOverseasStandardService fbService;
@Resource
private ILawsEnterpriseStandardService esService;
@Override
public IPage<LawsBindPart> queryPage(LawsBindPart lawsBindPart, Integer pageNo, Integer pageSize, HttpServletRequest req) {
IPage<LawsBindPart> page = new Page<>(pageNo, pageSize);
@@ -114,9 +135,63 @@ public class LawsBindPartServiceImpl extends ServiceImpl<LawsBindPartMapper, Law
@Override
public IPage<BindPartStandardVO> selectStandard(BindPartStandardVO bindPartStandardVO, Integer pageNo, Integer pageSize) {
IPage<BindPartStandardVO> page = new Page<>(pageNo, pageSize);
lawsBindPartMapper.selectStandard(page, bindPartStandardVO);
List<BindPartStandardVO> records = page.getRecords();
String standardType = bindPartStandardVO.getStandardType();
String standardName = bindPartStandardVO.getStandardName();
IPage<BindPartStandardVO> resultPage = new Page<>(pageNo, pageSize);
List<BindPartStandardVO> records = new ArrayList<>();
if (StrUtil.isBlank(standardType) || standardType.equals(TableNameEnum.DOMESTIC_REGULATIONS.getValue())) {
IPage<LawsDomesticStandard> page = new Page<>(pageNo, pageSize);
LambdaQueryWrapper<LawsDomesticStandard> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ne(LawsDomesticStandard::getStandardState, "7");
queryWrapper.like(StrUtil.isNotBlank(standardName), LawsDomesticStandard::getStandardNumber, standardName).or()
.like(StrUtil.isNotBlank(standardName),LawsDomesticStandard::getStandardName, standardName);
IPage<LawsDomesticStandard> lawsDomesticStandardIPage = gbService.page(page, queryWrapper);
records = BeanCopyUtils.copyBeanList(lawsDomesticStandardIPage.getRecords(), BindPartStandardVO.class);
records.forEach(r -> {
r.setStandardType(TableNameEnum.DOMESTIC_REGULATIONS.getValue());
});
resultPage.setPages(page.getPages())
.setCurrent(page.getCurrent())
.setSize(page.getSize())
.setTotal(page.getTotal())
.setRecords(records);
}
if (standardType.equals(TableNameEnum.FOREIGN_REGULATIONS.getValue())){
IPage<LawsOverseasStandard> page = new Page<>(pageNo, pageSize);
LambdaQueryWrapper<LawsOverseasStandard> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ne(LawsOverseasStandard::getStandardState, "7");
queryWrapper.like(StrUtil.isNotBlank(standardName), LawsOverseasStandard::getStandardNumber, standardName).or()
.like(StrUtil.isNotBlank(standardName), LawsOverseasStandard::getStandardName, standardName);
IPage<LawsOverseasStandard> lawsOverseasStandardIPage = fbService.page(page, queryWrapper);
records = BeanCopyUtils.copyBeanList(lawsOverseasStandardIPage.getRecords(), BindPartStandardVO.class);
records.forEach(r -> {
r.setStandardType(TableNameEnum.FOREIGN_REGULATIONS.getValue());
});
resultPage.setPages(page.getPages())
.setCurrent(page.getCurrent())
.setSize(page.getSize())
.setTotal(page.getTotal())
.setRecords(records);
}
if (standardType.equals(TableNameEnum.ENTERPRISE_STANDARDS.getValue())){
IPage<LawsEnterpriseStandard> page = new Page<>(pageNo, pageSize);
LambdaQueryWrapper<LawsEnterpriseStandard> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.ne(LawsEnterpriseStandard::getStandardState, StandardStateEnum.ABOLISH);
queryWrapper.like(StrUtil.isNotBlank(standardName), LawsEnterpriseStandard::getStandardNumber, standardName).or()
.like(StrUtil.isNotBlank(standardName), LawsEnterpriseStandard::getStandardName, standardName);
IPage<LawsEnterpriseStandard> lawsEnterpriseStandardIPage = esService.page(page, queryWrapper);
records = BeanCopyUtils.copyBeanList(lawsEnterpriseStandardIPage.getRecords(), BindPartStandardVO.class);
records.forEach(r -> {
r.setEsStandardState(r.getStandardState());
r.setStandardType(TableNameEnum.ENTERPRISE_STANDARDS.getValue());
});
resultPage.setPages(page.getPages())
.setCurrent(page.getCurrent())
.setSize(page.getSize())
.setTotal(page.getTotal())
.setRecords(records);
}
// 获取所有标准Id
List<String> standardIdList = records.stream().map(BindPartStandardVO::getId).collect(Collectors.toList());
LambdaQueryWrapper<SarFileSplitInfoEO> sarFileSplitInfoEOLambdaQueryWrapper = new LambdaQueryWrapper<>();
@@ -146,7 +221,7 @@ public class LawsBindPartServiceImpl extends ServiceImpl<LawsBindPartMapper, Law
standard.setInfoId(sarFileSplitInfoEOS.get(0).getId());
});
// 设置编辑Id
return page;
return resultPage;
}