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

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

...@@ -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) {
......
...@@ -150,7 +150,7 @@ public class SalesApDisplay implements Serializable { ...@@ -150,7 +150,7 @@ public class SalesApDisplay implements Serializable {
/** /**
* 品项数 * 品项数
*/ */
private String productCount; private Integer productCount;
/** /**
* 大业态测试-动销模型 * 大业态测试-动销模型
......
...@@ -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");
} catch (ParseException e) {
throw new RuntimeException(e);
}
}
/** /**
* 计划-档期结束时间 * 实际-档期结束时间
*/ */
private Date plannedPromotionEndDate; 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) {
// 修改DB 日期值为null
try {
SalesApPromotionDto dto = new SalesApPromotionDto(); SalesApPromotionDto dto = new SalesApPromotionDto();
BeanUtils.copyProperties(request.getPromotion(), dto); SalesApRequest.Promotion promotion = request.getPromotion();
BeanUtils.copyProperties(promotion, dto);
dto.setSapId(request.getSapId()); 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); salesApPromotionDao.updateById(dto);
} catch (ParseException e) {
e.printStackTrace();
}
} }
} }
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
<result property="storeArea" column="store_area" jdbcType="VARCHAR"/> <result property="storeArea" column="store_area" jdbcType="VARCHAR"/>
<result property="storeLevel" column="store_level" jdbcType="VARCHAR"/> <result property="storeLevel" column="store_level" jdbcType="VARCHAR"/>
<result property="storeAddress" column="store_address" 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="lfSalesModel" column="lf_sales_model" jdbcType="VARCHAR"/>
<result property="lfMonthlyPos" column="lf_monthly_pos" jdbcType="VARCHAR"/> <result property="lfMonthlyPos" column="lf_monthly_pos" jdbcType="VARCHAR"/>
<result property="plannedMainShelfType" column="planned_main_shelf_type" jdbcType="VARCHAR"/> <result property="plannedMainShelfType" column="planned_main_shelf_type" jdbcType="VARCHAR"/>
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sfa.operation.domain.sales.mapper.SalesApPromotionMapper"> <mapper namespace="com.sfa.operation.domain.sales.mapper.SalesApPromotionMapper">
<resultMap id="SalesApPromotionBaseMap" type="com.sfa.operation.domain.sales.entity.SalesApPromotion"> <resultMap id="SalesApPromotionBaseMap" type="com.sfa.operation.domain.sales.entity.SalesApPromotion">
<id property="sapId" column="sap_id" jdbcType="BIGINT"/> <id property="sapId" column="sap_id" jdbcType="BIGINT"/>
<result property="regionName" column="region_name" jdbcType="VARCHAR"/> <result property="regionName" column="region_name" jdbcType="VARCHAR"/>
...@@ -35,19 +34,23 @@ ...@@ -35,19 +34,23 @@
<result property="plannedPromotionFormat" column="planned_promotion_format" jdbcType="VARCHAR"/> <result property="plannedPromotionFormat" column="planned_promotion_format" jdbcType="VARCHAR"/>
<result property="plannedVerificationMethod" column="planned_verification_method" jdbcType="VARCHAR"/> <result property="plannedVerificationMethod" column="planned_verification_method" jdbcType="VARCHAR"/>
<result property="plannedPromotionRules" column="planned_promotion_rules" jdbcType="VARCHAR"/> <result property="plannedPromotionRules" column="planned_promotion_rules" jdbcType="VARCHAR"/>
<result property="plannedPrePromotionAdjustDays" column="planned_pre_promotion_adjust_days" jdbcType="INTEGER"/> <result property="plannedPrePromotionAdjustDays" column="planned_pre_promotion_adjust_days"
<result property="plannedPostPromotionAdjustDays" column="planned_post_promotion_adjust_days" jdbcType="INTEGER"/> jdbcType="INTEGER"/>
<result property="plannedPostPromotionAdjustDays" column="planned_post_promotion_adjust_days"
jdbcType="INTEGER"/>
<result property="plannedPromotionStartDate" column="planned_promotion_start_date" jdbcType="DATE"/> <result property="plannedPromotionStartDate" column="planned_promotion_start_date" jdbcType="DATE"/>
<result property="actualPromotionStartDate" column="actual_promotion_start_date" jdbcType="DATE"/> <result property="actualPromotionStartDate" column="actual_promotion_start_date" jdbcType="DATE"/>
<result property="plannedPromotionEndDate" column="planned_promotion_end_date" jdbcType="DATE"/> <result property="plannedPromotionEndDate" column="planned_promotion_end_date" jdbcType="DATE"/>
<result property="actualPromotionEndDate" column="actual_promotion_end_date" jdbcType="DATE"/> <result property="actualPromotionEndDate" column="actual_promotion_end_date" jdbcType="DATE"/>
<result property="promotionImplementationStatus" column="promotion_implementation_status" jdbcType="VARCHAR"/> <result property="promotionImplementationStatus" column="promotion_implementation_status"
jdbcType="VARCHAR"/>
<result property="timeExecutionStatus" column="time_execution_status" jdbcType="VARCHAR"/> <result property="timeExecutionStatus" column="time_execution_status" jdbcType="VARCHAR"/>
<result property="plannedAdjustmentStartDate" column="planned_adjustment_start_date" jdbcType="DATE"/> <result property="plannedAdjustmentStartDate" column="planned_adjustment_start_date" jdbcType="DATE"/>
<result property="plannedAdjustmentEndDate" column="planned_adjustment_end_date" jdbcType="DATE"/> <result property="plannedAdjustmentEndDate" column="planned_adjustment_end_date" jdbcType="DATE"/>
<result property="plannedPromotionMechanism" column="planned_promotion_mechanism" jdbcType="VARCHAR"/> <result property="plannedPromotionMechanism" column="planned_promotion_mechanism" jdbcType="VARCHAR"/>
<result property="actualPromotionMechanism" column="actual_promotion_mechanism" jdbcType="VARCHAR"/> <result property="actualPromotionMechanism" column="actual_promotion_mechanism" jdbcType="VARCHAR"/>
<result property="promotionMechanismExecutionStatus" column="promotion_mechanism_execution_status" jdbcType="VARCHAR"/> <result property="promotionMechanismExecutionStatus" column="promotion_mechanism_execution_status"
jdbcType="VARCHAR"/>
<result property="estimatedBagCount" column="estimated_bag_count" jdbcType="INTEGER"/> <result property="estimatedBagCount" column="estimated_bag_count" jdbcType="INTEGER"/>
<result property="promotionStockQuantity" column="promotion_stock_quantity" jdbcType="INTEGER"/> <result property="promotionStockQuantity" column="promotion_stock_quantity" jdbcType="INTEGER"/>
<result property="unitFactoryPrice" column="unit_factory_price" jdbcType="DECIMAL"/> <result property="unitFactoryPrice" column="unit_factory_price" jdbcType="DECIMAL"/>
...@@ -55,11 +58,15 @@ ...@@ -55,11 +58,15 @@
<result property="regularRetailPrice" column="regular_retail_price" jdbcType="DECIMAL"/> <result property="regularRetailPrice" column="regular_retail_price" jdbcType="DECIMAL"/>
<result property="plannedPromotionPrice" column="planned_promotion_price" jdbcType="DECIMAL"/> <result property="plannedPromotionPrice" column="planned_promotion_price" jdbcType="DECIMAL"/>
<result property="actualPromotionPrice" column="actual_promotion_price" jdbcType="DECIMAL"/> <result property="actualPromotionPrice" column="actual_promotion_price" jdbcType="DECIMAL"/>
<result property="promotionPriceExecutionStatus" column="promotion_price_execution_status" jdbcType="VARCHAR"/> <result property="promotionPriceExecutionStatus" column="promotion_price_execution_status"
jdbcType="VARCHAR"/>
<result property="normalDealerMarginStatus" column="normal_dealer_margin_status" jdbcType="VARCHAR"/> <result property="normalDealerMarginStatus" column="normal_dealer_margin_status" jdbcType="VARCHAR"/>
<result property="systemFrontendMarginGuarantee" column="system_frontend_margin_guarantee" jdbcType="VARCHAR"/> <result property="systemFrontendMarginGuarantee" column="system_frontend_margin_guarantee"
<result property="systemBackendMarginGuarantee" column="system_backend_margin_guarantee" jdbcType="VARCHAR"/> jdbcType="VARCHAR"/>
<result property="systemPromotionMarginGuarantee" column="system_promotion_margin_guarantee" jdbcType="VARCHAR"/> <result property="systemBackendMarginGuarantee" column="system_backend_margin_guarantee"
jdbcType="VARCHAR"/>
<result property="systemPromotionMarginGuarantee" column="system_promotion_margin_guarantee"
jdbcType="VARCHAR"/>
<result property="dealerMarginGuarantee" column="dealer_margin_guarantee" jdbcType="VARCHAR"/> <result property="dealerMarginGuarantee" column="dealer_margin_guarantee" jdbcType="VARCHAR"/>
<result property="unitBagAdjustmentAmount" column="unit_bag_adjustment_amount" jdbcType="DECIMAL"/> <result property="unitBagAdjustmentAmount" column="unit_bag_adjustment_amount" jdbcType="DECIMAL"/>
<result property="adjustmentCostRatio" column="adjustment_cost_ratio" jdbcType="FLOAT"/> <result property="adjustmentCostRatio" column="adjustment_cost_ratio" jdbcType="FLOAT"/>
...@@ -74,4 +81,58 @@ ...@@ -74,4 +81,58 @@
<result property="cost" column="cost" jdbcType="DECIMAL"/> <result property="cost" column="cost" jdbcType="DECIMAL"/>
</resultMap> </resultMap>
<update id="putById" parameterType="com.sfa.operation.domain.sales.entity.SalesApPromotion">
UPDATE sales_ap_promotion
<set>
<if test="actualPromotionSpec != null">
actual_promotion_spec = #{actualPromotionSpec},
</if>
<if test="actualPromotionFlavor != null">
actual_promotion_flavor = #{actualPromotionFlavor},
</if>
<if test="specExecutionStatus != null">
spec_execution_status = #{specExecutionStatus},
</if>
<if test="isActualPromotionStartDate != null and isActualPromotionStartDate == true">
actual_promotion_start_date = #{actualPromotionStartDate},
</if>
<if test="isActualPromotionEndDate != null and isActualPromotionEndDate == true">
actual_promotion_end_date = #{actualPromotionEndDate},
</if>
<if test="promotionImplementationStatus != null">
promotion_implementation_status = #{promotionImplementationStatus},
</if>
<if test="timeExecutionStatus != null">
time_execution_status = #{timeExecutionStatus},
</if>
<if test="actualPromotionMechanism != null">
actual_promotion_mechanism = #{actualPromotionMechanism},
</if>
<if test="promotionMechanismExecutionStatus != null">
promotion_mechanism_execution_status = #{promotionMechanismExecutionStatus},
</if>
<if test="promotionStockQuantity != null">
promotion_stock_quantity = #{promotionStockQuantity},
</if>
<if test="actualPromotionPrice != null">
actual_promotion_price = #{actualPromotionPrice},
</if>
<if test="promotionPriceExecutionStatus != null">
promotion_price_execution_status = #{promotionPriceExecutionStatus},
</if>
<if test="promotionExecutionStatus != null">
promotion_execution_status = #{promotionExecutionStatus},
</if>
<if test="actualPosterFormat != null">
actual_poster_format = #{actualPosterFormat},
</if>
<if test="posterExecutionStatus != null">
poster_execution_status = #{posterExecutionStatus},
</if>
</set>
WHERE sap_id = #{sapId}
</update>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论