提交 2abc943c authored 作者: 000516's avatar 000516

档期执行修改档期开始/结束日期,bug修复

上级 46950851
...@@ -16,7 +16,7 @@ public class ApPromotionCoreController { ...@@ -16,7 +16,7 @@ public class ApPromotionCoreController {
@Autowired @Autowired
private IApPromotionCoreService apPromotionCoreService; private IApPromotionCoreService apPromotionCoreService;
@PutMapping("/{id}") @PutMapping("/{id}")
public void putDetail(@PathVariable("id") Long sapId, @RequestBody SalesApRequest request){ public void putDetail(@PathVariable("id") Long sapId, @RequestBody SalesApRequest request) {
request.setSapId(sapId); request.setSapId(sapId);
apPromotionCoreService.updateDetail(request); apPromotionCoreService.updateDetail(request);
} }
......
...@@ -40,7 +40,7 @@ public class SalesApPromotionImplDao implements ISalesApPromotionDao { ...@@ -40,7 +40,7 @@ public class SalesApPromotionImplDao implements ISalesApPromotionDao {
public void updateById(SalesApPromotionDto dto) { public void updateById(SalesApPromotionDto dto) {
SalesApPromotion salesApPromotion = new SalesApPromotion(); SalesApPromotion salesApPromotion = new SalesApPromotion();
BeanUtils.copyProperties(dto, salesApPromotion); BeanUtils.copyProperties(dto, salesApPromotion);
salesApPromotionMapper.updateById(salesApPromotion); salesApPromotionMapper.putById(salesApPromotion);
} }
private LambdaQueryWrapper<SalesApPromotion> buildWq(SalesApWq salesApWq) { private LambdaQueryWrapper<SalesApPromotion> buildWq(SalesApWq salesApWq) {
......
...@@ -186,6 +186,8 @@ public class SalesApPromotion implements Serializable { ...@@ -186,6 +186,8 @@ public class SalesApPromotion implements Serializable {
* 实际-档期开始时间 * 实际-档期开始时间
*/ */
private Date actualPromotionStartDate; private Date actualPromotionStartDate;
@TableField(exist = false)
private Boolean isActualPromotionStartDate;
/** /**
* 计划-档期结束时间 * 计划-档期结束时间
...@@ -196,6 +198,8 @@ public class SalesApPromotion implements Serializable { ...@@ -196,6 +198,8 @@ public class SalesApPromotion implements Serializable {
* 实际-档期结束时间 * 实际-档期结束时间
*/ */
private Date actualPromotionEndDate; private Date actualPromotionEndDate;
@TableField(exist = false)
private Boolean isActualPromotionEndDate;
/** /**
* 档期是否开展 * 档期是否开展
......
...@@ -13,6 +13,7 @@ import org.springframework.stereotype.Repository; ...@@ -13,6 +13,7 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public interface SalesApPromotionMapper extends BaseMapper<SalesApPromotion> { public interface SalesApPromotionMapper extends BaseMapper<SalesApPromotion> {
void putById(SalesApPromotion salesApPromotion);
} }
......
package com.sfa.operation.pojo.sales.request; package com.sfa.operation.pojo.sales.request;
import cn.hutool.core.date.DatePattern;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.Value;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Date; import java.util.Date;
/** /**
...@@ -105,10 +109,25 @@ public class SalesApRequest { ...@@ -105,10 +109,25 @@ public class SalesApRequest {
* 实际-档期开始时间 * 实际-档期开始时间
*/ */
private Date actualPromotionStartDate; private Date actualPromotionStartDate;
/** {
* 计划-档期结束时间 try {
*/ actualPromotionStartDate = DatePattern.NORM_DATE_FORMAT.parse("2000-01-01");
private Date plannedPromotionEndDate; } catch (ParseException e) {
throw new RuntimeException(e);
}
}
/**
* 实际-档期结束时间
*/
private Date actualPromotionEndDate;
{
try {
actualPromotionEndDate = DatePattern.NORM_DATE_FORMAT.parse("2000-01-01");
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
/** /**
* 档期是否开展 * 档期是否开展
*/ */
......
...@@ -29,10 +29,14 @@ public class SalesApPromotionDto { ...@@ -29,10 +29,14 @@ public class SalesApPromotionDto {
* 实际-档期开始时间 * 实际-档期开始时间
*/ */
private Date actualPromotionStartDate; private Date actualPromotionStartDate;
// true则修改数据库为null
private Boolean isActualPromotionStartDate;
/** /**
* 计划-档期结束时间 * 实际-档期结束时间
*/ */
private Date plannedPromotionEndDate; private Date actualPromotionEndDate;
// true则修改数据库为null
private Boolean isActualPromotionEndDate;
/** /**
* 档期是否开展 * 档期是否开展
*/ */
......
package com.sfa.operation.service.sales.impl; package com.sfa.operation.service.sales.impl;
import cn.hutool.core.date.DatePattern;
import com.sfa.operation.domain.sales.dao.ISalesApPromotionDao; import com.sfa.operation.domain.sales.dao.ISalesApPromotionDao;
import com.sfa.operation.pojo.sales.request.SalesApRequest; import com.sfa.operation.pojo.sales.request.SalesApRequest;
import com.sfa.operation.pojo.sales.response.SalesApPromotionDto; import com.sfa.operation.pojo.sales.response.SalesApPromotionDto;
...@@ -8,6 +9,10 @@ import org.springframework.beans.BeanUtils; ...@@ -8,6 +9,10 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.Date;
import java.util.Objects;
/** /**
* @author : liqiulin * @author : liqiulin
* @date : 2025-09-17 15 * @date : 2025-09-17 15
...@@ -17,11 +22,36 @@ import org.springframework.stereotype.Service; ...@@ -17,11 +22,36 @@ import org.springframework.stereotype.Service;
public class ApPromotionCoreServiceImpl implements IApPromotionCoreService { public class ApPromotionCoreServiceImpl implements IApPromotionCoreService {
@Autowired @Autowired
private ISalesApPromotionDao salesApPromotionDao; private ISalesApPromotionDao salesApPromotionDao;
@Override @Override
public void updateDetail(SalesApRequest request) { public void updateDetail(SalesApRequest request) {
SalesApPromotionDto dto = new SalesApPromotionDto(); // 修改DB 日期值为null
BeanUtils.copyProperties(request.getPromotion(), dto); try {
dto.setSapId(request.getSapId()); SalesApPromotionDto dto = new SalesApPromotionDto();
salesApPromotionDao.updateById(dto); SalesApRequest.Promotion promotion = request.getPromotion();
BeanUtils.copyProperties(promotion, dto);
dto.setSapId(request.getSapId());
Date parse = DatePattern.NORM_DATE_FORMAT.parse("2000-01-01");
if (Objects.isNull(promotion.getActualPromotionStartDate())) {
dto.setIsActualPromotionStartDate(true);
} else if (promotion.getActualPromotionStartDate().compareTo(parse) == 0) {
dto.setIsActualPromotionStartDate(false);
}else {
dto.setIsActualPromotionStartDate(true);
}
if (Objects.isNull(promotion.getActualPromotionEndDate())) {
// DB 日期值无需修改
dto.setIsActualPromotionEndDate(true);
} else if (promotion.getActualPromotionEndDate().compareTo(parse) == 0) {
// DB 日期值无需修改
dto.setIsActualPromotionEndDate(false);
}else {
dto.setIsActualPromotionEndDate(true);
}
salesApPromotionDao.updateById(dto);
} catch (ParseException e) {
e.printStackTrace();
}
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论