Forráskód Böngészése

Merge branch 'test' of jishutao/kede-server into prod

anderx 3 éve%!(EXTRA string=óta)
szülő
commit
b9aafa8520

+ 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>

+ 73 - 53
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.
@@ -640,15 +640,22 @@
 	</if>
   </select>
   <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 
-	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) 
+    select a.id,a.unit_name as unitName,a.order_no as orderNo,c.name,b.project_status as projectStatus,a.amount,a.approval,
+    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
+    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 b.delete_sign in (0,2)
+    <if test="all ==0">
+      and a.status in (1,2)
+      and a.approval in (0,2)
+    </if>
+    <if test="all ==1">
+      and a.status in (1,2,3)
+    </if>
 	<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 +676,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 +686,22 @@
 			${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 b.delete_sign in (0,2)
+    <if test="all ==0">
+      and a.status in (1,2)
+      and a.approval in (0,2)
+    </if>
+    <if test="all ==1">
+      and a.status in (1,2,3)
+    </if>
 	<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 +722,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 +741,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"> 
+	on a.order_no=d.order_no where b.delete_sign in (0,2)
+	<if test="status ==null">
 	and a.status in(1,2)
 	</if>
 	<if test="status != null">
@@ -777,12 +791,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"> 
+	where  b.delete_sign in (0,2)
+	<if test="status ==null">
 	and a.status in(1,2)
 	</if>
 	<if test="status != null">
@@ -813,28 +827,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 +858,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() {
+    }
+}

+ 13 - 3
src/main/java/com/goafanti/order/bo/InputOrderInvoiceBo.java

@@ -7,6 +7,16 @@ public class InputOrderInvoiceBo {
 	private Integer type;
 	private Integer approval;
 	private Integer status;
+	private Integer all;
+
+	public Integer getAll() {
+		return all;
+	}
+
+	public void setAll(Integer all) {
+		this.all = all;
+	}
+
 	public String getOrderDep() {
 		return orderDep;
 	}
@@ -43,7 +53,7 @@ public class InputOrderInvoiceBo {
 	public void setStatus(Integer status) {
 		this.status = status;
 	}
-	
-	
-	
+
+
+
 }

+ 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);
     }
+
+
 }

+ 26 - 37
src/main/java/com/goafanti/order/controller/OrderInvoiceApiController.java

@@ -21,18 +21,16 @@ import com.goafanti.order.service.OrderInvoiceService;
 @RestController
 @RequestMapping(value = "/api/admin/orderInvoice")
 public class OrderInvoiceApiController extends CertifyApiController {
-	
+
 	@Autowired
 	private OrderInvoiceService		orderInvoiceService;
-	
+
 	/**
 	 * 创建发票申请
-	 * @param uid
-	 * @param orderType
 	 * @return
 	 */
 	@RequestMapping(value = "/createOrderInvoice",method = RequestMethod.POST)
-	public Result createOrderInvoice(TOrderInvoice t,Integer submit ){
+	public Result createOrderInvoice(TOrderInvoice t){
 		Result res = new Result();
 		if(t==null||null==t.getInvoiceType()||StringUtils.isBlank(t.getTaxNumber())||
 				null==t.getAmount()||null==t.getBanks()||StringUtils.isBlank(t.getContent())
@@ -50,12 +48,10 @@ public class OrderInvoiceApiController extends CertifyApiController {
 		res.data(orderInvoiceService.createServiceOrder(t));
 		return res;
 	}
-	
-	
+
+
 	/**
 	   *   发票申请详情
-	 * @param uid
-	 * @param orderType
 	 * @return
 	 */
 	@RequestMapping(value = "/selectByIdOrderInvoice",method = RequestMethod.GET)
@@ -65,14 +61,12 @@ public class OrderInvoiceApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","ID"));
 			return res;
 		}
-		
+
 		res.data(orderInvoiceService.selectByIdOrderInvoice(id));
 		return res;
 	}
 	/**
 	 * 获取最新开票详情
-	 * @param uid
-	 * @param orderType
 	 * @return
 	 */
 	@RequestMapping(value = "/getInvoiceDetails",method = RequestMethod.GET)
@@ -82,14 +76,12 @@ public class OrderInvoiceApiController extends CertifyApiController {
 			res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"","订单编号"));
 			return res;
 		}
-		
+
 		res.data(orderInvoiceService.getInvoiceDetails(orderNo));
 		return res;
 	}
 	/**
 	 * 修改发票申请
-	 * @param uid
-	 * @param orderType
 	 * @return
 	 */
 	@RequestMapping(value = "/updateOrderInvoice",method = RequestMethod.POST)
@@ -110,42 +102,36 @@ public class OrderInvoiceApiController extends CertifyApiController {
 		res.data(orderInvoiceService.updateServiceOrder(t));
 		return res;
 	}
-	
-	
+
+
 	/**
 	 *  财务开票列表
-	 * @param uid
-	 * @param orderType
 	 * @return
 	 */
 	@RequestMapping(value = "/financeOrderInvoiceList",method = RequestMethod.GET)
 	public Result financeOrderInvoiceList(InputOrderInvoiceBo o,Integer pageNo,Integer pageSize){
 		Result res = new Result();
-		
+
 		res.data(orderInvoiceService.financeOrderInvoiceList( o,pageNo,pageSize));
 		return res;
 	}
