Browse Source

Merge remote-tracking branch 'origin/dev-mysql' into function-productModify-hulh-0312

# Conflicts:
#	src/main/webapp/resources/js/vendor/controllers/forstore/vendor_onSaleCtrl.js
dongbw 7 years ago
parent
commit
ec09a2a8c5
100 changed files with 2644 additions and 1022 deletions
  1. BIN
      jpg
  2. 2 1
      src/main/java/com/uas/platform/b2c/common/account/controller/AuthenticationController.java
  3. 1 1
      src/main/java/com/uas/platform/b2c/common/account/controller/EnterpriseController.java
  4. 72 0
      src/main/java/com/uas/platform/b2c/common/account/controller/ResourceController.java
  5. 97 0
      src/main/java/com/uas/platform/b2c/common/account/controller/RoleController.java
  6. 1 1
      src/main/java/com/uas/platform/b2c/common/account/controller/SecurityController.java
  7. 9 5
      src/main/java/com/uas/platform/b2c/common/account/controller/UserController.java
  8. 9 0
      src/main/java/com/uas/platform/b2c/common/account/dao/EnterpriseDao.java
  9. 20 0
      src/main/java/com/uas/platform/b2c/common/account/dao/ResourceDao.java
  10. 3 0
      src/main/java/com/uas/platform/b2c/common/account/dao/ResourceItemDao.java
  11. 82 0
      src/main/java/com/uas/platform/b2c/common/account/dao/RoleDao.java
  12. 13 3
      src/main/java/com/uas/platform/b2c/common/account/dao/UserDao.java
  13. 28 0
      src/main/java/com/uas/platform/b2c/common/account/model/Resource.java
  14. 1 1
      src/main/java/com/uas/platform/b2c/common/account/model/ResourceItem.java
  15. 14 0
      src/main/java/com/uas/platform/b2c/common/account/model/Role.java
  16. 1 1
      src/main/java/com/uas/platform/b2c/common/account/model/User.java
  17. 16 0
      src/main/java/com/uas/platform/b2c/common/account/service/ResourceService.java
  18. 76 0
      src/main/java/com/uas/platform/b2c/common/account/service/RoleService.java
  19. 1 0
      src/main/java/com/uas/platform/b2c/common/account/service/UserService.java
  20. 110 0
      src/main/java/com/uas/platform/b2c/common/account/service/impl/ResourceServiceImpl.java
  21. 124 0
      src/main/java/com/uas/platform/b2c/common/account/service/impl/RoleServiceImpl.java
  22. 184 59
      src/main/java/com/uas/platform/b2c/common/account/service/impl/UserServiceImpl.java
  23. 4 11
      src/main/java/com/uas/platform/b2c/common/account/v2/service/impl/EnterpriseServiceImpl.java
  24. 15 0
      src/main/java/com/uas/platform/b2c/core/config/MessageConf.java
  25. 1 1
      src/main/java/com/uas/platform/b2c/core/constant/IntegerConstant.java
  26. 61 51
      src/main/java/com/uas/platform/b2c/core/filter/SSOInterceptor.java
  27. 51 35
      src/main/java/com/uas/platform/b2c/external/erp/prod/service/impl/ProdServiceImpl.java
  28. 33 32
      src/main/java/com/uas/platform/b2c/external/erp/prod/util/ModelConvertUtil.java
  29. 33 21
      src/main/java/com/uas/platform/b2c/external/erp/product/service/impl/ComponentServiceImpl.java
  30. 5 0
      src/main/java/com/uas/platform/b2c/fa/payment/controller/BankInfoController.java
  31. 2 2
      src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductDao.java
  32. 2 1
      src/main/java/com/uas/platform/b2c/prod/commodity/model/Product.java
  33. 6 1
      src/main/java/com/uas/platform/b2c/prod/product/component/modal/Component.java
  34. 15 1
      src/main/java/com/uas/platform/b2c/prod/store/controller/StoreInController.java
  35. 4 1
      src/main/java/com/uas/platform/b2c/trade/seek/dao/SeekPurchaseBomListDao.java
  36. 91 104
      src/main/java/com/uas/platform/b2c/trade/seek/service/impl/SeekPurchaseBomServiceImpl.java
  37. 13 13
      src/main/java/com/uas/platform/b2c/trade/vendor/service/impl/VendorIntroductionServiceImpl.java
  38. 1 0
      src/main/resources/dev/message.properties
  39. BIN
      src/main/resources/jxls-tpl/trade/seekPurchaseByBatch.xls
  40. 1 0
      src/main/resources/prod/message.properties
  41. 1 0
      src/main/resources/test/message.properties
  42. 2 2
      src/main/webapp/WEB-INF/web.xml
  43. 14 16
      src/main/webapp/resources/css/common.css
  44. BIN
      src/main/webapp/resources/img/vendor/authority/role-bg-1.jpg
  45. BIN
      src/main/webapp/resources/img/vendor/authority/role-bg-2.jpg
  46. BIN
      src/main/webapp/resources/img/vendor/authority/role-bg-3.jpg
  47. BIN
      src/main/webapp/resources/img/vendor/authority/role-bg-4.jpg
  48. BIN
      src/main/webapp/resources/img/vendor/authority/role-bg-5.jpg
  49. BIN
      src/main/webapp/resources/img/vendor/images/addUser.png
  50. BIN
      src/main/webapp/resources/img/vendor/images/check-active.jpg
  51. BIN
      src/main/webapp/resources/img/vendor/images/check.jpg
  52. BIN
      src/main/webapp/resources/img/vendor/images/person-material-pc.png
  53. BIN
      src/main/webapp/resources/img/vendor/images/xiala-blue.jpg
  54. 1 1
      src/main/webapp/resources/js/admin/controllers/AuditRealAuthCtrl.js
  55. 1 1
      src/main/webapp/resources/js/admin/controllers/SecQuestionCtrl.js
  56. 1 1
      src/main/webapp/resources/js/admin/controllers/bankInfo/AuditBankInfoCtrl.js
  57. 1 1
      src/main/webapp/resources/js/admin/controllers/checkMoney/billInfoAdminCtrl.js
  58. 1 1
      src/main/webapp/resources/js/admin/controllers/checkMoney/creditCardAdminCtrl.js
  59. 2 2
      src/main/webapp/resources/js/admin/controllers/logistics/DelayTime.js
  60. 2 2
      src/main/webapp/resources/js/admin/controllers/product/MoveCmpCtrl.js
  61. 2 2
      src/main/webapp/resources/js/admin/controllers/trade/AfSaleApplyProcessingCtrl.js
  62. 2 2
      src/main/webapp/resources/js/admin/controllers/trade/supExProcessCtrl.js
  63. 53 0
      src/main/webapp/resources/js/common/controllers/commonCtrls.js
  64. 2 2
      src/main/webapp/resources/js/common/controllers/originalGoodsCtrl.js
  65. 2 11
      src/main/webapp/resources/js/common/module/store_recommend_product.js
  66. 1 1
      src/main/webapp/resources/js/common/query/enterprise.js
  67. 151 120
      src/main/webapp/resources/js/common/query/user.js
  68. 1 1
      src/main/webapp/resources/js/prod/controllers/ApplySampleCtrl.js
  69. 4 4
      src/main/webapp/resources/js/prod/controllers/KindDetailCtrl.js
  70. 2 2
      src/main/webapp/resources/js/prod/controllers/OrderEnsureCtrl.js
  71. 2 2
      src/main/webapp/resources/js/prod/controllers/OrderEnsureCtrlWithMultiCurrency.js
  72. 2 2
      src/main/webapp/resources/js/prod/controllers/ProductListByKindCtrl.js
  73. 3 3
      src/main/webapp/resources/js/prod/controllers/ProofingCtrl.js
  74. 1 1
      src/main/webapp/resources/js/prod/controllers/WastageCtrl.js
  75. 2 2
      src/main/webapp/resources/js/search/app.js
  76. 1 1
      src/main/webapp/resources/js/usercenter/controllers/BillAdminCtrl.js
  77. 2 2
      src/main/webapp/resources/js/usercenter/controllers/MyOrderToDoCtrl.js
  78. 1 1
      src/main/webapp/resources/js/usercenter/controllers/addressAdminCtrl.js
  79. 1 1
      src/main/webapp/resources/js/usercenter/controllers/creditCardAdminCtrl.js
  80. 13 9
      src/main/webapp/resources/js/usercenter/controllers/forstore/account_manager_ctrl.js
  81. 95 95
      src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_cart_ctrl.js
  82. 2 2
      src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_home_ctrl.js
  83. 3 3
      src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_invoice_ctrl.js
  84. 2 2
      src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_invoice_record_ctrl.js
  85. 3 3
      src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_logistics_ctrl.js
  86. 23 24
      src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_no_invoice_ctrl.js
  87. 1 1
      src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_order_ctrl.js
  88. 1 1
      src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js
  89. 4 3
      src/main/webapp/resources/js/usercenter/controllers/forstore/pay_center_ctrl.js
  90. 1 1
      src/main/webapp/resources/js/usercenter/controllers/forstore/shipping_address_edit_ctrl.js
  91. 2 2
      src/main/webapp/resources/js/vendor/controllers/CheckSaveCtrl.js
  92. 1 1
      src/main/webapp/resources/js/vendor/controllers/ShippedCtrl.js
  93. 1 1
      src/main/webapp/resources/js/vendor/controllers/addressAdminCtrl.js
  94. 1 1
      src/main/webapp/resources/js/vendor/controllers/creditCardAdminCtrl.js
  95. 2 2
      src/main/webapp/resources/js/vendor/controllers/exceptionProcessingCtrl.js
  96. 112 91
      src/main/webapp/resources/js/vendor/controllers/forstore/pay_center_ctrl.js
  97. 25 2
      src/main/webapp/resources/js/vendor/controllers/forstore/seek_purchase_ctrl.js
  98. 2 2
      src/main/webapp/resources/js/vendor/controllers/forstore/show_rate_ctrl.js
  99. 884 240
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_account_management_ctrl.js
  100. 3 3
      src/main/webapp/resources/js/vendor/controllers/forstore/vendor_brand_apply_list_ctrl.js

BIN
jpg


+ 2 - 1
src/main/java/com/uas/platform/b2c/common/account/controller/AuthenticationController.java

