dcs 1 năm trước cách đây
mục cha
commit
196bb46711

+ 0 - 48
virgo.api/src/main/java/com/bosshand/virgo/api/controller/InvoiceController.java

@@ -1,48 +0,0 @@
-package com.bosshand.virgo.api.controller;
-
-
-import com.bosshand.virgo.api.model.Invoice;
-import com.bosshand.virgo.api.service.InvoiceService;
-import com.bosshand.virgo.core.response.Response;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-@RestController
-@RequestMapping({"invoice"})
-@Api(tags = {"发票管理"})
-public class InvoiceController {
-
-    @Autowired
-    InvoiceService invoiceService;
-
-    @ApiOperation("保存")
-    @RequestMapping(value = "", method = RequestMethod.POST)
-    public Response insert(@RequestBody Invoice invoice) {
-        invoiceService.insert(invoice);
-        return Response.ok();
-    }
-
-    @ApiOperation("获取")
-    @RequestMapping(value = "/list", method = RequestMethod.POST)
-    public Response getList(@RequestBody Invoice invoice) {
-        return Response.ok(invoiceService.getList(invoice));
-    }
-
-    @ApiOperation("更新")
-    @RequestMapping(value = "/update", method = RequestMethod.PUT)
-    public Response update(@RequestBody Invoice invoice) {
-        invoiceService.update(invoice);
-        return Response.ok();
-    }
-
-    @ApiOperation("删除")
-    @RequestMapping(value = "/delete/{id}", method = RequestMethod.DELETE)
-    public Response delete(@PathVariable long id) {
-        invoiceService.delete(id);
-        return Response.ok();
-    }
-
-
-}

+ 76 - 1
virgo.api/src/main/java/com/bosshand/virgo/api/controller/PaymentController.java

@@ -1,6 +1,8 @@
 package com.bosshand.virgo.api.controller;
 
 import com.bosshand.virgo.api.model.Payment;
+import com.bosshand.virgo.api.model.PaymentInvoice;
+import com.bosshand.virgo.api.model.PaymentRecord;
 import com.bosshand.virgo.api.service.PaymentService;
 import com.bosshand.virgo.core.response.Response;
 import io.swagger.annotations.Api;
@@ -15,7 +17,7 @@ import java.util.Map;
 
 @RestController
 @RequestMapping({"payment"})
-@Api(tags = {"账单缴费管理"})
+@Api(tags = {"账单缴费发票管理"})
 public class PaymentController {
 
     @Autowired
@@ -57,4 +59,77 @@ public class PaymentController {
         return Response.ok("账单已生成!");
     }
 
+    /**
+     * 发票记录
+     */
+    @ApiOperation("发票记录详情")
+    @RequestMapping(value = "/invoice/{id}", method = RequestMethod.GET)
+    public Response getInvoice(@PathVariable long id) {
+        return Response.ok(paymentService.getInvoice(id));
+    }
+
+    @ApiOperation("保存发票记录")
+    @RequestMapping(value = "/invoice", method = RequestMethod.POST)
+    public Response insertInvoice(@RequestBody PaymentInvoice paymentInvoice) {
+        paymentService.insertInvoice(paymentInvoice);
+        return Response.ok();
+    }
+
+    @ApiOperation("获取发票记录")
+    @RequestMapping(value = "/invoice/query", method = RequestMethod.POST)
+    public Response getInvoiceList(@RequestBody PaymentInvoice paymentInvoice) {
+        return Response.ok(paymentService.getInvoiceList(paymentInvoice));
+    }
+
+    @ApiOperation("更新发票记录")
+    @RequestMapping(value = "/invoice/update", method = RequestMethod.PUT)
+    public Response updateInvoice(@RequestBody PaymentInvoice paymentInvoice) {
+        paymentService.updateInvoice(paymentInvoice);
+        return Response.ok();
+    }
+
+    @ApiOperation("删除发票记录")
+    @RequestMapping(value = "/invoice/delete/{id}", method = RequestMethod.DELETE)
+    public Response deleteInvoice(@PathVariable long id) {
+        paymentService.deleteInvoice(id);
+        return Response.ok();
+    }
+
+    /**
+     * 付款记录
+     */
+    @ApiOperation("付款记录详情")
+    @RequestMapping(value = "/record/{id}", method = RequestMethod.GET)
+    public Response getPaymentRecord(@PathVariable long id) {
+        return Response.ok(paymentService.getPaymentRecord(id));
+    }
+
+    @ApiOperation("保存付款记录")
+    @RequestMapping(value = "/record", method = RequestMethod.POST)
+    public Response insertPaymentRecord(@RequestBody PaymentRecord paymentRecord) {
+        paymentService.insertPaymentRecord(paymentRecord);
+        return Response.ok();
+    }
+
+    @ApiOperation("获取付款记录")
+    @RequestMapping(value = "/record/query", method = RequestMethod.POST)
+    public Response getPaymentRecordList(@RequestBody PaymentRecord paymentRecord) {
+        return Response.ok(paymentService.getPaymentRecordList(paymentRecord));
+    }
+
+    @ApiOperation("更新付款记录")
+    @RequestMapping(value = "/record/update", method = RequestMethod.PUT)
+    public Response updatePaymentRecord(@RequestBody PaymentRecord paymentRecord) {
+        paymentService.updatePaymentRecord(paymentRecord);
+        return Response.ok();
+    }
+
+    @ApiOperation("删除付款记录")
+    @RequestMapping(value = "/record/delete/{id}", method = RequestMethod.DELETE)
+    public Response deletePaymentRecord(@PathVariable long id) {
+        paymentService.deletePaymentRecord(id);
+        return Response.ok();
+    }
+
+
 }

