提交 28c755f3 authored 作者: 000516's avatar 000516

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

......@@ -16,7 +16,7 @@ public class ApPromotionCoreController {
@Autowired
private IApPromotionCoreService apPromotionCoreService;
@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);
apPromotionCoreService.updateDetail(request);
}
......
......@@ -40,7 +40,7 @@ public class SalesApPromotionImplDao implements ISalesApPromotionDao {
public void updateById(SalesApPromotionDto dto) {
SalesApPromotion salesApPromotion = new SalesApPromotion();
BeanUtils.copyProperties(dto, salesApPromotion);
salesApPromotionMapper.updateById(salesApPromotion);
salesApPromotionMapper.putById(salesApPromotion);
}
private LambdaQueryWrapper<SalesApPromotion> buildWq(SalesApWq salesApWq) {
......
......@@ -150,7 +150,7 @@ public class SalesApDisplay implements Serializable {
/**
* 品项数
*/
private String productCount;
private Integer productCount;
/**
* 大业态测试-动销模型
......
......@@ -186,6 +186,8 @@ public class SalesApPromotion implements Serializable {
* 实际-档期开始时间
*/
private Date actualPromotionStartDate;
@TableField(exist = false)
private Boolean isActualPromotionStartDate;
/**
* 计划-档期结束时间
......@@ -196,6 +198,8 @@ public class SalesApPromotion implements Serializable {
* 实际-档期结束时间
*/
private Date actualPromotionEndDate;
@TableField(exist = false)
private Boolean isActualPromotionEndDate;
/**
* 档期是否开展
......
......@@ -13,6 +13,7 @@ import org.springframework.stereotype.Repository;
@Repository
public interface SalesApPromotionMapper extends BaseMapper<SalesApPromotion> {
void putById(SalesApPromotion salesApPromotion);
}
......
package com.sfa.operation.pojo.sales.request;
import cn.hutool.core.date.DatePattern;
import lombok.Builder;
import lombok.Data;
import lombok.Value;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Date;
/**
......@@ -105,10 +109,25 @@ public class SalesApRequest {
* 实际-档期开始时间
*/
private Date actualPromotionStartDate;
/**
* 计划-档期结束时间
*/
private Date plannedPromotionEndDate;
{
try {
actualPromotionStartDate = DatePattern.NORM_DATE_FORMAT.parse("2000-01-01");
} 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 {
* 实际-档期开始时间
*/
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;
import cn.hutool.core.date.DatePattern;
import com.sfa.operation.domain.sales.dao.ISalesApPromotionDao;
import com.sfa.operation.pojo.sales.request.SalesApRequest;
import com.sfa.operation.pojo.sales.response.SalesApPromotionDto;
......@@ -8,6 +9,10 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.Date;
import java.util.Objects;
/**
* @author : liqiulin
* @date : 2025-09-17 15
......@@ -17,11 +22,36 @@ import org.springframework.stereotype.Service;
public class ApPromotionCoreServiceImpl implements IApPromotionCoreService {
@Autowired
private ISalesApPromotionDao salesApPromotionDao;
@Override
public void updateDetail(SalesApRequest request) {
SalesApPromotionDto dto = new SalesApPromotionDto();
BeanUtils.copyProperties(request.getPromotion(), dto);
dto.setSapId(request.getSapId());
salesApPromotionDao.updateById(dto);
// 修改DB 日期值为null
try {
SalesApPromotionDto dto = new SalesApPromotionDto();
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();
}
}
}
......@@ -31,7 +31,7 @@
<result property="storeArea" column="store_area" jdbcType="VARCHAR"/>
<result property="storeLevel" column="store_level" jdbcType="VARCHAR"/>
<result property="storeAddress" column="store_address" jdbcType="VARCHAR"/>
<result property="productCount" column="product_count" jdbcType="VARCHAR"/>
<result property="productCount" column="product_count" jdbcType="INTEGER"/>
<result property="lfSalesModel" column="lf_sales_model" jdbcType="VARCHAR"/>
<result property="lfMonthlyPos" column="lf_monthly_pos" jdbcType="VARCHAR"/>
<result property="plannedMainShelfType" column="planned_main_shelf_type" jdbcType="VARCHAR"/>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论