日计划管理-客户需求

This commit is contained in:
2026-01-21 15:06:57 +08:00
parent 989dd66a20
commit 0b50834d08
4 changed files with 134 additions and 56 deletions

View File

@ -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<UpdateLngPngDemandPurDto> 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<UpdateLngPngApproDto> lngPngApproList;
**/
}

View File

@ -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<UpdateLngPngDemandDto> 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<UpdateLngPngDemandDto> 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<UpdateLngPngDemandDto>() {
@Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
}
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
}
}));
public R submit(@Valid @RequestBody List<Long> ids){
demandService.submit(ids);
return R.ok();
}
@PostMapping("/import")

View File

@ -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<LngPngDemand>, MPJDeepService<LngPngDemand>, MPJRelationService<LngPngDemand> {
PageOutput<LngPngDemandPageVo> queryPage(LngPngDemandPageDto dto);
//PageOutput<LngPngDemandPageVo> queryPage(LngPngDemandPageDto dto);
LngPngDemandVo getInfoById(Long id);
@ -34,6 +35,10 @@ public interface IDemandService extends MPJBaseService<LngPngDemand>, MPJDeepSer
void withdraw(@Valid List<Long> ids);
void deleteByIds(@Valid List<Long> ids);
void submit(@Valid List<Long> ids);
void saveAndSubmit(@Valid UpdateLngPngDemandDto dto);
}

View File

@ -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<LngPngDemandMapper, Ln
private final DatalogService dataService;
@Override
public PageOutput<LngPngDemandPageVo> queryPage(LngPngDemandPageDto dto) {
QueryWrapper<LngPngDemand> 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<LngPngDemandPageVo> page = this.baseMapper.queryPage(ConventPage.getPage(dto), queryWrapper);
PageOutput<LngPngDemandPageVo> pageOutput = ConventPage.getPageOutput(page, LngPngDemandPageVo.class);
return pageOutput;
}
@Override
public LngPngDemandVo getInfoById(Long id) {
@ -306,5 +290,96 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
}
@Override
public void submit(@Valid List<Long> ids) {
List<UpdateLngPngDemandDto> tempList = Lists.newArrayList();
//List<Long> 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<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_submit(?)}",
content.getTableName());
List<JdbcParam> 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<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_submit(?,?)}",
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("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();
}
});
}
}