zhangyuewww 3 лет назад
Родитель
Сommit
e348bc153e

+ 5 - 7
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/CustomerInfoController.java

@@ -31,21 +31,19 @@ public class CustomerInfoController {
     }
 
     /**
-     * 编辑
-     * @param id
-     * @param money 更新的值
-     * @param flag 0 修改定金比例 1增加定金 2 退回定金
+     * 增加\退回定金
+     * @param customerInfo
      * @return
      */
     @PostMapping("/api/editCustomerInfo")
-    public String editCustomerInfo(String id,Float money,Integer flag){
-        return customerInfoService.editCustomerInfo(id,money,flag);
+    public String editCustomerInfo(CustomerInfo customerInfo){
+        return customerInfoService.editCustomerInfo(customerInfo);
     }
     /**
      * 设置默认定金比例
      * @param compId
      */
-    @PostMapping("/api/installDepositRatio")
+    @GetMapping("/api/installDepositRatio")
     public void installDepositRatio(String compId,Float depositRatio){
         customerInfoService.installDepositRatio(compId,depositRatio);
     }

+ 10 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/CustomerInfo.java

@@ -121,7 +121,16 @@ public class CustomerInfo extends BaseModel<CustomerInfo> {
      */
     @TableField(exist = false)
     private String searchKeyWord;
-
+    /**
+     * 修改标识(0修改定金比例1增加定金2退回定金)
+     */
+    @TableField(exist = false)
+    private Integer flag;
+    /**
+     * 本次定金
+     */
+    @TableField(exist = false)
+    private Float money;
 
     @Override
     protected Serializable pkVal() {

+ 3 - 5
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ICustomerInfoService.java

@@ -20,13 +20,11 @@ public interface ICustomerInfoService extends IService<CustomerInfo> {
      */
     Page<CustomerInfo> selectCustomerInfo(CustomerInfo customerInfo);
     /**
-     * 编辑
-     * @param id
-     * @param money 更新的值
-     * @param flag 0 修改定金比例 1增加定金 2 退回定金
+     * 增加\退回定金
+     * @param customerInfo
      * @return
      */
-    String editCustomerInfo(String id,Float money,Integer flag);
+    String editCustomerInfo(CustomerInfo customerInfo);
     /**
      * 设置默认定金比例
      * @param compId

+ 8 - 11
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/CustomerInfoServiceImpl.java

@@ -60,34 +60,31 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
 
 
     /**
-     * 编辑
-     * @param id
-     * @param money 更新的值
-     * @param flag 0 修改定金比例 1增加定金 2 退回定金
+     * 增加\退回定金
+     * @param customerInfo
      * @return
      */
     @Override
-    public String editCustomerInfo(String id, Float money, Integer flag) {
+    public String editCustomerInfo(CustomerInfo customerInfo) {
         //查询客户信息
-        CustomerInfo customerInfo = this.selectById(id);
         if (customerInfo != null ){
             //0 修改定金比例
-            if(flag == 0) {
-                customerInfo.setDepositRatio(money);
+            if("0".equals(customerInfo.getFlag())) {
+                customerInfo.setDepositRatio(customerInfo.getDepositRatio());
                 //更改客户信息
                 this.updateById(customerInfo);
                 return "OK";
             }
             //1 增加定金
-            else if(flag==1){
-                customerInfo.setTotalDeposit(customerInfo.getTotalDeposit()+money);
+            else if("1".equals(customerInfo.getFlag())){
+                customerInfo.setTotalDeposit(customerInfo.getTotalDeposit()+customerInfo.getMoney());
                 //更改客户信息
                 this.updateById(customerInfo);
                 return "OK";
             }
             //2 退回定金
             else {
-                customerInfo.setTotalDeposit(customerInfo.getTotalDeposit()-money);
+                customerInfo.setTotalDeposit(customerInfo.getTotalDeposit()-customerInfo.getMoney());
                 //更改客户信息
                 this.updateById(customerInfo);
                 return "OK";