@@ -42,7 +42,7 @@ public class AuthenticationController {
 	@RequestMapping(method = RequestMethod.GET, headers = "Accept=application/json")
 	@ResponseBody
 	@ResponseStatus(value = HttpStatus.OK)
-	public UserInfo getAuthentication() {
+	public UserInfo getAuthentication(HttpServletRequest request) {
 		if (SystemSession.getUser() == null) {
 			return null;
 		}
@@ -55,6 +55,7 @@ public class AuthenticationController {
 				user.setIssys(Constant.YES);
 			}
 		} catch (NullPointerException e) { }
+		request.getSession().setAttribute("user",user);
 		UserInfo userInfo = new UserInfo(user);
 		Integer hasQuestion = user.getHasQuestion();
 		if (hasQuestion != null && hasQuestion ==1) {

+ 1 - 1
src/main/java/com/uas/platform/b2c/common/account/controller/EnterpriseController.java

@@ -83,7 +83,7 @@ public class EnterpriseController {
 	 *
 	 * @return
 	 */
-	@RequestMapping(value = "/{enuu}/info", method = RequestMethod.POST)
+	@RequestMapping(value = "/{enuu}/updateInfo", method = RequestMethod.POST)
 	public Enterprise updateEnterprise(@PathVariable Long enuu, @RequestBody Enterprise enterprise) {
 		Enterprise enterpriseInfo = enterpriseService.getEnterpriseInfo(enuu);
 		if (enterpriseInfo.getEnAdminuu() == null) {

+ 72 - 0
src/main/java/com/uas/platform/b2c/common/account/controller/ResourceController.java

@@ -0,0 +1,72 @@
+package com.uas.platform.b2c.common.account.controller;
+
+import com.uas.platform.b2c.common.account.dao.ResourceItemDao;
+import com.uas.platform.b2c.common.account.model.Resource;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.service.ResourceService;
+import com.uas.platform.b2c.common.account.service.UserService;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.security.access.ConfigAttribute;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+
+
+
+/**
+ * 账户管理--系统资源
+ *
+ * @author yingp
+ *
+ */
+@Controller
+@RequestMapping(value = "/account/resource")
+public class ResourceController {
+
+    @Autowired
+    private ResourceService resourceService;
+
+
+
+    /**
+     * 取系统资源
+     *
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.GET)
+    @ResponseBody
+    public List<Resource> getResources() {
+        return resourceService.findAll();
+    }
+
+    /**
+     * 根据访问url和方法查询权限;
+     * @param request
+     * @param user
+     */
+    @RequestMapping(value = "/validateRes", method = RequestMethod.GET)
+    @ResponseBody
+    public ResultMap validateResources(HttpServletRequest request, String resUrl,String method) {
+        String currUrl;
+        try {
+            currUrl = URLDecoder.decode(resUrl, "UTF-8");
+        } catch (UnsupportedEncodingException e) {
+            throw new IllegalArgumentException("URL编码错误!");
+        }
+        return resourceService.getAccessResources(request,currUrl,method);
+    }
+
+}

+ 97 - 0
src/main/java/com/uas/platform/b2c/common/account/controller/RoleController.java

@@ -0,0 +1,97 @@
+package com.uas.platform.b2c.common.account.controller;
+
+import com.uas.platform.b2c.common.account.model.Role;
+import com.uas.platform.b2c.common.account.service.RoleService;
+import com.uas.platform.b2c.core.support.log.UsageBufferedLogger;
+import com.uas.platform.core.logging.BufferedLoggerManager;
+import com.uas.platform.core.util.serializer.FlexJsonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.ModelMap;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * 账户管理--角色
+ *
+ * @author yingp
+ *
+ */
+@Controller
+@RequestMapping(value = "/account/role")
+public class RoleController {
+
+    @Autowired
+    private RoleService roleService;
+
+    private final static UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
+
+    /**
+     * 取系统资源
+     *
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.GET)
+    @ResponseBody
+    public List<Role> getRoles() {
+        return roleService.findAll();
+    }
+
+    /**
+     * 取当前企业已经存在的人员角色
+     *
+     * @return
+     */
+    @RequestMapping(value = "/existRole", method = RequestMethod.GET)
+    @ResponseBody
+    public Set<Role> getRolesByExist() {
+        return roleService.getRolesByExist();
+    }
+
+    /**
+     * 添加自定义角色
+     *
+     * @param json
+     * @return
+     */
+    @RequestMapping(method = RequestMethod.POST)
+    public ResponseEntity<String> save(@RequestBody String json) {
+        Role role = FlexJsonUtils.fromJson(json, Role.class);
+        role = roleService.save(role);
+        logger.log("角色", "添加角色", role.getDuty(), role.getDesc(), role.getId());
+        return new ResponseEntity<String>(HttpStatus.OK);
+    }
+
+    /**
+     * 删除角色
+     *
+     * @param roleId ID
+     * @return
+     */
+    @RequestMapping(value = "/{roleId}", method = RequestMethod.DELETE)
+    public ResponseEntity<String> delete(@PathVariable("roleId") Long roleId) {
+        Role role = roleService.findById(roleId);
+        roleService.delete(role);
+        logger.log("角色", "删除角色", role.getDuty(), role.getDesc(), role.getId());
+        return new ResponseEntity<String>(HttpStatus.OK);
+    }
+
+    /**
+     * 查询当前用户在当前企业的角色是否是管理员或者销售经理
+     *
+     * @return
+     */
+    @RequestMapping(value = "/currentRole", method =  RequestMethod.GET)
+    @ResponseBody
+    public ModelMap getCurrentRoles(){
+        return roleService.getCurrentRoles();
+    }
+
+    @RequestMapping(value = "/isManager", method =  RequestMethod.GET)
+    @ResponseBody
+    public ModelMap isManager(){return  roleService.isManager(); }
+}

+ 1 - 1
src/main/java/com/uas/platform/b2c/common/account/controller/SecurityController.java

@@ -293,7 +293,7 @@ public class SecurityController {
 		} else {
 			loginUrl = SSOHelper.getRedirectLoginUrl(request, String.valueOf(request.getSession().getAttribute("SSOReferer")));
 		}
-		model.addAttribute("loginUrl", loginUrl);
+		model.addAttribute("loginUrl", loginUrl) ;
 		return model;
 	}
 

+ 9 - 5
src/main/java/com/uas/platform/b2c/common/account/controller/UserController.java

@@ -602,9 +602,9 @@ public class UserController {
 	 * @return 完整的企业人员信息
 	 */
 	@RequestMapping(value = "/enterprise/keywordinfo",method = RequestMethod.GET)
-	public Page<User> getEnterpriseAllUsersInfoByKeyword(PageParams params, Long enuu, String keyword){
+	public Page<User> getEnterpriseAllUsersInfoByKeyword(PageParams params, Long enuu, String keyword , Long roleId){
 		PageInfo pageInfo = new PageInfo(params);
-		return userService.findUsersPageByEnUUAndKeyword(pageInfo,enuu,keyword);
+		return userService.findUsersPageByEnUUAndKeyword(pageInfo,enuu,keyword,roleId);
 	}
 
 
@@ -653,11 +653,15 @@ public class UserController {
 	 * @param
 	 * @return
 	 */
-	@RequestMapping(value = "/{uu}", method = RequestMethod.PUT)
-	public ResponseEntity<String> updateUser(@PathVariable("uu") Long uu , @RequestBody String json) {
+	@RequestMapping(method = RequestMethod.PUT)
+	public ResponseEntity<String> updateUser(@RequestBody String json , HttpServletRequest request) {
 		User user = FlexJsonUtils.fromJson(json, User.class);
 		userService.save(user);
-		logger.log("用户信息", "修改用户,UU:" + uu);
+		if (user != null) {
+			logger.log("用户信息", "修改用户信息,UU:" + user.getUserUU());
+			if (SystemSession.getUser().getUserUU().equals(user.getUserUU()))
+				request.getSession().setAttribute("user", user);
+		}
 		return new ResponseEntity<String>(HttpStatus.OK);
 	}
 	/**

+ 9 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/EnterpriseDao.java

@@ -4,6 +4,7 @@ import com.uas.platform.b2c.common.account.model.Enterprise;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.jpa.repository.query.Procedure;
 import org.springframework.data.repository.query.Param;
 import org.springframework.stereotype.Repository;
 
@@ -20,6 +21,14 @@ public interface EnterpriseDao extends JpaSpecificationExecutor<Enterprise>, Jpa
 	@Query(value="select e.uu from Enterprise e where e.enName like %?1%")
 	public List<Long> findEnuuByName(String name);
 
+	/**
+	 * 企业资料初始化
+	 *
+	 * @param enUU
+	 */
+	@Procedure(procedureName = "init_en_b2c")
+	public void callInitProcedure(Long enUU);
+
 	/**
 	 * 通过营业执照号码获取企业信息
 	 * @param bussinessCode

+ 20 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/ResourceDao.java

@@ -0,0 +1,20 @@
+package com.uas.platform.b2c.common.account.dao;
+
+import java.util.List;
+
+import javax.persistence.OrderBy;
+
+import com.uas.platform.b2c.common.account.model.Resource;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+@Repository
+public interface ResourceDao extends JpaRepository<Resource, Long> {
+
+    @OrderBy("id")
+    public List<Resource> findAll();
+
+    @OrderBy("id")
+    public List<Resource> findByParentid(Long parentId);
+
+}

+ 3 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/ResourceItemDao.java

@@ -3,8 +3,11 @@ package com.uas.platform.b2c.common.account.dao;
 import com.uas.platform.b2c.common.account.model.ResourceItem;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.stereotype.Repository;
+import java.util.List;
 
 @Repository
 public interface ResourceItemDao extends JpaRepository<ResourceItem, Long>{
 
+    List<ResourceItem> findByMethodAndUrl(String method, String url);
+
 }

+ 82 - 0
src/main/java/com/uas/platform/b2c/common/account/dao/RoleDao.java

@@ -0,0 +1,82 @@
+package com.uas.platform.b2c.common.account.dao;
+
+import com.uas.platform.b2c.common.account.model.Role;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+
+@Repository
+public interface RoleDao extends JpaRepository<Role, Long> {
+
+    /**
+     * 获取企业的角色列表
+     * @param enUU
+     * @return
+     */
+    @Query("from Role r where r.enUU = :enUU order by id")
+    public List<Role> findByEnUU(@Param("enUU") long enUU);
+
+    /**
+     * 获取企业的默认角色的数量
+     * @param enUU
+     * @return
+     */
+    @Query("select count(r) from Role r where r.isdefault = 1 and r.enUU = :enUU")
+    public Integer findIsDefaultCountByEnUU(@Param("enUU") long enUU);
+
+    /**
+     * 按角色描述查找角色
+     *
+     * @param enUU
+     * @param desc
+     * @return
+     */
+    public List<Role> findByEnUUAndDesc(long enUU, String desc);
+
+    /**
+     * 角色个数
+     *
+     * @param enUU
+     * @return
+     */
+    @Query("select count(r) from Role r where r.enUU = :enUU")
+    public int getCountByEnUU(@Param("enUU") long enUU);
+
+    /**
+     * 按角色描述查找角色个数
+     *
+     * @param enUU
+     * @param desc
+     * @return
+     */
+    @Query("select count(r) from Role r where r.enUU = :enUU and r.desc = :desc")
+    public int getCountByEnUUAndDesc(@Param("enUU") long enUU, @Param("desc") String desc);
+
+    List<Role> findByEnUUAndIssys(Long vendUU, short yes);
+
+    /**
+     * 查询当前用户在当前企业的角色是否是管理员或者销售经理<br>
+     *
+     * 分配客户需要
+     *
+     * @param enuu
+     * @param useruu
+     * @return
+     */
+    @Query(value = "select count(1) from sec$roles r left join sec$userrole u on r.role_id = u.role_id where r.role_enuu = :enuu and u.user_uu = :useruu and (r.role_name = 'ROLE_ADMIN' or r.role_name = 'ROLE_SALEMANAGER')",nativeQuery = true)
+    Double findByEnuuAndUseruu(@Param("enuu") Long enuu, @Param("useruu") Long useruu);
+
+    /**
+     * 是否是当前企业的管理员(只有管理员才能设置权限)
+     *
+     * @param enuu
+     * @param useruu
+     * @return
+     */
+    @Query(value = "select count(1) from sec$roles r left join sec$userrole u on r.role_id = u.role_id where r.role_enuu = :enuu and u.user_uu = :useruu and r.role_name = 'ROLE_ADMIN'",nativeQuery = true)
+    Double findByEnuuAndUserUU(@Param("enuu") Long enuu, @Param("useruu") Long useruu);
+}

+ 13 - 3
src/main/java/com/uas/platform/b2c/common/account/dao/UserDao.java

@@ -75,7 +75,7 @@ public interface UserDao extends JpaSpecificationExecutor<User>, JpaRepository<U
 	 * @return
 	 */
 	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
-	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU and u.userName = :userName")
+	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU and u.userName like %:userName%")
 	public List<Long> findUserByUserNameAndEnUU(@Param("userName") String userName, @Param("enUU") Long enUU);
 
 	/**
@@ -86,7 +86,7 @@ public interface UserDao extends JpaSpecificationExecutor<User>, JpaRepository<U
 	 * @return
 	 */
 	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
-	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU and u.userEmail = :userEmail")
+	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU and u.userEmail like %:userEmail%")
 	public List<Long> findUserByUserEmailAndEnUU(@Param("userEmail") String userEmail, @Param("enUU") Long enUU);
 
 	/**
@@ -97,7 +97,7 @@ public interface UserDao extends JpaSpecificationExecutor<User>, JpaRepository<U
 	 * @return
 	 */
 	@QueryHints({ @QueryHint(name = "org.hibernate.cacheable", value = "true") })
-	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU and u.userTel = :userTel")
+	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU and u.userTel like %:userTel%")
 	public List<Long> findUserByUserTelAndEnUU(@Param("userTel") String userTel, @Param("enUU") Long enUU);
 
 	/**
@@ -111,6 +111,16 @@ public interface UserDao extends JpaSpecificationExecutor<User>, JpaRepository<U
 	@Query("select u.userUU from User u inner join u.enterprises as e where e.uu = :enUU and u.userUU = :userUU")
 	public List<Long> findUserByEnUUAndUserUU(@Param("enUU") long enUU, @Param("userUU") long userUU);
 
+	/**
+	 * 按既有id与角色id查找人员信息
+	 *
+	 * @param roleid
+	 * @param userUU
+	 * @return
+	 */
+	@Query(value = "select u.user_uu from sec$userrole_b2c u  where u.role_id = :roleid and u.user_uu in :userUU" ,nativeQuery = true)
+	public List<Long> findUserByRoleAndUsers(@Param("roleid") long roleid, @Param("userUU") Long[] userUU);
+
 	/**
 	 * 按名字查询当前企业的用户信息
 	 *

+ 28 - 0
src/main/java/com/uas/platform/b2c/common/account/model/Resource.java

@@ -5,6 +5,7 @@ import org.hibernate.annotations.CacheConcurrencyStrategy;
 
 import javax.persistence.*;
 import java.io.Serializable;
+import java.util.List;
 import java.util.Set;
 
 /**
@@ -41,6 +42,18 @@ public class Resource implements Serializable {
 	@Column(name = "res_desc")
 	private String desc;
 
+	/**
+	 * 所含子资源
+	 */
+	@Transient
+	private List<Resource> children;
+
+	/**
+	 * 父级类目的id号
+	 */
+	@Column(name = "res_parentid")
+	private Long parentid;
+
 	/**
 	 * 资源的详细清单
 	 */
@@ -82,4 +95,19 @@ public class Resource implements Serializable {
 		this.items = items;
 	}
 
+	public List<Resource> getChildren() {
+		return children;
+	}
+
+	public void setChildren(List<Resource> children) {
+		this.children = children;
+	}
+
+	public Long getParentid() {
+		return parentid;
+	}
+
+	public void setParentid(Long parentid) {
+		this.parentid = parentid;
+	}
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/common/account/model/ResourceItem.java

@@ -46,7 +46,7 @@ public class ResourceItem implements Serializable {
 	/**
 	 * 对资源的具体操作对象及行为的描述
 	 */
-	@Column(name = "item_desc")
+	@Column(name = "item_desc" , unique = true)
 	private String desc;
 
 	public Long getId() {

+ 14 - 0
src/main/java/com/uas/platform/b2c/common/account/model/Role.java

@@ -72,6 +72,12 @@ public class Role implements Serializable {
 	@Column(name = "role_duty")
 	private String duty;
 
+	/**
+	 * 背景颜色(页面)
+	 */
+	@Column(name = "role_color")
+	private String color;
+
 	public Long getId() {
 		return id;
 	}
@@ -142,6 +148,14 @@ public class Role implements Serializable {
 		this.duty = duty;
 	}
 
+	public String getColor() {
+		return color;
+	}
+
+	public void setColor(String color) {
+		this.color = color;
+	}
+
 	@Override
 	public int hashCode() {
 		final int prime = 31;

+ 1 - 1
src/main/java/com/uas/platform/b2c/common/account/model/User.java

@@ -148,7 +148,7 @@ public class User implements Serializable {
 	@ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.EAGER)
 	@JoinTable(name = "sec$userrole_b2c", joinColumns = @JoinColumn(name = "user_uu", referencedColumnName = "user_uu"), inverseJoinColumns = @JoinColumn(name = "role_id", referencedColumnName = "role_id"))
 	@OrderBy("id")
-	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
+	//@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
 	private Set<Role> roles;
 
 	/**

+ 16 - 0
src/main/java/com/uas/platform/b2c/common/account/service/ResourceService.java

@@ -0,0 +1,16 @@
+package com.uas.platform.b2c.common.account.service;
+
+import com.uas.platform.b2c.common.account.model.Resource;
+import com.uas.platform.b2c.trade.support.ResultMap;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+public interface ResourceService {
+
+    public List<Resource> findAll();
+
+
+    ResultMap getAccessResources(HttpServletRequest request, String currUrl, String method);
+
+}

+ 76 - 0
src/main/java/com/uas/platform/b2c/common/account/service/RoleService.java

@@ -0,0 +1,76 @@
+package com.uas.platform.b2c.common.account.service;
+
+import com.uas.platform.b2c.common.account.model.Role;
+import org.springframework.ui.ModelMap;
+
+import java.util.List;
+import java.util.Set;
+
+
+public interface RoleService {
+
+    /**
+     * 查找当前企业下所有角色
+     *
+     * @return
+     */
+    public List<Role> findAll();
+
+    /**
+     * 取当前企业已经存在的人员角色
+     *
+     * @return
+     */
+    public Set<Role> getRolesByExist();
+
+    /**
+     * 查找指定企业下所有角色
+     *
+     * @return
+     */
+    public List<Role> findByEnterprise(long enUU);
+
+    /**
+     * 保存角色信息
+     *
+     * @param role
+     * @return
+     */
+    public Role save(Role role);
+
+    /**
+     * 查找角色
+     *
+     * @param id
+     * @return
+     */
+    public Role findById(long id);
+
+    /**
+     * 删除角色
+     *
+     * @param role
+     */
+    public void delete(Role role);
+
+    /**
+     * 删除角色
+     *
+     * @param id
+     */
+    public void delete(long id);
+
+    /**
+     * 查询当前用户在当前企业的角色是否是管理员或者销售经理
+     *
+     * @return
+     */
+    public ModelMap getCurrentRoles();
+
+    /**
+     * 判断是否是当前企业的管理员
+     *
+     * @return
+     */
+    ModelMap isManager();
+}

+ 1 - 0
src/main/java/com/uas/platform/b2c/common/account/service/UserService.java

@@ -61,6 +61,7 @@ public interface UserService {
 	 */
 	Page<User> findUserByUserNameLikeAndEnUU(PageInfo pageInfo , Long enUU , String userName);
 
+	Page<User> findUsersPageByEnUUAndKeyword(PageInfo pageInfo , Long enUU , String keyword , Long roleId);
 	/**
 	 * 按email取用户信息
 	 * 

+ 110 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/ResourceServiceImpl.java

@@ -0,0 +1,110 @@
+package com.uas.platform.b2c.common.account.service.impl;
+
+import java.util.*;
+
+import com.uas.platform.b2c.common.account.dao.ResourceDao;
+import com.uas.platform.b2c.common.account.dao.ResourceItemDao;
+import com.uas.platform.b2c.common.account.model.Resource;
+import com.uas.platform.b2c.common.account.model.ResourceItem;
+import com.uas.platform.b2c.common.account.model.Role;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.service.ResourceService;
+import com.uas.platform.b2c.common.account.service.UserService;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.b2c.trade.support.ResultMap;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import javax.servlet.http.HttpServletRequest;
+
+
+@Service
+public class ResourceServiceImpl implements ResourceService {
+
+    @Autowired
+    private ResourceDao resourceDao;
+
+    @Autowired
+    private UserService userService;
+    @Autowired
+    private ResourceItemDao resourceItemDao;
+
+    /**
+     * 商城运营商企业UU号
+     */
+    @Value("#{sys.enUU}")
+    private Long enUU;
+
+  /*  @Autowired
+    private MallAdministratorsDao mallAdministratorsDao;*/
+
+    @Override
+    public List<Resource> findAll() {
+      /*  List<MallAdministrators> admins = mallAdministratorsDao
+                .findByAdenuu(SystemSession.getUser().getEnterprise().getUu());*/
+        List<Resource> resources = getAllChildResource(0L);
+        if (!CollectionUtils.isEmpty(resources)) {
+            if (!SystemSession.getUser().getEnterprise().getUu().equals(enUU)) {// 如果不存在商城管理员设置权限,这个不显示出来
+                for (Iterator<Resource> it = resources.iterator(); it.hasNext();) {
+                    Resource re = it.next();
+                    if (re.getName().equals("优软商城-管理员")) {
+                        it.remove();
+                    }
+                }
+            }
+        }
+        return resources;
+    }
+    public List<Resource> getAllChildResource(Long parentid) {
+        List<Resource> resourceList = resourceDao.findByParentid(parentid);
+        for (Resource res : resourceList) {
+                res.setChildren(getAllChildResource(res.getId()));
+        }
+        return resourceList;
+    }
+
+    @Override
+    public ResultMap getAccessResources(HttpServletRequest request, String currUrl, String method) {
+        HashMap<String, Boolean> dataMap = new HashMap<>();
+        dataMap.put("isManager",  Boolean.FALSE);
+        dataMap.put("isOpenApi",  Boolean.FALSE);
+        dataMap.put("access", Boolean.FALSE);
+        ResultMap resultMap = new ResultMap();
+        resultMap.setData(dataMap);
+        //判断当前用户是否是管理员isManager;
+        User user = (User) request.getSession().getAttribute("user");
+        Long enAdminuu = user.getEnterprise().getEnAdminuu();
+        if (enAdminuu.equals(user.getUserUU()) ) {
+            dataMap.put("isManager", Boolean.TRUE);
+            dataMap.put("access", Boolean.TRUE);
+            return resultMap;
+        }
+        //根据当前权限的url和访问方法到resources表中查询是否有受权限控制
+        List<ResourceItem> currResourceItems = resourceItemDao.findByMethodAndUrl(method, currUrl);
+        if (currResourceItems == null || currResourceItems.size() == 0) {
+            dataMap.put("isOpenApi",  Boolean.TRUE);
+            resultMap.setSuccess(true);
+            return resultMap;
+        }
+        ResourceItem currResourceItem = currResourceItems.get(0);
+        //查找用户是否拥有当前资源
+        User curUser = userService.findUserByUserUU(user.getUserUU());
+        Set<Role> roles = curUser.getRoles();
+        HashMap<String, ResourceItem> authItems = new HashMap<>();
+        for (Role role : roles) {
+            if (role.getEnUU().equals(user.getEnterprise().getUu())) {
+                Set<ResourceItem> resourceItems = role.getResourceItems();
+                for (ResourceItem resourceItem : resourceItems) {
+                    authItems.put(resourceItem.getDesc(), resourceItem);
+                    if (currResourceItem.getMethod().equals(resourceItem.getMethod()) && currResourceItem.getDesc().equals(resourceItem.getDesc()))  {
+                        dataMap.put("access", Boolean.TRUE);
+                    }
+                }
+            }
+        }
+        resultMap.setSuccess(true);
+        return resultMap;
+    }
+}

+ 124 - 0
src/main/java/com/uas/platform/b2c/common/account/service/impl/RoleServiceImpl.java

@@ -0,0 +1,124 @@
+package com.uas.platform.b2c.common.account.service.impl;
+
+import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
+import com.uas.platform.b2c.common.account.dao.RoleDao;
+import com.uas.platform.b2c.common.account.dao.UserDao;
+import com.uas.platform.b2c.common.account.model.Role;
+import com.uas.platform.b2c.common.account.model.User;
+import com.uas.platform.b2c.common.account.service.RoleService;
+import com.uas.platform.b2c.core.support.SystemSession;
+import com.uas.platform.core.exception.IllegalOperatorException;
+import com.uas.platform.core.model.Constant;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.ui.ModelMap;
+import org.springframework.util.Assert;
+import org.springframework.util.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+@Service
+public class RoleServiceImpl implements RoleService {
+
+    private static final int DEFAULT_ROLE = 1;
+
+    private static final int ALL_DEFAULT_ROLE = 4;
+
+    @Autowired
+    private RoleDao roleDao;
+
+    @Autowired
+    private EnterpriseDao enterpriseDao;
+
+    @Autowired
+    private UserDao userDao;
+
+    @Override
+    public List<Role> findAll() {
+        return findByEnterprise(SystemSession.getUser().getEnterprise().getUu());
+    }
+
+    @Override
+    public Set<Role> getRolesByExist() {
+        Long enuu = SystemSession.getUser().getEnterprise().getUu();
+        List<User> users = userDao.findByEnUU(enuu);
+        Set<Role> roles = new HashSet<>();
+        for (User u : users) {
+            for (Role role : u.getRoles()) {
+                if (role.getEnUU().equals(enuu)) {
+                    roles.add(role);
+                }
+            }
+        }
+        return roles;
+    }
+
+    @Override
+    public List<Role> findByEnterprise(long enUU) {
+        // 默认角色个数
+        Integer defaultRoleCount = roleDao.findIsDefaultCountByEnUU(enUU);
+        if (defaultRoleCount < ALL_DEFAULT_ROLE) {
+            // 如果默认角色个数小于设定的值,进行初始化角色数据
+            enterpriseDao.callInitProcedure(enUU);
+        }
+        List<Role> roles = roleDao.findByEnUU(enUU);
+        return roles;
+    }
+
+    @Override
+    public Role save(Role role) {
+        Assert.notNull(role.getDesc());
+        long enUU = SystemSession.getUser().getEnterprise().getUu();
+        // 角色描述不能重复
+        List<Role> roles = roleDao.findByEnUUAndDesc(enUU, role.getDesc());
+        if (roles.size() > 0 && !roles.get(0).equals(role))
+            throw new IllegalOperatorException("角色描述不能重复");
+        if (role.getName() == null) {
+            // 自定义角色
+            role.setName("ROLE_" + System.currentTimeMillis());
+            role.setEnUU(enUU);
+            role.setIsdefault(Constant.NO);
+            role.setIssys(Constant.NO);
+        }
+        return roleDao.save(role);
+    }
+
+    @Override
+    public Role findById(long id) {
+        return roleDao.findOne(id);
+    }
+
+    @Override
+    public void delete(Role role) {
+        if (role != null && role.getId() != null) {
+            List<User> users = userDao.findByRole(role.getId());
+            if (!CollectionUtils.isEmpty(users)) {
+                for (User user : users) {
+                    user.getRoles().remove(role);
+                }
+                userDao.save(users);
+            }
+            roleDao.delete(role);
+        }
+    }
+
+    @Override
+    public void delete(long id) {
+        delete(findById(id));
+    }
+
+    @Override
+    public ModelMap getCurrentRoles() {
+        return new ModelMap("count", roleDao.findByEnuuAndUseruu(SystemSession.getUser().getEnterprise().getUu(), SystemSession.getUser().getUserUU()));
+    }
+
+    @Override
+    public ModelMap isManager() {
+        return new ModelMap("isManager", roleDao.findByEnuuAndUserUU(SystemSession.getUser().getEnterprise().getUu(), SystemSession.getUser().getUserUU()) > 0 ? true : false);
+    }
+
+}

+ 184 - 59
src/main/java/com/uas/platform/b2c/common/account/service/impl/UserServiceImpl.java

@@ -1,6 +1,8 @@
 package com.uas.platform.b2c.common.account.service.impl;
 
 import com.uas.message.mail.service.MailService;
+import com.uas.platform.b2c.common.account.dao.EnterpriseDao;
+import com.uas.platform.b2c.common.account.dao.RoleDao;
 import com.uas.platform.b2c.common.account.dao.UserCacheEnterpriseDao;
 import com.uas.platform.b2c.common.account.dao.UserDao;
 import com.uas.platform.b2c.common.account.model.*;
@@ -12,25 +14,9 @@ import com.uas.platform.core.exception.IllegalOperatorException;
 import com.uas.platform.core.exception.SystemException;
 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;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import javax.servlet.http.HttpServletRequest;
-
-import com.uas.sso.util.AccountUtils;
+import com.uas.sso.entity.UserView;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.jpa.domain.Specification;
@@ -38,11 +24,20 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
+import com.uas.sso.util.AccountUtils;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import javax.servlet.http.HttpServletRequest;
+import java.text.SimpleDateFormat;
+import java.util.*;
 
 @Service
 public class UserServiceImpl implements UserService {
 
-	static final String TEL_REGEXP = "^((\\(\\d{3}\\))|(\\d{3}\\-))?(13|15|18|17)\\d{9}$";
+
+	static final String TEL_REGEXP = "^1[0-9]{10}$";
 
 	static final String UU_REGEXP = "^\\d{4,}$";
 
@@ -59,6 +54,12 @@ public class UserServiceImpl implements UserService {
 	@Autowired
 	private UserDao userDao;
 
+	@Autowired
+	private RoleDao roleDao;
+
+	@Autowired
+	private EnterpriseDao enterpriseDao;
+
 	@Autowired
 	private CommonDao commonDao;
 
@@ -67,9 +68,55 @@ public class UserServiceImpl implements UserService {
 
 	@Autowired
 	private MailService mailService;
+
 	@Autowired
 	private MessageConf messageConf;
 
+
+	@Override
+	public Page<User> findUsersPageByEnUUAndKeyword(final PageInfo pageInfo , Long enUU , String keyword) {
+		List<Long> usersId = new ArrayList<>();
+		if (keyword.contains("@")) { // 按邮箱查找
+			usersId = userDao.findUserByUserEmailAndEnUU(keyword, enUU);
+		} else if (keyword.matches(TEL_REGEXP)) { // 按手机号查找
+			usersId = userDao.findUserByUserTelAndEnUU(keyword, enUU);
+		} else if (keyword.matches(UU_REGEXP)) { // 按UU号查找
+			usersId = userDao.findUserByEnUUAndUserUU(enUU, Long.parseLong(keyword));
+		} else if (!keyword.contains("@") && (keyword.matches(CHINESE_REGEXP) || keyword.matches(ENGLISH_REGEXP))) {// 按名字查找
+			usersId = userDao.findUserByUserNameAndEnUU(keyword, enUU);
+		} else{
+			usersId = userDao.findUserByUserNameAndEnUU(keyword, enUU);
+		}
+		final List<Long> users = usersId;
+		if (users.size()>0) {
+			Page<User> pUser = userDao.findAll(new Specification<User>() {
+				public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
+					Predicate predicateId = root.get("userUU").in(users);
+					query.where(predicateId);
+					return null;
+				}
+			}, pageInfo);
+			for (User user : pUser) {
+				Set<Role> roles = user.getRoles();
+				Long enuu = SystemSession.getUser().getEnterprise().getUu();
+				if (!CollectionUtils.isEmpty(roles)) {
+					Iterator<Role> iterator = roles.iterator();
+					while (iterator.hasNext()) {
+						Role role = iterator.next();
+						if (!role.getEnUU().equals(enuu)) {
+							iterator.remove();
+						}
+					}
+				}
+			}
+			return pUser;
+		}else{
+			return null;
+		}
+
+	}
+
+
 	@Override
 	public User findUserByUserUU(Long uu) {
 		List<User> users = userDao.findUserByUserUU(uu);
@@ -201,6 +248,14 @@ public class UserServiceImpl implements UserService {
 		}
 		enterprises.add(SystemSession.getUser().getEnterprise());
 		user.setEnterprises(enterprises);
+		List<Role> roles = roleDao.findByEnUUAndDesc(SystemSession.getUser().getEnterprise().getUu(),"普通用户");
+		if(roles.size()>0){
+			Set<Role> set = user.getRoles();
+			set.add(roles.get(0));
+			user.setRoles(set);
+		}else{
+			enterpriseDao.callInitProcedure(SystemSession.getUser().getEnterprise().getUu());
+		}
 		userDao.save(user);
 		try {
 			postToAccountCenter(user);
@@ -209,19 +264,28 @@ public class UserServiceImpl implements UserService {
 		}
 	}
 	@Override
-	public Page<User> findUsersPageByEnUUAndKeyword(final PageInfo pageInfo , Long enUU , String keyword) {
+	public Page<User> findUsersPageByEnUUAndKeyword(final PageInfo pageInfo , Long enUU , String keyword, Long roleId) {
 		List<Long> usersId = new ArrayList<>();
-		if (keyword.contains("@")) { // 按邮箱查找
-			usersId = userDao.findUserByUserEmailAndEnUU(keyword, enUU);
-		} else if (keyword.matches(TEL_REGEXP)) { // 按手机号查找
-			usersId = userDao.findUserByUserTelAndEnUU(keyword, enUU);
-		} else if (keyword.matches(UU_REGEXP)) { // 按UU号查找
-			usersId = userDao.findUserByEnUUAndUserUU(enUU, Long.parseLong(keyword));
-		} else if (!keyword.contains("@") && (keyword.matches(CHINESE_REGEXP) || keyword.matches(ENGLISH_REGEXP))) {// 按名字查找
-			usersId = userDao.findUserByUserNameAndEnUU(keyword, enUU);
-		} else{
-			usersId = userDao.findUserByUserNameAndEnUU(keyword, enUU);
+		if(keyword == null || "".equals(keyword)){
+			usersId = userDao.findIdByEnUU(enUU);
+		}else {
+			if (keyword.contains("@")) { // 按邮箱查找
+				usersId = userDao.findUserByUserEmailAndEnUU(keyword, enUU);
+			} else if (keyword.matches(TEL_REGEXP)) { // 按手机号查找
+				usersId = userDao.findUserByUserTelAndEnUU(keyword, enUU);
+			} else if (keyword.matches(UU_REGEXP)) { // 按UU号查找
+				usersId = userDao.findUserByEnUUAndUserUU(enUU, Long.parseLong(keyword));
+			} else if (!keyword.contains("@") && (keyword.matches(CHINESE_REGEXP) || keyword.matches(ENGLISH_REGEXP))) {// 按名字查找
+				usersId = userDao.findUserByUserNameAndEnUU(keyword, enUU);
+			} else{
+				usersId = userDao.findUserByUserNameAndEnUU(keyword, enUU);
+			}
 		}
+		if (roleId != null && usersId.size() > 0){
+			//过滤 角色信息
+			usersId = userDao.findUserByRoleAndUsers(roleId,usersId.toArray(new Long[0]));
+		}
+
 		final List<Long> users = usersId;
 		if (users.size()>0) {
 			Page<User> pUser = userDao.findAll(new Specification<User>() {
@@ -287,16 +351,64 @@ public class UserServiceImpl implements UserService {
 
 	@Override
 	public User save(User user) {
-        User userOld = userDao.findOne(user.getUserUU());
-        userOld.setUserEmail(user.getUserEmail());
-        userOld.setUserTel(user.getUserTel());
-        userOld.setUserName(user.getUserName());
-        try {
-            postToAccountCenter(userOld);
-            return userDao.save(userOld);
-        } catch (Exception e) {
-            throw new RuntimeException(e.getMessage());
-        }
+		User userOld = userDao.findOne(user.getUserUU());
+		if (userOld != null) {
+			userOld.setUserEmail(user.getUserEmail());
+			userOld.setUserTel(user.getUserTel());
+			userOld.setUserName(user.getUserName());
+			try {
+				postToAccountCenter(userOld);
+			} catch (Exception e) {
+//				throw new RuntimeException(e.getMessage());
+			}
+			// 修改用户角色,只对用户的当前企业的角色进行修改
+			if (!CollectionUtils.isEmpty(user.getRoles())) {
+				Set<Role> existRoles = userOld.getRoles();
+				if (!CollectionUtils.isEmpty(existRoles)) {// 保留用户在其他企业的角色
+					Iterator<Role> iterator = existRoles.iterator();
+					Long currentEnuu = SystemSession.getUser().getEnterprise().getUu();
+					while (iterator.hasNext()) {
+						Role role = iterator.next();
+						if (role.getEnUU().equals(currentEnuu)) {
+							iterator.remove();
+						}
+					}
+				} else {
+					existRoles = new HashSet<>();
+				}
+				for (Role role : user.getRoles()) {
+					existRoles.add(role);
+				}
+				userOld.setRoles(existRoles);
+			} else {
+				Set<Role> existRoles = userOld.getRoles();
+				if (!CollectionUtils.isEmpty(existRoles)) {// 保留用户在其他企业的角色
+					Iterator<Role> iterator = existRoles.iterator();
+					Long currentEnuu = SystemSession.getUser().getEnterprise().getUu();
+					while (iterator.hasNext()) {
+						Role role = iterator.next();
+						if (role.getEnUU().equals(currentEnuu)) {
+							iterator.remove();
+						}
+					}
+				}
+				userOld.setRoles(existRoles);
+			}
+			try {
+				userOld = userDao.save(userOld);
+
+			} catch (Exception e) {
+				throw new RuntimeException(e.getMessage());
+			}
+			if (SystemSession.getUser().getUserUU().equals(userOld.getUserUU())) {
+				userOld.setCurrentEnterprise(SystemSession.getUser().getEnterprise().getUu());
+				userOld.setCurrentEnterpriseRoles();
+				SystemSession.setUser(userOld);
+			}
+			return userOld;
+		} else {
+			throw new IllegalOperatorException("修改的用户不存在");
+		}
 	}
 
 	@Override
@@ -339,18 +451,27 @@ public class UserServiceImpl implements UserService {
 		if (users2.size() > 0) {
 			throw new IllegalOperatorException("邮箱地址重复,建议输入您自己的电子邮箱地址");
 		}
-		Long uu = commonDao.queryForObject("select users_seq.nextval from dual", Long.class);
-		user.setUserUU(uu);
-		user.addEnterprise(SystemSession.getUser().getEnterprise());
-		user.setCurrentEnterprise();
-		user = userDao.save(user);
-
-		user.setUserPwd(Md5Utils.encode(defaultPassword, user.getUserUU()));
+		UserView userView = new UserView();
+		userView.setVipName(user.getUserName());
+		userView.setSex(user.getUserSex());
+		userView.setMobile(user.getUserTel());
+		userView.setEmail(user.getUserEmail());
 		try {
+			UserView addssoUser = AccountUtils.addUser(SystemSession.getUser().getEnterprise().getUu(), userView);
+			List<Role> roles = roleDao.findByEnUUAndDesc(SystemSession.getUser().getEnterprise().getUu(),"普通用户");
+			if(roles.size()>0){
+				Set<Role> set = new HashSet<>();
+				set.add(roles.get(0));
+				user.setRoles(set);
+			}else{
+				enterpriseDao.callInitProcedure(SystemSession.getUser().getEnterprise().getUu());
+			}
+			//Long uu = commonDao.queryForObject("select users_seq.nextval from dual", Long.class);
+			user.setUserUU(addssoUser.getUserUU());
+			user.addEnterprise(SystemSession.getUser().getEnterprise());
+			user.setCurrentEnterprise();
 			user = userDao.save(user);
-			postToAccountCenter(user, defaultPassword);
 		} catch (Exception e) {
-			userDao.delete(user);
 			throw new RuntimeException(e.getMessage());
 		}
 		// 发送邮件
@@ -365,23 +486,27 @@ public class UserServiceImpl implements UserService {
 		model.put("userTel", user.getUserTel());
 		model.put("rootpath", AgentUtils.getHost(request));
 		if (user.getUserEmail() != null) {
-			//mailService.send("a4c45a22-436a-430c-9667-4edfd7d04a27", newUserEmail, data);
+			mailService.send(messageConf.getTplAfterBeAddedtoB2C(), user.getUserEmail(), model);
 			//mailService.send(messageConf.getTplInvitationForB2B(), user.getUserEmail(), model);
 		}
 		return user;
 	}
 
-	//添加未注册
-	public void postToAccountCenter(User user, String password) throws Exception {
-		/*UserDetail detail = new UserDetail();
+    //添加未注册
+	/*public  com.uas.account.entity.User postToAccountCenter(User user, String password) throws Exception {
+		UserDetail detail = new UserDetail();
 		detail.setEmail(user.getUserEmail());
 		detail.setIdCode(user.getUserIdcode());
 		detail.setMobile(user.getUserTel());
 		detail.setName(user.getUserName());
 		detail.setSex(user.getUserSex());
-		AccountUtils.addUser(user.getUserUU(), SystemSession.getUser().getEnterprise().getUu(), detail, password);
-		//.uas.sso.util.AccountUtils.addUser();*/
-	}
+		List<com.uas.account.entity.User> users = AccountUtils.addUser(user.getUserUU(), SystemSession.getUser().getEnterprise().getUu(), detail, password);
+		if (!CollectionUtils.isEmpty(users)) {
+			return users.get(0);
+		} else {
+			return null;
+		}
+	}*/
 	public void postToAccountCenter(User user) throws Exception {
 		//判断是否个人用户
 		if(SystemSession.getUser().getEnterprise()==null){
@@ -394,10 +519,10 @@ public class UserServiceImpl implements UserService {
 	public void removeUser(Long uu) {
 		User user = userDao.findOne(uu);
 		if (user.getEnterprises().contains(SystemSession.getUser().getEnterprise())) {
-//			user.removeEnterprise(SystemSession.getUser().getEnterprise());
-//			if (user.getEnterprises().size() == 0)
-//				user.setEnable((short) Status.DISABLED.value());
-//			userDao.save(user);
+			user.removeEnterprise(SystemSession.getUser().getEnterprise());
+			/*if (user.getEnterprises().size() == 0)
+				user.setEnable((short) Status.DISABLED.value());*/
+			userDao.save(user);
 			try {
 				com.uas.sso.util.AccountUtils.removeUser(uu,SystemSession.getUser().getEnterprise().getUu());
 			} catch (Exception e) {

+ 4 - 11
src/main/java/com/uas/platform/b2c/common/account/v2/service/impl/EnterpriseServiceImpl.java

@@ -82,19 +82,12 @@ public class EnterpriseServiceImpl implements EnterpriseService {
         enterprise.setEnLogoUrl(userSpaceView.getBusinessCodeImage());
         enterprise.setUu(Long.valueOf(userSpaceView.getSpaceUU()));
         //Long userUU = admins.get(0).getUserUU();
-        enterprise.setEnAdminuu(userSpaceView.getAdminUU());
+        if (userSpaceView.getAdminUU() != null) {
+            enterprise.setEnAdminuu(userSpaceView.getAdminUU());
+        }
         enterprise.setEnValidCode(userSpaceView.getValidCode());
         Enterprise newEn = enterpriseDao.save(enterprise);
-
-        User adminUser = null;
-        if (null == userSpaceView.getAdminUU()) {
-            adminUser = userDao.findOne(newEn.getEnAdminuu());
-        } else {
-            List<User> users = userDao.findUserByUserTel(userSpaceView.getTelephone());
-            if (CollectionUtils.isNotEmpty(users)) {
-                adminUser = users.get(0);
-            }
-        }
+        User adminUser = userDao.findOne(newEn.getEnAdminuu());
         // 保存新注册企业与用户的关联关系
         if (adminUser != null) {
             adminUser.addEnterprise(newEn);

+ 15 - 0
src/main/java/com/uas/platform/b2c/core/config/MessageConf.java

@@ -55,6 +55,14 @@ public class MessageConf {
 	@Value("#{message.plaformB2cComponentUnproveTemplateId}")
 	private String componentUnprove;
 
+	/**
+	 * 添加新的未注册人员
+	 *
+	 * @return
+	 */
+	@Value("#{message.tplAfterBeAddedtoB2C}")
+	private String tplAfterBeAddedtoB2C;
+
 	/**
 	 * 邮件通知有新的供应链申请
 	 * 
@@ -119,4 +127,11 @@ public class MessageConf {
 		this.supplyChain = supplyChain;
 	}
 
+	public String getTplAfterBeAddedtoB2C() {
+		return tplAfterBeAddedtoB2C;
+	}
+
+	public void setTplAfterBeAddedtoB2C(String tplAfterBeAddedtoB2C) {
+		this.tplAfterBeAddedtoB2C = tplAfterBeAddedtoB2C;
+	}
 }

+ 1 - 1
src/main/java/com/uas/platform/b2c/core/constant/IntegerConstant.java

@@ -26,5 +26,5 @@ public class IntegerConstant {
     public static final Integer PRICE_FRACTION = 6;
 
 
-    public static final Integer PAGE_COUNT = 1000;
+    public static final Integer PAGE_COUNT = 500;
 }

+ 61 - 51
src/main/java/com/uas/platform/b2c/core/filter/SSOInterceptor.java

@@ -14,7 +14,7 @@ import com.uas.sso.SSOHelper;
 import com.uas.sso.SSOToken;
 import com.uas.sso.common.SSOProperties;
 import com.uas.sso.common.util.HttpUtil;
-import com.uas.sso.entity.UserAccount;
+    import com.uas.sso.entity.UserAccount;
 import com.uas.sso.web.spring.AbstractSSOInterceptor;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.log4j.Logger;
@@ -171,8 +171,9 @@ public class SSOInterceptor extends AbstractSSOInterceptor {
      * 权限验证
      */
     private void accessDecision(HttpServletRequest request, User user) {
+        //判断当前访问是否有权限限制
         Collection<ConfigAttribute> configAttributes = getAttributes(request);
-        if (null == configAttributes || configAttributes.size() == 0) {
+        if (null == configAttributes || configAttributes.size() == 0 || user.isSys() || user.getEnterprise() == null) {
             return;
         }
         Iterator<ConfigAttribute> iterator = configAttributes.iterator();
@@ -180,7 +181,9 @@ public class SSOInterceptor extends AbstractSSOInterceptor {
         if (null == authorities || !authorities.containsKey(user.getUserUU())) {
             setGrantedAuthorities(user);
         }
+        //获取当前登录用户的所有权限;
         Collection<GrantedAuthority> userAuthorities = authorities.get(user.getUserUU());
+        //匹配当前访问权限;
         while (iterator.hasNext()) {
             ConfigAttribute configAttribute = iterator.next();
             needPermission = configAttribute.getAttribute();
@@ -196,10 +199,12 @@ public class SSOInterceptor extends AbstractSSOInterceptor {
         if (needPermission != null) {
             if ("prod".equals(profile)) {
                 if (!user.getEnterprise().getUu().toString().equals(enUU)) {
-                    if ("优软商城后台-运维".equals(needPermission)) {
+                    if ("进入优软商城后台进行运营维护".equals(needPermission)) {
                         throw new AccessDeniedException("无法访问,没有 " + needPermission + " 权限!");
                     }
                 }
+            } else {
+                throw new AccessDeniedException("无法访问,没有 " + needPermission + " 权限!");
             }
         }
     }
@@ -213,21 +218,22 @@ public class SSOInterceptor extends AbstractSSOInterceptor {
         }
     }
 
-    /**
-     * 加载资源,初始化资源变量
-     */
-    private void loadResourceDefine() {
-        if (resourceMap == null) {
-            resourceMap = new HashMap<String, Collection<ConfigAttribute>>();
-            List<ResourceItem> resources = resourceItemDao.findAll();
-            for (ResourceItem resource : resources) {
-                Collection<ConfigAttribute> configAttributes = new ArrayList<ConfigAttribute>();
-                ConfigAttribute configAttribute = new SecurityConfig(resource.getName());
-                configAttributes.add(configAttribute);
-                resourceMap.put(resource.getMethod() + ":" + resource.getUrl(), configAttributes);
-            }
-        }
-    }
+	/**
+	 * 加载资源,初始化资源变量
+	 *
+	 */
+	private void loadResourceDefine() {
+		if (resourceMap == null) {
+			resourceMap = new HashMap<String, Collection<ConfigAttribute>>();
+			List<ResourceItem> resources = resourceItemDao.findAll();
+			for (ResourceItem resource : resources) {
+				Collection<ConfigAttribute> configAttributes = new ArrayList<ConfigAttribute>();
+				ConfigAttribute configAttribute = new SecurityConfig(resource.getDesc());
+				configAttributes.add(configAttribute);
+				resourceMap.put(resource.getMethod() + ":" + resource.getUrl(), configAttributes);
+			}
+		}
+	}
 
     /**
      * 根据路径获取访问权限的集合接口
@@ -240,42 +246,46 @@ public class SSOInterceptor extends AbstractSSOInterceptor {
         if (resourceMap == null)
             loadResourceDefine();
 
-        for (Iterator<String> iter = resourceMap.keySet().iterator(); iter.hasNext(); ) {
-            String resourceKey = iter.next();
-            String[] resourceParam = resourceKey.split(":");
-            String resourceMethod = resourceParam[0];
-            String resourceUrl = resourceParam[1];
-            AntPathRequestMatcher matcher = new AntPathRequestMatcher(resourceUrl);
-            if (null != resourceUrl && request.getMethod().equals(resourceMethod) && matcher.matches(request)) {
-                return resourceMap.get(resourceKey);
-            }
-        }
-        return null;
-    }
+		for (Iterator<String> iter = resourceMap.keySet().iterator(); iter.hasNext();) {
+			String resourceKey = iter.next();
+			String[] resourceParam = resourceKey.split(":");
+			String resourceMethod = resourceParam[0];
+			String resourceUrl = resourceParam[1];
+			AntPathRequestMatcher matcher = new AntPathRequestMatcher(resourceUrl);
+			if (null != resourceUrl && request.getMethod().equals(resourceMethod) && matcher.matches(request)) {
+				return resourceMap.get(resourceKey);
+			}
+		}
+		return null;
+	}
 
-    private void setGrantedAuthorities(User user) {
-        Set<GrantedAuthority> authSet = new HashSet<GrantedAuthority>();
-        user.setCurrentEnterpriseRoles();
-        Set<Role> roles = user.getRoles();
-        if (!CollectionUtils.isEmpty(roles)) {
-            for (Role role : roles) {
-                if (role.isSys()) {// 超级账号
-                    user.setIssys(Constant.YES);
-                    break;
-                }
-                Set<ResourceItem> resourceItems = role.getResourceItems();
-                if (!CollectionUtils.isEmpty(resourceItems)) {
-                    for (ResourceItem res : resourceItems) {
-                        authSet.add(new SimpleGrantedAuthority(res.getName()));
-                    }
-                }
-            }
+	private void setGrantedAuthorities(User user) {
+		Set<GrantedAuthority> authSet = new HashSet<GrantedAuthority>();
+		user.setCurrentEnterpriseRoles();
+		Set<Role> roles = user.getRoles();
+		if (!CollectionUtils.isEmpty(roles)) {
+			for (Role role : roles) {
+				if (role.isSys()) {// 超级账号
+					user.setIssys(Constant.YES);
+					break;
+				}
+				Set<ResourceItem> resourceItems = role.getResourceItems();
+				if (!CollectionUtils.isEmpty(resourceItems)) {
+					for (ResourceItem res : resourceItems) {
+						authSet.add(new SimpleGrantedAuthority(res.getDesc()));
+					}
+				}
+			}
+
+		}
+        if (user.getEnterprise() != null && user.getUserUU().equals(user.getEnterprise().getEnAdminuu())) {
+            user.setIssys(Constant.YES);
         }
         if (authorities == null) {
-            authorities = new HashMap<Long, Collection<GrantedAuthority>>();
-        }
-        authorities.put(user.getUserUU(), authSet);
-    }
+			authorities = new HashMap<Long, Collection<GrantedAuthority>>();
+		}
+		authorities.put(user.getUserUU(), authSet);
+	}
 
     @Override
     protected void sendRedirect(HttpServletRequest request, HttpServletResponse response) throws IOException {

+ 51 - 35
src/main/java/com/uas/platform/b2c/external/erp/prod/service/impl/ProdServiceImpl.java

@@ -2,6 +2,7 @@ package com.uas.platform.b2c.external.erp.prod.service.impl;
 
 import com.uas.api.b2c_erp.seller.model.Prod;
 import com.uas.api.b2c_erp.seller.service.ProdService;
+import com.uas.platform.b2c.common.base.dao.CommonDao;
 import com.uas.platform.b2c.core.constant.IntegerConstant;
 import com.uas.platform.b2c.core.constant.Status;
 import com.uas.platform.b2c.core.support.SystemSession;
@@ -14,7 +15,6 @@ import com.uas.platform.b2c.prod.commodity.dao.ProductPrivateDao;
 import com.uas.platform.b2c.prod.commodity.dao.V_ProductPrivateDao;
 import com.uas.platform.b2c.prod.commodity.model.Product;
 import com.uas.platform.b2c.prod.commodity.model.ProductPrivate;
-import com.uas.platform.b2c.prod.commodity.model.V_ProductPrivate;
 import com.uas.platform.b2c.prod.commodity.service.ProductService;
 import com.uas.platform.b2c.prod.commodity.service.ReleaseProductByBatchService;
 import com.uas.platform.b2c.prod.store.dao.StoreInDao;
@@ -22,27 +22,21 @@ import com.uas.platform.b2c.prod.store.model.StoreIn;
 import com.uas.platform.core.logging.BufferedLoggerManager;
 import com.uas.platform.core.model.PageInfo;
 import com.uas.platform.core.model.PageParams;
-import com.uas.platform.core.persistence.criteria.CriterionExpression;
-import com.uas.platform.core.persistence.criteria.LogicalExpression;
-import com.uas.platform.core.persistence.criteria.PredicateUtils;
-import com.uas.platform.core.persistence.criteria.SimpleExpression;
 import org.apache.log4j.Logger;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageImpl;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.jpa.domain.Specification;
+import org.springframework.jdbc.core.BatchPreparedStatementSetter;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by wangyc on 2017/10/26.
@@ -69,6 +63,12 @@ public class ProdServiceImpl implements ProdService {
     @Autowired
     private ProductPrivateDao productPrivateDao;
 
+    @Autowired
+    private JdbcTemplate jdbcTemplate;
+
+    @Autowired
+    private CommonDao commonDao;
+
     @Autowired
     private ReleaseProductByBatchService releaseProductByBatchService;
 
@@ -206,42 +206,58 @@ public class ProdServiceImpl implements ProdService {
 
     }
 
+    @Transactional
     @Override
-    public Page<Prod> findNewProdUploadMallERP(int i) {
+    public List<Prod> findNewProdUploadMallERP(int i) {
         PageParams pageParams = new PageParams();
         pageParams.setPage(i);
         pageParams.setCount(IntegerConstant.PAGE_COUNT);
         final PageInfo info = new PageInfo(pageParams);
-        info.sorting("id", Sort.Direction.ASC);
-        SimpleExpression b2cEnabled = new SimpleExpression("b2cEnabled", 1, CriterionExpression.Operator.EQ);
-        SimpleExpression pbranden = PredicateUtils.isNotNull("pbranden");
-        SimpleExpression pcmpcode = PredicateUtils.isNotNull("pcmpcode");
-        SimpleExpression erpDown = PredicateUtils.isNull("erpDown");
-        LogicalExpression expression = new LogicalExpression(new SimpleExpression[]{b2cEnabled, pbranden, pcmpcode, erpDown}, CriterionExpression.Operator.AND);
-        info.expression(expression);
-        Page<V_ProductPrivate> productPrivates = vProductPrivateDao.findAll(new Specification<V_ProductPrivate>() {
-            @Override
-            public Predicate toPredicate(Root<V_ProductPrivate> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
-                query.where(info.getPredicates(root, query, cb));
-                return null;
-            }
-        }, info);
-        List<V_ProductPrivate> content = productPrivates.getContent();
+//        info.sorting("id", Sort.Direction.ASC);
+//        SimpleExpression b2cEnabled = new SimpleExpression("b2cEnabled", 1, CriterionExpression.Operator.EQ);
+//        SimpleExpression pbranden = PredicateUtils.isNotNull("pbranden");
+//        SimpleExpression pcmpcode = PredicateUtils.isNotNull("pcmpcode");
+//        SimpleExpression erpDown = PredicateUtils.isNull("erpDown");
+//        LogicalExpression expression = new LogicalExpression(new SimpleExpression[]{b2cEnabled, pbranden, pcmpcode, erpDown}, CriterionExpression.Operator.AND);
+//        info.expression(expression);
+        String sql = "select pr_pbranden,pr_pcmpcode,pr_spec,pr_kind,pr_cmpuuid,pr_unit,pr_id from v$product$private where pr_erpdown is null and pr_b2cenabled = 1 and pr_pcmpcode is not null and pr_pbrand is not null limit " + i +", 500";
+
+        List<Map<String, Object>> mapList = commonDao.queryForList(sql);
         List<Prod> content1 =  new ArrayList<>();
-        for (V_ProductPrivate v_productPrivate : content) {
-            Prod prod = ModelConvertUtil.vProductPrivateConvertProd(v_productPrivate);
+        for (Map<String, Object> map : mapList) {
+                Prod prod = ModelConvertUtil.vProductPrivateConvertProd(map);
             if (prod != null) {
                 content1.add(prod);
             }
         }
-        PageImpl<Prod> page = new PageImpl<>(content1, new PageInfo(pageParams), productPrivates.getTotalElements());
-        return page;
+        List<Long> ids = new ArrayList<>();
+        for (Map<String, Object> map : mapList) {
+            Long pr_id = Long.valueOf(String.valueOf(map.get("pr_id")));
+            ids.add(pr_id);
+        }
+        productDao.updateProductMallERPDowned(ids);
+        return content1;
     }
 
     @Override
-    public void updateNewProdDowned(List<String> list) {
+    public void updateNewProdDowned(final List<String> list) {
         if (!CollectionUtils.isEmpty(list)) {
-            productDao.updateProductMallERPDowned(list);
+            final String sql = "update products set pr_erpdown = '已上传' where pr_pcmpcode = ? and pr_pbranden = ?";
+            jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() {
+                @Override
+                public void setValues(PreparedStatement ps, int i) throws SQLException {
+                    String str = list.get(i);
+                    String[] split = str.split("-----");
+                    ps.setString(1, split[0]);
+                    ps.setString(2, split[1]);
+                }
+
+                @Override
+                public int getBatchSize() {
+                    return list.size();
+                }
+            });
+            System.out.println("success");
         }
     }
 }

+ 33 - 32
src/main/java/com/uas/platform/b2c/external/erp/prod/util/ModelConvertUtil.java

@@ -1,8 +1,9 @@
 package com.uas.platform.b2c.external.erp.prod.util;
 
 import com.uas.api.b2c_erp.seller.model.Prod;
-import com.uas.platform.b2c.prod.commodity.model.V_ProductPrivate;
-import com.uas.platform.b2c.prod.product.component.modal.ComponentInfo;
+
+import java.util.Map;
+import java.util.UUID;
 
 /**
  * 类型转换
@@ -14,26 +15,26 @@ public class ModelConvertUtil {
     /**
      * 物料转化成 prod
      *
-     * @param v_productPrivate 物料服务
+     * @param map 物料服务
      * @return Prod
      */
-   public static Prod vProductPrivateConvertProd(V_ProductPrivate v_productPrivate) {
-       if (v_productPrivate == null) {
+   public static Prod vProductPrivateConvertProd(Map<String, Object> map) {
+       if (map == null) {
            return null;
        }
        Prod prod = new Prod();
-       prod.setPr_orispeccode(v_productPrivate.getPcmpcode());
-       prod.setPr_brand(v_productPrivate.getPbranden());
-       prod.setPcmpcode(v_productPrivate.getPcmpcode());
-       prod.setKind(v_productPrivate.getKind());
-       prod.setKinden(v_productPrivate.getKinden());
-       prod.setPr_detail(v_productPrivate.getKind());
-       prod.setPr_uuid(v_productPrivate.getCmpUuId());
-       prod.setPbrand(v_productPrivate.getPbrand());
-       prod.setPbranden(v_productPrivate.getPbranden());
-       prod.setPr_code(v_productPrivate.getProdNum());
-       prod.setPr_spec(v_productPrivate.getSpec());
-       prod.setPr_unit(v_productPrivate.getUnit());
+       prod.setPr_orispeccode(String.valueOf(map.get("pr_pcmpcode")));
+       prod.setPr_brand(String.valueOf(map.get("pr_pbranden")));
+       prod.setPcmpcode(String.valueOf(map.get("pr_pcmpcode")));
+       prod.setKind(String.valueOf(map.get("pr_kind")));
+       prod.setKinden(String.valueOf(map.get("pr_kind")));
+       prod.setPr_detail(String.valueOf(map.get("pr_kind")));
+       prod.setPr_uuid(String.valueOf(map.get("pr_uuid")));
+       prod.setPbrand(String.valueOf(map.get("pr_pbranden")));
+       prod.setPbranden(String.valueOf(map.get("pr_pbranden")));
+       prod.setPr_code(UUID.randomUUID().toString());
+       prod.setPr_spec(String.valueOf(map.get("pr_spec")));
+       prod.setPr_unit(String.valueOf(map.get("pr_uuid")));
        return prod;
     }
 
@@ -41,26 +42,26 @@ public class ModelConvertUtil {
     /**
      * 物料转化成 prod
      *
-     * @param info 器件信息
+     * @param map 器件信息
      * @return Prod
      */
-    public static Prod ComponentInfoConvertProd(ComponentInfo info) {
-        if (info == null) {
+    public static Prod ComponentInfoConvertProd(Map<String, Object> map) {
+        if (map == null) {
             return null;
         }
         Prod prod = new Prod();
-        prod.setPr_orispeccode(info.getCode());
-        prod.setPr_brand(info.getBrand().getNameEn());
-        prod.setPcmpcode(info.getCode());
-        prod.setKind(info.getKind().getNameCn());
-        prod.setKinden(info.getKind().getNameCn());
-        prod.setPr_detail(info.getKind().getNameCn());
-        prod.setPr_uuid(info.getUuid());
-        prod.setPbrand(info.getBrand().getNameEn());
-        prod.setPbranden(info.getBrand().getNameEn());
-        prod.setPr_code(info.getUuid());
-        prod.setPr_spec(info.getDescription());
-        prod.setPr_unit(info.getUnit());
+        prod.setPr_orispeccode(String.valueOf(map.get("cmp_code")));
+        prod.setPr_brand(String.valueOf(map.get("br_name_en")));
+        prod.setPcmpcode(String.valueOf(map.get("cmp_code")));
+        prod.setKind(String.valueOf(map.get("ki_name")));
+        prod.setKinden(String.valueOf(map.get("ki_name")));
+        prod.setPr_detail(String.valueOf(map.get("ki_name")));
+        prod.setPr_uuid(String.valueOf(map.get("cmp_uuid")));
+        prod.setPbrand(String.valueOf(map.get("br_name_en")));
+        prod.setPbranden(String.valueOf(map.get("br_name_en")));
+        prod.setPr_code(String.valueOf(map.get("cmp_uuid")));
+        prod.setPr_spec(String.valueOf(map.get("cmp_description")));
+        prod.setPr_unit(String.valueOf(map.get("cmp_unit")));
         return prod;
     }
 }

+ 33 - 21
src/main/java/com/uas/platform/b2c/external/erp/product/service/impl/ComponentServiceImpl.java

@@ -4,7 +4,7 @@ import com.uas.api.b2c_erp.baisc.model.ComponentInfoUas;
 import com.uas.api.b2c_erp.baisc.service.ComponentService;
 import com.uas.api.b2c_erp.seller.model.Prod;
 import com.uas.api.domain.IPage;
-import com.uas.platform.b2c.core.constant.IntegerConstant;
+import com.uas.platform.b2c.common.base.dao.CommonDao;
 import com.uas.platform.b2c.core.constant.SplitChar;
 import com.uas.platform.b2c.core.utils.StringUtilB2C;
 import com.uas.platform.b2c.external.erp.prod.util.ModelConvertUtil;
@@ -21,7 +21,6 @@ import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;
-import org.springframework.data.domain.Sort;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
@@ -43,6 +42,9 @@ public class ComponentServiceImpl implements ComponentService {
     @Autowired
     private ComponentInfoDao componentInfoDao;
 
+    @Autowired
+    private CommonDao commonDao;
+
     @Override
     public List<ComponentInfoUas> getSimpleInfoByUuids(String uuids) {
         List<ComponentInfoUas> lists = new ArrayList<ComponentInfoUas>();
@@ -178,34 +180,44 @@ public class ComponentServiceImpl implements ComponentService {
         return mapList;
     }
 
+    @Transactional
     @Override
-    public Page<Prod> findNewComponentUploadMallERP(int i) {
-        PageParams pageParams = new PageParams();
-        pageParams.setPage(i);
-        pageParams.setCount(IntegerConstant.PAGE_COUNT);
-        final PageInfo info = new PageInfo(pageParams);
-        info.sorting("id", Sort.Direction.ASC);
-        SimpleExpression erpDown = PredicateUtils.isNull("erpDown");
-        info.expression(erpDown);
-        Page<ComponentInfo> componentInfos = componentInfoDao.findAll(new Specification<ComponentInfo>() {
-            @Override
-            public Predicate toPredicate(Root<ComponentInfo> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
-                query.where(info.getPredicates(root, query, cb));
-                return null;
-            }
-        }, info);
-        List<ComponentInfo> content = componentInfos.getContent();
+    public List<Prod> findNewComponentUploadMallERP(int i) {
+//        PageParams pageParams = new PageParams();
+//        pageParams.setPage(i);
+//        pageParams.setCount(IntegerConstant.PAGE_COUNT);
+//        final PageInfo info = new PageInfo(pageParams);
+//        info.sorting("id", Sort.Direction.ASC);
+//        SimpleExpression erpDown = PredicateUtils.isNull("erpDown");
+//        info.expression(erpDown);
+//        Page<ComponentInfo> componentInfos = componentInfoDao.findAll(new Specification<ComponentInfo>() {
+//            @Override
+//            public Predicate toPredicate(Root<ComponentInfo> root, CriteriaQuery<?> query, CriteriaBuilder cb) {
+//                query.where(info.getPredicates(root, query, cb));
+//                return null;
+//            }
+//        }, info);
+
+        String sql = "select cmp_code,br_name_en,cmp_uuid,cmp_description,cmp_unit,ki_name from product$component left join `product$brand` on cmp_brid = br_id left join product$kind on ki_id = cmp_kiid where pr_erpdown is null limit " + i + ", 500";
+
+        List<Map<String, Object>> mapList = commonDao.queryForList(sql);
         List<Prod> content1 =  new ArrayList<>();
-        for (ComponentInfo componentInfo : content) {
-            Prod prod = ModelConvertUtil.ComponentInfoConvertProd(componentInfo);
+        for (Map<String, Object> map : mapList) {
+            Prod prod = ModelConvertUtil.ComponentInfoConvertProd(map);
             if (prod != null) {
                 content1.add(prod);
             }
         }
-        return new PageImpl<Prod>(content1, info, componentInfos.getTotalElements());
+        List<String> uuids = new ArrayList<>();
+        for (Prod prod : content1) {
+            uuids.add(prod.getPr_uuid());
+        }
+        componentInfoDao.updateComponentInfoMallERPDowned(uuids);
+        return content1;
     }
 
     @Override
+    @Transactional
     public void updateNewComponentDowned(List<String> list) {
         if (!CollectionUtils.isEmpty(list)) {
             componentInfoDao.updateComponentInfoMallERPDowned(list);

+ 5 - 0
src/main/java/com/uas/platform/b2c/fa/payment/controller/BankInfoController.java

@@ -1,6 +1,8 @@
 package com.uas.platform.b2c.fa.payment.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.common.account.model.Role;
+import com.uas.platform.b2c.common.account.model.User;
 import com.uas.platform.b2c.common.base.model.FileUpload;
 import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.core.support.SystemSession;
@@ -20,6 +22,7 @@ import org.springframework.data.domain.Page;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Set;
 
 /**
  * The type BankInfo controller.
@@ -191,6 +194,8 @@ public class BankInfoController {
 	@RequestMapping(value="/setDefaultAccount/{id}", method = RequestMethod.GET)
 	@ApiOperation(value = "设置默认银行账户", httpMethod = "GET")
 	public void setDefaultAccount(@ApiParam(required = true, value = "账户id") @PathVariable("id") Long id) {
+		User user = SystemSession.getUser();
+		Set<Role> roles = user.getRoles();
 		logger.log("银行账户信息", "设置默认账户", "将id为"+ id +"的账户信息设置成默认账户,操作人UU号是:"+ SystemSession.getUser().getUserUU());
 		bankInfoService.setDefaultAccount(id);
 	}

+ 2 - 2
src/main/java/com/uas/platform/b2c/prod/commodity/dao/ProductDao.java

@@ -183,8 +183,8 @@ public interface ProductDao extends JpaSpecificationExecutor<Product>, JpaReposi
      * @param list
      */
     @Modifying
-    @Query(value = "update Product p set p.erpDown = \'已上传\' where p.prodNum in (:list)")
-    void updateProductMallERPDowned(@Param("list") List<String> list);
+    @Query(value = "update Product p set p.erpDown = \'已上传\' where p.id in (:list)")
+    void updateProductMallERPDowned(@Param("list") List<Long> list);
 
     /**
      * 通过型号查询物料信息

+ 2 - 1
src/main/java/com/uas/platform/b2c/prod/commodity/model/Product.java

@@ -19,7 +19,8 @@ import java.util.Set;
 	@Index(name = "products_enuu_index", columnList = "pr_enuu"),
 	@Index(name = "products_cmpcode_index", columnList = "pr_cmpcode"),
 	@Index(name = "products_brand_index", columnList = "pr_brand"),
-	@Index(name = "products_enuu_code_index", columnList = "pr_code, pr_enuu", unique = true)})
+	@Index(name = "products_enuu_code_index", columnList = "pr_code, pr_enuu", unique = true),
+	@Index(name = "products_erpdown_index", columnList = "pr_erpdown")})
 @Logger
 //@Cacheable
 //@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region = "com.uas.platform.b2b.model.Product")

+ 6 - 1
src/main/java/com/uas/platform/b2c/prod/product/component/modal/Component.java

@@ -19,7 +19,12 @@ import java.util.Set;
  * @version  2016年3月11日上午10:24:29 suntg 创建
  */
 @Entity
-@Table(name = "product$component", indexes = { @Index(name = "BRID_CODE_UNIQUE", columnList = "cmp_code,cmp_brid", unique = true), @Index(name = "PRODUCT$COMPONENT_CODE", columnList = "cmp_code"), @Index(name = "component_attach_index", columnList = "cmp_attach"), @Index(name = "component_img_index", columnList = "cmp_img")})
+@Table(name = "product$component", indexes = {
+		@Index(name = "BRID_CODE_UNIQUE", columnList = "cmp_code,cmp_brid", unique = true),
+		@Index(name = "PRODUCT$COMPONENT_CODE", columnList = "cmp_code"),
+		@Index(name = "component_attach_index", columnList = "cmp_attach"),
+		@Index(name = "component_img_index", columnList = "cmp_img"),
+		@Index(name = "component_erp_index", columnList = "pr_erpdown")})
 public class Component implements Serializable {
 
 	/**

+ 15 - 1
src/main/java/com/uas/platform/b2c/prod/store/controller/StoreInController.java

@@ -1,6 +1,8 @@
 package com.uas.platform.b2c.prod.store.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.uas.platform.b2c.advertise.ad.model.RecommendProduct;
+import com.uas.platform.b2c.advertise.ad.service.RecommendProductService;
 import com.uas.platform.b2c.core.config.SysConf;
 import com.uas.platform.b2c.core.support.SystemSession;
 import com.uas.platform.b2c.core.utils.FastjsonUtils;
@@ -40,13 +42,16 @@ public class StoreInController {
 
 	private final StoreInFacade storeInFacade;
 
+	private final RecommendProductService recommendProductService;
+
 	private final SysConf sysConf;
 
 	@Autowired
-	public StoreInController(StoreInService storeService, StoreInFacade storeInFacade, SysConf sysConf) {
+	public StoreInController(StoreInService storeService, StoreInFacade storeInFacade, SysConf sysConf,RecommendProductService recommendProductService) {
 		this.storeService = storeService;
 		this.storeInFacade = storeInFacade;
 		this.sysConf = sysConf;
+		this.recommendProductService = recommendProductService;
 	}
 
 	/**
@@ -193,4 +198,13 @@ public class StoreInController {
 		List<String> storeidArray = FastjsonUtils.fromJsonArray(storeids, String.class);
 		return storeService.getContactInfo(storeidArray);
 	}
+
+
+	/**
+	 * 当卖家新增或修改产品推荐时,创建或更新产品推荐信息
+	 */
+	@RequestMapping(method = RequestMethod.POST, value = "/products//update_batch")
+	public List<RecommendProduct> saveProductsWhenSellerUpdate(String uuid, @RequestBody List<RecommendProduct> productList) {
+		return recommendProductService.saveProductsWhenSellerUpdate(uuid, productList);
+	}
 }

+ 4 - 1
src/main/java/com/uas/platform/b2c/trade/seek/dao/SeekPurchaseBomListDao.java

@@ -14,6 +14,9 @@ import org.springframework.stereotype.Repository;
 @Repository
 public interface SeekPurchaseBomListDao extends JpaSpecificationExecutor<SeekPurchaseBomList>,
         JpaRepository<SeekPurchaseBomList, Long> {
-
+    /**
+     * 通过BomId删除明细列表
+     */
+    void deleteByBomId(Long bomId);
 }
 

+ 91 - 104
src/main/java/com/uas/platform/b2c/trade/seek/service/impl/SeekPurchaseBomServiceImpl.java

@@ -99,7 +99,13 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
 
     private static final UsageBufferedLogger logger = BufferedLoggerManager.getLogger(UsageBufferedLogger.class);
 
-    private int mallColNum = 10;
+    /**
+     * 模板列
+     */
+    private int mallColNum = 6;
+    /**
+     * 上限行数
+     */
     private int mallRowNum = 500;
 
     /**
@@ -109,12 +115,12 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
     public static final int BRANDNUM = 1;
     public static final int DEADLINENUM = 2;
     public static final int AMOUNTNUM = 3;
-    public static final int CURRENCYNUM = 4;
-    public static final int UNITPRICENUM = 5;
-    public static final int ENCAPSULATIONNUM = 8;
-    public static final int PRODUCEDATENUM = 9;
-    public static final int KINDNUM = 6;
-    public static final int SPECNUM = 7;
+//    public static final int CURRENCYNUM = 6;
+//    public static final int UNITPRICENUM = 7;
+//    public static final int ENCAPSULATIONNUM = 8;
+//    public static final int PRODUCEDATENUM = 9;
+    public static final int KINDNUM = 4;
+    public static final int SPECNUM = 5;
 
 
     /**
@@ -192,10 +198,10 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         Object brandCellObj = readWorkBookCell(row.getCell(BRANDNUM), Cell.CELL_TYPE_STRING,
                 0, BRANDNUM);
         String brandString = StringUtilB2C.getStr(brandCellObj);
-        Object produceDateCellObj = readWorkBookCell(row.getCell(PRODUCEDATENUM), Cell.CELL_TYPE_STRING,
-                0, PRODUCEDATENUM);
-        String produceDateString = StringUtilB2C.getStr(produceDateCellObj);
-        if ("只能填数字、英文、英文特殊符号".equals(codeString) || "请勿用中文特殊符号".equals(brandString) || "不超过6个汉字或12个字符".equals(produceDateString)) {
+//        Object produceDateCellObj = readWorkBookCell(row.getCell(PRODUCEDATENUM), Cell.CELL_TYPE_STRING,
+//                0, PRODUCEDATENUM);
+//        String produceDateString = StringUtilB2C.getStr(produceDateCellObj);
+        if ("只能填数字、英文、英文特殊符号".equals(codeString) || "请勿用中文特殊符号".equals(brandString)) {
             return true;
         }
         return false;
@@ -222,14 +228,27 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         if (!"截止时间".equals(StringUtilB2C.getStr(deadlineCellObj))) {
             return false;
         }
-        Object produceDateCellObj = readWorkBookCell(headerRow.getCell(PRODUCEDATENUM), Cell.CELL_TYPE_STRING,
-                0, PRODUCEDATENUM);
-        if (!"生产日期".equals(StringUtilB2C.getStr(produceDateCellObj))) {
-            return false;
-        }
+//        Object produceDateCellObj = readWorkBookCell(headerRow.getCell(PRODUCEDATENUM), Cell.CELL_TYPE_STRING,
+//                0, PRODUCEDATENUM);
+//        if (!"生产日期".equals(StringUtilB2C.getStr(produceDateCellObj))) {
+//            return false;
+//        }
         return true;
     }
 
+
+    private String convert(Object obj, int length) {
+        String result = StringUtilB2C.getStr(obj).trim();
+        try {
+            result = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(result, length);
+            result = match(result);
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+            result = null;
+        }
+        return result;
+    }
+
     /**
      * 将列信息注入到求购临时实体中
      * @param row
@@ -246,16 +265,7 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         if (StringUtils.isEmpty(codeValue)) {
             result += 1;
         } else {
-            String code = StringUtilB2C.getStr(codeValue).trim();
-            try {
-                code = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(code, 100);
-                if (!match(code)) {
-                    code = null;
-                }
-            } catch (UnsupportedEncodingException e) {
-                e.printStackTrace();
-            }
-            seekPurchaseByBatch.setCode(code);
+            seekPurchaseByBatch.setCode(convert(codeValue, 100));
         }
 
         // 品牌
@@ -264,16 +274,7 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         if (StringUtils.isEmpty(brandValue)) {
             result += 1;
         } else {
-            String brand = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(brandValue));
-            try {
-                brand = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(brand, 50);
-                if (!match(brand)) {
-                    brand = null;
-                }
-            } catch (UnsupportedEncodingException e) {
-                e.printStackTrace();
-            }
-            seekPurchaseByBatch.setBrand(brand);
+            seekPurchaseByBatch.setBrand(convert(brandValue, 50));
         }
 
         // 截止日期
@@ -322,90 +323,75 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         }
 
         // 币别
-        Object currencyValue = readWorkBookCell(row.getCell(CURRENCYNUM), Cell.CELL_TYPE_STRING,
-                rowNum, CURRENCYNUM);
-        if (!StringUtils.isEmpty(currencyValue)) {
-            try {
-                String currency = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(currencyValue));
-                seekPurchaseByBatch.setCurrency(currency);
-            } catch (Exception e) {
-                seekPurchaseByBatch.setCurrency(null);
-            }
-        }
+//        Object currencyValue = readWorkBookCell(row.getCell(CURRENCYNUM), Cell.CELL_TYPE_STRING,
+//                rowNum, CURRENCYNUM);
+//        if (!StringUtils.isEmpty(currencyValue)) {
+//            try {
+//                String currency = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(currencyValue));
+//                seekPurchaseByBatch.setCurrency(currency);
+//            } catch (Exception e) {
+//                seekPurchaseByBatch.setCurrency(null);
+//            }
+//        }
 
         // 单价
-        Object unitPriceValue = readWorkBookCell(row.getCell(UNITPRICENUM), Cell.CELL_TYPE_STRING,
-                rowNum, UNITPRICENUM);
-        if (!StringUtils.isEmpty(unitPriceValue)) {
-            try {
-                Double unitPrice = Double.valueOf(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(unitPriceValue)));
-                if (unitPrice <= 0 || unitPrice >= 10000) {
-                    unitPrice = null;
-                }
-                seekPurchaseByBatch.setUnitPrice(unitPrice);
-            } catch (NumberFormatException e) {
-                seekPurchaseByBatch.setUnitPrice(null);
-            }
-        }
+//        Object unitPriceValue = readWorkBookCell(row.getCell(UNITPRICENUM), Cell.CELL_TYPE_STRING,
+//                rowNum, UNITPRICENUM);
+//        if (!StringUtils.isEmpty(unitPriceValue)) {
+//            try {
+//                Double unitPrice = Double.valueOf(StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(unitPriceValue)));
+//                if (unitPrice <= 0 || unitPrice >= 10000) {
+//                    unitPrice = null;
+//                }
+//                seekPurchaseByBatch.setUnitPrice(unitPrice);
+//            } catch (NumberFormatException e) {
+//                seekPurchaseByBatch.setUnitPrice(null);
+//            }
+//        }
         // 如果填了单价又不选币种,导入的时候系统就默认人民币吧
-        if (!StringUtils.isEmpty(unitPriceValue) && StringUtils.isEmpty(currencyValue)) {
-            seekPurchaseByBatch.setCurrency("RMB");
-        }
+//        if (!StringUtils.isEmpty(unitPriceValue) && StringUtils.isEmpty(currencyValue)) {
+//            seekPurchaseByBatch.setCurrency("RMB");
+//        }
 
         // 封装
-        Object encapsulationValue = readWorkBookCell(row.getCell(ENCAPSULATIONNUM), Cell.CELL_TYPE_STRING,
-                rowNum, ENCAPSULATIONNUM);
-        if (!StringUtils.isEmpty(encapsulationValue)) {
-            try {
-                String encapsulation = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(encapsulationValue));
-                encapsulation = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(encapsulation, 20);
-                seekPurchaseByBatch.setEncapsulation(encapsulation);
-            } catch (Exception e) {
-                seekPurchaseByBatch.setEncapsulation(null);
-            }
-        }
+//        Object encapsulationValue = readWorkBookCell(row.getCell(ENCAPSULATIONNUM), Cell.CELL_TYPE_STRING,
+//                rowNum, ENCAPSULATIONNUM);
+//        if (!StringUtils.isEmpty(encapsulationValue)) {
+//            try {
+//                String encapsulation = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(encapsulationValue));
+//                encapsulation = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(encapsulation, 20);
+//                seekPurchaseByBatch.setEncapsulation(encapsulation);
+//            } catch (Exception e) {
+//                seekPurchaseByBatch.setEncapsulation(null);
+//            }
+//        }
 
 
         // 生产日期
-        Object produceDateValue = readWorkBookCell(row.getCell(PRODUCEDATENUM), Cell.CELL_TYPE_STRING,
-                rowNum, PRODUCEDATENUM);
-        if (!StringUtils.isEmpty(produceDateValue)) {
-            try {
-                String produceDate = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(produceDateValue));
-                produceDate = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(produceDate, 20);
-                seekPurchaseByBatch.setProduceDate(produceDate);
-            } catch (Exception e) {
-                seekPurchaseByBatch.setProduceDate(null);
-            }
-        }
+//        Object produceDateValue = readWorkBookCell(row.getCell(PRODUCEDATENUM), Cell.CELL_TYPE_STRING,
+//                rowNum, PRODUCEDATENUM);
+//        if (!StringUtils.isEmpty(produceDateValue)) {
+//            try {
+//                String produceDate = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(produceDateValue));
+//                produceDate = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(produceDate, 20);
+//                seekPurchaseByBatch.setProduceDate(produceDate);
+//            } catch (Exception e) {
+//                seekPurchaseByBatch.setProduceDate(null);
+//            }
+//        }
 
         // 规格
         Object specValue = readWorkBookCell(row.getCell(SPECNUM), Cell.CELL_TYPE_STRING,
                 rowNum, SPECNUM);
         if (!StringUtils.isEmpty(specValue)) {
-            try {
-                String spec = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(specValue));
-                spec = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(spec, 50);
-                if (!match(spec)) {
-                    spec = null;
-                }
-                seekPurchaseByBatch.setSpec(spec);
-            } catch (Exception e) {
-                seekPurchaseByBatch.setSpec(null);
-            }
+            seekPurchaseByBatch.setSpec(convert(specValue, 50));
         }
 
         // 类目
         Object kindValue = readWorkBookCell(row.getCell(KINDNUM), Cell.CELL_TYPE_STRING,
                 rowNum, KINDNUM);
         if (!StringUtils.isEmpty(kindValue)) {
-            try {
-                String kind = StringUtilB2C.replaceLineBreak(StringUtilB2C.getStr(kindValue));
-                kind = com.uas.platform.b2c.fa.payment.utils.StringUtils.cutOutString(kind, 20);
-                seekPurchaseByBatch.setKind(kind);
-            } catch (Exception e) {
-                seekPurchaseByBatch.setKind(null);
-            }
+            seekPurchaseByBatch.setKind(convert(kindValue, 50));
         }
         return result;
     }
@@ -415,14 +401,14 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
      * @param code
      * @return
      */
-    private boolean match(String code) {
+    private String match(String code) {
         List<String> filterList = Arrays.asList("空", "没", "无", "—", "-", "null", "#N/A");
         for (String s : filterList) {
             if (s.equals(code)){
-                return false;
+                return null;
             }
         }
-        return true;
+        return code;
     }
 
     /**
@@ -588,6 +574,7 @@ public class SeekPurchaseBomServiceImpl implements SeekPurchaseBomService {
         }
         // 删除bom的临时数据
         seekPurchaseBomDao.delete(seekPurchaseBom.getId());
+        seekPurchaseBomListDao.deleteByBomId(seekPurchaseBom.getId());
         Map<String, Object> result = new HashMap<>();
         result.put("successAmount", inquiryItems.size());
         result.put("goodsAmount", haveGoodsCount);

+ 13 - 13
src/main/java/com/uas/platform/b2c/trade/vendor/service/impl/VendorIntroductionServiceImpl.java

@@ -49,7 +49,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 		Integer total = getTotalCount(enUU, keyword);
 		// 查询企业
 		List<VendorIntroduction> vendorIntroductions = getEnterpriseWithCondition(enUU, keyword, page, size);
-		System.out.println("查找完企业UU" + (System.currentTimeMillis() - start));
+//		System.out.println("查找完企业UU" + (System.currentTimeMillis() - start));
 		return new Page<VendorIntroduction>(page, size, vendorIntroductions, total);
 	}
 
@@ -75,16 +75,16 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 		long start = System.currentTimeMillis();
 		// and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%'
 		String prodSql = "select a.* from (select pr_id id, pr_code prodNum, pr_title prodName, pr_spec spec, pr_cmpcode cmpCode, pr_unit unit, pr_kind kind, "
-				+ " pr_brand brand, pr_pbranden pbranden, pr_standard standard from v$product$private where ifnull(pr_b2cenabled, 1) <> 0  and pr_enuu = "
-				+ vendUU + " and pr_issale = 1 and pr_pbranden is not null and pr_pcmpcode is not null and " + whereCondition
-                + " order by pr_issale desc, pr_standard desc, pr_id desc) a limit " + (page - 1) * size + "," + size;
-		System.out.println("prod:" + prodSql);
+				+ " pr_brand brand, pr_pbranden pbranden, pr_standard standard from v$product$private where pr_enuu = "
+				+ vendUU + " and " + whereCondition + " and pr_pbranden is not null and pr_pcmpcode is not null and ifnull(pr_b2cenabled, 1) <> 0 order by pr_standard desc, pr_id desc) a limit " + (page - 1) * size + "," + size;
+//		System.out.println("prod:" + prodSql);
 		// and Pr_Title not like '%测试%' and lower(Pr_Title) not like '%test%' and Pr_code not like '%测试%' and lower(Pr_code) not like '%test%'
-		String countSql = "select count(1) from v$product$private where pr_enuu = " + vendUU
-				+ " and pr_issale = 1 and pr_pbranden is not null and pr_pcmpcode is not null and ifnull(pr_b2cenabled, 1) <> 0 and " + whereCondition;
+		String countSql = "select count(1) from v$product$private where pr_enuu = " + vendUU + " and " + whereCondition
+				+ " and pr_pbranden is not null and pr_pcmpcode is not null and ifnull(pr_b2cenabled, 1) <> 0";
 		Integer count = commonDao.queryForObject(countSql, Integer.class);
+//		System.out.println("count:" + countSql);
 		List<V_ProductPrivate> products = commonDao.query(prodSql, V_ProductPrivate.class);
-		System.out.println("耗时" + (System.currentTimeMillis() - start));
+//		System.out.println("耗时" + (System.currentTimeMillis() - start));
 		return new Page<>(page, size, products, count);
 	}
 
@@ -125,7 +125,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 		// 获取企业sql
 		enterpriseSql.append("select en.en_uu enUU, en.en_name enName, en.en_shortname enShortname, en.en_address enAddress, en.en_tel enTel, " +
 				"en.en_email enEmail, en.en_corporation enCorporation, en.en_businesscode enBusinesscode, en.en_industry enIndustry, en.en_Businessscope enBusinessScope " +
-				",st.st_enuu,st.st_status from sec$enterprises en left join store$info st on st.st_enuu = en.en_uu where en_name not like '%测试%' and en_name not like '%test%' and length(en_businesscode) > 12 and en_uu <> ")
+				",st.st_enuu,st.st_status from sec$enterprises en left join store$info st on st.st_enuu = en.en_uu where en_name not like '%测试%' and en_name not like '%test%' and (length(en_businesscode) > 12 or en_name like '%香港%' or en_name like '%HONG KONG%' or en_area like '%香港%') and en_uu <> ")
 			.append(enUU);
 		if (!StringUtils.isEmpty(keyword)) {
 			enterpriseSql.append(" and (en_name like '%").append(keyword).append("%' or en_address like '%").append(keyword).append("%' or en_industry like '%").append(keyword)
@@ -143,7 +143,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 				+ enterpriseSql + rownumSql;
 //		String vendorIntroductionUusSql = "select s.*,( " + prodInfoSql + ") productInfo, (" + storeSql +
 //				") isStore from (select t.*,rownum as r1 from (" + enterpriseSql + rownumSql;
-        System.out.println("ens:" + vendorIntroductionUusSql);
+//        System.out.println("ens:" + vendorIntroductionUusSql);
 		return commonDao.query(vendorIntroductionUusSql, VendorIntroduction.class);
 	}
 
@@ -161,10 +161,10 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 			enCountSql.append("select count(1) from (").append(keywordSql);
 		} else {
 			enCountSql.append("select count(1) from (select en_uu,count(1) from sec$enterprises where en_name not like '%测试%' " +
-					" and en_name not like '%test%' and length(en_businesscode) > 12 and en_uu <> ").append(enUU);
+					" and en_name not like '%test%' and (length(en_businesscode) > 12 or en_name like '%香港%' or en_name like '%HONG KONG%' or en_area like '%香港%') and en_uu <> ").append(enUU);
 		}
 		enCountSql.append(" group by en_uu )a");
-        System.out.println("en_count:" + enCountSql.toString());
+//        System.out.println("en_count:" + enCountSql.toString());
 		return commonDao.queryForObject(enCountSql.toString(), Integer.class);
 	}
 
@@ -176,7 +176,7 @@ public class VendorIntroductionServiceImpl implements VendorIntroductionService
 	 */
 	private String getKeywordSql(Long enUU, String keyword) {
 		return "select en_uu,count(1) as counts from sec$enterprises where en_name not like '%测试%' " +
-				"and lower(en_name) not like '%test%' and length(en_businesscode) > 12 and (en_name like '%"
+				"and lower(en_name) not like '%test%' and (length(en_businesscode) > 12 or en_name like '%香港%' or en_name like '%HONG KONG%' or en_area like '%香港%') and (en_name like '%"
 				+ keyword + "%' or en_address like '%" + keyword + "%' or en_industry like '%" + keyword
 				+ "%') and en_uu <> " + enUU;
 	}

+ 1 - 0
src/main/resources/dev/message.properties

@@ -2,6 +2,7 @@ tplNotifySupplierAfterCommit=3c70dd8f-0e1e-4aec-bd7f-c360a506f35e
 plaformB2cAuditRemindTemplateId=774296f3-a260-4bb5-b4eb-6f01090dadf3
 plaformB2cBrandApprovedTemplateId=5b5effdf-5562-45f7-9021-18f21e29bec6
 plaformB2cBrandUnproveTemplateId=03b3d658-cd92-43a0-a53f-103492cfc595
+tplAfterBeAddedtoB2C=b9dee589-9fd8-45d3-9b2a-64b56d65e7e2
 plaformB2cComponentApprovedTemplateId=36812a85-d0f9-4d2a-a7aa-62319f092b6f
 plaformB2cComponentUnproveTemplateId=6228240a-93ba-405f-851c-f874a6c99864
 plaformB2cSupplyChainTemplateId=b28337ba-f115-4f11-b457-15d558443160

BIN
src/main/resources/jxls-tpl/trade/seekPurchaseByBatch.xls


+ 1 - 0
src/main/resources/prod/message.properties

@@ -2,6 +2,7 @@ tplNotifySupplierAfterCommit=3c70dd8f-0e1e-4aec-bd7f-c360a506f35e
 plaformB2cAuditRemindTemplateId=774296f3-a260-4bb5-b4eb-6f01090dadf3
 plaformB2cBrandApprovedTemplateId=5b5effdf-5562-45f7-9021-18f21e29bec6
 plaformB2cBrandUnproveTemplateId=03b3d658-cd92-43a0-a53f-103492cfc595
+tplAfterBeAddedtoB2C=b9dee589-9fd8-45d3-9b2a-64b56d65e7e2
 plaformB2cComponentApprovedTemplateId=36812a85-d0f9-4d2a-a7aa-62319f092b6f
 plaformB2cComponentUnproveTemplateId=6228240a-93ba-405f-851c-f874a6c99864
 plaformB2cSupplyChainTemplateId=b28337ba-f115-4f11-b457-15d558443160

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

@@ -2,6 +2,7 @@ tplNotifySupplierAfterCommit=3c70dd8f-0e1e-4aec-bd7f-c360a506f35e
 plaformB2cAuditRemindTemplateId=774296f3-a260-4bb5-b4eb-6f01090dadf3
 plaformB2cBrandApprovedTemplateId=5b5effdf-5562-45f7-9021-18f21e29bec6
 plaformB2cBrandUnproveTemplateId=03b3d658-cd92-43a0-a53f-103492cfc595
+tplAfterBeAddedtoB2C=b9dee589-9fd8-45d3-9b2a-64b56d65e7e2
 plaformB2cComponentApprovedTemplateId=36812a85-d0f9-4d2a-a7aa-62319f092b6f
 plaformB2cComponentUnproveTemplateId=6228240a-93ba-405f-851c-f874a6c99864
 plaformB2cSupplyChainTemplateId=b28337ba-f115-4f11-b457-15d558443160

+ 2 - 2
src/main/webapp/WEB-INF/web.xml

@@ -3,12 +3,12 @@
 	version="3.1"
 	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-app_3_1.xsd">
 
-	<display-name>platform-b2c</display-name>
+	<display-name>platform-b2cAuthority</display-name>
 
 	<description>usoftchina platform b2c</description>
 	<context-param>
 		<param-name>webAppRootKey</param-name>
-		<param-value>spring.webapp.b2c.prod</param-value>
+		<param-value>spring.webapp.b2c.authority</param-value>
 	</context-param>
 	<context-param>
 		<param-name>spring.profiles.active</param-name>

+ 14 - 16
src/main/webapp/resources/css/common.css

@@ -970,6 +970,10 @@ select {
 
 
 /*买卖家求购*/
+.seek-purchase .seek-purchase-content >table {
+	table-layout:fixed;
+	margin: 0 auto;
+}
 .seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap {
 	height: 100%;
 	padding-top: 10px;
@@ -988,18 +992,13 @@ select {
 	display: inline-block;
 	float: left;
 }
-.seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap.il-content .il-box .item span {
-	color: #999;
-}
-.seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap.il-content .il-box.il-box-large {
-	width: 520px;
-}
+
 .seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap.il-content .il-box.il-box-large .fl {
-	width: 183px;
+	width: 260px;
 	line-height: 19px;
 	word-break: break-all;
 	white-space: pre-line;
-	margin-right: 75px;
+	margin-right: 13px;
 }
 .seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap.il-content .il-box.il-box-large .fl.bottom {
 	margin-top: 11px;
@@ -1013,9 +1012,11 @@ select {
 }
 .seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap.il-content .il-box.il-box-large .fl span {
 	float: left;
+	width:110px;
+	text-align: right;
 }
 .seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap.il-content .il-box.il-box-large .fl.size-middle {
-	width: 136px;
+	width: 200px;
 }
 .seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap.il-content .il-box.il-box-large .fl.size-middle .content {
 	width: 86px;
@@ -1024,18 +1025,15 @@ select {
 	width: 128px;
 }*/
 .seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap.il-content .il-box.il-box-small .item {
-	color: #333;
-	width: 150px;
-	margin-bottom: 8px;
-	overflow: hidden;
-	text-overflow: ellipsis;
-	white-space: nowrap;
+	color: #f71026;
+	width: 110px;
+	line-height: 100px;
+	text-align: center;
 }
 .seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap .remain {
 	margin-top: 24px;
 }
 .seek-purchase .seek-purchase-content >table >tbody >tr.default-row td .row-wrap .en-name {
-	width: 226px;
 	overflow: hidden;
 	text-overflow: ellipsis;
 	white-space: nowrap;

BIN
src/main/webapp/resources/img/vendor/authority/role-bg-1.jpg


BIN
src/main/webapp/resources/img/vendor/authority/role-bg-2.jpg


BIN
src/main/webapp/resources/img/vendor/authority/role-bg-3.jpg


BIN
src/main/webapp/resources/img/vendor/authority/role-bg-4.jpg


BIN
src/main/webapp/resources/img/vendor/authority/role-bg-5.jpg


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


BIN
src/main/webapp/resources/img/vendor/images/check-active.jpg


BIN
src/main/webapp/resources/img/vendor/images/check.jpg


BIN
src/main/webapp/resources/img/vendor/images/person-material-pc.png


BIN
src/main/webapp/resources/img/vendor/images/xiala-blue.jpg


+ 1 - 1
src/main/webapp/resources/js/admin/controllers/AuditRealAuthCtrl.js

@@ -16,7 +16,7 @@ define(['app/app'], function (app) {
           params.total(data.totalElements);
           $defer.resolve(data.content);
         }, function (response) {
-          toaster.pop('error', response.data);
+          toaster.pop('error', '获取账户信息失败 ', response.data);
         });
       }
     });

+ 1 - 1
src/main/webapp/resources/js/admin/controllers/SecQuestionCtrl.js

@@ -15,7 +15,7 @@ define(['app/app'], function (app) {
           params.total(data.totalElements);
           $defer.resolve(data.content);
         }, function (response) {
-          toaster.pop('error', '获取账户信息失败');
+          toaster.pop('error', '获取账户信息失败 ', response.data);
         });
       }
     });

+ 1 - 1
src/main/webapp/resources/js/admin/controllers/bankInfo/AuditBankInfoCtrl.js

@@ -45,7 +45,7 @@ define(['app/app'], function (app) {
                     params.total(data.totalElements);
                     $defer.resolve(data.content);
                 }, function (response) {
-                    toaster.pop('error', '获取账户信息失败');
+                    toaster.pop('error', '获取账户信息失败 ', response.data);
                 });
             }
         });

+ 1 - 1
src/main/webapp/resources/js/admin/controllers/checkMoney/billInfoAdminCtrl.js

@@ -15,7 +15,7 @@ define(['app/app'], function(app) {
 					}
 				});
 			}, function(response) {
-				toaster.pop('error', '获取发票信息失败');
+				toaster.pop('error', '获取发票信息失败 ' + response.data);
 			});
 		}
 		

+ 1 - 1
src/main/webapp/resources/js/admin/controllers/checkMoney/creditCardAdminCtrl.js

@@ -45,7 +45,7 @@ define(['app/app'], function(app) {
 					account.filterAccount = hideBankFilter(account.number);
 				})
 			}, function(response) {
-				toaster.pop('error', '获取账户信息失败');
+				toaster.pop('error', '获取账户信息失败 '+ response.data);
 			})
 		}
 		loadAccount();

+ 2 - 2
src/main/webapp/resources/js/admin/controllers/logistics/DelayTime.js

@@ -16,8 +16,8 @@ define([ 'app/app' ], function(app) {
 					}
 				});
 			}
-		}, function(response) {
-			toaster.pop('error', '获取信息失败');
+		}, function(res) {
+			toaster.pop('error', '获取信息失败 ', res.data);
 		});
 		$scope.modify = function(delayTime) {
 			delayTime.edit = true;

+ 2 - 2
src/main/webapp/resources/js/admin/controllers/product/MoveCmpCtrl.js

@@ -110,8 +110,8 @@ define([ 'app/app' ], function(app) {
 						$scope.allCheck = false;
 						$defer.resolve(data.content);
 						params.total(data.totalElements);
-					}, function(response) {
-						toaster.pop('error', '获取信息失败');
+					}, function(res) {
+						toaster.pop('error', '获取信息失败 ', res.data);
 					});
 				}
 			});	

+ 2 - 2
src/main/webapp/resources/js/admin/controllers/trade/AfSaleApplyProcessingCtrl.js

@@ -56,8 +56,8 @@ define(['app/app'], function(app) {
 								}
 							})
 						}
-					}, function(response) {
-						toaster.pop('error', '获取信息失败');
+					}, function(res) {
+						toaster.pop('error', '获取信息失败 ', res.data);
 					});
 				}
 			});

+ 2 - 2
src/main/webapp/resources/js/admin/controllers/trade/supExProcessCtrl.js

@@ -32,8 +32,8 @@ define(['app/app'], function (app) {
                     PuExProcess.getPuExApplyListForMall(param, function (data) {
                         $defer.resolve(data.content);
                         params.total(data.totalElements);
-                    }, function (response) {
-                        toaster.pop('error', '获取信息失败');
+                    }, function (res) {
+                        toaster.pop('error', '获取信息失败 ', res.data);
                     });
                 }
             });

+ 53 - 0
src/main/webapp/resources/js/common/controllers/commonCtrls.js

@@ -1752,6 +1752,59 @@ define([ 'app/app' ], function(app) {
 		};
 	}]);
 
+  /**
+   * 左侧导航栏控制器
+   */
+	app.controller('leftNavCtrl', ["$scope", "toaster", '$modal', '$rootScope', function($scope, toaster, $modal, $rootScope) {
+        //安全设置提醒框
+        $scope.openHomeCenterModel = function () {
+            var modalInstance = $modal.open({
+                animation: true,
+                templateUrl: $rootScope.rootPath + '/static/view/usercenter/modal/homeCenter_modal.html',
+                controller: 'homeModalCtrl'
+            });
+            modalInstance.result.then(function () {
+            }, function () {
+            });
+        };
+    }]);
+	/**
+	 * 左侧导航栏控制器
+	 */
+	app.controller('leftNavCtrl', ["$scope", "toaster", '$modal', '$rootScope', function($scope, toaster, $modal, $rootScope){
+		//安全设置提醒框
+
+		$scope.openHomeCenterModel = function() {
+			var modalInstance = $modal.open({
+				animation: true,
+				templateUrl: $rootScope.rootPath + '/static/view/usercenter/modal/homeCenter_modal.html',
+				controller:'homeModalCtrl'
+			});
+			modalInstance.result.then(function(){
+			}, function(){
+			});
+		};
+		$scope.promptUpdate = function() {
+			if (!$scope.userInfo.pwdEnable || !$scope.userInfo.userEmail || !$scope.userInfo.haveUserQuestion) {
+				$scope.openHomeCenterModel();
+			}
+		};
+  }]);
+
+	app.controller('homeModalCtrl', ['$rootScope', '$scope',  '$modalInstance', 'toaster', '$http', 'ShippingAddress','$state', function($rootScope, $scope, $modalInstance, toaster, $http, ShippingAddress,$state) {
+        $rootScope.$on('$stateChangeStart',
+            function (event, toState, toParams, fromState, fromParams) {
+                $modalInstance.dismiss();
+            })
+        $scope.goLink = function (op) {
+            $state.go('vendor_account_management', {op: op});
+            $modalInstance.dismiss('cancel');
+        }
+
+        $scope.cancel = function () {
+            $modalInstance.dismiss('cancel');
+        }
+    }])
     // 手续费控制器
     app.controller('poundageCtrl', ["$scope", "NumberService", function($scope, NumberService){
         // 手续费介绍提示框

+ 2 - 2
src/main/webapp/resources/js/common/controllers/originalGoodsCtrl.js

@@ -23,8 +23,8 @@ define([ 'app/app' ], function(app) {
 					$scope.components = data.content;
 					$defer.resolve(data.content);
 					params.total(data.totalElements);
-				}, function () {
-					toaster.pop('error', '获取信息失败');
+				}, function (res) {
+					toaster.pop('error', '获取信息失败 ', res.data);
 				})
 			}
 		});

+ 2 - 11
src/main/webapp/resources/js/common/module/store_recommend_product.js

@@ -39,7 +39,7 @@ define([ 'ngResource', 'common/query/commodity' ], function() {
 			 * @param uuid
 			 */
 			saveProductsWhenSellerUpdate: {
-				url: 'api/store/recommend/products//update_batch',
+				url: 'store-service/products//update_batch',
 				method: 'POST',
 				isArray: true
 			},
@@ -549,16 +549,7 @@ define([ 'ngResource', 'common/query/commodity' ], function() {
 			}
 			console.log(products);
 
-			return RecommendProduct.saveProductsWhenSellerUpdate({ uuid: uuid }, products).$promise.then(function (products) {
-				if (!products) {
-					return [];
-				}
-				productExist(products);
-				return products;
-			}, function (error) {
-				console.log(error);
-				return [];
-			});
+			return RecommendProduct.saveProductsWhenSellerUpdate({ uuid: uuid }, products).$promise;
 		}
 
 	}]);

+ 1 - 1
src/main/webapp/resources/js/common/query/enterprise.js

@@ -186,7 +186,7 @@ define([ 'angular', 'ui-bootstrap', 'ngResource' ], function(angular) {
 				method : 'PUT'
 			},
 			updateEnterpriseInfo : {
-				url : 'basic/enterprise/:enuu/info',
+				url : 'basic/enterprise/:enuu/updateInfo',
 				method : 'POST'
 			},
 			//绑定界面的用户搜索

+ 151 - 120
src/main/webapp/resources/js/common/query/user.js

@@ -1,114 +1,118 @@
-define([ 'angular', 'ui-bootstrap', 'ngResource' ], function(angular) {
-	'use strict';
-	angular.module('common.query.user', ['ui.bootstrap', 'ngResource']).factory('UserService', ['$modal', function($modal){
-		return {
-			open: function(enterprise) {
-				var modalInstance = $modal.open({
-					templateUrl : 'static/view/common/query/user.html',
-					controller : 'UserQueryCtrl',
-					backdrop : "static",
-					resolve : {
-						enterprise : function() {
-							return enterprise;
-						}
-					},
-					windowClass : 'modal-large'
-				});
-				return modalInstance;
-			}
-		};
-	}]).controller('UserQueryCtrl', ['$scope', '$modalInstance', '$http', '$filter', 'enterprise', 'ngTableParams', function($scope, $modalInstance, $http, $filter, enterprise, ngTableParams){
-		$scope.enterprise = enterprise;
-		
-		$scope.tableParams = new ngTableParams({
-			page : 1,
-			total: 1, 
-			count : 500,
-			sorting: {
+define(['angular', 'ui-bootstrap', 'ngResource'], function (angular) {
+    'use strict';
+    angular.module('common.query.user', ['ui.bootstrap', 'ngResource']).factory('UserService', ['$modal', function ($modal) {
+        return {
+            open: function (enterprise) {
+                var modalInstance = $modal.open({
+                    templateUrl: 'static/view/common/query/user.html',
+                    controller: 'UserQueryCtrl',
+                    backdrop: "static",
+                    resolve: {
+                        enterprise: function () {
+                            return enterprise;
+                        }
+                    },
+                    windowClass: 'modal-large'
+                });
+                return modalInstance;
+            }
+        };
+    }]).controller('UserQueryCtrl', ['$scope', '$modalInstance', '$http', '$filter', 'enterprise', 'ngTableParams', function ($scope, $modalInstance, $http, $filter, enterprise, ngTableParams) {
+        $scope.enterprise = enterprise;
+
+        $scope.tableParams = new ngTableParams({
+            page: 1,
+            total: 1,
+            count: 500,
+            sorting: {
                 'userName': 'asc'
             },
             filter: {
-            	'enabled': 1
+                'enabled': 1
             }
-		}, {
-			groupBy : 'role',
-			counts: [],
-			getData : function($defer, params) {
-				$http.get('user/' + enterprise.uu + '/users').success(function(users){
-					if(users) {
-						var data = params.filter() ? $filter('filter')(users, params.filter()) : users;
-						params.total(data.length);
-						data = params.sorting() ? $filter('orderBy')(data, $scope.tableParams.orderBy()) : data;
+        }, {
+            groupBy: 'role',
+            counts: [],
+            getData: function ($defer, params) {
+                $http.get('user/' + enterprise.uu + '/users').success(function (users) {
+                    if (users) {
+                        var data = params.filter() ? $filter('filter')(users, params.filter()) : users;
+                        params.total(data.length);
+                        data = params.sorting() ? $filter('orderBy')(data, $scope.tableParams.orderBy()) : data;
                         $defer.resolve(data.slice((params.page() - 1) * params.count(), params.page() * params.count()));
-					}
-				}).error(function(){
-					
-				});
-			}
-		});
+                    }
+                }).error(function () {
+
+                });
+            }
+        });
 
-		// 关闭模态窗
-		$scope.close = function() {
-			$modalInstance.close();
-		};
-		// 选中user
-		$scope.select = function(user) {
-			$modalInstance.close(angular.copy(user));
-		};
-	}]).factory('User', ['$resource', function($resource) {
-		return $resource('basic/user/personal', {}, {
-			postImageUrl: {
-				url : 'basic/user/setImageUrl',
-				method : 'POST'
-			},
-			getUser: {
-				method : 'GET'
-			},
-			isDevOrProd: {
-				url: 'basic/user/isDev',
-				method : 'GET'
-			},
-			getUserByUU: {
-				url: 'basic/user/getUserByUU',
-				method : 'GET'
-			},
-			checkPassword: {
-				url: 'basic/user/checkPassword',
-				method: 'GET'
-			},
-			updatePassword: {
-				url: 'basic/user/updatePassword',
-				method: 'POST'
-			},
+        // 关闭模态窗
+        $scope.close = function () {
+            $modalInstance.close();
+        };
+        // 选中user
+        $scope.select = function (user) {
+            $modalInstance.close(angular.copy(user));
+        };
+    }]).factory('User', ['$resource', function ($resource) {
+        return $resource('basic/user/personal', {}, {
+            postImageUrl: {
+                url: 'basic/user/setImageUrl',
+                method: 'POST'
+            },
+            getUser: {
+                method: 'GET'
+            },
+            getUserByUU: {
+                url: 'basic/user/getUserByUU',
+                method: 'GET'
+            },
+            checkPassword: {
+                url: 'basic/user/checkPassword',
+                method: 'GET'
+            },
+            updatePassword: {
+                url: 'basic/user/updatePassword',
+                method: 'POST'
+            },
+            update: {
+                url: 'basic/user',
+                method: 'PUT'
+            },
             checkUserEmail: {
                 url: 'basic/user/checkUserEmail',
                 method: 'GET'
             },
-            sendCheckCode:{
+            isDevOrProd: {
+                url: 'basic/user/isDev',
+                method : 'GET'
+            },
+            sendCheckCode: {
                 url: 'basic/user/sendCheckCode',
                 method: 'GET'
             },
-            emailEnable:{
+            emailEnable: {
                 url: 'basic/user/emailEnable',
                 method: 'GET'
-			},
-            validCheckCode:{
+            },
+            validCheckCode: {
                 url: 'basic/user/validCheckCode',
                 method: 'GET'
             },
-            updateUserEmail:{
+            updateUserEmail: {
                 url: 'basic/user/updateUserEmail',
                 method: 'POST'
-			},
-			checkUserTel:{
+            },
+            checkUserTel: {
                 url: 'basic/user/checkUserTel',
                 method: 'GET'
-			},
-            telEnable:{
+            },
+            telEnable: {
                 url: 'basic/user/telEnable',
                 method: 'GET'
             },
-            getPageToken:{
+            getPageToken: {
                 url: 'basic/user/getPageToken',
                 method: 'GET'
             },
@@ -116,51 +120,78 @@ define([ 'angular', 'ui-bootstrap', 'ngResource' ], function(angular) {
                 url: 'basic/user/sendTelCheckCode',
                 method: 'GET'
             },
-            validTelCheckCode:{
+            validTelCheckCode: {
                 url: 'basic/user/validTelCheckCode',
                 method: 'GET'
-			},
-            updateUserTel:{
+            },
+            updateUserTel: {
                 url: 'basic/user/updateUserTel',
                 method: 'POST'
             },
-            checkHaveUserPay:{
+            checkHaveUserPay: {
                 url: 'basic/user/checkHaveUserPay',
                 method: 'GET'
-			},
-            checkUserPay:{
+            },
+            checkUserPay: {
                 url: 'basic/user/checkUserPay',
                 method: 'GET'
-			},
-            updateUserPay:{
+            },
+            updateUserPay: {
                 url: 'basic/user/updateUserPay',
                 method: 'POST'
-			},
-            updateUserQuestion:{
+            },
+            updateUserQuestion: {
                 url: 'basic/user/updateUserQuestion',
-            	  method: 'POST'
-			},
-            getUserQuestion:{
-							 url: 'basic/user/getUserQuestion',
+                method: 'POST'
+            },
+            getUserQuestion: {
+                url: 'basic/user/getUserQuestion',
                 method: 'GET',
-              isArray : true
-						},
-      updateRealAuth:{
-        url: 'basic/user/updateRealAuth',
-        method: 'POST'
-			},
-      getPageStatusRealAuth:{
-        url: 'basic/user/getPageStatusRealAuth',
-        method: 'GET'
-			},
-			updateIdEnable:{
-        url: 'basic/user/updateIdEnable',
-        method: 'POST'
-			},
-			getAllSecQuestion:{
-				url:'user/secQuestion/getPageInfo',
-				method:'GET'
-			}
-		});
-	}]);
+                isArray: true
+            },
+            updateRealAuth: {
+                url: 'basic/user/updateRealAuth',
+                method: 'POST'
+            },
+            getPageStatusRealAuth: {
+                url: 'basic/user/getPageStatusRealAuth',
+                method: 'GET'
+            },
+            updateIdEnable: {
+                url: 'basic/user/updateIdEnable',
+                method: 'POST'
+            },
+            getAllSecQuestion: {
+                url: 'user/secQuestion/getPageInfo',
+                method: 'GET'
+            }
+        });
+    }]).factory('AccountResource', ['$resource', function ($resource) {
+        return $resource('account/resource', {});
+    }]).factory('AccountRole', ['$resource', function ($resource) {
+        return $resource('account/role/:id',{},{
+            getByExistRoleAndEnuu: {
+                url: 'account/role/existRole',
+                method: 'GET',
+                isArray: true
+            },
+            save: {
+                url: 'account/role',
+                method: 'POST'
+            },
+            remove: {
+                url: 'account/role/:id',
+                method: 'DELETE'
+            },
+            findAll: {
+                url: 'account/role',
+                method: 'GET',
+                isArray: true
+            },
+            findAuthority: {
+                url: 'account/resource/validateRes',
+                method: 'GET'
+            }
+        });
+    }]);
 });

+ 1 - 1
src/main/webapp/resources/js/prod/controllers/ApplySampleCtrl.js

@@ -187,7 +187,7 @@ define([ 'app/app' ], function(app) {
 	    		toaster.pop('success', '成功 ', '保存收货地址成功');
 	    		$modalInstance.close(data);
 	    	}, function(res){
-	    		toaster.pop('error', '系统错误 ', '保存收货地址失败');
+	    		toaster.pop('error', '保存收货地址失败 ', res.data);
 	    	});
 	    }
 	    

+ 4 - 4
src/main/webapp/resources/js/prod/controllers/KindDetailCtrl.js

@@ -57,8 +57,8 @@ define([ 'app/app' ], function(app) {
 						searchService.kindPropertySearch(propertyParams, function(data) {
 							$defer.resolve(data.components);
 							params.total(data.resultCount);
-						}, function(response) {
-							toaster.pop('error', '获取信息失败');
+						}, function(res) {
+							toaster.pop('error', '获取信息失败 ', res.data);
 						})
 					}
 				});
@@ -147,8 +147,8 @@ define([ 'app/app' ], function(app) {
 								$scope.hasSample.push(false);
 							}
 						});
-					}, function(response) {
-						toaster.pop('error', '获取信息失败');
+					}, function(res) {
+						toaster.pop('error', '获取信息失败 ', res.data);
 					});
 				}
 			});	

+ 2 - 2
src/main/webapp/resources/js/prod/controllers/OrderEnsureCtrl.js

@@ -268,7 +268,7 @@ define([ 'app/app' ], function(app) {
 					}
 				});
 			}, function(response) {
-				toaster.pop('error', '获取发票信息失败');
+				toaster.pop('error', '获取发票信息失败 ' + response.data);
 			});
 		};
 		
@@ -1134,7 +1134,7 @@ define([ 'app/app' ], function(app) {
 	    		toaster.pop('success', '成功 ', '保存收货地址成功');
 	    		$modalInstance.close(data);
 	    	}, function(res){
-	    		toaster.pop('error', '系统错误 ', '保存收货地址失败');
+	    		toaster.pop('error', '保存收货地址失败', res.data);
 	    	});
 	    };
 	    

+ 2 - 2
src/main/webapp/resources/js/prod/controllers/OrderEnsureCtrlWithMultiCurrency.js

@@ -214,7 +214,7 @@ define([ 'app/app' ], function(app) {
 					}
 				});
 			}, function(response) {
-				toaster.pop('error', '获取发票信息失败');
+                toaster.pop('error', '获取发票信息失败 ' + response.data);
 			});
 		};
 		
@@ -1044,7 +1044,7 @@ define([ 'app/app' ], function(app) {
 	    		toaster.pop('success', '成功 ', '保存收货地址成功');
 	    		$modalInstance.close(data);
 	    	}, function(res){
-	    		toaster.pop('error', '系统错误 ', '保存收货地址失败');
+	    		toaster.pop('error', '保存收货地址失败', res.data);
 	    	});
 	    }
 	    

+ 2 - 2
src/main/webapp/resources/js/prod/controllers/ProductListByKindCtrl.js

@@ -156,8 +156,8 @@ define([ 'app/app' ], function(app) {
 								$scope.hasSample.push(false);
 							}
 						});
-					}, function(response) {
-						toaster.pop('error', '获取信息失败');
+					}, function(res) {
+						toaster.pop('error', '获取信息失败 ', res.data);
 					});
 				}
 			});	

+ 3 - 3
src/main/webapp/resources/js/prod/controllers/ProofingCtrl.js

@@ -58,8 +58,8 @@ define([ 'app/app' ], function(app) {
 					$scope.components = data.content
 					$defer.resolve(data.content);
 					params.total(data.totalElements);
-				}, function(response) {
-					toaster.pop('error', '获取信息失败');
+				}, function(res) {
+					toaster.pop('error', '获取信息失败 ', res.data);
 				});
 			}
 		});	
