|
@@ -11,6 +11,7 @@ import com.iamberry.rst.core.page.PagedResult;
|
|
|
import com.iamberry.rst.faces.customer.CustomerBasicService;
|
|
|
import com.iamberry.rst.service.customer.mapper.CustomerBasicMapper;
|
|
|
import com.iamberry.rst.util.PageUtil;
|
|
|
+import com.iamberry.wechat.tools.payUtil.StringUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -102,7 +103,7 @@ public class CustomerBasicServiceImpl implements CustomerBasicService{
|
|
|
BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) throws Exception{
|
|
|
logger.info("saveCustomerBasicInfo start...");
|
|
|
int customerId = -1;
|
|
|
- int channelDivisionId = -1;
|
|
|
+ String channelDivisionId = "";
|
|
|
try {
|
|
|
customerBasicMapper.saveCustomerBasicInfo(customerBasicInfo);
|
|
|
customerId = customerBasicInfo.getCustomerId();
|
|
@@ -118,9 +119,20 @@ public class CustomerBasicServiceImpl implements CustomerBasicService{
|
|
|
channelSaleInfoList.remove(0);
|
|
|
for (ChannelSaleInfo channelSaleInfo: channelSaleInfoList) {
|
|
|
channelSaleInfo.setCustomerId(customerId);
|
|
|
- customerBasicMapper.saveChannelDivisionInfo(channelSaleInfo);
|
|
|
- //channelSaleInfo.setChannelDivisionId(channelDivisionId);
|
|
|
- customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
|
|
|
+ String channelName = channelSaleInfo.getChannelName();
|
|
|
+ channelDivisionId = customerBasicMapper.queryIsExsitChannelNameChannelName(channelSaleInfo);
|
|
|
+ if(StringUtil.isNotEmpty(channelDivisionId)){
|
|
|
+ if(Integer.valueOf(channelDivisionId)>0){
|
|
|
+ channelSaleInfo.setChannelDivisionId(Integer.valueOf(channelDivisionId));
|
|
|
+ customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
|
|
|
+ }else{
|
|
|
+ customerBasicMapper.saveChannelDivisionInfo(channelSaleInfo);
|
|
|
+ customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ customerBasicMapper.saveChannelDivisionInfo(channelSaleInfo);
|
|
|
+ customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
billingInfo.setCustomerId(customerId);
|
|
@@ -141,7 +153,7 @@ public class CustomerBasicServiceImpl implements CustomerBasicService{
|
|
|
public void updateCustomerBasicInfo(CustomerBasicInfo customerBasicInfo,List<DockedContactInfo> dockedContactInfoList, List<ChannelSaleInfo> channelSaleInfoList,
|
|
|
BillingInfo billingInfo, TicketOpeningInfo ticketOpeningInfo) throws Exception{
|
|
|
int customerId = -1;
|
|
|
- Integer channelDivisionId = -1;
|
|
|
+ String channelDivisionId = "";
|
|
|
try {
|
|
|
customerBasicMapper.updateCustomerBasic(customerBasicInfo);
|
|
|
customerId = customerBasicInfo.getCustomerId();
|
|
@@ -168,10 +180,15 @@ public class CustomerBasicServiceImpl implements CustomerBasicService{
|
|
|
channelSaleInfoList.remove(0);
|
|
|
for (ChannelSaleInfo channelSaleInfo: channelSaleInfoList) {
|
|
|
channelSaleInfo.setCustomerId(customerId);
|
|
|
- channelDivisionId = customerBasicMapper.queryIsExsitChannelNameChannelName(channelSaleInfo.getChannelName());
|
|
|
- if(channelDivisionId > 0){
|
|
|
- channelSaleInfo.setChannelDivisionId(channelDivisionId);
|
|
|
- customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
|
|
|
+ channelDivisionId = customerBasicMapper.queryIsExsitChannelNameChannelName(channelSaleInfo);
|
|
|
+ if(StringUtil.isNotEmpty(channelDivisionId)){
|
|
|
+ if(Integer.valueOf(channelDivisionId)>0){
|
|
|
+ channelSaleInfo.setChannelDivisionId(Integer.valueOf(channelDivisionId));
|
|
|
+ customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
|
|
|
+ }else{
|
|
|
+ customerBasicMapper.saveChannelDivisionInfo(channelSaleInfo);
|
|
|
+ customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
|
|
|
+ }
|
|
|
}else{
|
|
|
customerBasicMapper.saveChannelDivisionInfo(channelSaleInfo);
|
|
|
customerBasicMapper.saveChannelSaleInfo(channelSaleInfo);
|