This commit is contained in:
2026-01-28 14:05:57 +08:00
10 changed files with 230 additions and 201 deletions

View File

@ -0,0 +1,32 @@
package com.pictc.enums;
/**
* @Author: zbz
* @Date: 2023/3/1 15:12
*/
public enum ApproveCodeEnum {
WTJ("WTJ", "未提交"),
SPZ("SPZ", "审批中"),
YSP("YSP", "已审批"),
YBH("YBH", "已驳回");
final String code;
final String value;
public String getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
ApproveCodeEnum(final String code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -1,6 +1,7 @@
package com.xjrsoft.module.contract.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xjrsoft.common.model.base.BaseModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -13,7 +14,7 @@ import java.time.LocalDateTime;
* @Version 1.0
*/
@Data
public class LngContractPageVo {
public class LngContractPageVo extends BaseModel {
/**
* 主键
@ -82,11 +83,11 @@ public class LngContractPageVo {
*/
@ApiModelProperty("备注")
private String note;
/**
* 数据权限id
*/
@ApiModelProperty("数据权限id")
private Long ruleUserId;
// /**
// * 数据权限id
// */
// @ApiModelProperty("数据权限id")
// private Long ruleUserId;
/**
* 交割点名称
*/
@ -97,4 +98,6 @@ public class LngContractPageVo {
*/
@ApiModelProperty("自主托运")
private String transName;
private Long createUserId;
}

View File

@ -74,5 +74,7 @@ public class LngScorePageVo {
*/
@ApiModelProperty("备注")
private String note;
private Long createUserId;
}

View File

@ -16,7 +16,6 @@ import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.contract.dto.LngContractFactPageDto;
import com.xjrsoft.module.contract.dto.UpdateLngContractFactDto;
import com.xjrsoft.module.contract.entity.LngContractFact;
@ -65,8 +64,7 @@ public class ContractFactController {
.like(LngContractFact::getKName, dto.getKName())
)
.eq(StrUtil.isNotBlank(dto.getRelTypeCode()), LngContractFact::getRelTypeCode,dto.getRelTypeCode())
.orderByDesc(LngContractFact::getDateDraft, LngContractFact::getKNo)
.select(LngContractFact.class,x -> VoToColumnUtil.fieldsToColumns(LngContractFactPageVo.class).contains(x.getProperty()));
.orderByDesc(LngContractFact::getDateDraft, LngContractFact::getKNo);
IPage<LngContractFact> page = contractFactService.page(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngContractFactPageVo> pageOutput = ConventPage.getPageOutput(page, LngContractFactPageVo.class);
List<LngContractFactPageVo> list = pageOutput.list;

View File

@ -27,7 +27,7 @@ public interface LngContractMapper extends MPJBaseMapper<LngContract>, BaseMappe
@Select("SELECT k.id, k.rule_user_id, k.k_no, k.k_name, cu.cu_sname AS cp_name, k.date_from," +
" k.date_to, GROUP_CONCAT(DISTINCT p.full_name) AS point_up_name," +
" GROUP_CONCAT(DISTINCT di_trans.name) AS trans_name, com.name as com_name," +
" k.appro_code, dd_a.name as appro_name, k.note" +
" k.appro_code, dd_a.name as appro_name, k.note, k.create_user_id" +
" FROM lng_contract k" +
" JOIN lng_contract_sales_png_point kppp ON kppp.k_id=k.id" +
" LEFT JOIN lng_customer cu on cu.cu_code=k.cp_code" +

View File

@ -23,7 +23,7 @@ import com.xjrsoft.module.contract.vo.LngContractPageVo;
public interface LngContractPurMapper extends MPJBaseMapper<LngContractPur>, BaseMapper<LngContractPur> {
@Select("SELECT k.id, k.rule_user_id, k.k_no, k.k_name, su.su_sname AS cp_name, k.date_from," +
@Select("SELECT k.id, k.rule_user_id, k.k_no, k.k_name,k.create_user_id, su.su_sname AS cp_name, k.date_from," +
" k.date_to, GROUP_CONCAT(DISTINCT p.full_name) AS point_up_name," +
" GROUP_CONCAT(DISTINCT di_trans.name) AS trans_name, com.name as com_name," +
" k.appro_code, dd_a.name as appro_name, k.note" +

View File

@ -20,36 +20,21 @@ import org.springframework.web.multipart.MultipartFile;
import com.alibaba.excel.EasyExcel;
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;
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngDemandDto;
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngDemandPurDto;
import com.xjrsoft.module.dayPlan.entity.LngPngDemand;
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 cn.hutool.core.util.IdUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import shade.powerjob.com.google.common.collect.Lists;
/**
* @title: 日计划-客户需求
@ -65,6 +50,7 @@ public class DemandController {
private final IDemandService demandService;
private final DatalogService dataService;
@GetMapping(value = "/page")
@ -95,80 +81,15 @@ public class DemandController {
@ApiOperation(value = "新增LngPngDemand")
@SaCheckPermission("demand:add")
public R add(@Valid @RequestBody UpdateLngPngDemandDto dto){
if(dto.getId() == null) {
dto.setId(IdUtil.getSnowflakeNextId());
dto.setOrgId(dto.getId());
dto.setLastVerSign("Y");
}
//dto.setTenantId(null);
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
}
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
String sql = StringUtils.format("{? = call pc_{0}.f_save(?,?)}",
content.getTableName());
List<JdbcParam> 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("I"));
}else {
params.add(JdbcParam.ofString("U"));
}
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();
}
}));
return R.ok(demandService.add(dto));
}
@PutMapping
@ApiOperation(value = "编辑LngPngDemand")
@SaCheckPermission("demand:edit")
public R update(@Valid @RequestBody UpdateLngPngDemandDto dto){
LngPngDemand lngPngDemand = demandService.getByIdDeep(dto.getId());
if (lngPngDemand == null) {
return R.error("找不到此数据!");
}
if(!"WTJ".equals(lngPngDemand.getApproCode()) && !"YBH".equals(lngPngDemand.getApproCode())) {
throw new BusinessException(BusinessCode.of(10500,"审批状态变化,不能取消"));
}
dto.setOrgId(dto.getId());
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
}
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
String sql = StringUtils.format("{? = call pc_{0}.f_save(?,?)}",
content.getTableName());
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(content.getIdValue()));
params.add(JdbcParam.ofString("U"));
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();
}
}));
demandService.update(dto);
return R.ok();
}
@PostMapping(value="/saveAndSubmit")
@ -183,77 +104,16 @@ public class DemandController {
@ApiOperation(value = "变更LngPngDemand")
//@SaCheckPermission("demand:toChange")
public R toChange(@Valid @RequestParam Long id){
LngPngDemandVo res = demandService.getInfoById(id);
if (res == null) {
return R.error("找不到此数据!");
}
//LngPngDemandVo res = BeanUtil.toBean(lngPngDemand, LngPngDemandVo.class);
res.setId(null);
res.setVerNo((byte) (res.getVerNo()+(byte)1));
res.setAlterSign("U");
res.setApproCode("WTJ");
res.setLastVerSign("Y");
res.setTimeSubmit(null);
res.setReply(null);
res.setQtySalesGj(null);
res.setQtySalesM3(null);
res.setRateM3Gj(null);
res.setQtyContractGj(null);
res.setQtyContractM3(null);
res.setQtyPlanGj(null);
res.setQtyPlanM3(null);
res.setOrgId(id);
if(res.getLngPngDemandPurList() != null) {
for(LngPngDemandPurVo pdp: res.getLngPngDemandPurList()) {
pdp.setId(null);
pdp.setDemandId(null);
pdp.setQtySalesGj(null);
pdp.setQtySalesM3(null);
pdp.setAddSign("N");
}
}
return R.ok(res);
return R.ok(demandService.toChange(id));
}
@GetMapping(value="/cancel")
@ApiOperation(value = "取消LngPngDemand")
//@SaCheckPermission("demand:cancel")
public R cancel(@Valid @RequestParam Long id){
LngPngDemand lngPngDemand = demandService.getByIdDeep(id);
if (lngPngDemand == null) {
return R.error("找不到此数据!");
}
if(!"YSP".equals(lngPngDemand.getApproCode())) {
throw new BusinessException(BusinessCode.of(10500,"审批状态变化,不能取消"));
}
UpdateLngPngDemandDto temp = BeanUtil.toBean(lngPngDemand, UpdateLngPngDemandDto.class);
temp.setId(null);
temp.setAlterSign("D");
temp.setApproCode("WTJ");
temp.setTimeSubmit(null);
temp.setReply(null);
if(temp.getLngPngDemandPurList() != null) {
for(UpdateLngPngDemandPurDto pdp: temp.getLngPngDemandPurList()) {
pdp.setId(null);
pdp.setDemandId(null);
pdp.setAddSign("N");
}
}
return R.ok(dataService.insert(temp,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
}
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
lngPngDemand.setLastVerSign("N");
demandService.updateById(lngPngDemand);
return null;
}
}));
demandService.cancel(id);
return R.ok();
}

View File

@ -7,13 +7,9 @@ import javax.validation.Valid;
import com.github.yulichang.base.MPJBaseService;
import com.github.yulichang.extension.mapping.base.MPJDeepService;
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.datalog.vo.CompareResultVo;
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;
/**
@ -40,6 +36,14 @@ public interface IDemandService extends MPJBaseService<LngPngDemand>, MPJDeepSer
void submit(@Valid List<Long> ids);
void saveAndSubmit(@Valid UpdateLngPngDemandDto dto);
UpdateLngPngDemandDto add(@Valid UpdateLngPngDemandDto dto);
void update(@Valid UpdateLngPngDemandDto dto);
void cancel(@Valid Long id);
LngPngDemandVo toChange(@Valid Long id);
}

View File

@ -1,11 +1,6 @@
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.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
@ -18,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.yulichang.base.MPJBaseServiceImpl;
import com.pictc.datalog.DataOperationContent;
import com.pictc.datalog.DataOperationListener;
import com.pictc.enums.ApproveCodeEnum;
import com.pictc.enums.BusinessCode;
import com.pictc.enums.ExceptionCommonCode;
import com.pictc.jdbc.JdbcTools;
@ -26,20 +22,18 @@ import com.pictc.utils.DataLogTools;
import com.pictc.utils.ObjectDiffUtils;
import com.pictc.utils.StringUtils;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.datalog.vo.CompareResultVo;
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngApproDto;
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngDemandDto;
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngDemandPurDto;
import com.xjrsoft.module.dayPlan.entity.LngPngAppro;
import com.xjrsoft.module.dayPlan.entity.LngPngDemand;
import com.xjrsoft.module.dayPlan.entity.LngPngDemandPur;
import com.xjrsoft.module.dayPlan.mapper.LngPngApproMapper;
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.LngPngApproPurVo;
import com.xjrsoft.module.dayPlan.vo.LngPngApproVo;
import com.xjrsoft.module.dayPlan.vo.LngPngDemandChangeDetailVo;
import com.xjrsoft.module.dayPlan.vo.LngPngDemandPurVo;
import com.xjrsoft.module.dayPlan.vo.LngPngDemandVo;
@ -59,22 +53,17 @@ import shade.powerjob.com.google.common.collect.Lists;
public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, LngPngDemand> implements IDemandService {
private final LngPngApproMapper approMapper;
private final LngPngDemandPurMapper demandPurMapper;
private final LngPngDemandMapper demandMapper;
private final DatalogService dataService;
@Override
public LngPngDemandVo getInfoById(Long id) {
LngPngDemandVo lngPngDemandVo = this.baseMapper.getInfoBygId(id);
if (lngPngDemandVo == null) {
return null;
}
List<LngPngDemandPurVo> purList = demandMapper.queryLngPngDemandPurList(id);
lngPngDemandVo.setLngPngDemandPurList(purList);
return lngPngDemandVo;
@ -109,8 +98,6 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
}
return vo;
}
@Override
public void withdraw(@Valid List<Long> ids) {
@ -127,7 +114,7 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
throw new BusinessException(BusinessCode.of(10500,"找不到此数据!"));
}
UpdateLngPngDemandDto dto = BeanUtil.toBean(lngPngDemand, UpdateLngPngDemandDto.class);
dto.setApproCode("WTJ");
dto.setApproCode(ApproveCodeEnum.WTJ.getCode());
dtoList.add(dto);
}
LambdaQueryWrapper<LngPngAppro> queryApproWrapper = new LambdaQueryWrapper<>();
@ -144,7 +131,6 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
//DataLogTools.deleteByIds(UpdateLngPngApproDto.class,approIds);
deleteAppro(approIds);
return null;
}
@ -161,7 +147,8 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
throw new BusinessException(BusinessCode.of(10500,"找不到此数据!"));
}
if(!"WTJ".equals(lngPngDemand.getApproCode()) && !"YBH".equals(lngPngDemand.getApproCode()) ) {
if(!ApproveCodeEnum.WTJ.getCode().equals(lngPngDemand.getApproCode()) &&
!ApproveCodeEnum.YBH.getCode().equals(lngPngDemand.getApproCode()) ) {
throw new BusinessException(BusinessCode.of(10500,"审批状态变化,不能删除"));
}
LambdaQueryWrapper<LngPngDemand> queryWrapper = new LambdaQueryWrapper<>();
@ -171,8 +158,6 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
if(last != null) {
lastList.add(last);
}
}
LambdaQueryWrapper<LngPngAppro> queryApproWrapper = new LambdaQueryWrapper<>();
queryApproWrapper.in(LngPngAppro::getDemandId, ids);
@ -196,18 +181,14 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
demandMapper.updateById(last);
}
}
return null;
}
});
}
private void deleteAppro(List<Long> approIds){
DataLogTools.deleteByIds(UpdateLngPngApproDto.class, approIds,new DataOperationListener<UpdateLngPngApproDto>() {
DataLogTools.deleteByIds(UpdateLngPngApproDto.class, approIds,
new DataOperationListener<UpdateLngPngApproDto>() {
@Override
public UpdateLngPngApproDto before(DataOperationContent<UpdateLngPngApproDto> content) {
return null;
@ -215,8 +196,6 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
@Override
public UpdateLngPngApproDto after(DataOperationContent<UpdateLngPngApproDto> content) {
return null;
}
});
@ -231,11 +210,12 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
throw new BusinessException(BusinessCode.of(10500,"找不到此数据!"));
}
if(!"WTJ".equals(lngPngDemand.getApproCode()) && !"YBH".equals(lngPngDemand.getApproCode()) ) {
if(!ApproveCodeEnum.WTJ.getCode().equals(lngPngDemand.getApproCode()) &&
!ApproveCodeEnum.YBH.getCode().equals(lngPngDemand.getApproCode()) ) {
throw new BusinessException(BusinessCode.of(10500,"审批状态变化,不能提交"));
}
lngPngDemand.setApproCode("SPZ");
lngPngDemand.setApproCode(ApproveCodeEnum.SPZ.getCode());
lngPngDemand.setTimeSubmit(LocalDateTime.now());
tempList.add(BeanUtil.copyProperties(lngPngDemand,UpdateLngPngDemandDto.class));
}
@ -268,7 +248,7 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
@Override
public void saveAndSubmit(@Valid UpdateLngPngDemandDto dto) {
dto.setApproCode("SPZ");
dto.setApproCode(ApproveCodeEnum.SPZ.getCode());
dto.setTimeSubmit(LocalDateTime.now());
if(dto.getId() != null) {
if(dto.getOrgId() == null) {
@ -277,10 +257,10 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
LngPngDemand lngPngDemand = this.getById(dto.getId());
if (lngPngDemand == null) {
throw new BusinessException(BusinessCode.of(10500,"找不到此数据!"));
}
if(!"WTJ".equals(lngPngDemand.getApproCode()) && !"YBH".equals(lngPngDemand.getApproCode()) ) {
if(!ApproveCodeEnum.WTJ.getCode().equals(lngPngDemand.getApproCode()) &&
!ApproveCodeEnum.YBH.getCode().equals(lngPngDemand.getApproCode()) ) {
throw new BusinessException(BusinessCode.of(10500,"审批状态变化,不能提交"));
}
dataService.updateById(dto,new DataOperationListener<UpdateLngPngDemandDto>() {
@ -338,5 +318,157 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
}
@Override
public UpdateLngPngDemandDto add(@Valid UpdateLngPngDemandDto dto) {
if(dto.getId() == null) {
dto.setId(IdUtil.getSnowflakeNextId());
dto.setOrgId(dto.getId());
dto.setLastVerSign("Y");
}
dataService.insert(dto,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
}
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
String sql = StringUtils.format("{? = call pc_{0}.f_save(?,?)}",
content.getTableName());
List<JdbcParam> 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("I"));
}else {
params.add(JdbcParam.ofString("U"));
}
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();
}
});
return dto;
}
@Override
public void update(@Valid UpdateLngPngDemandDto dto) {
LngPngDemand lngPngDemand = this.getByIdDeep(dto.getId());
if (lngPngDemand == null) {
throw new BusinessException(BusinessCode.of(10500,"找不到此数据!"));
}
if(!ApproveCodeEnum.WTJ.getCode().equals(lngPngDemand.getApproCode()) && !ApproveCodeEnum.YBH.getCode().equals(lngPngDemand.getApproCode())) {
throw new BusinessException(BusinessCode.of(10500,"审批状态变化,不能取消"));
}
if(dto.getId() != null && dto.getOrgId() == null) {
dto.setOrgId(dto.getId());
}
dataService.updateById(dto,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
}
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
String sql = StringUtils.format("{? = call pc_{0}.f_save(?,?)}",
content.getTableName());
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofLong(content.getIdValue()));
params.add(JdbcParam.ofString("U"));
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 cancel(@Valid Long id) {
LngPngDemand lngPngDemand = this.getByIdDeep(id);
if (lngPngDemand == null) {
throw new BusinessException(BusinessCode.of(10500,"找不到此数据!"));
}
if(!ApproveCodeEnum.YSP.getCode().equals(lngPngDemand.getApproCode())) {
throw new BusinessException(BusinessCode.of(10500,"审批状态变化,不能取消"));
}
UpdateLngPngDemandDto temp = BeanUtil.toBean(lngPngDemand, UpdateLngPngDemandDto.class);
temp.setId(null);
temp.setAlterSign("D");
temp.setApproCode(ApproveCodeEnum.WTJ.getCode());
temp.setTimeSubmit(null);
temp.setReply(null);
if(temp.getLngPngDemandPurList() != null) {
for(UpdateLngPngDemandPurDto pdp: temp.getLngPngDemandPurList()) {
pdp.setId(null);
pdp.setDemandId(null);
pdp.setAddSign("N");
}
}
dataService.updateById(temp,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
}
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
lngPngDemand.setLastVerSign("N");
baseMapper.updateById(lngPngDemand);
return null;
}
});
}
@Override
public LngPngDemandVo toChange(@Valid Long id) {
LngPngDemandVo res = this.getInfoById(id);
if (res == null) {
throw new BusinessException(BusinessCode.of(10500,"找不到此数据!"));
}
res.setId(null);
res.setVerNo((byte) (res.getVerNo()+(byte)1));
res.setAlterSign("U");
res.setApproCode(ApproveCodeEnum.WTJ.getCode());
res.setLastVerSign("Y");
res.setTimeSubmit(null);
res.setReply(null);
res.setQtySalesGj(null);
res.setQtySalesM3(null);
res.setRateM3Gj(null);
res.setQtyContractGj(null);
res.setQtyContractM3(null);
res.setQtyPlanGj(null);
res.setQtyPlanM3(null);
res.setOrgId(id);
if(res.getLngPngDemandPurList() != null) {
for(LngPngDemandPurVo pdp: res.getLngPngDemandPurList()) {
pdp.setId(null);
pdp.setDemandId(null);
pdp.setQtySalesGj(null);
pdp.setQtySalesM3(null);
pdp.setAddSign("N");
}
}
return res;
}
}

View File

@ -17,7 +17,6 @@ import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.datalog.service.DatalogService;
import com.xjrsoft.module.datalog.vo.DataChangeLogVo;
import com.xjrsoft.module.sales.dto.LngApproPageDto;
@ -69,8 +68,7 @@ public class ApproController {
)
.eq(StrUtil.isNotBlank(dto.getTypeCode()),LngAppro::getTypeCode,dto.getTypeCode())
.eq(StrUtil.isNotBlank(dto.getApproCode()),LngAppro::getApproCode,dto.getApproCode())
.orderByDesc(LngAppro::getId)
.select(LngAppro.class,x -> VoToColumnUtil.fieldsToColumns(LngApproPageVo.class).contains(x.getProperty()));
.orderByDesc(LngAppro::getId);
IPage<LngAppro> page = approService.page(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngApproPageVo> pageOutput = ConventPage.getPageOutput(page, LngApproPageVo.class);
List<LngApproPageVo> list = pageOutput.list;