@@ -171,7 +171,7 @@ define([ 'app/app' ], function(app) {
 	    		toaster.pop('success', '成功 ', '保存收货地址成功');
 	    		$modalInstance.close(data);
 	    	}, function(res){
-	    		toaster.pop('error', '系统错误 ', '保存收货地址失败');
+	    		toaster.pop('error', '保存收货地址失败', res.data);
 	    	});
 	    }
 	    

+ 1 - 1
src/main/webapp/resources/js/prod/controllers/WastageCtrl.js

@@ -122,7 +122,7 @@ define([ 'app/app' ], function(app) {
 	    		toaster.pop('success', '成功 ', '保存收货地址成功');
 	    		$modalInstance.close(data);
 	    	}, function(res){
-	    		toaster.pop('error', '系统错误 ', '保存收货地址失败');
+	    		toaster.pop('error', '保存收货地址失败 ', res.data);
 	    	});
 	    }
 	    

+ 2 - 2
src/main/webapp/resources/js/search/app.js

@@ -174,8 +174,8 @@ define([ 'angularAMD', 'common/services', 'common/directives','ui.router', 'ui-b
 					getCarts();
 					$defer.resolve(data.components);
 					params.total(data.expose);
-				}, function(response) {
-					toaster.pop('error', '获取信息失败');
+				}, function(res) {
+					toaster.pop('error', '获取信息失败 ', res.data);
 				});
 			}
 		});

