This commit is contained in:
2026-01-23 09:54:43 +08:00
11 changed files with 353 additions and 78 deletions

View File

@ -0,0 +1,28 @@
package com.xjrsoft.module.datalog.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class CompareResultVo<T> {
/**
* 最新版本
*/
@ApiModelProperty("最新版本")
private T newBean;
/**
* 旧版本
*/
@ApiModelProperty("旧版本")
private T oldBean;
/**
* 比对结果
*/
@ApiModelProperty("比对结果")
private List<String> diffResultList;
}

View File

@ -0,0 +1,116 @@
package com.pictc.utils;
import org.apache.commons.collections4.CollectionUtils;
import java.lang.reflect.Field;
import java.util.*;
/**
* 对象差异比较工具类
* 支持嵌套对象和List集合的比较
*/
public class ObjectDiffUtils {
/**
* 比较两个对象并返回差异信息
* @param obj1 第一个对象
* @param obj2 第二个对象
* @param <T> 对象类型
* @return 差异结果列表
*/
public static <T> List<String> compare(T obj1, T obj2) {
List<String> diffs = new ArrayList<>();
if (obj1 == null || obj2 == null) {
return diffs;
}
try {
compareFields(obj1, obj2, diffs);
} catch (Exception e) {
throw new RuntimeException("Failed to compare objects", e);
}
return diffs;
}
/**
* 递归比较对象字段
*/
private static void compareFields(Object obj1, Object obj2, List<String> diffs)
throws IllegalAccessException {
Class<?> clazz = obj1.getClass();
// 获取所有字段(包括私有字段)
Field[] fields = getAllFields(clazz);
for (Field field : fields) {
field.setAccessible(true);
Object value1 = field.get(obj1);
Object value2 = field.get(obj2);
String fieldName = field.getName();
// 检查字段类型
Class<?> fieldType = field.getType();
// 如果是List类型
if (List.class.isAssignableFrom(fieldType)) {
compareLists(value1, value2, fieldName, diffs);
}
// 如果是Map类型可选扩展
else if (Map.class.isAssignableFrom(fieldType)) {
compareMaps(value1, value2, fieldName, diffs);
}
// 基本类型、String、包装类型等
else {
compareBasicValues(value1, value2, fieldName, diffs);
}
}
}
/**
* 比较两个List
*/
private static void compareLists(Object list1, Object list2, String fieldName, List<String> diffs) {
List<?> l1 = (List<?>) list1;
List<?> l2 = (List<?>) list2;
if (l1 == null || l2 == null) {
return;
}
// 比较List大小
if (l1.size() != l2.size()) {
diffs.add(fieldName);
return;
}
// 比较List中的每个元素
for (int i = 0; i < l1.size(); i++) {
List<String> result = compare(l1.get(i), l2.get(i));
if (CollectionUtils.isNotEmpty(result)) {
for (String s : result) {
diffs.add(fieldName + "["+ i +"]." + s);
}
}
}
}
/**
* 比较两个Map可选功能
*/
private static void compareMaps(Object map1, Object map2, String path, List<String> diffs) {
// Map比较的实现可根据需要扩展
}
/**
* 比较基本值
*/
private static void compareBasicValues(Object value1, Object value2, String fieldName, List<String> diffs) {
if (!Objects.equals(value1, value2)) {
diffs.add(fieldName);
}
}
/**
* 获取类及其父类的所有字段
*/
private static Field[] getAllFields(Class<?> clazz) {
List<Field> fields = new ArrayList<>();
while (clazz != null && clazz != Object.class) {
fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
clazz = clazz.getSuperclass();
}
return fields.toArray(new Field[0]);
}
}

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

