wangxiaoming %!s(int64=7) %!d(string=hai) anos
pai
achega
a232ae9450

+ 61 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/Postage.java

@@ -10,6 +10,8 @@ public class Postage implements Serializable {
     private static final long serialVersionUID = -4278004816117383308L;
 
     private Integer postageId;
+    //销售公司
+    private Integer companyId;
     //客服人员id
     private Integer adminId;
     //客诉id
@@ -51,6 +53,17 @@ public class Postage implements Serializable {
     //销售来源名称
     private String storeName;
 
+    //销售公司集合
+    private  Integer[] companyIds;
+
+    private Integer customerConfirm;    //确认   1有权限
+
+    private Integer customerManager;    //经理审核权限   1有权限
+
+    private Integer financeManager;    //财务审核权限   1有权限
+
+    private Integer financePay;    //财务转账         1有权限
+
     public Integer getPostageId() {
         return postageId;
     }
@@ -218,4 +231,52 @@ public class Postage implements Serializable {
     public void setCustomerId(Integer customerId) {
         this.customerId = customerId;
     }
+
+    public Integer getCompanyId() {
+        return companyId;
+    }
+
+    public void setCompanyId(Integer companyId) {
+        this.companyId = companyId;
+    }
+
+    public Integer[] getCompanyIds() {
+        return companyIds;
+    }
+
+    public void setCompanyIds(Integer[] companyIds) {
+        this.companyIds = companyIds;
+    }
+
+    public Integer getCustomerManager() {
+        return customerManager;
+    }
+
+    public void setCustomerManager(Integer customerManager) {
+        this.customerManager = customerManager;
+    }
+
+    public Integer getFinanceManager() {
+        return financeManager;
+    }
+
+    public void setFinanceManager(Integer financeManager) {
+        this.financeManager = financeManager;
+    }
+
+    public Integer getFinancePay() {
+        return financePay;
+    }
+
+    public void setFinancePay(Integer financePay) {
+        this.financePay = financePay;
+    }
+
+    public Integer getCustomerConfirm() {
+        return customerConfirm;
+    }
+
+    public void setCustomerConfirm(Integer customerConfirm) {
+        this.customerConfirm = customerConfirm;
+    }
 }

+ 80 - 29
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/PostageAuthority.java

@@ -1,55 +1,106 @@
 package com.iamberry.rst.core.cm;
 
-import java.util.Date;
+import  java.util.Date;
+import  java.io.Serializable;
 
-public class PostageAuthority {
-    private Integer postageAuthorityId;
-    //管理员id
+/**
+ *  邮费权限流程控制表类
+ * @author
+ * @Date 2018-04-09
+ */
+public class PostageAuthority  implements  Serializable{
+
+    private static final long serialVersionUID = 2784518115996494444L;
+
+    //主键
+    private Integer authorityId;
+    //销售公司
+    private Integer companyId;
+    //客服经理
+    private Integer authorityCustomerManager;
+    //财务经理
+    private Integer authorityFinancialManager;
+    //财务打款
+    private Integer authorityFinancialPayment;
+    //状态:1:使用中 2:未使用
+    private Integer authorityStatus;
+    //创建时间
+    private Date authorityCreateTime;
+    //修改时间
+    private Date authorityUpdateTime;
+
+    //登录id
     private Integer adminId;
-    //权限 1:客服人员   2:客服经理 3:财务
-    private Integer postageAuthorityGrade;
-    //状态 1:使用中  2:未使用
-    private Integer postageAuthorityStatus;
 
-    private Date postageAuthorityCreateTime;
+    public Integer getAuthorityId(){
+        return authorityId;
+    }
 
-    public Integer getPostageAuthorityId() {
-        return postageAuthorityId;
+    public void setAuthorityId(Integer  authorityId){
+        this.authorityId=authorityId;
     }
 
-    public void setPostageAuthorityId(Integer postageAuthorityId) {
-        this.postageAuthorityId = postageAuthorityId;
+    public Integer getCompanyId() {
+        return companyId;
     }
 
-    public Integer getAdminId() {
-        return adminId;
+    public void setCompanyId(Integer companyId) {
+        this.companyId = companyId;
     }
 
-    public void setAdminId(Integer adminId) {
-        this.adminId = adminId;
+    public Integer getAuthorityCustomerManager(){
+        return authorityCustomerManager;
+    }
+
+    public void setAuthorityCustomerManager(Integer  authorityCustomerManager){
+        this.authorityCustomerManager=authorityCustomerManager;
+    }
+
+    public Integer getAuthorityFinancialManager(){
+        return authorityFinancialManager;
+    }
+
+    public void setAuthorityFinancialManager(Integer  authorityFinancialManager){
+        this.authorityFinancialManager=authorityFinancialManager;
+    }
+
+    public Integer getAuthorityFinancialPayment(){
+        return authorityFinancialPayment;
+    }
+
+    public void setAuthorityFinancialPayment(Integer  authorityFinancialPayment){
+        this.authorityFinancialPayment=authorityFinancialPayment;
+    }
+
+    public Integer getAuthorityStatus(){
+        return authorityStatus;
     }
 
-    public Integer getPostageAuthorityGrade() {
-        return postageAuthorityGrade;
+    public void setAuthorityStatus(Integer  authorityStatus){
+        this.authorityStatus=authorityStatus;
     }
 
-    public void setPostageAuthorityGrade(Integer postageAuthorityGrade) {
-        this.postageAuthorityGrade = postageAuthorityGrade;
+    public Date getAuthorityCreateTime(){
+        return authorityCreateTime;
     }
 
-    public Integer getPostageAuthorityStatus() {
-        return postageAuthorityStatus;
+    public void setAuthorityCreateTime(Date  authorityCreateTime){
+        this.authorityCreateTime=authorityCreateTime;
     }
 
-    public void setPostageAuthorityStatus(Integer postageAuthorityStatus) {
-        this.postageAuthorityStatus = postageAuthorityStatus;
+    public Date getAuthorityUpdateTime(){
+        return authorityUpdateTime;
     }
 
-    public Date getPostageAuthorityCreateTime() {
-        return postageAuthorityCreateTime;
+    public void setAuthorityUpdateTime(Date  authorityUpdateTime){
+        this.authorityUpdateTime=authorityUpdateTime;
     }
 
-    public void setPostageAuthorityCreateTime(Date postageAuthorityCreateTime) {
-        this.postageAuthorityCreateTime = postageAuthorityCreateTime;
+    public Integer getAdminId() {
+        return adminId;
+    }
+
+    public void setAdminId(Integer adminId) {
+        this.adminId = adminId;
     }
 }

+ 51 - 0
watero-rst-interface/src/main/java/com/iamberry/rst/faces/cm/PostageAuthorityService.java

@@ -0,0 +1,51 @@
+package com.iamberry.rst.faces.cm;
+
+import com.iamberry.rst.core.cm.PostageAuthority;
+
+import java.util.List;
+
+/**
+ *  邮费权限流程控制表接口
+ * @author -
+ * @Date 2018-04-09
+ */
+public interface PostageAuthorityService {
+    /**
+     * 获取集合
+     * @param  postageAuthority
+     * @return List
+     */
+    List<PostageAuthority> getPostageAuthorityList(PostageAuthority  postageAuthority);
+
+    /**
+     * 获取集合
+     * @param  adminId
+     * @return List
+     */
+    List<PostageAuthority> getPostageAuthorityListByAdminId(Integer adminId);
+
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  postageAuthority
+     */
+    PostageAuthority  getPostageAuthorityById(Integer  id);
+    /**
+     * 增加数据
+     * @param  postageAuthority
+     * @return Integer
+     */
+    Integer  save(PostageAuthority  postageAuthority);
+    /**
+     * 修改数据
+     * @param  postageAuthority
+     * @return Integer
+     */
+    Integer  update(PostageAuthority  postageAuthority);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+}

+ 71 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/PostageAuthorityServiceImpl.java

@@ -0,0 +1,71 @@
+package com.iamberry.rst.service.cm;
+
+import com.iamberry.rst.core.cm.PostageAuthority;
+import com.iamberry.rst.faces.cm.PostageAuthorityService;
+import com.iamberry.rst.service.cm.mapper.PostageAuthorityMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ *  邮费权限流程控制表接口
+ * @author -
+ * @Date 2018-04-09
+ */
+@Service
+public class PostageAuthorityServiceImpl  implements PostageAuthorityService {
+    @Autowired
+    private PostageAuthorityMapper postageAuthorityMapper;
+    /**
+     * 获取集合
+     * @param  postageAuthority
+     * @return List
+     */
+    @Override
+    public List<PostageAuthority> getPostageAuthorityList(PostageAuthority  postageAuthority){
+        return  postageAuthorityMapper.getPostageAuthorityList(postageAuthority);
+    }
+
+    @Override
+    public List<PostageAuthority> getPostageAuthorityListByAdminId(Integer adminId) {
+        return  postageAuthorityMapper.getPostageAuthorityListByAdminId(adminId);
+    }
+
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  postageAuthority
+     */
+    @Override
+    public  PostageAuthority  getPostageAuthorityById(Integer  id){
+        return  postageAuthorityMapper.getPostageAuthorityById(id);
+    }
+    /**
+     * 增加数据
+     * @param  postageAuthority
+     * @return Integer
+     */
+    @Override
+    public  Integer  save(PostageAuthority  postageAuthority){
+        return  postageAuthorityMapper.save(postageAuthority);
+    }
+    /**
+     * 修改数据
+     * @param  postageAuthority
+     * @return Integer
+     */
+    @Override
+    public  Integer  update(PostageAuthority  postageAuthority){
+        return  postageAuthorityMapper.update(postageAuthority);
+    }
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    @Override
+    public  Integer  delete(Integer  id){
+        return  postageAuthorityMapper.delete(id);
+    }
+}

+ 51 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/PostageAuthorityMapper.java

@@ -0,0 +1,51 @@
+package com.iamberry.rst.service.cm.mapper;
+
+import com.iamberry.rst.core.cm.PostageAuthority;
+
+import java.util.List;
+
+/**
+ *  邮费权限流程控制表接口
+ * @author -
+ * @Date 2018-04-09
+ */
+public interface PostageAuthorityMapper {
+    /**
+     * 获取集合
+     * @param  postageAuthority
+     * @return List
+     */
+    List<PostageAuthority> getPostageAuthorityList(PostageAuthority  postageAuthority);
+
+    /**
+     * 获取集合
+     * @param  adminId
+     * @return List
+     */
+    List<PostageAuthority> getPostageAuthorityListByAdminId(Integer adminId);
+
+    /**
+     * 查询单条数据
+     * @param  id
+     * @return  postageAuthority
+     */
+    PostageAuthority  getPostageAuthorityById(Integer  id);
+    /**
+     * 增加数据
+     * @param  postageAuthority
+     * @return Integer
+     */
+    Integer  save(PostageAuthority  postageAuthority);
+    /**
+     * 修改数据
+     * @param  postageAuthority
+     * @return Integer
+     */
+    Integer  update(PostageAuthority  postageAuthority);
+    /**
+     * 删除数据
+     * @param  id
+     * @return Integer
+     */
+    Integer  delete(Integer  id);
+}

+ 123 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/postageAuthorityMapper.xml

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.iamberry.rst.service.cm.mapper.PostageAuthorityMapper">
+    <resultMap  id="BaseResultMap" type="PostageAuthority" >
+        <result    column="authority_id"    property="authorityId" />
+        <result    column="company_id"    property="companyId" />
+        <result    column="authority_customer_manager"    property="authorityCustomerManager" />
+        <result    column="authority_financial_manager"    property="authorityFinancialManager" />
+        <result    column="authority_financial_payment"    property="authorityFinancialPayment" />
+        <result    column="authority_status"    property="authorityStatus" />
+        <result    column="authority_create_time"    property="authorityCreateTime" />
+        <result    column="authority_update_time"    property="authorityUpdateTime" />
+    </resultMap>
+    <sql    id="Base_List" >
+        t.authority_id,
+        t.company_id,
+        t.authority_customer_manager,
+        t.authority_financial_manager,
+        t.authority_financial_payment,
+        t.authority_status,
+        t.authority_create_time,
+        t.authority_update_time
+    </sql>
+    <select id="getPostageAuthorityList" resultMap="BaseResultMap" parameterType="PostageAuthority" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_postage_authority t
+        <where>
+            <if test="authorityId != null ">
+                AND t.authority_id = #{authorityId}
+            </if >
+            <if test="companyId != null ">
+                AND t.company_id = #{companyId}
+            </if >
+            <if test="authorityCustomerManager != null ">
+                AND t.authority_customer_manager = #{authorityCustomerManager}
+            </if >
+            <if test="authorityFinancialManager != null ">
+                AND t.authority_financial_manager = #{authorityFinancialManager}
+            </if >
+            <if test="authorityFinancialPayment != null ">
+                AND t.authority_financial_payment = #{authorityFinancialPayment}
+            </if >
+            <if test="authorityStatus != null ">
+                AND t.authority_status = #{authorityStatus}
+            </if >
+        </where>
+    </select>
+
+    <select id="getPostageAuthorityListByAdminId" resultMap="BaseResultMap" parameterType="Integer" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_postage_authority t
+        WHERE
+          (
+            t.authority_customer_manager = #{adminId}
+            OR
+            t.authority_financial_manager = #{adminId}
+            OR
+            t.authority_financial_payment = #{adminId}
+          )
+            AND t.authority_status = 1
+    </select>
+
+
+    <select id="getPostageAuthorityById" resultMap="BaseResultMap" parameterType="Integer" >
+        select
+        <include refid="Base_List" />
+        from tb_rst_postage_authority t
+        where t.authority_id= #{authorityId}
+    </select>
+    <insert id="save" parameterType="PostageAuthority" >
+        insert into
+        tb_rst_postage_authority
+        (
+        authority_id,
+        company_id,
+        authority_customer_manager,
+        authority_financial_manager,
+        authority_financial_payment,
+        authority_status
+        )
+        values
+        (
+        #{authorityId},
+        #{companyId},
+        #{authorityCustomerManager},
+        #{authorityFinancialManager},
+        #{authorityFinancialPayment},
+        #{authorityStatus}
+        )
+    </insert>
+    <update id="update" parameterType="PostageAuthority" >
+        update
+        tb_rst_postage_authority
+        <set >
+            <if test="authorityId != null ">
+                authority_id = #{authorityId},
+            </if >
+            <if test="companyId != null ">
+                company_id = #{companyId},
+            </if >
+            <if test="authorityCustomerManager != null ">
+                authority_customer_manager = #{authorityCustomerManager},
+            </if >
+            <if test="authorityFinancialManager != null ">
+                authority_financial_manager = #{authorityFinancialManager},
+            </if >
+            <if test="authorityFinancialPayment != null ">
+                authority_financial_payment = #{authorityFinancialPayment},
+            </if >
+            <if test="authorityStatus != null ">
+                authority_status = #{authorityStatus},
+            </if >
+        </set >
+        where authority_id= #{authorityId}
+    </update>
+    <delete id="delete" parameterType="Integer" >
+        delete
+            tb_rst_postage_authority
+        where authority_id=#{authorityId}
+    </delete>
+</mapper>

+ 12 - 3
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/postageMapper.xml

@@ -23,7 +23,7 @@
   </resultMap>
 
   <sql id="Base_Column_List" >
-    p.postage_id, p.admin_id, p.customer_id,  p.postage_customer_status, p.postage_manager_status, p.postage_finance_status,
+    p.postage_id, p.admin_id, p.customer_id, p.company_id,  p.postage_customer_status, p.postage_manager_status, p.postage_finance_status,
     p.postage_order_source, p.postage_treatment_method, p.sales_orderId, p.postage_client_name,
     p.postage_client_tel,p.postage_client_address, p.postage_logistics_company, p.postage_logistics_no, p.postage_amount,
     p.postage_alipay, p.postage_alipay_name, p.postage_create_time, p.postage_update_time
@@ -83,6 +83,12 @@
       <if test="postageAlipayName != null and postageAlipayName != ''">
         AND p.postage_alipay_name like CONCAT('%',#{postageAlipayName},'%')
       </if>
+      <if test="companyIds != null and companyIds != ''">
+        AND p.company_id IN
+          <foreach collection="companyIds" item="item" index="index" separator="," open="(" close=")">
+            #{item}
+          </foreach >
+      </if>
     </where>
     ORDER BY postage_id DESC
   </select>
@@ -99,7 +105,7 @@
   </select>
 
     <insert id="savePostage" parameterType="Postage" >
-    insert into tb_rst_postage (postage_id, admin_id, customer_id, postage_customer_status,
+    insert into tb_rst_postage (postage_id, admin_id, customer_id, company_id, postage_customer_status,
     postage_manager_status, postage_finance_status,
     postage_order_source, postage_treatment_method,
     sales_orderId, postage_client_name, postage_client_tel,
@@ -107,7 +113,7 @@
     postage_logistics_company, postage_logistics_no,
     postage_amount, postage_alipay, postage_alipay_name
     )
-    values (#{postageId,jdbcType=INTEGER}, #{adminId,jdbcType=INTEGER}, #{customerId,jdbcType=INTEGER}, #{postageCustomerStatus,jdbcType=INTEGER},
+    values (#{postageId,jdbcType=INTEGER}, #{adminId,jdbcType=INTEGER}, #{customerId,jdbcType=INTEGER},#{companyId,jdbcType=INTEGER}, #{postageCustomerStatus,jdbcType=INTEGER},
     #{postageManagerStatus,jdbcType=INTEGER}, #{postageFinanceStatus,jdbcType=INTEGER},
     #{postageOrderSource,jdbcType=INTEGER}, #{postageTreatmentMethod,jdbcType=INTEGER},
     #{salesOrderId,jdbcType=VARCHAR}, #{postageClientName,jdbcType=VARCHAR}, #{postageClientTel,jdbcType=VARCHAR},
@@ -123,6 +129,9 @@
       <if test="adminId != null" >
         admin_id = #{adminId,jdbcType=INTEGER},
       </if>
+      <if test="companyId != null" >
+        company_id = #{companyId,jdbcType=INTEGER},
+      </if>
       <if test="customerId != null" >
         customer_id = #{customerId,jdbcType=INTEGER},
       </if>

+ 5 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminCustomerController.java

@@ -1774,6 +1774,10 @@ public class AdminCustomerController {
             return new ResponseJson(500, "请填写邮费信息", 500);
         }
 
+        if(customerInfo.getCompanyId() == null || customerInfo.getCompanyId() == 0 ){
+            return new ResponseJson(500, "未正确选择销售公司", 500);
+        }
+
         Postage age = new Postage();
         age.setCustomerId(customerInfo.getCustomerId());    //客诉id
         List<Postage> postageList = postageService.listPostage(age);
@@ -1783,6 +1787,7 @@ public class AdminCustomerController {
 
         Integer flag = 0;
         Postage postage = new Postage();
+        postage.setCompanyId(customerInfo.getCompanyId());      //销售公司
         postage.setAdminId(customerInfo.getAdminId());      //客服
         postage.setCustomerId(customerInfo.getCustomerId());        //客诉id
         postage.setPostageCustomerStatus(2);            //------考虑手动点, 直接变为申请中

+ 150 - 125
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminPostageController.java

@@ -1,12 +1,10 @@
 package com.iamberry.rst.controllers.cm;
 
-import com.iamberry.rst.core.cm.ComplaintTypeInfo;
-import com.iamberry.rst.core.cm.CustomerInfo;
-import com.iamberry.rst.core.cm.Postage;
-import com.iamberry.rst.core.cm.QuestionDescribe;
+import com.iamberry.rst.core.cm.*;
 import com.iamberry.rst.core.order.ProductType;
 import com.iamberry.rst.core.page.PagedResult;
 import com.iamberry.rst.core.sys.Admin;
+import com.iamberry.rst.faces.cm.PostageAuthorityService;
 import com.iamberry.rst.faces.cm.PostageService;
 import com.iamberry.rst.faces.sys.SysService;
 import com.iamberry.rst.utils.AdminUtils;
@@ -23,8 +21,11 @@ import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Array;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * Created by wxm
@@ -38,6 +39,8 @@ public class AdminPostageController {
     @Autowired
     private PostageService postageService;
     @Autowired
+    private PostageAuthorityService postageAuthorityService;
+    @Autowired
     private SysService sysService;
 
     /**
@@ -53,166 +56,188 @@ public class AdminPostageController {
                                     @RequestParam(value = "pageNO", defaultValue = "1", required = false) Integer pageNO,
                                     @RequestParam(value = "totalNum", defaultValue = "0", required = false) Integer totalNum) {
         ModelAndView mv = new ModelAndView("cm/postage/postage_list");
-        List<String> operation = getAdminDept();      //1=客服  2=客服经理 3=财务经理 4=财务打款
-        PagedResult<Postage> pagedResult = postageService.listPostage(pageNO, pageSize, postage, totalNum == 0);
+        Admin loginAdmin = AdminUtils.getLoginAdmin();
+
+        PagedResult<Postage> pagedResult = new PagedResult<>();
+
+        //获取登录人id
+        if(loginAdmin.getAdminDept() == 3 && loginAdmin.getAdminManager() == 1){        //员工
+            postage.setAdminId(loginAdmin.getAdminId());
+        }else if(loginAdmin.getAdminDept() == 3 && loginAdmin.getAdminManager() == 2) {
+
+        }else{
+            /*  获取个人权限所属的销售公司 ,只查询所分的权限的列表 */
+            ArrayList companyIdList = new ArrayList();
+            List<PostageAuthority> postageAuthorityList = postageAuthorityService.getPostageAuthorityListByAdminId(loginAdmin.getAdminId());
+            for (PostageAuthority postageAuthority:postageAuthorityList ) {
+                companyIdList.add(postageAuthority.getCompanyId());
+            }
+            Integer[] companyIds = (Integer[]) companyIdList.toArray(new Integer[companyIdList.size()]);//能正确运行
+            if(companyIds == null || companyIds.length == 0){
+                companyIds = new Integer[]{99};
+            }
+            postage.setCompanyIds(companyIds);
+        }
+        pagedResult = postageService.listPostage(pageNO, pageSize, postage, totalNum == 0);
         if (totalNum != 0) {
             pagedResult.setTotal(totalNum);
         }
-        //查询跟进客服集合
-        Admin admin = new Admin();
-        admin.setAdminStatus(1);
-        List<Admin> adminList = sysService.listSelectAdmin(admin);
 
-        mv.addObject("operation", operation);
-        mv.addObject("adminList", adminList);
+        getManager(loginAdmin,pagedResult);
+
         StitchAttrUtil.setModelAndView(postage, mv, "/admin/postage/postage_list", pagedResult);
         return mv;
     }
 
-    /**
-     * 获取登录用户的权限
-     * @return
-     */
-    private List<String> getAdminDept(){
-        //获取登录人id
-        Admin loginAdmin = AdminUtils.getLoginAdmin();
-        //判断当前登录人权限
-        List<String> operation = sysService.listPermissionShiro(loginAdmin.getAdminId());
-        return operation;
-    }
 
+    private void getManager(Admin loginAdmin,PagedResult<Postage> pagedResult){
+        for (int i=0;i<pagedResult.getDataList().size();i++){
 
-    /**
-     * 客服确认状态
-     * @return
-     */
-    @ResponseBody
-    @RequiresPermissions("postage:update:confirm")
-    @RequestMapping(value = "/updateConfirmPostage")
-    public ResponseJson updateConfirmPostage(HttpServletRequest request, Integer postageId,Integer status) throws Exception {
-        if(postageId == null || postageId == 0){
-            return new ResponseJson(500, "未获取到记录id", 500);
-        }
-        if( status == null || status == 0){
-            return new ResponseJson(500, "修改失败,请重试", 500);
-        }
-        Postage post = postageService.getPostage(postageId);
-        Postage postage = new Postage();
-        postage.setPostageId(postageId);
-        //判断修改类型 1=客服修改申请状态 2=客服经理修改审核状态 3=财务经理修改审核转账状态
-        Integer num = 0;
-        if(post.getPostageCustomerStatus() == 1){
-            if(status == 2){
-                postage.setPostageCustomerStatus(status);   //申请中,
-                postage.setPostageManagerStatus(1);     //审核中
+            Integer companyId = pagedResult.getDataList().get(i).getCompanyId();
+
+            Map<String,Integer> map = new HashMap<>();
+            ArrayList authorityCustomerManagerList =  new ArrayList();
+            ArrayList authorityFinancialManagerList =  new ArrayList();
+            ArrayList authorityFinancialPaymentList =  new ArrayList();
+            List<PostageAuthority> postageAuthorityList = postageAuthorityService.getPostageAuthorityListByAdminId(loginAdmin.getAdminId());
+            for (PostageAuthority postageAuthority:postageAuthorityList ) {
+                if(companyId == postageAuthority.getCompanyId()){
+                    if(loginAdmin.getAdminId() == postageAuthority.getAuthorityCustomerManager()){
+                        authorityCustomerManagerList.add(postageAuthority.getAuthorityCustomerManager());
+                    }
+                    if(loginAdmin.getAdminId() == postageAuthority.getAuthorityFinancialManager()){
+                        authorityFinancialManagerList.add(postageAuthority.getAuthorityFinancialManager());
+                    }
+                    if(loginAdmin.getAdminId() == postageAuthority.getAuthorityFinancialPayment()){
+                        authorityFinancialPaymentList.add(postageAuthority.getAuthorityFinancialPayment());
+                    }
+                }
+            }
+            if(authorityCustomerManagerList != null && authorityCustomerManagerList.size() > 0){
+                pagedResult.getDataList().get(i).setCustomerManager(1);
+            }else{
+                pagedResult.getDataList().get(i).setCustomerManager(0);
             }
-            num = postageService.updatePostage(postage);
-        }
 
-        if(num > 0){
-            return new ResponseJson(200, "修改成功", 200);
-        }else{
-            return new ResponseJson(500, "修改失败", 500);
-        }
-    }
+            if(authorityFinancialManagerList != null && authorityFinancialManagerList.size() > 0){
+                pagedResult.getDataList().get(i).setFinanceManager(1);
+            }else{
+                pagedResult.getDataList().get(i).setFinanceManager(0);
+            }
 
-    /**
-     * 客服经理审核
-     * @return
-     */
-    @ResponseBody
-    @RequiresPermissions("postage:customer:review")
-    @RequestMapping(value = "/updateCustomerReview")
-    public ResponseJson updatePostageStatus(HttpServletRequest request, Integer postageId,Integer status) throws Exception {
-        if(postageId == null || postageId == 0){
-            return new ResponseJson(500, "未获取到记录id", 500);
-        }
-        if(status == null || status == 0){
-            return new ResponseJson(500, "修改失败,请重试", 500);
-        }
-        Postage post = postageService.getPostage(postageId);
-        Integer num = 0;
-        if(post.getPostageManagerStatus() == 1){          //审核中
-            Postage postage = new Postage();
-            postage.setPostageId(postageId);
-            if(status == 2){    //状态(客服经理审核)1:审核中 2:通过  3:驳回
-                postage.setPostageManagerStatus(status);
-                postage.setPostageFinanceStatus(1);     //审核中
+            if(authorityFinancialPaymentList != null && authorityFinancialPaymentList.size() > 0){
+                pagedResult.getDataList().get(i).setFinancePay(1);
             }else{
-                postage.setPostageManagerStatus(status);    //驳回
+                pagedResult.getDataList().get(i).setFinancePay(0);
             }
-            num = postageService.updatePostage(postage);
-        }
 
-        if(num > 0){
-            return new ResponseJson(200, "修改成功", 200);
-        }else{
-            return new ResponseJson(500, "修改失败", 500);
+            if(pagedResult.getDataList().get(i).getAdminId() == loginAdmin.getAdminId()){
+                pagedResult.getDataList().get(i).setCustomerConfirm(1);
+            }else{
+                pagedResult.getDataList().get(i).setCustomerConfirm(0);
+            }
         }
     }
 
     /**
-     * 财务经理审核
+     *  验证审核权限
+     * @param companyId 销售公司
+     * @param reviewNumber  2:客服经理  3:财务审核   4:财务打款
      * @return
      */
-    @ResponseBody
-    @RequiresPermissions("postage:finance:review")
-    @RequestMapping(value = "/updateFinanceReview")
-    public ResponseJson updateFinanceReview(HttpServletRequest request, Integer postageId,Integer status) throws Exception {
-        if(postageId == null || postageId == 0){
-            return new ResponseJson(500, "未获取到记录id", 500);
-        }
-        if(status == null || status == 0){
-            return new ResponseJson(500, "修改失败,请重试", 500);
-        }
-        Postage post = postageService.getPostage(postageId);
-        Integer num = 0;
-
-        if((post.getPostageFinanceStatus() == 1) ){
-            Postage postage = new Postage();
-            postage.setPostageId(postageId);
-            //状态(财务审核) 1:审核中 2:通过(已申请待转账)  3:驳回  4:已转账
-            postage.setPostageFinanceStatus(status);
-            num = postageService.updatePostage(postage);
-        }
+    private boolean verificaAuthority(Integer companyId,Integer reviewNumber){
+        if(companyId == null ) return false;
 
-        if(num > 0){
-            return new ResponseJson(200, "修改成功", 200);
-        }else{
-            return new ResponseJson(500, "修改失败", 500);
+        //获取登录人id
+        Admin loginAdmin = AdminUtils.getLoginAdmin();
+        boolean flag = false;
+        PostageAuthority postageAuthority = new PostageAuthority();
+        postageAuthority.setCompanyId(companyId);
+        List<PostageAuthority> postageAuthorityList =  postageAuthorityService.getPostageAuthorityList(postageAuthority);
+        for (PostageAuthority authority : postageAuthorityList) {
+            switch (reviewNumber){
+                case 2:
+                    if(authority.getAuthorityCustomerManager() == loginAdmin.getAdminId()){
+                        flag = true;
+                    }
+                    break;
+                case 3:
+                    if(authority.getAuthorityFinancialManager() == loginAdmin.getAdminId()){
+                        flag = true;
+                    }
+                    break;
+                case 4:
+                    if(authority.getAuthorityFinancialPayment() == loginAdmin.getAdminId()){
+                        flag = true;
+                    }
+                    break;
+            }
         }
+        return flag;
     }
 
-
     /**
-     * 财务经理打款
+     * 客服确认状态
      * @return
      */
     @ResponseBody
-    @RequiresPermissions("postage:finance:money")
-    @RequestMapping(value = "/updateFinanceMoney")
-    public ResponseJson updateFinanceMoney(HttpServletRequest request, Integer postageId,Integer status) throws Exception {
+    @RequiresPermissions("postage:update:confirm")
+    @RequestMapping(value = "/updateConfirmPostage")
+    public ResponseJson updateConfirmPostage(HttpServletRequest request, Integer postageId,Integer status,Integer type) throws Exception {
         if(postageId == null || postageId == 0){
             return new ResponseJson(500, "未获取到记录id", 500);
         }
-        if(status == null || status == 0){
-            return new ResponseJson(500, "修改失败,请重试", 500);
+        if( status == null || status == 0){
+            return new ResponseJson(500, "修改状态失败,请重试", 500);
         }
         Postage post = postageService.getPostage(postageId);
+
+        Postage postage = new Postage();
+        postage.setPostageId(postageId);
+        //判断修改类型 1=客服修改申请状态 2=客服经理修改审核状态 3=财务经理修改审核转账状态
         Integer num = 0;
+        switch (type){
+            case 1:     ////客服确认
+                if(post.getPostageCustomerStatus() == 1){
+                    if(status == 2){
+                        postage.setPostageCustomerStatus(status);   //申请中,
+                        postage.setPostageManagerStatus(1);     //审核中
+                    }
+                    num = postageService.updatePostage(postage);
+                }
+                break;
+            case 2:     //客服经理审核
+                if(post.getPostageManagerStatus() == 1 && verificaAuthority(post.getCompanyId(),2)){          //审核中
+                    if(status == 2){    //状态(客服经理审核)1:审核中 2:通过  3:驳回
+                        postage.setPostageManagerStatus(status);
+                        postage.setPostageFinanceStatus(1);     //审核中
+                    }else{
+                        postage.setPostageManagerStatus(status);    //驳回
+                    }
+                    num = postageService.updatePostage(postage);
+                }
+                break;
+            case 3:         //财务审核
+                if((post.getPostageFinanceStatus() == 1) && verificaAuthority(post.getCompanyId(),3)){
+                    //状态(财务审核) 1:审核中 2:通过(已申请待转账)  3:驳回  4:已转账
+                    postage.setPostageFinanceStatus(status);
+                    num = postageService.updatePostage(postage);
+                }
+                break;
+            case 4:     //财务打款
 
-        if((post.getPostageFinanceStatus() == 2) ){
-            Postage postage = new Postage();
-            postage.setPostageId(postageId);
-            //状态(财务审核) 1:审核中 2:通过(已申请待转账)  3:驳回  4:已转账
-            postage.setPostageFinanceStatus(status);
-            num = postageService.updatePostage(postage);
+                if((post.getPostageFinanceStatus() == 2) && verificaAuthority(post.getCompanyId(),4)){
+                    //状态(财务审核) 1:审核中 2:通过(已申请待转账)  3:驳回  4:已转账
+                    postage.setPostageFinanceStatus(status);
+                    num = postageService.updatePostage(postage);
+                }
+                break;
         }
 
         if(num > 0){
-            return new ResponseJson(200, "修改成功", 200);
+            return new ResponseJson(200, "修改状态成功", 200);
         }else{
-            return new ResponseJson(500, "修改失败", 500);
+            return new ResponseJson(500, "修改状态失败", 500);
         }
     }
 
@@ -231,9 +256,9 @@ public class AdminPostageController {
         num = postageService.delPostage(postageId);
 
         if(num > 0){
-            return new ResponseJson(200, "修改成功", 200);
+            return new ResponseJson(200, "修改状态成功", 200);
         }else{
-            return new ResponseJson(500, "修改失败", 500);
+            return new ResponseJson(500, "修改状态失败", 500);
         }
     }
 

+ 2 - 0
watero-rst-web/src/main/resources/watero-rst-orm.xml

@@ -82,6 +82,7 @@
 		<typeAlias type="com.iamberry.rst.core.cm.Visit" alias="Visit"/>
 		<typeAlias type="com.iamberry.rst.core.cm.CustomerCommon" alias="CustomerCommon"/>
 		<typeAlias type="com.iamberry.rst.core.cm.Postage" alias="Postage"/>
+		<typeAlias type="com.iamberry.rst.core.cm.PostageAuthority" alias="PostageAuthority"/>
 
 		<typeAlias type="com.iamberry.rst.core.sys.SysConfig" alias="SysConfig"/>
 
@@ -143,6 +144,7 @@
 		<mapper resource="com/iamberry/rst/service/cm/mapper/storeInfoMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/cm/mapper/customerCommonMapper.xml"/>
 		<mapper resource="com/iamberry/rst/service/cm/mapper/postageMapper.xml"/>
+		<mapper resource="com/iamberry/rst/service/cm/mapper/postageAuthorityMapper.xml"/>
 
 		<mapper resource="com/iamberry/rst/service/address/mapper/addressMapper.xml"/>
 

+ 1 - 1
watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/custome_list.ftl

@@ -374,7 +374,7 @@
                         </tr>
                     </#list>
             <#else>
-                <tr><td colspan="17" class="td-manage text-c" >暂时没有客诉信息,请添加!</td></tr>
+                <tr><td colspan="19" class="td-manage text-c" >暂时没有客诉信息,请添加!</td></tr>
             </#if>
         </tbody>
     </table>

+ 39 - 58
watero-rst-web/src/main/webapp/WEB-INF/views/cm/postage/postage_list.ftl

@@ -42,11 +42,6 @@
             <input type="text" class="my-input"  style="width:90px;margin-right: 0px;" value="${postage.postageClientName!}" placeholder="请输入客户姓名" id="postageClientName" name="postageClientName">
             <input type="text" class="my-input"  style="width:90px;margin-right: 0px;" value="${postage.postageClientTel!}" placeholder="请输入电话号码" id="postageClientTel" name="postageClientTel">
 
-            <select class="my-select" name="postageCustomerStatus" id="postageCustomerStatus" style="height: 36px;width: 100px;margin: 0px;padding: 6px 10px 6px 15px;">
-                <option value="">客服确认</option>
-                <option value="1" <#if postage.postageCustomerStatus??><#if postage.postageCustomerStatus == 1 >selected="selected"</#if></#if>>待确认</option>
-                <option value="2" <#if postage.postageCustomerStatus??><#if postage.postageCustomerStatus == 2 >selected="selected"</#if></#if>>申请中</option>
-            </select>
             <select class="my-select" name="postageManagerStatus" id="postageManagerStatus" style="height: 36px;width: 100px;margin: 0px;padding: 6px 10px 6px 15px;">
                 <option value="">客服经理审核</option>
                 <option value="1" <#if postage.postageManagerStatus??><#if postage.postageManagerStatus == 1 >selected="selected"</#if></#if>>待审核</option>
@@ -180,47 +175,33 @@
                     <td>${postage.postageAlipay!''}</td>
                     <td>${postage.postageAlipayName!''}</td>
                     <td>
-                        <#if postage.postageCustomerStatus == 1>
-                            <#list operation as open>
-                                <#if open == "postage:update:confirm">
-                                    <a style="text-decoration:none" href="javascript:;" title="确认申请" onclick="updatePostage(${postage.postageId},2,1);">
-                                        <i class="Hui-iconfont">&#xe6a7;</i>
-                                    </a>
-                                </#if>
-                            </#list>
+                        <#if postage.postageCustomerStatus == 1 && postage.customerConfirm == 1 >
+                            <a style="text-decoration:none" href="javascript:;" title="确认申请" onclick="updatePostage(${postage.postageId},2,1);">
+                                <i class="Hui-iconfont">&#xe6a7;</i>
+                            </a>
                          </#if>
-                        <#if postage.postageManagerStatus?? && postage.postageManagerStatus == 1>
-                            <#list operation as open>
-                                <#if open == "postage:customer:review">
-                                    <a style="text-decoration:none" href="javascript:;" title="审核通过" onclick="updatePostage(${postage.postageId},2,2);">
-                                        <i class="iconfont icon-pass-2-copy"></i>
-                                    </a>
-                                    <a style="text-decoration:none" href="javascript:;" title="审核不通过" onclick="updatePostage(${postage.postageId},3,2);">
-                                        <i class="iconfont icon-bohui"></i>
-                                    </a>
-                                </#if>
-                            </#list>
+
+                        <#if postage.postageManagerStatus?? && postage.postageManagerStatus == 1 && postage.customerManager == 1>
+                                <a style="text-decoration:none" href="javascript:;" title="审核通过" onclick="updatePostage(${postage.postageId},2,2);">
+                                    <i class="iconfont icon-pass-2-copy"></i>
+                                </a>
+                                <a style="text-decoration:none" href="javascript:;" title="审核不通过" onclick="updatePostage(${postage.postageId},3,2);">
+                                    <i class="iconfont icon-bohui"></i>
+                                </a>
                         </#if>
-                        <#if postage.postageFinanceStatus?? && postage.postageFinanceStatus == 1>
-                            <#list operation as open>
-                                <#if open == "postage:finance:review">
-                                    <a style="text-decoration:none" href="javascript:;" title="审核通过" onclick="updatePostage(${postage.postageId},2,3);">
-                                        <i class="iconfont icon-pass-2-copy"></i>
-                                    </a>
-                                    <a style="text-decoration:none" href="javascript:;" title="审核不通过" onclick="updatePostage(${postage.postageId},2,3);">
-                                        <i class="iconfont icon-bohui"></i>
-                                    </a>
-                                </#if>
-                            </#list>
+
+                        <#if postage.postageFinanceStatus?? && postage.postageFinanceStatus == 1 && postage.financeManager == 1>
+                            <a style="text-decoration:none" href="javascript:;" title="审核通过" onclick="updatePostage(${postage.postageId},2,3);">
+                                <i class="iconfont icon-pass-2-copy"></i>
+                            </a>
+                            <a style="text-decoration:none" href="javascript:;" title="审核不通过" onclick="updatePostage(${postage.postageId},2,3);">
+                                <i class="iconfont icon-bohui"></i>
+                            </a>
                         </#if>
-                        <#if postage.postageFinanceStatus?? && postage.postageFinanceStatus == 2>
-                            <#list operation as open>
-                                <#if open == "postage:finance:review">
-                                    <a style="text-decoration:none" href="javascript:;" title="已转账" onclick="updatePostage(${postage.postageId},4,4);">
-                                        <i class="iconfont icon-zhuanzhang"></i>
-                                    </a>
-                                </#if>
-                            </#list>
+                        <#if postage.postageFinanceStatus?? && postage.postageFinanceStatus == 2 &&  postage.financePay==1 >
+                            <a style="text-decoration:none" href="javascript:;" title="已转账" onclick="updatePostage(${postage.postageId},4,4);">
+                                <i class="iconfont icon-zhuanzhang"></i>
+                            </a>
                         </#if>
                     </td>
                 </tr>
@@ -240,30 +221,30 @@
      * 修改状态
      */
     function updatePostage(postageId,status,type) {
-        var url = "";
-        if(type == 1){
-            url = '/admin/postage/updateConfirmPostage';   //客服确认
-        }else if(type == 2){
-            url = '/admin/postage/updateCustomerReview';   //客服经理审核
-        }else if(type == 3){
-            url = '/admin/postage/updateFinanceReview';   //财务审核
-        }else if(type == 4){
-            url = '/admin/postage/updateFinanceMoney';   //财务打款
-        }
+//        var url = "";
+//        if(type == 1){
+//            url = '/admin/postage/updateConfirmPostage';   //客服确认
+//        }else if(type == 2){
+//            url = '/admin/postage/updateCustomerReview';   //客服经理审核
+//        }else if(type == 3){
+//            url = '/admin/postage/updateFinanceReview';   //财务审核
+//        }else if(type == 4){
+//            url = '/admin/postage/updateFinanceMoney';   //财务打款
+//        }
         layer.confirm('确认要修改吗?',function(index){
             $.ajax({
                 cache: true,
                 type: "POST",
-                data: {"postageId":postageId,"status" : status},
-                url: "${path}" + url,
+                data: {"postageId":postageId,"status" : status,"type":type},
+                url: "${path}" + "/admin/postage/updateConfirmPostage",
                 async: false,
                 success: function(data){
                     if (data.returnCode == 200) {
-                        layer.msg(data.resultMsg,{icon: 1,time:1000});
+                        //layer.msg(data.resultMsg,{icon: 1,time:3000});
+                        location.replace(location.href);
                     } else {
-                        layer.msg(data.resultMsg,{icon: 5,time:1000});
+                        layer.msg(data.resultMsg,{icon: 5,time:3000});
                     }
-                    location.replace(location.href);
                 },
                 error: function(XmlHttpRequest, textStatus, errorThrown){
                 }