Browse Source

修改新增、修改、审核、列表接口,关联审核人名称

anderx 2 years ago
parent
commit
7bea5fb62f

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

@@ -22,11 +22,12 @@
     <result column="release_start" jdbcType="TIMESTAMP" property="releaseStart" />
     <result column="release_end" jdbcType="TIMESTAMP" property="releaseEnd" />
     <result column="duration" jdbcType="DOUBLE" property="duration" />
+    <result column="examine_name" jdbcType="VARCHAR" property="examineName" />
   </resultMap>
   <sql id="Base_Column_List">
     id, prid, order_no, aid, aname, `type`, type_other, `status`, process_status, total_amount,
     attachment_url, apply_dep, pay_dep, eaaid, create_time, district_name, user_names,
-    release_start, release_end, duration
+    release_start, release_end, duration, examine_name
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
     select
@@ -34,7 +35,6 @@
     from expense_account
     where id = #{id,jdbcType=INTEGER}
   </select>
-
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
     delete from expense_account
     where id = #{id,jdbcType=INTEGER}
@@ -46,14 +46,14 @@
       attachment_url, apply_dep, pay_dep,
       eaaid, create_time, district_name,
       user_names, release_start, release_end,
-      duration)
+      duration, examine_name)
     values (#{prid,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{aid,jdbcType=VARCHAR},
       #{aname,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{typeOther,jdbcType=VARCHAR},
       #{status,jdbcType=INTEGER}, #{processStatus,jdbcType=INTEGER}, #{totalAmount,jdbcType=DECIMAL},
       #{attachmentUrl,jdbcType=VARCHAR}, #{applyDep,jdbcType=VARCHAR}, #{payDep,jdbcType=VARCHAR},
       #{eaaid,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{districtName,jdbcType=VARCHAR},
       #{userNames,jdbcType=VARCHAR}, #{releaseStart,jdbcType=TIMESTAMP}, #{releaseEnd,jdbcType=TIMESTAMP},
-      #{duration,jdbcType=DOUBLE})
+      #{duration,jdbcType=DOUBLE}, #{examineName,jdbcType=VARCHAR})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.ExpenseAccount" useGeneratedKeys="true">
     insert into expense_account
@@ -115,6 +115,9 @@
       <if test="duration != null">
         duration,
       </if>
+      <if test="examineName != null">
+        examine_name,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="prid != null">
@@ -174,6 +177,9 @@
       <if test="duration != null">
         #{duration,jdbcType=DOUBLE},
       </if>
+      <if test="examineName != null">
+        #{examineName,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.ExpenseAccount">
@@ -236,6 +242,9 @@
       <if test="duration != null">
         duration = #{duration,jdbcType=DOUBLE},
       </if>
+      <if test="examineName != null">
+        examine_name = #{examineName,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=INTEGER}
   </update>
@@ -259,7 +268,8 @@
       user_names = #{userNames,jdbcType=VARCHAR},
       release_start = #{releaseStart,jdbcType=TIMESTAMP},
       release_end = #{releaseEnd,jdbcType=TIMESTAMP},
-      duration = #{duration,jdbcType=DOUBLE}
+      duration = #{duration,jdbcType=DOUBLE},
+      examine_name = #{examineName,jdbcType=VARCHAR}
     where id = #{id,jdbcType=INTEGER}
   </update>
 
@@ -284,7 +294,7 @@
 
 
   <select id="selectExpenseAccountList" resultType="com.goafanti.expenseAccount.bo.OutExpenseAccountBo">
-    select a.id,a.total_amount totalAmount,a.`type`,a.process_status processStatus,a.status,
+    select a.id,a.total_amount totalAmount,a.`type`,a.process_status processStatus,a.status,a.examine_name examineName,
            date_format(a.create_time,'%Y-%m-%d %H:%i:%S')createTimeStr
     from expense_account a
     <if test="processStatus ==1">

+ 16 - 3
src/main/java/com/goafanti/common/model/ExpenseAccount.java

@@ -27,12 +27,12 @@ public class ExpenseAccount implements Serializable {
     private String aid;
 
     /**
-     * 审核人名称
+     * 报销人名称
      */
     private String aname;
 
     /**
-     * 状态 0=其他,1=差旅费,2=第三方付款,3=餐费,4=申请借支
+     * 分类 0=其他,1=差旅费,2=非业务报销, 3=第三方付款,4=申请借支
      */
     private Integer type;
 
@@ -47,7 +47,7 @@ public class ExpenseAccount implements Serializable {
     private Integer status;
 
     /**
-     * 流程状态 0=巴员发起,1=巴主发起或审核,2=总经理审核,3=财务审核,4=董事长审核
+     * 流程状态 0=巴员发起,1=上级审核,2=财务审核,3=总经理审核,4=董事长审核
      */
     private Integer processStatus;
 
@@ -106,6 +106,11 @@ public class ExpenseAccount implements Serializable {
      */
     private Double duration;
 
+    /**
+     * 审核人员名称
+     */
+    private String examineName;
+
     private static final long serialVersionUID = 1L;
 
     public Integer getId() {
@@ -267,4 +272,12 @@ public class ExpenseAccount implements Serializable {
     public void setDuration(Double duration) {
         this.duration = duration;
     }
+
+    public String getExamineName() {
+        return examineName;
+    }
+
+    public void setExamineName(String examineName) {
+        this.examineName = examineName;
+    }
 }

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

@@ -7,9 +7,18 @@ public class OutExpenseAccountBo {
     private BigDecimal totalAmount;
     private Integer type;
     private Integer processStatus;
+    private String examineName;
     private String createTimeStr;
     private Integer status;
 
+    public String getExamineName() {
+        return examineName;
+    }
+
+    public void setExamineName(String examineName) {
+        this.examineName = examineName;
+    }
+
     public Integer getStatus() {
         return status;
     }

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

@@ -65,7 +65,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         Integer eaaid = expenseAccountPrivateMapper.selectByaidDefault(in.getAid());
         in.setEaaid(eaaid);
         expenseAccountMapper.insertSelective(in);
-        addExpenseAccountLogAndNoticEmail(in.getId(),0,"创建报销");
+        addExpenseAccountLogAndNoticEmail(in,0,"创建报销");
         return in.getId();
     }
 
@@ -85,17 +85,18 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         expenseAccountLogMapper.insertSelective(eaLog);
     }
 
-    private void addExpenseAccountLogAndNoticEmail(Integer eaid, Integer status, String str) {
+    private void addExpenseAccountLogAndNoticEmail(InputExpenseAccount in, Integer status, String str) {
         Date date=new Date();
         String aid=TokenManager.getAdminId();
-        addExpenseAccountLog(eaid,status,aid,str);
+        addExpenseAccountLog(in.getId(),status,aid,str);
         //日志写入用操作人,邮箱、微信订阅与站内信要的是发送方消息,即收件人
         AdminNoticeBo an = adminMapper.selectMyAndSuperBySuperId(aid);
         StringBuffer sb =new StringBuffer();
         if (status>0){
+            in.setExamineName(an.getSuperName());
             sb=sb.append("[").append(an.getName()).append("]").append(str).append(",请及时审核。");
             asyncUtils.addNoticAndEmail(NoticeStatus.EXPENSE_NOTICE.getCode(), an.getSuperId(),sb.toString());
-            weChatUtils.addExpenseAccountWeChatNotice(an.getExpenseOpenId(), 1, eaid, date, an.getName(),sb.toString());
+            weChatUtils.addExpenseAccountWeChatNotice(an.getExpenseOpenId(), 1, in.getId(), date, an.getName(),sb.toString());
         }
     }
 
@@ -115,9 +116,9 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         //计算总金额
         in.setTotalAmount(expenseAccountDetailsMapper.selectAmountCountByEAid(in.getId()));
         if (useEA.getStatus()==0){
-            addExpenseAccountLogAndNoticEmail(useEA.getId(),1,"发起报销审核");
+            addExpenseAccountLogAndNoticEmail(in,1,"发起报销审核");
         }else if (useEA.getStatus()==3){
-            addExpenseAccountLogAndNoticEmail(useEA.getId(),4,"修改并发起审核");
+            addExpenseAccountLogAndNoticEmail(in,4,"修改并发起审核");
         }
         return expenseAccountMapper.updateByPrimaryKeySelective(in);
     }
@@ -159,10 +160,10 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         //审核通知 获取发送人
         addExamineExpenseAccountLog(in, useEa, newEa);
         //完成申请
-        if (newEa.getStatus()==2){
+        if (in.getStatus()==2){
             //如果是借支则订单新增
 
-            if (useEa.getType()==4){
+            if (in.getType()==4){
 
             }else {
                 //不然就看是否挂载借支订单进行抵扣
@@ -182,39 +183,55 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
             str=str.append("您有报销需要审核,").append("报销编号[").append(in.getId()).append("]").append(",请查看并审核。");
             if(useEa.getProcessStatus()== EAProcessStatus.FQ.getCode()){
                 //获取上级
-                aids.add(adminMapper.selectByPrimaryKey(admin.getSuperiorId()));
+                Admin superAdmin = adminMapper.selectByPrimaryKey(admin.getSuperiorId());
+                aids.add(superAdmin);
                 newEa.setProcessStatus(EAProcessStatus.SJSH.getCode());
-
+                newEa.setUserNames(superAdmin.getName());
             }else if (useEa.getProcessStatus()== EAProcessStatus.SJSH.getCode()){
                 //获取财务负责人
-                aids.add(adminMapper.selectByPrimaryKey(admin.getDepFinance()));
+                Admin finaceAdmin = adminMapper.selectByPrimaryKey(admin.getDepFinance());
+                aids.add(finaceAdmin);
                 newEa.setProcessStatus(EAProcessStatus.CWSH.getCode());
+                newEa.setExamineName(finaceAdmin.getName());
             }else if (useEa.getProcessStatus()== EAProcessStatus.CWSH.getCode()){
                 //获取部门负责人
                 List<Admin> list = adminMapper.listAdminBydepIdAndRoleType(admin.getDepartmentId(), AFTConstants.SALESMAN_ADMIN);
                 if (!list.isEmpty())aids.addAll(list);
                 newEa.setProcessStatus(EAProcessStatus.ZJLSH.getCode());
+                newEa.setExamineName(getAdmins(list));
             }else if (useEa.getProcessStatus()== EAProcessStatus.ZJLSH.getCode()){
                 //获取总裁、董事长等审核
-                List<Admin> admins = adminMapper.selectAdminByRoleType(AFTConstants.All_CED_AND_CHAIRMAN);
-                if (!admins.isEmpty())aids.addAll(admins);
+                List<Admin> list = adminMapper.selectAdminByRoleType(AFTConstants.All_CED_AND_CHAIRMAN);
+                if (!list.isEmpty())aids.addAll(list);
                 newEa.setProcessStatus(EAProcessStatus.DSZSH.getCode());
+                newEa.setExamineName(getAdmins(list));
             }else if (useEa.getProcessStatus()== EAProcessStatus.DSZSH.getCode()){
                 //获取报销申请人
                 status =2;
                 aids.add(adminMapper.selectByPrimaryKey(admin.getId()));
                 newEa.setStatus(status);
+                newEa.setExamineName("");
                 str.setLength(0);
                 str=str.append("您的报销审核已通过,报销编号[").append(in.getId()).append("],请注意查看。");
             }
         }else {
             aids.add(adminMapper.selectByPrimaryKey(admin.getId()));
+            newEa.setStatus(3);
             str.setLength(0);
             str=str.append("您的报销审核已驳回,报销编号[").append(in.getId()).append("],请注意查看。");
         }
+        if (newEa.getStatus()==null)newEa.setStatus(1);
         addLogAndNoticeAndEmail(in,  status,str.toString(),admin.getName(),aids);
     }
 
+    private String getAdmins(List<Admin> list) {
+        StringBuffer str =new StringBuffer();
+        for (Admin admin : list) {
+            str=str.append(admin.getName()).append(",");
+        }
+        return str.substring(0,str.length()-1);
+    }
+
     private void addLogAndNoticeAndEmail(InputExpenseAccount in, Integer status, String str,String aname, List<Admin> aids) {
         Date date= new Date();
         addExpenseAccountLog(in.getId(),status,null,in.getReason());