日计划管理-客户需求

This commit is contained in:
2026-01-20 17:53:31 +08:00
parent 2127cd0f47
commit 58df623462
12 changed files with 195 additions and 14 deletions

View File

@ -265,4 +265,17 @@ 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

@ -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.LogAttrField;
import com.pictc.annotations.datalog.LogField;
import com.pictc.annotations.datalog.LogTable;
@ -54,6 +55,7 @@ public class UpdateLngPngMeasureSalesPurDto implements Serializable {
*/
@LogField(name="计划日期",index=3)
@ApiModelProperty("计划日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime datePlan;
/**
@ -61,6 +63,7 @@ public class UpdateLngPngMeasureSalesPurDto implements Serializable {
*/
@LogField(name="计量日期",index=4)
@ApiModelProperty("计量日期(缺省=计划日期+1)")
@JsonFormat(pattern = "yyyy-MM-dd")
private LocalDateTime dateMea;
/**

View File

@ -111,4 +111,10 @@ public class LngPngDemandPageVo {
@ApiModelProperty("备注")
private String note;
/**
* 创建人id
*/
@ApiModelProperty("创建人id")
private Long createUserId;
}

View File

@ -75,4 +75,10 @@ public class LngScorePageVo {
@ApiModelProperty("备注")
private String note;
/**
* 创建人id
*/
@ApiModelProperty("创建人id")
private Long createUserId;
}

View File

@ -76,4 +76,10 @@ public class LngSupplierPageVo {
@ApiModelProperty("状态(未提交/审批中/已审批/已驳回)")
private String approName;
/**
* 创建人id
*/
@ApiModelProperty("创建人id")
private Long createUserId;
}

View File

@ -22,6 +22,9 @@ 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.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;
@ -41,6 +44,7 @@ import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import shade.powerjob.com.google.common.collect.Lists;
/**
* @title: 日计划-客户需求
@ -164,6 +168,9 @@ public class DemandController {
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");
@ -178,7 +185,7 @@ public class DemandController {
pdp.setAddSign("N");
}
}
return R.ok(dataService.insert(temp,new DataOperationListener<UpdateLngPngDemandDto>() {
return R.ok(dataService.updateById(temp,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
@ -203,12 +210,40 @@ public class DemandController {
return R.ok(demandService.compare(id));
}
@PostMapping(value="/withdraw")
@ApiOperation(value = "撤回LngPngDemand")
//@SaCheckPermission("demand:cancel")
public R withdraw(@Valid @RequestParam List<Long> ids){
demandService.withdraw(ids);
return R.ok();
}
@DeleteMapping
@ApiOperation(value = "删除")
@SaCheckPermission("demand:delete")
public R delete(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.deleteByIds(UpdateLngPngDemandDto.class, ids));
demandService.deleteByIds(ids);
return R.ok();
}
@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;
}
}));
}
@PostMapping("/import")

View File

@ -204,7 +204,7 @@ public class PngMeasureSalesPurController {
@DeleteMapping
@ApiOperation(value = "删除")
@SaCheckPermission("pngMeasureSalesPur:delete")
//@SaCheckPermission("pngMeasureSalesPur:delete")
public R delete(@Valid @RequestBody List<Long> ids){
return R.ok(dataService.deleteByIds(UpdateLngPngMeasureSalesPurDto.class, ids));

View File

@ -113,9 +113,6 @@ public class LngPngDemand implements Serializable {
* 电厂开机方式-连运机组数(电厂用户填报开机方式)
*/
@ApiModelProperty("电厂开机方式-连运机组数(电厂用户填报开机方式)")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Short powerCont;
@ -222,9 +219,6 @@ public class LngPngDemand implements Serializable {
* 销售金额(自动计算,扣减预付款用)
*/
@ApiModelProperty("销售金额(自动计算,扣减预付款用)")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private BigDecimal amountSales;
@ -285,7 +279,7 @@ public class LngPngDemand implements Serializable {
* 租户id
*/
@ApiModelProperty("租户id")
@TableField(updateStrategy = FieldStrategy.IGNORED)
//@TableField(updateStrategy = FieldStrategy.IGNORED)
private Long tenantId;
/**

View File

@ -230,7 +230,7 @@ public class LngPngMeasureSalesPur implements Serializable {
* 租户id
*/
@ApiModelProperty("租户id")
@TableField(updateStrategy = FieldStrategy.IGNORED)
//@TableField(updateStrategy = FieldStrategy.IGNORED)
private Long tenantId;
/**

View File

@ -37,4 +37,10 @@ public interface LngPngDemandMapper extends MPJBaseMapper<LngPngDemand>,BaseMapp
" ORDER BY d.date_plan DESC, (CASE d.appro_code WHEN 'WTJ' THEN 1 WHEN 'YBH' THEN 2 WHEN 'SPZ' THEN 3 WHEN 'YSP' THEN 4 ELSE 5 END) " )
IPage<LngPngDemandPageVo> queryPage(IPage<LngPngDemandPageDto> page,@Param(Constants.WRAPPER) QueryWrapper<LngPngDemand> queryWrapper);
@Select(" SELECT count(a.id) "+
" FROM lng_png_demand d "+
" JOIN lng_png_appro pa ON pa.demand_id=d.id "+
" JOIN lng_png_approval a ON a.appro_id=pa.id " +
" WHERE d.id = #{id}")
Long getApprovedCount(@Param("id") Long id);
}

View File

@ -29,5 +29,11 @@ public interface IDemandService extends MPJBaseService<LngPngDemand>, MPJDeepSer
List<LngPngDemandVo> compare(@Valid Long id);
Long selectApprovedCount(Long id);
void withdraw(@Valid List<Long> ids);
void deleteByIds(@Valid List<Long> ids);
}

View File

@ -16,11 +16,21 @@ 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.utils.DataLogTools;
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;
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;
@ -42,9 +52,13 @@ import shade.powerjob.com.google.common.collect.Lists;
@AllArgsConstructor
public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, LngPngDemand> implements IDemandService {
private final LngPngDemandMapper demandLngPngDemandMapper;
private final LngPngApproMapper approMapper;
private final LngPngDemandPurMapper demandLngPngDemandPurMapper;
private final LngPngDemandPurMapper demandPurMapper;
private final LngPngDemandMapper demandMapper;
private final DatalogService dataService;
@Override
public PageOutput<LngPngDemandPageVo> queryPage(LngPngDemandPageDto dto) {
@ -71,6 +85,11 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
return BeanUtil.toBean(lngPngDemand, LngPngDemandVo.class);
}
@Override
public Long selectApprovedCount(Long id) {
return this.baseMapper.getApprovedCount(id);
}
@Override
public List<LngPngDemandVo> compare(@Valid Long id) {
List<LngPngDemandVo> list = Lists.newArrayList();
@ -94,7 +113,7 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
LambdaQueryWrapper<LngPngDemandPur> queryPurWrapper = new LambdaQueryWrapper<>();
queryPurWrapper.eq(LngPngDemandPur::getDemandId,last.getId());
queryPurWrapper.orderByAsc(LngPngDemandPur::getSort);
List<LngPngDemandPur> lastPurList = demandLngPngDemandPurMapper.selectList(queryPurWrapper);
List<LngPngDemandPur> lastPurList = demandPurMapper.selectList(queryPurWrapper);
//增加了item
if(currentPurList.size() >= lastPurList.size()) {
for(int i=0;i<lastPurList.size();i++) {
@ -200,5 +219,92 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
return changeDetail;
}
@Override
public void withdraw(@Valid List<Long> ids) {
for(Long id:ids) {
Long approvedCount = this.selectApprovedCount(id);
if(approvedCount >= 1) {
throw new BusinessException(BusinessCode.of(10500,"已进入审批环节,不可撤回"));
}
}
List<UpdateLngPngDemandDto> dtoList = Lists.newArrayList();
for(Long id:ids) {
LngPngDemand lngPngDemand = this.getById(id);
if (lngPngDemand == null) {
throw new BusinessException(BusinessCode.of(10500,"找不到此数据!"));
}
UpdateLngPngDemandDto dto = BeanUtil.toBean(lngPngDemand, UpdateLngPngDemandDto.class);
dto.setApproCode("WTJ");
dtoList.add(dto);
}
LambdaQueryWrapper<LngPngAppro> queryApproWrapper = new LambdaQueryWrapper<>();
queryApproWrapper.in(LngPngAppro::getDemandId, ids);
List<LngPngAppro> approList = approMapper.selectList(queryApproWrapper);
List<Long> approIds = approList.stream().map(LngPngAppro::getId).collect(Collectors.toList());
dataService.insertBatch(dtoList,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
}
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
DataLogTools.deleteByIds(UpdateLngPngApproDto.class,approIds);
return null;
}
});
}
@Override
public void deleteByIds(@Valid List<Long> ids) {
List<LngPngDemand> lastList = Lists.newArrayList();
for(Long id:ids) {
LngPngDemand lngPngDemand = this.getById(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,"审批状态变化,不能删除"));
}
LambdaQueryWrapper<LngPngDemand> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(LngPngDemand::getOrgId, lngPngDemand.getOrgId());
queryWrapper.eq(LngPngDemand::getVerNo, lngPngDemand.getVerNo()-1);
LngPngDemand last = this.baseMapper.selectOne(queryWrapper);
lastList.add(last);
}
LambdaQueryWrapper<LngPngAppro> queryApproWrapper = new LambdaQueryWrapper<>();
queryApproWrapper.in(LngPngAppro::getDemandId, ids);
List<LngPngAppro> approList = approMapper.selectList(queryApproWrapper);
List<Long> approIds = approList.stream().map(LngPngAppro::getId).collect(Collectors.toList());
dataService.deleteByIds(UpdateLngPngDemandDto.class, ids,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);
DataLogTools.deleteByIds(UpdateLngPngApproDto.class,approIds);
for(LngPngDemand last:lastList) {
last.setLastVerSign("Y");
demandMapper.updateById(last);
}
return null;
}
});
}
}