Просмотр исходного кода

Merge branch 'dev' of ssh://10.10.101.21/source/platform-b2b

hejq 7 лет назад
Родитель
Сommit
efd1d1ed27
19 измененных файлов с 1277 добавлено и 58 удалено
  1. 42 0
      src/main/java/com/uas/platform/b2b/b2capi/UserController.java
  2. 7 7
      src/main/java/com/uas/platform/b2b/dao/PurchaseAcceptItemDao.java
  3. 1 1
      src/main/java/com/uas/platform/b2b/erp/controller/PurchaseAPBillController.java
  4. 62 0
      src/main/java/com/uas/platform/b2b/openapi/controller/TradingDataToErpController.java
  5. 17 17
      src/main/java/com/uas/platform/b2b/openapi/controller/UsoftFxController.java
  6. 72 0
      src/main/java/com/uas/platform/b2b/openapi/model/CustTrading.java
  7. 92 0
      src/main/java/com/uas/platform/b2b/openapi/model/RecentOfMonth.java
  8. 76 0
      src/main/java/com/uas/platform/b2b/openapi/model/RecentOfYear.java
  9. 38 0
      src/main/java/com/uas/platform/b2b/openapi/service/TradingDataService.java
  10. 8 3
      src/main/java/com/uas/platform/b2b/openapi/service/UsoftFxService.java
  11. 590 0
      src/main/java/com/uas/platform/b2b/openapi/service/impl/TradingDataServiceImpl.java
  12. 10 10
      src/main/java/com/uas/platform/b2b/openapi/service/impl/UsoftFxServiceImpl.java
  13. 19 0
      src/main/java/com/uas/platform/b2b/openapi/support/ErpRate.java
  14. 141 0
      src/main/java/com/uas/platform/b2b/openapi/support/NumFormat.java
  15. 21 0
      src/main/java/com/uas/platform/b2b/openapi/support/TimeStauts.java
  16. 13 1
      src/main/java/com/uas/platform/b2b/service/UserService.java
  17. 2 1
      src/main/java/com/uas/platform/b2b/service/impl/ErpProdIODetailServiceImpl.java
  18. 54 11
      src/main/java/com/uas/platform/b2b/service/impl/UserServiceImpl.java
  19. 12 7
      src/main/webapp/resources/js/index/app.js

+ 42 - 0
src/main/java/com/uas/platform/b2b/b2capi/UserController.java

@@ -0,0 +1,42 @@
+package com.uas.platform.b2b.b2capi;
+
+import com.uas.platform.b2b.model.User;
+import com.uas.platform.b2b.service.UserService;
+import com.uas.platform.b2b.support.UsageBufferedLogger;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * B2C查询用户信息接口
+ *
+ * @author hejq
+ * @date 2018-09-26 17:13
+ */
+@RestController("b2capi.UserController")
+@RequestMapping(value = "/user")
+public class UserController {
+
+    @Autowired
+    private UserService userService;
+
+    private final static UsageBufferedLogger LOGGER = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+    /**
+     *  通过用户UU查询用户信息
+     *
+     * @param userUUJson 用户UU
+     * @return
+     */
+    @RequestMapping(value = "/findByUserUUList", method = RequestMethod.GET)
+    public List<User> findByUserUUList(String userUUJson) {
+        LOGGER.log("查询用户信息", "通过UU号查询用户信息", userUUJson);
+        List<Long> userUUs = FlexJsonUtils.fromJsonArray(userUUJson, Long.class);
+        return userService.findByUserUUList(userUUs);
+    }
+}

+ 7 - 7
src/main/java/com/uas/platform/b2b/dao/PurchaseAcceptItemDao.java

@@ -33,10 +33,10 @@ public interface PurchaseAcceptItemDao extends JpaSpecificationExecutor<Purchase
 			@Param("number") Short number);
 
 	/**
-	 * 根据企业enUU获取当前企业最近三个月(订单时间or验收单时间?)有验收单的数据,只返回有验收单的订单和订单明细
-	 * @param enUU
-	 * @param needStartDate
-	 * @param needEndDate
+	 * 根据企业enUU获取当前企业最近三个月(订单时间)有验收单的数据,只返回有验收单的订单和订单明细
+	 * @param enUU 卖方uu
+	 * @param needStartDate 起始时间
+	 * @param needEndDate 结束时间
 	 * @return
 	 */
 	@Query("from PurchaseAcceptItem p where p.accept.vendUU = :enUU and p.orderItem.order.date >= :startDate and p.orderItem.order.date <= :endDate and p.orderItem.order.currency = 'RMB'")
@@ -44,10 +44,10 @@ public interface PurchaseAcceptItemDao extends JpaSpecificationExecutor<Purchase
 
 	/**
 	 * 根据验收单明细ID获取数据
-	 * @param enUU
-	 * @param ids
+	 * @param enUU 卖方uu
+	 * @param ids 明细id
 	 * @return
 	 */
 	@Query("from PurchaseAcceptItem p where p.accept.vendUU = :enUU and p.id in :ids")
-	List<PurchaseAcceptItem> findPurcAcceptByItemIds(@Param("enUU") Long enUU,@Param("ids") List<Long> ids);
+	List<PurchaseAcceptItem> findPurcAcceptByItemIds(@Param("enUU") Long enUU, @Param("ids") List<Long> ids);
 }

+ 1 - 1
src/main/java/com/uas/platform/b2b/erp/controller/PurchaseAPBillController.java