+ 1 - 1
src/main/webapp/resources/js/usercenter/controllers/BillAdminCtrl.js

@@ -15,7 +15,7 @@ define(['app/app'], function(app) {
 					}
 				});
 			}, function(response) {
-				toaster.pop('error', '获取发票信息失败');
+                toaster.pop('error', '获取发票信息失败 ' + response.data);
 			});
 		}
 		

+ 2 - 2
src/main/webapp/resources/js/usercenter/controllers/MyOrderToDoCtrl.js

@@ -109,7 +109,7 @@ define([ 'app/app' ], function(app) {
 				$scope.yrscAccount = data;
 			}
 		}, function(response) {
-			toaster.pop('error', '获取账户信息失败');
+			toaster.pop('error', '获取账户信息失败 ', response.data);
 		});
 		
 		// 获取优软商城对私账户的信息
@@ -118,7 +118,7 @@ define([ 'app/app' ], function(app) {
 				$scope.yrscPerAccount = data[0];
 			}
 		}, function(response) {
-			toaster.pop('error', '获取账户信息失败');
+			toaster.pop('error', '获取账户信息失败 ', response.data);
 		});
 		
 		// 根据当前状态获取对应的状态码值

+ 1 - 1
src/main/webapp/resources/js/usercenter/controllers/addressAdminCtrl.js