@ -83,6 +83,8 @@ public class LngPngDemandVo extends com.xjrsoft.common.model.base.BaseModel{
@ApiModelProperty("合同-主信息主键(销售)(lng_contract)")
private Long ksId;
private String kName;
/**
* 合同-国内销售-管道气-交割点主键(lng_contract_sales_png_point)
@ -95,7 +97,9 @@ public class LngPngDemandVo extends com.xjrsoft.common.model.base.BaseModel{
* 交割点编码
*/
@ApiModelProperty("交割点编码")
@Trans(type = TransType.LNG_STATION, transToFieldName = "pointDelyName")
private String pointDelyCode;
private String pointDelyName;
/**
@ -214,8 +218,9 @@ public class LngPngDemandVo extends com.xjrsoft.common.model.base.BaseModel{
* 审批状态(待提交/审批中/已审批/已驳回)
*/
@ApiModelProperty("审批状态(待提交/审批中/已审批/已驳回)")
@Trans(type = TransType.DIC, id = "1990669393069129729", transToFieldName = "approName")
private String approCode;
private String approName;
/**
* 提交时间

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,19 @@ public class DemandController {
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
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("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();
}
}));
@ -110,8 +125,10 @@ public class DemandController {
@ApiOperation(value = "编辑LngPngDemand")
@SaCheckPermission("demand:edit")
public R update(@Valid @RequestBody UpdateLngPngDemandDto dto){
dto.setOrgId(dto.getId());
return R.ok(dataService.updateById(dto,new DataOperationListener<UpdateLngPngDemandDto>() {
@Override
public UpdateLngPngDemandDto before(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
@ -119,12 +136,31 @@ public class DemandController {
@Override
public UpdateLngPngDemandDto after(DataOperationContent<UpdateLngPngDemandDto> content) {
return null;
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();
}
}));
}
@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 +266,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

@ -1,5 +1,7 @@
package com.xjrsoft.module.dayPlan.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -11,7 +13,9 @@ 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.LngPngDemandVo;
/**
* @title: mapper
@ -43,4 +47,11 @@ public interface LngPngDemandMapper extends MPJBaseMapper<LngPngDemand>,BaseMapp
" JOIN lng_png_approval a ON a.appro_id=pa.id " +
" WHERE d.id = #{id}")
Long getApprovedCount(@Param("id") Long id);
@Select("SELECT d.*,k.k_name"+
" FROM lng_png_demand d" +
" LEFT JOIN lng_contract k ON k.id=d.ks_id" +
" WHERE d.id = #{id}")
LngPngDemandVo getInfoBygId(@Param("id") Long id);
}

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

@ -5,6 +5,7 @@ import com.github.yulichang.extension.mapping.base.MPJDeepService;
import com.github.yulichang.extension.mapping.base.MPJRelationService;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.module.approve.ApproveDto;
import com.xjrsoft.module.datalog.vo.CompareResultVo;
import com.xjrsoft.module.dayPlan.dto.LngPngApproPageDto;
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngApproDto;
import com.xjrsoft.module.dayPlan.entity.LngPngAppro;
@ -12,7 +13,6 @@ import com.xjrsoft.module.dayPlan.vo.LngPngApproPageVo;
import com.xjrsoft.module.dayPlan.vo.LngPngApproVo;
import javax.validation.Valid;
import java.util.List;
/**
* @title: service
@ -33,5 +33,5 @@ public interface IPngApproService extends MPJBaseService<LngPngAppro>, MPJDeepSe
void approveJSZ(@Valid ApproveDto<UpdateLngPngApproDto> dto);
List<LngPngApproVo> compare(Long orgId);
CompareResultVo<LngPngApproVo> compare(Long orgId);
}

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,7 @@ 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.LngPngDemandPurVo;
import com.xjrsoft.module.dayPlan.vo.LngPngDemandVo;
import cn.hutool.core.bean.BeanUtil;
@ -60,29 +59,20 @@ 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) {
LngPngDemand lngPngDemand = this.getByIdDeep(id);
if (lngPngDemand == null) {
LngPngDemandVo lngPngDemandVo = this.baseMapper.getInfoBygId(id);
if (lngPngDemandVo == null) {
return null;
}
return BeanUtil.toBean(lngPngDemand, LngPngDemandVo.class);
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));
return lngPngDemandVo;
}
@Override
@ -267,7 +257,7 @@ public class DemandServiceImpl extends MPJBaseServiceImpl<LngPngDemandMapper, Ln
throw new BusinessException(BusinessCode.of(10500,"找不到此数据!"));
}
if(!"WTJ".equals(lngPngDemand.getApproCode()) || !"YBH".equals(lngPngDemand.getApproCode()) ) {
if(!"WTJ".equals(lngPngDemand.getApproCode()) && !"YBH".equals(lngPngDemand.getApproCode()) ) {
throw new BusinessException(BusinessCode.of(10500,"审批状态变化,不能删除"));
}
LambdaQueryWrapper<LngPngDemand> queryWrapper = new LambdaQueryWrapper<>();
@ -306,5 +296,98 @@ 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();
}
});
}
}

View File

@ -12,11 +12,13 @@ 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.ObjectDiffUtils;
import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.exception.BusinessException;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import com.xjrsoft.module.approve.ApproveDto;
import com.xjrsoft.module.datalog.vo.CompareResultVo;
import com.xjrsoft.module.dayPlan.dto.LngPngApproPageDto;
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngApproDto;
import com.xjrsoft.module.dayPlan.dto.UpdateLngPngApproPurDto;
@ -36,6 +38,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
/**
@ -81,7 +84,7 @@ public class PngApproServiceImpl extends MPJBaseServiceImpl<LngPngApproMapper, L
}
@Override
public List<LngPngApproVo> compare(Long orgId) {
public CompareResultVo<LngPngApproVo> compare(Long orgId) {
List<LngPngApproVo> voList = this.baseMapper.getListByOrgId(orgId);
if(CollectionUtils.isEmpty(voList)) {
throw new BusinessException(BusinessCode.of(10500,"找不到此数据"));
@ -90,7 +93,16 @@ public class PngApproServiceImpl extends MPJBaseServiceImpl<LngPngApproMapper, L
List<LngPngApproPurVo> lngPngApproPurList = this.baseMapper.queryLngPngApproPurList(vo.getId());
vo.setLngPngApproPurList(lngPngApproPurList);
}
return voList;
CompareResultVo<LngPngApproVo> vo = new CompareResultVo<>();
LngPngApproVo newBean = voList.get(0);
vo.setNewBean(newBean);
if (voList.size() > 1) {
LngPngApproVo oldBean = voList.get(1);
List<String> diffResultList = ObjectDiffUtils.compare(newBean, oldBean);
vo.setOldBean(oldBean);
vo.setDiffResultList(diffResultList);
}
return vo;
}
@Override
@ -170,15 +182,15 @@ public class PngApproServiceImpl extends MPJBaseServiceImpl<LngPngApproMapper, L
SaSession tokenSession = StpUtil.getTokenSession();
UserDto user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new UserDto());
for (UpdateLngPngApproDto lngPngApproDto : data) {
LngPngAppro lngPngAppro = this.baseMapper.selectById(lngPngApproDto.getId());
if(lngPngAppro == null) {
throw new BusinessException(BusinessCode.of(10500,"找不到此数据"));
LocalDateTime datePlan = lngPngApproDto.getDatePlan();
if(datePlan == null) {
throw new BusinessException(BusinessCode.of(10500,"没有计划日期"));
}
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofString(user.getStaCode()));
params.add(JdbcParam.ofLocalDateTime(lngPngAppro.getDatePlan()));
params.add(JdbcParam.ofLocalDateTime(datePlan));
params.add(JdbcParam.ofString(dto.getResult()));
params.add(JdbcParam.ofString(dto.getRemark()));
params.add(JdbcParam.ofLong(user.getId()));
@ -202,15 +214,15 @@ public class PngApproServiceImpl extends MPJBaseServiceImpl<LngPngApproMapper, L
SaSession tokenSession = StpUtil.getTokenSession();
UserDto user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new UserDto());
for (UpdateLngPngApproDto lngPngApproDto : data) {
LngPngAppro lngPngAppro = this.baseMapper.selectById(lngPngApproDto.getId());
if(lngPngAppro == null) {
throw new BusinessException(BusinessCode.of(10500,"找不到此数据"));
LocalDateTime datePlan = lngPngApproDto.getDatePlan();
if(datePlan == null) {
throw new BusinessException(BusinessCode.of(10500,"没有计划日期"));
}
List<JdbcParam> params = Lists.newArrayList();
JdbcParam outParam = JdbcParam.ofString(null).setOut(true);
params.add(outParam);
params.add(JdbcParam.ofString(user.getStaCode()));
params.add(JdbcParam.ofLocalDateTime(lngPngAppro.getDatePlan()));
params.add(JdbcParam.ofLocalDateTime(datePlan));
params.add(JdbcParam.ofString(dto.getResult()));
params.add(JdbcParam.ofString(dto.getRemark()));
params.add(JdbcParam.ofLong(user.getId()));

View File

@ -1,9 +1,6 @@
package com.xjrsoft.module.sales.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import com.github.yulichang.annotation.EntityMapping;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -52,11 +49,13 @@ public class LngCustomerGroup implements Serializable {
* 起始日期
*/
@ApiModelProperty("起始日期")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDateTime dateFrom;
/**
* 结束日期
*/
@ApiModelProperty("结束日期")
@TableField(updateStrategy = FieldStrategy.IGNORED)
private LocalDateTime dateTo;
/**
* 备注