Browse Source

调整

v1.0
Yen 2 years ago
parent
commit
ca6f6f7714
  1. 30
      src/main/java/com/qs/serve/modules/bir/entity/vo/BirCostApplyRateVo.java
  2. 28
      src/main/java/com/qs/serve/modules/bir/entity/vo/BirRoiCostItemVo.java
  3. 6
      src/main/java/com/qs/serve/modules/bir/mapper/BirActivityCenterGoodsMapper.java
  4. 12
      src/main/java/com/qs/serve/modules/bir/service/impl/BirCenterRateServiceImpl.java
  5. 1
      src/main/java/com/qs/serve/modules/bir/service/impl/BirRoiRateServiceImpl.java
  6. 12
      src/main/java/com/qs/serve/modules/erp/mapper/ErpDispatchDataMapper.java
  7. 14
      src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java
  8. 8
      src/main/java/com/qs/serve/modules/tbs/mapper/TbsBudgetMapper.java
  9. 2
      src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetMatchApplication.java
  10. 8
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetServiceImpl.java
  11. 8
      src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java
  12. 10
      src/main/resources/mapper/bir/BirActivityCenterGoodsMapper.xml
  13. 13
      src/main/resources/mapper/erp/ErpDispatchDataMapper.xml
  14. 2
      src/main/resources/mapper/tbs/TbsCostApplyMapper.xml

30
src/main/java/com/qs/serve/modules/bir/entity/vo/BirCostApplyRateVo.java

@ -34,14 +34,14 @@ public class BirCostApplyRateVo {
*/ */
private String scheduleType; private String scheduleType;
/** 目标金额(待定) */ // /** 目标金额(待定) */
private BigDecimal targetAmount; // private BigDecimal targetAmount;
//
/** 预算金额(待定) */ // /** 预算金额(待定) */
private BigDecimal budgetAmt; // private BigDecimal budgetAmt;
//
/** 预算费用率(待定) */ // /** 预算费用率(待定) */
private BigDecimal budgetRate; // private BigDecimal budgetRate;
/** 客户发货 */ /** 客户发货 */
private BigDecimal cusDisAmt; private BigDecimal cusDisAmt;
@ -52,13 +52,21 @@ public class BirCostApplyRateVo {
/** 客户费用率(客户费用/客户发货) */ /** 客户费用率(客户费用/客户发货) */
private BigDecimal cusRate; private BigDecimal cusRate;
/** 整体发货(该成本中心所有客户的发货金额) */ /** 该成本中心所有客户的发货金额 */
private BigDecimal centerDisAmt; private BigDecimal centerDisAmt;
/** 整体费用(所有客户占用该成本中心的费用金额) */ /** 所有客户占用该成本中心的费用金额 */
private BigDecimal centerCostAmt; private BigDecimal centerCostAmt;
/** 整体费用率(整体费用/整体发货) */ /** 成本中心维度比率 */
private BigDecimal centerRate; private BigDecimal centerRate;
/** 整体发货金额 */
private BigDecimal allDisAmt;
/** 整体费用金额 */
private BigDecimal allCostAmt;
/** 整体的比率 */
private BigDecimal allByRate;
} }

28
src/main/java/com/qs/serve/modules/bir/entity/vo/BirRoiCostItemVo.java