@@ -137,7 +137,7 @@ define(['app/app'], function(app) {
 	    		toaster.pop('success', '成功 ', '保存收货地址成功');
 	    		$modalInstance.close(data);
 	    	}, function(res){
-	    		toaster.pop('error', '系统错误 ', '保存收货地址失败');
+	    		toaster.pop('error', '保存收货地址失败 ', res.data);
 	    	});
 	    }
 	    

+ 1 - 1
src/main/webapp/resources/js/usercenter/controllers/creditCardAdminCtrl.js

@@ -31,7 +31,7 @@ define(['app/app'], function(app) {
 					account.filterAccount = hideBankFilter(account.number);
 				})
 			}, function(response) {
-				toaster.pop('error', '获取账户信息失败');
+				toaster.pop('error', '获取账户信息失败 ', response.data);
 			})
 		}
 		loadAccount();

+ 13 - 9
src/main/webapp/resources/js/usercenter/controllers/forstore/account_manager_ctrl.js

@@ -93,7 +93,7 @@ define(['app/app'], function (app) {
 
 		//删除地址
 		$scope.deleteAddress = function (address) {
-			$scope.deleteObject = angular.copy(address);;
+			$scope.deleteObject = angular.copy(address);
 			$scope.showDeleteFrame = true;
 		};
 
@@ -416,14 +416,18 @@ define(['app/app'], function (app) {
 				//拼装地区
 				address.area = address.province + ',' + address.city + ',' + address.district;
 
-				// send属性 控制本地址是否是发货地址
-				ShippingAddress.save({isSetTop: $scope.isSetTop, send: $scope.isSendType, isPersonal: !$scope.isSendType}, address, function(data){
-					toaster.pop('success', '成功 ', '保存收货地址成功');
-					$modalInstance.close(data);
-				}, function(){
-					toaster.pop('error', '系统错误 ', '保存收货地址失败');
-				});
-			};
+                    // send属性 控制本地址是否是发货地址
+                    ShippingAddress.save({
+                      isSetTop: $scope.isSetTop,
+                      send: $scope.isSendType,
+                      isPersonal: !$scope.isSendType
+                    }, address, function (data) {
+                      toaster.pop('success', '成功 ', '保存收货地址成功');
+                      $modalInstance.close(data);
+                    }, function (res) {
+                      toaster.pop('error', '保存收货地址失败 ', res.data);
+                    });
+                  };
 
 			$scope.cancel = function() {
 				$modalInstance.dismiss();

+ 95 - 95
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_cart_ctrl.js

@@ -43,47 +43,47 @@ define(["app/app", 'jquery-summernote'], function(app) {
 		$scope.isChooseAll = false;
 
 		$scope.loadData = function (){
-				Cart.getPageInfo($scope.pageInfo, function(data) {
-					$scope.isDataLoading = false;
-					$scope.total = data.totalElements;
-					$scope.pageNum = data.totalPages;
+			Cart.getPageInfo($scope.pageInfo, function(data) {
+				$scope.isDataLoading = false;
+				$scope.total = data.totalElements;
+				$scope.pageNum = data.totalPages;
 
-					angular.forEach(data.content, function (cart) {
-						cart.buyCurrency = cart.currencyName.indexOf("RMB") > -1 ? "RMB" : "USD";
-						cart.isSelect = false;
-						//计算分段和统计一下价格
-						$scope.getPrice(cart);
-
-						//便于后期循环
-						$scope.carts.push(cart);
-						$scope.disabledAddAndSub(cart);
-						$scope.countByPage += 1;
-						var isContain = false;
-						for (var i = 0; i < $scope.cartMap.length; i++) {
-							if(angular.equals($scope.cartMap[i].name, cart.storeName)) {
-								$scope.cartMap[i].arr.push(cart);
-								isContain = true;
-							}
-						}
-						if(!isContain) {
-							var obj = {};
-							obj.name = cart.storeName;
-							obj.arr = [];
-							obj.arr.push(cart);
-							$scope.cartMap.push(obj);
+				angular.forEach(data.content, function (cart) {
+					cart.buyCurrency = cart.currencyName.indexOf("RMB") > -1 ? "RMB" : "USD";
+					cart.isSelect = false;
+					//计算分段和统计一下价格
+					$scope.getPrice(cart);
+
+					//便于后期循环
+					$scope.carts.push(cart);
+					$scope.disabledAddAndSub(cart);
+					$scope.countByPage += 1;
+					var isContain = false;
+					for (var i = 0; i < $scope.cartMap.length; i++) {
+						if(angular.equals($scope.cartMap[i].name, cart.storeName)) {
+							$scope.cartMap[i].arr.push(cart);
+							isContain = true;
 						}
-					});
-					$scope.cartIsEmpty = !$scope.carts.length ? true : false;
-					//设置全选的复选框
-					$scope.isChooseAll = $scope.isAllSelect($scope.carts);
+					}
+					if(!isContain) {
+						var obj = {};
+						obj.name = cart.storeName;
+						obj.arr = [];
+						obj.arr.push(cart);
+						$scope.cartMap.push(obj);
+					}
+				});
+				$scope.cartIsEmpty = !$scope.carts.length ? true : false;
+				//设置全选的复选框
+				$scope.isChooseAll = $scope.isAllSelect($scope.carts);
 
-					//设置店铺复选框的状态
-					angular.forEach($scope.cartMap, function (store) {
-						$scope.selectedStore[store.name] = $scope.isAllSelect(store.arr);
-					});
-				},function() {
-					toaster.pop('error', "提示", "获取购物车信息失败,请刷新页面");
+				//设置店铺复选框的状态
+				angular.forEach($scope.cartMap, function (store) {
+					$scope.selectedStore[store.name] = $scope.isAllSelect(store.arr);
 				});
+			},function() {
+				toaster.pop('error', "提示", "获取购物车信息失败,请刷新页面");
+			});
 		};
 
 		$scope.loadData();
@@ -120,7 +120,7 @@ define(["app/app", 'jquery-summernote'], function(app) {
 			//计算总价格
 			$scope.calculateAmount($scope.selectedStoreCarts);
 		};
-		
+
 		// 减少按钮,每次减minPackQty
 		$scope.reduce = function(cart){
 			if(cart.status == 1) {
@@ -139,7 +139,7 @@ define(["app/app", 'jquery-summernote'], function(app) {
 			//计算总价格
 			$scope.calculateAmount($scope.selectedStoreCarts);
 		};
-				
+
 		//根据搜索词过滤购物车信息,对类目、品牌、器件筛选
 		$scope.cartFilterCurrency = function(cartGroup) {
 			var result = false;
@@ -167,8 +167,8 @@ define(["app/app", 'jquery-summernote'], function(app) {
 
 		$scope.closeTable = function() {
 			console.log('0kds');
-        };
-        // //监听点击的位置,隐藏价格梯度的信息
+		};
+		// //监听点击的位置,隐藏价格梯度的信息
 		// document.onclick = function(event) {
 		// 	$scope.$apply(function () {
 		// 		angular.forEach($scope.carts, function (cart) {
@@ -181,9 +181,9 @@ define(["app/app", 'jquery-summernote'], function(app) {
 
 		//查看价格分段。
 		$scope.togglePrice = function (cart) {
-            cart.display = cart.display == 'block' ? 'none' : 'block';
-        };
-        // 统计已勾选批次
+			cart.display = cart.display == 'block' ? 'none' : 'block';
+		};
+		// 统计已勾选批次
 		var creatSelectArr = function(){
 			var arr = [];
 			angular.forEach($scope.carts, function(cart) {
@@ -607,8 +607,8 @@ define(["app/app", 'jquery-summernote'], function(app) {
 					if(!isThisTag) {
 						$scope.carts[i].contactSeller = false;
 					}
-                }
-            });
+				}
+			});
 		};
 
 
@@ -811,17 +811,17 @@ define(["app/app", 'jquery-summernote'], function(app) {
 			SessionService.set("buyNow",false);
 			var jsonOrderDetails = angular.toJson(result);
 			Order.saveByGroup({}, jsonOrderDetails, function(result){
-                if(result.code == 1) {
+				if(result.code == 1) {
 					if(result.message) {
 						toaster.pop('info', result.message);
 					}
-                    $state.go('order_pay', {orderid :  enIdFilter(result.data.orderid)});
-                }else if(result.code == 7){
-                    toaster.pop('info', '提示', "选中的购物车信息已经失效,将为您刷新界面之后重新操作");
+					$state.go('order_pay', {orderid :  enIdFilter(result.data.orderid)});
+				}else if(result.code == 7){
+					toaster.pop('info', '提示', "选中的购物车信息已经失效,将为您刷新界面之后重新操作");
 					$timeout(function () {
 						window.location.reload();
 					}, 1500);
-                }else {
+				}else {
 					toaster.pop('info', '提示', result.message);
 				}
 			}, function(res){
@@ -864,46 +864,46 @@ define(["app/app", 'jquery-summernote'], function(app) {
 				Goods.getSimilarityPro({page : 1, size : 6, code : cart.code, batchCode : cart.batchCode}, function (data) {
 					cart.similarities = data.data.content;
 				}, function (error) {
-					toaster.pop('error', '获取相似产品失败!');
+					toaster.pop('error', '获取相似产品失败!'+ error.data);
 				});
 			}
 
 		};
-        // 移入收藏后删除购物车操作
+		// 移入收藏后删除购物车操作
 		$scope.collectDelete = function(id){
-            var arr = [];
-            if(id != null){
-                arr.push(id);
-            }else {
-                angular.forEach($scope.carts, function(cart){
-                    if(cart.isSelect){
-                        arr.push(cart.id);
-                    }
-                });
-            }
-            var ids = angular.toJson(arr);
-            Cart.deleteById({ids : ids}, function(data){
-                $rootScope.countCart = $rootScope.countCart - arr.length;
-
-                //更新选中的购物车信息
-                $scope.selectedStoreCarts = $scope.arrayFilterId($scope.selectedStoreCarts, arr);
-                //更新购物车信息
-                $scope.carts = $scope.arrayFilterId($scope.carts, arr);
-                //判断是否全部删除,如果全部删除,就将全选置为取消状态。
-                if($scope.carts.length == 0) {
-                    $scope.isChooseAll = false;
+			var arr = [];
+			if(id != null){
+				arr.push(id);
+			}else {
+				angular.forEach($scope.carts, function(cart){
+					if(cart.isSelect){
+						arr.push(cart.id);
+					}
+				});
+			}
+			var ids = angular.toJson(arr);
+			Cart.deleteById({ids : ids}, function(data){
+				$rootScope.countCart = $rootScope.countCart - arr.length;
+
+				//更新选中的购物车信息
+				$scope.selectedStoreCarts = $scope.arrayFilterId($scope.selectedStoreCarts, arr);
+				//更新购物车信息
+				$scope.carts = $scope.arrayFilterId($scope.carts, arr);
+				//判断是否全部删除,如果全部删除,就将全选置为取消状态。
+				if($scope.carts.length == 0) {
+					$scope.isChooseAll = false;
 					$scope.cartIsEmpty = true;
-                }
+				}
 
-                //更新map中购物车信息
-                var deleteStoreName = [];
+				//更新map中购物车信息
+				var deleteStoreName = [];
 				angular.forEach($scope.cartMap, function(store) {
-						if(store.arr && store.arr.length > 0) {
-							store.arr = $scope.arrayFilterId(store.arr, arr)
-							if(!store.arr || !store.arr.length || store.arr.length == 0) {
-								deleteStoreName.push(store.name);
-							}
+					if(store.arr && store.arr.length > 0) {
+						store.arr = $scope.arrayFilterId(store.arr, arr)
+						if(!store.arr || !store.arr.length || store.arr.length == 0) {
+							deleteStoreName.push(store.name);
 						}
+					}
 				});
 				//删除$scope.cartMap多余的部分。
 				angular.forEach(deleteStoreName, function(storeName) {
@@ -912,17 +912,17 @@ define(["app/app", 'jquery-summernote'], function(app) {
 					});
 				});
 
-                //计算总金额
-                $scope.calculateAmount($scope.selectedStoreCarts);
+				//计算总金额
+				$scope.calculateAmount($scope.selectedStoreCarts);
 
             }, function (res) {
-                toaster.pop('error', '系统错误', '购物车信息删除失败' + res.data);
+                toaster.pop('error', '系统错误', res.data);
             });
 
 
 		};
-        // 移入收藏
-        $scope.collect = function(uuid, id) {
+		// 移入收藏
+		$scope.collect = function(uuid, id) {
 			if(uuid){
                 ComponentActive.getSimpleInfoByUuid({uuid: uuid}, { }, function(data){
                     var obj = {'componentid': data.id, 'kind': 2};
@@ -930,7 +930,7 @@ define(["app/app", 'jquery-summernote'], function(app) {
                         $scope.collectDelete(id);
                         toaster.pop('success', '收藏成功');
                     }, function(response) {
-                        toaster.pop('error', '收藏失败');
+                        toaster.pop('error', response.data);
                     })
                 });
 			}else{
@@ -951,8 +951,8 @@ define(["app/app", 'jquery-summernote'], function(app) {
                         $scope.collectDelete();
                         toaster.pop('success', '收藏成功');
 					}
-				},function () {
-                    toaster.pop('error', '收藏失败');
+				},function (response) {
+                    toaster.pop('error', response.data);
                 })
 			}
 		}
@@ -1009,7 +1009,7 @@ define(["app/app", 'jquery-summernote'], function(app) {
                 toaster.pop('success', '成功删除');
                 $modalInstance.close()
             }, function (res) {
-                toaster.pop('error', '系统错误', '购物车信息删除失败' + res.data);
+                toaster.pop('error', '系统错误', res.data);
             });
         };
 
@@ -1018,13 +1018,13 @@ define(["app/app", 'jquery-summernote'], function(app) {
                 toaster.pop('success', '成功清除购物车内的无效产品');
                 $modalInstance.close()
             }, function (res) {
-                toaster.pop('error', '系统错误', '购物车信息删除失败' + res.data);
+                toaster.pop('error', '系统错误', res.data);
             });
         };
 
-        $scope.cancleDelete = function () {
-            $modalInstance.dismiss();
-        }
+		$scope.cancleDelete = function () {
+			$modalInstance.dismiss();
+		}
 
 	}]);
 

+ 2 - 2
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_home_ctrl.js

@@ -155,7 +155,7 @@ define(['app/app', 'calendar'], function(app) {
                 $scope.invoiceType = 1205;
                 $scope.selectInvoiceType(1205); // --1205专用增值税发票   --1206普通发票  --1207不开发票
             }, function(response) {
-                toaster.pop('error', '获取发票信息失败');
+                toaster.pop('error', '获取发票信息失败 ' + response.data);
             });
         };
 
@@ -336,7 +336,7 @@ define(['app/app', 'calendar'], function(app) {
                 toaster.pop('success', '成功 ', '保存收货地址成功');
                 $modalInstance.close(data);
             }, function(res){
-                toaster.pop('error', '系统错误 ', '保存收货地址失败');
+                toaster.pop('error', '保存收货地址失败', res.data);
             });
         };
 

+ 3 - 3
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_invoice_ctrl.js

@@ -22,8 +22,8 @@ define(['app/app'], function(app) {
                         $scope.isNormal = false;
                     }
                 })
-            }, function(error) {
-                toaster.pop('error', '获取发票信息失败');
+            }, function(response) {
+                toaster.pop('error', '获取发票信息失败 ' + response.data);
             });
         };
         getInvoiceInfo();
@@ -83,7 +83,7 @@ define(['app/app'], function(app) {
                 $scope.changeBillStatusFlag = false
                 $state.reload();
             }).error(function(data){
-                toaster.pop('error', message + '失败');
+                toaster.pop('error', message + '失败 ' + data);
             });
         }
 

+ 2 - 2
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_invoice_record_ctrl.js

@@ -56,8 +56,8 @@ define([ 'app/app' ], function(app) {
                         $defer.resolve(page.content);
                         //划分数据
                         $scope.billData = page.content;
-                    }, function () {
-                        toaster.pop('error', '获取开票记录失败');
+                    }, function (response) {
+                        toaster.pop('error', '获取开票记录失败 ', response.data);
                     });
                 }
             });

+ 3 - 3
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_logistics_ctrl.js

@@ -231,8 +231,8 @@ define(['app/app', 'calendar'], function(app) {
 				ShippingAddress.del({ addid : addressId }, {}, function () {
 					$scope.shippingAddressTableParams.page(1);
 					$scope.shippingAddressTableParams.reload();
-				}, function () {
-					toaster.pop('error', '删除收货地址失败');
+				}, function (res) {
+					toaster.pop('error', '删除收货地址失败 '+ res);
 				});
 			}
 		};
@@ -365,7 +365,7 @@ define(['app/app', 'calendar'], function(app) {
 				toaster.pop('success', '成功 ', '保存收货地址成功');
 				$modalInstance.close(data);
 			}, function(){
-				toaster.pop('error', '系统错误 ', '保存收货地址失败');
+				toaster.pop('error', '保存收货地址失败', res.data);
 			});
 		};
 

+ 23 - 24
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_no_invoice_ctrl.js

@@ -12,23 +12,28 @@ define([ 'app/app' ], function(app) {
                 }
             })
             if (applyItem.length > 0) {
-                if ($scope.invoices.length > 0) {
-                    $modal.open({
-                        templateUrl : $rootScope.rootPath + '/static/view/usercenter/modal/apply-invoice.html',
-                        size : 'lg',
-                        controller : 'NoInvoiceSubmitCtrl',
-                        resolve : {
-                            submitInvoice : function () {
-                                return applyItem;
-                            },
-                            invoiceData: function () {
-                                return $scope.invoices;
+                Bill.getListPersonal(null, function(data) {
+                    $scope.invoices = data;
+                    if ($scope.invoices.length > 0) {
+                        $modal.open({
+                            templateUrl : $rootScope.rootPath + '/static/view/usercenter/modal/apply-invoice.html',
+                            size : 'lg',
+                            controller : 'NoInvoiceSubmitCtrl',
+                            resolve : {
+                                submitInvoice : function () {
+                                    return applyItem;
+                                },
+                                invoiceData: function () {
+                                    return $scope.invoices;
+                                }
                             }
-                        }
-                    })
-                } else {
-                    toaster.pop('error','请前往开票信息页面新增发票');
-                }
+                        })
+                    } else {
+                        toaster.pop('error','请前往开票信息页面新增发票');
+                    }
+                }, function(response) {
+                    toaster.pop('error', '获取发票信息失败 ' + response.data);
+                });
             } else {
                 toaster.pop('error','请勾选未开票订单');
             }
@@ -42,12 +47,6 @@ define([ 'app/app' ], function(app) {
                 keyword : ''
             };
             $scope.keyword = '';
-
-            Bill.getListPersonal(null, function(data) {
-                $scope.invoices = data;
-            }, function(error) {
-                toaster.pop('error', '获取发票信息失败');
-            });
         }
         initDataRule();
 
@@ -77,8 +76,8 @@ define([ 'app/app' ], function(app) {
                         angular.forEach($scope.orderData, function (item) {
                             item.checked = false;
                         })
-                    }, function () {
-                        toaster.pop('error', '获取未开票订单信息失败');
+                    }, function (response) {
+                        toaster.pop('error', '获取未开票订单信息失败 ', response.data);
                     });
                 }
             });

+ 1 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/buyer_order_ctrl.js

@@ -201,7 +201,7 @@ define(['app/app'], function (app) {
 				});
 
 			}, function(response) {
-				toaster.pop('error', '获取订单失败,请重新刷新界面,' + response.data);
+				toaster.pop('error', '获取订单失败 ' + response.data);
 			});
 		};
 

