|
@@ -1,12 +1,15 @@
|
|
package com.dayou.service.impl;
|
|
package com.dayou.service.impl;
|
|
|
|
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.dayou.common.BaseEntity;
|
|
import com.dayou.common.BaseEntity;
|
|
|
|
+import com.dayou.entity.Assets;
|
|
|
|
+import com.dayou.entity.Major;
|
|
import com.dayou.entity.OrderFund;
|
|
import com.dayou.entity.OrderFund;
|
|
|
|
+import com.dayou.entity.Personal;
|
|
import com.dayou.enums.MainBusinessEnum;
|
|
import com.dayou.enums.MainBusinessEnum;
|
|
import com.dayou.mapper.OrderFundMapper;
|
|
import com.dayou.mapper.OrderFundMapper;
|
|
-import com.dayou.service.IFinanceClaimService;
|
|
|
|
-import com.dayou.service.IOrderFundService;
|
|
|
|
|
|
+import com.dayou.service.*;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -18,6 +21,8 @@ import java.math.BigDecimal;
|
|
import java.util.Collections;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import static com.dayou.enums.MainBusinessEnum.ASSET_BUSINESS;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
* 订单应收款 服务实现类
|
|
* 订单应收款 服务实现类
|
|
@@ -36,6 +41,15 @@ public class OrderFundServiceImpl extends ServiceImpl<OrderFundMapper, OrderFund
|
|
@Autowired
|
|
@Autowired
|
|
private IFinanceClaimService financeClaimService;
|
|
private IFinanceClaimService financeClaimService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IPersonalService personalService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IAssetsService assetsService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IMajorService majorService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@SuppressWarnings("unchecked")
|
|
@SuppressWarnings("unchecked")
|
|
public Page<OrderFund> selectPage(Page page,OrderFund orderFund){
|
|
public Page<OrderFund> selectPage(Page page,OrderFund orderFund){
|
|
@@ -50,6 +64,27 @@ public class OrderFundServiceImpl extends ServiceImpl<OrderFundMapper, OrderFund
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Boolean add(OrderFund orderFund){
|
|
public Boolean add(OrderFund orderFund){
|
|
|
|
+ // 设置客户经理id
|
|
|
|
+ switch (orderFund.getBusinessType()) {
|
|
|
|
+ case "ASSET_BUSINESS":
|
|
|
|
+ Assets assets = assetsService.getOne(new LambdaQueryWrapper<Assets>().eq(Assets::getOrderId, orderFund.getOrderId()).eq(Assets::getId,orderFund.getBusinessId()).eq(BaseEntity::getDeleted, Boolean.FALSE));
|
|
|
|
+ if (assets != null) {
|
|
|
|
+ orderFund.setClientManagerId(assets.getClientManagerId());
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case "PERSONAL_BUSINESS":
|
|
|
|
+ Personal personal = personalService.getOne(new LambdaQueryWrapper<Personal>().eq(Personal::getOrderId, orderFund.getOrderId()).eq(Personal::getId,orderFund.getBusinessId()).eq(BaseEntity::getDeleted, Boolean.FALSE));
|
|
|
|
+ if (personal != null) {
|
|
|
|
+ orderFund.setClientManagerId(personal.getClientManagerId());
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case "MAJOR_BUSINESS":
|
|
|
|
+ Major major = majorService.getOne(new LambdaQueryWrapper<Major>().eq(Major::getOrderId, orderFund.getOrderId()).eq(Major::getId,orderFund.getBusinessId()).eq(BaseEntity::getDeleted, Boolean.FALSE));
|
|
|
|
+ if (major != null) {
|
|
|
|
+ orderFund.setClientManagerId(major.getClientManagerId());
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
return this.save(orderFund);
|
|
return this.save(orderFund);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -78,12 +113,13 @@ public class OrderFundServiceImpl extends ServiceImpl<OrderFundMapper, OrderFund
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void createOrderFundWhenOpeningOrder(Long id, String orderId, String name, MainBusinessEnum mainBusinessEnum) {
|
|
|
|
|
|
+ public void createOrderFundWhenOpeningOrder(Long id, String orderId, String name, MainBusinessEnum mainBusinessEnum, Long clientManagerId) {
|
|
OrderFund orderFund = new OrderFund();
|
|
OrderFund orderFund = new OrderFund();
|
|
orderFund.setBusinessType(mainBusinessEnum.name());
|
|
orderFund.setBusinessType(mainBusinessEnum.name());
|
|
orderFund.setOrderId(orderId);
|
|
orderFund.setOrderId(orderId);
|
|
orderFund.setBusinessId(id);
|
|
orderFund.setBusinessId(id);
|
|
orderFund.setOrderName(name);
|
|
orderFund.setOrderName(name);
|
|
|
|
+ orderFund.setClientManagerId(clientManagerId);
|
|
this.save(orderFund);
|
|
this.save(orderFund);
|
|
}
|
|
}
|
|
|
|
|