Browse Source

报销开发费用明细列表,费用列表新增
主报销查询修改

anderx 2 years ago
parent
commit
ec6d0d0530

+ 14 - 30
src/main/java/com/goafanti/common/mapper/ExpenseAccountMapper.xml

@@ -1009,8 +1009,8 @@
 
 
   <select id="ExpenseDetailsList" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountDetailsList">
-    select mea.check_no ,ead.`type`,ead.amount ,ead.real_amount ,o.contract_no ,dep.name applyDepName,
-    dep2.name payDepName ,mea.aname ,ad2.name financeName,mea.status ,mea.process_status ,mea.id mainId,
+    select mea.check_no checkNo ,ead.`type`,ead.amount ,ead.real_amount realAmount ,o.contract_no contractNo ,dep.name applyDepName,
+    dep2.name payDepName ,mea.aname ,ad2.name financeName,mea.status ,mea.process_status processStatus ,mea.id mainId,
     tm.buyer_name buyerName ,date_format(mea.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr
     from expense_account_details  ead left join expense_account a on ead.eaid =a.id
     left join expense_relationship er on a.id=er.ea_id  left join expense_account mea on  er.id=mea.id
@@ -1019,6 +1019,10 @@
     left join department dep2 on mea.pay_dep =dep2.id  left join  admin ad on mea.aid=ad.id
     left join department dep3 on ad.department_id =dep3.id left join admin ad2 on dep3.finance_id =ad2.id
     where 1=1
+   <include refid="ExpenseDetailsSql"/>
+    ${page_sql}
+  </select>
+  <sql id="ExpenseDetailsSql">
     <if test=" status != null">
       and mea.status = #{status}
     </if>
@@ -1028,6 +1032,12 @@
         #{dep}
       </foreach>
     </if>
+    <if test="roleType ==1">
+      and dep.finance_id = #{aid}
+    </if>
+    <if test="roleType ==2">
+      and dep.finance_id in  (select id from admin where superior_id = #{aid})
+    </if>
     <if test=" contractNo != null">
       and o.contract_no like concat('%',#{contractNo},'%')
     </if><if test=" buyerName != null">
@@ -1045,8 +1055,7 @@
   </if><if test=" checkNo != null">
     and mea.check_no like concat('%',#{checkNo},'%')
   </if>
-    ${page_sql}
-  </select>
+  </sql>
   <select id="ExpenseDetailsCount" resultType="java.lang.Integer">
     select count(*)
     from expense_account_details  ead left join expense_account a on ead.eaid =a.id
@@ -1056,32 +1065,7 @@
     left join department dep2 on mea.pay_dep =dep2.id  left join  admin ad on mea.aid=ad.id
     left join department dep3 on ad.department_id =dep3.id left join admin ad2 on dep3.finance_id =ad2.id
     where 1=1
-    <if test=" status != null">
-      and mea.status = #{status}
-    </if>
-    <if test="deps !=null">
-      and ad.department_id  in
-      <foreach collection="deps" item="dep" open="(" close=")" separator=",">
-        #{dep}
-      </foreach>
-    </if>
-    <if test=" contractNo != null">
-      and o.contract_no like concat('%',#{contractNo},'%')
-    </if><if test=" buyerName != null">
-    and tm.buyer_name like concat('%','buyerName','%')
-  </if><if test=" type != null">
-    and ead.`type` = #{type}
-  </if><if test=" aname != null">
-    and mea.aname like concat('%',#{aname},'%')
-  </if><if test=" applyDep != null">
-    and mea.apply_dep =#{applyDep}
-  </if><if test=" payDep != null">
-    and mea.pay_dep =#{payDep}
-  </if><if test=" startTime != null and endTime !=null">
-    and mea.create_time between #{startTime} and #{endTime}
-  </if><if test=" checkNo != null">
-    and mea.check_no like concat('%',#{checkNo},'%')
-  </if>
+    <include refid="ExpenseDetailsSql"/>
   </select>
   <select id="selectCountByIdsAndType" resultType="java.lang.Integer">
     select count(*) from expense_account

+ 54 - 48
src/main/java/com/goafanti/expenseAccount/bo/OutExpenseAccountDetailsList.java

@@ -1,5 +1,7 @@
 package com.goafanti.expenseAccount.bo;
 
+import java.math.BigDecimal;
+
 public class OutExpenseAccountDetailsList {
 
     /**
@@ -10,15 +12,15 @@ public class OutExpenseAccountDetailsList {
      * 0=其他,1=交通费,2=住宿费,3=市内车费,4=餐费,5=出差补贴,6=预借支,7=油费
      * 8=招待费,9=办公费,10=福利费,11=物业水电费,12=打印费
      */
-    private String type;
+    private Integer type;
     /**
      * 金额
      */
-    private String amount;
+    private BigDecimal amount;
     /**
      * 实付金额
      */
-    private String realAmount;
+    private BigDecimal realAmount;
     /**
      * 合同编号
      */
@@ -42,15 +44,15 @@ public class OutExpenseAccountDetailsList {
     /**
      * 状态 0=草稿,1=审核中,2=完成,3=驳回 ,4=撤销
      */
-    private String status;
+    private Integer status;
     /**
      * 流程状态 0=巴员发起,1=上级审核,2=财务审核,3=总经理审核,4=董事长审核
      */
-    private String processStatus;
+    private Integer processStatus;
     /**
      * 主报销编号
      */
-    private String mainId;
+    private Integer mainId;
     /**
      * 客户名称
      */
@@ -68,29 +70,7 @@ public class OutExpenseAccountDetailsList {
         this.checkNo = checkNo;
     }
 
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public String getAmount() {
-        return amount;
-    }
 
-    public void setAmount(String amount) {
-        this.amount = amount;
-    }
-
-    public String getRealAmount() {
-        return realAmount;
-    }
-
-    public void setRealAmount(String realAmount) {
-        this.realAmount = realAmount;
-    }
 
     public String getContractNo() {
         return contractNo;
@@ -132,43 +112,69 @@ public class OutExpenseAccountDetailsList {
         this.financeName = financeName;
     }
 
-    public String getStatus() {
-        return status;
+
+
+    public String getBuyerName() {
+        return buyerName;
     }
 
-    public void setStatus(String status) {
-        this.status = status;
+    public void setBuyerName(String buyerName) {
+        this.buyerName = buyerName;
     }
 
-    public String getProcessStatus() {
-        return processStatus;
+    public String getCreateTimeStr() {
+        return createTimeStr;
     }
 
-    public void setProcessStatus(String processStatus) {
-        this.processStatus = processStatus;
+    public void setCreateTimeStr(String createTimeStr) {
+        this.createTimeStr = createTimeStr;
     }
 
-    public String getMainId() {
-        return mainId;
+    public Integer getType() {
+        return type;
     }
 
-    public void setMainId(String mainId) {
-        this.mainId = mainId;
+    public void setType(Integer type) {
+        this.type = type;
     }
 
-    public String getBuyerName() {
-        return buyerName;
+    public BigDecimal getAmount() {
+        return amount;
     }
 
-    public void setBuyerName(String buyerName) {
-        this.buyerName = buyerName;
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
     }
 
-    public String getCreateTimeStr() {
-        return createTimeStr;
+    public BigDecimal getRealAmount() {
+        return realAmount;
     }
 
-    public void setCreateTimeStr(String createTimeStr) {
-        this.createTimeStr = createTimeStr;
+    public void setRealAmount(BigDecimal realAmount) {
+        this.realAmount = realAmount;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getProcessStatus() {
+        return processStatus;
+    }
+
+    public void setProcessStatus(Integer processStatus) {
+        this.processStatus = processStatus;
+    }
+
+    public Integer getMainId() {
+        return mainId;
+    }
+
+    public void setMainId(Integer mainId) {
+        this.mainId = mainId;
     }
 }

+ 12 - 0
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -833,6 +833,18 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         if (in.getStartTime()!=null)params.put("startTime",in.getStartTime());
         if (in.getEndTime()!=null)params.put("endTime",in.getEndTime());
         if (in.getCheckNo()!=null)params.put("checkNo",in.getCheckNo());
+        //0=自己 1=财务 2=财务经理 3=超管
+        if (TokenManager.hasRole(AFTConstants.SUPERADMIN)){
+            params.put("roleType",3);
+        }else if (TokenManager.hasRole(AFTConstants.FINANCE_MANAGER)){
+            params.put("roleType",2);
+            params.put("aid",TokenManager.getAdminId());
+        }else if (TokenManager.hasRole(AFTConstants.FINANCE)){
+            params.put("roleType",1);
+            params.put("aid",TokenManager.getAdminId());
+        }else{
+            params.put("roleType",0);
+        }
         return findPage("ExpenseDetailsList","ExpenseDetailsCount",params,in.getPageNo(),in.getPageSize());
     }