日计划管理-客户需求

This commit is contained in:
2026-01-23 16:13:27 +08:00
parent 5ec3cedadf
commit 1875bc455a
10 changed files with 105 additions and 56 deletions

View File

@ -41,4 +41,6 @@ public interface DatalogService {
public <T>boolean disable(Class<T> class1, @Valid List<Long> ids,DataOperationListener<T> listener); public <T>boolean disable(Class<T> class1, @Valid List<Long> ids,DataOperationListener<T> listener);
public <T>List<T> updateBatch(List<T> entitys, DataOperationListener<T> listener);
} }

View File

@ -49,6 +49,16 @@ public class DatalogServiceImpl implements DatalogService{
return res; return res;
} }
@Transactional(rollbackFor = Exception.class)
@Override
public <T> List<T> updateBatch(List<T> entitys, DataOperationListener<T> listener) {
List<T> res = Lists.newArrayList();
for (T entity : entitys) {
res.add(DataLogTools.update(entity,listener));
}
return res;
}
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public <T> boolean updateById(T entity) { public <T> boolean updateById(T entity) {

View File

@ -1,22 +1,13 @@
package com.xjrsoft.module.dayPlan.dto; package com.xjrsoft.module.dayPlan.dto;
import java.io.Serializable;
import java.math.BigDecimal;
import com.pictc.annotations.datalog.LogField;
import com.pictc.annotations.datalog.LogTable;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.io.Serializable;
import java.time.LocalTime;
import java.time.LocalDateTime;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.List;
import com.pictc.annotations.datalog.LogTable;
import com.pictc.annotations.datalog.LogField;
import com.pictc.annotations.datalog.LogJoin;
import com.pictc.annotations.datalog.LogJoinColumn;
import com.pictc.annotations.datalog.JoinCaseType;
import com.pictc.annotations.datalog.JoinType;
import com.pictc.annotations.datalog.ValueDirectionType;

View File

@ -1,20 +1,14 @@
package com.xjrsoft.module.dayPlan.vo; package com.xjrsoft.module.dayPlan.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.time.LocalTime;
import java.time.LocalDateTime;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.time.LocalDateTime;
import com.xjrsoft.common.annotation.Trans; import com.xjrsoft.common.annotation.Trans;
import com.xjrsoft.common.enums.TransType; import com.xjrsoft.common.enums.TransType;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/** /**
* @title: 表单出参 * @title: 表单出参
* @Author test01 * @Author test01
@ -42,7 +36,7 @@ public class LngPngDemandPurVo extends com.xjrsoft.common.model.base.BaseModel{
* 供应商 * 供应商
*/ */
@ApiModelProperty("供应商") @ApiModelProperty("供应商")
@Trans(type = TransType.SUPPLIER, transToFieldName = "suName") //@Trans(type = TransType.SUPPLIER, transToFieldName = "suName")
private String suCode; private String suCode;
private String suName; private String suName;
@ -64,7 +58,7 @@ public class LngPngDemandPurVo extends com.xjrsoft.common.model.base.BaseModel{
* 上载点 * 上载点
*/ */
@ApiModelProperty("上载点") @ApiModelProperty("上载点")
@Trans(type = TransType.LNG_STATION, transToFieldName = "pointUpName") //@Trans(type = TransType.LNG_STATION, transToFieldName = "pointUpName")
private String pointUpCode; private String pointUpCode;
private String pointUpName; private String pointUpName;

View File

@ -65,7 +65,7 @@ public class LngPngDemandVo extends com.xjrsoft.common.model.base.BaseModel{
* 客户编码 * 客户编码
*/ */
@ApiModelProperty("客户编码") @ApiModelProperty("客户编码")
@Trans(type = TransType.CUSTOMER, transToFieldName = "cuName") // @Trans(type = TransType.CUSTOMER, transToFieldName = "cuName")
private String cuCode; private String cuCode;
private String cuName; private String cuName;
@ -73,7 +73,7 @@ public class LngPngDemandVo extends com.xjrsoft.common.model.base.BaseModel{
* 交易主体编码(天然气公司/惠贸;只读从合同带) * 交易主体编码(天然气公司/惠贸;只读从合同带)
*/ */
@ApiModelProperty("交易主体编码(天然气公司/惠贸;只读从合同带)") @ApiModelProperty("交易主体编码(天然气公司/惠贸;只读从合同带)")
@Trans(type = TransType.DEPT, transToFieldName = "comName") // @Trans(type = TransType.DEPT, transToFieldName = "comName")
private Long comId; private Long comId;
private String comName; private String comName;
@ -97,7 +97,7 @@ public class LngPngDemandVo extends com.xjrsoft.common.model.base.BaseModel{
* 交割点编码 * 交割点编码
*/ */
@ApiModelProperty("交割点编码") @ApiModelProperty("交割点编码")
@Trans(type = TransType.LNG_STATION, transToFieldName = "pointDelyName") //@Trans(type = TransType.LNG_STATION, transToFieldName = "pointDelyName")
private String pointDelyCode; private String pointDelyCode;
private String pointDelyName; private String pointDelyName;
@ -218,7 +218,7 @@ public class LngPngDemandVo extends com.xjrsoft.common.model.base.BaseModel{
* 审批状态(待提交/审批中/已审批/已驳回) * 审批状态(待提交/审批中/已审批/已驳回)
*/ */
@ApiModelProperty("审批状态(待提交/审批中/已审批/已驳回)") @ApiModelProperty("审批状态(待提交/审批中/已审批/已驳回)")
@Trans(type = TransType.DIC, id = "1990669393069129729", transToFieldName = "approName") //@Trans(type = TransType.DIC, id = "1990669393069129729", transToFieldName = "approName")
private String approCode; private String approCode;
private String approName; private String approName;

View File

@ -95,8 +95,12 @@ public class DemandController {
@ApiOperation(value = "新增LngPngDemand") @ApiOperation(value = "新增LngPngDemand")
@SaCheckPermission("demand:add") @SaCheckPermission("demand:add")
public R add(@Valid @RequestBody UpdateLngPngDemandDto dto){ public R add(@Valid @RequestBody UpdateLngPngDemandDto dto){
if(dto.getId() == null) {
dto.setId(IdUtil.getSnowflakeNextId()); dto.setId(IdUtil.getSnowflakeNextId());
dto.setOrgId(dto.getId()); dto.setOrgId(dto.getId());
dto.setLastVerSign("Y");
}
//dto.setTenantId(null);
return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngPngDemandDto>() { return R.ok(dataService.insert(dto,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override @Override
@ -112,7 +116,12 @@ public class DemandController {
JdbcParam outParam = JdbcParam.ofString(null).setOut(true); JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam); params.add(outParam);
params.add(JdbcParam.ofLong(content.getIdValue())); params.add(JdbcParam.ofLong(content.getIdValue()));
if(dto.getId() == null) {
params.add(JdbcParam.ofString("I")); params.add(JdbcParam.ofString("I"));
}else {
params.add(JdbcParam.ofString("U"));
}
JdbcTools.call(sql,params); JdbcTools.call(sql,params);
String error = outParam.getStringValue(); String error = outParam.getStringValue();
if (StringUtils.isNotEmpty(error)) { if (StringUtils.isNotEmpty(error)) {
@ -128,7 +137,13 @@ public class DemandController {
@ApiOperation(value = "编辑LngPngDemand") @ApiOperation(value = "编辑LngPngDemand")
@SaCheckPermission("demand:edit") @SaCheckPermission("demand:edit")
public R update(@Valid @RequestBody UpdateLngPngDemandDto dto){ 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()); dto.setOrgId(dto.getId());
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngPngDemandDto>() { return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngPngDemandDto>() {
@ -174,6 +189,7 @@ public class DemandController {
} }
//LngPngDemandVo res = BeanUtil.toBean(lngPngDemand, LngPngDemandVo.class); //LngPngDemandVo res = BeanUtil.toBean(lngPngDemand, LngPngDemandVo.class);
res.setId(null); res.setId(null);
res.setVerNo((byte) (res.getVerNo()+(byte)1));
res.setAlterSign("U"); res.setAlterSign("U");
res.setApproCode("WTJ"); res.setApproCode("WTJ");
res.setLastVerSign("Y"); res.setLastVerSign("Y");
@ -224,7 +240,7 @@ public class DemandController {
pdp.setAddSign("N"); pdp.setAddSign("N");
} }
} }
return R.ok(dataService.updateById(temp,new DataOperationListener<UpdateLngPngDemandDto>() { return R.ok(dataService.insert(temp,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override @Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) { public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {

View File

@ -300,8 +300,8 @@ public class LngPngDemand implements Serializable {
* 版本号(初始为1变更时+1) * 版本号(初始为1变更时+1)
*/ */
@ApiModelProperty("版本号(初始为1变更时+1)") @ApiModelProperty("版本号(初始为1变更时+1)")
@TableField(updateStrategy = FieldStrategy.IGNORED,fill = FieldFill.INSERT) //@TableField(updateStrategy = FieldStrategy.IGNORED,fill = FieldFill.INSERT_UPDATE)
@Version // 指定实际字段名 //@Version // 指定实际字段名
private Byte verNo; private Byte verNo;
/** /**

View File

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

View File

@ -13,8 +13,8 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.github.yulichang.base.MPJBaseMapper; import com.github.yulichang.base.MPJBaseMapper;
import com.xjrsoft.module.dayPlan.dto.LngPngDemandPageDto; import com.xjrsoft.module.dayPlan.dto.LngPngDemandPageDto;
import com.xjrsoft.module.dayPlan.entity.LngPngDemand; import com.xjrsoft.module.dayPlan.entity.LngPngDemand;
import com.xjrsoft.module.dayPlan.vo.LngPngApproVo;
import com.xjrsoft.module.dayPlan.vo.LngPngDemandPageVo; import com.xjrsoft.module.dayPlan.vo.LngPngDemandPageVo;
import com.xjrsoft.module.dayPlan.vo.LngPngDemandPurVo;
import com.xjrsoft.module.dayPlan.vo.LngPngDemandVo; import com.xjrsoft.module.dayPlan.vo.LngPngDemandVo;
/** /**
@ -49,9 +49,24 @@ public interface LngPngDemandMapper extends MPJBaseMapper<LngPngDemand>,BaseMapp
Long getApprovedCount(@Param("id") Long id); Long getApprovedCount(@Param("id") Long id);
@Select("SELECT d.*,k.k_name"+ @Select("SELECT d.*,k.k_name,"+
" cu.cu_name, cu.cu_sname, sp.full_name AS point_dely_name," +
" k.k_name, com.name AS com_name, dd_a.name as appro_name" +
" FROM lng_png_demand d" + " FROM lng_png_demand d" +
" LEFT JOIN lng_contract k ON k.id=d.ks_id" + " LEFT JOIN lng_contract k ON k.id=d.ks_id" +
" LEFT JOIN lng_customer cu ON cu.cu_code=d.cu_code" +
" LEFT JOIN xjr_dictionary_item di_a on di_a.code='LNG_APPRO1'" +
" LEFT JOIN xjr_dictionary_detail dd_a on dd_a.item_id=di_a.id AND dd_a.code=d.appro_code" +
" LEFT JOIN lng_b_station_png sp ON sp.code=d.point_dely_code" +
" LEFT JOIN xjr_department com ON com.id=d.com_id" +
" WHERE d.id = #{id}") " WHERE d.id = #{id}")
LngPngDemandVo getInfoBygId(@Param("id") Long id); LngPngDemandVo getInfoBygId(@Param("id") Long id);
@Select("SELECT a.*, su.su_name, sp.full_name AS point_up_name" +
" FROM lng_png_demand_pur a" +
" LEFT JOIN lng_supplier su ON su.su_code=a.su_code" +
" LEFT JOIN lng_b_station_png sp ON sp.code=a.point_up_code" +
" WHERE a.demand_id = #{id}" +
" ORDER BY a.sort")
List<LngPngDemandPurVo> queryLngPngDemandPurList(@Param("id")Long id);
} }

View File

@ -4,6 +4,7 @@ import java.lang.reflect.Field;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -73,11 +74,9 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
if (lngPngDemandVo == null) { if (lngPngDemandVo == null) {
return null; return null;
} }
LambdaQueryWrapper<LngPngDemandPur> queryPurWrapper = new LambdaQueryWrapper<>();
queryPurWrapper.eq(LngPngDemandPur::getDemandId,id); List<LngPngDemandPurVo> purList = demandMapper.queryLngPngDemandPurList(id);
queryPurWrapper.orderByAsc(LngPngDemandPur::getSort); lngPngDemandVo.setLngPngDemandPurList(purList);
List<LngPngDemandPur> purList = demandPurMapper.selectList(queryPurWrapper);
lngPngDemandVo.setLngPngDemandPurList(BeanUtil.copyToList(purList, LngPngDemandPurVo.class));
return lngPngDemandVo; return lngPngDemandVo;
} }
@ -145,7 +144,8 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
@Override @Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) { public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
DataLogTools.deleteByIds(UpdateLngPngApproDto.class,approIds); //DataLogTools.deleteByIds(UpdateLngPngApproDto.class,approIds);
deleteAppro(approIds);
return null; return null;
} }
}); });
@ -168,7 +168,10 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
queryWrapper.eq(LngPngDemand::getOrgId, lngPngDemand.getOrgId()); queryWrapper.eq(LngPngDemand::getOrgId, lngPngDemand.getOrgId());
queryWrapper.eq(LngPngDemand::getVerNo, lngPngDemand.getVerNo()-1); queryWrapper.eq(LngPngDemand::getVerNo, lngPngDemand.getVerNo()-1);
LngPngDemand last = this.baseMapper.selectOne(queryWrapper); LngPngDemand last = this.baseMapper.selectOne(queryWrapper);
if(last != null) {
lastList.add(last); lastList.add(last);
}
} }
LambdaQueryWrapper<LngPngAppro> queryApproWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<LngPngAppro> queryApproWrapper = new LambdaQueryWrapper<>();
@ -185,13 +188,15 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
@Override @Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) { public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
//lngPngDemand.setLastVerSign("N");
//demandService.updateById(lngPngDemand); deleteAppro(approIds);
DataLogTools.deleteByIds(UpdateLngPngApproDto.class,approIds); if(CollectionUtils.isNotEmpty(lastList)) {
for(LngPngDemand last:lastList) { for(LngPngDemand last:lastList) {
last.setLastVerSign("Y"); last.setLastVerSign("Y");
demandMapper.updateById(last); demandMapper.updateById(last);
} }
}
return null; return null;
} }
@ -200,10 +205,26 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
} }
private void deleteAppro(List<Long> approIds){
DataLogTools.deleteByIds(UpdateLngPngApproDto.class, approIds,new DataOperationListener<UpdateLngPngApproDto>() {
@Override
public UpdateLngPngApproDto before(DataOperationContent<UpdateLngPngApproDto> content) {
return null;
}
@Override
public UpdateLngPngApproDto after(DataOperationContent<UpdateLngPngApproDto> content) {
return null;
}
});
}
@Override @Override
public void submit(@Valid List<Long> ids) { public void submit(@Valid List<Long> ids) {
List<UpdateLngPngDemandDto> tempList = Lists.newArrayList(); List<UpdateLngPngDemandDto> tempList = Lists.newArrayList();
//List<Long> ids = dtoList.stream().map(UpdateLngPngDemandDto::getId).collect(Collectors.toList());
for(Long id:ids) { for(Long id:ids) {
LngPngDemand lngPngDemand = this.getByIdDeep(id); LngPngDemand lngPngDemand = this.getByIdDeep(id);
if (lngPngDemand == null) { if (lngPngDemand == null) {
@ -218,7 +239,7 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
lngPngDemand.setTimeSubmit(LocalDateTime.now()); lngPngDemand.setTimeSubmit(LocalDateTime.now());
tempList.add(BeanUtil.copyProperties(lngPngDemand,UpdateLngPngDemandDto.class)); tempList.add(BeanUtil.copyProperties(lngPngDemand,UpdateLngPngDemandDto.class));
} }
dataService.insertBatch(tempList,new DataOperationListener<UpdateLngPngDemandDto>() { dataService.updateBatch(tempList,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override @Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) { public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {