Browse Source

nsy update 添加销售分部目标数据处理

ningsy 4 years ago
parent
commit
9fb9cd8e6f

+ 51 - 1
suishenbang-order/src/main/java/com/dgtly/order/service/impl/OrderSalesGroupServiceImpl.java

@@ -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();
     }
 }

+ 5 - 5
suishenbang-order/src/main/resources/templates/order/orderSalesGroup/groupList.html

@@ -128,23 +128,23 @@
                 },
                 {
                     field : 'nowYearAct', 
-                    title : '已复核'
+                    title : '已复核(千元)'
                 },
                 {
                     field : 'nowYearBud', 
-                    title : '预算'
+                    title : '预算(千元)'
                 },
                 {
                     field : 'reviewNo', 
-                    title : '未复核'
+                    title : '未复核(千元)'
                 },
                 {
                     field : 'uncleared', 
-                    title : '未清'
+                    title : '未清(千元)'
                 },
                 {
                     field : 'freeze', 
-                    title : '冻结'
+                    title : '冻结(千元)'
                 },
                 {
                     field : 'runTime',