+ 0 - 19
virgo.api/src/main/java/com/bosshand/virgo/api/dao/InvoiceDao.java

@@ -1,19 +0,0 @@
-package com.bosshand.virgo.api.dao;
-
-import com.bosshand.virgo.api.model.Invoice;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
-
-@Mapper
-public interface InvoiceDao {
-
-    int insert (Invoice invoice);
-
-    int update(Invoice invoice);
-
-    int delete(long id);
-
-    List<Invoice> getList(Invoice invoice);
-
-}

+ 23 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/PaymentInvoiceDao.java

@@ -0,0 +1,23 @@
+package com.bosshand.virgo.api.dao;
+
+import com.bosshand.virgo.api.model.PaymentInvoice;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface PaymentInvoiceDao {
+
+    int insert (PaymentInvoice paymentInvoice);
+
+    int update(PaymentInvoice paymentInvoice);
+
+    int delete(long id);
+
+    List<PaymentInvoice> getList(PaymentInvoice paymentInvoice);
+
+    List<PaymentInvoice> getPaymentId(long paymentId);
+
+    PaymentInvoice get(long id);
+
+}

+ 23 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/PaymentRecordDao.java

@@ -0,0 +1,23 @@
+package com.bosshand.virgo.api.dao;
+
+import com.bosshand.virgo.api.model.PaymentRecord;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface PaymentRecordDao {
+
+    int insert(PaymentRecord paymentRecord);
+
+    int update(PaymentRecord paymentRecord);
+
+    int delete(long id);
+
+    List<PaymentRecord> getList(PaymentRecord paymentRecord);
+
+    List<PaymentRecord> getPaymentId(long paymentId);
+
+    PaymentRecord get(long id);
+
+}

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

@@ -1,28 +0,0 @@
-package com.bosshand.virgo.api.model;
-
-/**
- * 发票管理
- */
-public class Invoice {
-
-    private long id;
-
-    private long projectId;
-
-    public long getId() {
-        return id;
-    }
-
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    public long getProjectId() {
-        return projectId;
-    }
-
-    public void setProjectId(long projectId) {
-        this.projectId = projectId;
-    }
-
-}

+ 21 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/Payment.java

@@ -1,6 +1,7 @@
 package com.bosshand.virgo.api.model;
 
 import java.math.BigDecimal;
+import java.util.List;
 
 /**
  * 账单缴费管理
@@ -80,6 +81,10 @@ public class Payment {
      */
     private Integer status;
 
