LAPTOP-FO2T5SIU\35838 пре 9 месеци
родитељ
комит
6e6a06580b

+ 21 - 1
pro-base/src/main/java/com/idea/customerManagement/controller/IntentionalDepositController.java

@@ -45,7 +45,27 @@ public class IntentionalDepositController extends BaseController {
         return result(result);
     }
 
+    /**
+     * 意向金修改
+     * @param model
+     * @return
+     */
+    @PostMapping(value = "edit",produces = {"application/json;charset=UTF-8"})
+    @ResponseBody
+    public AjaxResult edit(IntentionalDeposit model){
+        int result = modelService.edit(model);
+        return result(result);
+    }
 
-
+    /**
+     * 根据客户id查找意向金
+     * @param customerManagementId
+     * @return
+     */
+    @PostMapping(value = "getByCustomerManagementId",produces = {"application/json;charset=UTF-8"})
+    @ResponseBody
+    public Object getByCustomerManagementId(String customerManagementId){
+        return modelService.getByCustomerManagementId(customerManagementId);
+    }
 
 }

+ 5 - 0
pro-base/src/main/java/com/idea/customerManagement/model/IntentionalDeposit.java

@@ -1,5 +1,8 @@
 package com.idea.customerManagement.model;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.util.Date;
@@ -21,6 +24,8 @@ public class IntentionalDeposit implements Serializable {
 
     private String serialNumber;
 
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date collectionTime;
 
     private String createdId;

+ 34 - 0
pro-base/src/main/java/com/idea/customerManagement/service/IntentionalDepositService.java

@@ -14,6 +14,7 @@ import com.idea.customerManagement.model.IntentionalDepositExample;
 import com.idea.customerManagement.model.RoomSelectionInfoExample;
 import com.rockstar.common.base.BaseService;
 import com.rockstar.shiro.util.ShiroUtils;
+import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -116,12 +117,45 @@ public class IntentionalDepositService implements BaseService<IntentionalDeposit
      */
     public int add(IntentionalDeposit model){
 
+        CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(model.getCustomerManagementId());
+        model.setGroupId(customerManagement.getGroupId());
+        model.setDiscId(customerManagement.getDiscId());
         model.setCreatedAt(new Date());
         model.setCreatedId(ShiroUtils.getUserId());
         return insertSelective(model);
     }
 
+    /**
+     * 意向金修改
+     * @param model
+     * @return
+     */
+    public int edit(IntentionalDeposit model){
+
+        CustomerManagement customerManagement = customerManagementMapper.selectByPrimaryKey(model.getCustomerManagementId());
+        model.setGroupId(customerManagement.getGroupId());
+        model.setDiscId(customerManagement.getDiscId());
+        model.setUpdatedAt(new Date());
+        model.setUpdatedId(ShiroUtils.getUserId());
+        return updateByPrimaryKeySelective(model);
+    }
+
+    /**
+     * 根据客户id查找意向金
+     * @param customerManagementId
+     * @return
+     */
+    public IntentionalDeposit getByCustomerManagementId(String customerManagementId){
 
+        IntentionalDepositExample example = new IntentionalDepositExample();
+        example.createCriteria().andCustomerManagementIdEqualTo(customerManagementId);
+        List<IntentionalDeposit> intentionalDeposits = modelMapper.selectByExampleWithBLOBs(example);
+        if(CollectionUtils.isNotEmpty(intentionalDeposits)){
+            return intentionalDeposits.get(0);
+        }
+        return null;
+
+    }
 
 
 

+ 3 - 1
pro-base/src/main/java/com/idea/customerManagement/service/RoomSelectionInfoService.java

@@ -168,7 +168,7 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
             count ++;
             number = String.format(count.toString(), "%05d", 1);
         }
-        String serialNumber = response.getGroupName()+ response.getDiscName() + "DJ" + number;
+        String serialNumber = response.getGroupName()+ response.getDiscName() + "-DJ" + number;
         return serialNumber;
     }
 
@@ -182,6 +182,7 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
         model.setUpdatedAt(new Date());
         model.setUpdatedId(ShiroUtils.getUserId());
         model.setStatus(2);
+        model.setCollectionId(ShiroUtils.getUserId());
         return updateByPrimaryKeySelective(model);
     }
 
@@ -194,6 +195,7 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
 
         model.setUpdatedAt(new Date());
         model.setUpdatedId(ShiroUtils.getUserId());
+        model.setCollectionId(ShiroUtils.getUserId());
         return updateByPrimaryKeySelective(model);
     }