diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java index a90866929..9a8b4b983 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java @@ -10,6 +10,7 @@ import com.jero.common.api.vo.Result; import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.constant.enums.CutEnum; import com.jero.common.system.base.controller.JeroController; +import com.jero.modules.cert.template.entity.CertCategoryParamsInfoEO; import com.jero.modules.cert.template.entity.ParamsInfoEO; import com.jero.modules.cert.template.service.IParamsInfoEOService; import com.jero.modules.cert.template.service.IParamsInfoPublishEOService; @@ -26,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -47,7 +49,7 @@ public class ParamsInfoEOController extends JeroController autoAddTestData(@RequestBody JSONObject json) { + //TODO 测试接口 + String certCategory = json.getString("certCategory"); + String certCategoryType = json.getString("certCategoryType"); // gg、3c、yy、hb + String controlType = json.getString("controlType"); + String controlVerify = json.getString("controlVerify"); + String cut = json.getString("cut"); + String dutyTerritory = json.getString("dutyTerritory"); + String isMust = json.getString("isMust"); + String nioNumber = json.getString("nioNumber"); + String paramsBatch = json.getString("paramsBatch"); + String paramsName = json.getString("paramsName"); + String paramsTemplateId = json.getString("paramsTemplateId"); + if (StringUtils.isEmpty(certCategory)) { + return Result.error("认证类别不能为空!"); + } + boolean isSuccess = false; + + Integer startIndex = json.getInteger("startIndex"); + Integer endIndex = json.getInteger("endIndex"); + for (Integer i = 0; i < endIndex; i++) { + ParamsInfoEO paramsInfoEO = new ParamsInfoEO(); + paramsInfoEO.setNioNumber(nioNumber + "-" + String.format("%04d",startIndex + i)); + paramsInfoEO.setParamsName(paramsName + "-" + String.format("%04d",startIndex + i) + "名称"); + paramsInfoEO.setCertCategory(certCategory); + paramsInfoEO.setControlType(controlType); + paramsInfoEO.setControlVerify(controlVerify); + paramsInfoEO.setCut(cut); + paramsInfoEO.setDutyTerritory(dutyTerritory); + paramsInfoEO.setIsMust(isMust); + paramsInfoEO.setParamsBatch(paramsBatch); + paramsInfoEO.setParamsTemplateId(paramsTemplateId); + + List certCategoryParamsInfoEOList = new ArrayList<>(); + CertCategoryParamsInfoEO certCategoryParamsInfoEO = new CertCategoryParamsInfoEO(); + certCategoryParamsInfoEO.setCertCategory(certCategory); + certCategoryParamsInfoEO.setParamsName(paramsName + "-" + String.format("%04d",startIndex + i) + "-" + certCategoryType + "-" + "name"); + certCategoryParamsInfoEO.setParamsNumber(nioNumber + "-" + String.format("%04d",startIndex + i) + "-" + certCategoryType); + certCategoryParamsInfoEOList.add(certCategoryParamsInfoEO); + paramsInfoEO.setCertCategoryParamsInfoEOList(certCategoryParamsInfoEOList); + + isSuccess = paramsInfoEOService.add(paramsInfoEO); + + if(!isSuccess){ + break; + } + } + + + + if (isSuccess) { + return Result.OK("添加成功!"); + } else { + return Result.error("添加失败!"); + } + } }