@@ -50,7 +50,7 @@ public class PurchaseAPBillController {
 	 */
 	@RequestMapping(method = RequestMethod.POST)
 	@ResponseBody
-	public List<PurchaseAPBill> saveApBills(@RequestParam("data") String data) throws UnsupportedEncodingException {
+	public List<PurchaseAPBill> saveApBills(@RequestParam(value = "data") String data) throws UnsupportedEncodingException {
 		String jsonStr = URLDecoder.decode(data, "UTF-8");
 		List<PurchaseAPBill> purchaseAPBills = FlexJsonUtils.fromJsonArray(jsonStr, PurchaseAPBill.class);
 		purchaseApBillService.save(purchaseAPBillService.convertApBills(purchaseAPBills));

+ 62 - 0
src/main/java/com/uas/platform/b2b/openapi/controller/TradingDataToErpController.java

@@ -0,0 +1,62 @@
+package com.uas.platform.b2b.openapi.controller;
+
+import com.uas.platform.b2b.openapi.service.TradingDataService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 对应收宝erp接口
+ * @Author: huj
+ * @Date: Created in 15:03 2018/9/20.
+ */
+@RestController
+@RequestMapping("/openapi/api/trade")
+public class TradingDataToErpController {
+
+    @Autowired
+    TradingDataService tradingDataService;
+
+    /**
+     * 根据uu获取卖方累计交易数据
+     * @param enUU 企业uu
+     * @return
+     */
+    @RequestMapping(value = "/sum", method = RequestMethod.GET)
+    public ModelMap getTradingSum(@RequestParam("enUU") Long enUU) {
+        return tradingDataService.getTradingSum(enUU);
+    }
+
+    /**
+     * 根据uu获取卖方对应所有买方客户历史记录
+     * @param enUU 企业uu
+     * @return
+     */
+    @RequestMapping(value = "/cust/history", method = RequestMethod.GET)
+    public ModelMap getCustTrading(@RequestParam("enUU") Long enUU) {
+        return tradingDataService.getCustTrading(enUU);
+    }
+
+    /**
+     * 根据uu获取卖方近三年交易记录
+     * @param enUU 企业uu
+     * @return
+     */
+    @RequestMapping(value = "/rencent/year", method = RequestMethod.GET)
+    public ModelMap getRecentOfYear(@RequestParam("enUU") Long enUU) {
+        return tradingDataService.getRecentOfYear(enUU);
+    }
+
+    /**
+     * 根据uu获取卖方近四个月交易记录
+     * @param enUU 企业uu
+     * @return
+     */
+    @RequestMapping(value = "/rencent/month", method = RequestMethod.GET)
+    public ModelMap getRecentOfMonth(@RequestParam("enUU") Long enUU) {
+        return tradingDataService.getRecentOfMonth(enUU);
+    }
+}

+ 17 - 17
src/main/java/com/uas/platform/b2b/openapi/controller/UsoftFxController.java

@@ -25,26 +25,26 @@ public class UsoftFxController {
     UsoftFxService usoftFxService;
 
     /**
-     * 根据企业enUU获取当前企业最近三个月(订单时间or验收单时间?)有验收单的数据
-     * @param enUU
-     * @param excludeAcceptItemIds
-     * @param startDate
-     * @param endDate
+     * 根据企业enUU获取当前企业最近三个月(订单时间)有验收单的数据
+     * @param enUU  卖方uu
+     * @param excludeAcceptItemIds  移除的id
+     * @param startDate  起始时间
+     * @param endDate  结束时间
      * @throws UnsupportedEncodingException
      * return 返回有验收单的订单和订单明细
      */
-    @RequestMapping(value = "/orders/withAccepts",method = RequestMethod.GET)
+    @RequestMapping(value = "/orders/withAccepts", method = RequestMethod.GET)
     @ResponseBody
-    public List<FxPurOrder> getPurcAcceptItems(@RequestParam("enUU") Long enUU,@RequestParam(value = "excludeAcceptItemIds",required = false) String excludeAcceptItemIds,
-                                   @RequestParam(value = "startDate",required = false) Long startDate,
-                                   @RequestParam(value = "endDate",required = false) Long endDate) throws UnsupportedEncodingException {
+    public List<FxPurOrder> getPurcAcceptItems(@RequestParam("enUU") Long enUU, @RequestParam(value = "excludeAcceptItemIds", required = false) String excludeAcceptItemIds,
+                                   @RequestParam(value = "startDate", required = false) Long startDate,
+                                   @RequestParam(value = "endDate", required = false) Long endDate) throws UnsupportedEncodingException {
         String acceptItems = null;
         if (!StringUtils.isEmpty(excludeAcceptItemIds)) {
-            acceptItems = URLDecoder.decode(excludeAcceptItemIds,"UTF-8");
+            acceptItems = URLDecoder.decode(excludeAcceptItemIds, "UTF-8");
         }
         List<Long> excludeItemsIds = new ArrayList<>();
         if (!StringUtils.isEmpty(acceptItems)) {
-            Long[] longs = (Long[]) ConvertUtils.convert(acceptItems.split(","),Long.class);
+            Long[] longs = (Long[]) ConvertUtils.convert(acceptItems.split(","), Long.class);
             excludeItemsIds = Arrays.asList(longs);
         }
         Date date = new Date();
@@ -54,21 +54,21 @@ public class UsoftFxController {
         date = calendar.getTime();
         Date needStartDate = startDate == null ? date : new Date(startDate);
         Date needEndDate = endDate == null ? new Date() : new Date(endDate);
-        List<FxPurOrder> fxPurOrders = usoftFxService.getPurcAccsptItems(enUU,excludeItemsIds,needStartDate,needEndDate);
+        List<FxPurOrder> fxPurOrders = usoftFxService.getPurcAccsptItems(enUU, excludeItemsIds, needStartDate, needEndDate);
         return fxPurOrders;
     }
 
     /**
      * 根据验收单的明细获取对应的验收单数据
-     * @param enUU
-     * @param acceptItemIds
+     * @param enUU 卖方uu
+     * @param acceptItemIds 验收明细id
      * @return
      * @throws UnsupportedEncodingException
      */
-    @RequestMapping(value = "/acceptItems",method = RequestMethod.GET)
+    @RequestMapping(value = "/acceptItems", method = RequestMethod.GET)
     @ResponseBody
     public List<FxPurcAcceptItem> getPurcAcceptByItemIds(@RequestParam("enUU") Long enUU, @RequestParam("acceptItemIds") String acceptItemIds) throws UnsupportedEncodingException{
-        List<Long> ids = Arrays.asList((Long[]) ConvertUtils.convert(acceptItemIds.split(","),Long.class));
-        return usoftFxService.getPurcAcceptByItemIds(enUU,ids);
+        List<Long> ids = Arrays.asList((Long[]) ConvertUtils.convert(acceptItemIds.split(","), Long.class));
+        return usoftFxService.getPurcAcceptByItemIds(enUU, ids);
     }
 }

+ 72 - 0
src/main/java/com/uas/platform/b2b/openapi/model/CustTrading.java

@@ -0,0 +1,72 @@
+package com.uas.platform.b2b.openapi.model;
+
+/**
+ * @Author: huj
+ * @Date: Created in 10:29 2018/9/21.
+ */
+public class CustTrading {
+
+    private Long custUU;
+    private String custName;
+    private Double realAccept;
+    private String acceptPercent;
+    private Integer realNum;
+    private String numPercent;
+    private Double timeSum;
+
+    public Long getCustUU() {
+        return custUU;
+    }
+
+    public void setCustUU(Long custUU) {
+        this.custUU = custUU;
+    }
+
+    public Double getRealAccept() {
+        return realAccept;
+    }
+
+    public void setRealAccept(Double realAccept) {
+        this.realAccept = realAccept;
+    }
+
+    public String getCustName() {
+        return custName;
+    }
+
+    public void setCustName(String custName) {
+        this.custName = custName;
+    }
+
+    public String getAcceptPercent() {
+        return acceptPercent;
+    }
+
+    public void setAcceptPercent(String acceptPercent) {
+        this.acceptPercent = acceptPercent;
+    }
+
+    public Integer getRealNum() {
+        return realNum;
+    }
+
+    public void setRealNum(Integer realNum) {
+        this.realNum = realNum;
+    }
+
+    public String getNumPercent() {
+        return numPercent;
+    }
+
+    public void setNumPercent(String numPercent) {
+        this.numPercent = numPercent;
+    }
+
+    public Double getTimeSum() {
+        return timeSum;
+    }
+
+    public void setTimeSum(Double timeSum) {
+        this.timeSum = timeSum;
+    }
+}

+ 92 - 0
src/main/java/com/uas/platform/b2b/openapi/model/RecentOfMonth.java

@@ -0,0 +1,92 @@
+package com.uas.platform.b2b.openapi.model;
+
+/**
+ * @Author: huj
+ * @Date: Created in 17:06 2018/9/21.
+ */
+public class RecentOfMonth {
+
+    private String name;
+
+    private Double fourMonth;
+
+    private Double threeMonth;
+
+    private Double twoMonth;
+
+    private Double oneMonth;
+
+    private String threeMonthNum;
+
+    private String twoMonthNum;
+
+    private String oneMonthNum;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Double getFourMonth() {
+        return fourMonth;
+    }
+
+    public void setFourMonth(Double fourMonth) {
+        this.fourMonth = fourMonth;
+    }
+
+    public Double getThreeMonth() {
+        return threeMonth;
+    }
+
+    public void setThreeMonth(Double threeMonth) {
+        this.threeMonth = threeMonth;
+    }
+
+    public Double getTwoMonth() {
+        return twoMonth;
+    }
+
+    public void setTwoMonth(Double twoMonth) {
+        this.twoMonth = twoMonth;
+    }
+
+    public Double getOneMonth() {
+        return oneMonth;
+    }
+
+    public void setOneMonth(Double oneMonth) {
+        this.oneMonth = oneMonth;
+    }
+
+    public String getThreeMonthNum() {
+        return threeMonthNum;
+    }
+
+    public void setThreeMonthNum(String threeMonthNum) {
+        this.threeMonthNum = threeMonthNum;
+    }
+
+    public String getTwoMonthNum() {
+        return twoMonthNum;
+    }
+
+    public void setTwoMonthNum(String twoMonthNum) {
+        this.twoMonthNum = twoMonthNum;
+    }
+
+    public String getOneMonthNum() {
+        return oneMonthNum;
+    }
+
+    public void setOneMonthNum(String oneMonthNum) {
+        this.oneMonthNum = oneMonthNum;
+    }
+
+    public RecentOfMonth(String name) {
+        this.name = name;
+    }
+}

+ 76 - 0
src/main/java/com/uas/platform/b2b/openapi/model/RecentOfYear.java

@@ -0,0 +1,76 @@
+package com.uas.platform.b2b.openapi.model;
+
+/**
+ * @Author: huj
+ * @Date: Created in 14:14 2018/9/21.
+ */
+public class RecentOfYear {
+
+    private String name;
+
+    private Double twoYear;
+
+    private Double oneYear;
+
+    private Double thisYear;
+
+    private String oneYearNum;
+
+    private String thisYearNum;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Double getTwoYear() {
+        return twoYear;
+    }
+
+    public void setTwoYear(Double twoYear) {
+        this.twoYear = twoYear;
+    }
+
+    public Double getOneYear() {
+        return oneYear;
+    }
+
+    public void setOneYear(Double oneYear) {
+        this.oneYear = oneYear;
+    }
+
+    public Double getThisYear() {
+        return thisYear;
+    }
+
+    public void setThisYear(Double thisYear) {
+        this.thisYear = thisYear;
+    }
+
+    public String getOneYearNum() {
+        return oneYearNum;
+    }
+
+    public void setOneYearNum(String oneYearNum) {
+        this.oneYearNum = oneYearNum;
+    }
+
+    public String getThisYearNum() {
+        return thisYearNum;
+    }
+
+    public void setThisYearNum(String thisYearNum) {
+        this.thisYearNum = thisYearNum;
+    }
+
+    public RecentOfYear(String name) {
+        this.name = name;
+    }
+
+    public RecentOfYear() {
+
+    }
+}

+ 38 - 0
src/main/java/com/uas/platform/b2b/openapi/service/TradingDataService.java

@@ -0,0 +1,38 @@
+package com.uas.platform.b2b.openapi.service;
+
+import org.springframework.ui.ModelMap;
+
+/**
+ * @Author: huj
+ * @Date: Created in 15:44 2018/9/20.
+ */
+public interface TradingDataService {
+
+    /**
+     * 卖方uu
+     * @param enUU 企业uu
+     * @return
+     */
+    ModelMap getTradingSum(Long enUU);
+
+    /**
+     * 卖方uu
+     * @param enUU 企业uu
+     * @return
+     */
+    ModelMap getCustTrading(Long enUU);
+
+    /**
+     * 卖方uu
+     * @param enUU 企业uu
+     * @return
+     */
+    ModelMap getRecentOfYear(Long enUU);
+
+    /**
+     * 卖方uu
+     * @param enUU 企业uu
+     * @return
+     */
+    ModelMap getRecentOfMonth(Long enUU);
+}

+ 8 - 3
src/main/java/com/uas/platform/b2b/openapi/service/UsoftFxService.java

@@ -15,14 +15,19 @@ import java.util.List;
 public interface UsoftFxService {
 
     /**
-     * 根据企业enUU获取当前企业最近三个月(订单时间or验收单时间?)有验收单的数据,只返回有验收单的订单和订单明细
+     * 根据企业enUU获取当前企业最近三个月(订单时间)有验收单的数据,只返回有验收单的订单和订单明细
+     * @param enUU  卖方uu
+     * @param excludeItemsIds  移除的明细id
+     * @param needStartDate  开始时间
+     * @param needEndDate  结束时间
+     * @return
      */
     List<FxPurOrder> getPurcAccsptItems(Long enUU, List<Long> excludeItemsIds, Date needStartDate, Date needEndDate);
 
     /**
      * 根据验收单明细ID获取数据
-     * @param enUU
-     * @param ids
+     * @param enUU 卖方uu
+     * @param ids  验收明细id
      */
     List<FxPurcAcceptItem> getPurcAcceptByItemIds(Long enUU, List<Long> ids);
 }

+ 590 - 0
src/main/java/com/uas/platform/b2b/openapi/service/impl/TradingDataServiceImpl.java

@@ -0,0 +1,590 @@
+package com.uas.platform.b2b.openapi.service.impl;
+
+import com.uas.platform.b2b.dao.CommonDao;
+import com.uas.platform.b2b.openapi.model.CustTrading;
+import com.uas.platform.b2b.openapi.model.RecentOfMonth;
+import com.uas.platform.b2b.openapi.model.RecentOfYear;
+import com.uas.platform.b2b.openapi.service.TradingDataService;
+import com.uas.platform.b2b.openapi.support.NumFormat;
+import com.uas.platform.b2b.openapi.support.ErpRate;
+import com.uas.platform.b2b.openapi.support.TimeStauts;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.ui.ModelMap;
+import org.springframework.util.StringUtils;
+
+import java.sql.Date;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @Author: huj
+ * @Date: Created in 15:45 2018/9/20.
+ */
+@Service
+public class TradingDataServiceImpl implements TradingDataService {
+
+
+    @Autowired
+    private CommonDao commonDao;
+
+    @Override
+    public ModelMap getTradingSum(Long enUU) {
+        ModelMap map = new ModelMap();
+        // 获取累计交易时间
+        Double timeSum = getTimeSum(enUU, null);
+        // 获取累计验收金额
+        Double acceptSum = getAcceptSum(enUU, null);
+        // 获取累计验退金额
+        Double returnSum = getReturnSum(enUU, null);
+        // 获取累计实收金额
+        Double realSum = NumFormat.getTwo(acceptSum - returnSum);
+        // 获取累计对账金额
+        Double apCheckSum = getApCheckSum(enUU);
+        // 获取累计发票金额
+        Double apBillSum = getApBillSum(enUU);
+        // 获取历史退货率
+        String historyReturn = NumFormat.getPercent(returnSum / getOrderSum(enUU));
+        map.put("timeSum", timeSum);
+        map.put("acceptSum", acceptSum);
+        map.put("returnSum", returnSum);
+        map.put("realSum", realSum);
+        map.put("apCheckSum", apCheckSum);
+        map.put("apBillSum", apBillSum);
+        map.put("historyReturn", historyReturn);
+        return map;
+    }
+
+    @Override
+    public ModelMap getCustTrading(Long enUU) {
+        ModelMap map = new ModelMap();
+        List<CustTrading> datas = getCust(enUU);
+        Double sum = getAcceptSum(enUU, null) - getReturnSum(enUU, null);
+        Integer sumNum = getAcceptNum(enUU, null) - getReturnNum(enUU, null);
+        if (CollectionUtils.isNotEmpty(datas)) {
+            for (CustTrading custTrading : datas) {
+                Double acceptSum = getAcceptSum(enUU, custTrading.getCustUU());
+                Double returnSum = getReturnSum(enUU, custTrading.getCustUU());
+                custTrading.setRealAccept(NumFormat.getTwo(acceptSum - returnSum));
+                if (StringUtils.isEmpty(acceptSum) || acceptSum == 0.0) {
+                    custTrading.setAcceptPercent("0.00%");
+                } else {
+                    custTrading.setAcceptPercent(NumFormat.getPercent((acceptSum - returnSum) / sum));
+                }
+                Integer acceptNum = getAcceptNum(enUU, custTrading.getCustUU());
+                Integer realNum = acceptNum - getReturnNum(enUU, custTrading.getCustUU());
+                custTrading.setRealNum(realNum);
+                if (0 != acceptNum) {
+                    custTrading.setNumPercent(NumFormat.getPercent((double) realNum / sumNum));
+                }
+                custTrading.setTimeSum(NumFormat.getOne(getTimeSum(enUU, custTrading.getCustUU())));
+            }
+        }
+        map.put("data", datas);
+        return map;
+    }
+
+    @Override
+    public ModelMap getRecentOfYear(Long enUU) {
+        ModelMap map = new ModelMap();
+        List<RecentOfYear> years = new ArrayList<>();
+        // 有交易额客户数量
+        RecentOfYear ofYear1 = new RecentOfYear("有交易额客户数量");
+        ofYear1.setTwoYear((double) getAcceptCust(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
+        ofYear1.setOneYear((double) getAcceptCust(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
+        ofYear1.setThisYear((double) getAcceptCust(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
+        ofYear1.setOneYearNum(NumFormat.getIncrease(ofYear1.getTwoYear(), ofYear1.getOneYear()));
+        ofYear1.setThisYearNum(NumFormat.getIncrease(ofYear1.getOneYear(), ofYear1.getThisYear()));
+        years.add(ofYear1);
+        // 验收金额
+        RecentOfYear ofYear2 = new RecentOfYear("验收金额");
+        ofYear2.setTwoYear(getAcceptSumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
+        ofYear2.setOneYear(getAcceptSumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
+        ofYear2.setThisYear(getAcceptSumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
+        ofYear2.setOneYearNum(NumFormat.getIncrease(ofYear2.getTwoYear(), ofYear2.getOneYear()));
+        ofYear2.setThisYearNum(NumFormat.getIncrease(ofYear2.getOneYear(), ofYear2.getThisYear()));
+        years.add(ofYear2);
+        // 验收笔数
+        RecentOfYear ofYear3 = new RecentOfYear("验收笔数");
+        ofYear3.setTwoYear((double) getAcceptNumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
+        ofYear3.setOneYear((double) getAcceptNumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
+        ofYear3.setThisYear((double) getAcceptNumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
+        ofYear3.setOneYearNum(NumFormat.getIncrease(ofYear3.getTwoYear(), ofYear3.getOneYear()));
+        ofYear3.setThisYearNum(NumFormat.getIncrease(ofYear3.getOneYear(), ofYear3.getThisYear()));
+        years.add(ofYear3);
+        // 验退金额
+        RecentOfYear ofYear4 = new RecentOfYear("验退金额");
+        ofYear4.setTwoYear(getReturnSumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
+        ofYear4.setOneYear(getReturnSumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
+        ofYear4.setThisYear(getReturnSumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
+        ofYear4.setOneYearNum(NumFormat.getIncrease(ofYear4.getTwoYear(), ofYear4.getOneYear()));
+        ofYear4.setThisYearNum(NumFormat.getIncrease(ofYear4.getOneYear(), ofYear4.getThisYear()));
+        years.add(ofYear4);
+        // 验退笔数
+        RecentOfYear ofYear5 = new RecentOfYear("验退笔数");
+        ofYear5.setTwoYear((double) getReturnNumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
+        ofYear5.setOneYear((double) getReturnNumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
+        ofYear5.setThisYear((double) getReturnNumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
+        ofYear5.setOneYearNum(NumFormat.getIncrease(ofYear5.getTwoYear(), ofYear5.getOneYear()));
+        ofYear5.setThisYearNum(NumFormat.getIncrease(ofYear5.getOneYear(), ofYear5.getThisYear()));
+        years.add(ofYear5);
+        // 实收金额
+        RecentOfYear ofYear6 = new RecentOfYear("实收金额");
+        ofYear6.setTwoYear(ofYear2.getTwoYear() - ofYear4.getTwoYear());
+        ofYear6.setOneYear(ofYear2.getOneYear() - ofYear4.getOneYear());
+        ofYear6.setThisYear(ofYear2.getThisYear() - ofYear4.getThisYear());
+        ofYear6.setOneYearNum(NumFormat.getIncrease(ofYear6.getTwoYear(), ofYear6.getOneYear()));
+        ofYear6.setThisYearNum(NumFormat.getIncrease(ofYear6.getOneYear(), ofYear6.getThisYear()));
+        years.add(ofYear6);
+        // 实收笔数
+        RecentOfYear ofYear7 = new RecentOfYear("实收笔数");
+        ofYear7.setTwoYear(ofYear3.getTwoYear() - ofYear5.getTwoYear());
+        ofYear7.setOneYear(ofYear3.getOneYear() - ofYear5.getOneYear());
+        ofYear7.setThisYear(ofYear3.getThisYear() - ofYear5.getThisYear());
+        ofYear7.setOneYearNum(NumFormat.getIncrease(ofYear7.getTwoYear(), ofYear7.getOneYear()));
+        ofYear7.setThisYearNum(NumFormat.getIncrease(ofYear7.getOneYear(), ofYear7.getThisYear()));
+        years.add(ofYear7);
+        // 对账金额
+        RecentOfYear ofYear8 = new RecentOfYear("对账金额");
+        ofYear8.setTwoYear(getApCheckSumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
+        ofYear8.setOneYear(getApCheckSumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
+        ofYear8.setThisYear(getApCheckSumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
+        ofYear8.setOneYearNum(NumFormat.getIncrease(ofYear8.getTwoYear(), ofYear8.getOneYear()));
+        ofYear8.setThisYearNum(NumFormat.getIncrease(ofYear8.getOneYear(), ofYear8.getThisYear()));
+        years.add(ofYear8);
+        // 对账笔数
+        RecentOfYear ofYear9 = new RecentOfYear("对账笔数");
+        ofYear9.setTwoYear(getApCheckNumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
+        ofYear9.setOneYear(getApCheckNumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
+        ofYear9.setThisYear(getApCheckNumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
+        ofYear9.setOneYearNum(NumFormat.getIncrease(ofYear9.getTwoYear(), ofYear9.getOneYear()));
+        ofYear9.setThisYearNum(NumFormat.getIncrease(ofYear9.getOneYear(), ofYear9.getThisYear()));
+        years.add(ofYear9);
+        // 开票金额
+        RecentOfYear ofYear10 = new RecentOfYear("开票金额");
+        ofYear10.setTwoYear(getApBillSumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
+        ofYear10.setOneYear(getApBillSumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
+        ofYear10.setThisYear(getApBillSumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
+        ofYear10.setOneYearNum(NumFormat.getIncrease(ofYear10.getTwoYear(), ofYear10.getOneYear()));
+        ofYear10.setThisYearNum(NumFormat.getIncrease(ofYear10.getOneYear(), ofYear10.getThisYear()));
+        years.add(ofYear10);
+        // 开票笔数
+        RecentOfYear ofYear11 = new RecentOfYear("开票笔数");
+        ofYear11.setTwoYear(getApBillNumTime(enUU, NumFormat.getTwoYear(), NumFormat.getOneYear()));
+        ofYear11.setOneYear(getApBillNumTime(enUU, NumFormat.getOneYear(), NumFormat.getThisYear()));
+        ofYear11.setThisYear(getApBillNumTime(enUU, NumFormat.getThisYear(), NumFormat.getNow()));
+        ofYear11.setOneYearNum(NumFormat.getIncrease(ofYear11.getTwoYear(), ofYear11.getOneYear()));
+        ofYear11.setThisYearNum(NumFormat.getIncrease(ofYear11.getOneYear(), ofYear11.getThisYear()));
+        years.add(ofYear11);
+        map.put("data", years);
+        return map;
+    }
+
+    @Override
+    public ModelMap getRecentOfMonth(Long enUU) {
+        ModelMap map = new ModelMap();
+        Date four = NumFormat.getThreeM();
+        Date three = NumFormat.getTwoM();
+        Date two = NumFormat.getOneM();
+        Date one = NumFormat.getThisM();
+        Date now = NumFormat.getNowM();
+        List<RecentOfMonth> months = new ArrayList<>();
+        // 有交易额客户数量
+        RecentOfMonth ofMonth1 = new RecentOfMonth("有交易额客户数量");
+        ofMonth1.setFourMonth((double) getAcceptCust(enUU, four, three));
+        ofMonth1.setThreeMonth((double) getAcceptCust(enUU, three, two));
+        ofMonth1.setTwoMonth((double) getAcceptCust(enUU, two, one));
+        ofMonth1.setOneMonth((double) getAcceptCust(enUU, one, now));
+        ofMonth1.setThreeMonthNum(NumFormat.getIncrease(ofMonth1.getFourMonth(), ofMonth1.getThreeMonth()));
+        ofMonth1.setTwoMonthNum(NumFormat.getIncrease(ofMonth1.getThreeMonth(), ofMonth1.getTwoMonth()));
+        ofMonth1.setOneMonthNum(NumFormat.getIncrease(ofMonth1.getTwoMonth(), ofMonth1.getOneMonth()));
+        months.add(ofMonth1);
+        // 验收金额
+        RecentOfMonth ofMonth2 = new RecentOfMonth("验收金额");
+        ofMonth2.setFourMonth(getAcceptSumTime(enUU, four, three));
+        ofMonth2.setThreeMonth(getAcceptSumTime(enUU, three, two));
+        ofMonth2.setTwoMonth(getAcceptSumTime(enUU, two, one));
+        ofMonth2.setOneMonth(getAcceptSumTime(enUU, one, now));
+        ofMonth2.setThreeMonthNum(NumFormat.getIncrease(ofMonth2.getFourMonth(), ofMonth2.getThreeMonth()));
+        ofMonth2.setTwoMonthNum(NumFormat.getIncrease(ofMonth2.getThreeMonth(), ofMonth2.getTwoMonth()));
+        ofMonth2.setOneMonthNum(NumFormat.getIncrease(ofMonth2.getTwoMonth(), ofMonth2.getOneMonth()));
+        months.add(ofMonth2);
+        // 验收笔数
+        RecentOfMonth ofMonth3 = new RecentOfMonth("验收笔数");
+        ofMonth3.setFourMonth((double) getAcceptNumTime(enUU, four, three));
+        ofMonth3.setThreeMonth((double) getAcceptNumTime(enUU, three, two));
+        ofMonth3.setTwoMonth((double) getAcceptNumTime(enUU, two, one));
+        ofMonth3.setOneMonth((double) getAcceptNumTime(enUU, one, now));
+        ofMonth3.setThreeMonthNum(NumFormat.getIncrease(ofMonth3.getFourMonth(), ofMonth3.getThreeMonth()));
+        ofMonth3.setTwoMonthNum(NumFormat.getIncrease(ofMonth3.getThreeMonth(), ofMonth3.getTwoMonth()));
+        ofMonth3.setOneMonthNum(NumFormat.getIncrease(ofMonth3.getTwoMonth(), ofMonth3.getOneMonth()));
+        months.add(ofMonth3);
+        // 验退金额
+        RecentOfMonth ofMonth4 = new RecentOfMonth("验退金额");
+        ofMonth4.setFourMonth(getReturnSumTime(enUU, four, three));
+        ofMonth4.setThreeMonth(getReturnSumTime(enUU, three, two));
+        ofMonth4.setTwoMonth(getReturnSumTime(enUU, two, one));
+        ofMonth4.setOneMonth(getReturnSumTime(enUU, one, now));
+        ofMonth4.setThreeMonthNum(NumFormat.getIncrease(ofMonth4.getFourMonth(), ofMonth4.getThreeMonth()));
+        ofMonth4.setTwoMonthNum(NumFormat.getIncrease(ofMonth4.getThreeMonth(), ofMonth4.getTwoMonth()));
+        ofMonth4.setOneMonthNum(NumFormat.getIncrease(ofMonth4.getTwoMonth(), ofMonth4.getOneMonth()));
+        months.add(ofMonth4);
+        // 验退笔数
+        RecentOfMonth ofMonth5 = new RecentOfMonth("验退笔数");
+        ofMonth5.setFourMonth((double) getReturnNumTime(enUU, four, three));
+        ofMonth5.setThreeMonth((double) getReturnNumTime(enUU, three, two));
+        ofMonth5.setTwoMonth((double) getReturnNumTime(enUU, two, one));
+        ofMonth5.setOneMonth((double) getReturnNumTime(enUU, one, now));
+        ofMonth5.setThreeMonthNum(NumFormat.getIncrease(ofMonth5.getFourMonth(), ofMonth5.getThreeMonth()));
+        ofMonth5.setTwoMonthNum(NumFormat.getIncrease(ofMonth5.getThreeMonth(), ofMonth5.getTwoMonth()));
+        ofMonth5.setOneMonthNum(NumFormat.getIncrease(ofMonth5.getTwoMonth(), ofMonth5.getOneMonth()));
+        months.add(ofMonth5);
+        // 实收金额
+        RecentOfMonth ofMonth6 = new RecentOfMonth("实收金额");
+        ofMonth6.setFourMonth(ofMonth2.getFourMonth() - ofMonth4.getFourMonth());
+        ofMonth6.setThreeMonth(ofMonth2.getThreeMonth() - ofMonth4.getThreeMonth());
+        ofMonth6.setTwoMonth(ofMonth2.getTwoMonth() - ofMonth4.getTwoMonth());
+        ofMonth6.setOneMonth(ofMonth2.getOneMonth() - ofMonth4.getOneMonth());
+        ofMonth6.setThreeMonthNum(NumFormat.getIncrease(ofMonth6.getFourMonth(), ofMonth6.getThreeMonth()));
+        ofMonth6.setTwoMonthNum(NumFormat.getIncrease(ofMonth6.getThreeMonth(), ofMonth6.getTwoMonth()));
+        ofMonth6.setOneMonthNum(NumFormat.getIncrease(ofMonth6.getTwoMonth(), ofMonth6.getOneMonth()));
+        months.add(ofMonth6);
+        // 实收笔数
+        RecentOfMonth ofMonth7 = new RecentOfMonth("实收笔数");
+        ofMonth7.setFourMonth(ofMonth3.getFourMonth() - ofMonth5.getFourMonth());
+        ofMonth7.setThreeMonth(ofMonth3.getThreeMonth() - ofMonth5.getThreeMonth());
+        ofMonth7.setTwoMonth(ofMonth3.getTwoMonth() - ofMonth5.getTwoMonth());
+        ofMonth7.setOneMonth(ofMonth3.getOneMonth() - ofMonth5.getOneMonth());
+        ofMonth7.setThreeMonthNum(NumFormat.getIncrease(ofMonth7.getFourMonth(), ofMonth7.getThreeMonth()));
+        ofMonth7.setTwoMonthNum(NumFormat.getIncrease(ofMonth7.getThreeMonth(), ofMonth7.getTwoMonth()));
+        ofMonth7.setOneMonthNum(NumFormat.getIncrease(ofMonth7.getTwoMonth(), ofMonth7.getOneMonth()));
+        months.add(ofMonth7);
+        // 对账金额
+        RecentOfMonth ofMonth8 = new RecentOfMonth("对账金额");
+        ofMonth8.setFourMonth(getApCheckSumTime(enUU, four, three));
+        ofMonth8.setThreeMonth(getApCheckSumTime(enUU, three, two));
+        ofMonth8.setTwoMonth(getApCheckSumTime(enUU, two, one));
+        ofMonth8.setOneMonth(getApCheckSumTime(enUU, one, now));
+        ofMonth8.setThreeMonthNum(NumFormat.getIncrease(ofMonth8.getFourMonth(), ofMonth8.getThreeMonth()));
+        ofMonth8.setTwoMonthNum(NumFormat.getIncrease(ofMonth8.getThreeMonth(), ofMonth8.getTwoMonth()));
+        ofMonth8.setOneMonthNum(NumFormat.getIncrease(ofMonth8.getTwoMonth(), ofMonth8.getOneMonth()));
+        months.add(ofMonth8);
+        // 对账笔数
+        RecentOfMonth ofMonth9 = new RecentOfMonth("对账笔数");
+        ofMonth9.setFourMonth(getApCheckNumTime(enUU, four, three));
+        ofMonth9.setThreeMonth(getApCheckNumTime(enUU, three, two));
+        ofMonth9.setTwoMonth(getApCheckNumTime(enUU, two, one));
+        ofMonth9.setOneMonth(getApCheckNumTime(enUU, one, now));
+        ofMonth9.setThreeMonthNum(NumFormat.getIncrease(ofMonth9.getFourMonth(), ofMonth9.getThreeMonth()));
+        ofMonth9.setTwoMonthNum(NumFormat.getIncrease(ofMonth9.getThreeMonth(), ofMonth9.getTwoMonth()));
+        ofMonth9.setOneMonthNum(NumFormat.getIncrease(ofMonth9.getTwoMonth(), ofMonth9.getOneMonth()));
+        months.add(ofMonth9);
+        // 开票金额
+        RecentOfMonth ofMonth10 = new RecentOfMonth("开票金额");
+        ofMonth10.setFourMonth(getApBillSumTime(enUU, four, three));
+        ofMonth10.setThreeMonth(getApBillSumTime(enUU, three, two));
+        ofMonth10.setTwoMonth(getApBillSumTime(enUU, two, one));
+        ofMonth10.setOneMonth(getApBillSumTime(enUU, one, now));
+        ofMonth10.setThreeMonthNum(NumFormat.getIncrease(ofMonth10.getFourMonth(), ofMonth10.getThreeMonth()));
+        ofMonth10.setTwoMonthNum(NumFormat.getIncrease(ofMonth10.getThreeMonth(), ofMonth10.getTwoMonth()));
+        ofMonth10.setOneMonthNum(NumFormat.getIncrease(ofMonth10.getTwoMonth(), ofMonth10.getOneMonth()));
+        months.add(ofMonth10);
+        // 开票笔数
+        RecentOfMonth ofMonth11 = new RecentOfMonth("开票笔数");
+        ofMonth11.setFourMonth(getApBillNumTime(enUU, four, three));
+        ofMonth11.setThreeMonth(getApBillNumTime(enUU, three, two));
+        ofMonth11.setTwoMonth(getApBillNumTime(enUU, two, one));
+        ofMonth11.setOneMonth(getApBillNumTime(enUU, one, now));
+        ofMonth11.setThreeMonthNum(NumFormat.getIncrease(ofMonth11.getFourMonth(), ofMonth11.getThreeMonth()));
+        ofMonth11.setTwoMonthNum(NumFormat.getIncrease(ofMonth11.getThreeMonth(), ofMonth11.getTwoMonth()));
+        ofMonth11.setOneMonthNum(NumFormat.getIncrease(ofMonth11.getTwoMonth(), ofMonth11.getOneMonth()));
+        months.add(ofMonth11);
+        map.put("data", months);
+        return map;
+    }
+
+    /**
+     * 交易时间
+     * @param enUU 卖方uu
+     * @param custUU 客户uu
+     * @return 交易时间
+     */
+    private Double getTimeSum(Long enUU, Long custUU) {
+        StringBuffer last = new StringBuffer("SELECT ifnull((SELECT pu_date from purc$orders "
+                + "WHERE pu_venduu = " + enUU + " and pu_date is not null ");
+        if (!StringUtils.isEmpty(custUU)) {
+            last.append("and pu_enuu = " + custUU + "");
+        }
+        last.append(" ORDER BY pu_date desc limit 1),now()) pu_date");
+        StringBuffer first = new StringBuffer("SELECT ifnull((SELECT pu_date from purc$orders "
+                + "WHERE pu_venduu = " + enUU + " and pu_date is not null ");
+        if (!StringUtils.isEmpty(custUU)) {
+            first.append("and pu_enuu = " + custUU + "");
+        }
+        first.append(" ORDER BY pu_date asc limit 1),now()) pu_date");
+        Date lastTime = commonDao.queryForObject(last.toString(), Date.class);
+        Date firstTime = commonDao.queryForObject(first.toString(), Date.class);
+        StringBuffer result = new StringBuffer("SELECT TIMESTAMPDIFF(MONTH,'" + firstTime + "','" + lastTime + "')");
+        Double resultTime = commonDao.queryForObject(result.toString(), Double.class) / TimeStauts.TYEAR.value();
+        return NumFormat.getOne(resultTime);
+    }
+
+    /**
+     * 验收金额
+     * @param enUU 卖方uu
+     * @param custUU 客户uu
+     * @return 验收金额
+     */
+    private Double getAcceptSum(Long enUU, Long custUU) {
+        StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' "
+                + " then a.amount * " + ErpRate.USD_RATE + " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) "
+                + " result FROM (SELECT SUM(pai_qty*pai_orderprice) amount,pa_currency currency FROM purc$accept LEFT "
+                + " JOIN purc$acceptitem on pai_paid=pa_id WHERE pa_venduu= " + enUU);
+        if (!StringUtils.isEmpty(custUU)) {
+            sql.append(" and pa_enuu = " + custUU + " ");
+        }
+        sql.append(" GROUP BY pa_currency) a");
+        Double result = commonDao.queryForObject(sql.toString(), Double.class);
+        return NumFormat.getTwo(NumFormat.getTenThousand(result));
+    }
+
+    /**
+     * 验退金额
+     * @param enUU 卖方uu
+     * @param custUU 客户uu
+     * @return 验退金额
+     */
+    private Double getReturnSum(Long enUU, Long custUU) {
+        StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' "
+                + "then a.amount * " + ErpRate.USD_RATE + " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) "
+                + " result FROM (SELECT SUM(pri_qty*pri_orderprice) amount,pr_currency currency FROM purc$return "
+                + " LEFT JOIN purc$returnitem on pri_prid=pr_id WHERE pr_venduu= " + enUU);
+        if (!StringUtils.isEmpty(custUU)) {
+            sql.append(" and pr_enuu = " + custUU + " ");
+        }
+        sql.append(" GROUP BY pr_currency) a");
+        Double result = commonDao.queryForObject(sql.toString(), Double.class);
+        return NumFormat.getTwo(NumFormat.getTenThousand(result));
+    }
+
+    /**
+     * 对账金额
+     * @param enUU 卖方uu
+     * @return 对账金额
+     */
+    private Double getApCheckSum(Long enUU) {
+        StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' "
+                + "then a.amount * " + ErpRate.USD_RATE + " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) result "
+                + "FROM (select sum(pa_checkamount) amount,pa_currency currency from purc$apcheck where pa_enuu = " + enUU
+                + " and pa_checkstatus = '已确认' GROUP BY pa_currency) a");
+        Double result = commonDao.queryForObject(sql.toString(), Double.class);
+        return NumFormat.getTwo(NumFormat.getTenThousand(result));
+    }
+
+    /**
+     * 发票金额
+     * @param enUU 卖方uu
+     * @return 发票金额
+     */
+    private Double getApBillSum(Long enUU) {
+        StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' "
+                + "then a.amount * " + ErpRate.USD_RATE + " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) result "
+                + "FROM (SELECT SUM(pab_paymount) amount,pab_currency currency FROM purc$apbill WHERE pad_venduu=" + enUU
+                + " GROUP BY pab_currency) a");
+        Double result = commonDao.queryForObject(sql.toString(), Double.class);
+        return NumFormat.getTwo(NumFormat.getTenThousand(result));
+    }
+
+    /**
+     * 订单金额
+     * @param enUU 卖方uu
+     * @return 订单金额
+     */
+    private Double getOrderSum(Long enUU) {
+        StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' "
+                + "then a.amount * " + ErpRate.USD_RATE + " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) result "
+                + "FROM (SELECT sum(pd_price*pd_qty) amount,pu_currency currency FROM purc$orders LEFT JOIN purc$orderitems "
+                + "on pu_id=pd_puid where pu_venduu = " + enUU + " GROUP BY pu_currency) a");
+        Double result = commonDao.queryForObject(sql.toString(), Double.class);
+        return NumFormat.getTwo(NumFormat.getTenThousand(result));
+    }
+
+    /**
+     * 客户
+     * @param enUU 卖方uu
+     * @return 客户
+     */
+    private List<CustTrading> getCust(Long enUU) {
+        StringBuffer sql = new StringBuffer("SELECT en_uu custUU,en_name custName FROM sec$enterprises WHERE en_uu in "
+                + "(SELECT ve_myenuu FROM purc$vendors WHERE ve_vendenuu= " + enUU + " ) ORDER BY en_name");
+        return commonDao.query(sql.toString(), CustTrading.class);
+    }
+
+    /**
+     * 验收笔数
+     * @param enUU 卖方uu
+     * @param custUU 客户uu
+     * @return 验收笔数
+     */
+    private Integer getAcceptNum(Long enUU, Long custUU) {
+        StringBuffer sql = new StringBuffer("SELECT COUNT(1) FROM purc$accept WHERE pa_venduu= " + enUU);
+        if (!StringUtils.isEmpty(custUU)) {
+            sql.append(" AND pa_enuu=" + custUU);
+        }
+        Integer result = commonDao.queryForObject(sql.toString(), Integer.class);
+        return result;
+    }
+
+    /**
+     * 验退金额
+     * @param enUU 卖方uu
+     * @param custUU 客户uu
+     * @return 验退金额
+     */
+    private Integer getReturnNum(Long enUU, Long custUU) {
+        StringBuffer sql = new StringBuffer("SELECT COUNT(1) FROM purc$return  WHERE pr_venduu= " + enUU);
+        if (!StringUtils.isEmpty(custUU)) {
+            sql.append(" and pr_enuu= " + custUU);
+        }
+        Integer result = commonDao.queryForObject(sql.toString(), Integer.class);
+        return result;
+    }
+
+    /**
+     * 有交易客户数
+     * @param enUU 卖方uu
+     * @param startTime 起始时间
+     * @param endTime 终止时间
+     * @return 有交易客户数
+     */
+    private Integer getAcceptCust(Long enUU, Date startTime, Date endTime) {
+        StringBuffer sql = new StringBuffer("SELECT COUNT(DISTINCT pu_enuu) from purc$orders WHERE pu_venduu= " + enUU
+                + " AND pu_date >= '" + startTime + "' and pu_date < " + "'" + endTime + "'");
+        Integer result = commonDao.queryForObject(sql.toString(), Integer.class);
+        return result;
+    }
+
+    /**
+     * 验收金额
+     * @param enUU 卖方uu
+     * @param startTime 起始时间
+     * @param endTime 终止时间
+     * @return  验收金额
+     */
+    private Double getAcceptSumTime(Long enUU, Date startTime, Date endTime) {
+        StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' "
+                + "then a.amount * " + ErpRate.USD_RATE + " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) result "
+                + "FROM (SELECT SUM(pai_qty*pai_orderprice) amount,pa_currency currency FROM purc$accept LEFT JOIN purc$acceptitem "
+                + "on pai_paid=pa_id WHERE pa_venduu= " + enUU + " and pa_date >= '" + startTime + "' and pa_date < " + "'" + endTime + "'"
+                + " GROUP BY pa_currency) a");
+        Double result = commonDao.queryForObject(sql.toString(), Double.class);
+        return NumFormat.getTwo(result);
+    }
+
+    /**
+     * 验退金额
+     * @param enUU 卖方uu
+     * @param startTime 起始时间
+     * @param endTime 终止时间
+     * @return 验退金额
+     */
+    private Double getReturnSumTime(Long enUU, Date startTime, Date endTime) {
+        StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' "
+                + "then a.amount * " + ErpRate.USD_RATE + " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) result "
+                + "FROM (SELECT SUM(pri_qty*pri_orderprice) amount,pr_currency currency FROM purc$return LEFT JOIN purc$returnitem "
+                + "on pri_prid=pr_id WHERE pr_venduu= " + enUU + " and pr_date >= '" + startTime + "' and pr_date < " + "'" + endTime + "'"
+                + " GROUP BY pr_currency) a");
+        Double result = commonDao.queryForObject(sql.toString(), Double.class);
+        return NumFormat.getTwo(result);
+    }
+
+    /**
+     * 验收笔数
+     * @param enUU 卖方uu
+     * @param startTime 起始时间
+     * @param endTime 终止时间
+     * @return 验收笔数
+     */
+    private Integer getAcceptNumTime(Long enUU, Date startTime, Date endTime) {
+        StringBuffer sql = new StringBuffer("SELECT COUNT(1) FROM purc$accept WHERE pa_venduu= " + enUU
+                + " and pa_date >= '" + startTime + "' and pa_date < " + "'" + endTime + "'");
+        Integer result = commonDao.queryForObject(sql.toString(), Integer.class);
+        return result;
+    }
+
+    /**
+     * 验退笔数
+     * @param enUU 卖方uu
+     * @param startTime 起始时间
+     * @param endTime 终止时间
+     * @return 验退笔数
+     */
+    private Integer getReturnNumTime(Long enUU, Date startTime, Date endTime) {
+        StringBuffer sql = new StringBuffer("SELECT COUNT(1) FROM purc$return  WHERE pr_venduu= " + enUU
+                + " and pr_date >= '" + startTime + "' and pr_date < " + "'" + endTime + "'");
+        Integer result = commonDao.queryForObject(sql.toString(), Integer.class);
+        return result;
+    }
+
+    /**
+     * 对账金额
+     * @param enUU 卖方uu
+     * @param startTime 起始时间
+     * @param endTime 终止时间
+     * @return 对账金额
+     */
+    private Double getApCheckSumTime(Long enUU, Date startTime, Date endTime) {
+        StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' "
+                + " then a.amount * " + ErpRate.USD_RATE + " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) result "
+                + " FROM (select sum(pa_checkamount) amount,pa_currency currency from purc$apcheck where pa_enuu = " + enUU
+                + " and pa_checkstatus = '已确认' and pa_recorddate >= '" + startTime + "' and pa_recorddate < '" + endTime + "'"
+                + " GROUP BY pa_currency) a");
+        Double result = commonDao.queryForObject(sql.toString(), Double.class);
+        return NumFormat.getTwo(result);
+    }
+
+    /**
+     * 对账笔数
+     * @param enUU 卖方uu
+     * @param startTime 起始时间
+     * @param endTime 终止时间
+     * @return 对账笔数
+     */
+    private Double getApCheckNumTime(Long enUU, Date startTime, Date endTime) {
+        StringBuffer sql = new StringBuffer("SELECT COUNT(1) from purc$apcheck where pa_enuu = " + enUU
+                + " and pa_checkstatus = '已确认' and pa_recorddate >= '" + startTime + "' and pa_recorddate < '" + endTime + "'");
+        Double result = commonDao.queryForObject(sql.toString(), Double.class);
+        return NumFormat.getTwo(result);
+    }
+
+    /**
+     * 发票金额
+     * @param enUU 卖方uu
+     * @param startTime 起始时间
+     * @param endTime 终止时间
+     * @return 发票金额
+     */
+    private Double getApBillSumTime(Long enUU, Date startTime, Date endTime) {
+        StringBuffer sql = new StringBuffer("SELECT sum(case currency when 'RMB' then a.amount when 'USD' "
+                + "then a.amount * " + ErpRate.USD_RATE + " when 'HKD' then a.amount * " + ErpRate.HKD_RATE + " end) result "
+                + "FROM (SELECT SUM(pab_paymount) amount,pab_currency currency FROM purc$apbill WHERE pad_venduu=" + enUU
+                + " and pab_date >= '" + startTime + "' and pab_date < '" + endTime + "' GROUP BY pab_currency) a");
+        Double result = commonDao.queryForObject(sql.toString(), Double.class);
+        return NumFormat.getTwo(result);
+    }
+
+    /**
+     * 发票笔数
+     * @param enUU 卖方uu
+     * @param startTime 起始时间
+     * @param endTime 终止时间
+     * @return 发票笔数
+     */
+    private Double getApBillNumTime(Long enUU, Date startTime, Date endTime) {
+        StringBuffer sql = new StringBuffer("SELECT COUNT(1) from purc$apbill WHERE pad_venduu=" + enUU
+                + " and pab_date >= '" + startTime + "' and pab_date < " + "'" + endTime + "'");
+        Double result = commonDao.queryForObject(sql.toString(), Double.class);
+        return NumFormat.getTwo(result);
+    }
+}

+ 10 - 10
src/main/java/com/uas/platform/b2b/openapi/service/impl/UsoftFxServiceImpl.java

@@ -32,8 +32,8 @@ public class UsoftFxServiceImpl implements UsoftFxService{
      * 根据企业enUU获取当前企业最近三个月(订单时间or验收单时间?)有验收单的数据,只返回有验收单的订单和订单明细
      */
     @Override
-    public List<FxPurOrder> getPurcAccsptItems(Long enUU, List<Long> excludeItemsIds, Date needStartDate,Date needEndDate) {
-        List<PurchaseAcceptItem> acceptItems = acceptItemDao.findPurcAccsptItems(enUU,needStartDate,needEndDate);
+    public List<FxPurOrder> getPurcAccsptItems(Long enUU, List<Long> excludeItemsIds, Date needStartDate, Date needEndDate) {
+        List<PurchaseAcceptItem> acceptItems = acceptItemDao.findPurcAccsptItems(enUU, needStartDate, needEndDate);
         if (!CollectionUtils.isEmpty(excludeItemsIds)) {
             Iterator<PurchaseAcceptItem> item = acceptItems.iterator();
             while (item.hasNext()) {
@@ -63,25 +63,25 @@ public class UsoftFxServiceImpl implements UsoftFxService{
                 boolean exitOrderItem = false;
                 for (PurchaseOrderItem orderItem1 : orderItems) {
                     if (orderItem.getId().equals(orderItem1.getId())) {
-                        exitOrderItem =true;
+                        exitOrderItem = true;
                     }
                 }
                 orderItems.add(orderItem);
                 // 不存在该订单,则新增
                 if (!exit) {
-                    fxPurOrders.add(new FxPurOrder(order,orderItem,needAcceptItem));
+                    fxPurOrders.add(new FxPurOrder(order, orderItem, needAcceptItem));
                 } else {
                     // 存在则找出该订单
                     for (FxPurOrder fxPurOrder : fxPurOrders) {
                         if (order.getId().equals(fxPurOrder.getId())) {
                             // 不存在该明细,新增
                             if (!exitOrderItem) {
-                                Double orderItemAmout = 0d ;
+                                Double orderItemAmout = 0d;
                                 if (!StringUtils.isEmpty(orderItem.getQty()) && !StringUtils.isEmpty(orderItem.getPrice())) {
-                                    orderItemAmout = orderItem.getQty()*orderItem.getPrice();
+                                    orderItemAmout = orderItem.getQty() * orderItem.getPrice();
                                 }
                                 fxPurOrder.setTotal(fxPurOrder.getTotal() + orderItemAmout);
-                                fxPurOrder.getOrderItems().add(new FxPurcOrderItem(orderItem,needAcceptItem));
+                                fxPurOrder.getOrderItems().add(new FxPurcOrderItem(orderItem, needAcceptItem));
                             } else {
                                 // 存在该明细,找出并把验收明细插入到该明细
                                 for (FxPurcOrderItem fxPurcOrderItem :fxPurOrder.getOrderItems()) {
@@ -104,11 +104,11 @@ public class UsoftFxServiceImpl implements UsoftFxService{
      * @param ids
      */
     @Override
-    public List<FxPurcAcceptItem> getPurcAcceptByItemIds(Long enUU,List<Long> ids){
-        List<PurchaseAcceptItem> acceptItems = acceptItemDao.findPurcAcceptByItemIds(enUU,ids);
+    public List<FxPurcAcceptItem> getPurcAcceptByItemIds(Long enUU, List<Long> ids){
+        List<PurchaseAcceptItem> acceptItems = acceptItemDao.findPurcAcceptByItemIds(enUU, ids);
         List<FxPurcAcceptItem> fxPurcAcceptItems = new ArrayList<>();
         for (PurchaseAcceptItem item : acceptItems) {
-            fxPurcAcceptItems.add(new FxPurcAcceptItem().convert(item,item.getOrderItem(),item.getOrderItem().getOrder()));
+            fxPurcAcceptItems.add(new FxPurcAcceptItem().convert(item, item.getOrderItem(), item.getOrderItem().getOrder()));
         }
         return fxPurcAcceptItems;
     }

+ 19 - 0
src/main/java/com/uas/platform/b2b/openapi/support/ErpRate.java

@@ -0,0 +1,19 @@
+package com.uas.platform.b2b.openapi.support;
+
+/**
+ * 应收宝汇率
+ * @Author: huj
+ * @Date: Created in 17:59 2018/9/20.
+ */
+public class ErpRate {
+
+    /**
+     * 美元汇率
+     */
+    public static final Double USD_RATE = 6.85;
+
+    /**
+     * 港币汇率
+     */
+    public static final Double HKD_RATE = 0.87;
+}

+ 141 - 0
src/main/java/com/uas/platform/b2b/openapi/support/NumFormat.java

@@ -0,0 +1,141 @@
+package com.uas.platform.b2b.openapi.support;
+
+import org.springframework.util.StringUtils;
+
+import java.text.DecimalFormat;
+import java.text.NumberFormat;
+import java.util.Calendar;
+import java.util.Date;
+
+/**
+ * @Author: huj
+ * @Date: Created in 16:55 2018/9/20.
+ */
+public class NumFormat {
+
+    public static Double getTenThousand(Double result) {
+        if (StringUtils.isEmpty(result)) {
+            return getTwo(result);
+        } else {
+            return result / 10000;
+        }
+    }
+
+    public static Double getOne(Double result) {
+        DecimalFormat df = new DecimalFormat("#.0");
+        if (StringUtils.isEmpty(result)) {
+            return 0.00;
+        } else {
+            return Double.parseDouble(df.format(result));
+        }
+    }
+
+    public static Double getTwo(Double result) {
+        DecimalFormat df = new DecimalFormat("#.00");
+        if (StringUtils.isEmpty(result)) {
+            return 0.00;
+        } else {
+            return Double.parseDouble(df.format(result));
+        }
+    }
+
+    public static String getPercent(Double result) {
+        NumberFormat nt = NumberFormat.getPercentInstance();
+        //设置百分数精确度2即保留两位小数
+        nt.setMinimumFractionDigits(2);
+        return nt.format(result);
+    }
+
+    public static java.sql.Date getTwoYear() {
+        Date date = getDayStartYear();
+        Calendar ca = Calendar.getInstance();
+        ca.setTime(date);
+        ca.add(Calendar.YEAR, -2);
+        return new java.sql.Date(ca.getTime().getTime());
+    }
+
+    public static java.sql.Date getOneYear() {
+        Date date = getDayStartYear();
+        Calendar ca = Calendar.getInstance();
+        ca.setTime(date);
+        ca.add(Calendar.YEAR, -1);
+        return new java.sql.Date(ca.getTime().getTime());
+    }
+
+    public static java.sql.Date getThisYear() {
+        return new java.sql.Date(getDayStartYear().getTime());
+    }
+
+    public static java.sql.Date getNow() {
+        Calendar ca = Calendar.getInstance();
+        ca.setTime(new Date());
+        return new java.sql.Date(ca.getTime().getTime());
+    }
+
+    public static String getIncrease(Double last, Double now) {
+        if ((last != 0.0) && (now != 0.0)) {
+            return NumFormat.getPercent(now / last - 1);
+        }
+        if (last == 0.0 && now != 0.0) {
+            return NumFormat.getPercent(now);
+        }
+        if (last != 0.0 && now == 0.0) {
+            return NumFormat.getPercent(-last);
+        }
+        return "0%";
+    }
+
+    public static java.sql.Date getThreeM() {
+        Calendar ca = Calendar.getInstance();
+        ca.setTime(getDayStartMon());
+        ca.add(Calendar.MONTH, -4);
+        return new java.sql.Date(ca.getTime().getTime());
+    }
+
+    public static java.sql.Date getTwoM() {
+        Calendar ca = Calendar.getInstance();
+        ca.setTime(getDayStartMon());
+        ca.add(Calendar.MONTH, -3);
+        return new java.sql.Date(ca.getTime().getTime());
+    }
+
+    public static java.sql.Date getOneM() {
+        Calendar ca = Calendar.getInstance();
+        ca.setTime(getDayStartMon());
+        ca.add(Calendar.MONTH, -2);
+        return new java.sql.Date(ca.getTime().getTime());
+    }
+
+    public static java.sql.Date getThisM() {
+        Calendar ca = Calendar.getInstance();
+        ca.setTime(getDayStartMon());
+        ca.add(Calendar.MONTH, -1);
+        return new java.sql.Date(ca.getTime().getTime());
+    }
+
+    public static java.sql.Date getNowM() {
+        return new java.sql.Date(getDayStartMon().getTime());
+    }
+
+
+    public static Date getDayStartYear() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.MONTH, 0);
+        calendar.set(Calendar.DATE, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        return calendar.getTime();
+    }
+
+    public static Date getDayStartMon() {
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.DATE, 1);
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        return calendar.getTime();
+    }
+}

+ 21 - 0
src/main/java/com/uas/platform/b2b/openapi/support/TimeStauts.java

@@ -0,0 +1,21 @@
+package com.uas.platform.b2b.openapi.support;
+
+/**
+ * @Author: huj
+ * @Date: Created in 16:41 2018/9/20.
+ */
+public enum TimeStauts{
+
+    TYEAR(12),
+    TMONTH(12);
+
+    private final int value;
+
+    private TimeStauts(int value) {
+        this.value = value;
+    }
+
+    public int value() {
+        return this.value;
+    }
+}

+ 13 - 1
src/main/java/com/uas/platform/b2b/service/UserService.java

@@ -1,6 +1,10 @@
 package com.uas.platform.b2b.service;
 
-import com.uas.platform.b2b.model.*;
+import com.uas.platform.b2b.model.Enterprise;
+import com.uas.platform.b2b.model.SearchFilter;
+import com.uas.platform.b2b.model.User;
+import com.uas.platform.b2b.model.UserInfo;
+import com.uas.platform.b2b.model.Vendor;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.search.b2b.model.SPage;
 
@@ -346,4 +350,12 @@ public interface UserService {
 	 * @throws Exception
 	 */
 	void postToAccountCenter(User user) throws Exception ;
+
+    /**
+     * 通过用户UU查询用户信息
+     *
+     * @param userUUList 用户UU号
+     * @return List<User>
+     */
+    List<User> findByUserUUList(List<Long> userUUList);
 }

+ 2 - 1
src/main/java/com/uas/platform/b2b/service/impl/ErpProdIODetailServiceImpl.java

@@ -75,7 +75,8 @@ public class ErpProdIODetailServiceImpl implements ErpProdIODetailService {
 	    StringBuffer sql = new StringBuffer("select  mr_code as inoutno, mr_date as pidate, mr_rate as rate, mr_receivecode as receivecode, " +
                 "mr_receivename as receivename, '客户委外验退单' as piclass, 'make$returnitem' as sourcetable, ma_code as ordercode, 0 as orderdetno, " +
                 "mri_number as detno,  (-(1) *  mri_qty ) as qty, mri_orderpice as orderprice, mr_currency as currency, mri_taxrate as taxrate, " +
-                "mri_whname as whname, mri_ycheckqty as ycheckqty, pr_code as prodcode, pr_spec as prodspec, pr_title as prodtitle, pr_unit as produnit, " +
+                "mri_whname as whname, mri_ycheckqty as ycheckqty, make$orders.pr_code as prodcode, make$orders.pr_spec as prodspec, " +
+                "make$orders.pr_title as prodtitle, make$orders.pr_unit as produnit, " +
                 "((-(1) *  mri_qty ) - coalesce(mri_ycheckqty, 0)) as thischeckqty, mr_enuu as custuu, ma_useruu custuseruu, mr_venduu as enuu, mri_id as sourceid, " +
                 "mr_sendcode as sendcode, ma_factory as pd_factory, en_name custname from make$return  " +
                 "join make$returnitem on mr_id =  mri_paid " +

+ 54 - 11
src/main/java/com/uas/platform/b2b/service/impl/UserServiceImpl.java

@@ -1,11 +1,27 @@
 package com.uas.platform.b2b.service.impl;
 
 import com.uas.message.mail.service.MailService;
-import com.uas.platform.b2b.dao.*;
-import com.uas.platform.b2b.model.*;
+import com.uas.platform.b2b.dao.CommonDao;
+import com.uas.platform.b2b.dao.DistributeDao;
+import com.uas.platform.b2b.dao.EnterpriseDao;
+import com.uas.platform.b2b.dao.UserDao;
+import com.uas.platform.b2b.dao.VendorDao;
+import com.uas.platform.b2b.model.Distribute;
+import com.uas.platform.b2b.model.Enterprise;
+import com.uas.platform.b2b.model.Role;
+import com.uas.platform.b2b.model.SearchFilter;
+import com.uas.platform.b2b.model.User;
+import com.uas.platform.b2b.model.UserInfo;
+import com.uas.platform.b2b.model.Vendor;
 import com.uas.platform.b2b.service.UserService;
 import com.uas.platform.b2b.service.VendorService;
-import com.uas.platform.b2b.support.*;
+import com.uas.platform.b2b.support.CommBufferedLogger;
+import com.uas.platform.b2b.support.MessageConf;
+import com.uas.platform.b2b.support.SPageUtils;
+import com.uas.platform.b2b.support.SendMailService;
+import com.uas.platform.b2b.support.SystemSession;
+import com.uas.platform.b2b.support.TokenService;
+import com.uas.platform.b2b.support.UsageBufferedLogger;
 import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.exception.SystemException;
 import com.uas.platform.core.logging.BufferedLoggerManager;
@@ -26,7 +42,14 @@ import org.springframework.util.StringUtils;
 
 import javax.servlet.http.HttpServletRequest;
 import java.text.SimpleDateFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * @since 2016-9-26 21:18:35 账户中心统一管理;部分功能保留,但转移到v2目录
@@ -316,12 +339,7 @@ public class UserServiceImpl implements UserService {
 				}
 			}
 		}
-		userInfos.setTotalPage(users.getTotalPages());
-		userInfos.setSize(users.getSize());
-		userInfos.setPage(users.getNumber());
-		userInfos.setTotalElement(users.getTotalElements());
-		userInfos.setContent(users.getContent());
-		return userInfos;
+		return SPageUtils.covertSPage(users);
 	}
 
 	private Page<User> getUsersByPage(final PageInfo pageInfo, String keyword) {
@@ -365,7 +383,32 @@ public class UserServiceImpl implements UserService {
 		AccountUtils.saveUser(detail, null);
 	}
 
-	static final String defaultPassword = "111111";
+    /**
+     * 通过用户UU查询用户信息
+     *
+     * @param userUUList 用户UU号
+     * @return List<User>
+     */
+    @Override
+    public List<User> findByUserUUList(List<Long> userUUList) {
+        List<User> users = userDao.findAll(userUUList);
+        users.forEach(user -> {
+            Set<Role> roles = user.getRoles();
+            Long enUU = SystemSession.getUser().getEnterprise().getUu();
+            if (!CollectionUtils.isEmpty(roles)) {
+                Iterator<Role> iterator = roles.iterator();
+                while (iterator.hasNext()) {
+                    Role role = iterator.next();
+                    if (!role.getEnUU().equals(enUU)) {
+                        iterator.remove();
+                    }
+                }
+            }
+        });
+        return users;
+    }
+
+    static final String defaultPassword = "111111";
 
 	@Override
 	public User addUser(User user, HttpServletRequest request) {

+ 12 - 7
src/main/webapp/resources/js/index/app.js

@@ -10107,14 +10107,19 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
             //保存生成的应收对账单
             $scope.saveApCheck = function () {
-                FaApCheck.saveApCheck({}, $scope.apCheck, function (data) {
+                if ($scope.apCheck.items.length == 0) {
                     $scope.loading = false;
-                    toaster.pop('success', '成功', '生成应收对账成功');
-                    $state.go('fa.apCheck_detail', {id: data.id}, {reload: true});
-                }, function (response) {
-                    $scope.loading = false;
-                    toaster.pop('error', '生成对账单失败', response.data);
-                })
+                    toaster.pop('error', '请先选择需要对账的数据');
+                } else {
+                    FaApCheck.saveApCheck({}, $scope.apCheck, function (data) {
+                        $scope.loading = false;
+                        toaster.pop('success', '成功', '生成应收对账成功');
+                        $state.go('fa.apCheck_detail', {id: data.id}, {reload: true});
+                    }, function (response) {
+                        $scope.loading = false;
+                        toaster.pop('error', '生成对账单失败', response.data);
+                    })
+                }
             };
 
             //如果是同一家客户,生成对账单的同时,关闭模态框