From 31d6d4725205c62fe99590969c2259f6396db667 Mon Sep 17 00:00:00 2001 From: bobol Date: Mon, 25 Dec 2023 18:19:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E6=8C=87=E6=A0=87=E8=AE=A1=E5=88=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bi/domain/DcBusiTargetDraftDaynew.java | 130 ++++++++++ .../mapper/DcBusiTargetDraftDaynewMapper.java | 63 +++++ .../DcBusiTargetDraftDaynewService.java | 91 +++++++ .../DcBusiPlanBillMasterController.java | 45 ++++ .../bill/domain/DcBusiPlanBillMaster.java | 6 + .../lzbi/bill/domain/DcBusiPlanBillSub.java | 2 +- .../mapper/DcBusiPlanBillMasterMapper.java | 20 +- .../service/DcBusiPlanBillMasterService.java | 231 ++++++++++++++--- .../asset/DcBusiPlanBillMasterMapper.xml | 236 ++++++++++++------ .../mapper/asset/DcBusiPlanBillSubMapper.xml | 44 +--- .../asset/DcBusiTargetDraftDaynewMapper.xml | 178 +++++++++++++ .../targetFolder/DcBaseAssetTargetMapper.xml | 6 + 12 files changed, 899 insertions(+), 153 deletions(-) create mode 100644 lzbi-module/src/main/java/com/lzbi/bi/domain/DcBusiTargetDraftDaynew.java create mode 100644 lzbi-module/src/main/java/com/lzbi/bi/mapper/DcBusiTargetDraftDaynewMapper.java create mode 100644 lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiTargetDraftDaynewService.java create mode 100644 lzbi-module/src/main/resources/mapper/asset/DcBusiTargetDraftDaynewMapper.xml diff --git a/lzbi-module/src/main/java/com/lzbi/bi/domain/DcBusiTargetDraftDaynew.java b/lzbi-module/src/main/java/com/lzbi/bi/domain/DcBusiTargetDraftDaynew.java new file mode 100644 index 0000000..dc552b8 --- /dev/null +++ b/lzbi-module/src/main/java/com/lzbi/bi/domain/DcBusiTargetDraftDaynew.java @@ -0,0 +1,130 @@ +package com.lzbi.bi.domain; + +import java.math.BigDecimal; +import java.util.Date; +import lombok.Data; +import io.swagger.annotations.ApiModelProperty; +import lombok.experimental.Accessors; +import com.lzbi.common.annotation.Excel; +import com.lzbi.module.base.BaseModuleEntity; + +/** + * 指标数据底稿日-新结构对象 dc_busi_target_draft_daynew + * + * @author lienbo + * @date 2023-12-25 + */ +@Data +@Accessors(chain = true) +public class DcBusiTargetDraftDaynew extends BaseModuleEntity +{ + private static final long serialVersionUID = 1L; + + /** 创建人 */ + private String createdBy; + + /** 创建时间 */ + private Date createdTime; + + /** 更新人 */ + private String updatedBy; + + /** 更新时间 */ + private Date updatedTime; + + /** 公司ID */ + @Excel(name = "公司ID") + @ApiModelProperty(name = "公司ID",notes = "companyId") + private Long companyId; + + /** 公司名称 */ + @Excel(name = "公司名称") + @ApiModelProperty(name = "公司名称",notes = "companyName") + private String companyName; + + /** 组织ID */ + @Excel(name = "组织ID") + @ApiModelProperty(name = "组织ID",notes = "organizeId") + private Long organizeId; + + /** 组织名称 */ + @Excel(name = "组织名称") + @ApiModelProperty(name = "组织名称",notes = "organizeName") + private String organizeName; + + /** 统计单元编码 */ + @Excel(name = "统计单元编码") + @ApiModelProperty(name = "统计单元编码",notes = "assetCode") + private String assetCode; + + /** 统计单元名称 */ + @Excel(name = "统计单元名称") + @ApiModelProperty(name = "统计单元名称",notes = "assetName") + private String assetName; + + /** 指标编码 */ + @Excel(name = "指标编码") + @ApiModelProperty(name = "指标编码",notes = "targetCode") + private String targetCode; + + /** 指标名称 */ + @Excel(name = "指标名称") + @ApiModelProperty(name = "指标名称",notes = "tagetName") + private String tagetName; + + /** 指标模型编码 */ + @Excel(name = "指标模型编码") + @ApiModelProperty(name = "指标模型编码",notes = "targetModelCode") + private String targetModelCode; + + /** 指标原值 */ + @Excel(name = "指标原值") + @ApiModelProperty(name = "指标原值",notes = "valueOriginal") + private BigDecimal valueOriginal; + + /** 指标结果值 */ + @Excel(name = "指标结果值") + @ApiModelProperty(name = "指标结果值",notes = "valueResult") + private BigDecimal valueResult; + + /** 指标计划值 */ + @Excel(name = "指标计划值") + @ApiModelProperty(name = "指标计划值",notes = "valuePlan") + private BigDecimal valuePlan; + + /** 年 */ + @Excel(name = "年") + @ApiModelProperty(name = "年",notes = "dateYear") + private String dateYear; + + /** 月 */ + @Excel(name = "月") + @ApiModelProperty(name = "月",notes = "dateMonth") + private String dateMonth; + + /** 日 */ + @Excel(name = "日") + @ApiModelProperty(name = "日",notes = "dateDay") + private String dateDay; + + /** 指标临时值 */ + @Excel(name = "指标临时值") + @ApiModelProperty(name = "指标临时值",notes = "valueTemp") + private BigDecimal valueTemp; + + /** 所属专业编码 */ + @Excel(name = "所属专业编码") + @ApiModelProperty(name = "所属专业编码",notes = "fieldCode") + private String fieldCode; + + /** 所属专业名称 */ + @Excel(name = "所属专业名称") + @ApiModelProperty(name = "所属专业名称",notes = "fieldName") + private String fieldName; + + /** 调整值 */ + @Excel(name = "调整值") + @ApiModelProperty(name = "调整值",notes = "valueAdjust") + private BigDecimal valueAdjust; + +} diff --git a/lzbi-module/src/main/java/com/lzbi/bi/mapper/DcBusiTargetDraftDaynewMapper.java b/lzbi-module/src/main/java/com/lzbi/bi/mapper/DcBusiTargetDraftDaynewMapper.java new file mode 100644 index 0000000..75b9c52 --- /dev/null +++ b/lzbi-module/src/main/java/com/lzbi/bi/mapper/DcBusiTargetDraftDaynewMapper.java @@ -0,0 +1,63 @@ +package com.lzbi.bi.mapper; + +import java.util.List; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.lzbi.bi.domain.DcBusiTargetDraftDaynew; + +/** + * 指标数据底稿日-新结构Mapper接口 + * + * @author lienbo + * @date 2023-12-25 + */ + +public interface DcBusiTargetDraftDaynewMapper extends BaseMapper +{ + /** + * 查询指标数据底稿日-新结构 + * + * @param id 指标数据底稿日-新结构主键 + * @return 指标数据底稿日-新结构 + */ + public DcBusiTargetDraftDaynew selectDcBusiTargetDraftDaynewById(String id); + + /** + * 查询指标数据底稿日-新结构列表 + * + * @param dcBusiTargetDraftDaynew 指标数据底稿日-新结构 + * @return 指标数据底稿日-新结构集合 + */ + public List selectDcBusiTargetDraftDaynewList(DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew); + + /** + * 新增指标数据底稿日-新结构 + * + * @param dcBusiTargetDraftDaynew 指标数据底稿日-新结构 + * @return 结果 + */ + public int insertDcBusiTargetDraftDaynew(DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew); + + /** + * 修改指标数据底稿日-新结构 + * + * @param dcBusiTargetDraftDaynew 指标数据底稿日-新结构 + * @return 结果 + */ + public int updateDcBusiTargetDraftDaynew(DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew); + + /** + * 删除指标数据底稿日-新结构 + * + * @param id 指标数据底稿日-新结构主键 + * @return 结果 + */ + public int deleteDcBusiTargetDraftDaynewById(String id); + + /** + * 批量删除指标数据底稿日-新结构 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDcBusiTargetDraftDaynewByIds(String[] ids); +} diff --git a/lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiTargetDraftDaynewService.java b/lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiTargetDraftDaynewService.java new file mode 100644 index 0000000..c6fd169 --- /dev/null +++ b/lzbi-module/src/main/java/com/lzbi/bi/service/DcBusiTargetDraftDaynewService.java @@ -0,0 +1,91 @@ +package com.lzbi.bi.service; + +import java.util.List; +import com.lzbi.common.utils.DateUtils; +import org.springframework.stereotype.Service; +import com.lzbi.bi.domain.DcBusiTargetDraftDaynew; +import com.lzbi.bi.mapper.DcBusiTargetDraftDaynewMapper; +import com.baomidou.mybatisplus.extension.service.IService; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +/** + * 指标数据底稿日-新结构Service业务层处理 + * + * @author 李恩博 + * @date 2023-12-25 + */ +@Service +public class DcBusiTargetDraftDaynewService extends ServiceImpl implements IService +{ + + /** + * 查询指标数据底稿日-新结构 + * + * @param id 指标数据底稿日-新结构主键 + * @return 指标数据底稿日-新结构 + */ + public DcBusiTargetDraftDaynew selectDcBusiTargetDraftDaynewById(String id) + { + return baseMapper.selectDcBusiTargetDraftDaynewById(id); + } + + /** + * 查询指标数据底稿日-新结构列表 + * + * @param dcBusiTargetDraftDaynew 指标数据底稿日-新结构 + * @return 指标数据底稿日-新结构 + */ + public List selectDcBusiTargetDraftDaynewList(DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew) + { + return baseMapper.selectDcBusiTargetDraftDaynewList(dcBusiTargetDraftDaynew); + } + + /** + * 新增指标数据底稿日-新结构 + * + * @param dcBusiTargetDraftDaynew 指标数据底稿日-新结构 + * @return 结果 + */ + + public int insertDcBusiTargetDraftDaynew(DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew) + { + dcBusiTargetDraftDaynew.setCreatedTime(DateUtils.getNowDate()); + return baseMapper.insertDcBusiTargetDraftDaynew(dcBusiTargetDraftDaynew); + } + + /** + * 修改指标数据底稿日-新结构 + * + * @param dcBusiTargetDraftDaynew 指标数据底稿日-新结构 + * @return 结果 + */ + + public int updateDcBusiTargetDraftDaynew(DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew) + { + dcBusiTargetDraftDaynew.setUpdatedTime(DateUtils.getNowDate()); + return baseMapper.updateDcBusiTargetDraftDaynew(dcBusiTargetDraftDaynew); + } + + /** + * 批量删除指标数据底稿日-新结构 + * + * @param ids 需要删除的指标数据底稿日-新结构主键 + * @return 结果 + */ + + public int deleteDcBusiTargetDraftDaynewByIds(String[] ids) + { + return baseMapper.deleteDcBusiTargetDraftDaynewByIds(ids); + } + + /** + * 删除指标数据底稿日-新结构信息 + * + * @param id 指标数据底稿日-新结构主键 + * @return 结果 + */ + + public int deleteDcBusiTargetDraftDaynewById(String id) + { + return baseMapper.deleteDcBusiTargetDraftDaynewById(id); + } +} diff --git a/lzbi-module/src/main/java/com/lzbi/bill/controller/DcBusiPlanBillMasterController.java b/lzbi-module/src/main/java/com/lzbi/bill/controller/DcBusiPlanBillMasterController.java index 6676bb8..d9cd0db 100644 --- a/lzbi-module/src/main/java/com/lzbi/bill/controller/DcBusiPlanBillMasterController.java +++ b/lzbi-module/src/main/java/com/lzbi/bill/controller/DcBusiPlanBillMasterController.java @@ -1,4 +1,7 @@ package com.lzbi.bill.controller; +import com.lzbi.common.utils.DateUtils; +import com.lzbi.common.utils.SecurityUtils; +import com.lzbi.draft.domain.DcBusiTargetBillMaster; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -83,6 +86,20 @@ public class DcBusiPlanBillMasterController extends BaseController return success(dcBusiPlanBillMasterService.selectDcBusiPlanBillMasterById(id)); } + /** + * 获取计划单据主详细信息 + */ + @ApiOperation("获取计划单据主详细信息") + @ApiImplicitParams({ + @ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class), + }) + @PreAuthorize("@ss.hasPermi('bill:planBillMaster:query')") + @GetMapping(value = "/billNo/{billNo}") + public AjaxResult getInfo(@PathVariable("billNo") String billNo) + { + return success(dcBusiPlanBillMasterService.selectDcBusiPlanBillMasterByBillNo(billNo)); + } + /** * 新增计划单据主 */ @@ -128,4 +145,32 @@ public class DcBusiPlanBillMasterController extends BaseController { return toAjax(dcBusiPlanBillMasterService.deleteDcBusiPlanBillMasterByIds(ids)); } + + @ApiOperation("驳回") + @ApiImplicitParams({ + @ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class), + }) + @PostMapping("/checkBack/{billNo}") + public AjaxResult checkBack(@PathVariable String billNo){ + return AjaxResult.success(dcBusiPlanBillMasterService.checkBack(billNo)); + } + + @ApiOperation("审核") + @ApiImplicitParams({ + @ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class), + }) + @PostMapping("/checkPass/{billNo}") + public AjaxResult checkPass(@PathVariable String billNo){ + + return AjaxResult.success(dcBusiPlanBillMasterService.checkPass(billNo)); + } + + @ApiOperation("反审核") + @ApiImplicitParams({ + @ApiImplicitParam(name = "billNo", value = "", dataType = "String", dataTypeClass = String.class), + }) + @PostMapping("/checkRevert/{billNo}") + public AjaxResult checkRevert(@PathVariable String billNo){ + return AjaxResult.success(dcBusiPlanBillMasterService.checkRevert(billNo)); + } } diff --git a/lzbi-module/src/main/java/com/lzbi/bill/domain/DcBusiPlanBillMaster.java b/lzbi-module/src/main/java/com/lzbi/bill/domain/DcBusiPlanBillMaster.java index 0e471ba..613aa8b 100644 --- a/lzbi-module/src/main/java/com/lzbi/bill/domain/DcBusiPlanBillMaster.java +++ b/lzbi-module/src/main/java/com/lzbi/bill/domain/DcBusiPlanBillMaster.java @@ -79,6 +79,12 @@ public class DcBusiPlanBillMaster extends BaseModuleEntity /** 组织机构ID */ private Long oragnizeId; + /** 所属专业 */ + private String fieldCode; + + /** 所属专业名称 */ + private String fieldName; + /** 计划单据明细信息 */ private List dcBusiPlanBillSubList; diff --git a/lzbi-module/src/main/java/com/lzbi/bill/domain/DcBusiPlanBillSub.java b/lzbi-module/src/main/java/com/lzbi/bill/domain/DcBusiPlanBillSub.java index ee32e88..a5ee3e7 100644 --- a/lzbi-module/src/main/java/com/lzbi/bill/domain/DcBusiPlanBillSub.java +++ b/lzbi-module/src/main/java/com/lzbi/bill/domain/DcBusiPlanBillSub.java @@ -49,7 +49,7 @@ public class DcBusiPlanBillSub /** 指标名称 */ @Excel(name = "指标名称") - private String tagetName; + private String targetName; /** 参数值 */ @Excel(name = "参数值") diff --git a/lzbi-module/src/main/java/com/lzbi/bill/mapper/DcBusiPlanBillMasterMapper.java b/lzbi-module/src/main/java/com/lzbi/bill/mapper/DcBusiPlanBillMasterMapper.java index fe80d69..f27f8f7 100644 --- a/lzbi-module/src/main/java/com/lzbi/bill/mapper/DcBusiPlanBillMasterMapper.java +++ b/lzbi-module/src/main/java/com/lzbi/bill/mapper/DcBusiPlanBillMasterMapper.java @@ -21,6 +21,13 @@ public interface DcBusiPlanBillMasterMapper extends BaseMapper implements IService -{ +public class DcBusiPlanBillMasterService extends ServiceImpl implements IService { + + @Autowired + private SysDeptServiceImpl sysDeptService; + + @Resource + private DcBusiPlanBillSubMapper dcBusiPlanBillSubMapper; + + @Resource + private DcBusiTargetDraftDaynewMapper dcBusiTargetDraftDaynewMapper; + + @Resource + private DcBaseAssetTargetMapper dcBaseAssetTargetMapper; /** * 查询计划单据主 - * + * * @param id 计划单据主主键 * @return 计划单据主 */ - public DcBusiPlanBillMaster selectDcBusiPlanBillMasterById(Long id) - { + public DcBusiPlanBillMaster selectDcBusiPlanBillMasterById(Long id) { return baseMapper.selectDcBusiPlanBillMasterById(id); } + public DcBusiPlanBillMaster selectDcBusiPlanBillMasterByBillNo(String billNo) { + DcBusiPlanBillMaster dcBusiPlanBillMaster = baseMapper.selectDcBusiPlanBillMasterByBillNo(billNo); + DcBusiPlanBillSub params = new DcBusiPlanBillSub(); + params.setBillNo(billNo); + List dcBusiPlanBillSubs = dcBusiPlanBillSubMapper.selectDcBusiPlanBillSubList(params); + if (!CollectionUtils.isEmpty(dcBusiPlanBillSubs)) { + dcBusiPlanBillMaster.setDcBusiPlanBillSubList(dcBusiPlanBillSubs); + dcBusiPlanBillMaster.setFieldCode(dcBusiPlanBillSubs.get(0).getFieldCode()); + dcBusiPlanBillMaster.setFieldName(dcBusiPlanBillSubs.get(0).getFieldName()); + } + return dcBusiPlanBillMaster; + } + /** * 查询计划单据主列表 - * + * * @param dcBusiPlanBillMaster 计划单据主 * @return 计划单据主 */ - public List selectDcBusiPlanBillMasterList(DcBusiPlanBillMaster dcBusiPlanBillMaster) - { + public List selectDcBusiPlanBillMasterList(DcBusiPlanBillMaster dcBusiPlanBillMaster) { return baseMapper.selectDcBusiPlanBillMasterList(dcBusiPlanBillMaster); } /** * 新增计划单据主 - * + * * @param dcBusiPlanBillMaster 计划单据主 * @return 结果 */ @Transactional - - public int insertDcBusiPlanBillMaster(DcBusiPlanBillMaster dcBusiPlanBillMaster) - { + public int insertDcBusiPlanBillMaster(DcBusiPlanBillMaster dcBusiPlanBillMaster) { + DcBusiPlanBillMaster params = new DcBusiPlanBillMaster(); + params.setBillNo(dcBusiPlanBillMaster.getBillNo()); + List dcBusiPlanBillMasters = this.selectDcBusiPlanBillMasterList(params); + // 如果单据号重复了 + if (!CollectionUtils.isEmpty(dcBusiPlanBillMasters)) { + throw new RuntimeException("单据号已存在,不可重复录入"); + } + // 查询公司 + SysDept company = sysDeptService.selectDeptById(dcBusiPlanBillMaster.getCompanyId()); + if (ObjectUtils.isNotEmpty(company)) { + dcBusiPlanBillMaster.setCompanyName(company.getDeptName()); + } + // 查询组织 + SysDept organize = sysDeptService.selectDeptById(dcBusiPlanBillMaster.getOragnizeId()); + if (ObjectUtils.isNotEmpty(organize)) { + dcBusiPlanBillMaster.setOrganizeName(organize.getDeptName()); + } dcBusiPlanBillMaster.setCreatedTime(DateUtils.getNowDate()); + dcBusiPlanBillMaster.setCreatedBy(SecurityUtils.getLoginUser().getUsername()); int rows = baseMapper.insertDcBusiPlanBillMaster(dcBusiPlanBillMaster); insertDcBusiPlanBillSub(dcBusiPlanBillMaster); return rows; @@ -62,68 +113,166 @@ public class DcBusiPlanBillMasterService extends ServiceImpl subList = dcBusiPlanBillSubMapper.selectDcBusiPlanBillSubList(subParams); + if (!CollectionUtils.isEmpty(subList)) { + // 循环修改底稿表数据 + for (int i = 0, len = subList.size(); i < len; i++) { + DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew = new DcBusiTargetDraftDaynew(); + dcBusiTargetDraftDaynew.setCompanyId(master.getCompanyId()); + dcBusiTargetDraftDaynew.setOrganizeId(master.getOragnizeId()); + dcBusiTargetDraftDaynew.setFieldCode(master.getFieldCode()); + dcBusiTargetDraftDaynew.setAssetCode(subList.get(i).getAssetCode()); + dcBusiTargetDraftDaynew.setTargetCode(subList.get(i).getTargetCode()); + dcBusiTargetDraftDaynew.setDateYear(subList.get(i).getDateYear()); + dcBusiTargetDraftDaynew.setDateMonth(subList.get(i).getDateMonth()); + dcBusiTargetDraftDaynew.setDateDay(subList.get(i).getDateDay()); + List dcBusiTargetDraftDaynews = dcBusiTargetDraftDaynewMapper.selectDcBusiTargetDraftDaynewList(dcBusiTargetDraftDaynew); + // 如果底稿表数据为空,则新增底稿数据,否则,加上计划值修改 + if (CollectionUtils.isEmpty(dcBusiTargetDraftDaynews)) { + dcBusiTargetDraftDaynew.setCompanyName(master.getCompanyName()); + dcBusiTargetDraftDaynew.setOrganizeName(master.getOrganizeName()); + dcBusiTargetDraftDaynew.setFieldName(master.getFieldName()); + dcBusiTargetDraftDaynew.setAssetName(subList.get(i).getAssetName()); + dcBusiTargetDraftDaynew.setTagetName(subList.get(i).getTargetName()); + DcBaseAssetTarget dcBaseAssetTarget = dcBaseAssetTargetMapper.selectDcBaseAssetTargetByTargetCodeAndAssetCode(subList.get(i).getAssetCode(), subList.get(i).getAssetCode()); + if (ObjectUtils.isNotEmpty(dcBaseAssetTarget)) { + dcBusiTargetDraftDaynew.setTargetModelCode(dcBaseAssetTarget.getTargetModelCode()); + } + dcBusiTargetDraftDaynew.setValuePlan(subList.get(i).getPlanValue()); + dcBusiTargetDraftDaynewMapper.insertDcBusiTargetDraftDaynew(dcBusiTargetDraftDaynew); + } else { + dcBusiTargetDraftDaynew = dcBusiTargetDraftDaynews.get(0); + dcBusiTargetDraftDaynew.setValuePlan(dcBusiTargetDraftDaynew.getValuePlan().add(subList.get(i).getPlanValue())); + dcBusiTargetDraftDaynewMapper.updateDcBusiTargetDraftDaynew(dcBusiTargetDraftDaynew); + } + } + } + // 修改计划单状态为2 + master.setUpdatedBy(SecurityUtils.getUsername()); + master.setCreatedTime(DateUtils.getNowDate()); + master.setBillNo(billNo); + master.setCheckStatus("2"); + return baseMapper.updateDcBusiPlanBillMasterByBillNo(master); + } + + @Transactional(rollbackFor = Exception.class) + public int checkRevert(String billNo) { + // 查询主表 + DcBusiPlanBillMaster master = baseMapper.selectDcBusiPlanBillMasterByBillNo(billNo); + if ("0".equals(master.getCheckStatus())) { + throw new RuntimeException("反审核失败,单据未提交"); + } + if ("1".equals(master.getCheckStatus())) { + throw new RuntimeException("反审核失败,单据未审核通过"); + } + // 如果单据状态为已审核状态,需要把底稿表数据恢复 + if ("2".equals(master.getCheckStatus())) { + // 查询子表数据 + DcBusiPlanBillSub subParams = new DcBusiPlanBillSub(); + subParams.setBillNo(billNo); + List subList = dcBusiPlanBillSubMapper.selectDcBusiPlanBillSubList(subParams); + for (int i = 0, len = subList.size(); i < len; i++) { + DcBusiTargetDraftDaynew dcBusiTargetDraftDaynew = new DcBusiTargetDraftDaynew(); + dcBusiTargetDraftDaynew.setCompanyId(master.getCompanyId()); + dcBusiTargetDraftDaynew.setOrganizeId(master.getOragnizeId()); + dcBusiTargetDraftDaynew.setFieldCode(master.getFieldCode()); + dcBusiTargetDraftDaynew.setAssetCode(subList.get(i).getAssetCode()); + dcBusiTargetDraftDaynew.setTargetCode(subList.get(i).getTargetCode()); + dcBusiTargetDraftDaynew.setDateYear(subList.get(i).getDateYear()); + dcBusiTargetDraftDaynew.setDateMonth(subList.get(i).getDateMonth()); + dcBusiTargetDraftDaynew.setDateDay(subList.get(i).getDateDay()); + List dcBusiTargetDraftDaynews = dcBusiTargetDraftDaynewMapper.selectDcBusiTargetDraftDaynewList(dcBusiTargetDraftDaynew); + // 如果底稿表数据不为空,则减去计划值 + if (!CollectionUtils.isEmpty(dcBusiTargetDraftDaynews)) { + dcBusiTargetDraftDaynew = dcBusiTargetDraftDaynews.get(0); + dcBusiTargetDraftDaynew.setValuePlan(dcBusiTargetDraftDaynew.getValuePlan().subtract(subList.get(i).getPlanValue())); + dcBusiTargetDraftDaynewMapper.updateDcBusiTargetDraftDaynew(dcBusiTargetDraftDaynew); + } + } + } + master.setUpdatedBy(SecurityUtils.getUsername()); + master.setCreatedTime(DateUtils.getNowDate()); + master.setBillNo(billNo); + master.setCheckStatus("0"); + return baseMapper.updateDcBusiPlanBillMasterByBillNo(master); } /** * 批量删除计划单据主 - * + * * @param ids 需要删除的计划单据主主键 * @return 结果 */ @Transactional - public int deleteDcBusiPlanBillMasterByIds(Long[] ids) - { - baseMapper.deleteDcBusiPlanBillSubByBillNos(ids); + public int deleteDcBusiPlanBillMasterByIds(Long[] ids) { + baseMapper.deleteDcBusiPlanBillSubByBillNos(ids); return baseMapper.deleteDcBusiPlanBillMasterByIds(ids); } /** * 删除计划单据主信息 - * + * * @param id 计划单据主主键 * @return 结果 */ @Transactional - public int deleteDcBusiPlanBillMasterById(Long id) - { - baseMapper.deleteDcBusiPlanBillSubByBillNo(id); + public int deleteDcBusiPlanBillMasterById(Long id) { + DcBusiPlanBillMaster dcBusiPlanBillMaster = baseMapper.selectDcBusiPlanBillMasterById(id); + if (ObjectUtils.isNotEmpty(dcBusiPlanBillMaster)) { + baseMapper.deleteDcBusiPlanBillSubByBillNo(dcBusiPlanBillMaster.getBillNo()); + } return baseMapper.deleteDcBusiPlanBillMasterById(id); } /** * 新增计划单据明细信息 - * + * * @param dcBusiPlanBillMaster 计划单据主对象 */ - public void insertDcBusiPlanBillSub(DcBusiPlanBillMaster dcBusiPlanBillMaster) - { + public void insertDcBusiPlanBillSub(DcBusiPlanBillMaster dcBusiPlanBillMaster) { List dcBusiPlanBillSubDaoList = dcBusiPlanBillMaster.getDcBusiPlanBillSubList(); - String billNo = dcBusiPlanBillMaster.getBillNo(); - if (StringUtils.isNotNull(dcBusiPlanBillSubDaoList)) - { - List list = new ArrayList(); - for (DcBusiPlanBillSub dcBusiPlanBillSubDao : dcBusiPlanBillSubDaoList) - { - dcBusiPlanBillSubDao.setBillNo(billNo); - list.add(dcBusiPlanBillSubDao); - } - if (list.size() > 0) - { - baseMapper.batchDcBusiPlanBillSub(list); + if (StringUtils.isNotNull(dcBusiPlanBillSubDaoList)) { + for (DcBusiPlanBillSub dcBusiPlanBillSubDao : dcBusiPlanBillSubDaoList) { + dcBusiPlanBillSubDao.setBillNo(dcBusiPlanBillMaster.getBillNo()); + dcBusiPlanBillSubMapper.insertDcBusiPlanBillSub(dcBusiPlanBillSubDao); } } } diff --git a/lzbi-module/src/main/resources/mapper/asset/DcBusiPlanBillMasterMapper.xml b/lzbi-module/src/main/resources/mapper/asset/DcBusiPlanBillMasterMapper.xml index 18467d4..db5c8ee 100644 --- a/lzbi-module/src/main/resources/mapper/asset/DcBusiPlanBillMasterMapper.xml +++ b/lzbi-module/src/main/resources/mapper/asset/DcBusiPlanBillMasterMapper.xml @@ -1,83 +1,145 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - select id, bill_no, bill_income_date, bill_type, check_type, check_status, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time, company_id, company_name, organize_name, oragnize_id from dc_busi_plan_bill_master + select id, + bill_no, + bill_income_date, + bill_type, + check_type, + check_status, + tenant_id, + revision, + created_by, + created_time, + updated_by, + updated_time, + delete_by, + delete_time, + company_id, + company_name, + organize_name, + oragnize_id + from dc_busi_plan_bill_master - - - and bill_no = #{billNo} - and bill_income_date = #{billIncomeDate} - and bill_type = #{billType} - and check_type = #{checkType} - and check_status = #{checkStatus} - and company_id = #{companyId} - and oragnize_id = #{oragnizeId} + + and bill_no = #{billNo} + and bill_income_date = #{billIncomeDate} + and bill_type = #{billType} + and check_type = #{checkType} + and check_status = #{checkStatus} + and company_id = #{companyId} + and oragnize_id = #{oragnizeId} - - + select a.id, + a.bill_no, + a.bill_income_date, + a.bill_type, + a.check_type, + a.check_status, + a.tenant_id, + a.revision, + a.created_by, + a.created_time, + a.updated_by, + a.updated_time, + a.delete_by, + a.delete_time, + a.company_id, + a.company_name, + a.organize_name, + a.oragnize_id from dc_busi_plan_bill_master a - left join dc_busi_plan_bill_sub b on b.bill_no = a.id where a.id = #{id} - - + + + + insert into dc_busi_plan_bill_master bill_no, @@ -97,7 +159,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" company_name, organize_name, oragnize_id, - + #{billNo}, #{billIncomeDate}, @@ -116,7 +178,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{companyName}, #{organizeName}, #{oragnizeId}, - + @@ -143,32 +205,64 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + update dc_busi_plan_bill_master + + bill_income_date = #{billIncomeDate}, + bill_type = #{billType}, + check_type = #{checkType}, + check_status = #{checkStatus}, + tenant_id = #{tenantId}, + revision = #{revision}, + created_by = #{createdBy}, + created_time = #{createdTime}, + updated_by = #{updatedBy}, + updated_time = #{updatedTime}, + delete_by = #{deleteBy}, + delete_time = #{deleteTime}, + company_id = #{companyId}, + company_name = #{companyName}, + organize_name = #{organizeName}, + oragnize_id = #{oragnizeId}, + + where bill_no = #{billNo} + + - delete from dc_busi_plan_bill_master where id = #{id} + delete + from dc_busi_plan_bill_master + where id = #{id} - delete from dc_busi_plan_bill_master where id in + delete from dc_busi_plan_bill_master where id in #{id} - + - delete from dc_busi_plan_bill_sub where bill_no in + delete from dc_busi_plan_bill_sub where bill_no in #{billNo} - - delete from dc_busi_plan_bill_sub where bill_no = #{billNo} + + delete + from dc_busi_plan_bill_sub + where bill_no = #{billNo} - insert into dc_busi_plan_bill_sub( id, bill_no, field_code, field_name, asset_code, asset_name, target_code, taget_name, plan_value, date_year, date_month, date_day, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time) values - - ( #{item.id}, #{item.billNo}, #{item.fieldCode}, #{item.fieldName}, #{item.assetCode}, #{item.assetName}, #{item.targetCode}, #{item.tagetName}, #{item.planValue}, #{item.dateYear}, #{item.dateMonth}, #{item.dateDay}, #{item.tenantId}, #{item.revision}, #{item.createdBy}, #{item.createdTime}, #{item.updatedBy}, #{item.updatedTime}, #{item.deleteBy}, #{item.deleteTime}) + insert into dc_busi_plan_bill_sub( id, bill_no, field_code, field_name, asset_code, asset_name, target_code, + taget_name, plan_value, date_year, date_month, date_day, tenant_id, revision, created_by, created_time, + updated_by, updated_time, delete_by, delete_time) values + + ( #{item.id}, #{item.billNo}, #{item.fieldCode}, #{item.fieldName}, #{item.assetCode}, #{item.assetName}, + #{item.targetCode}, #{item.tagetName}, #{item.planValue}, #{item.dateYear}, #{item.dateMonth}, + #{item.dateDay}, #{item.tenantId}, #{item.revision}, #{item.createdBy}, #{item.createdTime}, + #{item.updatedBy}, #{item.updatedTime}, #{item.deleteBy}, #{item.deleteTime}) \ No newline at end of file diff --git a/lzbi-module/src/main/resources/mapper/asset/DcBusiPlanBillSubMapper.xml b/lzbi-module/src/main/resources/mapper/asset/DcBusiPlanBillSubMapper.xml index 88081b1..65a97f8 100644 --- a/lzbi-module/src/main/resources/mapper/asset/DcBusiPlanBillSubMapper.xml +++ b/lzbi-module/src/main/resources/mapper/asset/DcBusiPlanBillSubMapper.xml @@ -12,23 +12,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - - - - - - - - - select id, bill_no, field_code, field_name, asset_code, asset_name, target_code, taget_name, plan_value, date_year, date_month, date_day, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time from dc_busi_plan_bill_sub + select id, bill_no, field_code, field_name, asset_code, asset_name, target_code, target_name, plan_value, date_year, date_month, date_day, tenant_id, revision, created_by, created_time, updated_by, updated_time, delete_by, delete_time from dc_busi_plan_bill_sub + + + and company_id = #{companyId} + and company_name like concat('%', #{companyName}, '%') + and organize_id = #{organizeId} + and organize_name like concat('%', #{organizeName}, '%') + and asset_code = #{assetCode} + and asset_name like concat('%', #{assetName}, '%') + and target_code = #{targetCode} + and taget_name like concat('%', #{tagetName}, '%') + and target_model_code = #{targetModelCode} + and value_original = #{valueOriginal} + and value_result = #{valueResult} + and value_plan = #{valuePlan} + and date_year = #{dateYear} + and date_month = #{dateMonth} + and date_day = #{dateDay} + and value_temp = #{valueTemp} + and field_code = #{fieldCode} + and field_name like concat('%', #{fieldName}, '%') + and value_adjust = #{valueAdjust} + + + + + + + insert into dc_busi_target_draft_daynew + + tenant_id, + revision, + created_by, + created_time, + updated_by, + updated_time, + delete_by, + delete_time, + company_id, + company_name, + organize_id, + organize_name, + asset_code, + asset_name, + target_code, + taget_name, + target_model_code, + value_original, + value_result, + value_plan, + date_year, + date_month, + date_day, + value_temp, + field_code, + field_name, + value_adjust, + + + #{tenantId}, + #{revision}, + #{createdBy}, + #{createdTime}, + #{updatedBy}, + #{updatedTime}, + #{deleteBy}, + #{deleteTime}, + #{companyId}, + #{companyName}, + #{organizeId}, + #{organizeName}, + #{assetCode}, + #{assetName}, + #{targetCode}, + #{tagetName}, + #{targetModelCode}, + #{valueOriginal}, + #{valueResult}, + #{valuePlan}, + #{dateYear}, + #{dateMonth}, + #{dateDay}, + #{valueTemp}, + #{fieldCode}, + #{fieldName}, + #{valueAdjust}, + + + + + update dc_busi_target_draft_daynew + + tenant_id = #{tenantId}, + revision = #{revision}, + created_by = #{createdBy}, + created_time = #{createdTime}, + updated_by = #{updatedBy}, + updated_time = #{updatedTime}, + delete_by = #{deleteBy}, + delete_time = #{deleteTime}, + company_id = #{companyId}, + company_name = #{companyName}, + organize_id = #{organizeId}, + organize_name = #{organizeName}, + asset_code = #{assetCode}, + asset_name = #{assetName}, + target_code = #{targetCode}, + taget_name = #{tagetName}, + target_model_code = #{targetModelCode}, + value_original = #{valueOriginal}, + value_result = #{valueResult}, + value_plan = #{valuePlan}, + date_year = #{dateYear}, + date_month = #{dateMonth}, + date_day = #{dateDay}, + value_temp = #{valueTemp}, + field_code = #{fieldCode}, + field_name = #{fieldName}, + value_adjust = #{valueAdjust}, + + where id = #{id} + + + + delete from dc_busi_target_draft_daynew where id = #{id} + + + + delete from dc_busi_target_draft_daynew where id in + + #{id} + + + \ No newline at end of file diff --git a/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml b/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml index 8efca09..739d9b7 100644 --- a/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml +++ b/lzbi-module/src/main/resources/mapper/targetFolder/DcBaseAssetTargetMapper.xml @@ -70,6 +70,12 @@ where id = #{id} + + insert into dc_base_asset_target