认证-参数项复制

This commit is contained in:
liyawei
2022-04-29 11:57:12 +08:00
parent 2d3a9a9fde
commit b0b0864d6e
14 changed files with 299 additions and 47 deletions
@@ -55,6 +55,8 @@ public class ParamsInfoEOController extends JeroController<ParamsInfoEO, IParams
public Result<?> queryPageList(ParamsInfoEO paramsInfoEO,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@RequestParam(name="orderByField") String orderByField,
@RequestParam(name="orderBy") String orderBy,
@RequestParam(name="cut") String cut,
HttpServletRequest req) {
LambdaQueryWrapper<ParamsInfoEO> queryWrapper = new LambdaQueryWrapper<>();
@@ -62,6 +64,7 @@ public class ParamsInfoEOController extends JeroController<ParamsInfoEO, IParams
.like(StringUtils.isNotEmpty(paramsInfoEO.getNioNumber()), ParamsInfoEO::getNioNumber, paramsInfoEO.getNioNumber())
.like(StringUtils.isNotEmpty(paramsInfoEO.getParamsName()), ParamsInfoEO::getParamsName, paramsInfoEO.getParamsName())
.eq(StringUtils.isNotEmpty(paramsInfoEO.getDutyTerritory()), ParamsInfoEO::getDutyTerritory, paramsInfoEO.getDutyTerritory())
.orderBy(StringUtils.isNotBlank(orderByField), "1".equals(orderBy)?true:false, ParamsInfoEO::getNioNumber)
.orderByDesc(ParamsInfoEO::getCreateTime);
Page<ParamsInfoEO> page = new Page<ParamsInfoEO>(pageNo, pageSize);
IPage<ParamsInfoEO> pageList = paramsInfoEOService.page(page, queryWrapper);
@@ -202,7 +205,7 @@ public class ParamsInfoEOController extends JeroController<ParamsInfoEO, IParams
@PostMapping(value = "/exportParamsInfoZip")
public void exportParamsInfoZip(@RequestParam(value = "cut") String cut,
@RequestParam(value = "exportName", required = false) String exportName,
@RequestParam(value = "paramsInfoVO", required = false) String parameter,
@RequestParam(value = "paramsInfoVO", required = true) String parameter,
HttpServletResponse response,
HttpServletRequest request) {
ParamsInfoVO paramsInfoVO = new ParamsInfoVO();
@@ -3,11 +3,11 @@ package com.jero.modules.cert.template.controller;
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.jero.modules.cert.template.entity.ParamsTemplateEO;
import com.jero.modules.cert.template.service.IParamsTemplateEOService;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.system.base.controller.JeroController;
import com.jero.modules.cert.template.entity.ParamsTemplateEO;
import com.jero.modules.cert.template.service.IParamsTemplateEOService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -156,7 +156,23 @@ public class ParamsTemplateEOController extends JeroController<ParamsTemplateEO,
return Result.OK(paramsTemplateEO);
}
/**
/**
* 复制参数模板
*
* @param id
* @return
*/
@AutoLog(value = "参数模板表-复制")
@ApiOperation(value="参数模板表-复制", notes="参数模板表-复制")
@GetMapping(value = "/copyById")
public Result<?> copyById(@RequestParam(name="id") String id,
@RequestParam(name="paramsTemplateName") String paramsTemplateName) {
ParamsTemplateEO paramsTemplateEO = paramsTemplateEOService.copyById(id, paramsTemplateName);
return Result.OK("复制成功", paramsTemplateEO);
}
/**
* 导出excel
*
* @param request
@@ -21,5 +21,9 @@ public interface CertCategoryParamsInfoEOMapper extends BaseMapper<CertCategoryP
*/
List<CertCategoryParamsInfoEO> selectListByNioNumber(@Param("nioNumber") String nioNumber);
List<CertCategoryParamsInfoEO> selectListByParamsTemplateIds(@Param("paramsTemplateIds") String paramsTemplateIds);
int deleteByNioNumberList(@Param("list") List<String> nioNumberList);
int deleteByParamsTemplateIds(@Param("paramsTemplateIds") String paramsTemplateIds);
}
@@ -17,6 +17,11 @@ import java.util.List;
public interface ParamsInfoEOMapper extends BaseMapper<ParamsInfoEO> {
List<ParamsInfoEO> selectListWithCert(@Param("paramsInfoVO") ParamsInfoVO paramsInfoVO);
List<ParamsInfoEnExport> selectListWithCertForEnExport(@Param("paramsInfoVO") ParamsInfoVO paramsInfoVO);
int deleteByParamsTemplateIds(@Param("paramsTemplateIds") String paramsTemplateIds);
List<ParamsInfoEO> selectListByParamsTemplateIds(@Param("paramsTemplateIds") String paramsTemplateIds);
}
@@ -25,6 +25,15 @@
</foreach>
</select>
<select id="selectListByParamsTemplateIds" resultMap="CertCategoryParamsInfoEOResultMap" parameterType="java.lang.String">
select *
from cert_category_params_info
where params_template_id in
<foreach collection="paramsTemplateIds.split(',')" index="index" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</select>
<delete id="deleteByNioNumberList" parameterType="java.util.List">
delete from cert_category_params_info
where nio_number in
@@ -32,4 +41,12 @@
#{nioNumber}
</foreach>
</delete>
<delete id="deleteByParamsTemplateIds" parameterType="java.lang.String">
delete from cert_category_params_info
where params_template_id in
<foreach collection="paramsTemplateIds.split(',')" index="index" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</delete>
</mapper>
@@ -117,6 +117,9 @@
<sql id="BaseQuerySql">
<where>
<if test="paramsInfoVO != null">
<if test="paramsInfoVO.paramsTemplateId !=null and paramsInfoVO.paramsTemplateId !=''">
AND params_template_id LIKE CONCAT(CONCAT('%',#{paramsInfoVO.paramsTemplateId}),'%')
</if>
<if test="paramsInfoVO.nioNumber !=null and paramsInfoVO.nioNumber !=''">
AND nio_number LIKE CONCAT(CONCAT('%',#{paramsInfoVO.nioNumber}),'%')
</if>
@@ -153,4 +156,21 @@
<include refid="BaseQuerySql"/>
</select>
<select id="selectListByParamsTemplateIds" resultMap="ParamsInfoEOResultMap" parameterType="java.lang.String">
select *
from params_info
where params_template_id in
<foreach collection="paramsTemplateIds.split(',')" index="index" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</select>
<delete id="deleteByParamsTemplateIds" parameterType="java.lang.String">
delete from params_info
where params_template_id in
<foreach collection="paramsTemplateIds.split(',')" index="index" separator="," open="(" close=")" item="item">
#{item}
</foreach>
</delete>
</mapper>
@@ -2,6 +2,8 @@ package com.jero.modules.cert.template.service;
import com.jero.modules.cert.template.entity.CertCategoryParamsInfoEO;
import com.baomidou.mybatisplus.extension.service.IService;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
@@ -61,5 +63,9 @@ public interface ICertCategoryParamsInfoEOService extends IService<CertCategoryP
List<CertCategoryParamsInfoEO> selectListByNioNumber(String nioNumber);
List<CertCategoryParamsInfoEO> selectListByParamsTemplateIds(String paramsTemplateIds);
int deleteByNioNumberList(List<String> nioNumberList);
int deleteByParamsTemplateIds(String paramsTemplateIds);
}
@@ -6,6 +6,7 @@ import com.jero.modules.cert.template.entity.ParamsInfoEO;
import com.jero.modules.cert.template.vo.CertCategoryParamsInfoCnImport;
import com.jero.modules.cert.template.vo.ParamsInfoCnImport;
import com.jero.modules.cert.template.vo.ParamsInfoVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
@@ -96,4 +97,9 @@ public interface IParamsInfoEOService extends IService<ParamsInfoEO> {
String unzipfilepath,
String paramsTemplateId,
String cut);
int deleteByParamsTemplateIds(String paramsTemplateIds);
List<ParamsInfoEO> selectListByParamsTemplateIds(String paramsTemplateIds);
}
@@ -53,6 +53,8 @@ public interface IParamsTemplateEOService extends IService<ParamsTemplateEO> {
*/
ParamsTemplateEO queryById(String id);
ParamsTemplateEO copyById(String id, String paramsTemplateName);
/**
* 列表查询
*
@@ -93,8 +93,18 @@ public class CertCategoryParamsInfoEOServiceImpl extends ServiceImpl<CertCategor
return baseMapper.selectListByNioNumber(nioNumber);
}
@Override
public List<CertCategoryParamsInfoEO> selectListByParamsTemplateIds(String paramsTemplateIds) {
return baseMapper.selectListByParamsTemplateIds(paramsTemplateIds);
}
@Override
public int deleteByNioNumberList(List<String> nioNumberList) {
return baseMapper.deleteByNioNumberList(nioNumberList);
}
@Override
public int deleteByParamsTemplateIds(String paramsTemplateIds) {
return baseMapper.deleteByParamsTemplateIds(paramsTemplateIds);
}
}
@@ -90,7 +90,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
@Override
public void add(ParamsInfoEO paramsInfoEO) {
String nioNumber = paramsInfoEO.getNioNumber();
String paramsInfoId = UUID.randomUUID().toString().replace("-", "");
String paramsTemplateId = paramsInfoEO.getParamsTemplateId();
// 校验nio编号 格式:字母数字横杠(-)
String nioNumberRegex = "^[A-Za-z0-9-]+$";
if (!nioNumber.matches(nioNumberRegex)) {
@@ -108,7 +108,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
throw new JeroBootException("不同类别间参数编号必须唯一!");
}
certCategoryParamsInfoEOList.forEach(certCategoryParamsInfoEO -> {
certCategoryParamsInfoEO.setParamsTemplateId(paramsInfoId);
certCategoryParamsInfoEO.setParamsTemplateId(paramsTemplateId);
certCategoryParamsInfoEO.setNioNumber(nioNumber);
});
certCategoryParamsInfoEOService.saveBatch(certCategoryParamsInfoEOList);
@@ -130,7 +130,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
}
}
paramsInfoEO.setId(paramsInfoId);
paramsInfoEO.setId(UUID.randomUUID().toString().replace("-",""));
Date now = new Date();
paramsInfoEO.setCreateTime(now);
paramsInfoEO.setUpdateTime(now);
@@ -147,6 +147,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
public void editById(ParamsInfoEO paramsInfoEO) {
String nioNumber = paramsInfoEO.getNioNumber();
String paramsInfoId = paramsInfoEO.getId();
String paramsTemplateId = paramsInfoEO.getParamsTemplateId();
// 校验nio编号 格式:字母数字横杠(-)
String nioNumberRegex = "^[A-Za-z0-9-]+$";
@@ -171,7 +172,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
}
certCategoryParamsInfoEOList.forEach(certCategoryParamsInfoEO -> {
certCategoryParamsInfoEO.setParamsTemplateId(paramsInfoId);
certCategoryParamsInfoEO.setParamsTemplateId(paramsTemplateId);
certCategoryParamsInfoEO.setNioNumber(nioNumber);
});
certCategoryParamsInfoEOService.saveBatch(certCategoryParamsInfoEOList);
@@ -808,6 +809,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
importDto.setFileTemplateConnectId(connectId);
ParamsInfoEO target = new ParamsInfoEO();
BeanUtils.copyProperties(importDto, target);
target.setId(UUID.randomUUID().toString().replace("-",""));
target.setParamsTemplateId(paramsTemplateId);
paramsInfoEOS.add(target);
}
@@ -877,7 +879,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
//存放数据验证结果信息
List<String> stringMessage = new ArrayList<>();
int i = 2; //记录行号
int i = 1; //记录行号
int num = 0; //记录是第几条数据
//循环验证数据
for (ParamsInfoCnImport dto : paramsInfoEOList) {
@@ -895,9 +897,12 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
errorMsg = i + " line";
}
Map<String, Object> resultMap = new HashMap<>();
// nio编号
String nioNumber = dto.getNioNumber();
validateMustAndLength(nioNumber, "nio编号", IsMustEnum.YES.getValue(),"15", errorMsg, countError, false, cut);
resultMap = validateMustAndLength(nioNumber, "nio编号", IsMustEnum.YES.getValue(),"15", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
if (StringUtils.isNotEmpty(dto.getNioNumber())) {
// 校验nio编号 格式:字母数字横杠(-)
String nioNumberRegex = "^[A-Za-z0-9-]+$";
@@ -909,56 +914,97 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
// 是否必填
String isMust = dto.getIsMust();
validateMustAndLength(isMust, "是否必填", IsMustEnum.YES.getValue(), "50",errorMsg, countError, false, cut);
getCodeByName(isMust,"是否必填","enum",paramsIsMustEnumMap,null,null,errorMsg,countError,cut);
resultMap = validateMustAndLength(isMust, "是否必填", IsMustEnum.YES.getValue(), "50", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
resultMap = getCodeByName(isMust,"是否必填","enum",paramsIsMustEnumMap,null,null,cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
isMust = (String)resultMap.get("value");
dto.setIsMust(isMust);
// 参数名称
String paramsName = dto.getParamsName();
validateMustAndLength(paramsName, "参数名称", IsMustEnum.YES.getValue(), "30",errorMsg, countError, false, cut);
resultMap = validateMustAndLength(paramsName, "参数名称", IsMustEnum.YES.getValue(), "30", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
// 技术领域
String technologyTerritory = dto.getTechnologyTerritory();
validateMustAndLength(technologyTerritory, "技术领域", IsMustEnum.YES.getValue(), "1000",errorMsg, countError, false, cut);
getCodeByName(technologyTerritory,"技术领域","treeDicCode",null,treeNameList,categoryList,errorMsg,countError,cut);
resultMap = validateMustAndLength(technologyTerritory, "技术领域", IsMustEnum.YES.getValue(), "1000", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
resultMap = getCodeByName(technologyTerritory,"技术领域","treeDicCode",null,treeNameList,categoryList,cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
technologyTerritory = (String)resultMap.get("value");
dto.setTechnologyTerritory(technologyTerritory);
// 参数批次
String paramsBatch = dto.getParamsBatch();
validateMustAndLength(paramsBatch, "参数批次", IsMustEnum.YES.getValue(), "50",errorMsg, countError, true, cut);
getCodeByName(paramsBatch,"参数批次","dicCode",null,itemNameList,dictItemList,errorMsg,countError,cut);
resultMap = validateMustAndLength(paramsBatch, "参数批次", IsMustEnum.YES.getValue(), "50", true, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
resultMap = getCodeByName(paramsBatch,"参数批次","dicCode",null,itemNameList,dictItemList,cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
paramsBatch = (String)resultMap.get("value");
dto.setParamsBatch(paramsBatch);
// 责任领域
String dutyTerritory = dto.getDutyTerritory();
validateMustAndLength(dutyTerritory, "责任领域", IsMustEnum.YES.getValue(), "50",errorMsg, countError, true, cut);
getCodeByName(dutyTerritory,"责任领域","dicCode",null,itemNameList,dictItemList,errorMsg,countError,cut);
resultMap = validateMustAndLength(dutyTerritory, "责任领域", IsMustEnum.YES.getValue(), "50",true, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
resultMap = getCodeByName(dutyTerritory,"责任领域","dicCode",null,itemNameList,dictItemList,cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
dutyTerritory = (String)resultMap.get("value");
dto.setDutyTerritory(dutyTerritory);
// 参数说明
String description = dto.getDescription();
validateMustAndLength(description,"参数说明",IsMustEnum.YES.getValue(),"200",errorMsg,countError,false,cut);
resultMap = validateMustAndLength(description,"参数说明",IsMustEnum.NO.getValue(),"200",false,cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
// 认证类别
String certCategory = dto.getCertCategory();
validateMustAndLength(certCategory, "认证类别", IsMustEnum.YES.getValue(), "1000",errorMsg, countError, false, cut);
getCodeByName(certCategory,"认证类别","dicCode",null,itemNameList,dictItemList,errorMsg,countError,cut);
resultMap = validateMustAndLength(certCategory, "认证类别", IsMustEnum.YES.getValue(), "1000", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
resultMap = getCodeByName(certCategory,"认证类别","dicCode",null,itemNameList,dictItemList,cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
certCategory = (String)resultMap.get("value");
dto.setCertCategory(certCategory);
// 控件类型
String controlType = dto.getControlType();
validateMustAndLength(controlType, "控件类型", IsMustEnum.YES.getValue(), "50",errorMsg, countError, false, cut);
getCodeByName(controlType,"控件类型","enum",controlTypeEnumMap,null,null,errorMsg,countError,cut);
resultMap = validateMustAndLength(controlType, "控件类型", IsMustEnum.YES.getValue(), "50", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
resultMap = getCodeByName(controlType,"控件类型","enum",controlTypeEnumMap,null,null,cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
controlType = (String)resultMap.get("value");
dto.setControlType(controlType);
// 控件备选值
String controlValues = dto.getControlValues();
validateMustAndLength(controlValues, "控件备选值", IsMustEnum.YES.getValue(), "500",errorMsg, countError, false, cut);
resultMap = validateMustAndLength(controlValues, "控件备选值", IsMustEnum.NO.getValue(), "500",false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
// 控件校验
String controlVerify = dto.getControlVerify();
validateMustAndLength(controlVerify, "控件校验", IsMustEnum.YES.getValue(), "50",errorMsg, countError, false, cut);
getCodeByName(controlVerify,"控件校验","enum",controlVerifyEnumMap,null,null,errorMsg,countError,cut);
resultMap = validateMustAndLength(controlVerify, "控件校验", IsMustEnum.NO.getValue(), "50", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
resultMap = getCodeByName(controlVerify,"控件校验","enum",controlVerifyEnumMap,null,null,cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
controlVerify = (String)resultMap.get("value");
dto.setControlVerify(controlVerify);
// 附件模板
@@ -1004,24 +1050,28 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
for (Map.Entry<String, List<CertCategoryParamsInfoCnImport>> ccDtoMap : certCategoryParamsInfoEOListMap.entrySet()) {
String certCategory = ccDtoMap.getKey();
List<CertCategoryParamsInfoCnImport> ccDtoList = ccDtoMap.getValue();
int j = 1;
for (CertCategoryParamsInfoCnImport ccDto : ccDtoList) {
//判断此行数据是否全部为空,是则不读取
if (checkObjAllFieldsIsNull(ccDto)) {
continue;
}
i++;
j++;
int countError = 0; //记录失败数据数量
String errorMsg = "";
if (CutEnum.CN.getValue().equals(cut)) {
errorMsg = certCategory + "" + i + "行:";
errorMsg = certCategory + "" + j + "行:";
} else {
errorMsg = i + " line";
errorMsg = j + " line";
}
Map<String, Object> resultMap = new HashMap<>();
// nio编号
String nioNumber = ccDto.getNioNumber();
validateMustAndLength(nioNumber, "nio编号", IsMustEnum.YES.getValue(),"15", errorMsg, countError, false, cut);
resultMap = validateMustAndLength(nioNumber, "nio编号", IsMustEnum.YES.getValue(),"15", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
if (StringUtils.isNotEmpty(ccDto.getNioNumber())) {
// 校验nio编号 格式:字母数字横杠(-)
String nioNumberRegex = "^[A-Za-z0-9-]+$";
@@ -1032,13 +1082,19 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
}
// 编号
String paramsNumber = ccDto.getParamsNumber();
validateMustAndLength(paramsNumber, "编号", IsMustEnum.YES.getValue(),"15", errorMsg, countError, false, cut);
resultMap = validateMustAndLength(paramsNumber, "编号", IsMustEnum.YES.getValue(),"15", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
// 参数名称
String paramsName = ccDto.getParamsName();
validateMustAndLength(paramsName, "参数名称", IsMustEnum.YES.getValue(),"30", errorMsg, countError, false, cut);
resultMap = validateMustAndLength(paramsName, "参数名称", IsMustEnum.YES.getValue(),"30", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
// 参数说明
String description = ccDto.getDescription();
validateMustAndLength(description, "参数说明", IsMustEnum.YES.getValue(),"200", errorMsg, countError, false, cut);
resultMap = validateMustAndLength(description, "参数说明", IsMustEnum.NO.getValue(),"200", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
if (countError > 0) {
stringMessage.add(errorMsg);
@@ -1072,8 +1128,12 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
return map;
}
private void validateMustAndLength (String fieldData, String fieldName, String mustInput, String dbLength, String errorMsg, int countError, Boolean isSingle, String cut) {
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isEmpty(fieldData)) {
private Map<String, Object> validateMustAndLength (String value, String fieldName, String mustInput, String dbLength, Boolean isSingle, String cut) {
String errorMsg = "";
int countError= 0;
Map<String, Object> resultMap = new HashMap<>();
if (IsMustEnum.YES.getValue().equals(mustInput) && StringUtils.isEmpty(value)) {
if(CutEnum.CN.getValue().equals(cut)) {
errorMsg += fieldName + "为必填项,不能为空;";
} else {
@@ -1082,7 +1142,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
countError++;
}
if (StringUtils.isNotBlank(fieldData) && fieldData.length() > Long.parseLong(dbLength)) {
if (StringUtils.isNotBlank(value) && value.length() > Long.parseLong(dbLength)) {
if(CutEnum.CN.getValue().equals(cut)) {
errorMsg += fieldName + "不能超过" + dbLength + "个字符;";
} else {
@@ -1093,7 +1153,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
if (isSingle) {
//判断是否是单选
if (StringUtils.isNotBlank(fieldData) && fieldData.contains(",")) {
if (StringUtils.isNotBlank(value) && value.contains(",")) {
if (CutEnum.CN.getValue().equals(cut)) {
errorMsg += fieldName + "为单选项;";
} else {
@@ -1103,9 +1163,16 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
}
}
resultMap.put("errorMsg", errorMsg);
resultMap.put("countError", countError);
return resultMap;
}
private void getCodeByName(String value, String fieldName, String type, Map enumMap, List judgeData, List coverData,String errorMsg, int countError,String cut) {
private Map<String, Object> getCodeByName(String value, String fieldName, String type, Map enumMap, List judgeData, List coverData,String cut) {
String errorMsg = "";
int countError= 0;
Map<String, Object> resultMap = new HashMap<>();
if ("treeDicCode".equals(type)) {
// 树形字典类型
List<String> treeNameList = judgeData;
@@ -1220,6 +1287,10 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
}
resultMap.put("value", value);
resultMap.put("errorMsg", errorMsg);
resultMap.put("countError", countError);
return resultMap;
}
@@ -1237,4 +1308,15 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
}
}
}
@Override
public int deleteByParamsTemplateIds(String paramsTemplateIds) {
return baseMapper.deleteByParamsTemplateIds(paramsTemplateIds);
}
@Override
public List<ParamsInfoEO> selectListByParamsTemplateIds(String paramsTemplateIds) {
return baseMapper.selectListByParamsTemplateIds(paramsTemplateIds);
}
}
@@ -1,13 +1,24 @@
package com.jero.modules.cert.template.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.cert.template.entity.CertCategoryParamsInfoEO;
import com.jero.modules.cert.template.entity.ParamsInfoEO;
import com.jero.modules.cert.template.entity.ParamsTemplateEO;
import com.jero.modules.cert.template.mapper.ParamsTemplateEOMapper;
import com.jero.modules.cert.template.service.ICertCategoryParamsInfoEOService;
import com.jero.modules.cert.template.service.IParamsInfoEOService;
import com.jero.modules.cert.template.service.IParamsTemplateEOService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
* @Description: 参数模板表
@@ -18,6 +29,12 @@ import java.util.List;
@Service
public class ParamsTemplateEOServiceImpl extends ServiceImpl<ParamsTemplateEOMapper, ParamsTemplateEO> implements IParamsTemplateEOService {
@Autowired
private IParamsInfoEOService paramsInfoEOService;
@Autowired
private ICertCategoryParamsInfoEOService certCategoryParamsInfoEOService;
/**
* 保存
*
@@ -26,6 +43,7 @@ public class ParamsTemplateEOServiceImpl extends ServiceImpl<ParamsTemplateEOMap
*/
@Override
public void add(ParamsTemplateEO paramsTemplateEO) {
paramsTemplateEO.setId(UUID.randomUUID().toString().replace("-",""));
Date now = new Date();
// 设置默认版本0
paramsTemplateEO.setVersion(0);
@@ -56,7 +74,9 @@ public class ParamsTemplateEOServiceImpl extends ServiceImpl<ParamsTemplateEOMap
*/
@Override
public void deleteById(String id) {
// TODO 关联删除参数项
// 关联删除参数项
certCategoryParamsInfoEOService.deleteByParamsTemplateIds(id);
paramsInfoEOService.deleteByParamsTemplateIds(id);
removeById(id);
}
@@ -68,7 +88,9 @@ public class ParamsTemplateEOServiceImpl extends ServiceImpl<ParamsTemplateEOMap
*/
@Override
public void deleteByIds(List<String> ids) {
// TODO 关联删除参数项
// 关联删除参数项
certCategoryParamsInfoEOService.deleteByParamsTemplateIds(StringUtils.join(ids, ","));
paramsInfoEOService.deleteByParamsTemplateIds(StringUtils.join(ids, ","));
removeByIds(ids);
}
@@ -83,7 +105,65 @@ public class ParamsTemplateEOServiceImpl extends ServiceImpl<ParamsTemplateEOMap
return getById(id);
}
/**
/**
* 复制模板
* @param id
* @param paramsTemplateName
* @return
*/
@Override
public ParamsTemplateEO copyById(String id, String paramsTemplateName) {
ParamsTemplateEO source = getById(id);
List<ParamsInfoEO> sourceParamsInfoEOList = paramsInfoEOService.selectListByParamsTemplateIds(id);
List<CertCategoryParamsInfoEO> sourceCertCategoryParamsInfoEOList = certCategoryParamsInfoEOService.selectListByParamsTemplateIds(id);
ParamsTemplateEO target = new ParamsTemplateEO();
List<ParamsInfoEO> targetParamsInfoEOList = new ArrayList<>();
List<CertCategoryParamsInfoEO> targetCertCategoryParamsInfoEOList = new ArrayList<>();
BeanUtils.copyProperties(source, target);
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String paramsTemplateId = UUID.randomUUID().toString().replace("-","");
target.setId(paramsTemplateId);
target.setParamsTemplateName(paramsTemplateName);
target.setCreateTime(new Date());
target.setCreateBy(sysUser.getUsername());
target.setUpdateTime(new Date());
target.setUpdateBy(sysUser.getUsername());
for (ParamsInfoEO sourceParamsInfoEO : sourceParamsInfoEOList) {
ParamsInfoEO targetParamsInfoEO = new ParamsInfoEO();
BeanUtils.copyProperties(sourceParamsInfoEO, targetParamsInfoEO);
targetParamsInfoEO.setParamsTemplateId(paramsTemplateId);
targetParamsInfoEO.setId(UUID.randomUUID().toString().replace("-",""));
targetParamsInfoEO.setCreateTime(new Date());
targetParamsInfoEO.setCreateBy(sysUser.getUsername());
targetParamsInfoEO.setUpdateTime(new Date());
targetParamsInfoEO.setUpdateBy(sysUser.getUsername());
targetParamsInfoEOList.add(targetParamsInfoEO);
}
for (CertCategoryParamsInfoEO sourceCertCategoryParamsInfoEO : sourceCertCategoryParamsInfoEOList) {
CertCategoryParamsInfoEO targetCertCategoryParamsInfoEO = new CertCategoryParamsInfoEO();
BeanUtils.copyProperties(sourceCertCategoryParamsInfoEO, targetCertCategoryParamsInfoEO);
targetCertCategoryParamsInfoEO.setParamsTemplateId(paramsTemplateId);
targetCertCategoryParamsInfoEO.setId(null);
targetCertCategoryParamsInfoEO.setCreateTime(new Date());
targetCertCategoryParamsInfoEO.setCreateBy(sysUser.getUsername());
targetCertCategoryParamsInfoEO.setUpdateTime(new Date());
targetCertCategoryParamsInfoEO.setUpdateBy(sysUser.getUsername());
targetCertCategoryParamsInfoEOList.add(targetCertCategoryParamsInfoEO);
}
paramsInfoEOService.saveBatch(targetParamsInfoEOList);
certCategoryParamsInfoEOService.saveBatch(targetCertCategoryParamsInfoEOList);
save(target);
return target;
}
/**
* 列表查询
*
* @return
@@ -42,22 +42,22 @@ public class CertCategoryParamsInfoCnImport {
private String sysOrgCode;
/**编号*/
@Excel(name = "*number", width = 15, orderNum = "2")
@Excel(name = "*编号", width = 15, orderNum = "2")
@ApiModelProperty(value = "编号")
private String paramsNumber;
/**参数名称*/
@Excel(name = "*params name", width = 15, orderNum = "3")
@Excel(name = "*参数名称", width = 15, orderNum = "3")
@ApiModelProperty(value = "参数名称")
private String paramsName;
/**参数说明*/
@Excel(name = "description", width = 36, orderNum = "4")
@Excel(name = "参数说明", width = 36, orderNum = "4")
@ApiModelProperty(value = "参数说明")
private String description;
/**nio编号*/
@Excel(name = "*nio number", width = 15, orderNum = "1")
@Excel(name = "*nio编号", width = 15, orderNum = "1")
@ApiModelProperty(value = "nio编号")
private String nioNumber;
@@ -13,4 +13,5 @@ public class ParamsInfoVO {
private String paramsName; // 参数名称
private String dutyTerritory; // 责任领域
private String ids; // 勾选的参数项id
private String paramsTemplateId; // 参数模板id
}