Selaa lähdekoodia

Merge branch 'feature-hejq-201844' into dev

wangcz 7 vuotta sitten
vanhempi
commit
e2575a5fdf
51 muutettua tiedostoa jossa 1351 lisäystä ja 667 poistoa
  1. 4 15
      pom.xml
  2. 26 27
      src/main/java/com/uas/platform/b2b/controller/SaleApCheckController.java
  3. 29 46
      src/main/java/com/uas/platform/b2b/controller/UserController.java
  4. 20 7
      src/main/java/com/uas/platform/b2b/controller/VendorDistributeController.java
  5. 74 0
      src/main/java/com/uas/platform/b2b/core/util/DateUtils.java
  6. 42 10
      src/main/java/com/uas/platform/b2b/dao/DistributeDao.java
  7. 50 0
      src/main/java/com/uas/platform/b2b/dao/UserBaseInfoDao.java
  8. 9 0
      src/main/java/com/uas/platform/b2b/dao/VendorDistributeDao.java
  9. 1 1
      src/main/java/com/uas/platform/b2b/filter/SSOInterceptor.java
  10. 13 0
      src/main/java/com/uas/platform/b2b/model/ApcheckKeyWord.java
  11. 54 0
      src/main/java/com/uas/platform/b2b/model/ErpProdIo.java
  12. 44 0
      src/main/java/com/uas/platform/b2b/model/OrderRedDotDone.java
  13. 6 7
      src/main/java/com/uas/platform/b2b/model/User.java
  14. 30 0
      src/main/java/com/uas/platform/b2b/model/Vendor.java
  15. 50 34
      src/main/java/com/uas/platform/b2b/model/util/UnCheckedCountSqls.java
  16. 15 0
      src/main/java/com/uas/platform/b2b/publicapi/model/TradeCount.java
  17. 2 2
      src/main/java/com/uas/platform/b2b/service/ErpProdIODetailService.java
  18. 26 1
      src/main/java/com/uas/platform/b2b/service/PurchaseApCheckService.java
  19. 7 6
      src/main/java/com/uas/platform/b2b/service/UserService.java
  20. 24 4
      src/main/java/com/uas/platform/b2b/service/VendorService.java
  21. 16 2
      src/main/java/com/uas/platform/b2b/service/impl/ErpProdIODetailServiceImpl.java
  22. 7 5
      src/main/java/com/uas/platform/b2b/service/impl/OrderRedDotServiceImpl.java
  23. 175 21
      src/main/java/com/uas/platform/b2b/service/impl/PurchaseApCheckServiceImpl.java
  24. 43 44
      src/main/java/com/uas/platform/b2b/service/impl/UserServiceImpl.java
  25. 68 45
      src/main/java/com/uas/platform/b2b/service/impl/VendorsServiceImpl.java
  26. 21 21
      src/main/java/com/uas/platform/b2b/task/SendNoticeTask.java
  27. 8 8
      src/main/resources/dev/account.properties
  28. 2 2
      src/main/resources/dev/jdbc.properties
  29. 1 1
      src/main/resources/dev/redis.properties
  30. 6 6
      src/main/resources/dev/sys.properties
  31. 6 6
      src/main/resources/ptest/account.properties
  32. 1 1
      src/main/resources/ptest/jdbc.properties
  33. 2 2
      src/main/resources/ptest/sys.properties
  34. 0 26
      src/main/resources/test/account.properties
  35. 0 3
      src/main/resources/test/dubbo.properties
  36. 0 5
      src/main/resources/test/email.properties
  37. 0 45
      src/main/resources/test/jdbc.properties
  38. 0 18
      src/main/resources/test/message.properties
  39. 0 2
      src/main/resources/test/redis.properties
  40. 0 28
      src/main/resources/test/sys.properties
  41. BIN
      src/main/webapp/resources/img/vendor/images/arrow-left-d-l.png
  42. BIN
      src/main/webapp/resources/img/vendor/images/arrow-right-d-l.png
  43. BIN
      src/main/webapp/resources/img/vendor/images/backIcon.png
  44. 6 8
      src/main/webapp/resources/js/common/services.js
  45. 236 87
      src/main/webapp/resources/js/index/app.js
  46. 0 2
      src/main/webapp/resources/js/index/services/Fa.js
  47. 6 16
      src/main/webapp/resources/tpl/index/account/add_userInfo.html
  48. 10 20
      src/main/webapp/resources/tpl/index/account/transfer_userInfo.html
  49. 1 1
      src/main/webapp/resources/tpl/index/baseInfo/modal/quotation_modal.html
  50. 1 1
      src/main/webapp/resources/tpl/index/common/header.html
  51. 209 81
      src/main/webapp/resources/tpl/index/fa/apCheck.html

+ 4 - 15
pom.xml

@@ -12,7 +12,10 @@
     </parent>
     <profiles>
         <profile>
-
+            <!-- 默认 -->
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
             <!-- 开发环境 -->
             <id>dev</id>
             <properties>
@@ -21,16 +24,6 @@
                 <static-path>static</static-path>
             </properties>
         </profile>
-        <profile>
-            <!-- 测试环境 -->
-            <id>test</id>
-            <properties>
-                <profile>test</profile>
-                <!-- static plugin -->
-                <static-path>static</static-path>
-            </properties>
-
-        </profile>
         <profile>
             <!-- 生产环境 -->
             <id>ptest</id>
@@ -50,10 +43,6 @@
             </properties>
         </profile>
         <profile>
-            <!-- 默认 -->
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
             <!-- 预部署环境 -->
             <id>pre</id>
             <properties>

+ 26 - 27
src/main/java/com/uas/platform/b2b/controller/SaleApCheckController.java

@@ -3,6 +3,7 @@ package com.uas.platform.b2b.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.uas.platform.b2b.model.ApcheckKeyWord;
 import com.uas.platform.b2b.model.ErpProdIODetail;
+import com.uas.platform.b2b.model.ErpProdIo;
 import com.uas.platform.b2b.model.OrderType;
 import com.uas.platform.b2b.model.PurchaseApCheck;
 import com.uas.platform.b2b.model.PurchaseApCheckItem;
