Kaynağa Gözat

审核日志列表修改

anderx 2 yıl önce
ebeveyn
işleme
5d01cec917

+ 16 - 1
src/main/java/com/goafanti/common/dao/ExpenseAccountExamineMapper.java

@@ -1,6 +1,7 @@
 package com.goafanti.common.dao;
 
 import com.goafanti.common.model.ExpenseAccountExamine;
+import com.goafanti.expenseAccount.bo.OutExpenseAccountLog;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
@@ -22,5 +23,19 @@ public interface ExpenseAccountExamineMapper {
 
     void updateStatusByEaidAndAid(@Param("id") Integer id, @Param("aid") String aid,@Param("status") Integer status);
 
-    List<ExpenseAccountExamine> selectByEaidAndType(@Param("id") Integer id, @Param("processStatus") Integer type);
+    /**
+     * 获取当前审核信息
+     * @param id
+     * @param processStatus
+     * @return
+     */
+    List<ExpenseAccountExamine> selectByEaidAndProcessStatus(@Param("id") Integer id, @Param("processStatus") Integer processStatus);
+
+    /**
+     * 获取大于当前的未审核角色
+     * @param id
+     * @param processStatus
+     * @return
+     */
+    List<OutExpenseAccountLog> selectNotExamineByEaidAndProcessStatus(@Param("id") Integer id, @Param("processStatus") Integer processStatus);
 }

+ 12 - 2
src/main/java/com/goafanti/common/mapper/ExpenseAccountExamineMapper.xml

@@ -128,10 +128,20 @@
       </if>
   </update>
 
-  <select id="selectByEaidAndType" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+  <select id="selectByEaidAndProcessStatus" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />
     from expense_account_examine
-    where eaid = #{id} and process_status= #{processStatus}
+    where eaid = #{id}
+    <if test="processStatus !=null">
+    and process_status= #{processStatus}
+    </if>
+  </select>
+  <select id="selectNotExamineByEaidAndProcessStatus"
+          resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountLog">
+    select  process_status processStatus,group_concat(auditorName) auditorName
+    from expense_account_examine
+    where eaid = #{id} and process_status> #{processStatus}
+    group by process_status
   </select>
 </mapper>

+ 20 - 8
src/main/java/com/goafanti/common/mapper/ExpenseAccountLogMapper.xml

@@ -4,13 +4,14 @@
   <resultMap id="BaseResultMap" type="com.goafanti.common.model.ExpenseAccountLog">
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="eaid" jdbcType="INTEGER" property="eaid" />
+    <result column="process_status" jdbcType="INTEGER" property="processStatus" />
     <result column="status" jdbcType="INTEGER" property="status" />
     <result column="remarks" jdbcType="VARCHAR" property="remarks" />
     <result column="auditor" jdbcType="VARCHAR" property="auditor" />
     <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
   </resultMap>
   <sql id="Base_Column_List">
-    id, eaid, `status`, remarks, auditor, create_time
+    id, eaid, process_status, `status`, remarks, auditor, create_time
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -18,16 +19,17 @@
     from expense_account_log
     where id = #{id,jdbcType=INTEGER}
   </select>
-
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
     delete from expense_account_log
     where id = #{id,jdbcType=INTEGER}
   </delete>
   <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccountLog" useGeneratedKeys="true">