+ 1 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/order_pay_ctrl.js

@@ -781,7 +781,7 @@ define(['app/app'], function(app) {
 					Bill.getBillById({id : $scope.order.invoiceid}, function(data) {
 						$scope.bill = data;
 					}, function(response) {
-						toaster.pop('info', '获取发票信息失败');
+                        toaster.pop('error', '获取发票信息失败 ' + response.data);
 					});
 				}
 				return ;

+ 4 - 3
src/main/webapp/resources/js/usercenter/controllers/forstore/pay_center_ctrl.js

@@ -115,8 +115,8 @@ define(['app/app'], function(app) {
 
 					params.total(page.totalElements);
 					$defer.resolve(page.content);
-				}, function() {
-					toaster.pop('error', '获取账户信息失败');
+				}, function(error) {
+					toaster.pop('error', '获取账户信息失败 '+ error.data);
 				});
 			}
 		});
@@ -253,7 +253,8 @@ define(['app/app'], function(app) {
 				toaster.pop('success', '设置成功');
 				loadAccountData();
 			}, function(response) {
-				toaster.pop('error', '设置默认账户失败');
+				// toaster.pop('error', '设置默认账户失败');
+                toaster.pop('error', response.data);
 			})
 		};
 

+ 1 - 1
src/main/webapp/resources/js/usercenter/controllers/forstore/shipping_address_edit_ctrl.js

@@ -247,7 +247,7 @@ define(['app/app'], function(app) {
 				toaster.pop('success', '成功 ', '保存收货地址成功');
 				$modalInstance.close(data);
 			}, function(res){
-				toaster.pop('error', '系统错误 ', '保存收货地址失败');
+				toaster.pop('error', '保存收货地址失败 ', res.data);
 			});
 		}
 

+ 2 - 2
src/main/webapp/resources/js/vendor/controllers/CheckSaveCtrl.js

@@ -342,8 +342,8 @@ define(['app/app'], function(app) {
 	    	ShippingAddress.save({isSetTop: $scope.isSetTop, send: true, isPersonal: false}, address, function(data){
 	    		toaster.pop('success', '成功 ', '保存发货地址成功');
 	    		$modalInstance.close(data);
-			}, function () {
-				toaster.pop('error', '系统错误 ', '保存发货地址失败');
+			}, function (res) {
+				toaster.pop('error', '保存发货地址失败 ', res.data);
 	    	});
 	    };
 	    

+ 1 - 1
src/main/webapp/resources/js/vendor/controllers/ShippedCtrl.js

@@ -275,7 +275,7 @@ define(['app/app'], function(app) {
 	    		toaster.pop('success', '成功 ', '保存收货地址成功');
 	    		$modalInstance.close(data);
 	    	}, function(res){
-	    		toaster.pop('error', '系统错误 ', '保存收货地址失败');
+	    		toaster.pop('error','保存收货地址失败 ', res.data);
 	    	});
 	    }
 	    

+ 1 - 1
src/main/webapp/resources/js/vendor/controllers/addressAdminCtrl.js

@@ -47,7 +47,7 @@ define(['app/app'], function(app) {
 					//重新加载购物数据
 					loadAddrs();
 				}, function(res){
-					toaster.pop('error', '系统错误', '删除收货地址失败');
+					toaster.pop('error', '系统错误', '删除收货地址失败 '+ res);
 				});
 			}
 		};

+ 1 - 1
src/main/webapp/resources/js/vendor/controllers/creditCardAdminCtrl.js

@@ -14,7 +14,7 @@ define(['app/app'], function(app) {
 					account.filterAccount = hideBankFilter(account.number);
 				})
 			}, function(response) {
-				toaster.pop('error', '获取账户信息失败');
+				toaster.pop('error', '获取账户信息失败 '+ response.data);
 			})
 		}
 		loadAccount();

+ 2 - 2
src/main/webapp/resources/js/vendor/controllers/exceptionProcessingCtrl.js

@@ -37,8 +37,8 @@ define(['app/app'], function (app) {
                     AfterSale.getApplyDetailList(BaseService.parseParams(pageParams), function (data) {
                         $defer.resolve(data.content);
                         params.total(data.totalElements);
-                    }, function (error) {
-                        toaster.pop('error', '获取信息失败');
+                    }, function (res) {
+                        toaster.pop('error', '获取信息失败 ', res.data);
                     })
                 }
             })

+ 112 - 91
src/main/webapp/resources/js/vendor/controllers/forstore/pay_center_ctrl.js

