From 940309e995276fb1f644b768750c15d0ef00e7f2 Mon Sep 17 00:00:00 2001 From: liyawei Date: Fri, 29 Apr 2022 16:36:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A4=E8=AF=81-=E5=8F=82=E6=95=B0=E9=A1=B9?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ParamsInfoEOController.java | 52 ++++-- .../CertCategoryParamsInfoPublishEO.java | 36 ++++ .../template/entity/ParamsInfoPublishEO.java | 31 ++++ ...CertCategoryParamsInfoPublishEOMapper.java | 14 ++ .../mapper/ParamsInfoPublishEOMapper.java | 14 ++ .../CertCategoryParamsInfoPublishEOMapper.xml | 19 +++ .../mapper/xml/ParamsInfoPublishEOMapper.xml | 26 +++ ...ertCategoryParamsInfoPublishEOService.java | 61 +++++++ .../service/IParamsInfoEOService.java | 5 +- .../service/IParamsInfoPublishEOService.java | 64 ++++++++ ...ategoryParamsInfoPublishEOServiceImpl.java | 90 ++++++++++ .../service/impl/ParamsInfoEOServiceImpl.java | 14 +- .../impl/ParamsInfoPublishEOServiceImpl.java | 155 ++++++++++++++++++ .../impl/ParamsTemplateEOServiceImpl.java | 1 + 14 files changed, 558 insertions(+), 24 deletions(-) create mode 100644 jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/entity/CertCategoryParamsInfoPublishEO.java create mode 100644 jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/entity/ParamsInfoPublishEO.java create mode 100644 jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/CertCategoryParamsInfoPublishEOMapper.java create mode 100644 jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/ParamsInfoPublishEOMapper.java create mode 100644 jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/CertCategoryParamsInfoPublishEOMapper.xml create mode 100644 jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/ParamsInfoPublishEOMapper.xml create mode 100644 jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/ICertCategoryParamsInfoPublishEOService.java create mode 100644 jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoPublishEOService.java create mode 100644 jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/CertCategoryParamsInfoPublishEOServiceImpl.java create mode 100644 jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoPublishEOServiceImpl.java diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java index 147db3e03..2d4dae9df 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/controller/ParamsInfoEOController.java @@ -1,7 +1,6 @@ package com.jero.modules.cert.template.controller; import cn.hutool.core.collection.CollectionUtil; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -10,6 +9,7 @@ import com.jero.common.aspect.annotation.AutoLog; import com.jero.common.system.base.controller.JeroController; import com.jero.modules.cert.template.entity.ParamsInfoEO; import com.jero.modules.cert.template.service.IParamsInfoEOService; +import com.jero.modules.cert.template.service.IParamsInfoPublishEOService; import com.jero.modules.cert.template.vo.ParamsInfoVO; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -24,6 +24,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.Arrays; import java.util.List; +import java.util.Map; /** @@ -39,6 +40,9 @@ import java.util.List; public class ParamsInfoEOController extends JeroController { @Autowired private IParamsInfoEOService paramsInfoEOService; + + @Autowired + private IParamsInfoPublishEOService paramsInfoPublishEOService; /** * 分页列表查询 @@ -115,8 +119,12 @@ public class ParamsInfoEOController extends JeroController add(@Validated @RequestBody ParamsInfoEO paramsInfoEO) { - paramsInfoEOService.add(paramsInfoEO); - return Result.OK("添加成功!"); + boolean isSuccess = paramsInfoEOService.add(paramsInfoEO); + if (isSuccess) { + return Result.OK("添加成功!"); + } else { + return Result.error("添加失败!"); + } } /** @@ -129,8 +137,12 @@ public class ParamsInfoEOController extends JeroController edit(@Validated @RequestBody ParamsInfoEO paramsInfoEO) { - paramsInfoEOService.editById(paramsInfoEO); - return Result.OK("编辑成功!"); + boolean isSuccess = paramsInfoEOService.editById(paramsInfoEO); + if (isSuccess) { + return Result.OK("编辑成功!"); + } else { + return Result.error("编辑失败!"); + } } /** @@ -184,6 +196,20 @@ public class ParamsInfoEOController extends JeroController publish(@RequestParam(name="paramsTemplateId") String paramsTemplateId) { + int publishVersion = paramsInfoPublishEOService.publishTemplate(paramsTemplateId); + return Result.OK("发布版本:" + publishVersion + "成功!"); + } + @AutoLog(value = "参数项基本信息表-模板下载") @ApiOperation(value = "参数项基本信息表-模板下载", notes="参数项基本信息表-模板下载") @GetMapping(value = "/exportTemplate") @@ -198,20 +224,16 @@ public class ParamsInfoEOController extends JeroController map, + HttpServletResponse response, + HttpServletRequest request) { + String cut = (String) map.get("cut"); + String exportName = (String) map.get("exportName"); + ParamsInfoVO paramsInfoVO = (ParamsInfoVO) map.get("paramsInfoVO"); paramsInfoEOService.exportParamsInfo(cut, paramsInfoVO, exportName, response, request); } diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/entity/CertCategoryParamsInfoPublishEO.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/entity/CertCategoryParamsInfoPublishEO.java new file mode 100644 index 000000000..b3cf1ecff --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/entity/CertCategoryParamsInfoPublishEO.java @@ -0,0 +1,36 @@ +package com.jero.modules.cert.template.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + + +/** + * @Description: 认证类别参数信息表发布版 + * @Author: jero-boot + * @Date: 2022-04-29 + * @Version: V1.0 + */ +@Data +@TableName("cert_category_params_info_publish") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="cert_category_params_info_publish对象", description="认证类别参数信息表发布版") +public class CertCategoryParamsInfoPublishEO extends CertCategoryParamsInfoEO implements Serializable { + private static final long serialVersionUID = 1L; + + /**发布时版本*/ + @ApiModelProperty(value = "发布时版本") + private Integer version; + +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/entity/ParamsInfoPublishEO.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/entity/ParamsInfoPublishEO.java new file mode 100644 index 000000000..2f93dd0e7 --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/entity/ParamsInfoPublishEO.java @@ -0,0 +1,31 @@ +package com.jero.modules.cert.template.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + + +/** + * @Description: 参数项基本信息表发布版 + * @Author: jero-boot + * @Date: 2022-04-29 + * @Version: V1.0 + */ +@Data +@TableName("params_info_publish") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="params_info_publish对象", description="参数项基本信息表发布版") +public class ParamsInfoPublishEO extends ParamsInfoEO implements Serializable { + private static final long serialVersionUID = 1L; + + /**发布时版本*/ + @ApiModelProperty(value = "发布时版本") + private Integer version; + +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/CertCategoryParamsInfoPublishEOMapper.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/CertCategoryParamsInfoPublishEOMapper.java new file mode 100644 index 000000000..aa7ae0aaa --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/CertCategoryParamsInfoPublishEOMapper.java @@ -0,0 +1,14 @@ +package com.jero.modules.cert.template.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jero.modules.cert.template.entity.CertCategoryParamsInfoPublishEO; + +/** + * @Description: 认证类别参数信息表发布版 + * @Author: jero-boot + * @Date: 2022-04-29 + * @Version: V1.0 + */ +public interface CertCategoryParamsInfoPublishEOMapper extends BaseMapper { + +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/ParamsInfoPublishEOMapper.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/ParamsInfoPublishEOMapper.java new file mode 100644 index 000000000..f6c577f8d --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/ParamsInfoPublishEOMapper.java @@ -0,0 +1,14 @@ +package com.jero.modules.cert.template.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.jero.modules.cert.template.entity.ParamsInfoPublishEO; + +/** + * @Description: 参数项基本信息表发布版 + * @Author: jero-boot + * @Date: 2022-04-29 + * @Version: V1.0 + */ +public interface ParamsInfoPublishEOMapper extends BaseMapper { + +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/CertCategoryParamsInfoPublishEOMapper.xml b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/CertCategoryParamsInfoPublishEOMapper.xml new file mode 100644 index 000000000..27710f449 --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/CertCategoryParamsInfoPublishEOMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/ParamsInfoPublishEOMapper.xml b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/ParamsInfoPublishEOMapper.xml new file mode 100644 index 000000000..5970251fc --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/mapper/xml/ParamsInfoPublishEOMapper.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/ICertCategoryParamsInfoPublishEOService.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/ICertCategoryParamsInfoPublishEOService.java new file mode 100644 index 000000000..5c4bff3c9 --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/ICertCategoryParamsInfoPublishEOService.java @@ -0,0 +1,61 @@ +package com.jero.modules.cert.template.service; + +import com.jero.modules.cert.template.entity.CertCategoryParamsInfoPublishEO; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + +/** + * @Description: 认证类别参数信息表发布版 + * @Author: jero-boot + * @Date: 2022-04-29 + * @Version: V1.0 + */ +public interface ICertCategoryParamsInfoPublishEOService extends IService { + + /** + * 保存 + * + * @param certCategoryParamsInfoPublishEO + * @return + */ + void add(CertCategoryParamsInfoPublishEO certCategoryParamsInfoPublishEO); + + /** + * 更新 + * + * @param certCategoryParamsInfoPublishEO + * @return + */ + void editById(CertCategoryParamsInfoPublishEO certCategoryParamsInfoPublishEO); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids); + + /** + * 通过id查询 + * + * @param id + * @return + */ + CertCategoryParamsInfoPublishEO queryById(String id); + + /** + * 列表查询 + * + * @return + */ + List queryList(); +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoEOService.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoEOService.java index ab26f9e10..625d14cf1 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoEOService.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoEOService.java @@ -6,7 +6,6 @@ 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; @@ -29,7 +28,7 @@ public interface IParamsInfoEOService extends IService { * @param paramsInfoEO * @return */ - void add(ParamsInfoEO paramsInfoEO); + boolean add(ParamsInfoEO paramsInfoEO); /** * 更新 @@ -37,7 +36,7 @@ public interface IParamsInfoEOService extends IService { * @param paramsInfoEO * @return */ - void editById(ParamsInfoEO paramsInfoEO); + boolean editById(ParamsInfoEO paramsInfoEO); /** * 通过id删除 diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoPublishEOService.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoPublishEOService.java new file mode 100644 index 000000000..d326581c9 --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/IParamsInfoPublishEOService.java @@ -0,0 +1,64 @@ +package com.jero.modules.cert.template.service; + +import com.jero.modules.cert.template.entity.ParamsInfoPublishEO; +import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; + +/** + * @Description: 参数项基本信息表发布版 + * @Author: jero-boot + * @Date: 2022-04-29 + * @Version: V1.0 + */ +public interface IParamsInfoPublishEOService extends IService { + + /** + * 保存 + * + * @param paramsInfoPublishEO + * @return + */ + void add(ParamsInfoPublishEO paramsInfoPublishEO); + + /** + * 更新 + * + * @param paramsInfoPublishEO + * @return + */ + void editById(ParamsInfoPublishEO paramsInfoPublishEO); + + /** + * 通过id删除 + * + * @param id + * @return + */ + void deleteById(String id); + + /** + * 批量删除 + * + * @param ids + * @return + */ + void deleteByIds(List ids); + + /** + * 通过id查询 + * + * @param id + * @return + */ + ParamsInfoPublishEO queryById(String id); + + /** + * 列表查询 + * + * @return + */ + List queryList(); + + int publishTemplate(String paramsTemplateId); + +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/CertCategoryParamsInfoPublishEOServiceImpl.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/CertCategoryParamsInfoPublishEOServiceImpl.java new file mode 100644 index 000000000..8dcecaf2c --- /dev/null +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/CertCategoryParamsInfoPublishEOServiceImpl.java @@ -0,0 +1,90 @@ +package com.jero.modules.cert.template.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.jero.modules.cert.template.entity.CertCategoryParamsInfoPublishEO; +import com.jero.modules.cert.template.mapper.CertCategoryParamsInfoPublishEOMapper; +import com.jero.modules.cert.template.service.ICertCategoryParamsInfoPublishEOService; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * @Description: 认证类别参数信息表发布版 + * @Author: jero-boot + * @Date: 2022-04-29 + * @Version: V1.0 + */ +@Service +public class CertCategoryParamsInfoPublishEOServiceImpl extends ServiceImpl implements ICertCategoryParamsInfoPublishEOService { + + /** + * 保存 + * + * @param certCategoryParamsInfoPublishEO + * @return + */ + @Override + public void add(CertCategoryParamsInfoPublishEO certCategoryParamsInfoPublishEO) { + Date now = new Date(); + certCategoryParamsInfoPublishEO.setCreateTime(now); + certCategoryParamsInfoPublishEO.setUpdateTime(now); + save(certCategoryParamsInfoPublishEO); + } + + /** + * 更新 + * + * @param certCategoryParamsInfoPublishEO + * @return + */ + @Override + public void editById(CertCategoryParamsInfoPublishEO certCategoryParamsInfoPublishEO) { + Date now = new Date(); + certCategoryParamsInfoPublishEO.setUpdateTime(now); + saveOrUpdate(certCategoryParamsInfoPublishEO); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @Override + public void deleteById(String id) { + removeById(id); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @Override + public void deleteByIds(List ids) { + removeByIds(ids); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @Override + public CertCategoryParamsInfoPublishEO queryById(String id) { + return getById(id); + } + + /** + * 列表查询 + * + * @return + */ + @Override + public List queryList() { + return list(); + } +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java index 2090ef98c..7869fc4b8 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsInfoEOServiceImpl.java @@ -1,7 +1,7 @@ package com.jero.modules.cert.template.service.impl; -import cn.afterturn.easypoi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.ExcelImportUtil; +import cn.afterturn.easypoi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; @@ -36,8 +36,8 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; -import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.ExcelExportUtil; +import org.jeecgframework.poi.excel.entity.ExportParams; import org.jeecgframework.poi.excel.entity.enmus.ExcelType; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -68,6 +68,7 @@ import static com.jero.modules.split.util.ExcelUtil.checkObjAllFieldsIsNull; @Service @Transactional(value = "transactionManager", readOnly = false, propagation = Propagation.REQUIRED, rollbackFor = Throwable.class) public class ParamsInfoEOServiceImpl extends ServiceImpl implements IParamsInfoEOService { + @Autowired private ICertCategoryParamsInfoEOService certCategoryParamsInfoEOService; @@ -81,6 +82,7 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl implements IParamsInfoPublishEOService { + + @Autowired + private IParamsTemplateEOService paramsTemplateEOService; + @Autowired + private IParamsInfoEOService paramsInfoEOService; + @Autowired + private ICertCategoryParamsInfoEOService certCategoryParamsInfoEOService; + @Autowired + private ICertCategoryParamsInfoPublishEOService certCategoryParamsInfoPublishEOService; + + /** + * 保存 + * + * @param paramsInfoPublishEO + * @return + */ + @Override + public void add(ParamsInfoPublishEO paramsInfoPublishEO) { + Date now = new Date(); + paramsInfoPublishEO.setCreateTime(now); + paramsInfoPublishEO.setUpdateTime(now); + save(paramsInfoPublishEO); + } + + /** + * 更新 + * + * @param paramsInfoPublishEO + * @return + */ + @Override + public void editById(ParamsInfoPublishEO paramsInfoPublishEO) { + Date now = new Date(); + paramsInfoPublishEO.setUpdateTime(now); + saveOrUpdate(paramsInfoPublishEO); + } + + /** + * 通过id删除 + * + * @param id + * @return + */ + @Override + public void deleteById(String id) { + removeById(id); + } + + /** + * 批量删除 + * + * @param ids + * @return + */ + @Override + public void deleteByIds(List ids) { + removeByIds(ids); + } + + /** + * 通过id查询 + * + * @param id + * @return + */ + @Override + public ParamsInfoPublishEO queryById(String id) { + return getById(id); + } + + /** + * 列表查询 + * + * @return + */ + @Override + public List queryList() { + return list(); + } + + + @Override + public int publishTemplate(String paramsTemplateId) { + ParamsTemplateEO source = paramsTemplateEOService.queryById(paramsTemplateId); + List sourceParamsInfoEOList = paramsInfoEOService.selectListByParamsTemplateIds(paramsTemplateId); + List sourceCertCategoryParamsInfoEOList = certCategoryParamsInfoEOService.selectListByParamsTemplateIds(paramsTemplateId); + + List targetParamsInfoPublishEOList = new ArrayList<>(); + List targetCertCategoryParamsInfoPublishEOList = new ArrayList<>(); + + int newVersion = source.getVersion() + 1; + ParamsTemplateEO updateSource = new ParamsTemplateEO(); + updateSource.setId(paramsTemplateId); + updateSource.setVersion(newVersion); + + LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + for (ParamsInfoEO sourceParamsInfoEO : sourceParamsInfoEOList) { + ParamsInfoPublishEO targetParamsInfoEO = new ParamsInfoPublishEO(); + BeanUtils.copyProperties(sourceParamsInfoEO, targetParamsInfoEO); + targetParamsInfoEO.setParamsTemplateId(paramsTemplateId); + targetParamsInfoEO.setId(UUID.randomUUID().toString().replace("-","")); + targetParamsInfoEO.setVersion(newVersion); // 设置发布版本 + targetParamsInfoEO.setCreateTime(new Date()); + targetParamsInfoEO.setCreateBy(sysUser.getUsername()); + targetParamsInfoEO.setUpdateTime(new Date()); + targetParamsInfoEO.setUpdateBy(sysUser.getUsername()); + targetParamsInfoPublishEOList.add(targetParamsInfoEO); + } + + for (CertCategoryParamsInfoEO sourceCertCategoryParamsInfoEO : sourceCertCategoryParamsInfoEOList) { + CertCategoryParamsInfoPublishEO targetCertCategoryParamsInfoEO = new CertCategoryParamsInfoPublishEO(); + BeanUtils.copyProperties(sourceCertCategoryParamsInfoEO, targetCertCategoryParamsInfoEO); + targetCertCategoryParamsInfoEO.setParamsTemplateId(paramsTemplateId); + targetCertCategoryParamsInfoEO.setVersion(newVersion); // 设置发布版本 + targetCertCategoryParamsInfoEO.setId(null); + targetCertCategoryParamsInfoEO.setCreateTime(new Date()); + targetCertCategoryParamsInfoEO.setCreateBy(sysUser.getUsername()); + targetCertCategoryParamsInfoEO.setUpdateTime(new Date()); + targetCertCategoryParamsInfoEO.setUpdateBy(sysUser.getUsername()); + targetCertCategoryParamsInfoPublishEOList.add(targetCertCategoryParamsInfoEO); + } + + this.saveBatch(targetParamsInfoPublishEOList); + certCategoryParamsInfoPublishEOService.saveBatch(targetCertCategoryParamsInfoPublishEOList); + paramsTemplateEOService.updateById(updateSource); + + return newVersion; + } +} diff --git a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsTemplateEOServiceImpl.java b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsTemplateEOServiceImpl.java index 8914c5ae1..3e1f82255 100644 --- a/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsTemplateEOServiceImpl.java +++ b/jero-boot/jero-boot-module-certification/src/main/java/com/jero/modules/cert/template/service/impl/ParamsTemplateEOServiceImpl.java @@ -127,6 +127,7 @@ public class ParamsTemplateEOServiceImpl extends ServiceImpl