LAPTOP-FO2T5SIU\35838 6 months ago
parent
commit
0e998ecd35

+ 7 - 0
pro-base/src/main/java/com/idea/buyingMore/controller/BuyingMoreController.java

@@ -77,4 +77,11 @@ public class BuyingMoreController extends BaseController {
         return modelService.getByContractId(contractId);
     }
 
+    @ApiOperation(value = "根据id查询")
+    @PostMapping(value = "getById", produces = {"application/json;charset=UTF-8"})
+    @ResponseBody
+    public Object getById(String id) {
+        return modelService.getById(id);
+    }
+
 }

+ 1 - 1
pro-base/src/main/java/com/idea/buyingMore/mapper/BuyingMoreExtendMapper.java

@@ -11,7 +11,7 @@ public interface BuyingMoreExtendMapper {
 
     List<BuyingMoreDto> listByModel(BuyingMoreDto record);
 
-    String getAllBuyerProportion(String houseId);
+    String getAllTransferProportion(String houseId);
 
 
 

+ 2 - 0
pro-base/src/main/java/com/idea/buyingMore/model/BuyingMore.java

@@ -42,6 +42,8 @@ public class BuyingMore implements Serializable {
 
     private BigDecimal transferMoney;
 
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date registrationDate;
 
     private String createdId;

+ 2 - 2
pro-base/src/main/java/com/idea/buyingMore/service/BuyingMoreService.java

@@ -227,9 +227,9 @@ public class BuyingMoreService implements BaseService<BuyingMore, BuyingMoreExam
         result.setSigningDate(contractManage.getSigningDate());
         result.setHousePrice(contractManage.getHousePrice());
         // 买受人最新份额占比 = 合同中买受人产权份额占比+已增购的历史记录份额-已回购的历史份额
-        String allBuyerProportion = extendMapper.getAllBuyerProportion(contractManage.getHouseId());
+        String allTransferProportion = extendMapper.getAllTransferProportion(contractManage.getHouseId());
         BigDecimal baseBuyerProportion = new BigDecimal(contractManage.getBuyerProportion().toString());
-        BigDecimal buyerProportion = baseBuyerProportion.add(new BigDecimal(allBuyerProportion));
+        BigDecimal buyerProportion = baseBuyerProportion.add(new BigDecimal(allTransferProportion));
         result.setBuyerProportion(buyerProportion.doubleValue());
         return result;
 

+ 6 - 14
pro-base/src/main/resources/mybatis/buyingMore/BuyingMoreExtendMapper.xml

@@ -19,20 +19,12 @@
     </where>
   </select>
 
-  <select id="getAllBuyerProportion" resultType="java.lang.String">
-    SELECT
-      ( buyingMore - buyingBack )
-    FROM
-      (
-        SELECT
-          IF
-          ( type = 1, sum( buyer_proportion ), 0 ) buyingMore,
-          IF
-          ( type = 2, sum( buyer_proportion ), 0 ) buyingBack
-        FROM
-          buying_more
-        WHERE house_id = #{houseId} and del_flag = 0
-      ) t
+  <select id="getAllTransferProportion" resultType="java.lang.String">
+    SELECT (
+        ( SELECT sum( transfer_proportion ) FROM buying_more WHERE house_id = #{houseId} AND del_flag = 0 AND type = 1 )
+            -
+        ( SELECT sum( transfer_proportion ) FROM buying_more WHERE house_id = #{houseId} AND del_flag = 0 AND type = 2 )
+        )
   </select>