|
@@ -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;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|