Explorar o código

费用单报销单开发

anderx hai 1 ano
pai
achega
6980b28a37

+ 12 - 4
src/main/java/com/goafanti/admin/bo/AdminListBo.java

@@ -1,12 +1,11 @@
 package com.goafanti.admin.bo;
 
-import java.util.Date;
-import java.util.List;
-
+import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.model.Role;
 import org.apache.commons.lang3.time.DateFormatUtils;
 
-import com.goafanti.common.constant.AFTConstants;
+import java.util.Date;
+import java.util.List;
 
 public class AdminListBo {
 
@@ -122,6 +121,7 @@ public class AdminListBo {
 	 *  公出权限 0正常 1全部
 	 */
 	private Integer publicPurview;
+	private Integer expenseSuperExamine;
 
 	private String ambId;
 	private String ancestors;
@@ -131,6 +131,14 @@ public class AdminListBo {
 	private String ancestorsNames;
 	private String ambRole;
 
+	public Integer getExpenseSuperExamine() {
+		return expenseSuperExamine;
+	}
+
+	public void setExpenseSuperExamine(Integer expenseSuperExamine) {
+		this.expenseSuperExamine = expenseSuperExamine;
+	}
+
 	public String getDepFinance() {
 		return depFinance;
 	}

+ 10 - 10
src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java

@@ -1,25 +1,24 @@
 package com.goafanti.admin.service.impl;
 
-import java.util.*;
-
-import com.goafanti.common.dao.*;
-import com.goafanti.common.model.AmbSystem;
-import com.goafanti.common.model.Role;
-import com.goafanti.common.utils.AsyncUtils;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 import com.goafanti.admin.bo.AdminDetail;
 import com.goafanti.admin.bo.AdminListBo;
 import com.goafanti.admin.service.NewAdminService;
 import com.goafanti.common.constant.AFTConstants;
+import com.goafanti.common.dao.*;
 import com.goafanti.common.model.Admin;
+import com.goafanti.common.model.AmbSystem;
+import com.goafanti.common.model.Role;
 import com.goafanti.common.model.UserRole;
+import com.goafanti.common.utils.AsyncUtils;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
 
 @Service
 public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements NewAdminService {
@@ -107,6 +106,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 			TokenManager.clearUserAuthByUserId(ad.getId());
 		}
 		ad.setType(sumType(roleIds));
+		if (ad.getExpenseSuperExamine()==null)ad.setExpenseSuperExamine(0);
 		int count=adminMapper.updateByPrimaryKey(ad);
 		//
 		asyncUtils.pushRoleUpdateExamine(ad,useAdmin,roleIds,useRole);

+ 104 - 98
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -31,12 +31,13 @@
     <result column="senior_staff" jdbcType="INTEGER" property="seniorStaff" />
     <result column="public_purview" jdbcType="INTEGER" property="publicPurview" />
     <result column="expense_open_id" jdbcType="VARCHAR" property="expenseOpenId" />
+    <result column="expense_super_examine" jdbcType="INTEGER" property="expenseSuperExamine" />
   </resultMap>
   <sql id="Base_Column_List">
     id, mobile, `name`, `password`, email, create_time, `number`, province, `position`,
     superior_id, city, department_id, `status`, user_no, duty, district, head_portrait_url,
     contact_mobile, last_login_time, open_id, `type`, reviewer, amb_id, amb_role, amb_manage,
-    manager_id, senior_staff, public_purview, expense_open_id
+    manager_id, senior_staff, public_purview, expense_open_id, expense_super_examine
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select
@@ -48,34 +49,31 @@
     delete from admin
     where id = #{id,jdbcType=VARCHAR}
   </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.Admin">
-    insert into admin (id, mobile, `name`,
-      `password`, email, create_time,
-      `number`, province, `position`,
-      superior_id, city, department_id,
-      `status`, user_no, duty,
-      district, head_portrait_url, contact_mobile,
-      last_login_time, open_id, `type`,
-      reviewer, amb_id, amb_role,
-      amb_manage, manager_id, senior_staff,
-      public_purview, expense_open_id)
-    values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
-      #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
-      #{number,jdbcType=INTEGER}, #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
-      #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR},
-      #{status,jdbcType=VARCHAR}, #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR},
-      #{district,jdbcType=VARCHAR}, #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
-      #{lastLoginTime,jdbcType=TIMESTAMP}, #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
-      #{reviewer,jdbcType=VARCHAR}, #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR},
-      #{ambManage,jdbcType=INTEGER}, #{managerId,jdbcType=VARCHAR}, #{seniorStaff,jdbcType=INTEGER},
-      #{publicPurview,jdbcType=INTEGER}, #{expenseOpenId,jdbcType=VARCHAR})
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
+    insert into admin (mobile, `name`, `password`,
+      email, create_time, `number`,
+      province, `position`, superior_id,
+      city, department_id, `status`,
+      user_no, duty, district,
+      head_portrait_url, contact_mobile, last_login_time,
+      open_id, `type`, reviewer,
+      amb_id, amb_role, amb_manage,
+      manager_id, senior_staff, public_purview,
+      expense_open_id, expense_super_examine)
+    values (#{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
+      #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{number,jdbcType=INTEGER},
+      #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, #{superiorId,jdbcType=VARCHAR},
+      #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
+      #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR}, #{district,jdbcType=VARCHAR},
+      #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR}, #{lastLoginTime,jdbcType=TIMESTAMP},
+      #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{reviewer,jdbcType=VARCHAR},
+      #{ambId,jdbcType=VARCHAR}, #{ambRole,jdbcType=VARCHAR}, #{ambManage,jdbcType=INTEGER},
+      #{managerId,jdbcType=VARCHAR}, #{seniorStaff,jdbcType=INTEGER}, #{publicPurview,jdbcType=INTEGER},
+      #{expenseOpenId,jdbcType=VARCHAR}, #{expenseSuperExamine,jdbcType=INTEGER})
   </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin">
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
     insert into admin
     <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
       <if test="mobile != null">
         mobile,
       </if>
@@ -160,11 +158,11 @@
       <if test="expenseOpenId != null">
         expense_open_id,
       </if>
+      <if test="expenseSuperExamine != null">
+        expense_super_examine,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=VARCHAR},
-      </if>
       <if test="mobile != null">
         #{mobile,jdbcType=VARCHAR},
       </if>
@@ -249,6 +247,9 @@
       <if test="expenseOpenId != null">
         #{expenseOpenId,jdbcType=VARCHAR},
       </if>
+      <if test="expenseSuperExamine != null">
+        #{expenseSuperExamine,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
@@ -338,6 +339,9 @@
       <if test="expenseOpenId != null">
         expense_open_id = #{expenseOpenId,jdbcType=VARCHAR},
       </if>
+      <if test="expenseSuperExamine != null">
+        expense_super_examine = #{expenseSuperExamine,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -370,7 +374,8 @@
       manager_id = #{managerId,jdbcType=VARCHAR},
       senior_staff = #{seniorStaff,jdbcType=INTEGER},
       public_purview = #{publicPurview,jdbcType=INTEGER},
-      expense_open_id = #{expenseOpenId,jdbcType=VARCHAR}
+      expense_open_id = #{expenseOpenId,jdbcType=VARCHAR},
+      expense_super_examine = #{expenseSuperExamine,jdbcType=INTEGER}
     where id = #{id,jdbcType=VARCHAR}
   </update>
 
@@ -378,6 +383,7 @@
 
 
 
+
   <select id="selectAllAdmin" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />
@@ -755,7 +761,7 @@
   <select id="selectAllByid" parameterType="java.lang.String" resultType="com.goafanti.common.model.Admin">
     select a.id, a.mobile, a.name, a.`password`, a.email, a.create_time as createTime,
            a.province, a.`position`,a.reviewer , a.superior_id as superiorId,a.public_purview publicPurview,
-           a.department_id as departmentId, a.status,a.user_no as userNo,a.duty,a.district,
+           a.department_id as departmentId, a.status,a.user_no as userNo,a.duty,a.district,a.expense_super_examine expenseSuperExamine,
            a.head_portrait_url as headPortraitUrl, a.contact_mobile as contactMobile,a.senior_staff seniorStaff,
            b.name superior,c.name reviewerName,a.type,a.amb_id ambId,a.manager_id managerId ,d.name managerName
     from admin a left join admin b on a.superior_id =b.id left join admin c on a.reviewer =c.id
@@ -912,14 +918,14 @@
 
   <select id="getDeptNameByAid" parameterType="java.lang.String" resultType="com.goafanti.admin.bo.AdminListBo">
     select a.id,a.name, d.name as departmentName,a.department_id departmentId,a.email,a.superior_id superiorId,a.open_id openId,
-           a.reviewer,d.manager_id depManager,d.finance_id depFinance,a.public_purview publicPurview
+           a.reviewer,d.manager_id depManager,d.finance_id depFinance,a.public_purview publicPurview,a.expense_super_examine expenseSuperExamine
     from admin a left join department d on a.department_id = d.id
     where a.id = #{_parameter,jdbcType=VARCHAR}
   </select>
 
   <insert id="addAdminContacts" parameterType="com.goafanti.admin.bo.AdminContacts">
     insert into admin_contacts (id,aid,contacts_id)values
-    (#{id,jdbcType=VARCHAR},#{aid,jdbcType=VARCHAR},#{contactsId,jdbcType=VARCHAR})
+      (#{id,jdbcType=VARCHAR},#{aid,jdbcType=VARCHAR},#{contactsId,jdbcType=VARCHAR})
   </insert>
 
 
@@ -1162,8 +1168,8 @@
 
   <select id="selectMyAndSuperBySuperId" parameterType="java.lang.String" resultType="com.goafanti.common.bo.AdminNoticeBo">
     select
-    a.id,a.name,a.email,a.open_id openId,a.expense_open_id expenseOpenId,
-    b.id superId,b.name superName,b.email superEmail,b.open_id superOpenId,b.expense_open_id superExpenseOpenId
+      a.id,a.name,a.email,a.open_id openId,a.expense_open_id expenseOpenId,
+      b.id superId,b.name superName,b.email superEmail,b.open_id superOpenId,b.expense_open_id superExpenseOpenId
     from admin a left join admin b on a.superior_id=b.id
     where  a.id=#{id}
   </select>
@@ -1246,7 +1252,7 @@
   <select id="selectFinanceAdminByAid" resultType="com.goafanti.common.model.Admin">
     select c.id,c.name,c.open_id openId,c.email
     from admin  a left join department b on a.department_id=b.id
-    left join admin c on b.finance_id=c.id
+                  left join admin c on b.finance_id=c.id
     where a.id= #{aid}
   </select>
   <select id="adminStatisticsInfo" resultType="com.goafanti.admin.bo.AdminStatisticsBo">
@@ -1254,19 +1260,19 @@
     from (select aid ,sum(private_count)privateSum ,sum(channel_count)channelSum ,sum(sign_count)signSum ,
                  sum(public_release_count)publicReleaseSum ,sum(follow_count) followSum,sum(order_count) orderSum
           from admin_user_count a where aid=#{aid} group by aid)x
-    left join(select a.salesman_id aid , sum(if( b.project_status =29,1,0))projectStopSum ,
-            sum(if(b.check_status=1,1,0))projectCheckSum from t_order_new a left join t_order_task b
-            on a.order_no =b.order_no where a.salesman_id =  #{aid})y on x.aid=y.aid
-    left join (  select salesman_id aid,  sum(1)orderSum, sum(if(delete_sign=2,1,0))changeSum
-            from t_order_new where delete_sign in (0,2,3) and process_status >0
-            and salesman_id =  #{aid})g on x.aid=g.aid
-    left join (  select salesman_id aid,  sum(if(order_status=3 or order_status=5,1,0))rejectSum
-            from t_order_new where delete_sign in (0,2,3)
-            and salesman_id =  #{aid})z on x.aid=z.aid
-    left join (  SELECT b.salesman_id aid ,sum(a.money)  receivables
-                 from new_order_dun a left join t_order_new b on a.order_no =b.order_no
-                 where a.status =1   and b.delete_sign in (0,2,3)
-                   and b.salesman_id = #{aid})t on x.aid=t.aid
+           left join(select a.salesman_id aid , sum(if( b.project_status =29,1,0))projectStopSum ,
+                            sum(if(b.check_status=1,1,0))projectCheckSum from t_order_new a left join t_order_task b
+                                                                                                      on a.order_no =b.order_no where a.salesman_id =  #{aid})y on x.aid=y.aid
+           left join (  select salesman_id aid,  sum(1)orderSum, sum(if(delete_sign=2,1,0))changeSum
+                        from t_order_new where delete_sign in (0,2,3) and process_status >0
+                                           and salesman_id =  #{aid})g on x.aid=g.aid
+           left join (  select salesman_id aid,  sum(if(order_status=3 or order_status=5,1,0))rejectSum
+                        from t_order_new where delete_sign in (0,2,3)
+                                           and salesman_id =  #{aid})z on x.aid=z.aid
+           left join (  SELECT b.salesman_id aid ,sum(a.money)  receivables
+                        from new_order_dun a left join t_order_new b on a.order_no =b.order_no
+                        where a.status =1   and b.delete_sign in (0,2,3)
+                          and b.salesman_id = #{aid})t on x.aid=t.aid
   </select>
 
   <select id="adminStatisticsInfoByTime" resultType="com.goafanti.admin.bo.AdminStatisticsBo">
@@ -1308,11 +1314,11 @@
   </select>
   <select id="adminStatisticsPublicReleaseByAidAndTime" resultType="java.lang.Integer">
     select sum(1) rangePublicReleaseSum
-     from public_release a left join public_release_details b on a.id=b.prid
-     where status =2 and a.aid =  #{aid}
-       and((a.release_start &gt;  #{startTime} and a.release_start &lt;  #{endTime})or
-           (a.release_end &gt;  #{startTime} and a.release_end &lt;  #{endTime})or
-           (a.release_start &lt;  #{startTime} and a.release_end &gt;  #{endTime}))
+    from public_release a left join public_release_details b on a.id=b.prid
+    where status =2 and a.aid =  #{aid}
+      and((a.release_start &gt;  #{startTime} and a.release_start &lt;  #{endTime})or
+          (a.release_end &gt;  #{startTime} and a.release_end &lt;  #{endTime})or
+          (a.release_start &lt;  #{startTime} and a.release_end &gt;  #{endTime}))
   </select>
   <select id="addAdminContactsRangeReceivables" resultType="java.math.BigDecimal">
     SELECT  ifnull(sum(a.money),0)  receivables
@@ -1324,14 +1330,14 @@
   <select id="consultantStatisticsInfo" resultType="com.goafanti.admin.bo.ConsultantStatisticsBo">
     SELECT x.aid,x.projectCount,x.inProgress,x.complete,x.notStarted,x.stop,y.countPublicRelease,y.countAssist,z.countChange,v.orderPayment
     from (select a.task_receiver aid,sum(commodity_quantity) projectCount, sum(if(a.project_status=1,commodity_quantity,0)) inProgress,
-         sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete, sum(if(a.project_status=0,commodity_quantity,0)) notStarted,
-         sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop
+    sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete, sum(if(a.project_status=0,commodity_quantity,0)) notStarted,
+    sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop
     from t_order_task a left join t_order_new b on a.order_no =b.order_no
     where b.delete_sign in (0,2,3) and  a.split_status in (0,2) and a.task_receiver = #{aid} group by a.task_receiver)x
     left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) countPublicRelease,sum(if(a.`type` in (3),1,0)) countAssist
-        from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid})y on x.aid=y.aid
+    from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid})y on x.aid=y.aid
     left join (SELECT b.aid,count(DISTINCT a.order_no) countChange from new_order_change a
-        left join order_examine b on a.order_no =b.order_no where 1=1
+    left join order_examine b on a.order_no =b.order_no where 1=1
     <if test="type==2">
       and a.process_state in (3,4)
     </if>
@@ -1343,53 +1349,53 @@
     </if>
     and b.aid=#{aid} and b.status =0  group by b.aid)z on x.aid=z.aid
     LEFT join (select b.task_receiver aid, count(*) orderPayment from t_order_payment a
-        left join t_order_task b on a.tid=b.id left join t_order_new c on b.order_no=c.order_no
-        where b.task_receiver= #{aid} and a.status in(0,1,2) group by b.task_receiver )v on x.aid=v.aid
+    left join t_order_task b on a.tid=b.id left join t_order_new c on b.order_no=c.order_no
+    where b.task_receiver= #{aid} and a.status in(0,1,2) group by b.task_receiver )v on x.aid=v.aid
   </select>
   <select id="consultantStatisticsInfoByTime" resultType="com.goafanti.admin.bo.ConsultantStatisticsBo">
     select a.id,x.projectCount,x.inProgress,x.notStarted,y.complete,y.stop,z.countPublicRelease,z.countAssist
     from admin a left join (select a.task_receiver aid,sum(commodity_quantity) projectCount,
-        sum(if(a.project_status=1,commodity_quantity,0)) inProgress,
-        sum(if(a.project_status=0,commodity_quantity,0)) notStarted from t_order_task a  where a.split_status in (0,2)
-        and a.task_receiver = #{aid} and a.task_distribution_time BETWEEN #{startTime} and #{endTime} group by a.task_receiver )x on a.id=x.aid
-    left join (SELECT a.task_receiver aid,sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete,
-        sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop from t_order_task a left join task_time b on a.id=b.tid
-        where a.split_status in (0,2) and b.project_status =a.project_status and a.task_receiver = #{aid}
-        and b.date_time  BETWEEN #{startTime} and #{endTime} group by a.task_receiver )y on a.id=y.aid
-    left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) countPublicRelease,sum(if(a.`type` in (3),1,0)) countAssist
-        from public_release a left join public_release_details b on a.id=b.prid where aid=  #{aid} and a.status =2
-        and a.release_start BETWEEN #{startTime} and #{endTime} group by a.aid)z on a.id=z.aid
+                                   sum(if(a.project_status=1,commodity_quantity,0)) inProgress,
+                                   sum(if(a.project_status=0,commodity_quantity,0)) notStarted from t_order_task a  where a.split_status in (0,2)
+                                                                                                                      and a.task_receiver = #{aid} and a.task_distribution_time BETWEEN #{startTime} and #{endTime} group by a.task_receiver )x on a.id=x.aid
+                 left join (SELECT a.task_receiver aid,sum(if(a.project_status in (19,27) ,commodity_quantity,0)) complete,
+                                   sum(if(a.project_status in (2,3,29),commodity_quantity,0)) stop from t_order_task a left join task_time b on a.id=b.tid
+                            where a.split_status in (0,2) and b.project_status =a.project_status and a.task_receiver = #{aid}
+                              and b.date_time  BETWEEN #{startTime} and #{endTime} group by a.task_receiver )y on a.id=y.aid
+                 left join (select aid,sum(if(a.`type` in (0,1,2),1,0)) countPublicRelease,sum(if(a.`type` in (3),1,0)) countAssist
+                            from public_release a left join public_release_details b on a.id=b.prid where aid=  #{aid} and a.status =2
+                                                                                                      and a.release_start BETWEEN #{startTime} and #{endTime} group by a.aid)z on a.id=z.aid
     where a.id=#{aid}
   </select>
   <select id="consultantthisMonthUser" resultType="com.goafanti.admin.bo.ConsultantUserCount">
     select x.dates,sum(projectCount)projectCount,sum(inProgress)inProgress,sum(notStarted)notStarted
          ,0 complete,0 stop,0 countPublicRelease,0 countAssist
     from (select commodity_quantity projectCount, if(a.project_status=1,commodity_quantity,0)inProgress,
-        if(a.project_status=0,commodity_quantity,0)notStarted,DATE_FORMAT(a.task_distribution_time,'%Y-%m-%d') dates
-        from t_order_task a  where a.split_status in (0,2) and a.task_receiver = #{aid}
-        and a.task_distribution_time BETWEEN #{firstDay} and #{endDay})x
+                 if(a.project_status=0,commodity_quantity,0)notStarted,DATE_FORMAT(a.task_distribution_time,'%Y-%m-%d') dates
+          from t_order_task a  where a.split_status in (0,2) and a.task_receiver = #{aid}
+                                 and a.task_distribution_time BETWEEN #{firstDay} and #{endDay})x
     group by x.dates
     union
     select x.dates,0 projectCount,0 inProgress,0 notStarted,sum(complete)complete,sum(stop)stop,0,0
     from (SELECT if(a.project_status in (19,27) ,commodity_quantity,0) complete,
-        if(a.project_status in (2,3,29),commodity_quantity,0) stop ,DATE_FORMAT(b.date_time ,'%Y-%m-%d') dates
-        from t_order_task a left join task_time b on a.id=b.tid
-        where a.split_status in (0,2) and b.project_status =a.project_status
-        and a.task_receiver = #{aid} and b.date_time  BETWEEN #{firstDay} and #{endDay})x
+                 if(a.project_status in (2,3,29),commodity_quantity,0) stop ,DATE_FORMAT(b.date_time ,'%Y-%m-%d') dates
+          from t_order_task a left join task_time b on a.id=b.tid
+          where a.split_status in (0,2) and b.project_status =a.project_status
+            and a.task_receiver = #{aid} and b.date_time  BETWEEN #{firstDay} and #{endDay})x
     group by x.dates
     union
     select x.dates,0,0,0,0,0,sum(countPublicRelease)countPublicRelease,sum(countAssist)countAssist
     from ( select if(a.`type` in (0,1,2),1,0) countPublicRelease,if(a.`type` in (3),1,0) countAssist,
-        DATE_FORMAT(a.release_start ,'%Y-%m-%d') dates
-    from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid}
-    and a.status =2
-    and a.release_start  BETWEEN #{firstDay} and #{endDay})x
+                  DATE_FORMAT(a.release_start ,'%Y-%m-%d') dates
+           from public_release a left join public_release_details b on a.id=b.prid where aid= #{aid}
+                                                                                     and a.status =2
+                                                                                     and a.release_start  BETWEEN #{firstDay} and #{endDay})x
     group by x.dates
   </select>
   <select id="selectOrderByFinanace" resultType="com.goafanti.common.model.Admin">
     select c.id,c.name
     from t_order_new a left join department b on a.order_dep=b.id
-    left join admin c on b.finance_id=c.id
+                       left join admin c on b.finance_id=c.id
     where a.order_no =#{orderNo};
   </select>
   <select id="selectAdminByRoleTypes" resultType="com.goafanti.common.model.Admin">
@@ -1402,24 +1408,24 @@
       #{e}
     </foreach>
   </select>
-    <select id="financeInfo" resultType="com.goafanti.admin.bo.OutFinanceCount">
-      select x.aid,x.orderCount,x.expenseCount,x.invoiceCount,x.memberCount,x.paymentCount,b.counts publicCount,y.orderUnauditedCount,
-             c.counts receivables,y.expenseUnauditedCount,y.invoiceUnauditedCount,y.memberUnauditedCount,y.paymentUnauditedCount
-      from ( select a.aid,sum(a.order_count)orderCount ,sum(a.expense_count)expenseCount ,SUM(a.invoice_count) invoiceCount,
-            sum(a.member_count) memberCount ,sum(a.payment_count)paymentCount from finance_count a where a.aid= #{aid} )x
-      left join(select aid,sum(if(a.`type` in (0,1,2),1,0)) counts from public_release a left join public_release_details b on a.id=b.prid
-          where a.status=2 and  a.aid= #{aid} )b  on x.aid=b.aid
-      left join (SELECT c.finance_id aid,sum(a.money) counts from new_order_dun a left join t_order_new b on a.order_no =b.order_no
-            left join department c on b.order_dep =c.id where a.status =1   and b.delete_sign in (0,2,3) and c.finance_id = #{aid} )c on x.aid=c.aid
-      left join (select a.aid,sum(a.order_unaudited_count)orderUnauditedCount , sum(a.expense_unaudited_count)expenseUnauditedCount ,
-            SUM(a.invoice_unaudited_count) invoiceUnauditedCount, sum(a.member_unaudited_count) memberUnauditedCount ,
-            sum(a.payment_unaudited_count)paymentUnauditedCount from finance_count a where a.aid= #{aid}
-            and a.date_time BETWEEN #{startTime}  and #{endTime} group by a.aid)y on x.aid=y.aid
-    </select>
+  <select id="financeInfo" resultType="com.goafanti.admin.bo.OutFinanceCount">
+    select x.aid,x.orderCount,x.expenseCount,x.invoiceCount,x.memberCount,x.paymentCount,b.counts publicCount,y.orderUnauditedCount,
+           c.counts receivables,y.expenseUnauditedCount,y.invoiceUnauditedCount,y.memberUnauditedCount,y.paymentUnauditedCount
+    from ( select a.aid,sum(a.order_count)orderCount ,sum(a.expense_count)expenseCount ,SUM(a.invoice_count) invoiceCount,
+                  sum(a.member_count) memberCount ,sum(a.payment_count)paymentCount from finance_count a where a.aid= #{aid} )x
+           left join(select aid,sum(if(a.`type` in (0,1,2),1,0)) counts from public_release a left join public_release_details b on a.id=b.prid
+                     where a.status=2 and  a.aid= #{aid} )b  on x.aid=b.aid
+           left join (SELECT c.finance_id aid,sum(a.money) counts from new_order_dun a left join t_order_new b on a.order_no =b.order_no
+                                                                                       left join department c on b.order_dep =c.id where a.status =1   and b.delete_sign in (0,2,3) and c.finance_id = #{aid} )c on x.aid=c.aid
+           left join (select a.aid,sum(a.order_unaudited_count)orderUnauditedCount , sum(a.expense_unaudited_count)expenseUnauditedCount ,
+                             SUM(a.invoice_unaudited_count) invoiceUnauditedCount, sum(a.member_unaudited_count) memberUnauditedCount ,
+                             sum(a.payment_unaudited_count)paymentUnauditedCount from finance_count a where a.aid= #{aid}
+                                                                                                        and a.date_time BETWEEN #{startTime}  and #{endTime} group by a.aid)y on x.aid=y.aid
+  </select>
   <select id="financeCountRangeReceivables" resultType="java.math.BigDecimal">
     SELECT  ifnull(sum(a.money),0)  receivables
     from new_order_dun a left join t_order_new b on a.order_no =b.order_no
-        left join department c on b.order_dep =c.id
+                         left join department c on b.order_dep =c.id
     where a.status =1   and b.delete_sign in (0,2,3)
       and c.finance_id = #{aid}
       and a.start_time  between #{startTime} and #{endTime}
@@ -1430,7 +1436,7 @@
     from new_order_change a left join t_order_new b on a.order_no =b.order_no
                             left join department c on b.order_dep =c.id
     where a.process_state in (6,8,9) and a.status in(1,2) and b.delete_sign in (0,2,3)
-    and  c.finance_id = #{aid}
+      and  c.finance_id = #{aid}
 
   </select>
   <select id="selectFinanceReceivablesCount" resultType="java.math.BigDecimal">

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

@@ -492,7 +492,7 @@
     </if>
   </select>
   <sql id="selectExpenseAccountSql">
-    where 1=1 and a.status &lt; 4
+    where 1=1
     <if test="processStatus ==1">
       and a.process_status>0
       <if test="examineStatus ==1">

+ 13 - 0
src/main/java/com/goafanti/common/model/Admin.java

@@ -150,6 +150,11 @@ public class Admin extends BaseModel implements AftUser {
      */
     private String expenseOpenId;
 
+    /**
+     * 报销上级审核 0-不需要 ,1-需要
+     */
+    private Integer expenseSuperExamine;
+
     private static final long serialVersionUID = 1L;
 
 
@@ -430,4 +435,12 @@ public class Admin extends BaseModel implements AftUser {
     public void setExpenseOpenId(String expenseOpenId) {
         this.expenseOpenId = expenseOpenId;
     }
+
+    public Integer getExpenseSuperExamine() {
+        return expenseSuperExamine;
+    }
+
+    public void setExpenseSuperExamine(Integer expenseSuperExamine) {
+        this.expenseSuperExamine = expenseSuperExamine;
+    }
 }

+ 30 - 7
src/main/java/com/goafanti/expenseAccount/bo/OutExpenseAccountBo.java

@@ -1,37 +1,60 @@
 package com.goafanti.expenseAccount.bo;
 
+import com.goafanti.common.utils.excel.Excel;
+
 import java.math.BigDecimal;
 
 public class OutExpenseAccountBo {
     private Integer id;
-    private BigDecimal totalAmount;
     private BigDecimal amount;
     private Integer type;
+    @Excel(name = "类型")
     private String typeOther;
+    @Excel(name = "报销金额")
+    private BigDecimal totalAmount;
+    @Excel(name = "实报金额")
+    private BigDecimal realAmount;
+    @Excel(name = "报销编号")
+    private String checkNo;
+    @Excel(name = "报销至订单")
+    private String targetName;
+    private String depName;
     private Integer secondaryType;
     private String secondaryTypeOther;
     private Integer processStatus;
     private Integer eaeType;
     private String examineName;
-    private String createTimeStr;
+    @Excel(name = "报销人")
     private String aname;
+    @Excel(name = "财务负责人")
+    private String financeName;
+    @Excel(name = "状态",readConverterExp = "0=草稿,1=审核中,2=完成,3=驳回,4=删除")
+    private Integer status;
+    @Excel(name = "申请公司")
     private String applyDepName;
+    @Excel(name = "支付公司")
     private String payDepName;
-    private Integer status;
+    @Excel(name = "报销时间")
+    private String createTimeStr;
     private Integer targetType;
     private String  releaseStartStr;
     private String releaseEndStr;
     private Integer mainId;
 
     private String contractNo;
-    private String checkNo;
     private String userNames;
     private String buyerName;
-    private String depName;
-    private String financeName;
+
     private String attachmentUrl;
     private Integer examine;
-    private BigDecimal realAmount;
+
+    public String getTargetName() {
+        return targetName;
+    }
+
+    public void setTargetName(String targetName) {
+        this.targetName = targetName;
+    }
 
     public BigDecimal getAmount() {
         return amount;

+ 25 - 0
src/main/java/com/goafanti/expenseAccount/controller/ExpenseAccountController.java

@@ -52,6 +52,18 @@ public class ExpenseAccountController extends CertifyApiController {
         return res;
     }
 
+    /**
+     * 删除报销
+     * @param id
+     * @return
+     */
+    @RequestMapping(value = "/delete",method = RequestMethod.POST)
+    public Result delete(String id){
+        Result res =new Result();
+        res.setData(expenseAccountService.delete(id));
+        return res;
+    }
+
 
     /**
      * 新增私有报销帐号
@@ -112,6 +124,19 @@ public class ExpenseAccountController extends CertifyApiController {
         res.setData(expenseAccountService.pageList(in));
         return res;
     }
+
+    /**
+     * 费用单列表导出
+     * @param in
+     * @return
+     */
+    @RequestMapping(value = "/pageListExport",method = RequestMethod.GET)
+    public Result pageListExport(InputPageListBo in ){
+        Result res =new Result();
+        in.setPageSize(999999);
+        res.setData(expenseAccountService.pageListExport(in));
+        return res;
+    }
     /**
      * 报销详情列表
      * @return

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

@@ -1,6 +1,7 @@
 package com.goafanti.expenseAccount.service;
 
 import com.goafanti.common.model.ExpenseAccount;
+import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.expenseAccount.bo.*;
 
 import java.math.BigDecimal;
@@ -23,7 +24,7 @@ public interface ExpenseAccountService {
 
     int updateExamine(InputExpenseAccount in);
 
-    Object pageList(InputPageListBo in);
+    Pagination<?> pageList(InputPageListBo in);
 
     Object selectByPrid(InputExpenseAccount in);
 
@@ -61,4 +62,8 @@ public interface ExpenseAccountService {
     void pushAll();
 
     Object updateDebitId(InputExpenseAccount in);
+
+    Object delete(String id);
+
+    Object pageListExport(InputPageListBo in);
 }

+ 53 - 3
src/main/java/com/goafanti/expenseAccount/service/impl/ExpenseAccountServiceImpl.java

@@ -12,6 +12,7 @@ import com.goafanti.common.enums.NoticeTypes;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.*;
 import com.goafanti.common.utils.*;
+import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.JDBCIdGenerator;
 import com.goafanti.core.mybatis.page.Pagination;
@@ -23,6 +24,7 @@ import com.goafanti.expenseAccount.bo.*;
 import com.goafanti.expenseAccount.service.ExpenseAccountService;
 import com.goafanti.organization.bo.OrganizationListOut;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.cache.annotation.CacheEvict;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
@@ -67,6 +69,8 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
 
 
 
+    @Value(value = "${upload.path}")
+    private final String	uploadPath			= null;
 
 
 
@@ -273,6 +277,45 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         return 1;
     }
 
+    @Override
+    public Object delete(String ids) {
+        String[] split = ids.split(",");
+        for (String s : split) {
+            Integer id=Integer.valueOf(s);
+            ExpenseAccount expenseAccount = expenseAccountMapper.selectByPrimaryKey(id);
+            if (expenseAccount.getStatus()!=0&&expenseAccount.getStatus()!=3){
+                throw new BusinessException("该费用单状态无法删除");
+            }
+            ExpenseAccount update =new ExpenseAccount();
+            update.setId(id);
+            update.setStatus(4);
+            expenseAccountMapper.updateByPrimaryKeySelective(update);
+        }
+
+        return 1;
+    }
+
+    @Override
+    public Object pageListExport(InputPageListBo in) {
+        List<OutExpenseAccountBo> list = (List<OutExpenseAccountBo>) pageList(in).getList();
+        for (OutExpenseAccountBo e : list) {
+            if (e.getTargetType()!=null){
+                if (e.getTargetType()==0){
+                    e.setTargetName("固定费用");
+                }else {
+                    e.setTargetName(e.getContractNo()+"-"+e.getBuyerName());
+                }
+            }
+            if (e.getType()!=0){
+                e.setTypeOther(EATypes.getDescByCode(e.getType()));
+            }else{
+                e.setTypeOther(String.format("其他(%s)",e.getTypeOther()));
+            }
+        }
+        NewExcelUtil excelUtil=new NewExcelUtil(OutExpenseAccountBo.class);
+        return excelUtil.exportExcel(list,"费用单列表",uploadPath);
+    }
+
 
     private void pushResettingDebit(InputExpenseAccount in, Integer debitId) {
         ExpenseAccount debit = expenseAccountMapper.selectByPrimaryKey(debitId);
@@ -583,6 +626,15 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
         if (list==null)list = expenseConfigDetailsMapper.selectByDepId(newEa.getApplyDep());
         List<ExpenseAccountExamine> examineList=new ArrayList<>();
         if (newEa.getProcessStatus()<EAProcessStatus.CWFS.getCode()){
+            if (newEa.getProcessStatus()==EAProcessStatus.SJSH.getCode()){
+                if (admin.getExpenseSuperExamine()==0){
+                    Date date = new Date();
+                    date.setTime(date.getTime()+1000l);
+                    addExpenseAccountLog(newEa.getId(),1,newEa.getProcessStatus(),"1","未设置[上级审核]需求,跳过此流程",date);
+                    newEa.setProcessStatus(newEa.getProcessStatus()+1);
+                }
+
+            }
             //获取当前流程审核人,如果有已审核则跳过当前审核
             examineList = expenseAccountExamineMapper.selectByEaidAndProcessStatus(newEa.getId(), newEa.getProcessStatus());
             boolean flag=false;
@@ -696,8 +748,6 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
 
             }
         }
-
-
         examineList=expenseAccountExamineMapper.selectByEaidAndProcessStatus(newEa.getId(), newEa.getProcessStatus());
         return examineList;
     }
@@ -762,7 +812,7 @@ public class ExpenseAccountServiceImpl extends BaseMybatisDao<ExpenseAccountMapp
     }
 
     @Override
-    public Object pageList(InputPageListBo in) {
+    public Pagination<?> pageList(InputPageListBo in) {
         Map<String ,Object> param=new HashMap<>();
         addParam(in, param);
         Pagination<?> pagePlus = findPagePlus("selectExpenseAccountList",