-	
-	
-	
+
+
+
 	/**
 	 *  开票特批列表
-	 * @param uid
-	 * @param orderType
 	 * @return
 	 */
 	@RequestMapping(value = "/approvalOrderInvoiceList",method = RequestMethod.GET)
 	public Result approvalOrderInvoiceList(Integer status,Integer approval,Integer type,String orderDep,String orderNo ,String name,String userName,Integer pageNo,Integer pageSize){
 		Result res = new Result();
-		
+
 		res.data(orderInvoiceService.approvalOrderInvoiceList( status,approval,type, orderDep, orderNo, name,userName,pageNo,pageSize));
 		return res;
 	}
-	
+
 	/**
 	 *   开票审核
-	 * @param uid
-	 * @param orderType
 	 * @return
 	 */
 	@RequestMapping(value = "/financeExamine",method = RequestMethod.POST)
@@ -163,11 +149,9 @@ public class OrderInvoiceApiController extends CertifyApiController {
 		res.data(orderInvoiceService.updatefinanceExamine( id, examine, reason));
 		return res;
 	}
-	
+
 	/**
 	 *   特批审核
-	 * @param uid
-	 * @param orderType
 	 * @return
 	 */
 	@RequestMapping(value = "/approvalExamine",method = RequestMethod.POST)
@@ -185,11 +169,9 @@ public class OrderInvoiceApiController extends CertifyApiController {
 		res.data(orderInvoiceService.updateapprovalExamine( id, examine, reason));
 		return res;
 	}
-	
+
 	/**
 	 *   订单开票列表
-	 * @param uid
-	 * @param orderType
 	 * @return
 	 */
 	@RequestMapping(value = "/salesmanOrderInvoiceList",method = RequestMethod.GET)
@@ -202,7 +184,7 @@ public class OrderInvoiceApiController extends CertifyApiController {
 		res.data(orderInvoiceService.salesmanOrderInvoiceList(  orderNo, pageNo,pageSize));
 		return res;
 	}
-	
+
 	/** 开票文件上传 **/
 	@RequestMapping(value = "/uploadOrderInvoiceFile", method = RequestMethod.POST)
 	public Result uploadOrderInvoiceFile(HttpServletRequest req,String sign){
@@ -211,5 +193,12 @@ public class OrderInvoiceApiController extends CertifyApiController {
 		res.setData(handleFile(res, "/order_invoice_file/", false, req, sign));
 		return res;
 	}
-	
+
+	@RequestMapping(value = "/invoice/log",method = RequestMethod.GET)
+	public Result InvoiceLog(Integer id){
+		Result res = new Result();
+		res .data(orderInvoiceService.InvoiceLog(id));
+		return res;
+	}
+
 }

+ 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);
 }

+ 45 - 16
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,37 @@ 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);
+		//前端直接会直接调取上一个发起数据给新开票,防止前一个数据为审核后
+		if (o.getApproval()==2)o.setApproval(1);
+		if (o.getStatus()!=1)o.setStatus(1);
+		 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);
+		o.setApproval(1);
+		o.setStatus(1);
 		return tOrderInvoiceMapper.updateByPrimaryKeySelective(o);
 	}
 	/**
@@ -117,6 +130,7 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 		//财务专员查看自己的
 		if (TokenManager.hasRole(AFTConstants.FINANCE)) {
 			params.put("financeId", TokenManager.getAdminId());
+
 		}
 		//财务经理
 		if (TokenManager.hasRole(AFTConstants.FINANCE_MANAGER)) {
@@ -130,11 +144,17 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 			Admin a=adminMapper.selectByPrimaryKey(TokenManager.getAdminId());
 			aDep.add(a.getDepartmentId());
 			params.put("aDep", aDep);
+
+		}
+		if (null !=o.getAll()){
+			params.put("all",o.getAll());
+		}else {
+			params.put("all",0);
 		}
 		if(StringUtils.isNotBlank(o.getOrderNo()))params.put("orderNo", o.getOrderNo());
 		if(StringUtils.isNotBlank(o.getName()))params.put("name", o.getName());
-		if(null==o.getApproval())params.put("approval", o.getApproval());
-		if(null==o.getStatus())params.put("status", o.getStatus());
+		if(null!=o.getApproval())params.put("approval", o.getApproval());
+		if(null!=o.getStatus())params.put("status", o.getStatus());
 		return (Pagination<TOrderInvoiceBo>)findPage("financeOrderInvoiceList", "financeOrderInvoiceCount", params, pageNo, pageSize);
 
 	}
@@ -150,6 +170,8 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 	}
 
 
+
+
 	@SuppressWarnings("unchecked")
 	@Override
 	public Pagination<TOrderInvoiceBo> salesmanOrderInvoiceList( String orderNo,
@@ -173,15 +195,16 @@ public class OrderInvoiceServiceImpl extends BaseMybatisDao<TOrderInvoiceMapper>
 		TOrderNew o=tOrderNewMapper.selectByPrimaryKey(t2.getOrderNo());
 		Integer type=null;
 		if(examine==3){
-			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 +258,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 +274,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;
+	}
 }

+ 1 - 1
src/main/resources/props/config_test.properties

@@ -43,7 +43,7 @@ user_remind_days=15
 #提前提醒天数
 user_channel_days=90
 
-static.host=//static.jishutao.com/1.2.09
+static.host=//static.jishutao.com/1.2.11
 portal.host=//static.jishutao.com/portal/2.0.6
 avatar.host=//static.jishutao.com
 avatar.upload.host=//static.jishutao.com/upload