@@ -3,7 +3,7 @@
  */
 define(['app/app'], function(app) {
     'use strict';
-    app.register.controller('payCenterCtrl', ['$scope', '$rootScope', 'bankInfoService', 'toaster', '$upload', 'bankTransferService', 'Purchase', '$filter', 'Loading', 'ngTableParams', 'BaseService', 'SessionService', '$stateParams', function($scope, $rootScope, bankInfoService, toaster, $upload, bankTransferService, Purchase, $filter, Loading, ngTableParams, BaseService, SessionService, $stateParams) {
+    app.register.controller('payCenterCtrl', ['$scope', '$rootScope', 'bankInfoService', 'toaster', '$upload', 'bankTransferService', 'Purchase', '$filter', 'Loading', 'ngTableParams', 'BaseService', 'SessionService', '$stateParams', '$http', function($scope, $rootScope, bankInfoService, toaster, $upload, bankTransferService, Purchase, $filter, Loading, ngTableParams, BaseService, SessionService, $stateParams, $http) {
         $rootScope.active = 'pay_center';
 
         document.title = '结算中心-优软商城';
@@ -22,95 +22,108 @@ define(['app/app'], function(app) {
         $scope.paytype = 'ALL';
         $scope.$$transfer = {};
 
-        $scope.tradeRecordTableParams = new ngTableParams({
-            page : 1,
-            count : 30,
-            sorting : {
-                transferTime : 'DESC'
-            }
-        },{
-            total : 0,
-            getData : function ($defer, params) {
-                var param = BaseService.parseParams(params.url());
-                if ($scope.keyword && $scope.keyword.length > 0){
-                    param.keyword = $scope.keyword;
+        var getTradeRecordInfo = function () {
+            $scope.tradeRecordTableParams = new ngTableParams({
+                page : 1,
+                count : 30,
+                sorting : {
+                    transferTime : 'DESC'
                 }
-                if ($scope.startDate){
-                    param.fromDate = $scope.startDate.getTime();
-                }
-                if ($scope.endDate){
-                    param.toDate = $scope.endDate.getTime();
-                }
-                bankTransferService.getVendorBankTransferByMall(param, function (page) {
-                    if(page.code == 1) {
-                        $scope.bankTransRecore = page.data.data.content;
-                        if ($scope.bankTransRecore.length > 0){
-                            $scope.currencySymbol = $scope.bankTransRecore[0].currencyName;
+            },{
+                total : 0,
+                getData : function ($defer, params) {
+                    var param = BaseService.parseParams(params.url());
+                    if ($scope.keyword && $scope.keyword.length > 0){
+                        param.keyword = $scope.keyword;
+                    }
+                    if ($scope.startDate){
+                        param.fromDate = $scope.startDate.getTime();
+                    }
+                    if ($scope.endDate){
+                        param.toDate = $scope.endDate.getTime();
+                    }
+                    bankTransferService.getVendorBankTransferByMall(param, function (page) {
+                        if(page.code == 1) {
+                            $scope.bankTransRecore = page.data.data.content;
+                            if ($scope.bankTransRecore.length > 0){
+                                $scope.currencySymbol = $scope.bankTransRecore[0].currencyName;
+                            }
+                            var pageObject = page.data.data;
+                            $scope.totalPrice = page.data.total;
+                            angular.forEach($scope.bankTransRecode, function (bankT) {
+                                bankT.jsonReceive = angular.fromJson(bankT.jsonReceive);
+                            });
+                            $scope.totalPages = pageObject.totalPages;
+                            $scope.param.currentPage = pageObject.number;
+                            $scope.totalElements = pageObject.totalElements;
+
+                            if(Number($scope.totalElements) > 0) {
+                                $scope.$$transfer.start = Number(pageObject.size) * (Number(pageObject.number) - 1) + 1;
+                            }else {
+                                $scope.$$transfer.start = 0;
+                            }
+                            $scope.$$transfer.end = Number(pageObject.size) * (Number(pageObject.number) - 1) + Number(pageObject.numberOfElements);
+                            //计算页数
+                            $scope.acculatePages(pageObject.number, pageObject.totalPages);
+                        }else {
+                            toaster.pop('info', '获取信息失败:' + page.message);
                         }
-                        var pageObject = page.data.data;
-                        $scope.totalPrice = page.data.total;
-                        angular.forEach($scope.bankTransRecode, function (bankT) {
-                            bankT.jsonReceive = angular.fromJson(bankT.jsonReceive);
-                        });
-                        $scope.totalPages = pageObject.totalPages;
-                        $scope.param.currentPage = pageObject.number;
-                        $scope.totalElements = pageObject.totalElements;
+                    }, function (res) {
+                        toaster.pop('error', '获取信息失败 ', res.data);
+                    });
+                }
+            });
+        }
 
-                        if(Number($scope.totalElements) > 0) {
-                            $scope.$$transfer.start = Number(pageObject.size) * (Number(pageObject.number) - 1) + 1;
+        var getBankInfo = function () {
+            $scope.bankInfoTableParams = new ngTableParams({
+                page : 1,
+                count : 10,
+                sorting : {
+                    num : 'ASC'
+                }
+            },{
+                total : 0,
+                getData : function ($defer, params) {
+                    var param = BaseService.parseParams(params.url());
+                    bankInfoService.getSaleEeterpriseBank(param, {}, function(page) {
+                        $scope.accounts = page.content;
+
+                        $scope.$$bankInfo.totalElements = page.totalElements;
+                        if(Number(page.totalElements) > 0) {
+                            $scope.$$bankInfo.start = Number(page.size) * (Number(page.number) - 1) + 1;
                         }else {
-                            $scope.$$transfer.start = 0;
+                            $scope.$$bankInfo.start = 0;
                         }
-                        $scope.$$transfer.end = Number(pageObject.size) * (Number(pageObject.number) - 1) + Number(pageObject.numberOfElements);
-                        //计算页数
-                        $scope.acculatePages(pageObject.number, pageObject.totalPages);
-                    }else {
-                        toaster.pop('info', '获取信息失败:' + page.message);
-                    }
-                }, function () {
-                    toaster.pop('error', '获取信息失败');
-                });
-            }
-        });
+                        $scope.$$bankInfo.end = Number(page.size) * (Number(page.number) - 1) + Number(page.numberOfElements);
 
-        $scope.bankInfoTableParams = new ngTableParams({
-            page : 1,
-            count : 10,
-            sorting : {
-                num : 'ASC'
-            }
-        },{
-            total : 0,
-            getData : function ($defer, params) {
-                var param = BaseService.parseParams(params.url());
-                bankInfoService.getSaleEeterpriseBank(param, {}, function(page) {
-                    $scope.accounts = page.content;
-
-                    $scope.$$bankInfo.totalElements = page.totalElements;
-                    if(Number(page.totalElements) > 0) {
-                        $scope.$$bankInfo.start = Number(page.size) * (Number(page.number) - 1) + 1;
-                    }else {
-                        $scope.$$bankInfo.start = 0;
-                    }
-                    $scope.$$bankInfo.end = Number(page.size) * (Number(page.number) - 1) + Number(page.numberOfElements);
-
-                    params.total(page.totalElements);
-                    $defer.resolve(page.content);
-                }, function() {
-                    toaster.pop('error', '获取账户信息失败');
-                });
-            }
-        });
+                        params.total(page.totalElements);
+                        $defer.resolve(page.content);
+                    }, function(response) {
+                        toaster.pop('error', '获取账户信息失败 ', response.data);
+                    });
+                }
+            });
+        }
 
         var loadAccountData = function() {
-            $scope.bankInfoTableParams.page(1);
-            $scope.bankInfoTableParams.reload();
+            if ($scope.bankInfoTableParams) {
+                $scope.bankInfoTableParams.page(1);
+                $scope.bankInfoTableParams.reload();
+            } else {
+                getBankInfo();
+            }
         };
 
         var loadHistory = function () {
-            $scope.tradeRecordTableParams.page(1);
-            $scope.tradeRecordTableParams.reload();
+            if ($scope.tradeRecordTableParams) {
+                $scope.tradeRecordTableParams.page(1);
+                $scope.tradeRecordTableParams.reload();
+            } else {
+                getTradeRecordInfo();
+            }
         };
+        loadHistory();
 
         var clearRecordParams = function () {
             $scope.keyword = null;
@@ -138,7 +151,7 @@ define(['app/app'], function(app) {
                     break;
                 case 'accountTab':
                     clearRecordParams();
-                    // loadAccountData();
+                    loadAccountData();
                     break;
             }
         };
@@ -594,18 +607,26 @@ define(['app/app'], function(app) {
                 var str = strArray.join("&");
                 url = url + "?" + str;
             }
-            var form = $("<form>");   //定义一个form表单
-            form.attr('style', 'display:none');   //在form表单中添加查询参数
-            form.attr('target', '');
-            form.attr('method', 'POST');
-            form.attr('action', url);
-
-            $('body').append(form);  //将表单放置在web中
-            form.submit();
-
-            $scope.$$transfer.clockID = setInterval(function() {
-                getDownLoadStatus();
-            }, 500);
+            $http({
+                method: 'post',
+                dataType: 'json',
+                url: url
+            }).success(function (data) {
+                var form = $("<form>");   //定义一个form表单
+                form.attr('style', 'display:none');   //在form表单中添加查询参数
+                form.attr('target', '');
+                form.attr('method', 'POST');
+                form.attr('action', url);
+
+                $('body').append(form);  //将表单放置在web中
+                form.submit();
+
+                $scope.$$transfer.clockID = setInterval(function() {
+                    getDownLoadStatus();
+                }, 500);
+            }).error(function (response) {
+                toaster.pop('error', response);
+            });
         };
 
         var getDownLoadStatus = function () {

+ 25 - 2
src/main/webapp/resources/js/vendor/controllers/forstore/seek_purchase_ctrl.js

@@ -18,6 +18,9 @@ define(['app/app'], function (app) {
           }
           $scope.initInquiryItem();
 
+            //卖家待报价推送信息,self为与我相关,all为全部
+            $scope.vendorType = 'self';
+
           // 获取当前卖家求购推送列表
           $scope.seekPurchaseTableParams = new ngTableParams({
             pageNumber: 1,
@@ -28,7 +31,6 @@ define(['app/app'], function (app) {
               const param = BaseService.parseParams(params.url());
               // param.deadline = $scope.deadline;
               // param.status = $scope.status;
-              param.enUU = $scope.userInfo.enterprise.uu;
               param.keyword = $scope.keyWord;
               param.fromDate = $scope.startDate
                   ? $scope.startDate.getTime() : null;
@@ -41,10 +43,19 @@ define(['app/app'], function (app) {
                 params.page(1);
                 $scope.isSearch = false;
               }
+              var isSelf = $scope.vendorType == 'self';
+              if (!isSelf) {
+                param.enUU = $scope.userInfo.enterprise.uu;
+                param.userUU = $scope.userInfo.userUU;
+              } else {
+                param.enuu = $scope.userInfo.enterprise.uu;
+                param.useruu = $scope.userInfo.userUU;
+              }
+              var target = isSelf ? '/inquiry/sale/remind' : '/inquiry/public';
               $http({
                 method: 'get',
                 dataType: 'json',
-                url: seekUrl + '/inquiry/public',
+                url: seekUrl + target,
                 params: param
               }).success(function (data) {
                 params.total(data.totalElements);
@@ -56,6 +67,15 @@ define(['app/app'], function (app) {
             }
           });
 
+            // 更换待报价状态
+            $scope.onVendorTypeChange = function () {
+              $scope.keyword = '';
+              $scope.startDate = null;
+              $scope.endDate = null;
+              $scope.seekPurchaseTableParams.page(1);
+              $scope.seekPurchaseTableParams.reload();
+            }
+
           // 搜索
           $scope.onSearch = function () {
             $scope.isSearch = true;
@@ -176,6 +196,9 @@ define(['app/app'], function (app) {
               if (!$scope.inquiryItem.currency) {
                 $scope.inquiryItem.currency = $scope.seekCurrency[0];
               }
+              if ($scope.vendorType == 'self') {
+                  $scope.inquiryItem.id = $scope.inquiryItem.itemId;
+              }
               if (seekUrl == 'https://api-inquiry.usoftmall.com') {
                 seekPurchase.saveOfferProd($scope.inquiryItem, function (data) {
                   toaster.pop('success', '报价成功');

+ 2 - 2
src/main/webapp/resources/js/vendor/controllers/forstore/show_rate_ctrl.js

@@ -66,8 +66,8 @@ define(['app/app'], function(app) {
                             init();
                         });
                     });
-                }, function () {
-                    toaster.pop('error', '获取信息失败');
+                }, function (res) {
+                    toaster.pop('error', '获取信息失败 ', res.data);
                 });
             }
         });

+ 884 - 240
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_account_management_ctrl.js

@@ -2,14 +2,20 @@
  * Created by yujia on 2017/3/24.
  *  原厂认证
  */
-define(['app/app'], function(app) {
+define(['app/app'], function (app) {
     "use strict";
-    app.register.controller('vendorAccountManagementCtrl', ['$scope', '$rootScope', 'Enterprise', 'User', 'toaster', '$modal','BaseService','ngTableParams','$http', 'AuthenticationService','$stateParams', function($scope, $rootScope, Enterprise, User, toaster, $modal, BaseService, ngTableParams, $http, AuthenticationService,$stateParams) {
+    app.register.controller('vendorAccountManagementCtrl', ['$scope', '$rootScope', 'Enterprise', 'User', 'toaster', '$modal', 'BaseService', 'ngTableParams', '$http', 'AuthenticationService', '$stateParams','AccountResource','AccountRole', function ($scope, $rootScope, Enterprise, User, toaster, $modal, BaseService, ngTableParams, $http, AuthenticationService, $stateParams, AccountResource, AccountRole) {
         $rootScope.active = 'vendor_account_management';
-		document.title = '账户管理-优软商城';
-		$scope.tab = 'base';
+        document.title = '账户管理-优软商城';
+        $scope.tab = 'base';
+        $scope.addingUser = false;
+        $scope.setAddingUser = function (status) {
+            $scope.addingUser = status;
+            $scope.adding = false;
+        };
         $scope.userInfo = $rootScope.userInfo;
 		$scope.updateState = false;
+        $scope.filterRole = 'all';
         $scope.searchParams = {
             keyword: ''
         };
@@ -151,183 +157,260 @@ define(['app/app'], function(app) {
 			})
 		}
 
-          $scope.tableParams = new ngTableParams({
-            page: 1, // show first page
-            count: 10 // count per page
-          }, {
-            total: 0,
-            getData: function ($defer, params) {
-              var param = BaseService.parseParams(params.url());
-              param.enuu = $scope.userInfo.enterprise.uu;
-              if (!$scope.searchMthod) {
-                Enterprise.getAllUsersByEnuu(param, function (page) {
-                  if (page) {
-                    params.total(page.totalElements);
-                    $defer.resolve(page.content);
-                    $scope.users = page.content;
-                  }
-                });
-              }
-              else {
-                param.keyword = $scope.keyword;
-                Enterprise.findUsersByKeyword(param, function (page) {
-                  if (page) {
-                    params.total(page.totalElements);
-                    $defer.resolve(page.content);
-                    $scope.users = page.content;
-                  }
-                })
-              }
+        $scope.pageParam = {};
+        $scope.tableParams = new ngTableParams({
+            page : 1, // show first page
+            count : 10 // count per page
+        }, {
+            total : 0,
+            getData : function($defer, params) {
+                var param = BaseService.parseParams(params.url());
+                param.enuu = $scope.userInfo.enterprise.uu;
+                if(!$scope.searchMthod) {
+                    Enterprise.getAllUsersByEnuu(param, function (page) {
+                        if (page) {
+                            $scope.pageParam.start = (page.number-1)*page.size+1;
+                            $scope.pageParam.end = $scope.pageParam.start + page.numberOfElements - 1;
+                            $scope.pageParam.all = page.totalElements;
+                            params.total(page.totalElements);
+                            $defer.resolve(page.content);
+                            $scope.users = page.content;
+                            $scope.reloadUserCheck(false);
+                        }
+                    },function (error) {
+                        toaster.pop('error', '获取企业人员信息失败',error.data);
+                    });
+                }
+                else {
+                    param.keyword = $scope.keyword;
+                    if (filterRolejs !== 1){
+                        param.roleId = filterRolejs;
+                    }
+                    Enterprise.findUsersByKeyword(param,function (page) {
+                        if (page) {
+                            $scope.pageParam.start = (page.number-1)*page.size+1;
+                            $scope.pageParam.end = $scope.pageParam.start + page.numberOfElements - 1;
+                            $scope.pageParam.all = page.totalElements;
+                            params.total(page.totalElements);
+                            $defer.resolve(page.content);
+                            $scope.users = page.content;
+                            $scope.reloadUserCheck(false);
+                        }
+                    },function (error) {
+                        toaster.pop('error', '获取企业人员信息失败',error.data);
+                    })
+                }
             }
-          });
+        });
 
-          $scope.onSearch = function (keyword) {
-            if (keyword != null && keyword != '') {
-              $scope.searchMthod = true;
-              $scope.keyword = keyword;
+        var filterRolejs = 1;
+        $scope.onSearch = function (keyword,filterRole) {
+            filterRolejs = 1;
+            if ((keyword != null && keyword != '') || filterRole !== 'all') {
+                if (filterRole === 'all'){
+                    filterRolejs = 1;
+                }else {
+                    filterRolejs = filterRole;
+                }
+                $scope.searchMthod = true;
+                $scope.keyword = keyword;
             } else {
-              $scope.searchMthod = false;
+                $scope.searchMthod = false;
             }
             $scope.tableParams.page(1);
             $scope.tableParams.reload();
-          };
+        };
+        $scope.onKeyUpSearch = function (keyword, filterRole, event) {
+            if (event && event.keyCode == 13) {
+                $scope.onSearch(keyword, filterRole);
+            }
+        }
 
-          $scope.newUser = {};
+        $scope.newUser = {};
 
-          //弹出添加用户模态框
-          $scope.addExistUser = function () {
+        //弹出添加用户模态框
+        $scope.addExistUser = function () {
+            $scope.adding = false;
+            $scope.setAddingUser(false);
+            $scope.newUser = {};
             var modalInstance = $modal.open({
-              animation: true,
-              templateUrl: $rootScope.rootPath
-              + '/static/view/vendor/forstore/addExistUser.html',
-              controller: 'AddExistUserCtrl'
+                animation: true,
+                templateUrl: $rootScope.rootPath + '/static/view/vendor/forstore/addExistUser.html',
+                controller: 'AddExistUserCtrl'
             });
 
             modalInstance.result.then(function () {
-              $scope.userTelSuccess = false;
-              $scope.userTelError = false;
-              $scope.tableParams.page(1);
-              $scope.tableParams.reload();
+                $scope.userTelSuccess = false;
+                $scope.userTelError = false;
+                $scope.tableParams.page(1);
+                $scope.tableParams.reload();
             }, function () {
 
             });
 
-          };
-          /**
-           * 添加未注册用户
-           */
-          $scope.addUser = function () {
+        };
+        /**
+         * 添加未注册用户
+         */
+        $scope.addUser = function () {
+            if (!$scope.userEmailSuccess || !$scope.userTelSuccess) {
+                toaster.pop('error', '请输入正确的信息后提交');
+                return;
+            }
             $scope.adding = true;
             $scope.loading = true;
             Enterprise.saveUser({}, $scope.newUser, function () {
-              $scope.loading = false;
-              toaster.pop('success', '提示', '增加用户成功:' + $scope.newUser.userName);
-              $scope.newUser = {userSex: 'M'};
-              $scope.tableParams.page(1);
-              $scope.tableParams.reload();
-              $scope.adding = false;
-              $scope.newUserForm.newUserTel.$setValidity('available', false);
-              $scope.newUserForm.newUserEmail.$setValidity('available', false);
-              $scope.userTelSuccess = false;
-              $scope.userTelError = false;
-              $scope.userEmailSuccess = false;
-              $scope.userEmailError = false;
+                $scope.loading = false;
+                toaster.pop('success', '提示', '增加用户成功:' + $scope.newUser.userName);
+                $scope.setAddingUser(false);
+                $scope.newUser = {userSex: 'M'};
+                $scope.tableParams.page(1);
+                $scope.tableParams.reload();
+                $scope.adding = false;
+                // $scope.newUserForm.newUserTel.$setValidity('available', false);
+                // $scope.newUserForm.newUserEmail.$setValidity('available', false);
+                $scope.userTelSuccess = false;
+                $scope.userTelError = false;
+                $scope.userEmailSuccess = false;
+                $scope.userEmailError = false;
             }, function (response) {
-              $scope.loading = false;
-              toaster.pop('error', '错误', response.data);
+                $scope.loading = false;
+                toaster.pop('error', '错误', response.data);
             });
-          };
-
-          /**
-           * 删除用户
-           */
-          $scope.removeUser = function (user) {
+        };
 
-            if (confirm('确定删除用户(' + user.userName + ')吗?')) {
-              Enterprise.removeUser({uu: user.userUU}, function () {
+        $scope.adding = false;
+        $scope.setAdding = function (status) {
+            $scope.adding = status;
+        }
+        /**
+         * 删除用户
+         */
+        $scope.removeUser = function (user) {
+
+            // if (confirm('确定删除用户(' + user.userName + ')吗?')) {
+            // }
+            Enterprise.removeUser({uu: user.userUU}, function () {
                 toaster.pop('success', '提示', '用户删除成功。');
                 $scope.tableParams.page(1);
                 $scope.tableParams.reload();
-              }, function (response) {
+                $scope.showDelUserFlag = false;
+            }, function (response) {
                 toaster.pop('error', '删除失败', response.data);
-              });
+            });
+        };
+        //用户删除确认框
+        $scope.showDelUserFlag = false;
+
+        $scope.setShowDelUserFlag = function (flag, user) {
+            $scope.showDelUserFlag = flag;
+            if (flag) {
+                $scope.delUser = user;
             }
-          };
-          /**
-           * 验证手机号是否可用
-           */
-          $scope.telValid = function (tel) {
-            if (tel) {
-              $http.get('basic/user/telEnable', {
-                params: {
-                  tel: tel
-                }
-              }).success(function (data) {
-                data = eval(data);
-                if (data == true) {
-                  $scope.newUserForm.newUserTel.$setValidity('available', true);
-                  $scope.userTelSuccess = true;
-                  $scope.userTelError = false;
-                } else {
-                  $scope.newUserForm.newUserTel.$setValidity('available',
-                      false);
-                  $scope.userTelError = true;
-                  $scope.userTelSuccess = false;
-                  if (tel.length == 11) {
-                    toaster.pop('error', '错误', '手机号 ' + tel + ' 已被注册');
-                  }
+        }
+        /***
+         * 全选
+         * */
+        $scope.isCheckAll = false;
+        $scope.doCheckAll = function () {
+            $scope.isCheckAll = !$scope.isCheckAll;
+            if ($scope.isCheckAll) {
+                $scope.reloadUserCheck(true);
+            } else {
+                $scope.reloadUserCheck(false);
+            }
+        }
+
+        $scope.checkUser = function (user) {
+            user.checked = !user.checked;
+            var allcheck = true
+            angular.forEach($scope.users, function (item) {
+                if (!item.checked) {
+                    allcheck = false;
                 }
-              }).error(function () {
-                $scope.userTelSuccess = false;
-                $scope.userTelError = true;
-              });
+            });
+            $scope.isCheckAll = allcheck;
+        }
+
+        $scope.reloadUserCheck = function (flag) {
+            angular.forEach($scope.users, function (item) {
+                item.checked = flag;
+            });
+        }
+        /**
+         * 验证手机号是否可用
+         */
+        $scope.telValid = function (tel) {
+            if (tel) {
+                $http.get('basic/user/telEnable', {
+                    params: {
+                        tel: tel
+                    }
+                }).success(function (data) {
+                    data = eval(data);
+                    if (data == true) {
+                        // $scope.newUserForm.newUserTel.$setValidity('available', true);
+                        $scope.userTelSuccess = true;
+                        $scope.userTelError = false;
+                    } else {
+                        // $scope.newUserForm.newUserTel.$setValidity('available', false);
+                        $scope.userTelError = true;
+                        $scope.userTelSuccess = false;
+                        if (tel.length == 11)
+                            toaster.pop('error', '错误', '手机号 ' + tel + ' 已被注册');
+                    }
+                }).error(function () {
+                    $scope.userTelSuccess = false;
+                    $scope.userTelError = true;
+                });
             } else {
-              $scope.userTelSuccess = false;
-              $scope.userTelError = false;
+                $scope.userTelSuccess = false;
+                $scope.userTelError = false;
             }
           };
 
-          /**
-           * 验证邮箱是否可用
-           */
-          $scope.emailValid = function (email) {
+        /**
+         * 验证邮箱是否可用
+         */
+        $scope.emailValid = function (email) {
             if (email) {
-              $http.get('basic/user/emailEnable', {
-                params: {
-                  email: email
-                }
-              }).success(function (data) {
-                data = eval(data);
-                if (data == true) {
-                  $scope.newUserForm.newUserEmail.$setValidity('available',
-                      true);
-                  $scope.userEmailSuccess = true;
-                  $scope.userEmailError = false;
-                } else {
-                  $scope.newUserForm.newUserEmail.$setValidity('available',
-                      false);
-                  $scope.userEmailError = true;
-                  $scope.userEmailSuccess = false;
-                }
-              }).error(function () {
-                $scope.userEmailError = true;
-                $scope.userEmailSuccess = false;
-              });
+                $http.get('basic/user/emailEnable', {
+                    params: {
+                        email: email
+                    }
+                }).success(function (data) {
+                    data = eval(data);
+                    if (data == true) {
+                        // $scope.newUserForm.newUserEmail.$setValidity('available',
+                        //     true);
+                        $scope.userEmailSuccess = true;
+                        $scope.userEmailError = false;
+                    } else {
+                        // $scope.newUserForm.newUserEmail.$setValidity('available',
+                        //     false);
+                        $scope.userEmailError = true;
+                        $scope.userEmailSuccess = false;
+                        toaster.pop('error', '错误', '邮箱 ' + email + ' 已被注册');
+                    }
+                }).error(function () {
+                    $scope.userEmailError = true;
+                    $scope.userEmailSuccess = false;
+                });
             } else {
-              $scope.userEmailError = false;
-              $scope.userEmailSuccess = false;
+                $scope.userEmailError = false;
+                $scope.userEmailSuccess = false;
             }
-          };
+        };
 
-          /**
-           * 变更到更新状态
-           */
-          $scope.changeToUpdate = function (isUpdate) {
+        /**
+         * 变更到更新状态
+         */
+        $scope.changeToUpdate = function (isUpdate) {
             $scope.updateState = isUpdate;
             if ($scope.updateState == false) {
-              $scope.enterpriseInfo = angular.copy($scope.enterpriseInfoBackup);
+                $scope.enterpriseInfo = angular.copy($scope.enterpriseInfoBackup);
             }
-          };
+        };
 
           /**
            * 验证企业信息
@@ -337,20 +420,20 @@ define(['app/app'], function(app) {
 
             var flag = true;
             angular.forEach(props, function (prop) {
-              if ($scope.enterpriseInfo.hasOwnProperty(prop)) {
-                if (!$scope.enterpriseInfo[prop] || $scope.enterpriseInfo[prop]
-                    === '') {
-                  console.log(prop + '不能为空');
-                  // TODO 记录验证信息
-                  flag = false;
+                if ($scope.enterpriseInfo.hasOwnProperty(prop)) {
+                    if (!$scope.enterpriseInfo[prop] || $scope.enterpriseInfo[prop]
+                        === '') {
+                        console.log(prop + '不能为空');
+                        // TODO 记录验证信息
+                        flag = false;
+                    }
+                } else {
+                    console.log(prop + '不能为空');
+                    flag = false;
                 }
-              } else {
-                console.log(prop + '不能为空');
-                flag = false;
-              }
             });
             return flag;
-          }
+        }
 
           // 获取行业信息
         $http.get('static/data/profession.json').success(function (data) {
@@ -437,24 +520,24 @@ define(['app/app'], function(app) {
             // 先检查信息是否为空
             if (angular.equals($scope.enterpriseInfo,
                     $scope.enterpriseInfoBackup)) {
-              toaster.pop('error', '未做任何修改');
-              $scope.updateState = false;
-              return;
+                toaster.pop('error', '未做任何修改');
+                $scope.updateState = false;
+                return;
             }
             var enterpriseInfoFlag = validateEnterpriseInfo();
             if (!enterpriseInfoFlag) {
-              toaster.pop('error', '请补充完信息后再次提交');
-              return;
+                toaster.pop('error', '请补充完信息后再次提交');
+                return;
             }
 
             Enterprise.updateEnterpriseInfo(
                 {enuu: $scope.userInfo.enterprise.uu}, $scope.enterpriseInfo,
                 function () {
-                  $scope.loading = false;
-                  toaster.pop('success', '提示', '企业信息修改成功');
-                  $scope.enterpriseInfoBackup = angular.copy(
-                      $scope.enterpriseInfo);
-                  $scope.updateState = false;
+                    $scope.loading = false;
+                    toaster.pop('success', '提示', '企业信息修改成功');
+                    $scope.enterpriseInfoBackup = angular.copy(
+                        $scope.enterpriseInfo);
+                    $scope.updateState = false;
 
                 }, function (response) {
                   $scope.loading = false;
@@ -471,8 +554,22 @@ define(['app/app'], function(app) {
         // 切换tab
         $scope.checkTab = function (t) {
             $scope.tab = t;
+            if (t === 'role' && $scope.rolesExcept) {
+                toaster.pop('error', '获取企业角色信息失败',$scope.rolesExcept);
+            }
+            // if (t === 'auth') {
+            //     $scope.keyword = '';
+            //     $scope.onSearch($scope.keyword,'all');
+            // }
           };
 
+          /* 查询接口权限 */
+        // AccountRole.findAuthority({resUrl: encodeURIComponent('/account/role'), method: 'GET'}, function (data) {
+        //
+        // }, function (error) {
+        //
+        // })
+
           $scope.updatePassword = function () {
               AuthenticationService.redirectPassword();
           };
@@ -524,81 +621,163 @@ define(['app/app'], function(app) {
                 $scope.updateUserEmail();
                 break;
             }
-          }
-        }]);
-
-  /*
-   * 绑定用户到企业
-   */
-  app.register.controller('AddExistUserCtrl',
-      ['$scope', '$modalInstance', 'Enterprise', 'AuthenticationService',
-        '$timeout', 'toaster',
-        function ($scope, $modalInstance, Enterprise, AuthenticationService,
-            $timeout, toaster) {
-          $scope.searching = false;
-          //根据输入的内容查找用户
-          $scope.searchUser = function (keyWord) {
-            $scope.searching = true;
-            $scope.searchSuccess = false;
-            $scope.searchFailed = false;
-            $scope.illegalError = false;
-            $scope.reBindError = false;
-            $scope.okDisabled = false;
-            Enterprise.searchUser({keyWord: keyWord}, function (data) {
-              $scope.searchSuccess = true;
-              $scope.searchFailed = false;
-              $scope.user = data;		//查询到的用户
-            }, function (response) {
-              $scope.searchSuccess = false;
-              $scope.searchFailed = true;
+        }
+        //角色控制
+        $scope.roles = {};
+        AccountResource.query({}, function (data) {
+            if (data && data.length > 0) {
+                data[0].$open = true;
+            }
+            $scope.resources = data;
+        });
+        var getData = function () {
+            AccountRole.findAll({}, function (data) {
+                var defaults = [], custom = [];
+                angular.forEach(data, function (d) {
+                    if (d.isdefault == 1)
+                        defaults.push(d);
+                    else
+                        custom.push(d);
+                });
+                $scope.roles = {defaults: defaults, custom: custom};
+            },function (error) {
+                $scope.rolesExcept = error.data;
             });
-          };
+            AccountRole.getByExistRoleAndEnuu({}, function (data) {
+                var defaults = [], custom = [];
+                angular.forEach(data, function (d) {
+                    if (d.isdefault == 1)
+                        defaults.push(d);
+                    else
+                        custom.push(d);
+                });
+                $scope.existRoles = {defaults: defaults, custom: custom};
+            });
+        };
+        getData();
+        $scope.editRole = function (role) {
+            var modalInstance = $modal.open({
+                animation: true,
+                templateUrl: $rootScope.rootPath + '/static/view/vendor/modal/role_detail.html',
+                controller: 'RoleEditCtrl',
+                resolve: {
+                    role: function () {
+                        return role;
+                    }
+                }
+            });
+            modalInstance.result.then(function (added) {
+                added && getData();
+            });
+        };
 
-          //确认绑定
-          $scope.ok = function (keyWord) {
-            AuthenticationService.getAuthentication().success(function (data) {
-              $scope.currentUser = data;	//当前登录的用户(管理员)
-              //不可自己绑定自己
-              if ($scope.currentUser.userUU == $scope.user.userUU) {
-                $scope.illegalError = true;
-                $scope.okDisabled = true;
-                return false;
-              }
+        $scope.editUserRole = function (user) {
+            var modalInstance = $modal.open({
+                animation: true,
+                templateUrl: $rootScope.rootPath + '/static/view/vendor/modal/edit_user_role.html',
+                controller: 'UserRoleEditCtrl',
+                resolve: {
+                    user: function () {
+                        return user;
+                    }
+                }
+            });
+        };
 
-              //用户未绑定到任何企业时
-              if (!$scope.user.enterprises) {
-                //正常绑定
-                Enterprise.bindUserToMyEnterprise({userUU: $scope.user.userUU},
-                    function (data) {
-                      $scope.okDisabled = true;
-                      toaster.pop("success", "提示", "用户绑定成功");
-                      $modalInstance.close(true);
+        $scope.inSelect = false;
+        $scope.setInSelect = function (status) {
+            $scope.inSelect = status;
+        }
+        $(document).on("click", function () {
+            $scope.$apply(function () {
+                if (!$scope.inSelect) {
+                    $scope.setAdding(false);
+                }
+            })
+        })
+    }]);
+
+
+    /*
+     * 绑定用户到企业
+     */
+    app.register.controller('AddExistUserCtrl',
+        ['$scope', '$modalInstance', 'Enterprise', 'AuthenticationService',
+            '$timeout', 'toaster',
+            function ($scope, $modalInstance, Enterprise, AuthenticationService,
+                      $timeout, toaster) {
+                $scope.searching = false;
+                //根据输入的内容查找用户
+                $scope.searchUser = function (keyWord) {
+                    $scope.searching = true;
+                    $scope.searchSuccess = false;
+                    $scope.searchFailed = false;
+                    $scope.illegalError = false;
+                    $scope.reBindError = false;
+                    $scope.okDisabled = false;
+                    Enterprise.searchUser({keyWord: keyWord}, function (data) {
+                        $scope.searchSuccess = true;
+                        $scope.searchFailed = false;
+                        $scope.user = data;		//查询到的用户
                     }, function (response) {
+                        $scope.searchSuccess = false;
+                        $scope.searchFailed = true;
                     });
-                return true;
-              }
+                };
 
-              //用户已绑定到某些企业时
-              for (var i = 0; i < $scope.currentUser.enterprises.length; i++) {
-                if ($scope.currentUser.enterprises[i].current) {
-                  for (var j = 0; j < $scope.user.enterprises.length; j++) {
-                    //该用户已绑定到当前企业,不可重复绑定
-                    if ($scope.currentUser.enterprises[i].uu
-                        == $scope.user.enterprises[j].uu) {
-                      $scope.reBindError = true;
-                      $scope.okDisabled = true;
-                      return false;
+                $scope.onKeyDown = function (e, key) {
+                    var keycode = window.event ? e.keyCode : e.which;
+                    if (keycode == 13) {
+                        $scope.searchUser(key);
                     }
-                  }
-                  //该用户未绑定到当前企业,可以进行绑定
-                  Enterprise.bindUserToMyEnterprise(
-                      {userUU: $scope.user.userUU}, function (data) {
-                        $scope.okDisabled = true;
-                        toaster.pop("success", "提示", "用户绑定成功");
-                        $modalInstance.close(true);
-                      }, function (response) {
-                        console.log("绑定失败!");
-                      });
+                }
+
+                //确认绑定
+                $scope.ok = function (keyWord) {
+                    AuthenticationService.getAuthentication().success(function (data) {
+                        $scope.currentUser = data;	//当前登录的用户(管理员)
+                        //不可自己绑定自己
+                        if ($scope.currentUser.userUU == $scope.user.userUU) {
+                            $scope.illegalError = true;
+                            $scope.okDisabled = true;
+                            return false;
+                        }
+
+                        //用户未绑定到任何企业时
+                        if (!$scope.user.enterprises) {
+                            //正常绑定
+                            Enterprise.bindUserToMyEnterprise({userUU: $scope.user.userUU},
+                                function (data) {
+                                    $scope.okDisabled = true;
+                                    toaster.pop("success", "提示", "用户绑定成功");
+                                    $modalInstance.close(true);
+                                }, function (response) {
+                                    toaster.pop('error', response.data);
+                                });
+                            return true;
+                        }
+
+                        //用户已绑定到某些企业时
+                        for (var i = 0; i < $scope.currentUser.enterprises.length; i++) {
+                            if ($scope.currentUser.enterprises[i].current) {
+                                for (var j = 0; j < $scope.user.enterprises.length; j++) {
+                                    //该用户已绑定到当前企业,不可重复绑定
+                                    if ($scope.currentUser.enterprises[i].uu
+                                        == $scope.user.enterprises[j].uu) {
+                                        $scope.reBindError = true;
+                                        $scope.okDisabled = true;
+                                        return false;
+                                    }
+                                }
+                                //该用户未绑定到当前企业,可以进行绑定
+                                Enterprise.bindUserToMyEnterprise(
+                                    {userUU: $scope.user.userUU}, function (data) {
+                                        $scope.okDisabled = true;
+                                        toaster.pop("success", "提示", "用户绑定成功");
+                                        $modalInstance.close(true);
+                                    }, function (response) {
+                                        toaster.pop('error', response.data);
+                                    });
 
                 }
               }
@@ -1638,16 +1817,481 @@ define(['app/app'], function(app) {
               $scope.checkFailed = false;
               window.location.href = "vendor#/account/management/sec";
 
-              window.location.reload();
-              $modalInstance.close();
-            }, function(response){
-              toaster.pop('error', '错误', response.data);
-              $modalInstance.close();
+                        window.location.reload();
+                        $modalInstance.close();
+                    }, function (response) {
+                        toaster.pop('error', '错误', response.data);
+                        $modalInstance.close();
+                    });
+                };
+
+                $scope.cancel = function () {
+                    $modalInstance.close();
+                };
+            }]);
+//角色管理-编辑角色controller
+    app.register.controller('RoleEditCtrl', ['$scope', '$modalInstance', '$timeout', 'AccountResource', 'AccountRole', 'toaster', 'role', 'BaseService', function ($scope, $modalInstance, $timeout, AccountResource, AccountRole, toaster, role, BaseService) {
+        BaseService.scrollBackToTop();
+        $scope.role = angular.copy(role || {});
+        $scope.master = angular.copy($scope.role);
+        var isNew = role == null;
+        $scope.cancel = function () {
+            $modalInstance.close(false);
+        };
+
+        var getCheckRoleResource = function (data, rs) {
+            if (data.items.length > 0) {
+                var c = 0;
+                angular.forEach(data.items, function (item) {
+                    if (rs.indexOf(item.id) > -1) {
+                        item.$checked = true;
+                        c += 1;
+                    }
+                });
+                data.$checked = c > 0 && c == data.items.length;
+                data.$halfChecked = c > 0 && c < data.items.length;
+            } else {
+                angular.forEach(data.children, function (item) {
+                    getCheckRoleResource(item, rs);
+                    var activeCount = 0;
+                    angular.forEach(data.children, function (item) {
+                        if (!item.$checked) {
+                            activeCount ++;
+                        }
+                    });
+                    data.$checked = activeCount > 0 && activeCount == data.children.length;
+
+                    data.$halfChecked = activeCount > 0 && activeCount < data.children.length;
+                });
+            }
+        }
+
+        AccountResource.query({}, function (data) {
+            if (data && data.length > 0) {
+                var rs = [];// 已分配的资源的id
+                if (role && role.resourceItems) {
+                    angular.forEach(role.resourceItems, function (item) {
+                        rs.push(item.id);
+                    });
+                }
+                angular.forEach(data, function (data2) {
+                    getCheckRoleResource(data2, rs);
+                })
+                $scope.resourceItems = data[0].items;
+                data[0].$active = true;
+            }
+            $scope.resources = data;
+            // if ($scope.role) {
+            // 	angular.forEach($scope.role.resourceItems,function (item) {
+            // 		angular.forEach($scope.resources, function (roleItem) {
+            // 			if (item.id == roleItem.id) {
+            // 				roleItem.$active = true;
+            // 			}
+            // 		})
+            // 	})
+            // }
+            $timeout(function () {
+                angular.forEach($scope.resources, function (resource) {
+                    var c = 0;
+                    angular.forEach(resource.items, function (item) {
+                        item.$checked && (c += 1);
+                    });
+                    angular.element(document.getElementById('check_' + resource.id)).prop('indeterminate', (c > 0 && !resource.$checked));
+                });
+            }, 100);
+            getChecked();
+        });
+
+        $scope.onItemClick = function (resource) {
+            if (resource.items.length > 0) {
+                $scope.resourceItems = resource.items;
+                $scope.activeResource = resource
+            } else {
+                $scope.resourceItems = [];
+                if (!resource.activeLevel) {
+                    resource.activeLevel = true;
+                } else {
+                    resource.activeLevel = false;
+                }
+            }
+            setNoActive($scope.resources);
+            resource.$active = true;
+        };
+        var setNoActive = function (obj) {
+            angular.forEach(obj, function (r) {
+                r.$active = false;
+                if (r.children) {
+                    setNoActive(r.children);
+                }
             });
-          };
+        }
 
-          $scope.cancel = function () {
+        var getChecked = function () {
+            var items = [];
+            angular.forEach($scope.resources, function (resource) {
+                pushCheckedResource(resource, items);
+            });
+            if ($scope.role) {
+                $scope.role.resourceItems = items;
+            }
+        };
+        var pushCheckedResource = function (resource, items) {
+            if (resource.items.length > 0) {
+                var activeCount = 0;
+                angular.forEach(resource.items, function (item) {
+                    // item.$checked && items.push(item);
+                    if (item.$checked) {
+                        items.push(item);
+                        activeCount ++;
+                    }
+                });
+                resource.$checked = activeCount > 0 && activeCount == resource.items.length;
+                resource.$halfChecked = activeCount > 0 && activeCount < resource.items.length;
+
+            } else {
+                var halfCount = 0;
+                var fullCount = 0;
+                angular.forEach(resource.children, function (item) {
+                    if (item.$checked) {
+                        fullCount ++;
+                    } else if (item.$halfChecked) {
+                        halfCount ++;
+                    }
+                    pushCheckedResource(item, items);
+                })
+                resource.$halfChecked = halfCount > 0 || (fullCount > 0 && fullCount < resource.children.length);
+                resource.$checked = fullCount > 0 && fullCount == resource.children.length;
+            }
+        }
+        $scope.onResourceChange = function (resource) {
+            levelResourceChecked(resource);
+            getChecked();
+        };
+        var levelResourceChecked = function (resource) {
+            if (resource.items.length > 0) {
+                angular.forEach(resource.items, function (item) {
+                    item.$checked = resource.$checked;
+                });
+            } else {
+                angular.forEach(resource.children, function (item) {
+                    item.$checked = resource.$checked;
+                    levelResourceChecked(item);
+                });
+            }
+
+        }
+
+        $scope.onItemChange = function () {
+            var activeCount = 0;
+            var resourceItems = $scope.resourceItems;
+            // console.log(resourceItems);
+            angular.forEach(resourceItems, function (item) {
+                if (item.$checked) {
+                    activeCount++;
+                }
+            })
+            // console.log(activeCount);
+            // console.log( $scope.activeResource)
+            $scope.activeResource.$checked = activeCount == resourceItems.length;
+
+            $scope.activeResource.$halfChecked = activeCount > 0 && activeCount < resourceItems.length;
+
+            angular.forEach($scope.resources, function (resource) {
+                if (resource.$active) {
+                    var c = 0;
+                    angular.forEach(resource.items, function (item) {
+                        item.$checked && (c += 1);
+                    });
+                    resource.$checked = (c == resource.items.length);
+                    resource.$halfChecked = c > 0 && c < resource.items.length;
+                    angular.element(document.getElementById('check_' + resource.id)).prop('indeterminate', (c > 0 && !resource.$checked));
+                }
+            });
+            getChecked();
+        };
+        $scope.isChanged = function (formData) {
+            if (!$scope.master)
+                return true;
+            return !angular.equals(formData, $scope.master);
+        };
+        $scope.save = function () {
+            $scope.master = angular.copy($scope.role);
+            if (!$scope.master.color || $scope.master.color == '') {
+                $scope.master.color = parseInt(Math.random() * 5) + 1 + '';
+            }
+            AccountRole.save($scope.master, function () {
+                toaster.pop('success', '提示', '角色:' + $scope.role.desc + ' 资料' + (isNew ? '添加' : '修改') + '成功');
+                $modalInstance.close(true);
+            }, function (response) {
+                toaster.pop('error', '错误', response.data);
+            });
+        };
+        $scope.del = function () {
+            if (confirm('确定删除角色(' + $scope.role.desc + ')吗?')) {
+                AccountRole.remove({id: role.id}, function () {
+                    toaster.pop('success', '提示', '角色:' + $scope.role.desc + ' 删除成功');
+                    $modalInstance.close(true);
+                }, function (response) {
+                    toaster.pop('error', '错误', response.data);
+                });
+            }
+        };
+    }]);
+
+    app.register.controller('UserRoleEditCtrl', ['$scope', '$modalInstance', '$timeout', 'AccountResource', 'toaster', 'user', 'BaseService', 'AccountRole', 'User', function ($scope, $modalInstance, $timeout, AccountResource, toaster, user, BaseService, AccountRole, User) {
+
+        $scope.pages = [];
+
+        $scope.params = {
+            page: 1,
+            count: 6,
+            totalPage: 1,
+            currentPage: 1
+        };
+
+        var loadCurrentRoles = function () {
+            var start = ($scope.params.page - 1) * $scope.params.count;
+            var end = $scope.params.page * $scope.params.count;
+            $scope.currentRoles = $scope.rolesData.slice(start, end);
+        };
+
+        var init = function () {
+            $scope.user = angular.copy(user);
+            AccountRole.query({}, function (data) {
+                $scope.rolesData = data;
+                loadCurrentRoles();
+                $scope.params.totalPage = Math.ceil($scope.rolesData.length / 6);
+                $scope.acculatePages(1, $scope.params.totalPage);
+                angular.forEach($scope.rolesData, function (item) {
+                    item.checked = false;
+                    angular.forEach($scope.user.roles, function (userItem) {
+                        if (item.id === userItem.id) {
+                            item.checked = true;
+                        }
+                    });
+                });
+            });
+        }
+        init();
+
+        $scope.checked = [];
+        //勾选角色
+        $scope.checkRole = function (role) {
+            role.checked = !role.checked;
+        }
+
+        //关闭模态框
+        $scope.cancelModal = function () {
             $modalInstance.close();
-          };
-        }]);
+        }
+        $scope.close = function (save) {
+            if (save) {
+                if (user.userUU) {
+                    angular.forEach($scope.rolesData, function (item) {
+                        if (item.checked) {
+                            $scope.checked.push(item);
+                        }
+                    });
+                    $scope.user.roles = $scope.checked;
+                    User.update({}, $scope.user, function () {
+                        toaster.pop('success', '提示', '保存成功');
+                        user.roles = $scope.checked
+                        $modalInstance.close(true);
+                    }, function (response) {
+                        toaster.pop('error', '保存失败', response.data);
+                    });
+                } else {
+                    $modalInstance.close(true, $scope.checked);
+                }
+            } else {
+                $modalInstance.close(false);
+            }
+        };
+
+        // //初始化分页数据
+        // var initPages = function () {
+        // 	$scope.totalPages = Math.ceil = ($scope.rolesData.length/6);
+        // }
+        //初始化页数信息
+        $scope.initPages = function (totalElementPages) {
+            var pageNum = [];
+            if (totalElementPages == 1) {
+                return;
+            } else if (totalElementPages < 10) {
+                for (var i = 0; i < totalElementPages + 2; i++) {
+                    pageNum.push(i);
+                }
+            } else {
+                pageNum = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+            }
+            angular.forEach(pageNum, function (number) {
+                var page = {active: true, type: 'page', number: number};
+                if (number == 0) {
+                    page.type = 'prev';
+                } else if (number == 1) {
+                    page.type = 'first';
+                } else if (number == pageNum.length - 2) {
+                    page.type = 'last';
+                    page.number = totalElementPages;
+                } else if (number == pageNum.length - 1) {
+                    page.type = 'next';
+                }
+                $scope.pages.push(page);
+            });
+        };
+
+        //当前页在后端计算方式
+        $scope.endSegment = function (currentPage, totalElementPages) {
+            if (totalElementPages > 8) {
+                angular.forEach($scope.pages, function (page) {
+                    switch (page.number) {
+                        case 2:
+                            page.active = false;
+                            page.type = 'more';
+                            break;
+                        case 10:
+                            if (currentPage == totalElementPages) {
+                                page.active = false;
+                            }
+                            break;
+                        case 0:
+                        case 1:
+                            break;
+                        default:
+                            if (page.number != totalElementPages) {
+                                page.number = totalElementPages - 9 + page.number;
+                            }
+                            page.current = (currentPage == page.number);
+                            break;
+                    }
+                });
+            }
+        };
+
+        //当前页在中间计算方式
+        $scope.middleSegment = function (currentPage) {
+            angular.forEach($scope.pages, function (page) {
+                switch (page.number) {
+                    case 2:
+                    case 8:
+                        page.type = 'more';
+                        page.active = false;
+                        break;
+                    case 3:
+                        page.number = currentPage - 2;
+                        break;
+                    case 4:
+                        page.number = currentPage - 1;
+                        break;
+                    case 5:
+                        page.number = currentPage;
+                        page.current = true;
+                        break;
+                    case 6:
+                        page.number = currentPage + 1;
+                        break;
+                    case 7:
+                        page.number = currentPage + 2;
+                        break;
+                }
+            });
+        };
+
+        //当前页在前段的计算方式
+        $scope.frontSegment = function (currentPage, totalElementPages) {
+            if (totalElementPages > 8) {
+                angular.forEach($scope.pages, function (page) {
+                    switch (page.number) {
+                        case 8:
+                            page.type = 'more';
+                            page.active = false;
+                            break;
+                        case 0:
+                            if (currentPage == 1) {
+                                page.active = false;
+                            }
+                        default : {
+                            page.current = (currentPage == page.number);
+                        }
+                    }
+                });
+            }
+        };
+
+        //输入框监听Enter事件
+        $scope.listenEnter = function () {
+            if (event.keyCode == 13) {
+                $scope.setPage("page", $scope.params.currentPage);
+            }
+        };
+        $scope.setPage = function (type, number) {
+            if (type != 'prev' && type != 'page' && type != 'next' && type != 'last' && type != 'first') {
+                return;
+            }
+            ;
+            var page = -1;
+            switch (type) {
+                case "page":
+                    if (number < 1) {
+                        page = 1;
+                    } else if (number > $scope.params.totalPage) {
+                        page = $scope.params.totalPage;
+                    } else {
+                        page = number;
+                    }
+                    ;
+                    break;
+                case "prev":
+                    if ($scope.params.page <= 1) {
+                        page = 1;
+                    } else {
+                        page = $scope.params.page - 1;
+                    }
+                    ;
+                    break;
+                case "next":
+                    if ($scope.params.page >= $scope.params.totalPage) {
+                        page = $scope.params.totalPage;
+                    } else {
+                        page = $scope.params.page + 1;
+                    }
+                    break;
+                case "first":
+                    page = 1;
+                    break;
+                case "last":
+                    page = $scope.params.totalPage;
+                    break;
+            }
+            if (page == $scope.params.page || page < 1 || page > $scope.params.totalPage) {
+                $scope.params.currentPage = $scope.params.page;
+                return;
+            }
+            $scope.params.page = page;
+            $scope.params.currentPage = page;
+            loadData();
+        };
+
+        //计算页数的方式。
+        $scope.acculatePages = function (currentPage, totalElementPages) {
+            $scope.pages = [];
+            if (totalElementPages < 1) {
+                return;
+            }
+            //初始化页面数据
+            $scope.initPages(totalElementPages);
+            if (currentPage < 6) {//当期页小于6
+                $scope.frontSegment(currentPage, totalElementPages);
+            } else if (currentPage > totalElementPages - 5) { //当期页在后面
+                $scope.endSegment(currentPage, totalElementPages);
+            } else { //当期页在中间
+                $scope.middleSegment(currentPage);
+            }
+        };
+
+        var loadData = function () {
+            loadCurrentRoles();
+            $scope.acculatePages($scope.params.page, $scope.params.totalPage);
+        };
+    }]);
 });

+ 3 - 3
src/main/webapp/resources/js/vendor/controllers/forstore/vendor_brand_apply_list_ctrl.js

@@ -3,7 +3,7 @@
  */
 define(['app/app'], function(app) {
     "use strict";
-    app.register.controller('vendorBrandApplyListCtrl', ['$scope', '$rootScope', 'AuthenticationService', 'BaseService', 'BrandsSubmit', 'ngTableParams', function ($scope, $rootScope, AuthenticationService, BaseService, BrandsSubmit, ngTableParams) {
+    app.register.controller('vendorBrandApplyListCtrl', ['$scope', '$rootScope', 'AuthenticationService', 'BaseService', 'BrandsSubmit', 'ngTableParams', 'toaster', function ($scope, $rootScope, AuthenticationService, BaseService, BrandsSubmit, ngTableParams, toaster) {
         document.title = "品牌申请" + "-优软商城";
         $rootScope.active = 'vendor_brand_apply';
         var loadMyBrandsSubmit = function(){
@@ -27,8 +27,8 @@ define(['app/app'], function(app) {
                             params.total(page.totalElements);
                             $defer.resolve(page.content);
                         }
-                    }, function(){
-
+                    }, function(err){
+                        toaster.pop('error', err.data);
                     });
                 }
             });

Some files were not shown because too many files changed in this diff