日计划管理-客户需求
This commit is contained in:
@ -1,22 +1,13 @@
|
||||
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 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;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -1,20 +1,14 @@
|
||||
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.util.List;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.xjrsoft.common.annotation.Trans;
|
||||
import com.xjrsoft.common.enums.TransType;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @title: 表单出参
|
||||
* @Author test01
|
||||
@ -42,7 +36,7 @@ public class LngPngDemandPurVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
* 供应商
|
||||
*/
|
||||
@ApiModelProperty("供应商")
|
||||
@Trans(type = TransType.SUPPLIER, transToFieldName = "suName")
|
||||
//@Trans(type = TransType.SUPPLIER, transToFieldName = "suName")
|
||||
private String suCode;
|
||||
private String suName;
|
||||
|
||||
@ -64,7 +58,7 @@ public class LngPngDemandPurVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
* 上载点
|
||||
*/
|
||||
@ApiModelProperty("上载点")
|
||||
@Trans(type = TransType.LNG_STATION, transToFieldName = "pointUpName")
|
||||
//@Trans(type = TransType.LNG_STATION, transToFieldName = "pointUpName")
|
||||
private String pointUpCode;
|
||||
private String pointUpName;
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ public class LngPngDemandVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
* 客户编码
|
||||
*/
|
||||
@ApiModelProperty("客户编码")
|
||||
@Trans(type = TransType.CUSTOMER, transToFieldName = "cuName")
|
||||
// @Trans(type = TransType.CUSTOMER, transToFieldName = "cuName")
|
||||
private String cuCode;
|
||||
private String cuName;
|
||||
|
||||
@ -73,7 +73,7 @@ public class LngPngDemandVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
* 交易主体编码(天然气公司/惠贸;只读从合同带)
|
||||
*/
|
||||
@ApiModelProperty("交易主体编码(天然气公司/惠贸;只读从合同带)")
|
||||
@Trans(type = TransType.DEPT, transToFieldName = "comName")
|
||||
// @Trans(type = TransType.DEPT, transToFieldName = "comName")
|
||||
private Long comId;
|
||||
private String comName;
|
||||
|
||||
@ -97,7 +97,7 @@ public class LngPngDemandVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
* 交割点编码
|
||||
*/
|
||||
@ApiModelProperty("交割点编码")
|
||||
@Trans(type = TransType.LNG_STATION, transToFieldName = "pointDelyName")
|
||||
//@Trans(type = TransType.LNG_STATION, transToFieldName = "pointDelyName")
|
||||
private String pointDelyCode;
|
||||
private String pointDelyName;
|
||||
|
||||
@ -218,7 +218,7 @@ public class LngPngDemandVo extends com.xjrsoft.common.model.base.BaseModel{
|
||||
* 审批状态(待提交/审批中/已审批/已驳回)
|
||||
*/
|
||||
@ApiModelProperty("审批状态(待提交/审批中/已审批/已驳回)")
|
||||
@Trans(type = TransType.DIC, id = "1990669393069129729", transToFieldName = "approName")
|
||||
//@Trans(type = TransType.DIC, id = "1990669393069129729", transToFieldName = "approName")
|
||||
private String approCode;
|
||||
private String approName;
|
||||
|
||||
|
||||
@ -95,8 +95,12 @@ public class DemandController {
|
||||
@ApiOperation(value = "新增LngPngDemand")
|
||||
@SaCheckPermission("demand:add")
|
||||
public R add(@Valid @RequestBody UpdateLngPngDemandDto dto){
|
||||
dto.setId(IdUtil.getSnowflakeNextId());
|
||||
dto.setOrgId(dto.getId());
|
||||
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
|
||||
@ -112,7 +116,12 @@ public class DemandController {
|
||||
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
|
||||
params.add(outParam);
|
||||
params.add(JdbcParam.ofLong(content.getIdValue()));
|
||||
params.add(JdbcParam.ofString("I"));
|
||||
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)) {
|
||||
@ -128,7 +137,13 @@ public class DemandController {
|
||||
@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>() {
|
||||
|
||||
@ -174,6 +189,7 @@ public class DemandController {
|
||||
}
|
||||
//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");
|
||||
@ -224,7 +240,7 @@ public class DemandController {
|
||||
pdp.setAddSign("N");
|
||||
}
|
||||
}
|
||||
return R.ok(dataService.updateById(temp,new DataOperationListener<UpdateLngPngDemandDto>() {
|
||||
return R.ok(dataService.insert(temp,new DataOperationListener<UpdateLngPngDemandDto>() {
|
||||
|
||||
@Override
|
||||
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
|
||||
|
||||
@ -300,8 +300,8 @@ public class LngPngDemand implements Serializable {
|
||||
* 版本号(初始为1,变更时+1)
|
||||
*/
|
||||
@ApiModelProperty("版本号(初始为1,变更时+1)")
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED,fill = FieldFill.INSERT)
|
||||
@Version // 指定实际字段名
|
||||
//@TableField(updateStrategy = FieldStrategy.IGNORED,fill = FieldFill.INSERT_UPDATE)
|
||||
//@Version // 指定实际字段名
|
||||
private Byte verNo;
|
||||
|
||||
/**
|
||||
|
||||
@ -164,7 +164,7 @@ public class LngPngDemandPur implements Serializable {
|
||||
* 租户id
|
||||
*/
|
||||
@ApiModelProperty("租户id")
|
||||
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
//@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||
private Long tenantId;
|
||||
|
||||
/**
|
||||
|
||||
@ -13,8 +13,8 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.xjrsoft.module.dayPlan.dto.LngPngDemandPageDto;
|
||||
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.LngPngDemandPurVo;
|
||||
import com.xjrsoft.module.dayPlan.vo.LngPngDemandVo;
|
||||
|
||||
/**
|
||||
@ -49,9 +49,24 @@ public interface LngPngDemandMapper extends MPJBaseMapper<LngPngDemand>,BaseMapp
|
||||
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" +
|
||||
" 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}")
|
||||
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);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ 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;
|
||||
@ -73,11 +74,9 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
|
||||
if (lngPngDemandVo == null) {
|
||||
return null;
|
||||
}
|
||||
LambdaQueryWrapper<LngPngDemandPur> queryPurWrapper = new LambdaQueryWrapper<>();
|
||||
queryPurWrapper.eq(LngPngDemandPur::getDemandId,id);
|
||||
queryPurWrapper.orderByAsc(LngPngDemandPur::getSort);
|
||||
List<LngPngDemandPur> purList = demandPurMapper.selectList(queryPurWrapper);
|
||||
lngPngDemandVo.setLngPngDemandPurList(BeanUtil.copyToList(purList, LngPngDemandPurVo.class));
|
||||
|
||||
List<LngPngDemandPurVo> purList = demandMapper.queryLngPngDemandPurList(id);
|
||||
lngPngDemandVo.setLngPngDemandPurList(purList);
|
||||
return lngPngDemandVo;
|
||||
}
|
||||
|
||||
@ -145,7 +144,8 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
|
||||
|
||||
@Override
|
||||
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
|
||||
DataLogTools.deleteByIds(UpdateLngPngApproDto.class,approIds);
|
||||
//DataLogTools.deleteByIds(UpdateLngPngApproDto.class,approIds);
|
||||
deleteAppro(approIds);
|
||||
return null;
|
||||
}
|
||||
});
|
||||
@ -168,7 +168,10 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
|
||||
queryWrapper.eq(LngPngDemand::getOrgId, lngPngDemand.getOrgId());
|
||||
queryWrapper.eq(LngPngDemand::getVerNo, lngPngDemand.getVerNo()-1);
|
||||
LngPngDemand last = this.baseMapper.selectOne(queryWrapper);
|
||||
lastList.add(last);
|
||||
if(last != null) {
|
||||
lastList.add(last);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
LambdaQueryWrapper<LngPngAppro> queryApproWrapper = new LambdaQueryWrapper<>();
|
||||
@ -185,25 +188,43 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
|
||||
|
||||
@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);
|
||||
|
||||
deleteAppro(approIds);
|
||||
if(CollectionUtils.isNotEmpty(lastList)) {
|
||||
for(LngPngDemand last:lastList) {
|
||||
last.setLastVerSign("Y");
|
||||
demandMapper.updateById(last);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
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) {
|
||||
@ -218,7 +239,7 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
|
||||
lngPngDemand.setTimeSubmit(LocalDateTime.now());
|
||||
tempList.add(BeanUtil.copyProperties(lngPngDemand,UpdateLngPngDemandDto.class));
|
||||
}
|
||||
dataService.insertBatch(tempList,new DataOperationListener<UpdateLngPngDemandDto>() {
|
||||
dataService.updateBatch(tempList,new DataOperationListener<UpdateLngPngDemandDto>() {
|
||||
|
||||
@Override
|
||||
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
|
||||
|
||||
Reference in New Issue
Block a user