dcs vor 1 Jahr
Ursprung
Commit
c140cff72b

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

@@ -2,6 +2,7 @@ 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.PaymentOrdinary;
 import com.bosshand.virgo.api.model.PaymentRecord;
 import com.bosshand.virgo.api.service.PaymentService;
 import com.bosshand.virgo.core.response.Response;
@@ -53,7 +54,7 @@ public class PaymentController {
     public Response generate(@PathVariable long contractId) {
         List<Payment> list = paymentService.getContractId(contractId);
         if (list.size() > 0) {
-            return Response.fail(200001, "合同下账单已生成好了!");
+            //return Response.fail(200001, "合同下账单已生成好了!");
         }
         paymentService.generate(contractId);
         return Response.ok("账单已生成!");
@@ -131,5 +132,45 @@ public class PaymentController {
         return Response.ok();
     }
 
+    /**
+     * 普通账单
+     */
+    @ApiOperation("普通账单分页获取")
+    @RequestMapping(value = "/ordinary/{currPage}/{pageSize}", method = RequestMethod.POST)
+    public Response list(@RequestBody PaymentOrdinary paymentOrdinary, @PathVariable int currPage, @PathVariable int pageSize) {
+        int totalCount = paymentService.getTotalCount(paymentOrdinary);
+        List<PaymentOrdinary> dataList = paymentService.getLimit(paymentOrdinary, currPage, pageSize);
+        Map<String, Object> result = new HashMap<>();
+        result.put("dataList", dataList);
+        result.put("totalCount", totalCount);
+        return Response.ok(result);
+    }
+
+    @ApiOperation("普通账单详情")
+    @RequestMapping(value = "/ordinary/{id}", method = RequestMethod.GET)
+    public Response getPaymentOrdinary(@PathVariable long id) {
+        return Response.ok(paymentService.getPaymentOrdinary(id));
+    }
+
+    @ApiOperation("普通账单保存")
+    @RequestMapping(value = "/ordinary", method = RequestMethod.POST)
+    public Response insertPaymentOrdinary(@RequestBody PaymentOrdinary paymentOrdinary) {
+        paymentService.insertPaymentOrdinary(paymentOrdinary);
+        return Response.ok();
+    }
+
+    @ApiOperation("普通账单更新")
+    @RequestMapping(value = "/ordinary", method = RequestMethod.PUT)
+    public Response updatePaymentOrdinary(@RequestBody PaymentOrdinary paymentOrdinary) {
+        paymentService.updatePaymentOrdinary(paymentOrdinary);
+        return Response.ok();
+    }
+
+    @ApiOperation("普通账单删除")
+    @RequestMapping(value = "/ordinary/{id}", method = RequestMethod.DELETE)
+    public Response update(@PathVariable long id) {
+        paymentService.deletePaymentOrdinary(id);
+        return Response.ok();
+    }
 
 }

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

@@ -20,4 +20,5 @@ public interface PaymentInvoiceDao {
 
     PaymentInvoice get(long id);
 
+    List<PaymentInvoice> getPaymentOrdinaryId(long id);
 }

+ 25 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/PaymentOrdinaryDao.java

@@ -0,0 +1,25 @@
+package com.bosshand.virgo.api.dao;
+
+
+import com.bosshand.virgo.api.model.PaymentOrdinary;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface PaymentOrdinaryDao {
+
+    int insert(PaymentOrdinary paymentOrdinary);
+
+    int delete(long id);
+
+    int update(PaymentOrdinary paymentOrdinary);
+
+    int getTotalCount(PaymentOrdinary paymentOrdinary);
+
+    List<PaymentOrdinary> getLimit(@Param("p") PaymentOrdinary p, @Param("currIndex") int currIndex, @Param("pageSize") int pageSize);
+
+    PaymentOrdinary get(long id);
+
+}

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

@@ -20,4 +20,6 @@ public interface PaymentRecordDao {
 
     PaymentRecord get(long id);
 
+    List<PaymentRecord> getPaymentOrdinaryId(long paymentOrdinaryId);
+
 }

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

@@ -7,6 +7,11 @@ public class PaymentInvoice {
 
     private long id;
 
+    /**
+     * 普通账单id
+     */
+    private long paymentOrdinaryId;
+
     /**
      * 账单id
      */
@@ -40,6 +45,14 @@ public class PaymentInvoice {
         this.id = id;
     }
 
+    public long getPaymentOrdinaryId() {
+        return paymentOrdinaryId;
+    }
+
+    public void setPaymentOrdinaryId(long paymentOrdinaryId) {
+        this.paymentOrdinaryId = paymentOrdinaryId;
+    }
+
     public long getPaymentId() {
         return paymentId;
     }

+ 231 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/PaymentOrdinary.java

@@ -0,0 +1,231 @@
+package com.bosshand.virgo.api.model;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 普通账单缴费管理
+ */
+public class PaymentOrdinary {
+
+
+    private long id;
+
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 创建时间
+     */
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date date;
+
+    /**
+     * 提醒时间
+     */
+    private String reminderDate;
+
+    /**
+     * 项目id
+     */
+    private long projectId;
+
+    /**
+     * 收款组织id
+     */
+    private long organizationId;
+
+    private String organizationName;
+
+    /**
+     * 付款企业id
+     */
+    private long payMerchantId;
+
+    private String payMerchantName;
+
+    /**
+     * 付款客户id
+     */
+    private long payClientId;
+
+    private String payClientName;
+
+    /**
+     * 租客类型
+     */
+    private Integer tenantType;
+
+    /**
+     * 金额
+     */
+    private BigDecimal amount;
+
+    /**
+     * 金额介绍
+     */
+    private String data;
+
+    /**
+     * 状态
+     */
+    private Integer status;
+
+    /**
+     * 类型
+     */
+    private Integer type;
+
+    List<PaymentInvoice> paymentInvoiceList;
+
+    List<PaymentRecord> paymentRecordList;
+
+    public long getId() {
+        return id;
+    }
+
+    public void setId(long id) {
+        this.id = id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Date getDate() {
+        return date;
+    }
+
+    public void setDate(Date date) {
+        this.date = date;
+    }
+
+    public String getReminderDate() {
+        return reminderDate;
+    }
+
+    public void setReminderDate(String reminderDate) {
+        this.reminderDate = reminderDate;
+    }
+
+    public long getProjectId() {
+        return projectId;
+    }
+
+    public void setProjectId(long projectId) {
+        this.projectId = projectId;
+    }
+
+    public long getOrganizationId() {
+        return organizationId;
+    }
+
+    public void setOrganizationId(long organizationId) {
+        this.organizationId = organizationId;
+    }
+
+    public String getOrganizationName() {
+        return organizationName;
+    }
+
+    public void setOrganizationName(String organizationName) {
+        this.organizationName = organizationName;
+    }
+
+    public long getPayMerchantId() {
+        return payMerchantId;
+    }
+
+    public void setPayMerchantId(long payMerchantId) {
+        this.payMerchantId = payMerchantId;
+    }
+
+    public String getPayMerchantName() {
+        return payMerchantName;
+    }
+
+    public void setPayMerchantName(String payMerchantName) {
+        this.payMerchantName = payMerchantName;
+    }
+
+    public long getPayClientId() {
+        return payClientId;
+    }
+
+    public void setPayClientId(long payClientId) {
+        this.payClientId = payClientId;
+    }
+
+    public String getPayClientName() {
+        return payClientName;
+    }
+
+    public void setPayClientName(String payClientName) {
+        this.payClientName = payClientName;
+    }
+
+    public Integer getTenantType() {
+        return tenantType;
+    }
+
+    public void setTenantType(Integer tenantType) {
+        this.tenantType = tenantType;
+    }
+
+    public BigDecimal getAmount() {
+        return amount;
+    }
+
+    public void setAmount(BigDecimal amount) {
+        this.amount = amount;
+    }
+
+    public String getData() {
+        return data;
+    }
+
+    public void setData(String data) {
+        this.data = data;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    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;
+    }
+}

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

@@ -7,6 +7,11 @@ public class PaymentRecord {
 
     private long id;
 
+    /**
+     * 普通账单id
+     */
+    private long paymentOrdinaryId;
+
     /**
      * 账单id
      */
@@ -40,6 +45,14 @@ public class PaymentRecord {
         this.id = id;
     }
 
+    public long getPaymentOrdinaryId() {
+        return paymentOrdinaryId;
+    }
+
+    public void setPaymentOrdinaryId(long paymentOrdinaryId) {
+        this.paymentOrdinaryId = paymentOrdinaryId;
+    }
+
     public long getPaymentId() {
         return paymentId;
     }

+ 38 - 6
virgo.api/src/main/java/com/bosshand/virgo/api/service/PaymentService.java

@@ -2,10 +2,7 @@ package com.bosshand.virgo.api.service;
 
 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.dao.PaymentInvoiceDao;
-import com.bosshand.virgo.api.dao.PaymentRecordDao;
+import com.bosshand.virgo.api.dao.*;
 import com.bosshand.virgo.api.model.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -33,6 +30,9 @@ public class PaymentService {
     @Autowired
     private PaymentRecordDao paymentRecordDao;
 
+    @Autowired
+    private PaymentOrdinaryDao paymentOrdinaryDao;
+
     public void generate(long clauseId) {
 
         LinkedList<Payment> list = new LinkedList<>();
@@ -77,7 +77,7 @@ public class PaymentService {
                     json.put("earnestMoney", clause.getEarnestMoney());
                     earnestMoneyArray.add(json);
                     BigDecimal bigDecimal = new BigDecimal(clause.getEarnestMoney());
-                    earnestMoney.add(bigDecimal);
+                    earnestMoney = earnestMoney.add(bigDecimal);
                 } else {
                     json.put("earnestMoneyType", clause.getEarnestMoneyType());
                     json.put("earnestMoney", clause.getEarnestMoney());
@@ -135,7 +135,8 @@ public class PaymentService {
             payment.setPhase(b + i);
             list.add(payment);
         }
-        paymentDao.batchInsert(list);
+        //paymentDao.batchInsert(list);
+        System.err.println(list.get(0).getAmount());
     }
 
 
@@ -213,4 +214,35 @@ public class PaymentService {
         return paymentRecordDao.delete(id);
     }
 
+    /**
+     * 普通账单
+     */
+    public int getTotalCount(PaymentOrdinary paymentOrdinary) {
+        return paymentOrdinaryDao.getTotalCount(paymentOrdinary);
+    }
+
+    public List<PaymentOrdinary> getLimit(PaymentOrdinary paymentOrdinary, int currPage, int pageSize) {
+        int currIndex = (currPage - 1) * pageSize;
+        return paymentOrdinaryDao.getLimit(paymentOrdinary, currIndex, pageSize);
+    }
+
+    public PaymentOrdinary getPaymentOrdinary(long id) {
+        PaymentOrdinary paymentOrdinary = paymentOrdinaryDao.get(id);
+        paymentOrdinary.setPaymentInvoiceList(paymentInvoiceDao.getPaymentOrdinaryId(id));
+        paymentOrdinary.setPaymentRecordList(paymentRecordDao.getPaymentOrdinaryId(id));
+        return paymentOrdinary;
+    }
+
+    public int deletePaymentOrdinary(long id) {
+        return paymentOrdinaryDao.delete(id);
+    }
+
+    public int insertPaymentOrdinary(PaymentOrdinary paymentOrdinary) {
+        return paymentOrdinaryDao.insert(paymentOrdinary);
+    }
+
+    public int updatePaymentOrdinary(PaymentOrdinary paymentOrdinary) {
+        return paymentOrdinaryDao.update(paymentOrdinary);
+    }
+
 }

+ 9 - 2
virgo.api/src/main/resources/mapper/PaymentInvoiceMapper.xml

@@ -6,6 +6,7 @@
 
     <resultMap type="com.bosshand.virgo.api.model.PaymentInvoice" id="result">
         <id column="id" property="id"/>
+        <result column="paymentOrdinaryId" property="paymentOrdinaryId"/>
         <result column="paymentId" property="paymentId"/>
         <result column="name" property="name"/>
         <result column="date" property="date"/>
@@ -14,8 +15,8 @@
     </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 INTO  payment_invoice (`paymentOrdinaryId`, `paymentId`, `name`, `date`, `attachment`, `data`)
+        VALUES (#{paymentOrdinaryId}, #{paymentId}, #{name}, #{date}, #{attachment}, #{data})
     </insert>
 
     <delete id="delete">
@@ -26,6 +27,7 @@
     <update id="update" parameterType="com.bosshand.virgo.api.model.PaymentInvoice">
         UPDATE  payment_invoice
         <trim prefix="set" suffixOverrides=",">
+            <if test="paymentOrdinaryId!=0">paymentOrdinaryId=#{paymentOrdinaryId},</if>
             <if test="paymentId!=0">paymentId=#{paymentId},</if>
             <if test="name!=null">name=#{name},</if>
             <if test="date!=null">date=#{date},</if>
@@ -38,6 +40,7 @@
     <select id="getList" resultMap="result">
         SELECT * FROM  payment_invoice
         <where>
+            <if test="paymentOrdinaryId!=0">and paymentOrdinaryId=#{paymentOrdinaryId}</if>
             <if test="paymentId!=0">and paymentId=#{paymentId}</if>
             <if test="name!=null">and name=#{name}</if>
             <if test="date!=null">and date=#{date}</if>
@@ -50,6 +53,10 @@
         SELECT * FROM  payment_invoice where paymentId = #{paymentId}
     </select>
 
+    <select id="getPaymentOrdinaryId" resultMap="result">
+        SELECT * FROM  payment_invoice where paymentOrdinaryId = #{paymentOrdinaryId}
+    </select>
+
     <select id="get" resultMap="result">
         SELECT * FROM  payment_invoice where id = #{id}
     </select>

+ 130 - 0
virgo.api/src/main/resources/mapper/PaymentOrdinaryMapper.xml

@@ -0,0 +1,130 @@
+<!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.PaymentOrdinaryDao">
+
+    <resultMap type="com.bosshand.virgo.api.model.PaymentOrdinary" id="result">
+        <id column="id" property="id"/>
+        <result column="name" property="name"/>
+        <result column="date" property="date"/>
+        <result column="reminderDate" property="reminderDate"/>
+        <result column="projectId" property="projectId"/>
+        <result column="organizationId" property="organizationId"/>
+        <result column="organizationName" property="organizationName"/>
+        <result column="payMerchantId" property="payMerchantId"/>
+        <result column="payMerchantName" property="payMerchantName"/>
+        <result column="payClientId" property="payClientId"/>
+        <result column="payClientName" property="payClientName"/>
+        <result column="tenantType" property="tenantType"/>
+        <result column="amount" property="amount"/>
+        <result column="data" property="data"/>
+        <result column="status" property="status"/>
+        <result column="type" property="type"/>
+    </resultMap>
+
+    <insert id="insert" parameterType="com.bosshand.virgo.api.model.PaymentOrdinary" useGeneratedKeys="true" keyProperty="id">
+        INSERT INTO payment_ordinary(`name`, `date`, `reminderDate`, `projectId`, `organizationId`, `payMerchantId`, `payClientId`, `tenantType`, `amount`, `data`, `status`, `type`)
+        VALUES (#{name}, now(), #{reminderDate}, #{projectId}, #{organizationId}, #{payMerchantId}, #{payClientId}, #{tenantType}, #{amount}, #{data}, #{status}, #{type})
+    </insert>
+
+    <delete id="delete">
+        DELETE from payment_ordinary where id=#{id}
+    </delete>
+
+    <update id="update" parameterType="com.bosshand.virgo.api.model.PaymentOrdinary">
+        UPDATE payment_ordinary
+        <trim prefix="set" suffixOverrides=",">
+            <if test="name != null">name = #{name},</if>
+            <if test="reminderDate != null">reminderDate = #{reminderDate},</if>
+            <if test="projectId != 0">projectId = #{projectId},</if>
+            <if test="organizationId != 0">organizationId = #{organizationId},</if>
+            <if test="payMerchantId != 0">payMerchantId = #{payMerchantId},</if>
+            <if test="payClientId != 0">payClientId = #{payClientId},</if>
+            <if test="tenantType != null">tenantType = #{tenantType},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="type != null">type = #{type},</if>
+        </trim>
+        WHERE id=#{id}
+    </update>
+
+    <select id="getTotalCount" parameterType="com.bosshand.virgo.api.model.PaymentOrdinary" resultType="Integer">
+        SELECT count(*) FROM payment_ordinary
+        <where>
+            <if test="name != null">
+                and name = #{name}
+            </if>
+            <if test="reminderDate != null">
+                and reminderDate = #{reminderDate}
+            </if>
+            <if test="projectId != 0">
+                and projectId = #{projectId}
+            </if>
+            <if test="organizationId != 0">
+                and organizationId = #{organizationId}
+            </if>
+            <if test="payMerchantId != 0">
+                and payMerchantId = #{payMerchantId}
+            </if>
+            <if test="payClientId != 0">
+                and payClientId = #{payClientId}
+            </if>
+            <if test="tenantType != null">
+                and tenantType = #{tenantType}
+            </if>
+            <if test="status != null">
+                and status = #{status}
+            </if>
+            <if test="type != null">
+                and type = #{type}
+            </if>
+        </where>
+    </select>
+
+    <sql id="query">
+        SELECT a.*, b.name as organizationName, c.name as payMerchantName, d.name as payClientName FROM payment_ordinary a
+                                                                                                            LEFT JOIN mgr_organization b ON a.organizationId = b.id
+                                                                                                            LEFT JOIN merchant c ON a.payMerchantId = c.id
+                                                                                                            LEFT JOIN mgr_client d ON a.payClientId = d.id
+    </sql>
+
+    <select id="get" resultMap="result">
+        <include refid="query"/> where a.id = #{id}
+    </select>
+
+    <select id="getLimit" resultMap="result">
+        <include refid="query"/>
+        <where>
+            <if test="p.name != null">
+                and a.name = #{p.name}
+            </if>
+            <if test="p.reminderDate != null">
+                and a.reminderDate = #{p.reminderDate}
+            </if>
+            <if test="p.projectId != 0">
+                and a.projectId = #{p.projectId}
+            </if>
+            <if test="p.organizationId != 0">
+                and a.organizationId = #{p.organizationId}
+            </if>
+            <if test="p.payMerchantId != 0">
+                and a.payMerchantId = #{p.payMerchantId}
+            </if>
+            <if test="p.payClientId != 0">
+                and a.payClientId = #{p.payClientId}
+            </if>
+            <if test="p.tenantType != null">
+                and a.tenantType = #{p.tenantType}
+            </if>
+            <if test="p.status != null">
+                and a.status = #{p.status}
+            </if>
+            <if test="p.type != null">
+                and a.type = #{p.type}
+            </if>
+        </where>
+        limit #{currIndex} , #{pageSize}
+    </select>
+
+
+</mapper>

+ 9 - 2
virgo.api/src/main/resources/mapper/PaymentRecordMapper.xml

@@ -6,6 +6,7 @@
 
     <resultMap type="com.bosshand.virgo.api.model.PaymentRecord" id="result">
         <id column="id" property="id"/>
+        <result column="paymentOrdinaryId" property="paymentOrdinaryId"/>
         <result column="paymentId" property="paymentId"/>
         <result column="name" property="name"/>
         <result column="date" property="date"/>
@@ -14,8 +15,8 @@
     </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 INTO  payment_record (`paymentOrdinaryId`, `paymentId`, `name`, `date`, `attachment`, `data`)
+        VALUES (#{paymentOrdinaryId}, #{paymentId}, #{name}, #{date}, #{attachment}, #{data})
     </insert>
 
     <delete id="delete">
@@ -26,6 +27,7 @@
     <update id="update" parameterType="com.bosshand.virgo.api.model.PaymentRecord">
         UPDATE  payment_record
         <trim prefix="set" suffixOverrides=",">
+            <if test="paymentOrdinaryId!=0">paymentOrdinaryId=#{paymentOrdinaryId},</if>
             <if test="paymentId!=0">paymentId=#{paymentId},</if>
             <if test="name!=null">name=#{name},</if>
             <if test="date!=null">date=#{date},</if>
@@ -38,6 +40,7 @@
     <select id="getList" resultMap="result">
         SELECT * FROM  payment_record
         <where>
+            <if test="paymentOrdinaryId!=0">and paymentOrdinaryId=#{paymentOrdinaryId}</if>
             <if test="paymentId!=0">and paymentId=#{paymentId}</if>
             <if test="name!=null">and name=#{name}</if>
             <if test="date!=null">and date=#{date}</if>
@@ -50,6 +53,10 @@
         SELECT * FROM  payment_record where paymentId = #{paymentId}
     </select>
 
+    <select id="getPaymentOrdinaryId" resultMap="result">
+        SELECT * FROM  payment_record where paymentOrdinaryId = #{paymentOrdinaryId}
+    </select>
+
     <select id="get" resultMap="result">
         SELECT * FROM  payment_record where id = #{id}
     </select>