提交 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();
}
} }
} }
...@@ -3,75 +3,136 @@ ...@@ -3,75 +3,136 @@
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">
<id property="sapId" column="sap_id" jdbcType="BIGINT"/>
<result property="regionName" column="region_name" jdbcType="VARCHAR"/>
<result property="districtName" column="district_name" jdbcType="VARCHAR"/>
<result property="dealerProvince" column="dealer_province" jdbcType="VARCHAR"/>
<result property="dealerCity" column="dealer_city" jdbcType="VARCHAR"/>
<result property="dealerCode" column="dealer_code" jdbcType="VARCHAR"/>
<result property="dealerName" column="dealer_name" jdbcType="VARCHAR"/>
<result property="dealerType" column="dealer_type" jdbcType="VARCHAR"/>
<result property="openingDate" column="opening_date" jdbcType="DATE"/>
<result property="closingDate" column="closing_date" jdbcType="DATE"/>
<result property="regionManager" column="region_manager" jdbcType="VARCHAR"/>
<result property="districtManager" column="district_manager" jdbcType="VARCHAR"/>
<result property="cityManager" column="city_manager" jdbcType="VARCHAR"/>
<result property="lineName" column="line_name" jdbcType="VARCHAR"/>
<result property="lineType" column="line_type" jdbcType="VARCHAR"/>
<result property="channelDl" column="channel_dl" jdbcType="VARCHAR"/>
<result property="channelXl" column="channel_xl" jdbcType="VARCHAR"/>
<result property="lineLf" column="line_lf" jdbcType="VARCHAR"/>
<result property="storeCount" column="store_count" jdbcType="VARCHAR"/>
<result property="promotionExecutionMonth" column="promotion_execution_month" jdbcType="VARCHAR"/>
<result property="plannedPromotionSpec" column="planned_promotion_spec" jdbcType="VARCHAR"/>
<result property="plannedPromotionFlavor" column="planned_promotion_flavor" jdbcType="VARCHAR"/>
<result property="actualPromotionSpec" column="actual_promotion_spec" jdbcType="VARCHAR"/>
<result property="actualPromotionFlavor" column="actual_promotion_flavor" jdbcType="VARCHAR"/>
<result property="specExecutionStatus" column="spec_execution_status" jdbcType="VARCHAR"/>
<result property="totalCost" column="total_cost" jdbcType="DECIMAL"/>
<result property="totalCostRate" column="total_cost_rate" jdbcType="FLOAT"/>
<result property="plannedPromotionFormat" column="planned_promotion_format" jdbcType="VARCHAR"/>
<result property="plannedVerificationMethod" column="planned_verification_method" jdbcType="VARCHAR"/>
<result property="plannedPromotionRules" column="planned_promotion_rules" jdbcType="VARCHAR"/>
<result property="plannedPrePromotionAdjustDays" column="planned_pre_promotion_adjust_days"
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="actualPromotionStartDate" column="actual_promotion_start_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="promotionImplementationStatus" column="promotion_implementation_status"
jdbcType="VARCHAR"/>
<result property="timeExecutionStatus" column="time_execution_status" jdbcType="VARCHAR"/>
<result property="plannedAdjustmentStartDate" column="planned_adjustment_start_date" jdbcType="DATE"/>
<result property="plannedAdjustmentEndDate" column="planned_adjustment_end_date" jdbcType="DATE"/>
<result property="plannedPromotionMechanism" column="planned_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="estimatedBagCount" column="estimated_bag_count" jdbcType="INTEGER"/>
<result property="promotionStockQuantity" column="promotion_stock_quantity" jdbcType="INTEGER"/>
<result property="unitFactoryPrice" column="unit_factory_price" jdbcType="DECIMAL"/>
<result property="normalSupplyPrice" column="normal_supply_price" jdbcType="DECIMAL"/>
<result property="regularRetailPrice" column="regular_retail_price" jdbcType="DECIMAL"/>
<result property="plannedPromotionPrice" column="planned_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="normalDealerMarginStatus" column="normal_dealer_margin_status" jdbcType="VARCHAR"/>
<result property="systemFrontendMarginGuarantee" column="system_frontend_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="unitBagAdjustmentAmount" column="unit_bag_adjustment_amount" jdbcType="DECIMAL"/>
<result property="adjustmentCostRatio" column="adjustment_cost_ratio" jdbcType="FLOAT"/>
<result property="totalAdjustmentCost" column="total_adjustment_cost" jdbcType="DECIMAL"/>
<result property="promotionExecutionStatus" column="promotion_execution_status" jdbcType="VARCHAR"/>
<result property="plannedPosterFormat" column="planned_poster_format" jdbcType="VARCHAR"/>
<result property="plannedPosterCost" column="planned_poster_cost" jdbcType="VARCHAR"/>
<result property="actualPosterFormat" column="actual_poster_format" jdbcType="VARCHAR"/>
<result property="posterExecutionStatus" column="poster_execution_status" jdbcType="VARCHAR"/>
<result property="storeCountInt" column="store_count_int" jdbcType="INTEGER"/>
<result property="averageStoreCost" column="average_store_cost" jdbcType="DECIMAL"/>
<result property="cost" column="cost" jdbcType="DECIMAL"/>
</resultMap>
<resultMap id="SalesApPromotionBaseMap" type="com.sfa.operation.domain.sales.entity.SalesApPromotion"> <update id="putById" parameterType="com.sfa.operation.domain.sales.entity.SalesApPromotion">
<id property="sapId" column="sap_id" jdbcType="BIGINT"/> UPDATE sales_ap_promotion
<result property="regionName" column="region_name" jdbcType="VARCHAR"/> <set>
<result property="districtName" column="district_name" jdbcType="VARCHAR"/>
<result property="dealerProvince" column="dealer_province" jdbcType="VARCHAR"/>
<result property="dealerCity" column="dealer_city" jdbcType="VARCHAR"/>
<result property="dealerCode" column="dealer_code" jdbcType="VARCHAR"/>
<result property="dealerName" column="dealer_name" jdbcType="VARCHAR"/>
<result property="dealerType" column="dealer_type" jdbcType="VARCHAR"/>
<result property="openingDate" column="opening_date" jdbcType="DATE"/>
<result property="closingDate" column="closing_date" jdbcType="DATE"/>
<result property="regionManager" column="region_manager" jdbcType="VARCHAR"/>
<result property="districtManager" column="district_manager" jdbcType="VARCHAR"/>
<result property="cityManager" column="city_manager" jdbcType="VARCHAR"/>
<result property="lineName" column="line_name" jdbcType="VARCHAR"/>
<result property="lineType" column="line_type" jdbcType="VARCHAR"/>
<result property="channelDl" column="channel_dl" jdbcType="VARCHAR"/>
<result property="channelXl" column="channel_xl" jdbcType="VARCHAR"/>
<result property="lineLf" column="line_lf" jdbcType="VARCHAR"/>
<result property="storeCount" column="store_count" jdbcType="VARCHAR"/>
<result property="promotionExecutionMonth" column="promotion_execution_month" jdbcType="VARCHAR"/>
<result property="plannedPromotionSpec" column="planned_promotion_spec" jdbcType="VARCHAR"/>
<result property="plannedPromotionFlavor" column="planned_promotion_flavor" jdbcType="VARCHAR"/>
<result property="actualPromotionSpec" column="actual_promotion_spec" jdbcType="VARCHAR"/>
<result property="actualPromotionFlavor" column="actual_promotion_flavor" jdbcType="VARCHAR"/>
<result property="specExecutionStatus" column="spec_execution_status" jdbcType="VARCHAR"/>
<result property="totalCost" column="total_cost" jdbcType="DECIMAL"/>
<result property="totalCostRate" column="total_cost_rate" jdbcType="FLOAT"/>
<result property="plannedPromotionFormat" column="planned_promotion_format" jdbcType="VARCHAR"/>
<result property="plannedVerificationMethod" column="planned_verification_method" jdbcType="VARCHAR"/>
<result property="plannedPromotionRules" column="planned_promotion_rules" jdbcType="VARCHAR"/>
<result property="plannedPrePromotionAdjustDays" column="planned_pre_promotion_adjust_days" 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="actualPromotionStartDate" column="actual_promotion_start_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="promotionImplementationStatus" column="promotion_implementation_status" jdbcType="VARCHAR"/>
<result property="timeExecutionStatus" column="time_execution_status" jdbcType="VARCHAR"/>
<result property="plannedAdjustmentStartDate" column="planned_adjustment_start_date" jdbcType="DATE"/>
<result property="plannedAdjustmentEndDate" column="planned_adjustment_end_date" jdbcType="DATE"/>
<result property="plannedPromotionMechanism" column="planned_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="estimatedBagCount" column="estimated_bag_count" jdbcType="INTEGER"/>
<result property="promotionStockQuantity" column="promotion_stock_quantity" jdbcType="INTEGER"/>
<result property="unitFactoryPrice" column="unit_factory_price" jdbcType="DECIMAL"/>
<result property="normalSupplyPrice" column="normal_supply_price" jdbcType="DECIMAL"/>
<result property="regularRetailPrice" column="regular_retail_price" jdbcType="DECIMAL"/>
<result property="plannedPromotionPrice" column="planned_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="normalDealerMarginStatus" column="normal_dealer_margin_status" jdbcType="VARCHAR"/>
<result property="systemFrontendMarginGuarantee" column="system_frontend_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="unitBagAdjustmentAmount" column="unit_bag_adjustment_amount" jdbcType="DECIMAL"/>
<result property="adjustmentCostRatio" column="adjustment_cost_ratio" jdbcType="FLOAT"/>
<result property="totalAdjustmentCost" column="total_adjustment_cost" jdbcType="DECIMAL"/>
<result property="promotionExecutionStatus" column="promotion_execution_status" jdbcType="VARCHAR"/>
<result property="plannedPosterFormat" column="planned_poster_format" jdbcType="VARCHAR"/>
<result property="plannedPosterCost" column="planned_poster_cost" jdbcType="VARCHAR"/>
<result property="actualPosterFormat" column="actual_poster_format" jdbcType="VARCHAR"/>
<result property="posterExecutionStatus" column="poster_execution_status" jdbcType="VARCHAR"/>
<result property="storeCountInt" column="store_count_int" jdbcType="INTEGER"/>
<result property="averageStoreCost" column="average_store_cost" jdbcType="DECIMAL"/>
<result property="cost" column="cost" jdbcType="DECIMAL"/>
</resultMap>
<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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论