Browse Source

新增开票日志,修改新增、修改、审核、特批审核等接口。

anderx 3 years ago
parent
commit
409891b41d

+ 17 - 0
src/main/java/com/goafanti/common/dao/InvoiceLogMapper.java

@@ -0,0 +1,17 @@
+package com.goafanti.common.dao;
+
+import com.goafanti.common.model.InvoiceLog;
+
+public interface InvoiceLogMapper {
+    int deleteByPrimaryKey(Integer id);
+
+    int insert(InvoiceLog record);
+
+    int insertSelective(InvoiceLog record);
+
+    InvoiceLog selectByPrimaryKey(Integer id);
+
+    int updateByPrimaryKeySelective(InvoiceLog record);
+
+    int updateByPrimaryKey(InvoiceLog record);
+}

+ 4 - 1
src/main/java/com/goafanti/common/dao/TOrderInvoiceMapper.java

@@ -3,6 +3,7 @@ package com.goafanti.common.dao;
 import com.goafanti.common.model.TOrderInvoice;
 import com.goafanti.common.model.TOrderInvoiceExample;
 import com.goafanti.order.bo.InvoiceBo;
+import com.goafanti.order.bo.OutInvoiceLog;
 import com.goafanti.order.bo.TOrderInvoiceDetails;
 
 import java.math.BigDecimal;
@@ -86,4 +87,6 @@ public interface TOrderInvoiceMapper {
 	List<InvoiceBo> selectByOrderNo(String orderNo);
 
 	TOrderInvoiceDetails getInvoiceDetails(String orderNo);
-}
+
+	List<OutInvoiceLog>  selectInvoiceLog(Integer id);
+}

