Browse Source

报销开发子报销列表新增字段

anderx 2 years ago
parent
commit
16e1cb7d1e

+ 64 - 61
src/main/java/com/goafanti/common/mapper/ExpenseAccountMapper.xml

@@ -836,6 +836,9 @@
     left join t_order_new o on b.order_no =o.order_no left join expense_account c on a.ea_id =c.id
     left join admin ad on b.aid=ad.id left join department adDep on ad.department_id=adDep.id
     where 1=1 and b.expense_main =1
+    <if test="checkNo !=null">
+      and b.check_no like concat('%',#{checkNo},'%')
+    </if>
     <if test=" status != null">
       and b.status = #{status}
     </if>
@@ -871,6 +874,9 @@
     left join admin ad on b.aid=ad.id
     left join department adDep on ad .department_id=adDep.id
     where 1=1 and b.expense_main =1
+    <if test="checkNo !=null">
+      and b.check_no like concat('%',#{checkNo},'%')
+    </if>
     <if test=" status != null">
       and b.status = #{status}
     </if>
@@ -902,83 +908,80 @@
 
 
 
-  <select id="ExpenseDetailsList" resultMap="MainMap">
-    select c.id detId,c.`type` sonType,ead.`type` detType,ead.amount ,ead.real_amount ,
-    b.id,b.check_no,b.total_amount,b.order_no,o.contract_no,b.aname,b.apply_dep,b.pay_dep,
-    date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr,b.status,b.process_status,
-    dep.name applyDepName,dep2.name payDepName, b.remarks,b.eaaid ,
-    c.id sonId,c.total_amount sonAmount,c.`type` ,c.type_other ,c.user_names ,c.release_start ,c.release_end
-    from expense_relationship a
-    left join expense_account b on a.id =b.id
-    left join department dep on b.apply_dep =dep.id left join department dep2 on b.pay_dep =dep2.id
-    left join t_order_new o on b.order_no =o.order_no
-    left join expense_account c on a.ea_id =c.id
-    left join expense_account_details ead on c.id=ead.eaid
-    left join admin ad on b.aid=ad.id
-    left join department adDep on ad .department_id=adDep.id
-    where 1=1 and b.expense_main =1
+  <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,
+    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
+    left join t_order_new o on mea.order_no =o.order_no left join t_order_mid tm on o.order_no =tm.order_no
+    left join department dep on mea.apply_dep =dep.id
+    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 b.status = #{status}
-    </if>
-    <if test="listStatus ==0">
-      and b.status in(0,1,3)
-    </if>
-    <if test="listStatus ==1">
-      and b.status =2
-    </if>
-    <if test=" roleType ==0">
-      and b.aid = #{aid}
-    </if>
-    <if test="roleType == 1">
-      and b.process_status &gt; 0
-      and ad.superior_id= #{aid}
-    </if>
-    <if test="roleType == 2">
-      and b.process_status &gt; 1
-      and adDep.finance_id = #{aid}
+      and mea.status = #{status}
     </if>
-    <if test="roleType == 3">
-      and b.process_status &gt; 2
-      and ad.department_id in
+    <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>
     ${page_sql}
   </select>
   <select id="ExpenseDetailsCount" resultType="java.lang.Integer">
     select count(*)
-    from expense_account b
-    left join admin ad on b.aid=ad.id
-    left join department adDep on ad .department_id=adDep.id
-    where 1=1 and b.expense_main =1
+    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
+    left join t_order_new o on mea.order_no =o.order_no left join t_order_mid tm on o.order_no =tm.order_no
+    left join department dep on mea.apply_dep =dep.id
+    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 b.status = #{status}
-    </if>
-    <if test="listStatus ==0">
-      and b.status in(0,1,3)
-    </if>
-    <if test="listStatus ==1">
-      and b.status =2
+      and mea.status = #{status}
     </if>
-    <if test=" roleType ==0">
-      and b.aid = #{aid}
-    </if>
-    <if test="roleType == 1">
-      and b.process_status &gt; 0
-      and ad.superior_id= #{aid}
-    </if>
-    <if test="roleType == 2">
-      and b.process_status &gt; 1
-      and adDep.finance_id = #{aid}
-    </if>
-    <if test="roleType == 3">
-      and b.process_status &gt; 2
-      and ad.department_id in
+    <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>
   </select>
   <select id="selectCountByIdsAndType" resultType="java.lang.Integer">
     select count(*) from expense_account

+ 9 - 0
src/main/java/com/goafanti/expenseAccount/bo/ExpenseMainListInput.java

@@ -7,6 +7,7 @@ public class ExpenseMainListInput {
      *  状态 0=草稿,1=审核中,2=完成,3=驳回 ,4=撤销
      */
     private Integer status;
+    private Integer checkNo;
 
 
     /**
@@ -18,6 +19,14 @@ public class ExpenseMainListInput {
      */
     private Integer processStatus;
 
+    public Integer getCheckNo() {
+        return checkNo;
+    }
+
+    public void setCheckNo(Integer checkNo) {
+        this.checkNo = checkNo;
+    }
+
     public Integer getListStatus() {
         return listStatus;
     }

+ 155 - 0
src/main/java/com/goafanti/expenseAccount/bo/InputDetailsListBo.java

@@ -0,0 +1,155 @@
+package com.goafanti.expenseAccount.bo;
+
+public class InputDetailsListBo {
+    private Integer pageSize;
+    private Integer pageNo;
+    /**
+     * 状态 0=草稿,1=审核中,2=完成,3=驳回 ,4=撤销
+     */
+    private Integer status;
+    /**
+     * 0=其他,1=交通费,2=住宿费,3=市内车费,4=餐费,5=出差补贴,6=预借支,7=油费
+     * 8=招待费,9=办公费,10=福利费,11=物业水电费,12=打印费
+     */
+    private Integer type;
+    /**
+     * 部门名称
+     */
+    private String depId;
+    /**
+     * 合同编号
+     */
+    private String contractNo;
+    /**
+     * 客户名称
+     */
+    private String buyerName;
+    /**
+     * 申请人
+     */
+    private String aname;
+    /**
+     * 申请部门
+     */
+    private String applyDep;
+    /**
+     * 支付部门
+     */
+    private String payDep;
+    /**
+     * 开始时间
+     */
+    private String startTime;
+    /**
+     * 结束时间
+     */
+    private String endTime;
+    /**
+     * 报销查询编号
+     */
+    private String checkNo;
+
+    public Integer getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(Integer pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public Integer getPageNo() {
+        return pageNo;
+    }
+
+    public void setPageNo(Integer pageNo) {
+        this.pageNo = pageNo;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public String getDepId() {
+        return depId;
+    }
+
+    public void setDepId(String depId) {
+        this.depId = depId;
+    }
+
+    public String getContractNo() {
+        return contractNo;
+    }
+
+    public void setContractNo(String contractNo) {
+        this.contractNo = contractNo;
+    }
+
+    public String getBuyerName() {
+        return buyerName;
+    }
+
+    public void setBuyerName(String buyerName) {
+        this.buyerName = buyerName;
+    }
+
+    public String getAname() {
+        return aname;
+    }
+
+    public void setAname(String aname) {
+        this.aname = aname;
+    }
+
+    public String getApplyDep() {
+        return applyDep;
+    }
+
+    public void setApplyDep(String applyDep) {
+        this.applyDep = applyDep;
+    }
+
+    public String getPayDep() {
+        return payDep;
+    }
+
+    public void setPayDep(String payDep) {
+        this.payDep = payDep;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public String getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(String endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getCheckNo() {
+        return checkNo;
+    }
+
+    public void setCheckNo(String checkNo) {
+        this.checkNo = checkNo;
+    }
+}

+ 28 - 4
src/main/java/com/goafanti/expenseAccount/bo/InputPageListBo.java

@@ -1,24 +1,48 @@
 package com.goafanti.expenseAccount.bo;
 
 public class InputPageListBo {
+    /**
+     * 开始时间
+     */
     private String startTime;
+    /**
+     * 结束时间
+     */
     private String endTime;
-//    状态 0=草稿,1=审核中,2=完成,3=驳回
+    /**
+     *  状态 0=草稿,1=审核中,2=完成,3=驳回
+     */
     private Integer status;
-//    审核状态 0审核中  1已审核
+    /**
+     * 审核状态 0审核中  1已审核
+     */
     private Integer examineStatus;
-//    查询人员 0自己 1审核 2查看
+    /**
+     *  查询人员 0自己 1审核 2查看
+      */
     private Integer processStatus;
 
-    //同编号搜索、按客户名称搜索 、按部门/公司搜索 、按报销类型搜索、按报销公司部门/公司、按支付部门/公司搜索、按审核状态(财务审核中-不同人员针对的审核状态不一样、已完成)、报销时间(按报销的时间段进行搜索)
+    /**
+     * 合同编号
+     */
     private String contractNo;
     /**
      * @param username 报销编号和企业名称用这个字段
      */
     private String username;
+    /**
+     * 部门编号
+     */
     private String depId;
+    /**
+     * 报销人
+     */
     private String aid;
+    /**
+     * 报销类型
+     */
     private String type;
+
     private String applyDep;
     private String payDep;
     private String checkNo;

+ 174 - 0
src/main/java/com/goafanti/expenseAccount/bo/OutExpenseAccountDetailsList.java

@@ -0,0 +1,174 @@
+package com.goafanti.expenseAccount.bo;
+
+public class OutExpenseAccountDetailsList {
+
+    /**
+     * 报销查询编号
+     */
+    private String checkNo;
+    /**
+     * 0=其他,1=交通费,2=住宿费,3=市内车费,4=餐费,5=出差补贴,6=预借支,7=油费
+     * 8=招待费,9=办公费,10=福利费,11=物业水电费,12=打印费
+     */
+    private String type;
+    /**
+     * 金额
+     */
+    private String amount;
+    /**
+     * 实付金额
+     */
+    private String realAmount;
+    /**
+     * 合同编号
+     */
+    private String contractNo;
+    /**
+     * 申请公司
+     */
+    private String applyDepName;
+    /**
+     * 支付公司
+     */
+    private String payDepName;
+    /**
+     * 申请人
+     */
+    private String aname;
+    /**
+     * 财富负责人
+     */
+    private String financeName;
+    /**
+     * 状态 0=草稿,1=审核中,2=完成,3=驳回 ,4=撤销
+     */
+    private String status;
+    /**
+     * 流程状态 0=巴员发起,1=上级审核,2=财务审核,3=总经理审核,4=董事长审核
+     */
+    private String processStatus;
+    /**
+     * 主报销编号
+     */
+    private String mainId;
+    /**
+     * 客户名称
+     */
+    private String buyerName;
+    /**
+     * 创建时间
+     */
+    private String createTimeStr;
+
+    public String getCheckNo() {
+        return checkNo;
+    }
+
+    public void setCheckNo(String checkNo) {
+        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;
+    }
+
+    public void setContractNo(String contractNo) {
+        this.contractNo = contractNo;
+    }
+
+    public String getApplyDepName() {
+        return applyDepName;
+    }
+
+    public void setApplyDepName(String applyDepName) {
+        this.applyDepName = applyDepName;
+    }
+
+    public String getPayDepName() {
+        return payDepName;
+    }
+
+    public void setPayDepName(String payDepName) {
+        this.payDepName = payDepName;
+    }
+
+    public String getAname() {
+        return aname;
+    }
+
+    public void setAname(String aname) {
+        this.aname = aname;
+    }
+
+    public String getFinanceName() {
+        return financeName;
+    }
+
+    public void setFinanceName(String financeName) {
+        this.financeName = financeName;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getProcessStatus() {
+        return processStatus;
+    }
+
+    public void setProcessStatus(String processStatus) {
+        this.processStatus = processStatus;
+    }
+
+    public String getMainId() {
+        return mainId;
+    }
+
+    public void setMainId(String mainId) {
+        this.mainId = mainId;
+    }
+
+    public String getBuyerName() {
+        return buyerName;
+    }
+
+    public void setBuyerName(String buyerName) {
+        this.buyerName = buyerName;
+    }
+
+    public String getCreateTimeStr() {
+        return createTimeStr;
+    }
+
+    public void setCreateTimeStr(String createTimeStr) {
+        this.createTimeStr = createTimeStr;
+    }
+}

+ 2 - 3
src/main/java/com/goafanti/expenseAccount/controller/ExpenseAccountController.java

@@ -97,12 +97,11 @@ public class ExpenseAccountController extends CertifyApiController {
     }
 
     /**
-     * 报销列表,子报销列表
-     * @param in
+     * 报销详情列表
      * @return
      */
     @RequestMapping(value = "/detailsList",method = RequestMethod.GET)
-    public Result detailsList(InputPageListBo in ){
+    public Result detailsList(InputDetailsListBo in ){
         Result res =new Result();
         res.setData(expenseAccountService.detailsList(in));
         return res;

+ 1 - 1
src/main/java/com/goafanti/expenseAccount/service/ExpenseAccountService.java

@@ -49,7 +49,7 @@ public interface ExpenseAccountService {
 
     Object mainList(ExpenseMainListInput id);
 
-    Object detailsList(InputPageListBo in);
+    Object detailsList(InputDetailsListBo in);
 
     List<ExpenseAccount> selectByIds(List<String> list);
 

+ 13 - 5
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -338,6 +338,10 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         if (in.getAgreeTimes()!=null){
             in.setAgreeTime(DateUtils.StringToDate(in.getAgreeTimes(),AFTConstants.YYYYMMDD));
         }
+        ExpenseAccount expenseAccount = expenseAccountMapper.selectByPrimaryKey(in.getEaid());
+        if (expenseAccount.getType()==2){
+            in.setType(expenseAccount.getSecondaryType());
+        }
         in.setRealAmount(in.getAmount());
         return expenseAccountDetailsMapper.insertSelective(in);
     }
@@ -761,18 +765,22 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     public Object mainList(ExpenseMainListInput in) {
         Map<String,Object> params = new HashMap<>();
         if (in.getStatus()!=null) params.put("status",in.getStatus());
-        if (in.getProcessStatus()==null){
+        if (in.getCheckNo()!=null) params.put("checkNo",in.getCheckNo());
+        if (in.getListStatus()!=null) params.put("listStatus",in.getListStatus());
+        //1-3s是不同人的审核
+        if (in.getProcessStatus()!=null&&in.getProcessStatus()==1){
             if (TokenManager.hasRole(AFTConstants.SALESMAN_ADMIN)){
                 in.setProcessStatus(3);
             }else if (TokenManager.hasRole(AFTConstants.FINANCE)||TokenManager.hasRole(AFTConstants.FINANCE_MANAGER)){
                 in.setProcessStatus(2);
             }else if (TokenManager.hasRole(AFTConstants.SALESMAN_MANAGER)){
                 in.setProcessStatus(1);
-            }else {
-                in.setProcessStatus(0);
             }
+        }else {
+                in.setProcessStatus(0);
         }
-        if (in.getListStatus()!=null) params.put("listStatus",in.getListStatus());
+
+
         if (in.getProcessStatus()!=null){
             params.put("aid",TokenManager.getAdminId());
             params.put("roleType",in.getProcessStatus());
@@ -784,7 +792,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     }
 
     @Override
-    public Object detailsList(InputPageListBo in) {
+    public Object detailsList(InputDetailsListBo in) {
         Map<String,Object> params = new HashMap<>();
         return findPage("ExpenseDetailsList","ExpenseDetailsCount",params,in.getPageNo(),in.getPageSize());
     }