|
@@ -1,10 +1,13 @@
|
|
|
package com.dgtly.order.service.impl;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.math.RoundingMode;
|
|
|
import java.util.List;
|
|
|
import com.dgtly.common.utils.DateUtils;
|
|
|
import com.dgtly.order.domain.OrderSalesGroup;
|
|
|
import com.dgtly.order.mapper.OrderSalesGroupMapper;
|
|
|
import com.dgtly.order.service.IOrderSalesGroupService;
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.dgtly.common.core.text.Convert;
|
|
@@ -44,6 +47,53 @@ public class OrderSalesGroupServiceImpl implements IOrderSalesGroupService
|
|
|
@Override
|
|
|
public List<OrderSalesGroup> selectOrderSalesGroupList(OrderSalesGroup orderSalesGroup)
|
|
|
{
|
|
|
- return orderSalesGroupMapper.selectOrderSalesGroupList(orderSalesGroup);
|
|
|
+
|
|
|
+ List<OrderSalesGroup> orderSalesGroupList = orderSalesGroupMapper.selectOrderSalesGroupList(orderSalesGroup);
|
|
|
+ if(orderSalesGroupList != null && orderSalesGroupList.size() > 0){
|
|
|
+ orderSalesGroupList.forEach(salesGroup ->{
|
|
|
+ if(salesGroup != null) salesGroup = shrinkMilVezesOrderSalesCustomer(salesGroup);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return orderSalesGroupList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 目标与达成缩小一千倍
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static OrderSalesGroup shrinkMilVezesOrderSalesCustomer(OrderSalesGroup salesGroup) {
|
|
|
+ //预算
|
|
|
+ String nowYearBud = salesGroup.getNowYearBud();
|
|
|
+ if(StringUtils.isNotBlank(nowYearBud))
|
|
|
+ salesGroup.setNowYearBud(new BigDecimal(nowYearBud).setScale(3,BigDecimal.ROUND_HALF_UP)+"");
|
|
|
+ //已复核
|
|
|
+ String nowYearAct = salesGroup.getNowYearAct();
|
|
|
+ if(StringUtils.isNotBlank(nowYearAct))
|
|
|
+ salesGroup.setNowYearAct(divide(new BigDecimal(nowYearAct),new BigDecimal("1000"),3)+"");
|
|
|
+ //未复核
|
|
|
+ String reviewNo= salesGroup.getReviewNo();
|
|
|
+ if(StringUtils.isNotBlank(reviewNo))
|
|
|
+ salesGroup.setReviewNo(divide(new BigDecimal(reviewNo),new BigDecimal("1000"),3)+"");
|
|
|
+ //未清
|
|
|
+ String uncleared = salesGroup.getUncleared();
|
|
|
+ if(StringUtils.isNotBlank(uncleared))
|
|
|
+ salesGroup.setUncleared(divide(new BigDecimal(uncleared),new BigDecimal("1000"),3)+"");
|
|
|
+ //冻结
|
|
|
+ String freeze = salesGroup.getFreeze();
|
|
|
+ if(StringUtils.isNotBlank(freeze))
|
|
|
+ salesGroup.setFreeze(divide(new BigDecimal(freeze),new BigDecimal("1000"),3)+"");
|
|
|
+ return salesGroup;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param dividend 被除数
|
|
|
+ * @param divisor 除数
|
|
|
+ * @param number 保留几位小数
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static double divide(BigDecimal dividend , BigDecimal divisor, int number){
|
|
|
+ return dividend
|
|
|
+ .divide(divisor, number,
|
|
|
+ RoundingMode.HALF_UP).doubleValue();
|
|
|
}
|
|
|
}
|