@ -21,18 +21,18 @@ public class BirRoiCostItemVo {
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
private LocalDate yearMonthDate; private LocalDate yearMonthDate;
/** // /**
* TODO 预算目标 // * TODO 预算目标
*/ // */
private BigDecimal budgetTargetAmt; // private BigDecimal budgetTargetAmt;
//
/** // /**
* TODO 预算统计金额 // * TODO 预算统计金额
*/ // */
private BigDecimal budgetTotalAmt; // private BigDecimal budgetTotalAmt;
/** /**
* 费用预估金额 * 费用预估金额目标
*/ */
private BigDecimal preAmt; private BigDecimal preAmt;
@ -47,7 +47,7 @@ public class BirRoiCostItemVo {
private BigDecimal checkAmt; private BigDecimal checkAmt;
/** /**
* 费用金额实际金额 * 费用金额实际金额界面的预算费用
*/ */
private BigDecimal costRealAmt; private BigDecimal costRealAmt;
@ -56,11 +56,6 @@ public class BirRoiCostItemVo {
*/ */
private BigDecimal checkRealAmt; private BigDecimal checkRealAmt;
/**
* 利润金额(无效参数)
*/
private BigDecimal returnAmt;
/** /**
* 发货金额(原发货金额) * 发货金额(原发货金额)
*/ */
@ -79,4 +74,5 @@ public class BirRoiCostItemVo {
private Float ytdPercent; private Float ytdPercent;
private Float qtdPercent; private Float qtdPercent;
} }

6
src/main/java/com/qs/serve/modules/bir/mapper/BirActivityCenterGoodsMapper.java

@ -1,5 +1,6 @@
package com.qs.serve.modules.bir.mapper; package com.qs.serve.modules.bir.mapper;
import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qs.serve.modules.bir.entity.BirActivityCenterGoods; import com.qs.serve.modules.bir.entity.BirActivityCenterGoods;
import com.qs.serve.modules.bir.entity.so.BirMonthCusCenterSo; import com.qs.serve.modules.bir.entity.so.BirMonthCusCenterSo;
@ -7,6 +8,7 @@ import com.qs.serve.modules.bir.entity.vo.BirActivityCenterGoodsMonthVo;
import com.qs.serve.modules.tbs.entity.TbsActivityCenterGoods; import com.qs.serve.modules.tbs.entity.TbsActivityCenterGoods;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
@ -19,6 +21,10 @@ public interface BirActivityCenterGoodsMapper extends BaseMapper<BirActivityCent
List<BirActivityCenterGoods> selectErrorBir(); List<BirActivityCenterGoods> selectErrorBir();
@InterceptorIgnore(tenantLine = "true")
BigDecimal totalAmt(@Param("startDate") Integer startDate,
@Param("endDate")Integer endDate);
/** /**
* 查询出异动的记录 * 查询出异动的记录
* @param startDate * @param startDate

12
src/main/java/com/qs/serve/modules/bir/service/impl/BirCenterRateServiceImpl.java

@ -237,7 +237,19 @@ public class BirCenterRateServiceImpl implements BirCenterRateService {
if(dispatchSumCenterAmt.compareTo(BigDecimal.ZERO)!=0){ if(dispatchSumCenterAmt.compareTo(BigDecimal.ZERO)!=0){
costApplyRateVo.setCenterRate(centerUsedCost.divide(dispatchSumCenterAmt,2,RoundingMode.DOWN)); costApplyRateVo.setCenterRate(centerUsedCost.divide(dispatchSumCenterAmt,2,RoundingMode.DOWN));
} }
//所有的发货单统计
BigDecimal dispatchSumAllsAmt = dispatchDataMapper.getSumCost(startMonthNum, endMonthNum);
costApplyRateVo.setAllDisAmt(dispatchSumAllsAmt);
//所有的费用使用金额
BigDecimal allUsedCost = birActivityCenterGoodsMapper.totalAmt(startMonthNum,endMonthNum);
costApplyRateVo.setAllCostAmt(allUsedCost);
if(dispatchSumAllsAmt!=null&&dispatchSumAllsAmt.compareTo(BigDecimal.ZERO)!=0){
costApplyRateVo.setAllByRate(costApplyRateVo.getAllCostAmt().divide(costApplyRateVo.getAllDisAmt(),2,RoundingMode.DOWN));
}
costApplyRateVoList.add(costApplyRateVo); costApplyRateVoList.add(costApplyRateVo);
} }
return costApplyRateVoList; return costApplyRateVoList;
} }

1
src/main/java/com/qs/serve/modules/bir/service/impl/BirRoiRateServiceImpl.java

@ -173,7 +173,6 @@ public class BirRoiRateServiceImpl extends ServiceImpl<BirRoiRateMapper,BirRoiRa
itemVo.setCheckAmt(BigDecimal.ZERO); itemVo.setCheckAmt(BigDecimal.ZERO);
itemVo.setCostRealAmt(BigDecimal.ZERO); itemVo.setCostRealAmt(BigDecimal.ZERO);
itemVo.setCheckRealAmt(BigDecimal.ZERO); itemVo.setCheckRealAmt(BigDecimal.ZERO);
itemVo.setReturnAmt(BigDecimal.ZERO);
itemVo.setRegionTotalCostAmt(BigDecimal.ZERO); itemVo.setRegionTotalCostAmt(BigDecimal.ZERO);
itemVo.setRegionTotalDispatchAmt(BigDecimal.ZERO); itemVo.setRegionTotalDispatchAmt(BigDecimal.ZERO);
itemVo.setDispatchAmt(dispatchAmt); itemVo.setDispatchAmt(dispatchAmt);

12
src/main/java/com/qs/serve/modules/erp/mapper/ErpDispatchDataMapper.java

@ -18,6 +18,16 @@ import java.util.List;
*/ */
public interface ErpDispatchDataMapper extends BaseMapper<ErpDispatchData> { public interface ErpDispatchDataMapper extends BaseMapper<ErpDispatchData> {
/**
* 查询发货单合计
* @param startNumber
* @param endNumber
* @return
*/
@InterceptorIgnore(tenantLine = "1")
BigDecimal getSumCost(@Param("startNumber")Integer startNumber,
@Param("endNumber")Integer endNumber);
/** /**
* 查询发货单合计 * 查询发货单合计
* @param startNumber * @param startNumber
@ -30,6 +40,8 @@ public interface ErpDispatchDataMapper extends BaseMapper<ErpDispatchData> {
@Param("endNumber")Integer endNumber, @Param("endNumber")Integer endNumber,
@Param("cusCodes")List<String> cusCodes); @Param("cusCodes")List<String> cusCodes);
@InterceptorIgnore(tenantLine = "1") @InterceptorIgnore(tenantLine = "1")
BigDecimal querySumCostAmt(@Param("startNumber")Integer startNumber, BigDecimal querySumCostAmt(@Param("startNumber")Integer startNumber,
@Param("endNumber")Integer endNumber, @Param("endNumber")Integer endNumber,

14
src/main/java/com/qs/serve/modules/tbs/controller/TbsCostApplyController.java

@ -120,13 +120,13 @@ public class TbsCostApplyController {
@PreAuthorize("hasRole('tbs:costApply:query')") @PreAuthorize("hasRole('tbs:costApply:query')")
public R<TbsBudgetTableVo> preview(Long id){ public R<TbsBudgetTableVo> preview(Long id){
TbsCostApply costApply = tbsCostApplyService.getById(id); TbsCostApply costApply = tbsCostApplyService.getById(id);
TbsBudgetTableVo tableVo = null; TbsBudgetTableVo tableVo = tbsBudgetMatchApplication.getMatchResult(id,true).getTableVo();
if(costApply.getMatchType().equals(0)){ // if(costApply.getMatchType().equals(0)){
TbsBudgetCostResult result = budgetApplicationService.buildBudgetCostResult(id,false,true); // TbsBudgetCostResult result = budgetApplicationService.buildBudgetCostResult(id,false,true);
tableVo = result.getTableData(); // tableVo = result.getTableData();
}else if (costApply.getMatchType().equals(1)){ // }else if (costApply.getMatchType().equals(1)){
tableVo = tbsBudgetMatchApplication.getMatchResult(id,true).getTableVo(); // tableVo = tbsBudgetMatchApplication.getMatchResult(id,true).getTableVo();
} // }
return R.ok(tableVo); return R.ok(tableVo);
} }

8
src/main/java/com/qs/serve/modules/tbs/mapper/TbsBudgetMapper.java

@ -24,12 +24,12 @@ public interface TbsBudgetMapper extends BaseMapper<TbsBudget> {
List<Long> selectBudgetId(@Param("query") TbsBudgetSo budgetSo); List<Long> selectBudgetId(@Param("query") TbsBudgetSo budgetSo);
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")
@Update("update tbs_budget_condition set brand_id = SUBSTRING_INDEX(target_level_path_ids,'_',1)") @Update("update tbs_budget_condition set brand_id = SUBSTRING_INDEX(target_level_path_ids,'_',1) where budget_id = #{budgetId}")
int updateBudgetCondition(); int updateBudgetCondition(@Param("budgetId")Long budgetId);
@InterceptorIgnore(tenantLine = "true") @InterceptorIgnore(tenantLine = "true")
@Update("update tbs_budget set center_combo = concat(center_type,'_',center_id)") @Update("update tbs_budget set center_combo = concat(center_type,'_',center_id) where id = #{budgetId}")
int updateBudgetComboCenter(); int updateBudgetComboCenter(@Param("budgetId")Long budgetId);
} }

2
src/main/java/com/qs/serve/modules/tbs/service/TbsBudgetMatchApplication.java

@ -113,7 +113,7 @@ public class TbsBudgetMatchApplication {
//跳过预算指定的模板 //跳过预算指定的模板
TbsActivity activity = activityMap.get(centerGoods.getActivityId()); TbsActivity activity = activityMap.get(centerGoods.getActivityId());
String templateId = activity.getTemplateId()==null?null:activity.getTemplateId().toString(); String templateId = activity.getTemplateId()==null||activity.getTemplateId()==0L?null:activity.getTemplateId().toString();
TbsBudget budget = allBudgetMap.get(itemBudget.getBudgetId()); TbsBudget budget = allBudgetMap.get(itemBudget.getBudgetId());
if(budget==null){ if(budget==null){
continue; continue;

8
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsBudgetServiceImpl.java

@ -228,11 +228,15 @@ public class TbsBudgetServiceImpl extends ServiceImpl<TbsBudgetMapper,TbsBudget>
} }
scheduleItemBudgetService.saveBatch(scheduleItemBudgets); scheduleItemBudgetService.saveBatch(scheduleItemBudgets);
//设置条件 //设置条件
if(budget.getId()!=null){
this.updateById(budget); this.updateById(budget);
}else {
this.save(budget);
}
buildCondition(budget.getId(),brandIds,categoryIds,seriesIds,spuIds,skuIds); buildCondition(budget.getId(),brandIds,categoryIds,seriesIds,spuIds,skuIds);
//冗余字段初始化 //冗余字段初始化
baseMapper.updateBudgetCondition(); baseMapper.updateBudgetCondition(budget.getId());
baseMapper.updateBudgetComboCenter(); baseMapper.updateBudgetComboCenter(budget.getId());
} }
/** /**

8
src/main/java/com/qs/serve/modules/tbs/service/impl/TbsCostApplyServiceImpl.java

@ -353,12 +353,12 @@ public class TbsCostApplyServiceImpl extends ServiceImpl<TbsCostApplyMapper,TbsC
TbsBudgetTableResultVo result1 = null; TbsBudgetTableResultVo result1 = null;
// 加载匹配方式 // 加载匹配方式
Integer matchType = tbsCostApply.getMatchType(); Integer matchType = tbsCostApply.getMatchType();
if(matchType.equals(0)){ //if(matchType.equals(0)){
result0 = budgetApplicationService.buildBudgetCostResult(tbsCostApply.getId(),true,false); // result0 = budgetApplicationService.buildBudgetCostResult(tbsCostApply.getId(),true,false);
}else if (matchType.equals(1)){ //}else if (matchType.equals(1)){
//新的匹配方式 //新的匹配方式
result1 = tbsBudgetMatchApplication.getMatchResult(tbsCostApply.getId(),false); result1 = tbsBudgetMatchApplication.getMatchResult(tbsCostApply.getId(),false);
} //}
//恢复绑定 //恢复绑定
this.releaseCost(tbsCostApply.getId(),0); this.releaseCost(tbsCostApply.getId(),0);
Map<String, Object> data = new HashMap<>(10); Map<String, Object> data = new HashMap<>(10);

10
src/main/resources/mapper/bir/BirActivityCenterGoodsMapper.xml

@ -181,5 +181,15 @@
on tbs_cost_apply.id = bir_activity_center_goods.cost_apply_id on tbs_cost_apply.id = bir_activity_center_goods.cost_apply_id
where charge_state not in (1,2,3,4) where charge_state not in (1,2,3,4)
</select> </select>
<select id="totalAmt" resultType="java.math.BigDecimal">
select
sum(split_amount) as total_cost_amt
from bir_activity_center_goods
where
1=1
and key_num &lt;=#{startDate}
and key_num &gt;=#{endDate}
</select>
</mapper> </mapper>

13
src/main/resources/mapper/erp/ErpDispatchDataMapper.xml

@ -66,6 +66,8 @@
GROUP BY DATE_FORMAT(date,'%Y%m') GROUP BY DATE_FORMAT(date,'%Y%m')
</select> </select>
<select id="querySumCostAmt" resultType="java.math.BigDecimal"> <select id="querySumCostAmt" resultType="java.math.BigDecimal">
SELECT SELECT
SUM(sum_money) as dispatchSumCost SUM(sum_money) as dispatchSumCost
@ -82,5 +84,16 @@
</if> </if>
</select> </select>
<select id="getSumCost" resultType="java.math.BigDecimal">
SELECT
SUM(sum_money) as dispatchSumCost
FROM
`erp_dispatch_data`
where
DATE_FORMAT(date,'%Y%m') &gt;= #{startNumber}
and DATE_FORMAT(date,'%Y%m') &lt;= #{endNumber}
GROUP BY DATE_FORMAT(date,'%Y%m')
</select>
</mapper> </mapper>

2
src/main/resources/mapper/tbs/TbsCostApplyMapper.xml

@ -156,7 +156,7 @@
WHERE WHERE
`tbs_cost_apply`.`del_flag` = 0 `tbs_cost_apply`.`del_flag` = 0
and `tbs_activity`.`del_flag` = 0 and `tbs_activity`.`del_flag` = 0
and `tbs_activity`.`activity_state` = 0 and (`tbs_activity`.`activity_state` = 0 or `tbs_activity`.`activity_state` = 3 )
and `tbs_cost_apply`.`charge_state` = 2 and `tbs_cost_apply`.`charge_state` = 2
and `tbs_activity`.pre_check_date &gt;= #{startNowDate} and `tbs_activity`.pre_check_date &gt;= #{startNowDate}
and `tbs_activity`.pre_check_date &lt; #{nowDate} and `tbs_activity`.pre_check_date &lt; #{nowDate}

Loading…
Cancel
Save