From 0b50834d08f62c64e267c04136d141f64a2f7251 Mon Sep 17 00:00:00 2001 From: "shunyi.kuang" <846002312@qq.com> Date: Wed, 21 Jan 2026 15:06:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E8=AE=A1=E5=88=92=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dayPlan/dto/UpdateLngPngDemandDto.java | 15 +-- .../dayPlan/controller/DemandController.java | 49 ++++---- .../dayPlan/service/IDemandService.java | 7 +- .../service/impl/DemandServiceImpl.java | 119 ++++++++++++++---- 4 files changed, 134 insertions(+), 56 deletions(-) diff --git a/itc-pcitc-mdm/itc-pcitc-mdm-api/src/main/java/com/xjrsoft/module/dayPlan/dto/UpdateLngPngDemandDto.java b/itc-pcitc-mdm/itc-pcitc-mdm-api/src/main/java/com/xjrsoft/module/dayPlan/dto/UpdateLngPngDemandDto.java index afdc97e..c774f45 100644 --- a/itc-pcitc-mdm/itc-pcitc-mdm-api/src/main/java/com/xjrsoft/module/dayPlan/dto/UpdateLngPngDemandDto.java +++ b/itc-pcitc-mdm/itc-pcitc-mdm-api/src/main/java/com/xjrsoft/module/dayPlan/dto/UpdateLngPngDemandDto.java @@ -5,6 +5,7 @@ import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; +import com.fasterxml.jackson.annotation.JsonFormat; import com.pictc.annotations.datalog.JoinCaseType; import com.pictc.annotations.datalog.JoinType; import com.pictc.annotations.datalog.LogField; @@ -70,6 +71,7 @@ public class UpdateLngPngDemandDto implements Serializable { */ @LogField(name="计划日期",index=5) @ApiModelProperty("计划日期(次日计划为次日;当日计划为当日;同日、同客户、同销售合同交割点、同上载点、同供应商不能重复(仅检查最新版并去掉变更标识为删除的))") + @JsonFormat(pattern = "yyyy-MM-dd") private LocalDateTime datePlan; /** @@ -266,16 +268,5 @@ public class UpdateLngPngDemandDto implements Serializable { caseType = JoinCaseType.FULL, target = UpdateLngPngDemandPurDto.class, type = JoinType.MANY) private List lngPngDemandPurList; - /** - * lngPngApproPur - */ - /** - @ApiModelProperty("lngPngAppro子表") - @LogJoin(name = "lngPngAppro子表", - columns = { - @LogJoinColumn(field = "demandId",relatedField = "id", valueDirection = ValueDirectionType.RIGHT) - }, - caseType = JoinCaseType.FULL, target = UpdateLngPngApproPurDto.class, type = JoinType.MANY) - private List lngPngApproList; - **/ + } diff --git a/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/controller/DemandController.java b/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/controller/DemandController.java index 1069d0a..5ff8be7 100644 --- a/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/controller/DemandController.java +++ b/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/controller/DemandController.java @@ -23,11 +23,15 @@ import com.alibaba.excel.support.ExcelTypeEnum; import com.pictc.datalog.DataOperationContent; import com.pictc.datalog.DataOperationListener; import com.pictc.enums.BusinessCode; +import com.pictc.enums.ExceptionCommonCode; +import com.pictc.jdbc.JdbcTools; +import com.pictc.jdbc.model.JdbcParam; import com.pictc.utils.DataLogTools; import com.xjrsoft.common.exception.BusinessException; import com.xjrsoft.common.model.result.R; import com.xjrsoft.common.page.PageOutput; import com.xjrsoft.common.utils.ExcelUtil; +import com.xjrsoft.module.common.db.utils.CommonCallUtils; import com.xjrsoft.module.datalog.service.DatalogService; import com.xjrsoft.module.datalog.vo.DataChangeLogVo; import com.xjrsoft.module.dayPlan.dto.LngPngDemandPageDto; @@ -38,7 +42,7 @@ import com.xjrsoft.module.dayPlan.service.IDemandService; import com.xjrsoft.module.dayPlan.vo.LngPngDemandPageVo; import com.xjrsoft.module.dayPlan.vo.LngPngDemandPurVo; import com.xjrsoft.module.dayPlan.vo.LngPngDemandVo; - +import com.pictc.utils.StringUtils; import cn.dev33.satoken.annotation.SaCheckPermission; import cn.hutool.core.bean.BeanUtil; import io.swagger.annotations.Api; @@ -66,8 +70,8 @@ public class DemandController { @ApiOperation(value="LngPngDemand列表(分页)") @SaCheckPermission("demand:list") public R page(@Valid LngPngDemandPageDto dto){ - - return R.ok(demandService.queryPage(dto)); + return null; + //return R.ok(demandService.queryPage(dto)); } @GetMapping(value = "/info") @@ -99,8 +103,11 @@ public class DemandController { @Override public UpdateLngPngDemandDto after(DataOperationContent content) { - - return null; + String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue()); + if (StringUtils.isNotEmpty(msg)) { + throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg)); + } + return content.getObj(); } })); @@ -119,12 +126,23 @@ public class DemandController { @Override public UpdateLngPngDemandDto after(DataOperationContent content) { - - return null; + String msg = CommonCallUtils.saveAfter(content.getTableName(),content.getIdValue()); + if (StringUtils.isNotEmpty(msg)) { + throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_EXEC_ERROR, msg)); + } + return content.getObj(); } })); } + @PostMapping(value="/saveAndSubmit") + @ApiOperation(value = "保存并提交LngPngDemand") + //@SaCheckPermission("demand:edit") + public R saveAndSubmit(@Valid @RequestBody UpdateLngPngDemandDto dto){ + demandService.saveAndSubmit(dto); + return R.ok(); + } + @PostMapping(value="/toChange") @ApiOperation(value = "变更LngPngDemand") //@SaCheckPermission("demand:toChange") @@ -230,20 +248,9 @@ public class DemandController { @PostMapping(value="/submit") @ApiOperation(value = "提交LngPngDemand") //@SaCheckPermission("demand:edit") - public R submit(@Valid @RequestBody UpdateLngPngDemandDto dto){ - return R.ok(dataService.updateById(dto,new DataOperationListener() { - - @Override - public UpdateLngPngDemandDto before(DataOperationContent content) { - return null; - } - - @Override - public UpdateLngPngDemandDto after(DataOperationContent content) { - - return null; - } - })); + public R submit(@Valid @RequestBody List ids){ + demandService.submit(ids); + return R.ok(); } @PostMapping("/import") diff --git a/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/service/IDemandService.java b/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/service/IDemandService.java index 0816faa..cb794a0 100644 --- a/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/service/IDemandService.java +++ b/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/service/IDemandService.java @@ -10,6 +10,7 @@ import com.github.yulichang.extension.mapping.base.MPJRelationService; import com.xjrsoft.common.model.result.R; import com.xjrsoft.common.page.PageOutput; import com.xjrsoft.module.dayPlan.dto.LngPngDemandPageDto; +import com.xjrsoft.module.dayPlan.dto.UpdateLngPngDemandDto; import com.xjrsoft.module.dayPlan.entity.LngPngDemand; import com.xjrsoft.module.dayPlan.vo.LngPngDemandPageVo; import com.xjrsoft.module.dayPlan.vo.LngPngDemandVo; @@ -23,7 +24,7 @@ import com.xjrsoft.module.dayPlan.vo.LngPngDemandVo; public interface IDemandService extends MPJBaseService, MPJDeepService, MPJRelationService { - PageOutput queryPage(LngPngDemandPageDto dto); + //PageOutput queryPage(LngPngDemandPageDto dto); LngPngDemandVo getInfoById(Long id); @@ -34,6 +35,10 @@ public interface IDemandService extends MPJBaseService, MPJDeepSer void withdraw(@Valid List ids); void deleteByIds(@Valid List ids); + + void submit(@Valid List ids); + + void saveAndSubmit(@Valid UpdateLngPngDemandDto dto); } diff --git a/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/service/impl/DemandServiceImpl.java b/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/service/impl/DemandServiceImpl.java index aaa4dfa..193ca00 100644 --- a/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/service/impl/DemandServiceImpl.java +++ b/itc-pcitc-mdm/itc-pcitc-mdm-service/src/main/java/com/xjrsoft/module/dayPlan/service/impl/DemandServiceImpl.java @@ -2,6 +2,7 @@ package com.xjrsoft.module.dayPlan.service.impl; import java.lang.reflect.Field; import java.math.BigDecimal; +import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Comparator; import java.util.List; @@ -9,22 +10,20 @@ import java.util.stream.Collectors; import javax.validation.Valid; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.github.yulichang.base.MPJBaseServiceImpl; import com.pictc.datalog.DataOperationContent; import com.pictc.datalog.DataOperationListener; import com.pictc.enums.BusinessCode; +import com.pictc.enums.ExceptionCommonCode; +import com.pictc.jdbc.JdbcTools; +import com.pictc.jdbc.model.JdbcParam; import com.pictc.utils.DataLogTools; +import com.pictc.utils.StringUtils; import com.xjrsoft.common.exception.BusinessException; -import com.xjrsoft.common.page.ConventPage; -import com.xjrsoft.common.page.PageOutput; import com.xjrsoft.module.datalog.service.DatalogService; -import com.xjrsoft.module.dayPlan.dto.LngPngDemandPageDto; import com.xjrsoft.module.dayPlan.dto.UpdateLngPngApproDto; import com.xjrsoft.module.dayPlan.dto.UpdateLngPngDemandDto; import com.xjrsoft.module.dayPlan.entity.LngPngAppro; @@ -35,7 +34,6 @@ import com.xjrsoft.module.dayPlan.mapper.LngPngDemandMapper; import com.xjrsoft.module.dayPlan.mapper.LngPngDemandPurMapper; import com.xjrsoft.module.dayPlan.service.IDemandService; import com.xjrsoft.module.dayPlan.vo.LngPngDemandChangeDetailVo; -import com.xjrsoft.module.dayPlan.vo.LngPngDemandPageVo; import com.xjrsoft.module.dayPlan.vo.LngPngDemandVo; import cn.hutool.core.bean.BeanUtil; @@ -60,21 +58,7 @@ public class DemandServiceImpl extends MPJBaseServiceImpl queryPage(LngPngDemandPageDto dto) { - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper - .and(StringUtils.isNotBlank(dto.getKName()), r -> - r.like("k.k_no", dto.getKName()) - .or() - .like("k.k_name", dto.getKName()) - ) - .like(StringUtils.isNotBlank(dto.getPointDelyName()), "sp.full_name", dto.getPointDelyName()) - .eq("d.last_ver_sign", "Y"); - IPage page = this.baseMapper.queryPage(ConventPage.getPage(dto), queryWrapper); - PageOutput pageOutput = ConventPage.getPageOutput(page, LngPngDemandPageVo.class); - return pageOutput; - } + @Override public LngPngDemandVo getInfoById(Long id) { @@ -306,5 +290,96 @@ public class DemandServiceImpl extends MPJBaseServiceImpl ids) { + List tempList = Lists.newArrayList(); + //List ids = dtoList.stream().map(UpdateLngPngDemandDto::getId).collect(Collectors.toList()); + for(Long id:ids) { + LngPngDemand lngPngDemand = this.getByIdDeep(id); + if (lngPngDemand == null) { + throw new BusinessException(BusinessCode.of(10500,"找不到此数据!")); + + } + if(!"WTJ".equals(lngPngDemand.getApproCode()) || !"YBH".equals(lngPngDemand.getApproCode()) ) { + throw new BusinessException(BusinessCode.of(10500,"审批状态变化,不能提交")); + } + + lngPngDemand.setApproCode("SPZ"); + lngPngDemand.setTimeSubmit(LocalDateTime.now()); + tempList.add(BeanUtil.copyProperties(lngPngDemand,UpdateLngPngDemandDto.class)); + } + dataService.insertBatch(tempList,new DataOperationListener() { + + @Override + public UpdateLngPngDemandDto before(DataOperationContent content) { + return null; + } + + @Override + public UpdateLngPngDemandDto after(DataOperationContent content) { + String sql = StringUtils.format("{? = call pc_{0}.f_submit(?)}", + content.getTableName()); + List params = Lists.newArrayList(); + JdbcParam outParam = JdbcParam.ofString(null).setOut(true); + params.add(outParam); + params.add(JdbcParam.ofLong(content.getIdValue())); + JdbcTools.call(sql,params); + String error = outParam.getStringValue(); + if (StringUtils.isNotEmpty(error)) { + throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error)); + } + return content.getObj(); + } + }); + + } + + @Override + public void saveAndSubmit(@Valid UpdateLngPngDemandDto dto) { + dto.setApproCode("SPZ"); + dto.setTimeSubmit(LocalDateTime.now()); + if(dto.getId() != null) { + LngPngDemand lngPngDemand = this.getById(dto.getId()); + if (lngPngDemand == null) { + throw new BusinessException(BusinessCode.of(10500,"找不到此数据!")); + + } + if(!"WTJ".equals(lngPngDemand.getApproCode()) || !"YBH".equals(lngPngDemand.getApproCode()) ) { + throw new BusinessException(BusinessCode.of(10500,"审批状态变化,不能提交")); + } + + + } + dataService.insert(dto,new DataOperationListener() { + + @Override + public UpdateLngPngDemandDto before(DataOperationContent content) { + return null; + } + + @Override + public UpdateLngPngDemandDto after(DataOperationContent content) { + String sql = StringUtils.format("{? = call pc_{0}.f_save_submit(?,?)}", + content.getTableName()); + + List params = Lists.newArrayList(); + JdbcParam outParam = JdbcParam.ofString(null).setOut(true); + params.add(outParam); + params.add(JdbcParam.ofLong(content.getIdValue())); + if(dto.getId() != null) { + params.add(JdbcParam.ofString("U")); + }else { + params.add(JdbcParam.ofString("I")); + } + JdbcTools.call(sql,params); + String error = outParam.getStringValue(); + if (StringUtils.isNotEmpty(error)) { + throw new BusinessException(BusinessCode.ofArgs(ExceptionCommonCode.DB_FUNCTION_DELETE_EXEC_ERROR, error)); + } + return content.getObj(); + } + }); + } + }