日计划管理-客户需求-优化
This commit is contained in:
@ -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();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user