+    List<PaymentInvoice> paymentInvoiceList;
+
+    List<PaymentRecord> paymentRecordList;
+
     public long getId() {
         return id;
     }
@@ -215,4 +220,20 @@ public class Payment {
     public void setStatus(Integer status) {
         this.status = status;
     }
+
+    public List<PaymentInvoice> getPaymentInvoiceList() {
+        return paymentInvoiceList;
+    }
+
+    public void setPaymentInvoiceList(List<PaymentInvoice> paymentInvoiceList) {
+        this.paymentInvoiceList = paymentInvoiceList;
+    }
+
+    public List<PaymentRecord> getPaymentRecordList() {
+        return paymentRecordList;
+    }
+
+    public void setPaymentRecordList(List<PaymentRecord> paymentRecordList) {
+        this.paymentRecordList = paymentRecordList;
+    }
 }

+ 82 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/PaymentInvoice.java

@@ -0,0 +1,82 @@
+package com.bosshand.virgo.api.model;
+
+/**
+ * 发票记录
+ */
+public class PaymentInvoice {
+
+    private long id;
+
+    /**
+     * 账单id
+     */
+    private long paymentId;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 时间
+     */
+    private String date;
+
+    /**
+     * 附件
+     */
+    private String attachment;
+
+    /**
+     * 自定义字段
+     */
+    private String data;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getPaymentId() {
+        return paymentId;
+    }
+
+    public void setPaymentId(long paymentId) {
+        this.paymentId = paymentId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public String getAttachment() {
+        return attachment;
+    }
+
+    public void setAttachment(String attachment) {
+        this.attachment = attachment;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+}

+ 82 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/PaymentRecord.java

@@ -0,0 +1,82 @@
+package com.bosshand.virgo.api.model;
+
+/**
+ * 付款记录
+ */
+public class PaymentRecord {
+
+    private long id;
+
+    /**
+     * 账单id
+     */
+    private long paymentId;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 时间
+     */
+    private String date;
+
+    /**
+     * 附件
+     */
+    private String attachment;
+
+    /**
+     * 自定义字段
+     */
+    private String data;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public long getPaymentId() {
+        return paymentId;
+    }
+
+    public void setPaymentId(long paymentId) {
+        this.paymentId = paymentId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getDate() {
+        return date;
+    }
+
+    public void setDate(String date) {
+        this.date = date;
+    }
+
+    public String getAttachment() {
+        return attachment;
+    }
+
+    public void setAttachment(String attachment) {
+        this.attachment = attachment;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+}

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

@@ -1,32 +0,0 @@
-package com.bosshand.virgo.api.service;
-
-import com.bosshand.virgo.api.dao.InvoiceDao;
-import com.bosshand.virgo.api.model.Invoice;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-@Service
-public class InvoiceService {
-
-    @Autowired
-    private InvoiceDao invoiceDao;
-
-    public int insert (Invoice invoice){
-        return invoiceDao.insert(invoice);
-    }
-
-    public int update(Invoice invoice){
-        return invoiceDao.update(invoice);
-    }
-
-    public int delete(long id){
-        return invoiceDao.delete(id);
-    }
-
-    public List<Invoice> getList(Invoice invoice){
-        return invoiceDao.getList(invoice);
-    }
-
-}

+ 59 - 4
virgo.api/src/main/java/com/bosshand/virgo/api/service/PaymentService.java

@@ -4,9 +4,9 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.bosshand.virgo.api.dao.ContractDao;
 import com.bosshand.virgo.api.dao.PaymentDao;
-import com.bosshand.virgo.api.model.Clause;
-import com.bosshand.virgo.api.model.Contract;
-import com.bosshand.virgo.api.model.Payment;
+import com.bosshand.virgo.api.dao.PaymentInvoiceDao;
+import com.bosshand.virgo.api.dao.PaymentRecordDao;
+import com.bosshand.virgo.api.model.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -27,6 +27,12 @@ public class PaymentService {
     @Autowired
     private ContractDao contractDao;
 
+    @Autowired
+    private PaymentInvoiceDao paymentInvoiceDao;
+
+    @Autowired
+    private PaymentRecordDao paymentRecordDao;
+
     public void generate(long clauseId) {
 
         LinkedList<Payment> list = new LinkedList<>();
@@ -155,7 +161,56 @@ public class PaymentService {
     }
 
     public Payment get(long id) {
-        return paymentDao.get(id);
+        Payment payment = paymentDao.get(id);
+        payment.setPaymentInvoiceList(paymentInvoiceDao.getPaymentId(id));
+        payment.setPaymentRecordList(paymentRecordDao.getPaymentId(id));
+        return payment;
+    }
+
+    /**
+     * 发票记录
+     */
+    public PaymentInvoice getInvoice(long id) {
+        return paymentInvoiceDao.get(id);
+    }
+
+    public int insertInvoice(PaymentInvoice paymentInvoice) {
+        return paymentInvoiceDao.insert(paymentInvoice);
+    }
+
+    public List<PaymentInvoice> getInvoiceList(PaymentInvoice paymentInvoice) {
+        return paymentInvoiceDao.getList(paymentInvoice);
+    }
+
+    public int updateInvoice(PaymentInvoice paymentInvoice) {
+        return paymentInvoiceDao.update(paymentInvoice);
+    }
+
+    public int deleteInvoice(long id) {
+        return paymentInvoiceDao.delete(id);
+    }
+
+    /**
+     * 付款记录
+     */
+    public PaymentRecord getPaymentRecord(long id) {
+        return paymentRecordDao.get(id);
+    }
+
+    public int insertPaymentRecord(PaymentRecord paymentRecord) {
+        return paymentRecordDao.insert(paymentRecord);
+    }
+
+    public List<PaymentRecord> getPaymentRecordList(PaymentRecord paymentRecord) {
+        return paymentRecordDao.getList(paymentRecord);
+    }
+
+    public int updatePaymentRecord(PaymentRecord paymentRecord) {
+        return paymentRecordDao.update(paymentRecord);
+    }
+
+    public int deletePaymentRecord(long id) {
+        return paymentRecordDao.delete(id);
     }
 
 }

+ 0 - 40
virgo.api/src/main/resources/mapper/InvoiceMapper.xml

@@ -1,40 +0,0 @@
-<!DOCTYPE mapper
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.bosshand.virgo.api.dao.InvoiceDao">
-
-    <resultMap type="com.bosshand.virgo.api.model.Invoice" id="invoiceResult">
-        <id column="id" property="id"/>
-        <result column="projectId" property="projectId"/>
-    </resultMap>
-
-    <insert id="insert" parameterType="com.bosshand.virgo.api.model.Invoice" useGeneratedKeys="true" keyProperty="id">
-        INSERT INTO invoice(projectId) VALUES (#{projectId})
-    </insert>
-
-    <delete id="delete">
-        DELETE from invoice where id=#{id}
-    </delete>
-
-    <update id="update" parameterType="com.bosshand.virgo.api.model.Invoice">
-        UPDATE invoice
-        <trim prefix="set" suffixOverrides=",">
-            <if test="projectId!=0">projectId=#{projectId},</if>
-        </trim>
-        WHERE id=#{id}
-    </update>
-
-    <select id="getList" resultMap="invoiceResult">
-        SELECT * FROM invoice
-        <where>
-            <if test="id != 0">
-                and id = #{id}
-            </if>
-            <if test="projectId != 0">
-                and projectId = #{projectId}
-            </if>
-        </where>
-    </select>
-
-</mapper>

+ 57 - 0
virgo.api/src/main/resources/mapper/PaymentInvoiceMapper.xml

@@ -0,0 +1,57 @@
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.bosshand.virgo.api.dao.PaymentInvoiceDao">
+
+    <resultMap type="com.bosshand.virgo.api.model.PaymentInvoice" id="result">
+        <id column="id" property="id"/>
+        <result column="paymentId" property="paymentId"/>
+        <result column="name" property="name"/>
+        <result column="date" property="date"/>
+        <result column="attachment" property="attachment"/>
+        <result column="data" property="data"/>
+    </resultMap>
+
+    <insert id="insert" parameterType="com.bosshand.virgo.api.model.PaymentInvoice" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO  payment_invoice (`paymentId`, `name`, `date`, `attachment`, `data`)
+        VALUES (#{paymentId}, #{name}, #{date}, #{attachment}, #{data})
+    </insert>
+
+    <delete id="delete">
+        DELETE from  payment_invoice
+        where id=#{id}
+    </delete>
+
+    <update id="update" parameterType="com.bosshand.virgo.api.model.PaymentInvoice">
+        UPDATE  payment_invoice
+        <trim prefix="set" suffixOverrides=",">
+            <if test="paymentId!=0">paymentId=#{paymentId},</if>
+            <if test="name!=null">name=#{name},</if>
+            <if test="date!=null">date=#{date},</if>
+            <if test="attachment!=null">attachment=#{attachment},</if>
+            <if test="data!=null">data=#{data},</if>
+        </trim>
+        WHERE id=#{id}
+    </update>
+
+    <select id="getList" resultMap="result">
+        SELECT * FROM  payment_invoice
+        <where>
+            <if test="paymentId!=0">and paymentId=#{paymentId}</if>
+            <if test="name!=null">and name=#{name}</if>
+            <if test="date!=null">and date=#{date}</if>
+            <if test="attachment!=null">and attachment=#{attachment}</if>
+            <if test="data!=null">and data=#{data}</if>
+        </where>
+    </select>
+
+    <select id="getPaymentId" resultMap="result">
+        SELECT * FROM  payment_invoice where paymentId = #{paymentId}
+    </select>
+
+    <select id="get" resultMap="result">
+        SELECT * FROM  payment_invoice where id = #{id}
+    </select>
+
+</mapper>

+ 57 - 0
virgo.api/src/main/resources/mapper/PaymentRecordMapper.xml

@@ -0,0 +1,57 @@
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.bosshand.virgo.api.dao.PaymentRecordDao">
+
+    <resultMap type="com.bosshand.virgo.api.model.PaymentRecord" id="result">
+        <id column="id" property="id"/>
+        <result column="paymentId" property="paymentId"/>
+        <result column="name" property="name"/>
+        <result column="date" property="date"/>
+        <result column="attachment" property="attachment"/>
+        <result column="data" property="data"/>
+    </resultMap>
+
+    <insert id="insert" parameterType="com.bosshand.virgo.api.model.PaymentRecord" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO  payment_record (`paymentId`, `name`, `date`, `attachment`, `data`)
+        VALUES (#{paymentId}, #{name}, #{date}, #{attachment}, #{data})
+    </insert>
+
+    <delete id="delete">
+        DELETE from  payment_record
+        where id=#{id}
+    </delete>
+
+    <update id="update" parameterType="com.bosshand.virgo.api.model.PaymentRecord">
+        UPDATE  payment_record
+        <trim prefix="set" suffixOverrides=",">
+            <if test="paymentId!=0">paymentId=#{paymentId},</if>
+            <if test="name!=null">name=#{name},</if>
+            <if test="date!=null">date=#{date},</if>
+            <if test="attachment!=null">attachment=#{attachment},</if>
+            <if test="data!=null">data=#{data},</if>
+        </trim>
+        WHERE id=#{id}
+    </update>
+
+    <select id="getList" resultMap="result">
+        SELECT * FROM  payment_record
+        <where>
+            <if test="paymentId!=0">and paymentId=#{paymentId}</if>
+            <if test="name!=null">and name=#{name}</if>
+            <if test="date!=null">and date=#{date}</if>
+            <if test="attachment!=null">and attachment=#{attachment}</if>
+            <if test="data!=null">and data=#{data}</if>
+        </where>
+    </select>
+
+    <select id="getPaymentId" resultMap="result">
+        SELECT * FROM  payment_record where paymentId = #{paymentId}
+    </select>
+
+    <select id="get" resultMap="result">
+        SELECT * FROM  payment_record where id = #{id}
+    </select>
+
+</mapper>