@@ -182,10 +183,10 @@ public class SaleApCheckController {
 	 * 
 	 * @param fromDate 开始时间
 	 * @param endDate 截止时间
-	 * @return List<ErpProdIODetail>
+	 * @return List<ErpProdIo>
 	 */
 	@RequestMapping(value = "/getAllByKeywords", method = RequestMethod.GET)
-	public List<ErpProdIODetail> getAllApchecksByDate(Long fromDate, Long endDate, ApcheckKeyWord searchKeyWord, String checkDate) {
+	public ErpProdIo getAllApchecksByDate(Long fromDate, Long endDate, ApcheckKeyWord searchKeyWord, String checkDate) {
 		List<Long> distributes = null;
 		// 判断当前用户是否被客户分配
 		if (!SystemSession.getUser().isSys()) {
@@ -206,11 +207,14 @@ public class SaleApCheckController {
      * 获取客户
      * @param keyword 关键字
      * @param params 分页参数
+     * @param checkDate 筛选月份
      * @return 符合条件的客户信息
      */
     @RequestMapping(value = "/customer", method = RequestMethod.GET)
-    public SPage<Vendor> getCustomers(PageParams params, String keyword) {
-        return purchaseApCheckService.getCustomerInfo(params, keyword);
+    public SPage<Vendor> getCustomers(PageParams params, String keyword, String checkDate, String searchFilter) {
+        logger.log("应收对账单", "获取客户信息", "获取所有符合条件的客户");
+        SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
+        return purchaseApCheckService.getCustomerInfo(params, keyword, checkDate, filter.getFromDate(), filter.getEndDate());
     }
 
 	/**
@@ -363,12 +367,11 @@ public class SaleApCheckController {
 	 */
 	@RequestMapping(value = "/info/search", params = RequestState.DONE, method = RequestMethod.GET)
 	public SPage<PurchaseApCheck> getDoneApChecks(PageParams params, String searchFilter) {
-		logger.log("应收对账单", "获取已确认应收对账单");
+		logger.log("应收对账单", "获取已对账应收对账单");
         SearchFilter filter = JSONObject.parseObject(searchFilter, SearchFilter.class);
         if (StringUtils.isEmpty(filter.getKeyword())) {
             PageInfo pageInfo = new PageInfo(params);
             pageInfo.filter("enUu", SystemSession.getUser().getEnterprise().getUu());
-            pageInfo.filter("checkStatus", "已确认");
             SearchFilter distribute = userService.distribute();
             if (distribute != null && distribute.getDistribute() == null) {
                 return null;
@@ -376,10 +379,18 @@ public class SaleApCheckController {
             if (distribute != null && !CollectionUtils.isEmpty(distribute.getDistribute())) {
                 filter.setDistribute(distribute.getDistribute());
             }
+            SimpleExpression agreed = new SimpleExpression("checkStatus", "已确认", CriterionExpression.Operator.EQ, true);
+            SimpleExpression haveDone = new SimpleExpression("checkStatus", "未对账", CriterionExpression.Operator.EQ, true);
+            SimpleExpression[] expressions = new SimpleExpression[]{agreed, haveDone};
+            LogicalExpression logical = new LogicalExpression(expressions, CriterionExpression.Operator.OR);
+            pageInfo.orExpression(logical);
             return SPageUtils.covertSPage(purchaseApCheckService.findAllByPageInfo(pageInfo, null, filter));
         }
 		com.uas.search.b2b.model.PageParams pageParams = distribute(params, searchFilter);
-		pageParams.getFilters().put("pa_checkstatus", "已确认");
+        List<Object> objectList = new ArrayList<>();
+        objectList.add("已确认");
+        objectList.add("未对账");
+		pageParams.getFilters().put("pa_checkstatus", new MultiValue(objectList, true));
 		return searchService.searchPurchaseApCheckIds(filter.getKeyword(), pageParams);
 	}
 
@@ -486,10 +497,10 @@ public class SaleApCheckController {
 		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
 		ModelAndView modelAndView = new ModelAndView();
 		modelAndView.addObject("dateFormat", dateFormat);
-		modelAndView.addObject("state", "已确认");
+		modelAndView.addObject("state", "已对账");
 		modelAndView.addObject("data", getDoneApChecks(params, searchFilter).getContent());
-		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/saleApCheck", "应收对账单列表_已确认"));
-		logger.log("应收对账单", "导出Excel列表", "导出已确认Excel列表");
+		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/saleApCheck", "应收对账单列表_已对账"));
+		logger.log("应收对账单", "导出Excel列表", "导出已对账Excel列表");
 		return modelAndView;
 	}
 
@@ -506,9 +517,9 @@ public class SaleApCheckController {
 		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
 		ModelAndView modelAndView = new ModelAndView();
 		modelAndView.addObject("dateFormat", dateFormat);
-		modelAndView.addObject("state", "待确认");
-		modelAndView.addObject("data", getTodoApChecks(params, searchFilter).getContent());
-		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/saleApCheck", "应收对账单列表_待确认"));
+		modelAndView.addObject("state", "未对账");
+		modelAndView.addObject("data", getDoneApChecks(params, searchFilter).getContent());
+		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/saleApCheck", "应收对账单列表_未对账"));
 		logger.log("应收对账单", "导出Excel列表", "导出未对账Excel列表");
 		return modelAndView;
 	}
@@ -555,23 +566,11 @@ public class SaleApCheckController {
 	 */
 	@RequestMapping(value = "/xls", method = RequestMethod.GET)
 	public ModelAndView export(ApcheckKeyWord keyword, Long fromDate, Long endDate, String checkDate) {
-		List<Long> distributes = null;
-		// 判断当前用户是否被客户分配
-		if (!SystemSession.getUser().isSys()) {
-			List<Vendor> vendors = userService.findChooseVendor(SystemSession.getUser().getUserUU());
-			distributes = new ArrayList<>();
-			if (!CollectionUtils.isEmpty(vendors)) {
-				for (Vendor v : vendors) {
-					distributes.add(v.getMyEnUU());
-				}
-			} else {
-				return null;
-			}
-		}
+		List<ErpProdIODetail> details = getAllApchecksByDate(fromDate, endDate, keyword, checkDate).getDetails();
 		ModelAndView modelAndView = new ModelAndView();
 		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy年MM月dd日");
 		modelAndView.addObject("dateFormat", dateFormat);
-		modelAndView.addObject("data", erpProdIODetailService.findXlsApChecks(distributes, keyword, fromDate, endDate, checkDate));
+		modelAndView.addObject("data", details);
 		modelAndView.setView(new JxlsExcelView("classpath:jxls-tpl/fa/faApCheck", "客户应收对账单"));
 		logger.log("客户应收对账单", "导出Excel列表", "导出全部Excel列表");
 		return modelAndView;

+ 29 - 46
src/main/java/com/uas/platform/b2b/controller/UserController.java

@@ -89,16 +89,16 @@ public class UserController {
 	}
 
 	/**
-	 * 通过客户UU查询分配的用户
+	 * 通过客户分配id查询分配的用户
 	 *
-	 * @param custUu 客户UU
+	 * @param id 客户UU
 	 * @return
 	 */
-	@RequestMapping(value = "/customer/{uu}", method = RequestMethod.POST)
+	@RequestMapping(value = "/customer/{id}", method = RequestMethod.GET)
 	@ResponseBody
-	public List<UserBaseInfo> getUsersAndDistribute(@PathVariable("uu") Long custUu) {
-        LOGGER.log("用户信息", "查询[" + custUu +"]客户分配信息");
-		return userService.findUserInfoDistribute(custUu);
+	public SPage<UserBaseInfo> getUsersAndDistribute(@PathVariable("id") Long id, PageParams params, String keyword) {
+        LOGGER.log("用户信息", "查询[" + id +"]客户分配信息");
+		return userService.findUserInfoDistribute(id, params, keyword);
 	}
 
 	/**
@@ -313,8 +313,8 @@ public class UserController {
 	@RequestMapping(value = "/addVendor/{uu}", method = RequestMethod.POST)
 	@ResponseBody
 	public ResponseEntity<String> bindVendor(@PathVariable("uu") Long userUU, @RequestBody String json) {
-		List<Vendor> ids = FlexJsonUtils.fromJsonArray(json, Vendor.class);
-		boolean result = userService.addCustomerToUser(userUU, ids);
+		List<Vendor> vendors = FlexJsonUtils.fromJsonArray(json, Vendor.class);
+		boolean result = userService.addCustomerToUser(userUU, vendors);
 		String resultInfo = result ? "成功" : "失败";
         LOGGER.log("客户权限", "分配客户权限", "userUU: " + userUU + "结果: 分配" + resultInfo);
 		if (result) {
@@ -327,42 +327,34 @@ public class UserController {
 	/**
 	 * 客户权限转移
      *
-	 * @param custUU
-	 * @param json
-	 * @return
+	 * @param id 客户关系id
+	 * @param json 用户信息
+	 * @return 转移结果
 	 */
-	@RequestMapping(value = "/bindUserToVendor/{uu}", method = RequestMethod.POST)
+	@RequestMapping(value = "/bindUserToVendor/{id}", method = RequestMethod.POST)
 	@ResponseBody
-	public ResponseEntity<String> bindUserToVendor(@PathVariable("uu") Long custUU, @RequestBody String json) {
-		List<User> users = FlexJsonUtils.fromJsonArray(json, User.class);
-		boolean result = userService.addUserToVendor(custUU, users);
+	public ResponseEntity<String> bindUserToVendor(@PathVariable("id") Long id, @RequestBody String json) {
+		List<UserBaseInfo> users = FlexJsonUtils.fromJsonArray(json, UserBaseInfo.class);
+		boolean result = userService.addUserToVendor(id, users);
         String resultInfo = result ? "成功" : "失败";
-        LOGGER.log("客户分配", "绑定用户到指定客户", "客户UU: " + custUU + "结果: 绑定" + resultInfo);
-		if (result) {
-			return new ResponseEntity<>(HttpStatus.OK);
-		} else {
-			return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
-		}
+        LOGGER.log("客户分配", "绑定用户到指定客户", "客户UU: " + id + "结果: 绑定" + resultInfo);
+        return new ResponseEntity<>(result ? HttpStatus.OK : HttpStatus.INTERNAL_SERVER_ERROR);
 	}
 
 	/**
 	 * 将客户权限转移给用户(管理员操作)
-	 * @param custUU
+	 * @param id
 	 * @param json
 	 * @return
 	 */
-	@RequestMapping(value = "/transferUserToVendor/{uu}", method = RequestMethod.POST)
+	@RequestMapping(value = "/transferUserToVendor/{id}", method = RequestMethod.POST)
 	@ResponseBody
-	public ResponseEntity<String> transferUserToVendor(@PathVariable("uu") Long custUU, @RequestBody String json) {
-		List<User> users = FlexJsonUtils.fromJsonArray(json, User.class);
-		boolean result = userService.transferUserToVendor(custUU, users);
+	public ResponseEntity<String> transferUserToVendor(@PathVariable("id") Long id, @RequestBody String json) {
+		List<UserBaseInfo> users = FlexJsonUtils.fromJsonArray(json, UserBaseInfo.class);
+		boolean result = userService.transferUserToVendor(id, users);
         String resultInfo = result ? "成功" : "失败";
-        LOGGER.log("客户分配", "将客户权限转移给用户", "客户UU: " + custUU + "结果: 绑定" + resultInfo);
-		if (result) {
-			return new ResponseEntity<>(HttpStatus.OK);
-		} else {
-			return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
-		}
+        LOGGER.log("客户分配", "将客户权限转移给用户", "客户UU: " + id + "结果: 绑定" + resultInfo);
+        return new ResponseEntity<>(result ? HttpStatus.OK : HttpStatus.INTERNAL_SERVER_ERROR);
 	}
 
 	/**
@@ -377,11 +369,7 @@ public class UserController {
 		boolean result = userService.transferMyDistribute(custUU, userUU);
         String resultInfo = result ? "成功" : "失败";
         LOGGER.log("客户分配", "将客户权限转移给用户", "客户UU: " + custUU + "结果: 绑定" + resultInfo);
-		if (result) {
-			return new ResponseEntity<String>(HttpStatus.OK);
-		} else {
-			return new ResponseEntity<String>(HttpStatus.INTERNAL_SERVER_ERROR);
-		}
+        return new ResponseEntity<>(result ? HttpStatus.OK : HttpStatus.INTERNAL_SERVER_ERROR);
 	}
 
 	/**
@@ -398,11 +386,7 @@ public class UserController {
 		boolean result = userService.removeChooseVendor(userUU, ids);
         String resultInfo = result ? "成功" : "失败";
         LOGGER.log("客户分配", "删除被选中客户", "用户UU: " + userUU + "结果: " + resultInfo);
-		if (result) {
-			return new ResponseEntity<>(HttpStatus.OK);
-		} else {
-			return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
-		}
+        return new ResponseEntity<>(result ? HttpStatus.OK : HttpStatus.INTERNAL_SERVER_ERROR);
 	}
 
 	/**
@@ -429,7 +413,6 @@ public class UserController {
 		return userService.findDistribute();
 	}
 
-
 	/**
 	 * 查询当前登录用户是否被转移权限
 	 *
@@ -449,10 +432,10 @@ public class UserController {
      *
      * @return
      */
-    @RequestMapping(value = "/getDistribute/{custUU}", method = RequestMethod.GET)
+    @RequestMapping(value = "/getDistribute/{id}", method = RequestMethod.GET)
     @ResponseBody
-    public ModelMap getDistribute(@PathVariable("custUU") Long custUU) {
-        Boolean result = userService.getDistribute(custUU);
+    public ModelMap getDistribute(@PathVariable("id") Long id) {
+        Boolean result = userService.getDistribute(id);
 		ModelMap modelMap = new ModelMap();
 		modelMap.put("result", result);
 		return  modelMap;

+ 20 - 7
src/main/java/com/uas/platform/b2b/controller/VendorDistributeController.java

@@ -1,13 +1,14 @@
 package com.uas.platform.b2b.controller;
 
-import com.uas.platform.b2b.model.User;
 import com.uas.platform.b2b.model.UserBaseInfo;
 import com.uas.platform.b2b.result.ResultCode;
 import com.uas.platform.b2b.result.ResultMap;
 import com.uas.platform.b2b.service.VendorService;
 import com.uas.platform.b2b.support.UsageBufferedLogger;
 import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.platform.core.model.PageParams;
 import com.uas.platform.core.util.serializer.FlexJsonUtils;
+import com.uas.search.b2b.model.SPage;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -41,7 +42,7 @@ public class VendorDistributeController {
      */
     @RequestMapping(value = "/bindVendor/{id}", method = RequestMethod.POST)
     public ResultMap bindVendor(@PathVariable("id") Long id, @RequestBody String json) {
-        List<User> users = FlexJsonUtils.fromJsonArray(json, User.class);
+        List<UserBaseInfo> users = FlexJsonUtils.fromJsonArray(json, UserBaseInfo.class);
         boolean result = vendorService.bindVendorToUser(id, users);
         String resultInfo = result ? "成功" : "失败";
         LOGGER.log("供应商权限", "分配供应商", "结果: 分配" + resultInfo, "", id);
@@ -57,7 +58,7 @@ public class VendorDistributeController {
      */
     @RequestMapping(value = "/bindUserToVendor/{id}", method = RequestMethod.POST)
     public ResultMap bindUserToVendor(@PathVariable("id") Long id, @RequestBody String json) throws IllegalAccessException {
-        List<User> users = FlexJsonUtils.fromJsonArray(json, User.class);
+        List<UserBaseInfo> users = FlexJsonUtils.fromJsonArray(json, UserBaseInfo.class);
         boolean result = vendorService.transferVendorToUser(id, users);
         String resultInfo = result ? "成功" : "失败";
         LOGGER.log("供应商权限", "转移权限", "结果: 绑定" + resultInfo, "", id);
@@ -68,11 +69,23 @@ public class VendorDistributeController {
      * 通过供应商UU查询分配的用户
      *
      * @param id 供应商客户关系id
-     * @return
+     * @return 符合条件的数据
      */
-    @RequestMapping(value = "/{id}", method = RequestMethod.POST)
-    public List<UserBaseInfo> getUsersAndDistribute(@PathVariable("id") Long id) throws IllegalAccessException {
+    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
+    public SPage<UserBaseInfo> getUsersAndDistribute(@PathVariable("id") Long id, PageParams params, String keyword) throws IllegalAccessException {
         LOGGER.log("用户信息", "查询[" + id +"]供应商分配信息");
-        return vendorService.findUserInfoVendDistribute(id);
+        return vendorService.findUserInfoVendDistribute(id, params, keyword);
+    }
+
+    /**
+     * 通过分页参数和关键词查询用户信息
+     *
+     * @param params 分页参数
+     * @param keyword 搜索关键词
+     * @return 符合条件的数据
+     */
+    @RequestMapping(value = "/user", method = RequestMethod.GET)
+    public SPage<UserBaseInfo> findByPageInfo(PageParams params, String keyword) {
+        return vendorService.findUserInfoByPage(params, keyword);
     }
 }

+ 74 - 0
src/main/java/com/uas/platform/b2b/core/util/DateUtils.java

@@ -15,11 +15,40 @@ import java.util.GregorianCalendar;
  */
 public class DateUtils {
 
+    /**
+     * 时间比较,默认
+     */
 	public static final int COMPARE_NONE = 0;
+
+    /**
+     * 时间比较,精确到秒
+     */
 	public static final int COMPARE_SECOND = 1;
+
+    /**
+     * 时间比较,精确到分钟
+     */
 	public static final int COMPARE_MINUTE = 2;
+
+    /**
+     * 时间比较,精确到小时
+     */
 	public static final int COMPARE_HOUR = 3;
+
+    /**
+     * 时间比较,精确到天
+     */
 	public static final int COMPARE_DAY = 4;
+
+    /**
+     * 时间比较,精确到月份
+     */
+    public static final int COMPARE_MONTH = 5;
+
+    /**
+     * 时间比较,精确到年份
+     */
+    public static final int COMPARE_YEAR = 6;
 	static final SimpleDateFormat ym = new SimpleDateFormat("yyyyMM");
 	static final SimpleDateFormat YM = new SimpleDateFormat("yyyy-MM");
     public static final SimpleDateFormat YMD = new SimpleDateFormat("yyyy-MM-dd");
@@ -27,6 +56,9 @@ public class DateUtils {
     static final FastDateFormat MM = FastDateFormat.getInstance("MM");
     static final FastDateFormat YYYY = FastDateFormat.getInstance("yyyy");
     static final FastDateFormat DD = FastDateFormat.getInstance("dd");
+    static final SimpleDateFormat COMPARE_HOUR_PATTERN = new SimpleDateFormat("yyyy-MM-dd HH:00:00");
+    static final SimpleDateFormat COMPARE_MINUTE_PATTERN = new SimpleDateFormat("yyyy-MM-dd HH:mm:00");
+    static final SimpleDateFormat COMPARE_SECOND_PATTERN = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
 
     /**
      * 获取月份
@@ -269,4 +301,46 @@ public class DateUtils {
         calendar.add(Calendar.MONTH, increase);
         return calendar.getTime();
     }
+
+    /**
+     * 比较日期大小
+     *
+     * @param firstDate 时间1
+     * @param secondDate 时间2
+     * @param compareType 比较类型
+     *            精确位(天、小时、分钟、秒)
+     * @return 1:firstDate > secondDate; 0: firstDate = secondDate; -1: firstDate < secondDate;
+     */
+    public static int dateCompare(Date firstDate, Date secondDate, int compareType) {
+        String firstDateParam;
+        String secondDateParam;
+        if (COMPARE_NONE == compareType) {
+            return firstDate.compareTo(secondDate);
+        } else if (COMPARE_SECOND == compareType) {
+            firstDateParam = COMPARE_SECOND_PATTERN.format(firstDate);
+            secondDateParam = COMPARE_SECOND_PATTERN.format(secondDate);
+            return firstDateParam.compareTo(secondDateParam);
+        } else if (COMPARE_MINUTE == compareType) {
+            firstDateParam = COMPARE_MINUTE_PATTERN.format(firstDate);
+            secondDateParam = COMPARE_MINUTE_PATTERN.format(secondDate);
+            return firstDateParam.compareTo(secondDateParam);
+        } else if (COMPARE_HOUR == compareType) {
+            firstDateParam = COMPARE_HOUR_PATTERN.format(firstDate);
+            secondDateParam = COMPARE_HOUR_PATTERN.format(secondDate);
+            return firstDateParam.compareTo(secondDateParam);
+        } else if (COMPARE_DAY == compareType) {
+            firstDateParam = YMD.format(firstDate);
+            secondDateParam = YMD.format(secondDate);
+            return firstDateParam.compareTo(secondDateParam);
+        } else if (COMPARE_MONTH == compareType) {
+            firstDateParam = YM.format(firstDate);
+            secondDateParam = YM.format(secondDate);
+            return firstDateParam.compareTo(secondDateParam);
+        } else if (COMPARE_YEAR == compareType) {
+            firstDateParam = YYYY.format(firstDate);
+            secondDateParam = YYYY.format(secondDate);
+            return firstDateParam.compareTo(secondDateParam);
+        }
+        return 0;
+    }
 }

+ 42 - 10
src/main/java/com/uas/platform/b2b/dao/DistributeDao.java

@@ -8,24 +8,31 @@ import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
 import java.util.List;
+import java.util.Set;
 
+/**
+ * 客户分配信息
+ *
+ * @author hejq
+ * @date 2018-12-12 9:26
+ */
 @Repository
 public interface DistributeDao extends JpaSpecificationExecutor<Distribute>, GenericRepository<Distribute, Long> {
 	
 	/**
 	 * 根据用户UU查询客户分配表 
 	 * @param userUU
-	 * @return
+	 * @return 分配记录
 	 */
 	List<Distribute> findByUserUU(Long userUU);
 	
 	/**
-	 * 根据用户UU和vendor ID
-	 * @param userUU
-	 * @param vendorId
-	 * @return
+	 * 根据用户UU和vendor ID 查询客户分配表
+	 * @param userUU 用户UU
+	 * @param vendorId vendor ID
+	 * @return 分配记录
 	 */
-	List<Distribute> findByUserUUAndVendorId(Long userUU,Long vendorId);
+	List<Distribute> findByUserUUAndVendorId(Long userUU, Long vendorId);
 
 	/**
 	 * 通过供应商表id查询客户分配
@@ -36,20 +43,45 @@ public interface DistributeDao extends JpaSpecificationExecutor<Distribute>, Gen
 	@Query("select d from Distribute d where d.vendorId in (:vendorIds)")
 	List<Distribute> findByVendorId(@Param("vendorIds") List<Long> vendorIds);
 
+    /**
+     * 通过供应商客户关系表ID查询客户分配信息
+     *
+     * @param vendorId 供应商客户关系表ID
+     * @return 客户分配
+     */
 	List<Distribute> findByVendorId(Long vendorId);
 
 	/**
 	 * 查找被当前用户绑定当前客户权限的记录
-	 * @param id
-	 * @param userUU
-	 * @return
+	 * @param id 供应商关系表id
+	 * @param userUU 转移人UU
+	 * @return 客户分配
 	 */
 	List<Distribute> findByVendorIdAndLeaderUU(Long id, Long userUU);
 
 	/**
 	 * 根据leaderUU 查询客户绑定记录
 	 * @param userUU 用户UU
-	 * @return
+	 * @return 分配记录
 	 */
     List<Distribute> findByLeaderUU(Long userUU);
+
+    /**
+     * 通过用户UU和供应商UU查询分配的客户信息
+     *
+     * @param UserUU 用户UU
+     * @param vendorUU 供应商UU
+     * @return 分配记录
+     */
+    @Query("select d from Distribute d where d.userUU = :userUU and d.vendor.vendEnUU = :vendorUU")
+    List<Distribute> findByUserUUAndVendorUU(@Param("userUU") Long UserUU, @Param("vendorUU") Long vendorUU);
+
+    /**
+     * 通过用户UU和供应商关系id查询客户分配信息
+     *
+     * @param userUUList 用户UUlist
+     * @param vendorId 供应商表Id
+     * @return 符合条件的客户分配关系
+     */
+    List<Distribute> findByVendorIdAndUserUUIn(Long vendorId, List<Long> userUUList);
 }

+ 50 - 0
src/main/java/com/uas/platform/b2b/dao/UserBaseInfoDao.java

@@ -2,6 +2,9 @@ package com.uas.platform.b2b.dao;
 
 import java.util.List;
 
+import com.uas.platform.b2b.model.User;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Query;
@@ -41,4 +44,51 @@ public interface UserBaseInfoDao extends JpaSpecificationExecutor<UserBaseInfo>,
      */
     @Query(value = "select u.* from sec$users u inner join sec$userenterprise as e on u.user_uu = e.user_uu where e.en_uu = :enUU", nativeQuery = true)
     List<UserBaseInfo> findByEnUU(@Param("enUU") long enUU);
+
+    /**
+     * 通过企业UU过滤和搜索词分页搜索用户基本信息
+     *
+     * @param enUU 企业UU
+     * @param keyword 关键词
+     * @param pageNumber 页码
+     * @param pageSize 分页大小
+     * @return 搜索结果
+     */
+    @Query(value = "select u.* from sec$users u inner join sec$userenterprise as e on e.user_uu = u.user_uu " +
+        "where e.en_uu = :enUU and (u.user_name like %:keyword% or u.user_tel like %:keyword%) limit :pageNumber, :pageSize", nativeQuery = true)
+    List<UserBaseInfo> findByEnUUAndKeyword(@Param("enUU") long enUU, @Param("keyword") String keyword,
+                                            @Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize);
+
+    /**
+     * 通过企业UU过滤用户基本信息
+     *
+     * @param enUU 企业UU
+     * @param pageNumber 页码
+     * @param pageSize 分页大小
+     * @return 搜索结果
+     */
+    @Query(value = "select u.* from sec$users u inner join sec$userenterprise as e on e.user_uu = u.user_uu " +
+        "where e.en_uu = :enUU limit :pageNumber, :pageSize", nativeQuery = true)
+    List<UserBaseInfo> findByEnUU(@Param("enUU") long enUU, @Param("pageNumber") int pageNumber, @Param("pageSize") int pageSize);
+
+    /**
+     * 通过企业UU过滤和搜索词统计总数
+     *
+     * @param enUU 企业UU
+     * @param keyword 关键词
+     * @return 数量
+     */
+    @Query(value = "select count(1) from sec$users u inner join sec$userenterprise as e on e.user_uu = u.user_uu " +
+        "where e.en_uu = :enUU and (u.user_name like %:keyword% or u.user_tel like %:keyword%)", nativeQuery = true)
+    Integer countByEnUUAndKeyword(@Param("enUU") long enUU, @Param("keyword") String keyword);
+
+    /**
+     * 通过企业UU统计总数
+     *
+     * @param enUU 企业UU
+     * @return 数量
+     */
+    @Query(value = "select count(1) from sec$users u inner join sec$userenterprise as e on e.user_uu = u.user_uu " +
+        "where e.en_uu = :enUU", nativeQuery = true)
+    Integer countByEnUU(@Param("enUU") long enUU);
 }

+ 9 - 0
src/main/java/com/uas/platform/b2b/dao/VendorDistributeDao.java

@@ -51,4 +51,13 @@ public interface VendorDistributeDao extends JpaSpecificationExecutor<VendorDist
      * @return 权限转移结果
      */
     List<VendorDistribute> findByVendorIdAndLeaderUU(Long vendorId, Long userUU);
+
+    /**
+     * 通过供应商客户id和转移状态查询供应商分配结果
+     *
+     * @param vendorId 供应商客户关系id
+     * @param status 转移状态
+     * @return 分配结果
+     */
+    List<VendorDistribute> findByVendorIdAndIsTransfer(Long vendorId, Short status);
 }

+ 1 - 1
src/main/java/com/uas/platform/b2b/filter/SSOInterceptor.java

@@ -133,7 +133,7 @@ public class SSOInterceptor extends AbstractSSOInterceptor {
 				// 企业资料在client系统自己的唯一标识,比如en_uu
 				if (tokenUser.getSpaceUU() != null) {
                     authorizedUser.setCurrentEnterprise(tokenUser.getSpaceUU());
-				} else if (StringUtils.isEmpty(tokenUser.getBusinessCode())) {
+				} else if (!StringUtils.isEmpty(tokenUser.getBusinessCode())) {
 					for (Enterprise enterprise : authorizedUser.getEnterprises()) {
 						// 企业资料在所有系统公认的唯一标识,这里使用商业登记证号
 						if (tokenUser.getBusinessCode().equals(enterprise.getEnBussinessCode())) {

+ 13 - 0
src/main/java/com/uas/platform/b2b/model/ApcheckKeyWord.java

@@ -20,6 +20,11 @@ public class ApcheckKeyWord {
      */
     private String suuorname;
 
+    /**
+     * 客户UU
+     */
+    private Long customerUU;
+
     /**
      * 送货工厂
      */
@@ -56,6 +61,14 @@ public class ApcheckKeyWord {
         this.suuorname = suuorname;
     }
 
+    public Long getCustomerUU() {
+        return customerUU;
+    }
+
+    public void setCustomerUU(Long customerUU) {
+        this.customerUU = customerUU;
+    }
+
     public String getFactory() {
         return factory;
     }

+ 54 - 0
src/main/java/com/uas/platform/b2b/model/ErpProdIo.java

@@ -0,0 +1,54 @@
+package com.uas.platform.b2b.model;
+
+import com.uas.platform.b2b.publicapi.model.TradeCount;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * ERP出入库单
+ *
+ * @author hejq
+ * @date 2018-12-11 18:32
+ */
+public class ErpProdIo {
+
+    /**
+     * 应收对账单数据
+     */
+    private List<ErpProdIODetail> details = new ArrayList<>();
+
+    /**
+     * 本月应收(前端传入指定月份)
+     */
+    private List<TradeCount> thisMonthCount;
+
+    /**
+     * 应收总额
+     */
+    private List<TradeCount> totalCount;
+
+    public List<ErpProdIODetail> getDetails() {
+        return details;
+    }
+
+    public void setDetails(List<ErpProdIODetail> details) {
+        this.details = details;
+    }
+
+    public List<TradeCount> getThisMonthCount() {
+        return thisMonthCount;
+    }
+
+    public void setThisMonthCount(List<TradeCount> thisMonthCount) {
+        this.thisMonthCount = thisMonthCount;
+    }
+
+    public List<TradeCount> getTotalCount() {
+        return totalCount;
+    }
+
+    public void setTotalCount(List<TradeCount> totalCount) {
+        this.totalCount = totalCount;
+    }
+}

+ 44 - 0
src/main/java/com/uas/platform/b2b/model/OrderRedDotDone.java

@@ -151,4 +151,48 @@ public class OrderRedDotDone implements Serializable {
         this.orderId = redDotAll.getOrderId();
         this.orderType = redDotAll.getOrderType();
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+
+        OrderRedDotDone that = (OrderRedDotDone) o;
+
+        if (id != null ? !id.equals(that.id) : that.id != null) {
+            return false;
+        }
+        if (redId != null ? !redId.equals(that.redId) : that.redId != null) {
+            return false;
+        }
+        if (enUU != null ? !enUU.equals(that.enUU) : that.enUU != null) {
+            return false;
+        }
+        if (userUU != null ? !userUU.equals(that.userUU) : that.userUU != null) {
+            return false;
+        }
+        if (orderId != null ? !orderId.equals(that.orderId) : that.orderId != null) {
+            return false;
+        }
+        if (orderType != null ? !orderType.equals(that.orderType) : that.orderType != null) {
+            return false;
+        }
+        return date != null ? date.equals(that.date) : that.date == null;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = id != null ? id.hashCode() : 0;
+        result = 31 * result + (redId != null ? redId.hashCode() : 0);
+        result = 31 * result + (enUU != null ? enUU.hashCode() : 0);
+        result = 31 * result + (userUU != null ? userUU.hashCode() : 0);
+        result = 31 * result + (orderId != null ? orderId.hashCode() : 0);
+        result = 31 * result + (orderType != null ? orderType.hashCode() : 0);
+        result = 31 * result + (date != null ? date.hashCode() : 0);
+        return result;
+    }
 }

+ 6 - 7
src/main/java/com/uas/platform/b2b/model/User.java

@@ -29,6 +29,11 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
+/**
+ * B2B用户信息
+ *
+ * @author US50
+ */
 @Entity
 @Table(name = "sec$users")
 @Cacheable
@@ -462,13 +467,7 @@ public class User implements Serializable {
     public void setCurrentEnterpriseRoles(Long enUU) {
         if (null != enUU) {
             if (!CollectionUtils.isEmpty(this.roles)) {
-                Iterator<Role> iterator = this.roles.iterator();
-                while (iterator.hasNext()) {
-                    Role role = iterator.next();
-                    if (!role.getEnUU().equals(enUU)) {
-                        iterator.remove();
-                    }
-                }
+                this.roles.removeIf(role -> !role.getEnUU().equals(enUU));
             }
         } else {
             this.roles = null;

+ 30 - 0
src/main/java/com/uas/platform/b2b/model/Vendor.java

@@ -2,6 +2,7 @@ package com.uas.platform.b2b.model;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import com.uas.platform.b2b.erp.model.InquiryVendorInfo;
+import com.uas.platform.b2b.publicapi.model.TradeCount;
 import com.uas.platform.core.persistence.Logger;
 import com.uas.platform.core.persistence.OtherUserUU;
 import com.uas.platform.core.persistence.StatusColumn;
@@ -25,6 +26,7 @@ import javax.persistence.Transient;
 import java.io.*;
 import java.util.Date;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -194,6 +196,18 @@ public class Vendor implements Serializable {
 	@Transient
     private Set<String> saleContacts = new HashSet<>();
 
+    /**
+     * 本月应收(前端传入指定月份)
+     */
+	@Transient
+    private List<TradeCount> thisMonthCount;
+
+    /**
+     * 应收总额
+     */
+	@Transient
+    private List<TradeCount> totalCount;
+
 	public Long getId() {
 		return id;
 	}
@@ -391,6 +405,22 @@ public class Vendor implements Serializable {
         this.saleContacts = saleContacts;
     }
 
+    public List<TradeCount> getThisMonthCount() {
+        return thisMonthCount;
+    }
+
+    public void setThisMonthCount(List<TradeCount> thisMonthCount) {
+        this.thisMonthCount = thisMonthCount;
+    }
+
+    public List<TradeCount> getTotalCount() {
+        return totalCount;
+    }
+
+    public void setTotalCount(List<TradeCount> totalCount) {
+        this.totalCount = totalCount;
+    }
+
     public InquiryVendorInfo covert() {
 		InquiryVendorInfo info = new InquiryVendorInfo();
 		info.setB2b_id(this.id);

+ 50 - 34
src/main/java/com/uas/platform/b2b/model/util/UnCheckedCountSqls.java

@@ -1,6 +1,5 @@
 package com.uas.platform.b2b.model.util;
 
-import com.uas.platform.b2b.publicapi.model.UsoftRate;
 
 /**
  * 未对账总额sql查询语句
@@ -10,63 +9,80 @@ import com.uas.platform.b2b.publicapi.model.UsoftRate;
  */
 public class UnCheckedCountSqls {
 
-
     /**
      * 货款调账未对账金额查询语句
      */
-    public static final String ADJUSTMENT_COUNT_SQL = "select coalesce(sum((aa_qty - coalesce(aa_ycheckqty, 0)) * aa_orderprice), 0) " +
-        "from purc$apbilladjustment where coalesce(aa_thischeckqty, 0) <> 0 and aa_enuu = ? and aa_custuu = ?";
+    public static final String ADJUSTMENT_COUNT_SQL = "select coalesce(sum((aa_qty - coalesce(aa_ycheckqty, 0)) * aa_orderprice), 0) as amount, aa_currency as currency \n" +
+        "from purc$apbilladjustment where coalesce(aa_thischeckqty, 0) <> 0 and aa_enuu = ? and aa_custuu = ? " +
+        "group by aa_currency";
+
+    /**
+     * 当月货款调账未对账金额查询语句
+     */
+    public static final String THISMONTH_ADJUSTMENT_COUNT_SQL = "select coalesce(sum((aa_qty - coalesce(aa_ycheckqty, 0)) * aa_orderprice), 0) as amount, aa_currency as currency \n" +
+        "from purc$apbilladjustment where coalesce(aa_thischeckqty, 0) <> 0 and aa_enuu = ? and aa_custuu = ? and aa_date between ? and ?" +
+        "group by aa_currency";
 
     /**
      * 客户采购验收单未对账金额查询语句
      */
-    public static final String SALE_ACCEPT_COUNT_SQL = "select coalesce(sum(case " +
-        " when currency = 'USD' then count * " + UsoftRate.USD_RATE +
-        " when currency = 'HKD' then count * " + UsoftRate.HKD_RATE +
-        " else count end), 0) " +
-        "from (" +
-        "select sum((pai_qty - coalesce(pai_ycheckqty, 0)) * pai_orderprice) as count, pa_currency as currency " +
+    public static final String SALE_ACCEPT_COUNT_SQL = "select coalesce(sum((pai_qty - coalesce(pai_ycheckqty, 0)) * pai_orderprice), 0) as amount, pa_currency as currency \n" +
         "from purc$accept left join `purc$acceptitem` on pai_paid = pa_id " +
-        "where pai_qty > coalesce(pai_ycheckqty, 0) and pa_enuu = ? and  pa_venduu = ? and pai_orderprice <> 0 " +
-        "group by pa_currency) a";
+        "where pa_venduu = ? and pa_enuu = ? and pai_qty > coalesce(pai_ycheckqty, 0) and pai_orderprice <> 0 " +
+        "group by pa_currency";
+
+    /**
+     * 客户采购验收单未对账金额查询语句
+     */
+    public static final String THISMONTH_SALE_ACCEPT_COUNT_SQL = "select coalesce(sum((pai_qty - coalesce(pai_ycheckqty, 0)) * pai_orderprice), 0) as amount, pa_currency as currency \n" +
+        "from purc$accept left join `purc$acceptitem` on pai_paid = pa_id " +
+        "where pa_venduu = ? and pa_enuu = ? and pai_qty > coalesce(pai_ycheckqty, 0) and pai_orderprice <> 0 and pa_date between ? and ?" +
+        "group by pa_currency";
 
     /**
      * 客户采购验退单未对账金额查询语句
      */
-    public static final String SALE_RETURN_COUNT_SQL = "select coalesce(sum(case " +
-        " when currency = 'USD' then count * " + UsoftRate.USD_RATE +
-        " when currency = 'HKD' then count * " + UsoftRate.HKD_RATE +
-        " else count end), 0) " +
-        "from (" +
-        "select sum(((-(1) * pri_qty ) - coalesce(pri_ycheckqty, 0)) *  pri_orderprice) as count, pr_currency as currency " +
+    public static final String SALE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) * pri_qty ) - coalesce(pri_ycheckqty, 0)) *  pri_orderprice), 0) as amount, pr_currency as currency \n" +
         "from `purc$return` left join `purc$returnitem` on pr_id = pri_prid " +
-        "where pri_qty > abs(coalesce(pri_ycheckqty, 0)) and pr_venduu = ? and pr_enuu = ? group by pr_currency) a";
+        "where pri_qty > abs(coalesce(pri_ycheckqty, 0)) and pr_venduu = ? and pr_enuu = ? group by pr_currency";
 
-    //todo 不良品出入库价格为0,暂不用计算
+    /**
+     * 客户采购验退单未对账金额查询语句
+     */
+    public static final String THISMONTH_SALE_RETURN_COUNT_SQL = "select sum(((-(1) * pri_qty ) - coalesce(pri_ycheckqty, 0)) *  pri_orderprice) as amount, pr_currency as currency \n" +
+        "from `purc$return` left join `purc$returnitem` on pr_id = pri_prid " +
+        "where pri_qty > abs(coalesce(pri_ycheckqty, 0)) and pr_venduu = ? and pr_enuu = ? and pr_date between ? and ? group by pr_currency";
 
     /**
      * 客户委外验收单未对账金额查询语句
      */
-    public static final String MAKE_ACCEPT_COUNT_SQL = "select coalesce(sum(case " +
-        " when currency = 'USD' then count * " + UsoftRate.USD_RATE +
-        " when currency = 'HKD' then count * " + UsoftRate.HKD_RATE +
-        " else count end), 0) " +
-        "from (" +
-        "select sum((mai_qty - coalesce(mai_ycheckqty, 0)) * mai_orderpice) as count,ma_currency as currency " +
+    public static final String MAKE_ACCEPT_COUNT_SQL = "select coalesce(sum((mai_qty - coalesce(mai_ycheckqty, 0)) * mai_orderpice), 0) as amount, ma_currency as currency " +
         " from make$accept " +
         "join make$acceptitem on ma_id = mai_paid " +
-        "where mai_qty > coalesce(mai_ycheckqty, 0) and ma_venduu = ? and ma_enuu = ? and mai_orderpice > 0 group by ma_currency) a";
+        "where mai_qty > coalesce(mai_ycheckqty, 0) and ma_venduu = ? and ma_enuu = ? and mai_orderpice > 0 group by ma_currency";
+
+    /**
+     * 客户委外验收单未对账金额查询语句
+     */
+    public static final String THISMONTH_MAKE_ACCEPT_COUNT_SQL = "select coalesce(sum((mai_qty - coalesce(mai_ycheckqty, 0)) * mai_orderpice), 0) as amount,ma_currency as currency " +
+        " from make$accept " +
+        "join make$acceptitem on ma_id = mai_paid " +
+        "where mai_qty > coalesce(mai_ycheckqty, 0) and ma_venduu = ? and ma_enuu = ? and mai_orderpice > 0 and ma_date between ? and ? group by ma_currency";
+
+    /**
+     * 客户委外验退单未对账金额查询语句
+     */
+    public static final String MAKE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) *  mri_qty ) - coalesce(mri_ycheckqty, 0)) * mri_orderpice), 0) as amount,mr_currency as currency " +
+        " from make$return " +
+        "join make$returnitem on mr_id =  mri_paid " +
+        "where mri_qty > abs(coalesce(mri_ycheckqty, 0)) and mr_venduu = ? and mr_enuu = ? and mri_orderpice > 0 group by mr_currency";
 
     /**
      * 客户委外验退单未对账金额查询语句
      */
-    public static final String MAKE_RETURN_COUNT_SQL = "select coalesce(sum(case " +
-        " when currency = 'USD' then count * " + UsoftRate.USD_RATE +
-        " when currency = 'HKD' then count * " + UsoftRate.HKD_RATE +
-        " else count end), 0) " +
-        "from (" +
-        "select sum(((-(1) *  mri_qty ) - coalesce(mri_ycheckqty, 0)) * mri_orderpice) as count,mr_currency as currency " +
+    public static final String THISMONTH_MAKE_RETURN_COUNT_SQL = "select coalesce(sum(((-(1) *  mri_qty ) - coalesce(mri_ycheckqty, 0)) * mri_orderpice), 0) as amount, mr_currency as currency " +
         " from make$return " +
         "join make$returnitem on mr_id =  mri_paid " +
-        "where mri_qty > abs(coalesce(mri_ycheckqty, 0)) and mr_venduu = ? and mr_enuu = ? and mri_orderpice > 0 group by mr_currency) a";
+        "where mri_qty > abs(coalesce(mri_ycheckqty, 0)) and mr_venduu = ? and mr_enuu = ? and mri_orderpice > 0 and mr_date between ? and ? " +
+        "group by mr_currency";
 }

+ 15 - 0
src/main/java/com/uas/platform/b2b/publicapi/model/TradeCount.java

@@ -106,4 +106,19 @@ public class TradeCount implements Serializable {
     public void setEndDate(String endDate) {
         this.endDate = endDate;
     }
+
+    public TradeCount() {
+
+    }
+
+    /**
+     * 通过币别,总额获取交易额
+     *
+     * @param currency 币别
+     * @param amount 总额
+     */
+    public TradeCount(String currency, Double amount) {
+        this.currency = currency;
+        this.amount = new BigDecimal(amount);
+    }
 }

+ 2 - 2
src/main/java/com/uas/platform/b2b/service/ErpProdIODetailService.java

@@ -1,7 +1,7 @@
 package com.uas.platform.b2b.service;
 
 import com.uas.platform.b2b.model.ApcheckKeyWord;
-import com.uas.platform.b2b.model.ErpProdIODetail;
+import com.uas.platform.b2b.model.ErpProdIo;
 
 import java.util.List;
 
@@ -23,6 +23,6 @@ public interface ErpProdIODetailService {
      * @param checkDate 对账月份
 	 * @return 符合条件的数据
 	 */
-	List<ErpProdIODetail> findXlsApChecks(List<Long> filter, ApcheckKeyWord keyWord, Long fromDate, Long endDate, String checkDate);
+    ErpProdIo findXlsApChecks(List<Long> filter, ApcheckKeyWord keyWord, Long fromDate, Long endDate, String checkDate);
 	
 }

+ 26 - 1
src/main/java/com/uas/platform/b2b/service/PurchaseApCheckService.java

@@ -6,6 +6,7 @@ import com.uas.platform.b2b.model.PurchaseApCheckItem;
 import com.uas.platform.b2b.model.PurchaseApCheckTodo;
 import com.uas.platform.b2b.model.SearchFilter;
 import com.uas.platform.b2b.model.Vendor;
+import com.uas.platform.b2b.publicapi.model.TradeCount;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
 import com.uas.search.b2b.model.SPage;
@@ -136,7 +137,31 @@ public interface PurchaseApCheckService {
      *
      * @param params 分页参数
      * @param keyword 关键字
+     * @param checkDate 筛选日期
+     * @param fromDate 开始时间
+     * @param endDate 截止时间
      * @return 搜索结果
      */
-    SPage<Vendor> getCustomerInfo(PageParams params, String keyword);
+    SPage<Vendor> getCustomerInfo(PageParams params, String keyword, String checkDate,  Long fromDate, Long endDate);
+
+    /**
+     * 获取总的应收金额
+     *
+     * @param enUU 企业UU
+     * @param customerUU 客户企业UU
+     * @return 统计结果
+     */
+    List<TradeCount> getDueTrade(Long enUU, Long customerUU);
+
+    /**
+     * 获取指定月份应收金额
+     *
+     * @param enUU 企业UU
+     * @param customerUU 客户企业UU
+     * @param checkDate 筛选月份
+     * @param fromDate 开始时间
+     * @param endDate 截止时间
+     * @return 统计结果
+     */
+    List<TradeCount> getThisMonthTrade(Long enUU, Long customerUU, String checkDate, Long fromDate, Long endDate);
 }

+ 7 - 6
src/main/java/com/uas/platform/b2b/service/UserService.java

@@ -7,6 +7,7 @@ import com.uas.platform.b2b.model.UserBaseInfo;
 import com.uas.platform.b2b.model.UserInfo;
 import com.uas.platform.b2b.model.Vendor;
 import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
 import com.uas.search.b2b.model.SPage;
 
 import javax.servlet.http.HttpServletRequest;
@@ -264,7 +265,7 @@ public interface UserService {
 	 * @param enUu
 	 * @return
 	 */
-    List<UserBaseInfo> findUserInfoDistribute(Long enUu);
+    SPage<UserBaseInfo> findUserInfoDistribute(Long id, PageParams params, String keyword);
 
 	/**
 	 * 为客户分配企业用户
@@ -273,15 +274,15 @@ public interface UserService {
 	 * @param users
 	 * @return
 	 */
-    boolean addUserToVendor(Long custUU, List<User> users);
+    boolean addUserToVendor(Long id, List<UserBaseInfo> users);
 
 	/**
 	 * 将客户权限转移给用户(管理员操作)
-	 * @param custUU
+	 * @param id
 	 * @param users
 	 * @return
 	 */
-	boolean transferUserToVendor(Long custUU, List<User> users);
+	boolean transferUserToVendor(Long id, List<UserBaseInfo> users);
 
 	/**
 	 * 将客户权限转移给用户(有权限的用户操作)
@@ -315,10 +316,10 @@ public interface UserService {
     Boolean getEnTransfer(Long custUU);
 	/**
 	 * 当前登录用户,是否被分配当前客户权限
-	 * @param custUU
+	 * @param id
 	 * @return
 	 */
-	Boolean getDistribute(Long custUU);
+	Boolean getDistribute(Long id);
 
 
 	User updateUserRole(User user);

+ 24 - 4
src/main/java/com/uas/platform/b2b/service/VendorService.java

@@ -174,7 +174,7 @@ public interface VendorService {
      * @param userList 供应商客户
      * @return 分配结果 成功或失败
      */
-    boolean bindVendorToUser(Long id, List<User> userList);
+    boolean bindVendorToUser(Long id, List<UserBaseInfo> userList);
 
     /**
      * 供应商权限转移
@@ -182,8 +182,9 @@ public interface VendorService {
      * @param id 供应商关系id
      * @param users 前端选择用户信息
      * @return 转移结果
+     * @throws IllegalAccessException 没有权限抛出异常
      */
-    boolean transferVendorToUser(Long id, List<User> users) throws IllegalAccessException;
+    boolean transferVendorToUser(Long id, List<UserBaseInfo> users) throws IllegalAccessException;
 
     /**
      * 设置联系人
@@ -204,9 +205,28 @@ public interface VendorService {
     /**
      * 通过供应商UU查询供应商分配信息
      *
-     * @param vendUU 供应商UU
+     * @param id 供应商关系表id
+     * @param params  分页参数
+     * @param keyword 搜索词
      * @return 分配的供应商
      * @throws IllegalAccessException
      */
-    List<UserBaseInfo> findUserInfoVendDistribute(Long vendUU) throws IllegalAccessException;
+    SPage<UserBaseInfo> findUserInfoVendDistribute(Long id, PageParams params, String keyword) throws IllegalAccessException;
+
+    /**
+     * 通过分页信息和关键词查询用户信息
+     *
+     * @param params 分页参数
+     * @param keyword 关键词
+     * @return 符合条件的数据
+     */
+    SPage<UserBaseInfo> findUserInfoByPage(PageParams params, String keyword);
+
+    /**
+     * 通过客户关系表id查询分配关系
+     *
+     * @param id 客户关系表id
+     * @return 分配的客户
+     */
+    List<Distribute> findByVeId(Long id);
 }

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

@@ -5,7 +5,10 @@ import com.uas.platform.b2b.core.util.DateUtils;
 import com.uas.platform.b2b.dao.CommonDao;
 import com.uas.platform.b2b.model.ApcheckKeyWord;
 import com.uas.platform.b2b.model.ErpProdIODetail;
+import com.uas.platform.b2b.model.ErpProdIo;
+import com.uas.platform.b2b.publicapi.model.TradeCount;
 import com.uas.platform.b2b.service.ErpProdIODetailService;
+import com.uas.platform.b2b.service.PurchaseApCheckService;
 import com.uas.platform.b2b.support.SystemSession;
 import com.uas.platform.core.exception.IllegalOperatorException;
 import org.apache.axis.utils.StringUtils;
@@ -30,8 +33,11 @@ public class ErpProdIODetailServiceImpl implements ErpProdIODetailService {
 	@Autowired
 	private CommonDao commonDao;
 
+	@Autowired
+    private PurchaseApCheckService apCheckService;
+
 	@Override
-	public List<ErpProdIODetail> findXlsApChecks(List<Long> filter, ApcheckKeyWord keyword, Long fromDate, Long endDate, String checkDate) {
+	public ErpProdIo findXlsApChecks(List<Long> filter, ApcheckKeyWord keyword, Long fromDate, Long endDate, String checkDate) {
 		Long enUU = SystemSession.getUser().getEnterprise().getUu();
         StringBuffer distributes = new StringBuffer();
         String sqlFromDate;
@@ -91,7 +97,15 @@ public class ErpProdIODetailServiceImpl implements ErpProdIODetailService {
         details.addAll(badOuts);
         details.addAll(makeAccepts);
         details.addAll(makeReturns);
-		return details;
+        ErpProdIo erpProdIo = new ErpProdIo();
+        erpProdIo.setDetails(details);
+        // 应收总额
+        List<TradeCount> totalTrades = apCheckService.getDueTrade(enUU, keyword.getCustomerUU());
+        erpProdIo.setTotalCount(totalTrades);
+        // 本月应收
+        List<TradeCount> thisMonthTrades = apCheckService.getThisMonthTrade(enUU, keyword.getCustomerUU(), checkDate, fromDate, endDate);
+        erpProdIo.setThisMonthCount(thisMonthTrades);
+		return erpProdIo;
 	}
 
     /**

+ 7 - 5
src/main/java/com/uas/platform/b2b/service/impl/OrderRedDotServiceImpl.java

@@ -172,7 +172,7 @@ public class OrderRedDotServiceImpl implements OrderRedDotService {
      *
      * @param orderType 单据类型
      * @param roleName 角色
-     * @return
+     * @return 未读单据的id,原表id
      */
     @Override
     public List<Long> getUnreadIds(String orderType, String roleName) {
@@ -192,13 +192,15 @@ public class OrderRedDotServiceImpl implements OrderRedDotService {
      *
      * @param orderType 单据类型
      * @param roleName  角色
-     * @return 数量
+     * @return 设置已读的数量
      */
     @Override
     public Integer setReadByState(String orderType, String roleName) {
         List<Long> redAllIdList = getUnreadRedAllIdList(orderType, roleName);
-        List<List<Long>> idsList = SplitArray.splitAry(redAllIdList, SplitArray.QUERY_MAX_NUMBER);
-        idsList.forEach(ids -> setReadByIdList(ids));
+        if (!CollectionUtil.isEmpty(redAllIdList)) {
+            List<List<Long>> idsList = SplitArray.splitAry(redAllIdList, SplitArray.QUERY_MAX_NUMBER);
+            idsList.forEach(this::setReadByIdList);
+        }
         return redAllIdList.size();
     }
 
@@ -210,7 +212,7 @@ public class OrderRedDotServiceImpl implements OrderRedDotService {
      * @return List<Long>
      */
     private List<Long> getUnreadRedAllIdList(String orderType, String roleName) {
-        StringBuffer buffer = new StringBuffer("select red_id from reddot$all");
+        StringBuilder buffer = new StringBuilder("select red_id from reddot$all");
         Long enUU = SystemSession.getUser().getEnterprise().getUu();
         if (Role.SELLER.equals(roleName)) {
             buffer.append(" where red_venduu = ?");

+ 175 - 21
src/main/java/com/uas/platform/b2b/service/impl/PurchaseApCheckServiceImpl.java

@@ -1,6 +1,9 @@
 package com.uas.platform.b2b.service.impl;
 
 import com.uas.platform.b2b.core.util.ContextUtils;
+import com.uas.platform.b2b.core.util.DateFormatUtils;
+import com.uas.platform.b2b.core.util.DateUtils;
+import com.uas.platform.b2b.core.util.ThreadUtils;
 import com.uas.platform.b2b.dao.CommonDao;
 import com.uas.platform.b2b.dao.EnterpriseDao;
 import com.uas.platform.b2b.dao.PurchaseApCheckDao;
@@ -19,6 +22,7 @@ import com.uas.platform.b2b.model.SearchFilter;
 import com.uas.platform.b2b.model.SourceForApcheck;
 import com.uas.platform.b2b.model.Vendor;
 import com.uas.platform.b2b.model.util.UnCheckedCountSqls;
+import com.uas.platform.b2b.publicapi.model.TradeCount;
 import com.uas.platform.b2b.search.SearchService;
 import com.uas.platform.b2b.service.OrderRedDotService;
 import com.uas.platform.b2b.service.PurchaseApCheckService;
@@ -47,6 +51,7 @@ import javax.persistence.criteria.CriteriaQuery;
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 import java.sql.SQLException;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
@@ -84,15 +89,27 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
 	@Autowired
     private EnterpriseDao enterpriseDao;
 
-	@Autowired
-    private VendorService vendorService;
-
 	@Autowired
     private SearchService searchService;
 
 	@Autowired
     private UserService userService;
 
+    /**
+     * RMB
+     */
+    private final String RMB = "RMB";
+
+    /**
+     * 港币
+     */
+    private final String HKD = "HKD";
+
+    /**
+     * 美元
+     */
+    private final String USD = "USD";
+
 	@Override
 	public List<PurchaseApCheck> findNotUploadAPcheck() {
 		return purchaseApCheckDao.findByCustUuAndStatusAndCheckStatus(SystemSession.getUser().getEnterprise().getUu(),
@@ -486,32 +503,169 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
     /**
      * 对账获取客户信息
      *
-     * @param params  分页参数
+     * @param params 分页参数
      * @param keyword 关键字
+     * @param checkDate 筛选日期
+     * @param fromDate 开始时间
+     * @param endDate 截止时间
      * @return 搜索结果
      */
     @Override
-    public SPage<Vendor> getCustomerInfo(PageParams params, String keyword) {
+    public SPage<Vendor> getCustomerInfo(PageParams params, String keyword, String checkDate, Long fromDate, Long endDate) {
         SPage<Vendor> vendorSPage = searchCustomerInfo(params, keyword);
         final Long enUU = SystemSession.getUser().getEnterprise().getUu();
-        vendorSPage.getContent().stream().filter(customer -> null != customer.getApcheck() && customer.getApcheck() == 1)
-            .forEach(customer -> {
-                Long customerUU = customer.getMyEnUU();
-                PurchaseApCheck apCheck = purchaseApCheckDao.findByCustomerUUAndEnUU(customerUU, enUU);
-                if (null != apCheck) {
-                    customer.setLastCheckDate(apCheck.getRecordDate());
-                }
-                Double adjustmentCount = commonDao.queryForObject(UnCheckedCountSqls.ADJUSTMENT_COUNT_SQL, Double.class, enUU, customerUU);
-                Double saleAcceptCount = commonDao.queryForObject(UnCheckedCountSqls.SALE_ACCEPT_COUNT_SQL, Double.class, enUU, customerUU);
-                Double saleReturnCount = commonDao.queryForObject(UnCheckedCountSqls.SALE_RETURN_COUNT_SQL, Double.class, enUU, customerUU);
-                Double makeAcceptCount = commonDao.queryForObject(UnCheckedCountSqls.MAKE_ACCEPT_COUNT_SQL, Double.class, enUU, customerUU);
-                Double makeReturnCount = commonDao.queryForObject(UnCheckedCountSqls.MAKE_RETURN_COUNT_SQL, Double.class, enUU, customerUU);
-                Double totalCount = adjustmentCount + saleAcceptCount + saleReturnCount + makeAcceptCount + makeReturnCount;
-                customer.setUncheckedCount(totalCount);
-            });
+        if (!CollectionUtils.isEmpty(vendorSPage.getContent())) {
+            vendorSPage.getContent().stream().filter(customer -> null != customer.getApcheck() && customer.getApcheck() == 1)
+                .forEach(customer -> {
+                    Long customerUU = customer.getMyEnUU();
+                    // 应收总额
+                    List<TradeCount> totalTrades = getDueTrade(enUU, customerUU);
+                    customer.setTotalCount(totalTrades);
+                    // 本月应收
+                    List<TradeCount> thisMonthTrades = getThisMonthTrade(enUU, customerUU, checkDate, fromDate, endDate);
+                    customer.setThisMonthCount(thisMonthTrades);
+                });
+        }
         return vendorSPage;
     }
 
+    /**
+     * 获取指定月份应收金额
+     *
+     * @param enUU 企业UU
+     * @param customerUU 客户企业UU
+     * @param checkDate 筛选月份
+     * @param fromDate 开始时间
+     * @param endDate 截止时间
+     * @return 统计结果
+     */
+    @Override
+    public List<TradeCount> getThisMonthTrade(Long enUU, Long customerUU, String checkDate, Long fromDate, Long endDate) {
+        String sqlFromDate;
+        String sqlEndDate;
+        /*
+         * 1、 如果前端指定开始截止时间,直接使用
+         * 2、 如果前端未指定,采用选择月份,使用月份处理
+         * 3、 截止时间筛为指定月份加1,即下月一号,采用小于这天,能取到当月所有数据
+         */
+        final Integer oneDayMilliseconds = 86400000;
+        boolean onlyCheckDate = (null == fromDate || null == endDate) && null != checkDate;
+        if (null != fromDate && null != endDate ) {
+            sqlFromDate = DateFormatUtils.DATE_FORMAT.format(new Date(fromDate));
+            sqlEndDate = DateFormatUtils.DATE_FORMAT.format(new Date(endDate + oneDayMilliseconds));
+        } else if (onlyCheckDate) {
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
+            Date date;
+            Date checkTime;
+            try {
+                date = DateUtils.dateAddMonth(format.parse(checkDate), 1);
+                checkTime = format.parse(checkDate);
+            } catch (ParseException e) {
+                throw new IllegalOperatorException("时间格式异常");
+            }
+            sqlFromDate = DateFormatUtils.DATE_FORMAT.format(checkTime);
+            sqlEndDate = DateFormatUtils.DATE_FORMAT.format(date);
+        } else {
+            throw new IllegalOperatorException("请选择对账时间");
+        }
+        List<TradeCount> totalTrades = new ArrayList<>();
+        ThreadUtils
+            // 货款调账
+            .task(() -> {
+                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_ADJUSTMENT_COUNT_SQL, TradeCount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
+                totalTrades.addAll(trades);
+            })
+            // 采购验收
+            .task(() -> {
+                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_SALE_ACCEPT_COUNT_SQL, TradeCount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
+                totalTrades.addAll(trades);
+            })
+            // 采购验退
+            .task(() -> {
+                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_SALE_RETURN_COUNT_SQL, TradeCount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
+                totalTrades.addAll(trades);
+            })
+            // 委外验收
+            .task(() -> {
+                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_MAKE_ACCEPT_COUNT_SQL, TradeCount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
+                totalTrades.addAll(trades);
+            })
+            // 委外验退
+            .task(() -> {
+                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.THISMONTH_MAKE_RETURN_COUNT_SQL, TradeCount.class, enUU, customerUU, sqlFromDate, sqlEndDate);
+                totalTrades.addAll(trades);
+            })
+            .run();
+        Double rmbCount = totalTrades.stream().filter(tradeCount -> RMB.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
+            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
+        Double usdCount = totalTrades.stream().filter(tradeCount -> USD.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
+            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
+        Double hkdCount = totalTrades.stream().filter(tradeCount -> HKD.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
+            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
+        List<TradeCount> resultCounts = new ArrayList<>();
+        resultCounts.add(new TradeCount(RMB, rmbCount));
+        resultCounts.add(new TradeCount(USD, usdCount));
+        resultCounts.add(new TradeCount(HKD, hkdCount));
+        return resultCounts;
+    }
+
+    /**
+     * 获取总的应收金额
+     *
+     * @param enUU 企业UU
+     * @param customerUU 客户企业UU
+     * @return 统计结果
+     */
+    @Override
+    public List<TradeCount> getDueTrade(Long enUU, Long customerUU) {
+        List<TradeCount> totalTrades = new ArrayList<>();
+        ThreadUtils
+            // 货款调账
+            .task(() -> {
+                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.ADJUSTMENT_COUNT_SQL, TradeCount.class, enUU, customerUU);
+                totalTrades.addAll(trades);
+            })
+            // 采购验收
+            .task(() -> {
+                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.SALE_ACCEPT_COUNT_SQL, TradeCount.class, enUU, customerUU);
+                totalTrades.addAll(trades);
+            })
+            // 采购验退
+            .task(() -> {
+                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.SALE_RETURN_COUNT_SQL, TradeCount.class, enUU, customerUU);
+                totalTrades.addAll(trades);
+            })
+            // 委外验收
+            .task(() -> {
+                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.MAKE_ACCEPT_COUNT_SQL, TradeCount.class, enUU, customerUU);
+                totalTrades.addAll(trades);
+            })
+            // 委外验退
+            .task(() -> {
+                List<TradeCount> trades = commonDao.query(UnCheckedCountSqls.MAKE_RETURN_COUNT_SQL, TradeCount.class, enUU, customerUU);
+                totalTrades.addAll(trades);
+            })
+            .run();
+        Double rmbCount = totalTrades.stream().filter(tradeCount -> RMB.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
+            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
+        Double usdCount = totalTrades.stream().filter(tradeCount -> USD.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
+            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
+        Double hkdCount = totalTrades.stream().filter(tradeCount -> HKD.equals(tradeCount.getCurrency()) && null != tradeCount.getAmount())
+            .mapToDouble(trade -> trade.getAmount().doubleValue()).sum();
+        List<TradeCount> resultCounts = new ArrayList<>();
+        resultCounts.add(new TradeCount(RMB, rmbCount));
+        resultCounts.add(new TradeCount(USD, usdCount));
+        resultCounts.add(new TradeCount(HKD, hkdCount));
+        return resultCounts;
+    }
+
+    /**
+     * 查询客户信息
+     *
+     * @param params 分页参数
+     * @param keyword 关键词
+     * @return 符合条件的客户
+     */
     private SPage<Vendor> searchCustomerInfo(PageParams params, String keyword) {
         com.uas.search.b2b.model.PageParams pageParams = searchService.convertPageParams(params, null);
         List<Object> vendInfo = new ArrayList<>();
@@ -522,7 +676,7 @@ public class PurchaseApCheckServiceImpl implements PurchaseApCheckService {
         List<Sort> sortList = new ArrayList<>();
         SearchFilter filter = userService.distribute();
         if (filter != null && filter.getDistribute() == null) {
-            return null;
+            return new SPage<>();
         }
         if (filter != null && !CollectionUtils.isEmpty(filter.getDistribute())) {
             List<Object> list = new ArrayList<>();

+ 43 - 44
src/main/java/com/uas/platform/b2b/service/impl/UserServiceImpl.java

@@ -28,6 +28,7 @@ import com.uas.platform.core.exception.SystemException;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.model.PageInfo;
+import com.uas.platform.core.model.PageParams;
 import com.uas.platform.core.model.Status;
 import com.uas.platform.core.util.AgentUtils;
 import com.uas.platform.core.util.encry.Md5Utils;
@@ -51,6 +52,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * @author US50
@@ -623,15 +625,16 @@ public class UserServiceImpl implements UserService {
 	 */
 	@Override
 	public Set<User> findUsersByKeyWord(String keyword) {
-		List<User> users = new ArrayList<User>();
-		Set<User> userSet = new HashSet<User>();
+		Set<User> userSet = new HashSet<>();
 		Long enUU = SystemSession.getUser().getEnterprise().getUu();
 		userSet.addAll(userDao.findUserByUserEmailAndEnUU(keyword, enUU));
 		userSet.addAll(userDao.findUserByUserTelAndEnUU(keyword, enUU));
-		userSet.addAll(userDao.findByEnUUAndUserUU(enUU, Long.parseLong(keyword)));
+		if (keyword.matches(UU_REGEXP)) {
+            userSet.addAll(userDao.findByEnUUAndUserUU(enUU, Long.parseLong(keyword)));
+        }
 		userSet.addAll(userDao.findUserByUserNameAndEnUU(keyword, enUU));
 		if (!CollectionUtils.isEmpty(userSet)) {
-			for (User user : users) {
+			for (User user : userSet) {
 				user.setCurrentEnterpriseRoles(enUU);
 			}
 		}
@@ -650,9 +653,9 @@ public class UserServiceImpl implements UserService {
 	}
 
 	@Override
-	public Boolean getDistribute(Long custUU) {
-		List<Vendor> vendors = vendorDao.findByMyEnUUAndVendUU(custUU, SystemSession.getUser().getEnterprise().getUu());
-		List<Distribute> distributes = distributeDao.findByUserUUAndVendorId(SystemSession.getUser().getUserUU(), vendors.get(0).getId());
+	public Boolean getDistribute(Long id) {
+		Vendor vendor = vendorDao.findOne(id);
+		List<Distribute> distributes = distributeDao.findByUserUUAndVendorId(SystemSession.getUser().getUserUU(), vendor.getId());
 		// 被分配了权限
 		if (!CollectionUtils.isEmpty(distributes)) {
 			return true;
@@ -740,6 +743,8 @@ public class UserServiceImpl implements UserService {
 	@Override
 	public boolean addCustomerToUser(Long userUU, List<Vendor> vendors) {
 		if (!CollectionUtils.isEmpty(vendors)) {
+		    List<Distribute> needToSave = new ArrayList<>();
+		    List<Distribute> needToRemove = new ArrayList<>();
 			for (Vendor vendor : vendors) {
 				Distribute disbute = new Distribute();
 				if (vendor.getDistribute()) {
@@ -747,15 +752,21 @@ public class UserServiceImpl implements UserService {
 					if (CollectionUtils.isEmpty(disbutes)) {
 						disbute.setUserUU(userUU);
 						disbute.setVendorId(vendor.getId());
-						distributeDao.save(disbute);
+                        needToSave.add(disbute);
 					}
 				} else {
 					List<Distribute> disbutes = distributeDao.findByUserUUAndVendorId(userUU, vendor.getId());
 					if (!CollectionUtils.isEmpty(disbutes)) {
-						distributeDao.delete(disbutes.get(0));
+                        needToRemove.add(disbutes.get(0));
 					}
 				}
 			}
+			if (!CollectionUtils.isEmpty(needToSave)) {
+                distributeDao.save(needToSave);
+            }
+            if (!CollectionUtils.isEmpty(needToRemove)) {
+                distributeDao.delete(needToRemove);
+            }
 			return true;
 		}
 		return false;
@@ -763,19 +774,8 @@ public class UserServiceImpl implements UserService {
 
 	@Override
 	public List<Vendor> findChooseVendor(Long userUU) {
-		List<Vendor> vendors = vendorDao.findByVendEnUU(SystemSession.getUser().getEnterprise().getUu());
-		List<Vendor> vendors2 = new ArrayList<Vendor>();
-		List<Distribute> distributes = distributeDao.findByUserUU(userUU);
-		if (!CollectionUtils.isEmpty(distributes) && !CollectionUtils.isEmpty(vendors)) {
-			for (Distribute d : distributes) {
-				for (int i = 0; i < vendors.size(); i++) {
-					if (d.getVendorId().equals(vendors.get(i).getId())) {
-						vendors2.add(vendors.get(i));
-					}
-				}
-			}
-		}
-		return vendors2;
+        List<Distribute> distributes = distributeDao.findByUserUUAndVendorUU(userUU, SystemSession.getUser().getEnterprise().getUu());
+        return distributes.stream().map(Distribute::getVendor).collect(Collectors.toList());
 	}
 
 	@Override
@@ -831,12 +831,13 @@ public class UserServiceImpl implements UserService {
 	}
 
 	@Override
-	public List<UserBaseInfo> findUserInfoDistribute(Long enUu) {
-		List<Distribute> butes = vendorService.findUserInfo(enUu);
-		List<UserBaseInfo> users = userBaseInfoDao.findByEnUU(SystemSession.getUser().getEnterprise().getUu());
-		if (!CollectionUtils.isEmpty(users)) {
-			if (!CollectionUtils.isEmpty(butes)) {
-				for (UserBaseInfo u : users) {
+	public SPage<UserBaseInfo> findUserInfoDistribute(Long id, PageParams params, String keyword) {
+        SPage<UserBaseInfo> userBaseInfoSPage = vendorService.findUserInfoByPage(params, keyword);
+        if (!CollectionUtils.isEmpty(userBaseInfoSPage.getContent())) {
+            List<Long> userUUList = userBaseInfoSPage.getContent().stream().map(UserBaseInfo::getUserUU).collect(Collectors.toList());
+            List<Distribute> butes = distributeDao.findByVendorIdAndUserUUIn(id, userUUList);
+            if (!CollectionUtils.isEmpty(butes)) {
+				for (UserBaseInfo u : userBaseInfoSPage.getContent()) {
 					for (Distribute d : butes) {
 						if (u.getUserUU().equals(d.getUserUU())) {
 							u.setDistribute(true);
@@ -847,25 +848,25 @@ public class UserServiceImpl implements UserService {
 					}
 				}
 			}
-			return users;
+			return userBaseInfoSPage;
 		}
-		return null;
+		return new SPage<>();
 	}
 
 	@Override
-	public boolean addUserToVendor(Long custUU, List<User> users) {
-		List<Vendor> vendors = vendorDao.findByMyEnUUAndVendUU(custUU, SystemSession.getUser().getEnterprise().getUu());
+	public boolean addUserToVendor(Long id, List<UserBaseInfo> users) {
+		Vendor vendor = vendorDao.findOne(id);
 		if (!CollectionUtils.isEmpty(users)) {
 		    List<Distribute> saveList = new ArrayList<>();
-			for (User u : users) {
+			for (UserBaseInfo u : users) {
 				List<Distribute> deleteList = new ArrayList<>();
 				if (null != u.getUserUU()) {
                     Distribute distribute = new Distribute();
-                    List<Distribute> butes = distributeDao.findByUserUUAndVendorId(u.getUserUU(), vendors.get(0).getId());
-                    if (u.getDistribute()) {
+                    List<Distribute> butes = distributeDao.findByUserUUAndVendorId(u.getUserUU(), vendor.getId());
+                    if (u.isDistribute()) {
                         if (CollectionUtils.isEmpty(butes)) {
                             distribute.setUserUU(u.getUserUU());
-                            distribute.setVendorId(vendors.get(0).getId());
+                            distribute.setVendorId(vendor.getId());
                             distribute.setLeaderUU(SystemSession.getUser().getUserUU());
                             saveList.add(distribute);
                         }
@@ -874,10 +875,9 @@ public class UserServiceImpl implements UserService {
                         if (!CollectionUtils.isEmpty(butes)) {
                             // 当前用户
                             deleteList.add(butes.get(0));
-                            Long vendorId = vendors.get(0).getId();
                             Long userUU = u.getUserUU();
 							if (null != butes.get(0).getIsTransfer() && 1 == butes.get(0).getIsTransfer()) {
-								deleteList = deleteChildrenDistributes(vendorId, userUU, deleteList);
+								deleteList = deleteChildrenDistributes(id, userUU, deleteList);
 							}
                             // 防止出现作为参数的用户之间存在权限父子节点关系,导致重复查询,所以每次递归完成,执行一次删除
                             distributeDao.delete(deleteList);
@@ -914,16 +914,15 @@ public class UserServiceImpl implements UserService {
     }
 
 	@Override
-	public boolean transferUserToVendor(Long custUU, List<User> users) {
-		List<Vendor> vendors = vendorDao.findByMyEnUUAndVendUU(custUU, SystemSession.getUser().getEnterprise().getUu());
-		if (!CollectionUtils.isEmpty(vendors) && !CollectionUtils.isEmpty(users)) {
-			Vendor vendor = vendors.get(0);
+	public boolean transferUserToVendor(Long id, List<UserBaseInfo> users) {
+		if (!CollectionUtils.isEmpty(users)) {
 			// 被转移人UU,用于修改转移人下属权限的leaderUU
+            Vendor vendor = vendorDao.findOne(id);
 			Long userUU = null;
-			for (User u : users) {
+			for (UserBaseInfo u : users) {
 				Distribute distribute = new Distribute();
 				List<Distribute> transfers = distributeDao.findByUserUUAndVendorId(u.getUserUU(), vendor.getId());
-				if (u.getTransfer()) {
+				if (u.isTransfer()) {
 					if (CollectionUtils.isEmpty(transfers)) {
 						distribute.setUserUU(u.getUserUU());
 						distribute.setVendorId(vendor.getId());

+ 68 - 45
src/main/java/com/uas/platform/b2b/service/impl/VendorsServiceImpl.java

@@ -26,6 +26,7 @@ import com.uas.platform.b2b.search.SearchService;
 import com.uas.platform.b2b.service.UserService;
 import com.uas.platform.b2b.service.VendorService;
 import com.uas.platform.b2b.support.CollectionUtil;
+import com.uas.platform.b2b.support.SPageUtils;
 import com.uas.platform.b2b.support.SystemSession;
 import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.model.PageInfo;
@@ -37,6 +38,7 @@ import com.uas.search.b2b.model.Sort;
 import com.uas.search.b2b.util.SearchConstants;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
 import org.springframework.stereotype.Service;
 import org.springframework.ui.ModelMap;
 import org.springframework.util.CollectionUtils;
@@ -502,8 +504,9 @@ public class VendorsServiceImpl implements VendorService {
                 Iterator<VendorDistribute> iterator = distributeListCopy.iterator();
                 while (iterator.hasNext()) {
                     VendorDistribute distribute = iterator.next();
-                    if (Objects.equals(vendor.getId(), distribute.getVendorId())
-                        && (1 == distribute.getIsTransfer() || 1 == distribute.getDistribute())) {
+                    boolean existContacts = Objects.equals(vendor.getId(), distribute.getVendorId())
+                        && (1 == distribute.getIsTransfer() || 1 == distribute.getDistribute());
+                    if (existContacts) {
                         contacts.add(distribute.getUser().getUserName());
                         iterator.remove();
                     }
@@ -521,14 +524,14 @@ public class VendorsServiceImpl implements VendorService {
      * @return 分配结果 成功或失败
      */
     @Override
-    public boolean bindVendorToUser(Long id, List<User> userList) {
+    public boolean bindVendorToUser(Long id, List<UserBaseInfo> userList) {
         if (!CollectionUtils.isEmpty(userList)) {
             List<VendorDistribute> needSaveOrUpdateList = new ArrayList<>();
             List<VendorDistribute> needDeleteList = new ArrayList<>();
-            for (User user : userList) {
+            for (UserBaseInfo user : userList) {
                 Long userUU = user.getUserUU();
                 VendorDistribute distribute = new VendorDistribute();
-                if (user.getDistribute()) {
+                if (user.isDistribute()) {
                     List<VendorDistribute> distributes = vendorDistributeDao.findByUserUUAndVendorId(userUU, id);
                     if (CollectionUtils.isEmpty(distributes)) {
                         distribute.setUserUU(userUU);
@@ -577,15 +580,16 @@ public class VendorsServiceImpl implements VendorService {
      * @return 转移结果
      */
     @Override
-    public boolean transferVendorToUser(Long id, List<User> users) throws IllegalAccessException {
+    public boolean transferVendorToUser(Long id, List<UserBaseInfo> users) throws IllegalAccessException {
         Vendor vendor = vendorDao.findOne(id);
         if (!CollectionUtils.isEmpty(users)) {
             List<VendorDistribute> saveList = new ArrayList<>();
-            for (User u : users) {
+            for (UserBaseInfo u : users) {
                 if (null != u.getUserUU()) {
                     VendorDistribute distribute = new VendorDistribute();
                     List<VendorDistribute> distributes = vendorDistributeDao.findByUserUUAndVendorId(u.getUserUU(), vendor.getId());
-                    if (u.getTransfer()) {
+                    List<VendorDistribute> transferDistributes = vendorDistributeDao.findByVendorIdAndIsTransfer(id, Constant.YES);
+                    if (u.isTransfer()) {
                         if (CollectionUtils.isEmpty(distributes)) {
                             distribute.setUserUU(u.getUserUU());
                             distribute.setVendorId(vendor.getId());
@@ -607,6 +611,12 @@ public class VendorsServiceImpl implements VendorService {
                                 saveList.add(distribute);
                             }
                         }
+                        // 删除该企业以前转移的用户
+                        if (!CollectionUtil.isEmpty(transferDistributes) && !Objects.equals(u.getUserUU(), transferDistributes.get(0).getUserUU())) {
+                            distribute = transferDistributes.get(0);
+                            distribute.setIsTransfer(Constant.NO);
+                            saveList.add(distribute);
+                        }
                     } else {
                         // 删除当前用户的权限子节点用户
                         if (!CollectionUtils.isEmpty(distributes)) {
@@ -653,30 +663,6 @@ public class VendorsServiceImpl implements VendorService {
         }
     }
 
-    /**
-     * 删除用户的所有关联节点
-     * @param vendorId 供应商关系id
-     * @param userUU  用户UU
-     * @param deleteList 删除idList
-     * @return
-     */
-    private List<VendorDistribute> deleteChildrenDistributes(Long vendorId, Long userUU, List<VendorDistribute> deleteList) {
-        // 删除时,同时删除被其分配权限的其他用户
-        List<VendorDistribute> distributes = vendorDistributeDao.findByVendorIdAndLeaderUU(vendorId, userUU);
-        List<VendorDistribute> vendorDistributes = new ArrayList<>();
-        if (!CollectionUtils.isEmpty(distributes)) {
-            deleteList.addAll(distributes);
-            // 被删除用户拥有转移权限时,继续删除其子节点
-            for (VendorDistribute distribute : distributes) {
-                if (null != distribute.getIsTransfer() && 1 == distribute.getIsTransfer()) {
-                    distribute.setIsTransfer(Constant.NO);
-                    vendorDistributes.add(distribute);
-                }
-            }
-        }
-        return deleteList;
-    }
-
     /**
      * 通过供应商UU查询供应商分配信息
      *
@@ -684,22 +670,59 @@ public class VendorsServiceImpl implements VendorService {
      * @return 分配的供应商
      */
     @Override
-    public List<UserBaseInfo> findUserInfoVendDistribute(Long veId) throws IllegalAccessException {
+    public SPage<UserBaseInfo> findUserInfoVendDistribute(Long veId, PageParams params, String keyword) throws IllegalAccessException {
         checkAuthority(veId);
         List<VendorDistribute> distributes = vendorDistributeDao.findByVendorId(veId);
-        List<UserBaseInfo> users = userBaseInfoDao.findByEnUU(SystemSession.getUser().getEnterprise().getUu());
-        users.forEach(user -> {
-            distributes.forEach(distribute -> {
-                if (user.getUserUU().equals(distribute.getUserUU())) {
-                    if (Constant.YES == distribute.getDistribute()) {
-                        user.setDistribute(true);
-                    }
-                    if (null != distribute.getIsTransfer() && Constant.YES == distribute.getIsTransfer()) {
-                        user.setTransfer(true);
+        SPage<UserBaseInfo> userBaseInfoSPage = findUserInfoByPage(params, keyword);
+        if (!CollectionUtil.isEmpty(userBaseInfoSPage.getContent())) {
+            userBaseInfoSPage.getContent().forEach(user -> {
+                distributes.forEach(distribute -> {
+                    if (user.getUserUU().equals(distribute.getUserUU())) {
+                        if (Constant.YES == distribute.getDistribute()) {
+                            user.setDistribute(true);
+                        }
+                        if (null != distribute.getIsTransfer() && Constant.YES == distribute.getIsTransfer()) {
+                            user.setTransfer(true);
+                        }
                     }
-                }
+                });
             });
-        });
-        return users;
+        }
+        return userBaseInfoSPage;
+    }
+
+    /**
+     * 通过分页信息和关键词查询用户信息
+     *
+     * @param params  分页参数
+     * @param keyword 关键词
+     * @return 符合条件的数据
+     */
+    @Override
+    public SPage<UserBaseInfo> findUserInfoByPage(PageParams params, String keyword) {
+        Long enUU = SystemSession.getUser().getEnterprise().getUu();
+        PageInfo pageInfo = new PageInfo(params);
+        List<UserBaseInfo> userList;
+        Integer total;
+        Integer startIndex = (pageInfo.getPageNumber() - 1) * pageInfo.getPageSize();
+        if (StringUtils.isEmpty(keyword)) {
+            userList = userBaseInfoDao.findByEnUU(enUU, startIndex, pageInfo.getPageSize());
+            total = userBaseInfoDao.countByEnUU(enUU);
+        } else {
+            userList = userBaseInfoDao.findByEnUUAndKeyword(enUU, keyword, startIndex, pageInfo.getPageSize());
+            total = userBaseInfoDao.countByEnUUAndKeyword(enUU, keyword);
+        }
+        return SPageUtils.covertSPage(new PageImpl<>(userList, pageInfo, total));
+    }
+
+    /**
+     * 通过客户关系表id查询分配关系
+     *
+     * @param id 客户关系表id
+     * @return 分配的客户
+     */
+    @Override
+    public List<Distribute> findByVeId(Long id) {
+        return distributeDao.findByVendorId(id);
     }
 }

+ 21 - 21
src/main/java/com/uas/platform/b2b/task/SendNoticeTask.java

@@ -7,6 +7,7 @@ import com.uas.platform.b2b.dao.PurchaseOrderDao;
 import com.uas.platform.b2b.model.CommunalLog;
 import com.uas.platform.core.model.Constant;
 import com.uas.platform.core.util.HttpUtil;
+import org.apache.commons.lang3.time.FastDateFormat;
 import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.log4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -137,25 +138,26 @@ public class SendNoticeTask {
      * <pre>
      *  1.判断当前是否属于同一个年份
      *      1.1.属于同一年
-     *          1.1.1.物料备料提前期为-1
-     *              1.1.1.1.如果交货期为当月或之前月份,可以发货
-     *              1.1.1.2.如果交货期为下月
-     *                  1.1.1.2.1.如果当前日期大于25,可以发货
-     *                  1.1.1.2.2.如果当前日期小于或等于25,不可以发货
-     *              1.1.1.3.如果交货日期大于下月,不可以发货
-     *          1.1.2.物料备料提前期为具体天数
-     *              1.1.2.1.交货日期小于备料提前期 + 当前日期,可以发货
-     *              1.1.2.2.其他状况不可以发货
+     *          物料备料提前期为-1
+     *             如果交货期为当月或之前月份,可以发货
+     *              如果交货期为下月
+     *                 如果当前日期大于25,可以发货
+     *                 如果当前日期小于或等于25,不可以发货
+     *              如果交货日期大于下月,不可以发货
+     *          物料备料提前期为具体天数
+     *              交货日期小于备料提前期 + 当前日期,可以发货
+     *              其他状况不可以发货
      *      1.2.不属于同一年
-     *          1.2.1.如果备料提前期大于或等于0
-     *              1.2.1.1.当前日期+备料提前期+1大于收货日期,可以发货
-     *              1.2.1.2.其他条件不能发货
+     *          如果备料提前期大于或等于0
+     *          当前日期+备料提前期大于收货日期,可以发货
+     *          其他条件不能发货
      *
      * </pre>
-     *
+     * <a herf="https://static.usoftchina.com//appb2c/5b20e18e-7bc3-4813-b479-98e7b747217a.pdf">逻辑附件</a>
      * @param delivery 发货日期
      * @param stock 备料提前期
      * @return 1: 等待发货 0: 可以发货
+     *
      */
     private static Short checkNoticeWaitStatus(Date delivery, Integer stock) {
         Integer nowYear = DateUtils.getYear(new Date());
@@ -180,7 +182,7 @@ public class SendNoticeTask {
                 }
             } else if (stock >= 0) {
                 Date resultDay = DateUtils.addDay(new Date(), stock);
-                if (DateUtils.compare(resultDay, delivery, DateUtils.COMPARE_DAY) == 1) {
+                if (DateUtils.dateCompare(resultDay, delivery, DateUtils.COMPARE_DAY) >= 0) {
                     return Constant.NO;
                 } else {
                     return Constant.YES;
@@ -188,8 +190,8 @@ public class SendNoticeTask {
             }
         } else {
             if (stock >= 0) {
-                Date resultDay = DateUtils.addDay(new Date(), stock + 1);
-                if (DateUtils.compare(resultDay, delivery, DateUtils.COMPARE_DAY) == 1) {
+                Date resultDay = DateUtils.addDay(new Date(), stock);
+                if (DateUtils.dateCompare(resultDay, delivery, DateUtils.COMPARE_DAY) >= 0) {
                     return Constant.NO;
                 } else {
                     return Constant.YES;
@@ -200,10 +202,8 @@ public class SendNoticeTask {
     }
 
     public static void main(String[] args) throws ParseException {
-        Long start = System.currentTimeMillis();
-        Date date = DateUtils.YMD.parse("2019-01-06");
-        System.out.println(checkNoticeWaitStatus(date, 60));
-        Long cost = System.currentTimeMillis() - start;
-        System.out.println("cost: " + cost);
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Short status = checkNoticeWaitStatus(dateFormat.parse("2019-01-11"), 32);
+        System.out.println(status);
     }
 }

+ 8 - 8
src/main/resources/dev/account.properties

@@ -1,7 +1,7 @@
-account.us.save.url=http://192.168.253.6:32323/api/userspace
-account.user.save.url=http://192.168.253.6:32323/api/user
-account.user.getPartners.url = http://192.168.253.6:32323/api/partners
-account.user.getContactPage.url=http://192.168.253.6:32323/business/groups
+account.us.save.url=https://test-sso.uuzcc.cn/api/userspace
+account.user.save.url=https://test-sso.uuzcc.cn/api/user
+account.user.getPartners.url = https://test-sso.uuzcc.cn/api/partners
+account.user.getContactPage.url=https://test-sso.uuzcc.cn/business/groups
 
 ### sso config
 sso.app=b2b
@@ -9,12 +9,12 @@ sso.app=b2b
 sso.secretkey=0taQcW073Z7G628g5H
 sso.cookie.secure=false
 sso.cookie.browser=false
-sso.login.url=http://192.168.253.6:32323/
-sso.logout.url=http://192.168.253.6:32323/logquit
+sso.login.url=https://test-sso.uuzcc.cn/
+sso.logout.url=https://test-sso.uuzcc.cn/logquit
 
 #cross domain
-sso.ask.url=http://192.168.253.6:32323/sso/login/ask
-sso.askout.url=http://192.168.253.6:32323/sso/logout/ask
+sso.ask.url=https://test-sso.uuzcc.cn/sso/login/ask
+sso.askout.url=https://test-sso.uuzcc.cn/sso/logout/ask
 sso.proxy.uri=login/proxy
 sso.authcookie.secretkey=Z318866alN6gA0piuO
 sso.client.private_key=MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAIquTH9rOygR1iyMzU1CSQDXG+lJpMQgWkRWMwO3lzS+UJ3GRq1yxxD8mPFZCuItMRxP4Mvu3nvxDvsJx8lfRXk4MGswROIBPcdBAnasphN7wS5mDvDe/VBIKv+fg4j4VEnak9VUAQhS1gDtp+ZmQpCc9/gz8vueF1ueIXspAoUhAgMBAAECgYBfMP8PY1KK0Zt6nvd5NauYqQ7elg9EFJUBXU3NGmLu8Eez1NrEygk8braoy57921lffrDmKsOKvc+zn2YEoqGzbHCOuYsTDBXFCGLkj8oPeHyrs02+XuJe9j2ejhq2N04oP/TMxerFeyWnHdRCNXECrthqhwTRmGitnj2/+FLVAQJBAM93HY/5HoFlfRv9zjFy72ft/ZC60jHERXwyumbFs8z/x8sHCY1GWfgGhm1ShE1bDWAPY3W9WCFsx6nOETsHajECQQCrH8Dl7IIIHJ5D0TDisFkePnYELxpmOGlPwPOQ7hyLAdW4aB1fVIpjsWmgGOyPvmhK+b99XeLUbwpxVU7AAB3xAkAJNxJCFd+sAbUH7EMfYSqPJDwSFKpHeZ9Yf+xVqkxtO6NFOl/LPae7Y5bO/k5QHU4/yQ8y6KEkgu9vdG7Bf3fRAkEAiDlX6vDytphpmN0PyHXQC9Z3Rm9k2ZjwpM+aVXZn/HSyeQFQ2JHJNQGHby5IK0nNZloYiSlTJ/9ZVc0uSoQNUQJBAJFix2tD7b0Zq82xpeGt81rhXsofuerq1x9WM5UyYILCKJMHZw5lt58snINVzA7JxV+l60dbIgJjmRYm0yxQIAY=

+ 2 - 2
src/main/resources/dev/jdbc.properties

@@ -1,6 +1,6 @@
 jdbc.driverClassName=com.mysql.jdbc.Driver
-jdbc.url=jdbc:mysql://192.168.253.6:3306/b2b_mysql_test?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true
-jdbc.username=root
+jdbc.url=jdbc:mysql://188.131.128.107:3306/b2b_mysql_test?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true
+jdbc.username=sa
 jdbc.password=select111***
 jdbc.initialSize=5
 jdbc.maxActive=100

+ 1 - 1
src/main/resources/dev/redis.properties

@@ -1,2 +1,2 @@
-redis.host=192.168.253.6
+redis.host=188.131.128.107
 redis.port=6379

+ 6 - 6
src/main/resources/dev/sys.properties

@@ -1,26 +1,26 @@
 #path
-b2b=https://tb2b.usoftchina.com
+b2b=https://test-b2b.uuzcc.cn
 manage=http://218.17.158.219:9090/platform-manage
 manageInner=http://192.168.253.60:9090/platform-manage
 im=http://113.105.74.131:8092
-b2c=https://tmall.usoftchina.com
-registerUrl=http://192.168.253.12:32323/register/enterpriseRegistration
+b2c=https://test-b2c.uuzcc.cn
+registerUrl=https://test-sso.uuzcc.cn/register/enterpriseRegistration
 
 #report url
 reportPrintUrl=http://192.168.253.121:8090/report/print?userName=B2B%s&profile=${profile}&reportName=%s&whereCondition=%s
 reportUploadUrl=http://192.168.253.121:8090/report/fileUpload?userName=B2B%s
 
 #product service url
-productServiceUrl=http://10.1.51.92:24002
+productServiceUrl=https://test-product.uuzcc.cn
 
 #inquiry service url
-inquiryServiceUrl=http://10.1.51.92:24000
+inquiryServiceUrl=https://test-inquiry.uuzcc.cn
 
 #message service ip
 messageServiceIp=http://10.1.51.92:24001
 
 #search url
-searchUrl=http://10.1.51.92:24005
+searchUrl=http://188.131.128.107:24005
 
 #dfs file url
 dfsFileUrl=http://10.10.100.200:9999

+ 6 - 6
src/main/resources/ptest/account.properties

@@ -1,14 +1,14 @@
 ### account center config, 
-account.us.save.url=https://test-sso.uuzcc.cn/api/userspace
-account.user.save.url=https://test-sso.uuzcc.cn/api/user
-account.user.getPartners.url = https://test-sso.uuzcc.cn/api/partners
-account.user.getContactPage.url=https://test-sso.uuzcc.cn/business/groups
+account.us.save.url=http://192.168.100.16:3000/api/userspace
+account.user.save.url=http://192.168.100.16:3000/api/user
+account.user.getPartners.url = http://192.168.100.16:3000/api/partners
+account.user.getContactPage.url=http://192.168.100.16:3000/business/groups
 
 ### sso config
 sso.app=b2b
 # token secretkey
 sso.secretkey=0taQcW073Z7G628g5H
-sso.cookie.domain=usoftchina.com
+sso.cookie.domain=uuzcc.cn
 sso.cookie.secure=false
 sso.cookie.browser=false
 sso.login.url=https://test-sso.uuzcc.cn
@@ -18,7 +18,7 @@ sso.ask.url=https://test-sso.uuzcc.cn/sso/login/ask
 sso.askout.url=https://test-sso.uuzcc.cn/sso/logout/ask
 sso.updatePassword.url=https://test-sso.uuzcc.cn/reset/forgetPasswordValidationAccount
 sso.cloudcenter.url=https://test-sso.uuzcc.cn/cloudcenter
-mall.login.url=https://tmall.usoftchina.com/newLogin/other
+mall.login.url=https://test-b2c.uuzcc.cn/newLogin/other
 sso.proxy.uri=login/proxy
 sso.authcookie.secretkey=Z318866alN6gA0piuO
 sso.client.private_key=MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAIquTH9rOygR1iyMzU1CSQDXG+lJpMQgWkRWMwO3lzS+UJ3GRq1yxxD8mPFZCuItMRxP4Mvu3nvxDvsJx8lfRXk4MGswROIBPcdBAnasphN7wS5mDvDe/VBIKv+fg4j4VEnak9VUAQhS1gDtp+ZmQpCc9/gz8vueF1ueIXspAoUhAgMBAAECgYBfMP8PY1KK0Zt6nvd5NauYqQ7elg9EFJUBXU3NGmLu8Eez1NrEygk8braoy57921lffrDmKsOKvc+zn2YEoqGzbHCOuYsTDBXFCGLkj8oPeHyrs02+XuJe9j2ejhq2N04oP/TMxerFeyWnHdRCNXECrthqhwTRmGitnj2/+FLVAQJBAM93HY/5HoFlfRv9zjFy72ft/ZC60jHERXwyumbFs8z/x8sHCY1GWfgGhm1ShE1bDWAPY3W9WCFsx6nOETsHajECQQCrH8Dl7IIIHJ5D0TDisFkePnYELxpmOGlPwPOQ7hyLAdW4aB1fVIpjsWmgGOyPvmhK+b99XeLUbwpxVU7AAB3xAkAJNxJCFd+sAbUH7EMfYSqPJDwSFKpHeZ9Yf+xVqkxtO6NFOl/LPae7Y5bO/k5QHU4/yQ8y6KEkgu9vdG7Bf3fRAkEAiDlX6vDytphpmN0PyHXQC9Z3Rm9k2ZjwpM+aVXZn/HSyeQFQ2JHJNQGHby5IK0nNZloYiSlTJ/9ZVc0uSoQNUQJBAJFix2tD7b0Zq82xpeGt81rhXsofuerq1x9WM5UyYILCKJMHZw5lt58snINVzA7JxV+l60dbIgJjmRYm0yxQIAY=

+ 1 - 1
src/main/resources/ptest/jdbc.properties

@@ -1,6 +1,6 @@
 #mysql info
 jdbc.driverClassName=com.mysql.jdbc.Driver
-jdbc.url=jdbc:mysql://188.131.128.107:3306/b2b_mysql_test?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true
+jdbc.url=jdbc:mysql://192.168.100.3:3306:3306/b2b_mysql_test?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true
 jdbc.username=sa
 jdbc.password=select111***
 jdbc.initialSize=5

+ 2 - 2
src/main/resources/ptest/sys.properties

@@ -1,5 +1,5 @@
 #path
-b2b=http://test-b2b.uuzcc.cn
+b2b=http://192.168.100.13:8080
 manage=http://manage.ubtob.com
 manageInner=http://192.168.100.13:8080
 im=http://113.105.74.140:8092
@@ -20,7 +20,7 @@ inquiryServiceUrl=https://test-inquiry.uuzcc.cn
 messageServiceIp=http://message.ubtob.com/
 
 #search url
-searchUrl=http://188.131.128.107:24005
+searchUrl=http://192.168.100.15:8080
 
 # dfs file url
 dfsFileUrl=http://dfs-api.ubtob.com

+ 0 - 26
src/main/resources/test/account.properties

@@ -1,26 +0,0 @@
-### account center config, 
-account.us.save.url=http://218.17.158.219:32323/api/userspace
-account.user.save.url=http://218.17.158.219:32323/api/user
-account.user.getPartners.url = http://218.17.158.219:32323/api/partners
-account.user.getContactPage.url=http://218.17.158.219:32323/business/groups
-
-### sso config
-sso.app=b2b
-# token secretkey
-sso.secretkey=0taQcW073Z7G628g5H
-sso.cookie.secure=false
-sso.cookie.browser=false
-sso.login.url=http://218.17.158.219:32323/
-sso.logout.url=http://218.17.158.219:32323/logquit
-
-#cross domain
-sso.ask.url=http://218.17.158.219:32323/sso/login/ask
-sso.askout.url=http://218.17.158.219:32323/sso/logout/ask
-sso.updatePassword.url=http://218.17.158.219:32323/reset/forgetPasswordValidationAccount
-sso.cloudcenter.url=http://218.17.158.219:32323/cloudcenter
-mall.login.url=http://218.17.158.219:23400/newLogin/other
-sso.proxy.uri=login/proxy
-sso.authcookie.secretkey=Z318866alN6gA0piuO
-sso.client.private_key=MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAIquTH9rOygR1iyMzU1CSQDXG+lJpMQgWkRWMwO3lzS+UJ3GRq1yxxD8mPFZCuItMRxP4Mvu3nvxDvsJx8lfRXk4MGswROIBPcdBAnasphN7wS5mDvDe/VBIKv+fg4j4VEnak9VUAQhS1gDtp+ZmQpCc9/gz8vueF1ueIXspAoUhAgMBAAECgYBfMP8PY1KK0Zt6nvd5NauYqQ7elg9EFJUBXU3NGmLu8Eez1NrEygk8braoy57921lffrDmKsOKvc+zn2YEoqGzbHCOuYsTDBXFCGLkj8oPeHyrs02+XuJe9j2ejhq2N04oP/TMxerFeyWnHdRCNXECrthqhwTRmGitnj2/+FLVAQJBAM93HY/5HoFlfRv9zjFy72ft/ZC60jHERXwyumbFs8z/x8sHCY1GWfgGhm1ShE1bDWAPY3W9WCFsx6nOETsHajECQQCrH8Dl7IIIHJ5D0TDisFkePnYELxpmOGlPwPOQ7hyLAdW4aB1fVIpjsWmgGOyPvmhK+b99XeLUbwpxVU7AAB3xAkAJNxJCFd+sAbUH7EMfYSqPJDwSFKpHeZ9Yf+xVqkxtO6NFOl/LPae7Y5bO/k5QHU4/yQ8y6KEkgu9vdG7Bf3fRAkEAiDlX6vDytphpmN0PyHXQC9Z3Rm9k2ZjwpM+aVXZn/HSyeQFQ2JHJNQGHby5IK0nNZloYiSlTJ/9ZVc0uSoQNUQJBAJFix2tD7b0Zq82xpeGt81rhXsofuerq1x9WM5UyYILCKJMHZw5lt58snINVzA7JxV+l60dbIgJjmRYm0yxQIAY=
-sso.client.public_key=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCKrkx/azsoEdYsjM1NQkkA1xvpSaTEIFpEVjMDt5c0vlCdxkatcscQ/JjxWQriLTEcT+DL7t578Q77CcfJX0V5ODBrMETiAT3HQQJ2rKYTe8EuZg7w3v1QSCr/n4OI+FRJ2pPVVAEIUtYA7afmZkKQnPf4M/L7nhdbniF7KQKFIQIDAQAB
-sso.center.public_key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAL2g7CEfuPZtEDy7Iz5AL6iwbHZewWGUBYUWxKnFAwAW4lY8mMavn5Ke5mB25eKj5bvUsB48r8gWTvJNsKRGEw8CAwEAAQ==

+ 0 - 3
src/main/resources/test/dubbo.properties

@@ -1,3 +0,0 @@
-zk.url=zookeeper://10.10.100.11:2181
-dubbo.owner=test
-dubbo.group=test

+ 0 - 5
src/main/resources/test/email.properties

@@ -1,5 +0,0 @@
-email.host=smtp.mxhichina.com
-email.port=25
-email.username=admin@usoftchina.com
-email.password=Youruan888
-email.from=admin@usoftchina.com

+ 0 - 45
src/main/resources/test/jdbc.properties

@@ -1,45 +0,0 @@
-#jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
-#jdbc.url=jdbc:oracle:thin:@218.17.158.219:1521:orcl
-#jdbc.username=uuplatformdemo
-#jdbc.password=selectuuplatform
-#jdbc.initialSize=5
-#jdbc.maxActive=100
-#jdbc.minIdle=5
-#jdbc.suspectTimeout=60
-#jdbc.timeBetweenEvictionRunsMillis=30000
-#jdbc.minEvictableIdleTimeMillis=60000
-#jdbc.validationQuery=SELECT 1 FROM DUAL
-#jdbc.testWhileIdle=true
-#jdbc.testOnBorrow=true
-#jdbc.testOmReturn=false
-#jdbc.removeAbandoned=true
-#jdbc.removeAbandonedTimeout=1800
-#
-##manage.ubtob.com
-#manage.jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
-#manage.jdbc.url=jdbc:oracle:thin:@218.17.158.219:1521:orcl
-#manage.jdbc.username=platformmanager$test
-#manage.jdbc.password=select!#%*(
-
-jdbc.driverClassName=com.mysql.jdbc.Driver
-jdbc.url=jdbc:mysql://192.168.253.6:3306/b2b_mysql_test?characterEncoding=UTF-8&allowMultiQueries=true&rewriteBatchedStatements=true
-jdbc.username=root
-jdbc.password=select111***
-jdbc.initialSize=5
-jdbc.maxActive=100
-jdbc.minIdle=5
-jdbc.suspectTimeout=60
-jdbc.timeBetweenEvictionRunsMillis=30000
-jdbc.minEvictableIdleTimeMillis=60000
-jdbc.validationQuery=SELECT 1 FROM DUAL
-jdbc.testWhileIdle=true
-jdbc.testOnBorrow=true
-jdbc.testOmReturn=false
-jdbc.removeAbandoned=true
-jdbc.removeAbandonedTimeout=1800
-
-##manage.ubtob.com
-manage.jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
-manage.jdbc.url=jdbc:oracle:thin:@218.17.158.219:1521:orcl
-manage.jdbc.username=platformmanager$test
-manage.jdbc.password=select!#%*(

+ 0 - 18
src/main/resources/test/message.properties

@@ -1,18 +0,0 @@
-tplInvitationForB2B=e565c0cf-87a2-4d18-8ce8-c5be757f5a3d
-msgInvitationForB2B=73c513f8-7423-49c4-b57c-50a63bd8a0af
-tplAfterBeAddedtoB2B=b9dee589-9fd8-45d3-9b2a-64b56d65e7e2
-msgTenderForB2B=f9e29b6f-4116-4d33-9bde-048aa037f8c6
-tplInvitationForERP=d8324da8-fa97-429c-8293-761698a94db8
-msgInvitationForERP=5081e29f-47af-4556-a560-9213af11753f
-
-## messageConfig
-tplInquiryForB2B=d94e931b-b699-46d7-8bb2-94604a3352c0
-tplAutoInquiryForB2B=fe01ead8-1e26-43d9-8278-4f8a9b4b343c
-msgInquiryForB2B=629edeb3-a87e-4a40-a5e5-51d9ae734f1b
-msgAutoInquiryForB2B=8cf71d56-09bb-4d60-993e-ed87ce72ec3b
-messageUrl=http://message.ubtob.com/sms/send
-msgAddPartForB2B=5222f956-69e8-4692-9b14-9711a4ead828
-msgAddPartNoticeManager=4d55f1aa-be3e-4690-9b0d-9f31f75deecb
-msgAddPartNoticeContact=
-
-messagePublicServiceDevUrl=http://218.17.158.219:24000/message/

+ 0 - 2
src/main/resources/test/redis.properties

@@ -1,2 +0,0 @@
-redis.host=192.168.253.6
-redis.port=6379

+ 0 - 28
src/main/resources/test/sys.properties

@@ -1,28 +0,0 @@
-#path
-b2b=http://218.17.158.219:9000/b2b-test
-manage=http://218.17.158.219:9090/platform-manage
-manageInner=http://10.1.51.24:8888
-im=http://113.105.74.131:8092
-b2c=http://192.168.253.12:23400
-registerUrl=http://192.168.253.12:32323/register/enterpriseRegistration
-
-#report url
-reportPrintUrl=http://192.168.253.121:8090/report/print?userName=B2B%s&profile=${profile}&reportName=%s&whereCondition=%s
-reportUploadUrl=http://192.168.253.121:8090/report/fileUpload?userName=B2B%s
-
-#product service url
-## test http://218.17.158.219:24000
-productServiceUrl=http://218.17.158.219:24000
-#productServiceUrl=http://10.1.51.24:8080/
-#inquiry service url
-inquiryServiceUrl=http://218.17.158.219:24000
-#inquiryServiceUrl=http://10.1.51.83:8080/
-
-#message service ip
-messageServiceIp=http://message.ubtob.com/
-
-#search url
-searchUrl=http://192.168.253.6:8081
-
-#dfs file url
-dfsFileUrl=http://10.10.100.200:9999

BIN
src/main/webapp/resources/img/vendor/images/arrow-left-d-l.png


BIN
src/main/webapp/resources/img/vendor/images/arrow-right-d-l.png


BIN
src/main/webapp/resources/img/vendor/images/backIcon.png


+ 6 - 8
src/main/webapp/resources/js/common/services.js

@@ -365,21 +365,19 @@ define(['angular', 'toaster', 'big'], function(angular, big) {
                 method: 'GET'
             },
             findUsers: {
-                url: 'account/user/customer/:uu',
-                method: 'POST',
-                isArray: true
+                url: 'account/user/customer/:id',
+                method: 'GET'
             },
             findSaleUsers: {
                 url: 'vendorDistribute/:id',
-                method: 'POST',
-                isArray: true
+                method: 'GET'
             },
             addSaleUserToVendor: {
                 url: 'vendorDistribute/bindVendor/:id',
                 method: 'POST'
             },
             addUserToVendor: {
-                url: 'account/user/bindUserToVendor/:uu',
+                url: 'account/user/bindUserToVendor/:id',
                 method: 'POST'
             },
             transferSaleUserToVendor: {
@@ -387,7 +385,7 @@ define(['angular', 'toaster', 'big'], function(angular, big) {
                 method: 'POST'
             },
             transferUserToVendor: {
-                url: 'account/user/transferUserToVendor/:uu',
+                url: 'account/user/transferUserToVendor/:id',
                 method: 'POST'
             },
             transferMyDistribute: {
@@ -400,7 +398,7 @@ define(['angular', 'toaster', 'big'], function(angular, big) {
                 isArray: true
             },
             getDistribute: {
-                url: 'account/user/getDistribute/:custUU',
+                url: 'account/user/getDistribute/:id',
                 method: 'GET'
             },
             getEnTransfer: {

+ 236 - 87
src/main/webapp/resources/js/index/app.js

@@ -2187,7 +2187,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             //     return;
             // }
             // 获取当前用户在当前企业是否被转移权限
-            AccountUser.getDistribute ({custUU: customer.myEnterprise.uu}, function(data) {
+            AccountUser.getDistribute ({id: customer.id}, function(data) {
                 customer.enDistribute = data.result;
                 //是管理员,或者被分配时
                 if ($scope.enabled || customer.enDistribute) {
@@ -2477,8 +2477,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         }
     }]);
 
-    app.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', 'AuthenticationService', 'type',
-        function ($scope, $modalInstance, customer, AccountUser, toaster, AuthenticationService, type) {
+    app.controller('AddUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', 'AuthenticationService', 'type', 'ngTableParams', 'BaseService',
+        function ($scope, $modalInstance, customer, AccountUser, toaster, AuthenticationService, type, ngTableParams, BaseService) {
         AuthenticationService.getAuthentication().success(function (data) {
             $scope.thisUser = data;
         });
@@ -2491,10 +2491,10 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             urlData = 'findSaleUsers';
             uuData = customer.id;
         } else {
-            params = {uu : customer.myEnterprise.uu};
+            params = {id : customer.id};
             urlSaveData = 'addUserToVendor';
             urlData = 'findUsers';
-            uuData = customer.myEnterprise.uu;
+            uuData = customer.id;
         }
 
         $scope.checkboxes = {
@@ -2502,7 +2502,53 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         };
         $scope.loading = true;
         $scope.distribute = [];
-        AccountUser[urlData](params, null, function (data) {
+
+        $scope.userParams = new ngTableParams({ // ng-Table参数
+            page: 1,
+            count: 10,
+            sorting: {
+            }
+        }, {
+            total: 0,
+            counts: [5, 10, 15, 25, 50],
+            getData: function ($defer, params) {// 获取数据的方法
+                $scope.loading = true;
+                var pageParams = params.url();
+                pageParams.keyword = $scope.keyword;
+                pageParams.id = uuData;
+                AccountUser[urlData].call(null, BaseService.parseParams(pageParams), function (page) {
+                    $scope.loading = false;
+                    if (page) {
+                        $defer.resolve(page.content);
+                        $scope.userinfos = page.content;
+                        var distribute = [];
+                        angular.forEach($scope.userinfos, function (user, index) {
+                            if (user.distribute) {
+                                distribute.push({num: index});
+                            }
+                        });
+                        $scope.distribute = distribute;
+                        $scope.havedone = angular.copy($scope.distribute);
+                        $scope.total = page.totalElement;
+                        params.total(page.totalElement);
+                        $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的条件
+                    }
+                }, function (response) {
+                    $scope.loading = false;
+                    toaster.pop('error', '数据加载失败', response.data);
+                });
+            }
+        });
+
+        // 搜索框回车
+        $scope.onSearch = function () {
+            $scope.userParams.page(1);
+            $scope.userParams.reload();
+            $scope.isChanged = false;
+            $scope.isChangedAll = false;
+        };
+
+        /*AccountUser[urlData](params, null, function (data) {
             $scope.userinfos = data;
             var distribute = [];
             angular.forEach($scope.userinfos, function (user, index) {
@@ -2516,8 +2562,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         }, function (res) {
             $scope.loading = false;
             toaster.pop('error', res.data);
-        });
-
+        });*/
         var checkStatus = function (userinfos) {
             var distribute = [];
             angular.forEach(userinfos, function (user, index) {
@@ -2583,19 +2628,20 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
     }]);
 
     // 转移权限
-    app.controller('TransferUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', 'AuthenticationService', 'type', function ($scope, $modalInstance, customer, AccountUser, toaster, AuthenticationService, type) {
+    app.controller('TransferUserInfoCtrl', ['$scope', '$modalInstance', 'customer', 'AccountUser', 'toaster', 'AuthenticationService', 'type', 'ngTableParams', 'BaseService',
+        function ($scope, $modalInstance, customer, AccountUser, toaster, AuthenticationService, type, ngTableParams, BaseService) {
         var urlData, urlSaveData, uuData;
         var params = {};
         if (type === 'sale') {
             params = {id : customer.id};
             urlSaveData = 'transferSaleUserToVendor';
             urlData = 'findSaleUsers';
-            uuData = customer.vendorEnterprise.uu;
+            uuData = customer.id;
         } else {
-            params = {uu : customer.myEnterprise.uu};
+            params = {id : customer.id};
             urlSaveData = 'transferUserToVendor';
             urlData = 'findUsers';
-            uuData = customer.myEnterprise.uu;
+            uuData = customer.id;
         }
 
         AuthenticationService.getAuthentication().success(function (data) {
@@ -2607,7 +2653,58 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         };
         $scope.loading = true;
         $scope.transfer = [];
-        AccountUser[urlData](params, {}, function (data) {
+        $scope.userParams = new ngTableParams({ // ng-Table参数
+            page: 1,
+            count: 10,
+            sorting: {
+            }
+        }, {
+            total: 0,
+            counts: [5, 10, 15, 25, 50],
+            getData: function ($defer, params) {// 获取数据的方法
+                $scope.loading = true;
+                var pageParams = params.url();
+                pageParams.keyword = $scope.keyword;
+                pageParams.id = uuData;
+                AccountUser[urlData].call(null, BaseService.parseParams(pageParams), function (page) {
+                    $scope.loading = false;
+                    if (page) {
+                        $defer.resolve(page.content);
+                        $scope.userinfos = page.content;
+                        var transfer = [];
+                        angular.forEach($scope.userinfos, function (user, index) {
+                            // 当前用户是被管理员转移权限时,转移的是被管理员转移的权限。
+                            if ($scope.thisUser.userUU === user.userUU && user.transfer) {
+                                $scope.thisUser.transfer = true;
+                            }
+                        });
+                        angular.forEach($scope.userinfos, function (user, index) {
+                            if ($scope.thisUser.sys || $scope.thisUser.transfer) {
+                                if (user.transfer) {
+                                    transfer.push({num: index});
+                                    user.checked = true;
+                                }
+                            } else {
+                                if (user.distribute) {
+                                    transfer.push({num: index});
+                                    user.checked = true;
+                                }
+                            }
+                        });
+                        $scope.transfer = transfer;
+                        $scope.havedone = angular.copy($scope.transfer);
+                        $scope.total = page.totalElement;
+                        params.total(page.totalElement);
+                        $scope.searchFilterXls = angular.copy(pageParams.searchFilter);//保存当前取值的条件
+                    }
+                }, function (response) {
+                    $scope.loading = false;
+                    toaster.pop('error', '数据加载失败', response.data);
+                });
+            }
+        });
+
+        /*AccountUser[urlData](params, {}, function (data) {
             $scope.userinfos = data;
             var transfer = [];
             angular.forEach($scope.userinfos, function (user, index) {
@@ -2634,7 +2731,15 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             $scope.loading = false;
         }, function (res) {
             toaster.pop('error', res.data);
-        });
+        });*/
+
+        // 搜索框回车
+        $scope.onSearch = function () {
+            $scope.userParams.page(1);
+            $scope.userParams.reload();
+            $scope.isChanged = false;
+            $scope.isChangedAll = false;
+        };
 
         var checkStatus = function (userinfos) {
             var transfer = [];
@@ -9522,7 +9627,9 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         $scope.condition = {dateZone: 1};
         $scope.currency = Symbol.currency;//将币别转化为对应的符号
         $scope.active = 'all';
-
+        $scope.apCheckCondition = {
+            $open: false
+        }
         /* 时间筛选初始化*/
         var fromDate = new Date();
         var toDate = new Date();
@@ -9554,6 +9661,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                     $scope.tableParams.page(1);
                 $scope.showNotCheck = false
             }
+            $scope.condition.$open = false
+            $scope.apCheckCondition.$open = false
         };
         $scope.changeDateZone = function (zone) {
             $scope.condition.dateZone = zone;
@@ -9585,6 +9694,16 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 pageParams.keyword = $scope.keyword;
                 if ($scope.active === 'all') {
                     pageParams.keyword = $scope.keyword
+                    var _fromDate =  $scope.thisMouthOut + '-01 00:00:00'
+                    var _d = new Date(_fromDate)
+                    _d.setDate(1)
+                    _d.setMonth(_d.getMonth() + 1)
+                    _d.setDate(_d.getDate() - 1)
+                    var _endDate = _d.getFullYear() + '-' + (_d.getMonth() + 1) + '-' + _d.getDate() + ' 00:00:00'
+                    _endDate = new Date(_endDate).getTime()
+                    _fromDate = new Date(_fromDate).getTime()
+                    pageParams.searchFilter.fromDate =  _fromDate
+                    pageParams.searchFilter.endDate = _endDate
                     FaApCheck.customer(BaseService.parseParams(pageParams), function (page) {
                         $scope.loading = false;
                         if (page) {
@@ -9746,6 +9865,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             });
             modalInstance.result.then(function (customer) {
                 $scope.suuorname = customer.myEnterprise.enName;
+                $scope.customerUU = customer.myEnterprise.uu;
             });
 
         }
@@ -9755,6 +9875,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             $scope.chooseItem = item;
             $scope.showNotCheck = true
             $scope.suuorname = item.myEnterprise.enName
+            $scope.customerUU = item.myEnterprise.uu
             this.searchOrder()
         }
 
@@ -9763,6 +9884,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
         $scope.sdateTo = new Date();
         $scope.sdateFrom = new Date($scope.sdateTo.getFullYear(), $scope.sdateTo.getMonth(), 1);
         $scope.thisMouth = $scope.sdateTo.getFullYear() +'-'+ ($scope.sdateTo.getMonth())
+        $scope.thisMouthOut = $scope.sdateTo.getFullYear() +'-'+ ($scope.sdateTo.getMonth())
         $scope.condition.uuorname = '';
         // $scope.condition.dateFrom = '';
         // $scope.condition.dateTo = '';
@@ -9773,6 +9895,10 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
         $scope.searchOrder = function (check) {
             $scope.data = [];
+            $scope.dataInfo = {
+                totalCount: [],
+                thisMonthCount: []
+            }
             $scope.checkboxes.checked = false;
             $scope.totalMoney = 0;
             $scope.condition.uuorname = $scope.suuorname;
@@ -9797,7 +9923,8 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                     prodTitle: $scope.prodTitle,
                     prodSpec: $scope.prodSpec,
                     taxRate: $scope.taxRate,
-                    suuorname: $scope.suuorname
+                    suuorname: $scope.suuorname,
+                    customerUU: $scope.customerUU
                 }
                 $scope.exportKeywords = encodeURIComponent($scope.searchKeyWord);
                 // $scope.fromDateXls = angular.copy($scope.condition.dateFrom ? $scope.condition.dateFrom.getTime() : null);//保存当前取值的起始日期
@@ -9806,23 +9933,57 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 //     toaster.pop('warning', '提示', '请先选择客户');
                 //     document.getElementById('suuorname').focus();//光标默认在客户
                 // } else {
+                $scope.fromDate = $scope.apCheckCondition.dateFrom ? $scope.apCheckCondition.dateFrom.getTime() : null;
+                $scope.endDate = $scope.apCheckCondition.dateTo ? $scope.apCheckCondition.dateTo.getTime() : null;
                     $scope.loading = true;
-                    FaApCheck.getAllByKeywords({
-                        // fromDate: $scope.fromDate,
-                        // endDate: $scope.endDate,
+                var _params = {}
+                if ($scope.apCheckCondition.$open) {
+                    _params = {
+                        fromDate: $scope.fromDate,
+                        endDate: $scope.endDate,
                         receiveName: $scope.receiveName,
                         factory: $scope.factory,
                         prodTitle: $scope.prodTitle,
                         prodSpec: $scope.prodSpec,
                         taxRate: $scope.taxRate,
                         checkDate: $scope.thisMouth,
-                        suuorname: $scope.suuorname
-                    }, function (data) {
-                        if (data.length > 0) {
-                            angular.forEach(data, function (item) {
+                        suuorname: $scope.suuorname,
+                        customerUU: $scope.customerUU,
+                    }
+                } else {
+                    _params = {
+                        receiveName: $scope.receiveName,
+                        factory: $scope.factory,
+                        prodTitle: $scope.prodTitle,
+                        prodSpec: $scope.prodSpec,
+                        taxRate: $scope.taxRate,
+                        checkDate: $scope.thisMouth,
+                        suuorname: $scope.suuorname,
+                        customerUU: $scope.customerUU,
+                    }
+                }
+                    FaApCheck.getAllByKeywords(_params, function (data) {
+                        $scope.checkMain = data;
+                        if (data.details.length > 0) {
+                            angular.forEach(data.details, function (item) {
                                 item.$selected = true;
                             });
-                            $scope.data = data;
+                            var _mouthArr = []
+                            data.thisMonthCount.forEach(function(item) {
+                                if (item.amount > 0) {
+                                    _mouthArr.push(item)
+                                }
+                            })
+                            data.thisMonthCount = _mouthArr
+                            var _totalArr = []
+                            data.totalCount.forEach(function(item) {
+                                if (item.amount > 0) {
+                                    _totalArr.push(item)
+                                }
+                            })
+                            data.totalCount = _totalArr
+                            $scope.dataInfo = data
+                            $scope.data = data.details;
                             $scope.checkboxes.checked = true;
                             $scope.getTotalMoney();
                         } else {
@@ -9844,7 +10005,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 url = url + '&fromDate=' + $scope.fromDate + '&endDate=' + $scope.endDate;
             }
             if (angular.isDefined($scope.thisMouth)) {
-                url = url + '&checkDate=' + $scope.thisMouth;x
+                url = url + '&checkDate=' + $scope.thisMouth;
             }
             if (angular.isDefined($scope.receiveName)) {
                 url = url + '&receiveName=' + $scope.receiveName;
@@ -10096,8 +10257,51 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
             if ($scope.sameCust && $scope.validQty) {
                 $scope.saveApCheck();
             }
+
+
+        }
+        // 新增
+
+        $scope.apCheckopenFilterDatePicker = function ($event, item, openParam) {
+            $event.preventDefault();
+            $event.stopPropagation();
+            item[openParam] = !item[openParam];
+            if ($scope.apCheckCondition.dateFrom && $scope.apCheckCondition.dateTo && !item[openParam]) {
+                $scope.searchOrder()
+            }
+        };
+        $scope.addMouth = function(val) {
+            var _time = new Date($scope.thisMouth)
+            _time.setMonth(_time.getMonth() + val)
+            $scope.thisMouth = _time.getFullYear() + '-' + (_time.getMonth() + 1)
+            $scope.apCheckCondition.$open = false
+            $scope.searchOrder()
         }
 
+        $scope.addMouthOut = function(val) {
+            var _time = new Date($scope.thisMouthOut)
+            _time.setMonth(_time.getMonth() + val)
+            $scope.thisMouthOut = _time.getFullYear() + '-' + (_time.getMonth() + 1)
+            $scope.tableParams.page(1);
+            $scope.tableParams.reload();
+        }
+
+        $scope.hideshowNotCheck = function() {
+            $scope.showNotCheck = false
+        }
+
+        $scope.$watch('thisMouthOut', function(newVal, oldVal) {
+            if (newVal !== oldVal) {
+                $scope.tableParams.page(1);
+                $scope.tableParams.reload();
+            }
+        })
+        $scope.$watch('thisMouth', function(newVal, oldVal) {
+            if (newVal !== oldVal) {
+                $scope.searchOrder()
+            }
+        })
+
     }]);
 
 
@@ -10396,6 +10600,7 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
 
         // 点击其中一个明细的复选框
         $scope.checkOne = function (check) {
+            check.$selected = !check.$selected
             var result = true;
             angular.forEach($scope.data, function (item) {
                 if (item.$selected != true) {
@@ -14774,38 +14979,6 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
                 }
                 $scope.customerParams.reload();
             });
-            // if (!$scope.enabled) {
-            //     toaster.pop('error', '您没有为当前客户分配用户的权限!');
-            //     return;
-            // }
-            // 获取当前用户在当前企业是否被转移权限
-            // AccountUser.getEnTransfer({custUU: customer.myEnterprise.uu}, function (data) {
-            //     customer.enTransfer = data.result;
-            //     //是管理员,或者被转移了权限时
-            //     if ($scope.enabled || customer.enTransfer) {
-            //         var modalInstance = $modal.open({
-            //             animation: true,
-            //             templateUrl: 'static/tpl/index/account/add_userInfo.html',
-            //             controller: 'AddUserInfoCtrl',
-            //             resolve: {
-            //                 customer: function () {
-            //                     return customer;
-            //                 }
-            //             }
-            //         });
-            //         modalInstance.result.then(function (changed, checked) {
-            //             if (changed) {
-            //                 if (checked)
-            //                     $scope.newUser.roles = checked;
-            //                 else
-            //                     loadUsers();
-            //             }
-            //             $scope.customerParams.reload();
-            //         });
-            //     } else {
-            //         toaster.pop('error', '您没有为当前客户分配用户的权限!');
-            //     }
-            // });
         };
 
         // 转移权限
@@ -24146,44 +24319,20 @@ define(['toaster', 'charts', 'ngTable', 'common/services', 'common/directives',
      */
     app.controller('SearchCtrl', ['$scope', '$http', '$rootScope', 'SessionService', 'AccountEnterprise', function($scope, $http, $rootScope, SessionService, AccountEnterprise) {
         $scope.hotwords = new Array();
-        var hasBrand = false;
-        var hasComponent = false;
 
-        // 热词搜索品牌
-        var hotBrand = function () {
-            $http.get($scope.toB2cLink + '/api/product/brand/mostSearchBrands'
+        // 热词搜索
+        var hotSearchList = function () {
+            $http.get('https://mall.usoftchina.com/cmsApi?method=queryContentPage&module=index_hotModels&orderBy=order_number%20ASC'
             ).success(function(data){
-                hasBrand = true;
-
-                angular.forEach(data, function (value) {
-                    $scope.hotwords.push({name: value.nameEn, url: $scope.toB2cLink + '/search?w='+ value.nameEn +'&type=brand'})
-                })
-                if (hasBrand) {
-                    hotComponent();
-                }
-            }).error(function(response) {
-                console.log(response)
-            });
-        };
-
-        // 热词搜索器件
-        var hotComponent = function () {
-            $http.get($scope.toB2cLink + '/api/product/component/mostSearchComponent'
-            ).success(function(data){
-                hasComponent = true;
-                if (hasBrand && hasComponent) {
-                    angular.forEach(data, function (value) {
-                        $scope.hotwords.push({name: value.code, url: $scope.toB2cLink + '/search?w='+ value.code +'&type=component'})
-                    })
-                }
+                $scope.hotwords = data.data
             }).error(function(response) {
                 console.log(response)
             });
         };
 
         AccountEnterprise.getB2cUrl({}, function(data) {
-            $scope.toB2cLink = data.url
-            hotBrand();
+            $scope.toB2cLink = data.url;
+            hotSearchList();
         });
 
         // 默认搜索类型

+ 0 - 2
src/main/webapp/resources/js/index/services/Fa.js

@@ -26,7 +26,6 @@ define([ 'ngResource'], function() {
 			getAllByKeywords: {
 				url: 'sale/apBillOut/getAllByKeywords',
 				method: 'GET',
-				isArray: true
 			},getDoneApCheckByKeywords: {
 				url: 'sale/apBillOut/getDoneByKeywords',
 				method: 'GET',
@@ -129,7 +128,6 @@ define([ 'ngResource'], function() {
 			getAllByKeywords: {
 				url: 'sale/apCheck/getAllByKeywords',
 				method: 'GET',
-				isArray: true
 			},
 			saveApCheck: {
 				url : 'sale/apCheck/operation/save',

+ 6 - 16
src/main/webapp/resources/tpl/index/account/add_userInfo.html

@@ -1,19 +1,9 @@
 <style>
 	#user-lists{
-		max-height: 600px;
+		max-height: 575px;
 		overflow-x: hidden;
 		overflow-y: scroll;
 	}
-	@media screen and (max-width: 1366px){
-		#user-lists{
-			max-height: 368px;
-		}
-	}
-	@media screen and (max-width: 1600px){
-		#user-lists{
-			max-height: 480px;
-		}
-	}
 </style>
 <div class="loading in" ng-class="{'in': loading}">
 	<!--<i></i>-->
@@ -28,22 +18,22 @@
 </div>
 <div class="form-group" id="window-search" style="height: 36px; margin-bottom: 0; margin-top: 5px;">
 	<div class="col-sm-12">
-		<input type="text" class="form-control input-sm ng-pristine ng-invalid ng-invalid-required ng-touched" required="" placeholder="输入用户名关键词搜索" autofocus="" ng-model="keyword" ng-search="onSearch(keyword)" />
+		<input type="text" class="form-control input-sm ng-pristine ng-invalid ng-invalid-required ng-touched" required="" placeholder="输入用户电话和用户名关键词搜索" autofocus="" ng-model="keyword" ng-search="onSearch(keyword)" />
 		<a class="btn input-group-addon" ng-click="onSearch()">搜索</a>
 	</div>
 </div>
 <div class="modal-body" id="user-lists">
 	<div>
-		<table width="99%" class="block table table-bordered table-striped table-hover">
+		<table width="99%" class="block table table-bordered table-striped table-hover" ng-table="userParams">
 		<thead>
-			<th width="80px;">用户UU</th>
+			<th width="80px;">用户电话</th>
 			<th width="100px;">用户名称</th>
 			<th width="40px;" style="text-align: center"><input type="checkbox" name="checkbox" ng-model="checkboxes.checked" ng-click="checkAll();"></th>
 		</thead>
 		<tbody>
 				<div style="overflow-y:scroll; width:100%;max-height:500px">			
-					<tr ng-repeat="user in userinfos| filter: keyword">
-						<td width="80px;">{{user.userUU}}</td>
+					<tr ng-repeat="user in $data">
+						<td width="80px;">{{user.userTel}}</td>
 						<td width="100px;">{{user.userName}}</td>
 						<td width="40px;" style="text-align: center"><input ng-model="user.distribute" name="checkbox" ng-click="checkOne()" type="checkbox"></td>
 					</tr>

+ 10 - 20
src/main/webapp/resources/tpl/index/account/transfer_userInfo.html

@@ -1,19 +1,9 @@
 <style>
 	#user-lists{
-		max-height: 600px;
+		max-height: 575px;
 		overflow-x: hidden;
 		overflow-y: scroll;
 	}
-	@media screen and (max-width: 1366px){
-		#user-lists{
-			max-height: 368px;
-		}
-	}
-	@media screen and (max-width: 1600px){
-		#user-lists{
-			max-height: 480px;
-		}
-	}
 </style>
 <div class="modal-header">
 	<h3 class="modal-title">
@@ -22,38 +12,38 @@
 </div>
 <div class="form-group" id="window-search" style="height: 36px; margin-bottom: 0; margin-top: 5px;">
 	<div class="col-sm-12">
-		<input type="text" class="form-control input-sm ng-pristine ng-invalid ng-invalid-required ng-touched" required="" placeholder="输入用户名关键词搜索" autofocus="" ng-model="keyword" ng-search="onSearch(keyword)" />
+		<input type="text" class="form-control input-sm ng-pristine ng-invalid ng-invalid-required ng-touched" required="" placeholder="输入用户电话和用户名关键词搜索" autofocus="" ng-model="keyword" ng-search="onSearch(keyword)" />
 		<a class="btn input-group-addon" ng-click="onSearch()">搜索</a>
 	</div>
 </div>
 <div class="modal-body" id="user-lists">
 	<div>
-		<table width="99%" class="block table table-bordered table-striped table-hover">
+		<table width="99%" class="block table table-bordered table-striped table-hover" ng-table="userParams">
 		<thead>
-			<th width="80px;">用户UU</th>
+			<th width="80px;">用户电话</th>
 			<th width="100px;">用户名称</th>
 			<th width="40px;"></th>
 		</thead>
 		<tbody ng-if="thisUser.sys">
 			<!-- 当前用户是管理员时 -->
-			<tr ng-repeat="user in userinfos| filter: keyword" style="overflow-y:scroll; width:100%;max-height:500px" >
-				<td width="80px;">{{user.userUU}}</td>
+			<tr ng-repeat="user in $data" style="overflow-y:scroll; width:100%;max-height:500px" >
+				<td width="80px;">{{user.userTel}}</td>
 				<td width="100px;">{{user.userName}}</td>
 				<td width="40px;" style="text-align: center"><input ng-model="user.transfer" name="checkbox" ng-click="checkOne(user)" ng-checked="user.checked" type="checkbox" title="选择"></td>
 			</tr>
 		</tbody>
 		<tbody ng-if="!thisUser.sys && thisUser.transfer">
 			<!-- 当前用户是被管理员转移权限时 -->
-			<tr ng-repeat="user in userinfos| filter: keyword">
-				<td width="80px;">{{user.userUU}}</td>
+			<tr ng-repeat="user in $data">
+				<td width="80px;">{{user.userTel}}</td>
 				<td width="100px;">{{user.userName}}</td>
 				<td width="40px;" style="text-align: center"><input ng-model="user.transfer" name="checkbox" ng-click="checkOne(user)" ng-checked="user.checked" type="checkbox" title="选择"></td>
 			</tr>
 		</tbody>
 		<tbody ng-if="!thisUser.sys && !thisUser.transfer">
 			<!-- 当前用户是非管理员,但有查看权限时 -->
-			<tr ng-repeat="user in userinfos| filter: keyword" ng-if="!user.distribute">
-				<td width="80px;">{{user.userUU}}</td>
+			<tr ng-repeat="user in $data" ng-if="!user.distribute">
+				<td width="80px;">{{user.userTel}}</td>
 				<td width="100px;">{{user.userName}}</td>
 				<td width="40px;" style="text-align: center"><input ng-model="user.transfer" name="distribute" ng-click="checkOne(user)" ng-checked="user.checked" type="checkbox" title="选择"></td>
 			</tr>

+ 1 - 1
src/main/webapp/resources/tpl/index/baseInfo/modal/quotation_modal.html

@@ -172,7 +172,7 @@
             <div class="form-group">
                 <label for="inputEmail4" class="col-xs-4 control-label">税率(%)</label>
                 <div class="col-xs-8">
-                    <input type="text" class="form-control" id="inputEmail4" placeholder="税率(数字)" ng-model="inquiryItem.taxrate" ng-pattern="/^((\d|[123456789]\d)(\.\d+)?)$/">
+                    <input type="text" class="form-control" id="inputEmail4" placeholder="税率(数字)" ng-model="inquiryItem.taxrate" ng-pattern="/^(\d|[123456789]\d)$/">
                 </div>
             </div>
         </div>

+ 1 - 1
src/main/webapp/resources/tpl/index/common/header.html

@@ -217,7 +217,7 @@
                             <div class="active-search">
                                 <ul class="list-untyled active-search-body" style="padding: 0;">
                                     <li class="active-search-item">热门搜索</li>
-                                    <li class="active-search-item" ng-repeat="hw in hotwords"><a ng-href="{{hw.url}}" ng-bind="hw.name"></a></li>
+                                    <li class="active-search-item" ng-repeat="hw in hotwords"><a ng-href="{{hw.detailsLink}}" ng-bind="hw.title"></a></li>
                                 </ul>
                             </div>
                         </div>

+ 209 - 81
src/main/webapp/resources/tpl/index/fa/apCheck.html

@@ -152,15 +152,15 @@
 						<button type="button" class="btn btn-default btn-line"
 							ng-class="{'btn-info':active=='all'}" ng-click="setActive('all')">未对账</button>
 					</div>
-					<div class="btn-group btn-group-sm">
-						<button type="button" class="btn btn-default btn-line"
-								ng-class="{'btn-info':active=='todo'}"
-								ng-click="setActive('todo')">待确认</button>
-					</div>
+					<!--<div class="btn-group btn-group-sm">-->
+						<!--<button type="button" class="btn btn-default btn-line"-->
+								<!--ng-class="{'btn-info':active=='todo'}"-->
+								<!--ng-click="setActive('todo')">待确认</button>-->
+					<!--</div>-->
 					<div class="btn-group btn-group-sm">
 						<button type="button" class="btn btn-default btn-line"
 								ng-class="{'btn-info':active=='done'}"
-								ng-click="setActive('done')">已确认
+								ng-click="setActive('done')">已对账
 							<!--<b class="new-dot" ng-if="unread.replied > 0">{{unread.replied>99?'99+':unread.replied}}</b>-->
 						</button>
 					</div>
@@ -170,6 +170,7 @@
 							<!--<b class="new-dot" ng-if="unread.cancelled > 0">{{unread.cancelled > 99 ? '99+' : unread.cancelled}}</b>-->
 						</button>
 					</div>
+
 					<!--<div class="btn-group btn-group-sm">-->
 					<!--<button type="button" class="btn btn-default btn-line"-->
 					<!--ng-class="{'btn-info':active=='all'}" ng-click="setActive('all')">全部</button>-->
@@ -195,13 +196,17 @@
 				</div>
 			</div>
 			<div class="col-xs-4 f12" style="text-align: right;height: 40px;line-height: 40px; margin-right: 20px; float: right;">
+				<div class="btn-group btn-group-sm"  style="float: right;font-size: 14px;cursor: pointer;" ng-hide="!showNotCheck" ng-click="hideshowNotCheck()">
+					<img src="static/img/vendor/images/backIcon.png" width="20"/>返回
+					<!--<b class="new-dot" ng-if="unread.cancelled > 0">{{unread.cancelled > 99 ? '99+' : unread.cancelled}}</b>-->
 
+				</div>
 			</div>
 		</div>
 	</div>
 
 	<div ng-hide="showNotCheck">
-		<div class="condition block" >
+		<div class="condition block"  ng-show="!showNotCheck">
 			<div class="search-bg condition block" style="padding: 10px 15px;">
 				<div class="row">
 					<div id="topSearch" ng-show="active !== 'all'" style="float: left">
@@ -210,15 +215,47 @@
 						<a ng-click="changeDateZone(6);condition.$open=false" title="最近六个月" ng-class="{'active':condition.dateZone=='6'}">最近六个月</a>
 						<a ng-click="condition.$open=!condition.$open;changeDateZone(-1)" title="自定义" ng-class="{'active':condition.dateZone=='-1'}" >自定义</a>
 					</div>
+					<div  style="float: left" ng-show="active === 'all'" >
+						<label class="control-label">请选择月份:</label>
+						<span ng-click="addMouthOut(-1)" style="display: inline-block;
+							width: 30px;
+							height: 30px;
+							border: 1px solid #ddd;
+							text-align: center;
+							line-height: 30px;
+							cursor: pointer;
+							vertical-align: middle;">
+							<img src="static/img/vendor/images/arrow-left-d-l.png" width="24"/>
+						</span>
+						<span class="inputsIcon control-label" style="padding-right: 5px;display: inline-block;vertical-align: top;">
+						  <wui-date
+								  format="yyyy-mm"
+								  placeholder="请选择或输入日期"
+								  id="date3"
+								  btns="{'ok':'确定','now':'此刻'}"
+								  ng-model="thisMouthOut"
+						  >
+						  </wui-date>
+						</span>
+									<span  ng-click="addMouthOut(1)" style="display: inline-block;
+							width: 30px;
+							height: 30px;
+							border: 1px solid #ddd;
+							text-align: center;
+							line-height: 30px;
+							cursor: pointer;
+							vertical-align: middle;"><img src="static/img/vendor/images/arrow-right-d-l.png" width="24"/></span>
+					</div>
 					<div class="col-xs-6" style="float: right;">
 						<div class="search">
 							<div class="form-group form-group-sm has-feedback" dropdown auto-close="outsideClick"
 								 on-toggle="searchAdvance=open">
 								<input type="search" class="form-control input-sm" ng-model="keyword"
 									   ng-search="onSearch(keyword)" placeholder="输入单据编号、客户名称、物料名称搜索" style="width: 100%" ng-show="active !== 'all'"/>
-								<input type="search" class="form-control input-sm" ng-model="keyword"
-									   ng-search="onSearch(keyword)" placeholder="客户名称" style="width: 100%" ng-show="active == 'all'"/>
-								<a class="btn input-group-addon" ng-click="onSearch(keyword)">搜索</a>
+								<a class="btn input-group-addon" href="javascript:void(0)" ng-click="onSearch(keyword)" ng-show="active !== 'all'">搜索</a>
+
+								<input type="search" class="form-control input-sm" ng-model="keyword" ng-search="onSearch(keyword)" placeholder="客户名称" style="width: 100%" ng-show="active === 'all' && !showNotCheck" />
+								<a class="btn input-group-addon" ng-click="onSearch(keyword)" ng-show="active === 'all' && !showNotCheck">搜索</a>
 							</div>
 						</div>
 					</div>
@@ -274,19 +311,28 @@
 				<thead>
 					<tr class="header">
 						<th width="313">客户名称</th>
-						<th width="250">上次对账时间</th>
-						<th width="250">未对账总额</th>
+						<th width="250">本月应收</th>
+						<th width="250">应收总额</th>
 						<th width="160">操作</th>
 					</tr>
 				</thead>
 				<tbody ng-repeat="check in ALLList">
-					<tr >
-						<td style="color: #3f84f6">{{::check.myEnterprise.enName}}</td>
-						<td ng-if="check.lastCheckDate">{{::check.lastCheckDate | date : 'MM月dd日 HH:mm'}}</td>
-						<td ng-if="!check.lastCheckDate">-</td>
-						<td>{{::check.uncheckedCount || '-'}}</td>
-						<td style="color: #3f84f6;cursor: pointer" ng-click="goToMNs(check)">立即对账</td>
-					</tr>
+				<tr >
+					<td style="color: #3f84f6">{{::check.myEnterprise.enName}}</td>
+					<td ng-if="check.thisMonthCount && check.thisMonthCount.length > 0">
+						<div ng-repeat="count in check.thisMonthCount">
+							<span>{{count.currency}}:{{count.amount | number:2}}</span>
+						</div>
+					</td>
+					<td ng-if="!check.thisMonthCount">-</td>
+					<td ng-if="check.totalCount && check.totalCount.length > 0">
+						<div ng-repeat="count in check.totalCount">
+							<span>{{count.currency}}:{{count.amount | number:2}}</span>
+						</div>
+					</td>
+					<td ng-if="!check.totalCount">-</td>
+					<td style="color: #3f84f6;cursor: pointer" ng-click="goToMNs(check)">立即对账</td>
+				</tr>
 				</tbody>
 			</table>
 		</div>
@@ -381,7 +427,7 @@
 							</div>
 							<div class="right_link">
 								<p ng-if="active != 'all'">您还未生成对账单,请立即新增对账!</p>
-								<a ng-if="active != 'all'" ui-sref="fa.apCheckList"><i class="fa fa-plus-square fa-fw"></i> 新增对账单</a>
+								<!--<a ng-if="active != 'all'" ui-sref="fa.apCheckList"><i class="fa fa-plus-square fa-fw"></i> 新增对账单</a>-->
 							</div>
 						</div>
 					</td>
@@ -394,20 +440,110 @@
 		<form class="form-horizontal"
 			  style="padding-top: 10px; padding-bottom: 20px;">
 			<div class="form-group form-group-sm form-group-inline">
-				<label class="col-sm-1 control-label">客&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;户:</label>
-				<div class="col-sm-7 control-label" style="text-align:left">
-					{{suuorname}}
+				<div  class="col-sm-6 control-label">
+					<div style="text-align: left">
+						<label>应收客户:</label>
+						<label style="text-align:left">
+							{{suuorname}}
+						</label>
+					</div>
+					<div style="text-align: left;margin-top: 20px">
+						<label>本期间应收:</label>
+						<label style="text-align:left;vertical-align: top;">
+							<div ng-if="dataInfo.thisMonthCount.length > 0" ng-repeat="count in dataInfo.thisMonthCount">
+								<span>{{count.currency}}:{{count.amount | number:2}}</span>
+							</div>
+							<div ng-if="dataInfo.thisMonthCount.length === 0">
+								0
+							</div>
+						</label>
+					</div>
+					<div style="text-align: left;margin-top: 20px">
+						<label>应收总额:</label>
+						<label style="text-align:left;vertical-align: top;">
+							<div ng-if="dataInfo.totalCount.length > 0" ng-repeat="count in dataInfo.totalCount">
+								<span>{{count.currency }}:{{count.amount | number:2}}</span>
+							</div>
+							<div ng-if="dataInfo.totalCount.length === 0">
+								0
+							</div>
+						</label>
+					</div>
 				</div>
-				<label class="col-sm-2 control-label">请选择月份:</label>
-				<div class="col-sm-2" style="padding-right: 5px">
-					<wui-date
-							format="yyyy-mm"
-							placeholder="请选择或输入日期"
-							id="date4"
-							btns="{'ok':'确定','now':'此刻'}"
-							ng-model="thisMouth"
-					>
-					</wui-date>
+				<div  class="col-sm-6 control-label condition">
+					<div>
+						<label class="control-label">请选择月份:</label>
+						<span ng-click="addMouth(-1)" style="display: inline-block;
+							width: 30px;
+							height: 30px;
+							border: 1px solid #ddd;
+							text-align: center;
+							line-height: 30px;
+							cursor: pointer;
+							vertical-align: middle;">
+							<img src="static/img/vendor/images/arrow-left-d-l.png" width="24"/>
+						</span>
+						<span class="control-label" style="padding-right: 5px;display: inline-block;vertical-align: top;padding-top: 0" ng-click="apCheckCondition.$open = false">
+							<wui-date
+								  format="yyyy-mm"
+								  placeholder="请选择或输入日期"
+								  id="date4"
+								  btns="{'ok':'确定','now':'此刻'}"
+								  ng-model="thisMouth"
+						  >
+						</wui-date>
+						</span><span  ng-click="addMouth(1)" style="display: inline-block;
+							width: 30px;
+							height: 30px;
+							border: 1px solid #ddd;
+							text-align: center;
+							line-height: 30px;
+							cursor: pointer;
+							vertical-align: middle;">
+						<img src="static/img/vendor/images/arrow-right-d-l.png" width="24"/></span>
+						<label class="control-label com-check-radio" ng-click="apCheckCondition.$open = true" style="vertical-align: middle;padding-top: 0">
+							<input type="radio" name="psa" ng-checked="apCheckCondition.$open === true"  ng-model="apCheckCondition.$open" style="vertical-align: middle">自定义
+						</label>
+					</div>
+					<div ng-hide="!apCheckCondition.$open" class="more open date fr" style="margin-top: 14px;">
+						<div class="form-inline">
+							<div class="form-group">
+								<div class="form-group input-group input-group-xs input-trigger">
+									<input type="text" ng-model="apCheckCondition.dateFrom"
+										   class="form-control" placeholder="从"
+										   datepicker-popup="yyyy-MM-dd" is-open="apCheckCondition.$fromOpened"
+										   ng-required="true" max-date = "apCheckCondition.dateTo"
+										   current-text="今天" clear-text="清除" close-text="关闭"
+										   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
+										   ng-focus="apCheckopenFilterDatePicker($event, apCheckCondition, '$fromOpened')"
+									style="height: 26px">
+									<span class="input-group-btn">
+									<button type="button" class="btn btn-default"
+											ng-click="apCheckopenFilterDatePicker($event, apCheckCondition, '$fromOpened')">
+										<i class="fa fa-calendar"></i>
+									</button>
+									</span>
+								</div>
+								<em style="margin: 0 10px;display: inline-block">–</em>
+								<div class="form-group input-group input-group-xs input-trigger">
+									<input type="text" ng-model="apCheckCondition.dateTo"
+													   class="form-control" placeholder="到"
+													   datepicker-popup="yyyy-MM-dd" is-open="apCheckCondition.$toOpened"
+													   ng-required="true" min-date = "apCheckCondition.dateFrom"
+													   current-text="今天" clear-text="清除" close-text="关闭"
+													   datepicker-options="{formatDayTitle: 'yyyy年M月', formatMonth: 'M月', showWeeks: false}"
+													   ng-focus="apCheckopenFilterDatePicker($event, apCheckCondition, '$toOpened')" style="height: 26px">
+									<span class="input-group-btn">
+										<button type="button" class="btn btn-default"
+												ng-click="apCheckopenFilterDatePicker($event, apCheckCondition, '$toOpened')">
+											<i class="fa fa-calendar"></i>
+										</button>
+									</span>
+								</div>
+							</div>
+						</div>
+
+					</div>
 				</div>
 			</div>
 			<div class="form-group form-group-sm form-group-inline">
@@ -484,68 +620,60 @@
 			<div class="table-header-wrap">
 				<table class="table table-bordered">
 					<tr>
-						<th width="36" style="vertical-align: middle;">
-							<input type="checkbox" name="checkbox" ng-model="checkboxes.checked" ng-click="checkAll()"></th>
-						<th width="100">本次<br>对账数</th>
+						<th width="36" style="vertical-align: middle;"><input type="checkbox" name="checkbox" ng-model="checkboxes.checked" ng-click="checkAll()"></th>
 						<!--<th width="70">客户<br>名称</th>-->
-						<th width="60">单据<br>编号</th>
-						<th width = "60">发货<br>单号</th>
-						<th width="35">序号</th>
-						<th width="60">类型</th>
-						<th width="60">单据<br>日期</th>
-						<th width="90">应付<br>供应商</th>
-						<th width="70">客户<br>采购单</th>
-						<th width="65">客户<br>料号</th>
-						<th width="70">客户物<br>料名称</th>
-						<th width="70">客户规<br>格型号</th>
-						<th width="65">送货<br>工厂</th>
-						<th width="55">数量</th>
+						<th width="70">采购单</th>
+						<th width="70">物料名称</th>
+						<th width="70">规格型号</th>
+						<th width="60">发货单</th>
+						<th width="55">发货数量</th>
+						<th width="60">验收单</th>
+						<th width="100">验收数量</th>
 						<th width="40">单价</th>
-						<th width="30">币别</th>
 						<th width="40">税率</th>
-						<th width="60">金额</th>
-						<th width="70">本次对<br>账金额</th>
+						<th width="70">小计</th>
+						<!--<th width="35">序号</th>-->
+						<!--<th width="60">类型</th>-->
+						<!--<th width="60">单据<br>日期</th>-->
+						<!--<th width="90">应付<br>供应商</th>-->
+						<!--<th width="65">客户<br>料号</th>-->
+						<!--<th width="65">送货<br>工厂</th>-->
+						<!--<th width="30">币别</th>-->
+						<!--<th width="60">金额</th>-->
 					</tr>
 				</table>
 			</div>
 			<div class="table-body-wrap">
 				<table class="table table-bordered">
-					<tr ng-repeat="check in data"
-						class="thAlign" style="height: 40px;">
-						<td width="36" style="text-align: center;vertical-align: middle;"><input
-								ng-model="check.$selected" name="checkbox"
-								ng-click="checkOne(check)" ng-change="getTotalMoney()"
-								type="checkbox"></td>
-						<td width="100"><input ng-model="check.thischeckqty"
-											   type="number" max="data.maxThisCheckQty"
-											   min="data.minThisCheckQty" ng-change="getTotalMoney()"
-											   style="width: 75px;" class=" input-sm text-center"></td>
-						<!--<td width="70" title="{{check.custname}}"><div-->
-								<!--style="display: -webkit-box; text-overflow: ellipsis; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 3; -webkit-box-orient: vertical;">{{::check.custname}}</div></td>-->
-						<td width="60">{{::check.inoutno}}</td>
-						<td width="60">{{::check.sendcode}}</td>
-						<td width="35" align="center">{{::check.detno}}</td>
-						<td width="60">{{::check.piclass}}</td>
-						<td width="60">{{::check.pidate | date:'yyyy-MM-dd' }}</td>
-						<td width="90" title="{{check.receivename}}">
-							<div
-									style="display: -webkit-box; text-overflow: ellipsis; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 3; -webkit-box-orient: vertical;">{{::check.receivename}}</div>
-						</td>
+					<tr ng-repeat="check in data" ng-click="checkOne(check);getTotalMoney()" class="thAlign" style="height: 40px;">
+						<td width="36" style="text-align: center;vertical-align: middle;">
+							<input ng-model="check.$selected" name="checkbox" type="checkbox" ng-checked="check.$selected"></td>
 						<td width="70">{{::check.ordercode}}</td>
-						<td width="65">{{::check.prodcode}}</td>
 						<td width="70" title="{{check.prodtitle}}">
-							<div
-									style="display: -webkit-box; text-overflow: ellipsis; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 3; -webkit-box-orient: vertical;">{{::check.prodtitle}}</div>
+							<div style="display: -webkit-box; text-overflow: ellipsis; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 3; -webkit-box-orient: vertical;">{{::check.prodtitle}}</div>
 						</td>
-						<td width="70" title="{{check.prodspec}}"><div
-								style="display: -webkit-box; text-overflow: ellipsis; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 3; -webkit-box-orient: vertical;">{{::check.prodspec}}</div></td>
-						<td width="65">{{::check.factory}}</td>
+						<td width="70" title="{{check.prodspec}}">
+							<div style="display: -webkit-box; text-overflow: ellipsis; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 3; -webkit-box-orient: vertical;">{{::check.prodspec}}</div></td>
+						<td width="60">{{::check.sendcode}}</td>
 						<td width="55">{{::check.qty}}</td>
+						<td width="60">{{::check.inoutno}}</td>
+						<td width="100">{{::check.thischeckqty}}</td>
 						<td width="40">{{::check.orderprice}}</td>
-						<td width="30">{{::check.currency}}</td>
 						<td width="40" align="center">{{::check.taxrate}}</td>
-						<td width="60">{{::(check.qty || 0)*(check.orderprice || 0) | number:2}}</td>
-						<td width="60">{{::(check.orderprice || 0)*(check.thischeckqty || 0) | number:2}}</td>
+						<td width="70">{{::(check.orderprice || 0)*(check.thischeckqty || 0) | number:2}}</td>
+						<!--<td width="70" title="{{check.custname}}"><div-->
+						<!--style="display: -webkit-box; text-overflow: ellipsis; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 3; -webkit-box-orient: vertical;">{{::check.custname}}</div></td>-->
+						<!--<td width="35" align="center">{{::check.detno}}</td>-->
+						<!--<td width="60">{{::check.piclass}}</td>-->
+						<!--<td width="60">{{::check.pidate | date:'yyyy-MM-dd' }}</td>-->
+						<!--<td width="90" title="{{check.receivename}}">-->
+						<!--<div style="display: -webkit-box; text-overflow: ellipsis; overflow: hidden; text-overflow: ellipsis; -webkit-line-clamp: 3; -webkit-box-orient: vertical;">{{::check.receivename}}</div>-->
+						<!--</td>-->
+						<!--<td width="65">{{::check.prodcode}}</td>-->
+						<!--<td width="65">{{::check.factory}}</td>-->
+						<!--<td width="30">{{::check.currency}}</td>-->
+						<!--<td width="60">{{::(check.qty || 0)*(check.orderprice || 0) | number:2}}</td>-->
+
 					</tr>
 					<tr ng-if="!data || data.length==0">
 						<td colspan="19">