dcs 2 月之前
父节点
当前提交
f5c96da8dc

+ 5 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/workark/model/Invoice.java

@@ -17,6 +17,11 @@ public class Invoice {
      */
     private long invoiceModelId;
 
+    /**
+     * 服务商id
+     */
+    private long providerId;
+
     /**
      * 组织id
      */

+ 3 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/workark/service/InvoiceService.java

@@ -5,6 +5,7 @@ import com.bosshand.virgo.api.workark.dao.InvoiceModelDao;
 import com.bosshand.virgo.api.workark.dao.OrderInfoDao;
 import com.bosshand.virgo.api.workark.model.Invoice;
 import com.bosshand.virgo.api.workark.model.InvoiceModel;
+import com.bosshand.virgo.api.workark.model.OrderInfo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -52,6 +53,8 @@ public class InvoiceService {
         if (od != null) {
             return od;
         }
+        OrderInfo o = orderInfoDao.getOrderNo(orderNo);
+        invoice.setAmount(o.getTotalFee());
         invoiceDao.save(invoice);
         return invoice;
     }

+ 13 - 2
virgo.api/src/main/resources/mapper/InvoiceMapper.xml

@@ -7,6 +7,7 @@
     <resultMap type="com.bosshand.virgo.api.workark.model.Invoice" id="result">
         <id column="id" property="id"/>
         <result column="invoiceModelId" property="invoiceModelId"/>
+        <result column="providerId" property="providerId"/>
         <result column="organizationId" property="organizationId"/>
         <result column="userId" property="userId"/>
         <result column="createTime" property="createTime"/>
@@ -39,6 +40,9 @@
             <if test="organizationId != 0">
                 and organizationId = #{organizationId}
             </if>
+            <if test="providerId != 0">
+                and providerId = #{providerId}
+            </if>
             <if test="userId != 0">
                 and userId = #{userId}
             </if>
@@ -81,6 +85,9 @@
             <if test="invoiceModelId != 0">
                 and invoiceModelId = #{invoiceModelId}
             </if>
+            <if test="providerId != 0">
+                and providerId = #{providerId}
+            </if>
             <if test="organizationId != 0">
                 and organizationId = #{organizationId}
             </if>
@@ -123,6 +130,9 @@
             <if test="p.invoiceModelId != 0">
                 and invoiceModelId = #{p.invoiceModelId}
             </if>
+            <if test="p.providerId != 0">
+                and providerId = #{p.providerId}
+            </if>
             <if test="p.organizationId != 0">
                 and organizationId = #{p.organizationId}
             </if>
@@ -161,14 +171,15 @@
     </select>
 
     <insert id="save" useGeneratedKeys="true" keyProperty="id">
-        INSERT INTO workark_invoice (`organizationId`, `userId`, `invoiceModelId`, `createTime`, `orderNo`, `type`, `name`, `taxpayerIdentificationNumber`, `address`, `phone`, `bankAccount`, `bankAccountNumber`, `content`, `amount`, `file`)
-        VALUES (#{organizationId}, #{userId}, #{invoiceModelId}, now(), #{orderNo}, #{type}, #{name}, #{taxpayerIdentificationNumber}, #{address}, #{phone}, #{bankAccount}, #{bankAccountNumber}, #{content}, #{amount}, #{file})
+        INSERT INTO workark_invoice (`providerId`, `organizationId`, `userId`, `invoiceModelId`, `createTime`, `orderNo`, `type`, `name`, `taxpayerIdentificationNumber`, `address`, `phone`, `bankAccount`, `bankAccountNumber`, `content`, `amount`, `file`)
+        VALUES (#{providerId}, #{organizationId}, #{userId}, #{invoiceModelId}, now(), #{orderNo}, #{type}, #{name}, #{taxpayerIdentificationNumber}, #{address}, #{phone}, #{bankAccount}, #{bankAccountNumber}, #{content}, #{amount}, #{file})
     </insert>
 
     <update id="update" parameterType="com.bosshand.virgo.api.workark.model.Invoice">
         UPDATE workark_invoice
         <trim prefix="set" suffixOverrides=",">
             <if test="invoiceModelId != 0">invoiceModelId = #{invoiceModelId},</if>
+            <if test="providerId != 0">providerId = #{providerId},</if>
             <if test="organizationId != 0">organizationId = #{organizationId},</if>
             <if test="userId != 0">userId = #{userId},</if>
             <if test="orderNo != null">orderNo = #{orderNo},</if>