-    insert into expense_account_log (eaid, `status`, remarks,
-      auditor, create_time)
-    values (#{eaid,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{remarks,jdbcType=VARCHAR},
-      #{auditor,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
+    insert into expense_account_log (eaid, process_status, `status`,
+      remarks, auditor, create_time
+      )
+    values (#{eaid,jdbcType=INTEGER}, #{processStatus,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
+      #{remarks,jdbcType=VARCHAR}, #{auditor,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
+      )
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccountLog" useGeneratedKeys="true">
     insert into expense_account_log
@@ -35,6 +37,9 @@
       <if test="eaid != null">
         eaid,
       </if>
+      <if test="processStatus != null">
+        process_status,
+      </if>
       <if test="status != null">
         `status`,
       </if>
@@ -52,6 +57,9 @@
       <if test="eaid != null">
         #{eaid,jdbcType=INTEGER},
       </if>
+      <if test="processStatus != null">
+        #{processStatus,jdbcType=INTEGER},
+      </if>
       <if test="status != null">
         #{status,jdbcType=INTEGER},
       </if>
@@ -72,6 +80,9 @@
       <if test="eaid != null">
         eaid = #{eaid,jdbcType=INTEGER},
       </if>
+      <if test="processStatus != null">
+        process_status = #{processStatus,jdbcType=INTEGER},
+      </if>
       <if test="status != null">
         `status` = #{status,jdbcType=INTEGER},
       </if>
@@ -90,6 +101,7 @@
   <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.ExpenseAccountLog">
     update expense_account_log
     set eaid = #{eaid,jdbcType=INTEGER},
+      process_status = #{processStatus,jdbcType=INTEGER},
       `status` = #{status,jdbcType=INTEGER},
       remarks = #{remarks,jdbcType=VARCHAR},
       auditor = #{auditor,jdbcType=VARCHAR},
@@ -98,7 +110,7 @@
   </update>
 
   <select id="selectByEaid" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountLog">
-    select a.id,a.eaid ,a.status ,a.remarks ,a.auditor ,b.name auditorName,
+    select a.id,a.eaid ,a.status ,a.remarks ,a.auditor ,b.name auditorName,a.process_status processStatus,
            date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr
     from expense_account_log a left join admin b on a.auditor =b.id
     where a.eaid= #{eaid}

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

@@ -366,7 +366,7 @@
     left join t_order_mid tm on a.order_no =tm.order_no left join department f on d.department_id =f.id
     left join admin d2 on f.finance_id =d2.id
     <if test="processStatus ==1">
-    inner join (select eaid ,auditor,min(type)`type` from expense_account_examine
+    inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
       where auditor= #{aid} group by eaid) eae on a.id=eae.eaid
     </if>
     where 1=1
@@ -415,7 +415,7 @@
     left join admin d on a.aid =d.id left join t_order_new e on a.order_no =e.order_no
     left join t_order_mid tm on a.order_no =tm.order_no
     <if test="processStatus ==1">
-      inner join (select eaid ,auditor,min(type)`type` from expense_account_examine
+      inner join (select eaid ,auditor,min(process_status)`type` from expense_account_examine
       where auditor= #{aid} group by eaid) eae on a.id=eae.eaid
     </if>
     where 1=1

+ 14 - 1
src/main/java/com/goafanti/common/model/ExpenseAccountLog.java

@@ -19,7 +19,12 @@ public class ExpenseAccountLog implements Serializable {
     private Integer eaid;
 
     /**
-     * 状态 0发起 1审核中 2通过 3驳回
+     * 流程状态 0=巴员发起,1=巴主发起或审核,2=总经理审核,3=财务审核,4=董事长审核
+     */
+    private Integer processStatus;
+
+    /**
+     * 状态 0发起 1通过 2完成 3驳回
      */
     private Integer status;
 
@@ -56,6 +61,14 @@ public class ExpenseAccountLog implements Serializable {
         this.eaid = eaid;
     }
 
+    public Integer getProcessStatus() {
+        return processStatus;
+    }
+
+    public void setProcessStatus(Integer processStatus) {
+        this.processStatus = processStatus;
+    }
+
     public Integer getStatus() {
         return status;
     }

+ 23 - 17
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -142,14 +142,8 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
      * @param status 状态 0创建 1发起 2通过 3驳回 4修改
      * @param str 备注
      */
-    private void addExpenseAccountLog(Integer eaid, Integer status,String aid, String str) {
-        if (aid==null)aid=TokenManager.getAdminId();
-        ExpenseAccountLog eaLog=new ExpenseAccountLog();
-        eaLog.setEaid(eaid);
-        eaLog.setStatus(status);
-        eaLog.setRemarks(str);
-        eaLog.setAuditor(aid);
-        expenseAccountLogMapper.insertSelective(eaLog);
+    private void addExpenseAccountLog(Integer eaid, Integer status,Integer processStatus,String aid, String str) {
+        addExpenseAccountLog(eaid,status,processStatus,aid,str,null);
     }
 
     /**
@@ -158,26 +152,29 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
      * @param status 状态 0创建 1发起 2通过 3驳回 4修改
      * @param str 备注
      */
-    private void addExpenseAccountLog(Integer eaid, Integer status,String aid, String str,Date date) {
+    private void addExpenseAccountLog(Integer eaid, Integer status,Integer processStatus,String aid, String str,Date date) {
         if (aid==null)aid=TokenManager.getAdminId();
         ExpenseAccountLog eaLog=new ExpenseAccountLog();
         eaLog.setEaid(eaid);
         eaLog.setStatus(status);
         eaLog.setRemarks(str);
+        eaLog.setProcessStatus(processStatus);
         eaLog.setAuditor(aid);
-        eaLog.setCreateTime(date);
+        if (date !=null)eaLog.setCreateTime(date);
         expenseAccountLogMapper.insertSelective(eaLog);
     }
 
     private void addExpenseAccountLogAndNoticEmail(InputExpenseAccount in, Integer status, String str) {
         String aid=TokenManager.getAdminId();
-        addExpenseAccountLog(in.getId(),status,aid,str);
+        addExpenseAccountLog(in.getId(),status,in.getProcessStatus(),aid,str);
         //正常是走入上级审核,但是可能会跳过
         if(status>0){
             Admin admin = adminMapper.selectByPrimaryKey(aid);
             if (admin.getSuperiorId()==null||admin.getId().equals(admin.getSuperiorId())){
                 String str2=String.format("重复审核人跳过[%s]。",EAProcessStatus.getDesc(in.getProcessStatus()));
-                addExpenseAccountLog(in.getId(),1,aid,str2);
+                Date date=new Date();
+                date.setTime(date.getTime()+1000L);
+                addExpenseAccountLog(in.getId(),1,in.getProcessStatus(),aid,str2,date);
                 in.setProcessStatus(in.getProcessStatus()+1);
             }
             createExamineByProcess(in);
@@ -313,7 +310,16 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
 
     @Override
     public Object logList(Integer eaid) {
-        return expenseAccountLogMapper.selectByEaid(eaid);
+        List<OutExpenseAccountLog> list = expenseAccountLogMapper.selectByEaid(eaid);
+        int maxProcessStatus=0;
+        for (OutExpenseAccountLog e : list) {
+            if (e.getProcessStatus()>maxProcessStatus){
+                maxProcessStatus=e.getProcessStatus();
+            }
+        }
+        List<OutExpenseAccountLog> eaelist = expenseAccountExamineMapper.selectNotExamineByEaidAndProcessStatus(eaid, maxProcessStatus);
+        list.addAll(eaelist);
+        return list;
     }
 
     @Override
@@ -410,7 +416,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             str=str.append("您的报销审核已驳回,报销编号[").append(in.getId()).append("],请注意查看。");
         }
         if (newEa.getStatus()==null)newEa.setStatus(1);
-        addExpenseAccountLog(in.getId(),status,null,in.getReason());
+        addExpenseAccountLog(in.getId(),status,useEa.getProcessStatus(),TokenManager.getAdminId(),in.getReason());
         addNoticeAndEmail(in,  status,str.toString(),admin.getName(),aids);
     }
 
@@ -423,7 +429,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     }
 
     private void examineByprocess( ExpenseAccount newEa) {
-        List<ExpenseAccountExamine> list = expenseAccountExamineMapper.selectByEaidAndType(newEa.getId(), newEa.getProcessStatus());
+        List<ExpenseAccountExamine> list = expenseAccountExamineMapper.selectByEaidAndProcessStatus(newEa.getId(), newEa.getProcessStatus());
         boolean flag=false;
         for (ExpenseAccountExamine e : list) {
             if (e.getStatus()==1){
@@ -435,7 +441,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             String str=String.format("重复审核人跳过[%s]。",EAProcessStatus.getDesc(newEa.getProcessStatus()));
             Date date=new Date();
             date.setTime(date.getTime()+1000l);
-            addExpenseAccountLog(newEa.getId(),1,null,str,date);
+            addExpenseAccountLog(newEa.getId(),1,newEa.getProcessStatus(),TokenManager.getAdminId(),str,date);
             newEa.setProcessStatus(newEa.getProcessStatus()+1);
             if (newEa.getProcessStatus()<EAProcessStatus.WCSH.getCode())examineByprocess(newEa);
         }
@@ -496,7 +502,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     @Override
     public Object selectById(Integer id) {
         OutExpenseAccount useEa = expenseAccountMapper.selectByid(id);
-        List<ExpenseAccountExamine> list = expenseAccountExamineMapper.selectByEaidAndType(id, useEa.getProcessStatus());
+        List<ExpenseAccountExamine> list = expenseAccountExamineMapper.selectByEaidAndProcessStatus(id, useEa.getProcessStatus());
         boolean flag=false;
         for (ExpenseAccountExamine e : list) {
                 if (e.getAuditor().equals(TokenManager.getAdminId())){