+ 93 - 0
src/main/java/com/goafanti/common/mapper/InvoiceLogMapper.xml

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.goafanti.common.dao.InvoiceLogMapper">
+  <resultMap id="BaseResultMap" type="com.goafanti.common.model.InvoiceLog">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="invoice_id" jdbcType="INTEGER" property="invoiceId" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="aid" jdbcType="VARCHAR" property="aid" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, invoice_id, `status`, aid, create_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from invoice_log
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from invoice_log
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.goafanti.common.model.InvoiceLog">
+    insert into invoice_log (id, invoice_id, `status`,
+      aid, create_time)
+    values (#{id,jdbcType=INTEGER}, #{invoiceId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
+      #{aid,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.InvoiceLog" >
+    insert into invoice_log
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="invoiceId != null">
+        invoice_id,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="aid != null">
+        aid,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="invoiceId != null">
+        #{invoiceId,jdbcType=INTEGER},
+      </if>
+      <if test="status != null">
+        #{status,jdbcType=INTEGER},
+      </if>
+      <if test="aid != null">
+        #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.InvoiceLog">
+    update invoice_log
+    <set>
+      <if test="invoiceId != null">
+        invoice_id = #{invoiceId,jdbcType=INTEGER},
+      </if>
+      <if test="status != null">
+        `status` = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="aid != null">
+        aid = #{aid,jdbcType=VARCHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.InvoiceLog">
+    update invoice_log
+    set invoice_id = #{invoiceId,jdbcType=INTEGER},
+      `status` = #{status,jdbcType=INTEGER},
+      aid = #{aid,jdbcType=VARCHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 53 - 47
src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml

@@ -109,9 +109,9 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Fri May 17 09:46:50 CST 2019.
     -->
-    id, order_no, type, status, reject_reason, remarks, invoice_type, unit_name, tax_number, 
-    amount, banks, content, unit_address, invoice_remarks, unit_mobile, voucher_url, 
-    post, addressee, addressee_mobile, addressee_province, addressee_city, addressee_area, 
+    id, order_no, type, status, reject_reason, remarks, invoice_type, unit_name, tax_number,
+    amount, banks, content, unit_address, invoice_remarks, unit_mobile, voucher_url,
+    post, addressee, addressee_mobile, addressee_province, addressee_city, addressee_area,
     recipient_address, create_time, update_time, approval, already_amount
   </sql>
   <select id="selectByExample" parameterType="com.goafanti.common.model.TOrderInvoiceExample" resultMap="BaseResultMap">
@@ -139,7 +139,7 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Fri May 17 09:46:50 CST 2019.
     -->
-    select 
+    select
     <include refid="Base_Column_List" />
     from t_order_invoice
     where id = #{id,jdbcType=INTEGER}
@@ -170,28 +170,28 @@
       This element is automatically generated by MyBatis Generator, do not modify.
       This element was generated on Fri May 17 09:46:50 CST 2019.
     -->
-    insert into t_order_invoice (id, order_no, type, 
-      status, reject_reason, remarks, 
-      invoice_type, unit_name, tax_number, 
-      amount, banks, content, 
-      unit_address, invoice_remarks, unit_mobile, 
-      voucher_url, post, addressee, 
-      addressee_mobile, addressee_province, addressee_city, 
-      addressee_area, recipient_address, create_time, 
+    insert into t_order_invoice (id, order_no, type,
+      status, reject_reason, remarks,
+      invoice_type, unit_name, tax_number,
+      amount, banks, content,
+      unit_address, invoice_remarks, unit_mobile,
+      voucher_url, post, addressee,
+      addressee_mobile, addressee_province, addressee_city,
+      addressee_area, recipient_address, create_time,
       update_time, approval, already_amount
       )
-    values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, 
-      #{status,jdbcType=INTEGER}, #{rejectReason,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}, 
-      #{invoiceType,jdbcType=INTEGER}, #{unitName,jdbcType=VARCHAR}, #{taxNumber,jdbcType=VARCHAR}, 
-      #{amount,jdbcType=DECIMAL}, #{banks,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, 
-      #{unitAddress,jdbcType=VARCHAR}, #{invoiceRemarks,jdbcType=VARCHAR}, #{unitMobile,jdbcType=VARCHAR}, 
-      #{voucherUrl,jdbcType=VARCHAR}, #{post,jdbcType=INTEGER}, #{addressee,jdbcType=VARCHAR}, 
-      #{addresseeMobile,jdbcType=VARCHAR}, #{addresseeProvince,jdbcType=INTEGER}, #{addresseeCity,jdbcType=INTEGER}, 
-      #{addresseeArea,jdbcType=INTEGER}, #{recipientAddress,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, 
+    values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
+      #{status,jdbcType=INTEGER}, #{rejectReason,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR},
+      #{invoiceType,jdbcType=INTEGER}, #{unitName,jdbcType=VARCHAR}, #{taxNumber,jdbcType=VARCHAR},
+      #{amount,jdbcType=DECIMAL}, #{banks,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
+      #{unitAddress,jdbcType=VARCHAR}, #{invoiceRemarks,jdbcType=VARCHAR}, #{unitMobile,jdbcType=VARCHAR},
+      #{voucherUrl,jdbcType=VARCHAR}, #{post,jdbcType=INTEGER}, #{addressee,jdbcType=VARCHAR},
+      #{addresseeMobile,jdbcType=VARCHAR}, #{addresseeProvince,jdbcType=INTEGER}, #{addresseeCity,jdbcType=INTEGER},
+      #{addresseeArea,jdbcType=INTEGER}, #{recipientAddress,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
       #{updateTime,jdbcType=TIMESTAMP}, #{approval,jdbcType=INTEGER}, #{alreadyAmount,jdbcType=DECIMAL}
       )
   </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderInvoice">
+  <insert id="insertSelective" parameterType="com.goafanti.common.model.TOrderInvoice" keyColumn="id" keyProperty="id"  useGeneratedKeys="true">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
@@ -642,13 +642,13 @@
   <select id="financeOrderInvoiceList" resultType="com.goafanti.order.bo.TOrderInvoiceBo">
       	  select a.id,a.unit_name as unitName,a.order_no as orderNo,c.name,b.project_status as projectStatus,a.amount,
      ifnull(d.sumAmount,0) as sumAmount, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')as createTime ,a.status,b.process_status processStatus,
-     b.settlement_amount as settlementAmount, (b.total_amount-b.settlement_amount) as notAmount from t_order_invoice a 
+     b.settlement_amount as settlementAmount, (b.total_amount-b.settlement_amount) as notAmount from t_order_invoice a
 	left join t_order_new b on a.order_no=b.order_no left join admin c on b.salesman_id=c.id
 	left join (select order_no,sum(amount)as  sumAmount from t_order_invoice where status =2 group by order_no) d
-	on a.order_no=d.order_no left join department e on b.order_dep=e.id 
-	where a.status in (1,2) and a.approval in (0,2) 
+	on a.order_no=d.order_no left join department e on b.order_dep=e.id
+	where a.status in (1,2) and a.approval in (0,2)
 	<if test="type !=null">
-	and a.`type`= #{type,jdbcType=INTEGER} 
+	and a.`type`= #{type,jdbcType=INTEGER}
 	</if>
 	<if test="financeId !=null">
 	and e.finance_id= #{financeId,jdbcType=VARCHAR}
@@ -669,7 +669,7 @@
 	and a.approval= #{approval,jdbcType=INTEGER}
 	</if>
 	<if test="aDep !=null">
-	and b.order_dep in 
+	and b.order_dep in
 	 <foreach collection="aDep" index="index" item="depid" open="(" separator="," close=")">
             #{depid}
         </foreach>
@@ -679,15 +679,15 @@
 			${page_sql}
 	</if>
   </select>
-  
+
   <select id="financeOrderInvoiceCount" resultType="java.lang.Integer">
-  	select count(*) from t_order_invoice a 
-	left join t_order_new b on a.order_no=b.order_no 
+  	select count(*) from t_order_invoice a
+	left join t_order_new b on a.order_no=b.order_no
 	left join admin c on b.salesman_id=c.id
 	 left join department e on b.order_dep=e.id
-	where a.status in (1,2) and a.approval in (0,2) 
+	where a.status in (1,2) and a.approval in (0,2)
 	<if test="type !=null">
-	and a.`type`= #{type,jdbcType=INTEGER} 
+	and a.`type`= #{type,jdbcType=INTEGER}
 	</if>
 	<if test="financeId !=null">
 	and e.finance_id= #{financeId,jdbcType=VARCHAR}
@@ -708,16 +708,16 @@
 	and a.approval= #{approval,jdbcType=INTEGER}
 	</if>
 	<if test="aDep !=null">
-	and b.order_dep in 
+	and b.order_dep in
 	 <foreach collection="aDep" index="index" item="depid" open="(" separator="," close=")">
             #{depid}
         </foreach>
 	</if>
   </select>
-  
+
   <select id="salesmanOrderInvoiceList" resultType="com.goafanti.order.bo.TOrderInvoiceBo">
     select a.id ,a.order_no as orderNo,b.contract_no contractNo,a.amount,date_format(a.create_time,'%Y-%m-%d %H:%i:%S') as createTime,
-	a.reject_reason as  rejectReason,a.status ,a.approval from t_order_invoice a left join t_order_new b 
+	a.reject_reason as  rejectReason,a.status ,a.approval from t_order_invoice a left join t_order_new b
 	on a.order_no=b.order_no where a.status !=4
 	<if test="orderNo !=null">
 	and a.order_no = #{orderNo,jdbcType=VARCHAR}
@@ -727,22 +727,22 @@
 			${page_sql}
 	</if>
   </select>
-  
+
   <select id="salesmanOrderInvoiceCount" resultType="java.lang.Integer">
    select count(*) from t_order_invoice where status !=4
 	<if test="orderNo !=null">
 	and order_no = #{orderNo,jdbcType=VARCHAR}
 	</if>
   </select>
-  
+
   <select id="approvalOrderInvoiceList" resultType="com.goafanti.order.bo.TOrderInvoiceBo">
       	select a.id,a.unit_name as unitName,a.order_no as orderNo,c.name,b.project_status as projectStatus,a.amount,b.process_status processStatus,
      ifnull(d.sumAmount,0) as sumAmount, date_format(a.create_time,'%Y-%m-%d %H:%i:%S')as createTime ,a.status, a.approval,
-     b.settlement_amount as settlementAmount, (b.total_amount-b.settlement_amount) as notAmount from t_order_invoice a 
+     b.settlement_amount as settlementAmount, (b.total_amount-b.settlement_amount) as notAmount from t_order_invoice a
 	left join t_order_new b on a.order_no=b.order_no left join admin c on b.salesman_id=c.id
 	left join (select order_no,sum(amount)as  sumAmount from t_order_invoice where status =2 group by order_no) d
 	on a.order_no=d.order_no where 1=1
-	<if test="status ==null"> 
+	<if test="status ==null">
 	and a.status in(1,2)
 	</if>
 	<if test="status != null">
@@ -777,12 +777,12 @@
 			${page_sql}
 	</if>
   </select>
-  
+
   <select id="approvalOrderInvoiceCount" resultType="java.lang.Integer">
-  	   select count(*) from t_order_invoice a 
+  	   select count(*) from t_order_invoice a
 	left join t_order_new b on a.order_no=b.order_no left join admin c on b.salesman_id=c.id
 	where  1=1
-	<if test="status ==null"> 
+	<if test="status ==null">
 	and a.status in(1,2)
 	</if>
 	<if test="status != null">
@@ -813,28 +813,28 @@
 	and c.department_id= #{aDep,jdbcType=VARCHAR}
 	</if>
   </select>
-  
+
   <select id="selectByInvoiceDitails" parameterType="java.lang.Integer"  resultType="com.goafanti.order.bo.TOrderInvoiceDetails">
     	select a.id ,a.order_no as orderNo,a.`type`,a.status,a.reject_reason as rejectReason,a.remarks,a.invoice_type as invoiceType,
 	a.unit_name as unitName,a.tax_number as taxNumber,a.amount,a.banks,a.content,a.unit_address as unitAddress,
 	a.invoice_remarks as invoiceRemarks,a.unit_mobile as unitMobile,a.voucher_url as voucherUrl ,a.post,a.addressee,
 	a.addressee_area as addresseeArea,a.addressee_city as addresseeCity,a.addressee_province as addresseeProvince,
 	a.addressee_mobile as addresseeMobile,a.recipient_address as recipientAddress,a.create_time,a.update_time,a.approval,
-	a.already_amount as alreadyAmount,b.contract_no as contractNo from t_order_invoice a 
+	a.already_amount as alreadyAmount,b.contract_no as contractNo from t_order_invoice a
 	left join t_order_new b on a.order_no=b.order_no
     where id = #{id,jdbcType=INTEGER}
   </select>
-  
+
   <select id="getInvoiceDetails" parameterType="java.lang.String"  resultType="com.goafanti.order.bo.TOrderInvoiceDetails">
     	select a.id ,a.order_no as orderNo,a.`type`,a.status,a.reject_reason as rejectReason,a.remarks,a.invoice_type as invoiceType,
 	a.unit_name as unitName,a.tax_number as taxNumber,a.amount,a.banks,a.content,a.unit_address as unitAddress,
 	a.invoice_remarks as invoiceRemarks,a.unit_mobile as unitMobile,a.voucher_url as voucherUrl ,a.post,a.addressee,
 	a.addressee_area as addresseeArea,a.addressee_city as addresseeCity,a.addressee_province as addresseeProvince,
 	a.addressee_mobile as addresseeMobile,a.recipient_address as recipientAddress,a.create_time,a.update_time,a.approval,
-	a.already_amount as alreadyAmount,b.contract_no as contractNo from t_order_invoice a 
+	a.already_amount as alreadyAmount,b.contract_no as contractNo from t_order_invoice a
 	left join t_order_new b on a.order_no=b.order_no
     where a.order_no= #{orderNo,jdbcType=VARCHAR}
-    and a.create_time=(select max(create_time) from t_order_invoice where order_no= #{orderNo,jdbcType=VARCHAR}) 
+    and a.create_time=(select max(create_time) from t_order_invoice where order_no= #{orderNo,jdbcType=VARCHAR})
   </select>
   <select id="conutAmountByOrderNo"  resultType="java.math.BigDecimal">
   select ifnull(sum(a.amount),0) amount from t_order_invoice a
@@ -844,4 +844,10 @@
   select date_format(a.create_time,'%Y-%m-%d %H:%i:%S') createTime,a.amount from t_order_invoice a
 where a.status=2 and a.order_no=  #{orderNo,jdbcType=VARCHAR}
   </select>
-</mapper>
+  <select id="selectInvoiceLog" resultType="com.goafanti.order.bo.OutInvoiceLog">
+    select a.id,a.invoice_id invoiceId ,a.status,a.aid,a.create_time createTime,
+           b.name adminName,date_format(a.create_time,'%Y-%m-%d %H:%i:%S')as createTimes
+    from invoice_log a left join admin b on a.aid =b.id
+    where a.invoice_id =#{id} order by a.create_time
+  </select>
+</mapper>

+ 92 - 0
src/main/java/com/goafanti/common/model/InvoiceLog.java

@@ -0,0 +1,92 @@
+package com.goafanti.common.model;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * invoice_log
+ * @author
+ */
+public class InvoiceLog implements Serializable {
+    /**
+     * 日志id
+     */
+    private Integer id;
+
+    /**
+     * 开票id
+     */
+    private Integer invoiceId;
+
+    /**
+     * 0发起 1开票通过 2开票拒绝 3特批通过 4特批拒绝 5修改提交
+     */
+    private Integer status;
+
+    /**
+     * 操作人
+     */
+    private String aid;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    private static final long serialVersionUID = 1L;
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getInvoiceId() {
+        return invoiceId;
+    }
+
+    public void setInvoiceId(Integer invoiceId) {
+        this.invoiceId = invoiceId;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getAid() {
+        return aid;
+    }
+
+    public void setAid(String aid) {
+        this.aid = aid;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     *
+     * @param invoiceId
+     * @param status
+     * @param aid
+     */
+    public InvoiceLog(Integer invoiceId, Integer status, String aid) {
+        this.invoiceId = invoiceId;
+        this.status = status;
+        this.aid = aid;
+    }
+
+    public InvoiceLog() {
+    }
+}

+ 28 - 0
src/main/java/com/goafanti/order/bo/OutInvoiceLog.java

@@ -0,0 +1,28 @@
+package com.goafanti.order.bo;
+
+import com.goafanti.common.model.InvoiceLog;
+
+import java.util.Date;
+
+public class OutInvoiceLog extends InvoiceLog {
+
+    private String  createTimes;
+
+    private String  adminName;
+
+    public String getAdminName() {
+        return adminName;
+    }
+
+    public void setAdminName(String adminName) {
+        this.adminName = adminName;
+    }
+
+    public String getCreateTimes() {
+        return createTimes;
+    }
+
+    public void setCreateTimes(String createTimes) {
+        this.createTimes = createTimes;
+    }
+}

+ 17 - 16
src/main/java/com/goafanti/order/controller/AdminOrderReceivablesApiController.java

@@ -44,7 +44,7 @@ import com.goafanti.order.service.OrderReceivablesService;
 @RestController
 @RequestMapping(value = "/api/admin/receivables")
 public class AdminOrderReceivablesApiController extends CertifyApiController {
-	
+
 	@Resource
 	private OrderReceivablesService orderReceivablesService;
 	@Resource
@@ -121,7 +121,7 @@ public class AdminOrderReceivablesApiController extends CertifyApiController {
 		}
 		return res;
 	}
-	
+
 	@RequestMapping(value ="/listReceivables",method = RequestMethod.GET)
 	public Result listReceivables(ReceivablesListBo rl,Integer status,String adminName,String adminDepId,String orderDepId,Integer pageSize,Integer pageNo){
 		Result res = new Result();
@@ -135,8 +135,8 @@ public class AdminOrderReceivablesApiController extends CertifyApiController {
 	}
 	/**
 	 * 	处理批量导入(批量回款)
-	 * 
-	 * 
+	 *
+	 *
 	 */
 	@RequestMapping(value ="/batchImport",method = RequestMethod.POST)
 	public Result batchImport(){
@@ -149,10 +149,10 @@ public class AdminOrderReceivablesApiController extends CertifyApiController {
 		}
 		return res;
 	}
-	
+
 	/**
 	 * 	下载回款批量导入Excel模板
-     * 
+     *
      * @param response
      * @return
      */
@@ -178,8 +178,7 @@ public class AdminOrderReceivablesApiController extends CertifyApiController {
     }
 	/**
 	 * 	Excel批量导入回款
-     * 
-     * @param response
+     *
      * @return
      */
     @RequestMapping(value = "/import" , method = RequestMethod.POST)
@@ -196,13 +195,13 @@ public class AdminOrderReceivablesApiController extends CertifyApiController {
         	  return res;
           }
     	orderReceivablesService.batchListReceivables(file);
-         res.data(1); 
+         res.data(1);
     	return res;
     }
-    
+
     /**
 	 * 	导出回款
-     * 
+     *
      * @param response
      * @return
      */
@@ -217,10 +216,10 @@ public class AdminOrderReceivablesApiController extends CertifyApiController {
     	NewExcelUtil<OrderListBo>excel=new NewExcelUtil<>(OrderListBo.class);
 		 return  excel.exportExcel(list,"订单回款列表",response);
     	}
-    
+
     /**
 	 * 	导出开票
-     * 
+     *
      * @param response
      * @return
      */
@@ -230,11 +229,11 @@ public class AdminOrderReceivablesApiController extends CertifyApiController {
 		@SuppressWarnings("unchecked")
     	List<TOrderInvoiceBo>list=(List<TOrderInvoiceBo>) orderInvoiceService.salesmanOrderInvoiceList( orderNo, pageNo,pageSize).getList();
     	NewExcelUtil<TOrderInvoiceBo>excel=new NewExcelUtil<>(TOrderInvoiceBo.class);
-		 return  excel.exportExcel(list,"订单"+orderNo+"开票列表",response); 
+		 return  excel.exportExcel(list,"订单"+orderNo+"开票列表",response);
     }
     /**
 	 * 	导出流水
-     * 
+     *
      * @param response
      * @return
      */
@@ -244,6 +243,8 @@ public class AdminOrderReceivablesApiController extends CertifyApiController {
     	@SuppressWarnings("unchecked")
 		List<TOrderBillNew>list=(List<TOrderBillNew>) orderBillService.myBillList(billNew,pageNo, pageSize).getList();
     	NewExcelUtil<TOrderBillNew>excel=new NewExcelUtil<>(TOrderBillNew.class);
-		 return  excel.exportExcel(list,"订单流水列表",response); 
+		 return  excel.exportExcel(list,"订单流水列表",response);
     }
+
+
 }

+ 6 - 8
src/main/java/com/goafanti/order/service/OrderInvoiceService.java

@@ -5,18 +5,19 @@ package com.goafanti.order.service;
 import com.goafanti.common.model.TOrderInvoice;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.order.bo.InputOrderInvoiceBo;
+import com.goafanti.order.bo.OutInvoiceLog;
 import com.goafanti.order.bo.TOrderInvoiceBo;
 import com.goafanti.order.bo.TOrderInvoiceDetails;
 
+import java.util.List;
+
 public interface OrderInvoiceService {
 	/**
 	 * 创建发票申请
-	 * @param uid
-	 * @param orderType
 	 * @return
 	 */
 	int createServiceOrder(TOrderInvoice t);
-	
+
 	/**
 	 * 修改发票申请
 	 * @return
@@ -25,7 +26,7 @@ public interface OrderInvoiceService {
 
 	boolean checkAmount(TOrderInvoice t);
 
-	
+
 
 	Pagination<TOrderInvoiceBo>  financeOrderInvoiceList(InputOrderInvoiceBo o, Integer pageNo, Integer pageSize);
 
@@ -42,9 +43,6 @@ public interface OrderInvoiceService {
 
 	TOrderInvoiceDetails getInvoiceDetails(String orderNo);
 
-	
 
-	
-	
-	
+    List<OutInvoiceLog> InvoiceLog(Integer id);
 }

+ 31 - 13
src/main/java/com/goafanti/order/service/impl/OrderInvoiceServiceImpl.java

@@ -8,17 +8,14 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import com.goafanti.order.bo.TOrderNewBo;
+import com.goafanti.common.dao.*;
+import com.goafanti.common.model.InvoiceLog;
+import com.goafanti.order.bo.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.goafanti.common.constant.AFTConstants;
-import com.goafanti.common.dao.AdminMapper;
-import com.goafanti.common.dao.OrganizationManagementMapper;
-import com.goafanti.common.dao.TOrderInvoiceMapper;
-import com.goafanti.common.dao.TOrderMidMapper;
-import com.goafanti.common.dao.TOrderNewMapper;
 import com.goafanti.common.enums.NoticeStatus;
 import com.goafanti.common.model.Admin;
 import com.goafanti.common.model.TOrderInvoice;
@@ -26,9 +23,6 @@ import com.goafanti.common.model.TOrderNew;
 import com.goafanti.core.mybatis.BaseMybatisDao;
 import com.goafanti.core.mybatis.page.Pagination;
 import com.goafanti.core.shiro.token.TokenManager;
-import com.goafanti.order.bo.InputOrderInvoiceBo;
-import com.goafanti.order.bo.TOrderInvoiceBo;
-import com.goafanti.order.bo.TOrderInvoiceDetails;
 import com.goafanti.order.service.OrderInvoiceService;
 import com.goafanti.order.service.OrderNewService;
 
@@ -47,18 +41,32 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 	private OrderNewService	orderNewService;
 	@Autowired
 	private TOrderMidMapper	tOrderMidMapper;
+	@Autowired
+	private InvoiceLogMapper invoiceLogMapper;
+
 	@Override
 	public int createServiceOrder(TOrderInvoice o) {
 		o.setCreateTime(new Date());
 		sendNoticeAndEmail(o);
-		return tOrderInvoiceMapper.insertSelective(o);
+		 Integer i=tOrderInvoiceMapper.insertSelective(o);
+		addInvoiceLog(o.getId(),0);
+		return i;
 	}
 
-
+	/**
+	 *
+	 * @param id 开票编号
+	 * @param status  0发起 1开票通过 2开票拒绝 3特批通过 4特批拒绝 5修改提交
+	 */
+	void addInvoiceLog(Integer id, Integer status){
+		InvoiceLog log = new InvoiceLog(id,status,TokenManager.getAdminId());
+		invoiceLogMapper.insertSelective(log);
+	}
 
 	@Override
 	public int updateServiceOrder(TOrderInvoice o) {
 		sendNoticeAndEmail(o);
+		addInvoiceLog(o.getId(),5);
 		return tOrderInvoiceMapper.updateByPrimaryKeySelective(o);
 	}
 	/**
@@ -150,6 +158,8 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 	}
 
 
+
+
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<TOrderInvoiceBo> salesmanOrderInvoiceList( String orderNo,
@@ -176,12 +186,14 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 			if(t2.getApproval()==2)t.setApproval(1);
 			type=NoticeStatus.ORDER_INVPICE_NO.getCode();
 			aids.add(o.getSalesmanId());
+			addInvoiceLog(id,2);
 		}else if(examine==2) {
 			type=NoticeStatus.ORDER_INVPICE_END.getCode();
 			aids.add(o.getSalesmanId());
 			//重新计算开票金额
-
+			addInvoiceLog(id,1);
 		}
+
 		TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t2.getOrderNo());
 		orderNewService.pushGeneralSendNoticeAndEmail(aids, type,order, TokenManager.getAdminId(),0);
 		tOrderInvoiceMapper.updateByPrimaryKeySelective(t);
@@ -235,8 +247,10 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 		t.setStatus(examine);
 		type= NoticeStatus.ORDER_INVPICE_APPROVA_NO.getCode();
 		aids.add(ts.getSalesmanId());
+			addInvoiceLog(id,4);
 		}else {
 			t.setApproval(examine);
+			addInvoiceLog(id,3);
 			type= NoticeStatus.ORDER_INVPICE_APPROVA_YES.getCode();
 			if (o.getType()==0) {
 				aids.add(organizationManagementMapper.selectByPrimaryKey(ts.getOrderDep()).getFinanceId());
@@ -249,5 +263,9 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 		orderNewService.pushGeneralSendNoticeAndEmail(aids,type,order, TokenManager.getAdminId(),0);
 		return tOrderInvoiceMapper.updateByPrimaryKeySelective(t);
 	}
-
+	@Override
+	public List<OutInvoiceLog> InvoiceLog(Integer id) {
+		List<OutInvoiceLog>  list=tOrderInvoiceMapper.selectInvoiceLog(id);
+		return list;
+	}
 }