From 02913517023edffba23b26419cca7b1582fe6092 Mon Sep 17 00:00:00 2001 From: tangw Date: Tue, 23 Dec 2025 16:11:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=82=E6=95=B0=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/domain/entity/lis/ComReportDict.java | 30 ++++ .../xtwh/ComConfigDictController.java | 6 +- .../xtwh/ComReportDictController.java | 108 +++++++++++++ .../mapper/xtwh/ComReportDictMapper.java | 85 ++++++++++ .../liswork/service/ComReportDictService.java | 87 ++++++++++ .../service/impl/ReportItemServiceImpl.java | 4 +- .../impl/xtwh/ComReportDictServiceImpl.java | 150 ++++++++++++++++++ .../resources/mapper/ComReportDictMapper.xml | 137 ++++++++++++++++ 8 files changed, 603 insertions(+), 4 deletions(-) create mode 100644 lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/ComReportDict.java create mode 100644 liswork/src/main/java/com/czlis/liswork/controller/xtwh/ComReportDictController.java create mode 100644 liswork/src/main/java/com/czlis/liswork/mapper/xtwh/ComReportDictMapper.java create mode 100644 liswork/src/main/java/com/czlis/liswork/service/ComReportDictService.java create mode 100644 liswork/src/main/java/com/czlis/liswork/service/impl/xtwh/ComReportDictServiceImpl.java create mode 100644 liswork/src/main/resources/mapper/ComReportDictMapper.xml diff --git a/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/ComReportDict.java b/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/ComReportDict.java new file mode 100644 index 0000000..668f009 --- /dev/null +++ b/lis-common/src/main/java/com/czlis/common/core/domain/entity/lis/ComReportDict.java @@ -0,0 +1,30 @@ +package com.czlis.common.core.domain.entity.lis; + + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + + +import java.util.Date; +@Data +@NoArgsConstructor +@AllArgsConstructor +public class ComReportDict { + + private Long reportId; + private String reportType; + private String reportCode; + private String reportName; + private String reportOptiontype; + private String reportDefvalue; + private Long reportSort; + private String status; + private String createBy; + private Date createTime; + private String updateBy; + private Date updateTime; + private String remark; + + +} diff --git a/liswork/src/main/java/com/czlis/liswork/controller/xtwh/ComConfigDictController.java b/liswork/src/main/java/com/czlis/liswork/controller/xtwh/ComConfigDictController.java index c507205..7dee746 100644 --- a/liswork/src/main/java/com/czlis/liswork/controller/xtwh/ComConfigDictController.java +++ b/liswork/src/main/java/com/czlis/liswork/controller/xtwh/ComConfigDictController.java @@ -29,10 +29,10 @@ public class ComConfigDictController extends BaseController { */ @ApiOperation("获取字典列表") @GetMapping("/list") - public AjaxResult list(ComConfigDict post) { - // startPage(); + public TableDataInfo list(ComConfigDict post) { + startPage(); List list = ComConfigDictService.selectComConfigDictList(post); - return success(list); + return getDataTable(list); } @ApiOperation("字典导出") @Log(title = "字典导出", businessType = BusinessType.EXPORT) diff --git a/liswork/src/main/java/com/czlis/liswork/controller/xtwh/ComReportDictController.java b/liswork/src/main/java/com/czlis/liswork/controller/xtwh/ComReportDictController.java new file mode 100644 index 0000000..5bce760 --- /dev/null +++ b/liswork/src/main/java/com/czlis/liswork/controller/xtwh/ComReportDictController.java @@ -0,0 +1,108 @@ +package com.czlis.liswork.controller.xtwh; + +import com.czlis.common.annotation.Log; +import com.czlis.common.core.controller.BaseController; +import com.czlis.common.core.domain.AjaxResult; +import com.czlis.common.core.domain.entity.lis.ComReportDict; +import com.czlis.common.enums.BusinessType; +import com.czlis.common.utils.poi.ExcelUtil; +import com.czlis.liswork.service.ComReportDictService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +@Api(tags = "参数模板设置") +@RestController +@RequestMapping("/reportdict") +@Slf4j +public class ComReportDictController extends BaseController { + @Autowired + private ComReportDictService comReportDictService; + /** + * 获取字典列表 + */ + @ApiOperation("获取字典列表") + @GetMapping("/list") + public AjaxResult list(ComReportDict post) { + // startPage(); + List list = comReportDictService.selectComReportDictList(post); + return success(list); + } + @ApiOperation("字典导出") + @Log(title = "字典导出", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, ComReportDict post) { + List list = comReportDictService.selectComReportDictList(post); + ExcelUtil util = new ExcelUtil<>(ComReportDict.class); + util.exportExcel(response, list, "字典数据"); + } + + /** + * 根据字典编号获取详细信息 + */ + @ApiOperation("获取详细信息") + @GetMapping(value = "/{dictId}") + public AjaxResult getInfo(@PathVariable Long dictId) { + return success(comReportDictService.selectComReportDictById(dictId)); + } + + /** + * 新增字典 + */ + @ApiOperation("新增字典") + @Log(title = "字典管理", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@Validated @RequestBody ComReportDict post) { + log.info("post:{}",post); + + if (!comReportDictService.checkDictNameUnique(post)) { + return error("新增字典'" + post.getReportName() + "'失败,字典名称已存在"); + } else if (!comReportDictService.checkDictCodeUnique(post)) { + return error("新增字典'" + post.getReportName() + "'失败,字典编码已存在"); + } + post.setCreateBy(getUsername()); + return toAjax(comReportDictService.insertDict(post)); + } + + /** + * 修改字典 + */ + @ApiOperation("修改字典") + @Log(title = "字典管理", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@Validated @RequestBody ComReportDict post) { + if (!comReportDictService.checkDictNameUnique(post)) { + return error("修改字典'" + post.getReportName() + "'失败,字典名称已存在"); + } else if (!comReportDictService.checkDictCodeUnique(post)) { + return error("修改字典'" + post.getReportName() + "'失败,字典编码已存在"); + } + post.setUpdateBy(getUsername()); + return toAjax(comReportDictService.updateDict(post)); + } + + /** + * 删除字典 + */ + @ApiOperation("删除字典") + @Log(title = "字典管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{dictIds}") + public AjaxResult remove(@PathVariable Long[] dictIds) { + return toAjax(comReportDictService.deleteDictByIds(dictIds)); + } + + /** + * 获取字典选择框列表 + */ + @ApiOperation("获取字典选择框列表") + @GetMapping("/optionselect") + public AjaxResult optionselect() { + List posts = comReportDictService.selectComReportDictAll(); + return success(posts); + } +} diff --git a/liswork/src/main/java/com/czlis/liswork/mapper/xtwh/ComReportDictMapper.java b/liswork/src/main/java/com/czlis/liswork/mapper/xtwh/ComReportDictMapper.java new file mode 100644 index 0000000..6a38971 --- /dev/null +++ b/liswork/src/main/java/com/czlis/liswork/mapper/xtwh/ComReportDictMapper.java @@ -0,0 +1,85 @@ +package com.czlis.liswork.mapper.xtwh; + +import com.czlis.common.core.domain.entity.lis.ComReportDict; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ComReportDictMapper { + Long getCountById(Long reportId); + List selectComReportDictByType(String reportType); + + /** + * 查询报表模板数据集合 + * + * @param Dict 报表模板信息 + * @return 报表模板数据集合 + */ + List selectComReportDictList(ComReportDict Dict); + + /** + * 查询所有报表模板 + * + * @return 报表模板列表 + */ + List selectComReportDictAll(); + + /** + * 通过报表模板ID查询报表模板信息 + * + * @param reportId 报表模板ID + * @return 角色对象信息 + */ + ComReportDict selectComReportDictById(Long reportId); + + + /** + * 删除报表模板信息 + * + * @param reportId 报表模板ID + * @return 结果 + */ + int delComReportDictById(Long reportId); + + /** + * 批量删除报表模板信息 + * + * @param DictIds 需要删除的报表模板ID + * @return 结果 + */ + int delComReportDictByIds(Long[] DictIds); + + /** + * 修改报表模板信息 + * + * @param Dict 报表模板信息 + * @return 结果 + */ + int updateComReportDict(ComReportDict Dict); + + /** + * 新增报表模板信息 + * + * @param Dict 报表模板信息 + * @return 结果 + */ + int insertComReportDict(ComReportDict Dict); + + /** + * 校验报表模板名称 + * + * @param reportName 报表模板名称 + * @param reportType 类别 + * @return 结果 + */ + ComReportDict checkDictNameUnique(@Param("reportName") String reportName, @Param("reportType") String reportType); + + /** + * 校验报表模板编码 + * + * @param reportCode 报表模板编码 + * @return 结果 + */ + ComReportDict checkDictCodeUnique(@Param("reportCode") String reportCode,@Param("reportType") String reportType); + +} diff --git a/liswork/src/main/java/com/czlis/liswork/service/ComReportDictService.java b/liswork/src/main/java/com/czlis/liswork/service/ComReportDictService.java new file mode 100644 index 0000000..5360ad8 --- /dev/null +++ b/liswork/src/main/java/com/czlis/liswork/service/ComReportDictService.java @@ -0,0 +1,87 @@ +package com.czlis.liswork.service; + +import com.czlis.common.core.domain.entity.lis.ComReportDict; + +import java.util.List; + +public interface ComReportDictService { + /** + * 查询报表模板信息集合 + * + * @param Dict 报表模板信息 + * @return 报表模板信息集合 + */ + List selectComReportDictList(ComReportDict Dict); + + /** + * 查询所有报表模板 + * + * @return 报表模板列表 + */ + List selectComReportDictAll(); + + /** + * 通过报表模板ID查询报表模板信息 + * + * @param DictId 报表模板ID + * @return 角色对象信息 + */ + ComReportDict selectComReportDictById(Long DictId); + + + /** + * 校验报表模板名称是否唯一 + * + * @param Dict 报表模板信息 + * @return 结果 + */ + boolean checkDictNameUnique(ComReportDict Dict); + + /** + * 校验报表模板编码是否唯一 + * + * @param Dict 报表模板信息 + * @return 结果 + */ + boolean checkDictCodeUnique(ComReportDict Dict); + + /** + * 通过报表模板ID查询报表模板使用数量 + * + * @param DictId 报表模板ID + * @return 结果 + */ + int countUserDictById(Long DictId); + + /** + * 删除报表模板信息 + * + * @param DictId 报表模板ID + * @return 结果 + */ + int deleteDictById(Long DictId); + + /** + * 批量删除报表模板信息 + * + * @param DictIds 需要删除的报表模板ID + * @return 结果 + */ + int deleteDictByIds(Long[] DictIds); + + /** + * 新增保存报表模板信息 + * + * @param Dict 报表模板信息 + * @return 结果 + */ + int insertDict(ComReportDict Dict); + + /** + * 修改保存报表模板信息 + * + * @param Dict 报表模板信息 + * @return 结果 + */ + int updateDict(ComReportDict Dict); +} diff --git a/liswork/src/main/java/com/czlis/liswork/service/impl/ReportItemServiceImpl.java b/liswork/src/main/java/com/czlis/liswork/service/impl/ReportItemServiceImpl.java index 8d4d78f..2437775 100644 --- a/liswork/src/main/java/com/czlis/liswork/service/impl/ReportItemServiceImpl.java +++ b/liswork/src/main/java/com/czlis/liswork/service/impl/ReportItemServiceImpl.java @@ -486,7 +486,9 @@ public class ReportItemServiceImpl implements ReportItemService { XmDouble xmDouble=new XmDouble(); xmDouble.setYq(yq); xmDouble.setXmdh(xmdh); - return new Result("0","成功!",reportItemMapper.queryXmDouble(xmDouble)); + List XmDoublelist=reportItemMapper.queryXmDouble(xmDouble); + if(!XmDoublelist.isEmpty()&&XmDoublelist!=null)xmDouble=XmDoublelist.get(0); + return new Result("0","成功!",xmDouble); } @Transactional(rollbackFor = Exception.class) @Override diff --git a/liswork/src/main/java/com/czlis/liswork/service/impl/xtwh/ComReportDictServiceImpl.java b/liswork/src/main/java/com/czlis/liswork/service/impl/xtwh/ComReportDictServiceImpl.java new file mode 100644 index 0000000..8f51204 --- /dev/null +++ b/liswork/src/main/java/com/czlis/liswork/service/impl/xtwh/ComReportDictServiceImpl.java @@ -0,0 +1,150 @@ +package com.czlis.liswork.service.impl.xtwh; + +import com.czlis.common.constant.UserConstants; +import com.czlis.common.core.domain.entity.lis.ComReportDict; +import com.czlis.common.exception.ServiceException; +import com.czlis.common.utils.StringUtils; +import com.czlis.liswork.mapper.xtwh.ComReportDictMapper; +import com.czlis.liswork.service.ComReportDictService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 配置参数报表模板,系统配置菜单依据本报表模板自动创建配置档 + */ +@Service +@Slf4j +public class ComReportDictServiceImpl implements ComReportDictService { + + @Autowired + ComReportDictMapper comReportDictMapper; + /** + * 查询报表模板信息集合 + * + * @param Dict 报表模板信息 + * @return 报表模板信息集合 + */ + @Override + public List selectComReportDictList(ComReportDict Dict) { + return comReportDictMapper.selectComReportDictList(Dict); + } + + /** + * 查询所有报表模板 + * + * @return 报表模板列表 + */ + @Override + public List selectComReportDictAll() { + return comReportDictMapper.selectComReportDictAll(); + } + + /** + * 通过报表模板ID查询报表模板信息 + * + * @param DictId 报表模板ID + * @return 角色对象信息 + */ + @Override + public ComReportDict selectComReportDictById(Long DictId) { + return comReportDictMapper.selectComReportDictById(DictId); + } + + + /** + * 校验报表模板名称是否唯一 + * + * @param Dict 报表模板信息 + * @return 结果 + */ + @Override + public boolean checkDictNameUnique(ComReportDict Dict) { + Long DictId = StringUtils.isNull(Dict.getReportId()) ? -1L : Dict.getReportId(); + ComReportDict info = comReportDictMapper.checkDictNameUnique(Dict.getReportName(),Dict.getReportType()); + if (StringUtils.isNotNull(info) && info.getReportId().longValue() != DictId.longValue()) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 校验报表模板编码是否唯一 + * + * @param Dict 报表模板信息 + * @return 结果 + */ + @Override + public boolean checkDictCodeUnique(ComReportDict Dict) { + Long DictId = StringUtils.isNull(Dict.getReportId()) ? -1L : Dict.getReportId(); + ComReportDict info = comReportDictMapper.checkDictCodeUnique(Dict.getReportCode(),Dict.getReportType()); + if (StringUtils.isNotNull(info) && info.getReportId().longValue() != DictId.longValue()) { + return UserConstants.NOT_UNIQUE; + } + return UserConstants.UNIQUE; + } + + /** + * 通过报表模板ID查询报表模板使用数量 + * + * @param DictId 报表模板ID + * @return 结果 + */ + @Override + public int countUserDictById(Long DictId) { + return 0;//comReportDictMapper.countUserDictById(DictId); + } + + /** + * 删除报表模板信息 + * + * @param DictId 报表模板ID + * @return 结果 + */ + @Override + public int deleteDictById(Long DictId) { + return comReportDictMapper.delComReportDictById(DictId); + } + + /** + * 批量删除报表模板信息 + * + * @param DictIds 需要删除的报表模板ID + * @return 结果 + */ + @Override + public int deleteDictByIds(Long[] DictIds) { + for (Long DictId : DictIds) { + ComReportDict Dict = selectComReportDictById(DictId); + if (countUserDictById(DictId) > 0) { + throw new ServiceException(String.format("%1$s已分配,不能删除", Dict.getReportName())); + } + } + return comReportDictMapper.delComReportDictByIds(DictIds); + } + + /** + * 新增保存报表模板信息 + * + * @param Dict 报表模板信息 + * @return 结果 + */ + @Override + public int insertDict(ComReportDict Dict) { + return comReportDictMapper.insertComReportDict(Dict); + } + + /** + * 修改保存报表模板信息 + * + * @param Dict 报表模板信息 + * @return 结果 + */ + @Override + public int updateDict(ComReportDict Dict) { + return comReportDictMapper.updateComReportDict(Dict); + } + +} diff --git a/liswork/src/main/resources/mapper/ComReportDictMapper.xml b/liswork/src/main/resources/mapper/ComReportDictMapper.xml new file mode 100644 index 0000000..319266d --- /dev/null +++ b/liswork/src/main/resources/mapper/ComReportDictMapper.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + select report_id,report_type,report_code,report_name,report_optiontype,report_defvalue,report_sort, + status,create_by,create_time,update_by,update_time,remark from com_report_dict + + + + + + + + + + + + + + insert into com_report_dict( + report_id, + report_type, + report_code, + report_name, + report_optiontype, + report_defvalue, + report_sort, + status, + remark, + create_by, + create_time + )values( + #{reportId}, + #{reportType}, + #{reportCode}, + #{reportName}, + #{reportOptiontype}, + #{reportDefvalue}, + #{reportSort}, + #{status}, + #{remark}, + #{createBy}, + getdate() + ) + + + + delete from com_report_dict where report_id = #{reportId} + + + + delete from com_report_dict where report_id in + + #{reportId} + + + + + update com_report_dict + + report_type = #{reportType}, + report_code = #{reportCode}, + report_name = #{reportName}, + report_optiontype = #{reportOptiontype}, + report_defvalue = #{reportDefvalue}, + report_sort = #{reportSort}, + status = #{status}, + remark = #{remark}, + update_by = #{updateBy}, + update_time = getdate() + + where report_id = #{reportId} + + + + \ No newline at end of file