Commit 8eaca9c7 authored by 全洪江's avatar 全洪江

用户模块保存、删除、修改bug

Signed-off-by: 全洪江's avatarHongjiang <hongjiang.quan@topsunit.com>
parent de725c04
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html> <html>
<head> <head>
<x:base include="layout,dialog,grid,tree,combox,commonTree"/> <x:base include="layout,dialog,grid,tree,dateTime,combox,commonTree"/>
<x:script src='/system/opm/js/OpmUtil.js'/> <x:script src='/system/opm/js/OpmUtil.js'/>
<x:script src='/biz/topsun/common/purchaseCommon.js'/> <x:script src='/biz/topsun/common/purchaseCommon.js'/>
<x:script src='/biz/topsun/customer/customerDetail.js'/> <x:script src='/biz/topsun/customer/customerDetail.js'/>
...@@ -44,12 +44,13 @@ ...@@ -44,12 +44,13 @@
<x:inputC name="customerCode" label="客户编码" labelCol="1" fieldCol="2"/> <x:inputC name="customerCode" label="客户编码" labelCol="1" fieldCol="2"/>
<x:inputC name="customerName" label="客户全称" labelCol="1" fieldCol="2"/> <x:inputC name="customerName" label="客户全称" labelCol="1" fieldCol="2"/>
<x:inputC name="customerShortName" label="客户简称" labelCol="1" fieldCol="2"/> <x:inputC name="customerShortName" label="客户简称" labelCol="1" fieldCol="2"/>
<x:inputC name="customerWorkTime" label="客户工作时间" wrapper="date" labelCol="1" fieldCol="2"/> <x:inputC name="customerWorkTime" label="客户工作时间" wrapper="dateTime" labelCol="1" fieldCol="2"/>
<x:inputC name="customerEnName" label="英文名称" labelCol="1" fieldCol="2"/> <x:inputC name="customerEnName" label="英文名称" labelCol="1" fieldCol="2"/>
<x:inputC name="customerEnShortName" label="英文名简称" labelCol="1" fieldCol="2"/> <x:inputC name="customerEnShortName" label="英文名简称" labelCol="1" fieldCol="2"/>
<x:inputC name="provinceInfo" label="所属地区" maxLength="32" labelCol="1" fieldCol="2" <x:inputC name="provinceInfo" label="所属地区" maxLength="32" labelCol="1" fieldCol="2"
readonly="true"/> readonly="true"/>
<x:inputC name="customerLevel" label="客户等级" maxLength="32" labelCol="1" fieldCol="2"/> <x:hidden name="provinceCode"></x:hidden>
<x:selectC name="customerLevel" label="客户等级" dictionary="customerLevel" labelCol="1" fieldCol="2"/>
<x:inputC name="customerFactoryCode" label="工厂代号" maxLength="32" labelCol="1" fieldCol="2"/> <x:inputC name="customerFactoryCode" label="工厂代号" maxLength="32" labelCol="1" fieldCol="2"/>
<x:inputC name="customerAddress" label="地址" maxLength="32" labelCol="1" fieldCol="2"/> <x:inputC name="customerAddress" label="地址" maxLength="32" labelCol="1" fieldCol="2"/>
<x:inputC name="customerGroup" label="所属集团" maxLength="32" labelCol="1" fieldCol="2"/> <x:inputC name="customerGroup" label="所属集团" maxLength="32" labelCol="1" fieldCol="2"/>
......
...@@ -98,11 +98,5 @@ function updateHandler(data) { ...@@ -98,11 +98,5 @@ function updateHandler(data) {
}) })
} }
/**
* 刷新表格
*/
function reloadGrid(obj) {
sizeGroupGridManager.loadData();
}
package com.huigou.topsun.customer.application; package com.huigou.topsun.customer.application;
import com.huigou.topsun.customer.domain.CustomerContact; import com.huigou.topsun.customer.domain.CustomerContact;
import com.huigou.topsun.customer.domain.CustomerDebtContact;
import com.huigou.topsun.customer.domain.CustomerPayInfo;
import com.huigou.topsun.customer.domain.CustomerRelated;
import com.huigou.topsun.customer.domain.query.ContactQueryRequest; import com.huigou.topsun.customer.domain.query.ContactQueryRequest;
import com.huigou.topsun.customer.domain.query.CustomerQueryRequest; import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import com.huigou.topsun.customer.domain.vo.CustomerVo;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -17,4 +21,8 @@ public interface CustomerApplication { ...@@ -17,4 +21,8 @@ public interface CustomerApplication {
void deleteContactById(String id); void deleteContactById(String id);
void deleteContactByIds(List<String> ids); void deleteContactByIds(List<String> ids);
CustomerVo saveCustomer(CustomerVo customerVo, List<CustomerContact> customerContactList, List<CustomerDebtContact> baoshenEmailList, List<CustomerDebtContact> customerEmailList, List<CustomerRelated> customerRelatedList, List<CustomerPayInfo> customerPayInfoList);
void deleteCustomerAndAffiliatedInfoByCustomerId(List<String> customerIds);
} }
...@@ -19,4 +19,6 @@ public interface CustomerBaseInfoApplication { ...@@ -19,4 +19,6 @@ public interface CustomerBaseInfoApplication {
CustomerBank findCustomerBankByCustomerId(String customerId); CustomerBank findCustomerBankByCustomerId(String customerId);
List<CustomerContact> findCustomerContactByCustomerId(String customerId); List<CustomerContact> findCustomerContactByCustomerId(String customerId);
void deleteByCustomerId(String customerId);
} }
package com.huigou.topsun.customer.application; package com.huigou.topsun.customer.application;
public interface CustomerOtherInfoApplication { public interface CustomerContactApplication {
void deleteByCustomerId(String customerId);
} }
...@@ -15,4 +15,5 @@ public interface CustomerDebtContactApplication { ...@@ -15,4 +15,5 @@ public interface CustomerDebtContactApplication {
void deleteCustomerDebtContact(List<String> ids); void deleteCustomerDebtContact(List<String> ids);
void deleteByCustomerId(String customerId);
} }
package com.huigou.topsun.customer.application; package com.huigou.topsun.customer.application;
import com.huigou.topsun.customer.domain.CustomerPayInfo; import com.huigou.topsun.customer.domain.CustomerPayInfo;
import com.huigou.topsun.customer.domain.query.CustomerPayInfoQueryRequest;
import com.huigou.topsun.customer.domain.vo.CustomerPayInfoVo; import com.huigou.topsun.customer.domain.vo.CustomerPayInfoVo;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* title: * title:
...@@ -14,9 +12,9 @@ import java.util.Map; ...@@ -14,9 +12,9 @@ import java.util.Map;
* description: * description:
*/ */
public interface CustomerPayInfoApplication { public interface CustomerPayInfoApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/customer/customerMapper.xml"; String QUERY_XML_FILE_PATH = "config/topsun/customer/customerMapper.xml";
Map<String, Object> getCustomerPayInfoList(CustomerPayInfoQueryRequest queryRequest); List<CustomerPayInfo> getCustomerPayInfoList(String customerId);
CustomerPayInfoVo updateCustomerPayInfo(CustomerPayInfo customerPayInfo); CustomerPayInfoVo updateCustomerPayInfo(CustomerPayInfo customerPayInfo);
...@@ -25,4 +23,6 @@ public interface CustomerPayInfoApplication { ...@@ -25,4 +23,6 @@ public interface CustomerPayInfoApplication {
void deleteCustomerPayInfo(List<String> ids); void deleteCustomerPayInfo(List<String> ids);
CustomerPayInfoVo getCustomerPayInfoById(String customerPayInfoId); CustomerPayInfoVo getCustomerPayInfoById(String customerPayInfoId);
void deleteByCustomerId(String customerId);
} }
...@@ -23,4 +23,5 @@ public interface CustomerRelatedApplication { ...@@ -23,4 +23,5 @@ public interface CustomerRelatedApplication {
void deleteCustomerRelated(List<String> ids); void deleteCustomerRelated(List<String> ids);
void deleteByCustomerId(String customerId);
} }
...@@ -3,16 +3,19 @@ package com.huigou.topsun.customer.application.Impl; ...@@ -3,16 +3,19 @@ package com.huigou.topsun.customer.application.Impl;
import com.huigou.data.query.model.QueryDescriptor; import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel; import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.customer.application.CustomerApplication; import com.huigou.topsun.customer.application.*;
import com.huigou.topsun.customer.domain.CustomerContact; import com.huigou.topsun.customer.domain.*;
import com.huigou.topsun.customer.domain.query.CustomerQueryRequest; import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import com.huigou.topsun.customer.repository.CustomerContactRepository; import com.huigou.topsun.customer.domain.vo.CustomerVo;
import com.huigou.topsun.customer.repository.*;
import com.huigou.uasp.bmp.common.application.BaseApplication; import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -21,11 +24,32 @@ import java.util.Map; ...@@ -21,11 +24,32 @@ import java.util.Map;
public class CustomerApplicationImpl extends BaseApplication implements CustomerApplication { public class CustomerApplicationImpl extends BaseApplication implements CustomerApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/customer/customerMapper.xml"; public static final String QUERY_XML_FILE_PATH = "config/topsun/customer/customerMapper.xml";
@Autowired @Autowired
private CustomerRepository customerRepository;
@Autowired
private CustomerBaseInfoApplication customerBaseInfoApplication;
@Autowired
private CustomerBankRepository customerBankRepository;
@Autowired
private CustomerContactRepository customerContactRepository; private CustomerContactRepository customerContactRepository;
@Autowired
private CustomerContactApplication customerContactApplication;
@Autowired
private CustomerDebtContactRepository CustomerDebtContactRepository;
@Autowired
private CustomerDebtContactApplication customerDebtContactApplication;
@Autowired
private CustomerRelatedRepository customerRelatedRepository;
@Autowired
private CustomerRelatedApplication customerRelatedApplication;
@Autowired
private CustomerPayInfoRepository customerPayInfoRepository;
@Autowired
private CustomerPayInfoApplication customerPayInfoApplication;
/** /**
* 分页查询客户信息数据 * 分页查询客户信息数据
*
* @param customerQueryRequest * @param customerQueryRequest
* @return * @return
*/ */
...@@ -38,6 +62,7 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer ...@@ -38,6 +62,7 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer
/** /**
* 分页查询联系人信息 * 分页查询联系人信息
*
* @param customerId * @param customerId
* @return * @return
*/ */
...@@ -50,6 +75,7 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer ...@@ -50,6 +75,7 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer
/** /**
* 根据单个id删除 * 根据单个id删除
*
* @param id * @param id
*/ */
@Override @Override
...@@ -60,6 +86,7 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer ...@@ -60,6 +86,7 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer
/** /**
* 批量进行删除 * 批量进行删除
*
* @param ids * @param ids
*/ */
...@@ -68,4 +95,83 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer ...@@ -68,4 +95,83 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer
public void deleteContactByIds(List<String> ids) { public void deleteContactByIds(List<String> ids) {
ids.forEach(this::deleteContactById); ids.forEach(this::deleteContactById);
} }
/**
* 保存客户信息(多表保存)
*
* @param customerVo
* @param customerContactList
* @param baoshenEmailList
* @param customerEmailList
* @param customerRelatedList
* @param customerPayInfoList
* @return
*/
@Override
public CustomerVo saveCustomer(CustomerVo customerVo, List<CustomerContact> customerContactList, List<CustomerDebtContact> baoshenEmailList, List<CustomerDebtContact> customerEmailList, List<CustomerRelated> customerRelatedList, List<CustomerPayInfo> customerPayInfoList) {
Customer customer = getCustomer(customerVo);
CustomerBank customerBank = getCustomerBank(customerVo);
Customer saveCustomer = customerRepository.saveAndFlush(customer);
String customerId = saveCustomer.getCustomerId();
customerBank.setCustomerId(customerId);
CustomerBank saveCustomerBank = customerBankRepository.saveAndFlush(customerBank);
customerContactList.forEach(customerContact -> {
customerContact.setCustomerId(customerId);
customerContactRepository.saveAndFlush(customerContact);
});
// for (CustomerDebtContact customerDebtContact : baoshenEmailList) {
// customerDebtContact.setCustomerEmailType("1");
// CustomerDebtContactRepository.saveAndFlush(customerDebtContact);
// }
customerEmailList.forEach(customerDebtContact ->{
customerDebtContact.setCustomerId(customerId);
customerDebtContact.setCustomerEmailType("1");
CustomerDebtContactRepository.saveAndFlush(customerDebtContact);
});
baoshenEmailList.forEach(customerDebtContact ->{
customerDebtContact.setCustomerId(customerId);
customerDebtContact.setCustomerEmailType("0");
CustomerDebtContactRepository.saveAndFlush(customerDebtContact);
});
customerRelatedList.forEach(customerRelated -> {
customerRelated.setCustomerId(customerId);
customerRelatedRepository.saveAndFlush(customerRelated);
});
customerPayInfoList.forEach(customerPayInfo -> {
customerPayInfo.setCustomerId(customerId);
customerPayInfoRepository.saveAndFlush(customerPayInfo);
});
CustomerVo saveCustomerVo = new CustomerVo();
BeanUtils.copyProperties(saveCustomer, saveCustomerVo);
BeanUtils.copyProperties(saveCustomerBank, saveCustomerVo);
return saveCustomerVo;
}
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void deleteCustomerAndAffiliatedInfoByCustomerId(List<String> customerIds) {
for (String customerId : customerIds) {
customerRepository.delete(customerId);
customerBaseInfoApplication.deleteByCustomerId(customerId);
customerContactApplication.deleteByCustomerId(customerId);
customerDebtContactApplication.deleteByCustomerId(customerId);
customerRelatedApplication.deleteByCustomerId(customerId);
customerPayInfoApplication.deleteByCustomerId(customerId);
}
}
public Customer getCustomer(CustomerVo customerVo) {
Customer customer = new Customer();
BeanUtils.copyProperties(customerVo, customer);
return customer;
}
public CustomerBank getCustomerBank(CustomerVo customerVo) {
CustomerBank customerBank = new CustomerBank();
BeanUtils.copyProperties(customerVo, customerBank);
return customerBank;
}
} }
package com.huigou.topsun.customer.application.Impl; package com.huigou.topsun.customer.application.Impl;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.topsun.customer.application.CustomerBaseInfoApplication; import com.huigou.topsun.customer.application.CustomerBaseInfoApplication;
import com.huigou.topsun.customer.domain.Customer; import com.huigou.topsun.customer.domain.*;
import com.huigou.topsun.customer.domain.CustomerBank;
import com.huigou.topsun.customer.domain.CustomerContact;
import com.huigou.topsun.customer.domain.Province;
import com.huigou.topsun.customer.domain.vo.CustomerVo; import com.huigou.topsun.customer.domain.vo.CustomerVo;
import com.huigou.topsun.customer.repository.CustomerBankRepository; import com.huigou.topsun.customer.repository.CustomerBankRepository;
import com.huigou.topsun.customer.repository.CustomerContactRepository; import com.huigou.topsun.customer.repository.CustomerContactRepository;
import com.huigou.topsun.customer.repository.CustomerRepository; import com.huigou.topsun.customer.repository.CustomerRepository;
import com.huigou.topsun.customer.repository.ProvinceRepository; import com.huigou.topsun.customer.repository.ProvinceRepository;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
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,7 +17,9 @@ import java.util.ArrayList; ...@@ -18,7 +17,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
@Service @Service
public class CustomerBaseInfoApplicationImpl implements CustomerBaseInfoApplication { public class CustomerBaseInfoApplicationImpl extends BaseApplication implements CustomerBaseInfoApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/customer/customerMapper.xml";
@Autowired @Autowired
private ProvinceRepository provinceRepository; private ProvinceRepository provinceRepository;
@Autowired @Autowired
...@@ -82,6 +83,12 @@ public class CustomerBaseInfoApplicationImpl implements CustomerBaseInfoApplicat ...@@ -82,6 +83,12 @@ public class CustomerBaseInfoApplicationImpl implements CustomerBaseInfoApplicat
} }
@Override
public void deleteByCustomerId(String customerId) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "deleteCustomerBank");
this.sqlExecutorDao.executeUpdate(queryDescriptor.getSql(),customerId);
}
// /** // /**
// * @param provinceCode // * @param provinceCode
// * @return provinceList // * @return provinceList
......
package com.huigou.topsun.customer.application.Impl;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.topsun.customer.application.CustomerContactApplication;
import com.huigou.topsun.customer.domain.CustomerContact;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.springframework.stereotype.Service;
@Service
public class CustomerContactApplicationImpl extends BaseApplication implements CustomerContactApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/customer/customerMapper.xml";
@Override
public void deleteByCustomerId(String customerId) {
QueryDescriptor queryDescriptor = sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "deleteContact");
sqlExecutorDao.executeUpdate(queryDescriptor.getSql(), customerId);
}
}
...@@ -12,6 +12,8 @@ import com.huigou.topsun.customer.repository.CustomerDebtContactRepository; ...@@ -12,6 +12,8 @@ import com.huigou.topsun.customer.repository.CustomerDebtContactRepository;
import com.huigou.uasp.bmp.common.application.BaseApplication; import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -45,7 +47,14 @@ public class CustomerDebtContactApplicationImpl extends BaseApplication implemen ...@@ -45,7 +47,14 @@ public class CustomerDebtContactApplicationImpl extends BaseApplication implemen
} }
@Override @Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void deleteCustomerDebtContact(List<String> ids) { public void deleteCustomerDebtContact(List<String> ids) {
ids.forEach(id -> customerDebtContactRepository.delete(id)); ids.forEach(id -> customerDebtContactRepository.delete(id));
} }
@Override
public void deleteByCustomerId(String customerId) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "deleteCustomerDebtContact");
this.sqlExecutorDao.executeUpdate(queryDescriptor.getSql(), customerId);
}
} }
package com.huigou.topsun.customer.application.Impl;
import com.huigou.topsun.customer.application.CustomerOtherInfoApplication;
public class CustomerOtherInfoApplicationImpl implements CustomerOtherInfoApplication {
}
...@@ -3,6 +3,7 @@ package com.huigou.topsun.customer.application.Impl; ...@@ -3,6 +3,7 @@ package com.huigou.topsun.customer.application.Impl;
import com.huigou.data.query.model.QueryDescriptor; import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel; import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.customer.application.CustomerPayInfoApplication; import com.huigou.topsun.customer.application.CustomerPayInfoApplication;
import com.huigou.topsun.customer.domain.CustomerDebtContact;
import com.huigou.topsun.customer.domain.CustomerPayInfo; import com.huigou.topsun.customer.domain.CustomerPayInfo;
import com.huigou.topsun.customer.domain.query.CustomerPayInfoQueryRequest; import com.huigou.topsun.customer.domain.query.CustomerPayInfoQueryRequest;
import com.huigou.topsun.customer.domain.vo.CustomerPayInfoVo; import com.huigou.topsun.customer.domain.vo.CustomerPayInfoVo;
...@@ -28,11 +29,10 @@ public class CustomerPayInfoApplicationImpl extends BaseApplication implements C ...@@ -28,11 +29,10 @@ public class CustomerPayInfoApplicationImpl extends BaseApplication implements C
private CustomerPayInfoRepository customerPayInfoRepository; private CustomerPayInfoRepository customerPayInfoRepository;
@Override @Override
public Map<String, Object> getCustomerPayInfoList(CustomerPayInfoQueryRequest queryRequest) { public List<CustomerPayInfo> getCustomerPayInfoList(String customerId) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "CustomerPayInfo"); QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "CustomerPayInfo");
QueryModel queryModel = this.sqlExecutorDao.getQueryModel(queryDescriptor, queryRequest); List<CustomerPayInfo> customerPayInfoList = this.sqlExecutorDao.queryToList(queryDescriptor.getSql(), CustomerPayInfo.class, customerId);
Map<String, Object> map = this.sqlExecutorDao.executeSlicedQuery(queryModel); return customerPayInfoList;
return map;
} }
@Override @Override
...@@ -65,4 +65,10 @@ public class CustomerPayInfoApplicationImpl extends BaseApplication implements C ...@@ -65,4 +65,10 @@ public class CustomerPayInfoApplicationImpl extends BaseApplication implements C
return CustomerPayInfoVo.getCustomerPayInfoVo(one); return CustomerPayInfoVo.getCustomerPayInfoVo(one);
} }
@Override
public void deleteByCustomerId(String customerId) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "deleteCustomerPayInfo");
this.sqlExecutorDao.executeUpdate(queryDescriptor.getSql(), customerId);
}
} }
...@@ -3,6 +3,7 @@ package com.huigou.topsun.customer.application.Impl; ...@@ -3,6 +3,7 @@ package com.huigou.topsun.customer.application.Impl;
import com.huigou.data.query.model.QueryDescriptor; import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel; import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.customer.application.CustomerRelatedApplication; import com.huigou.topsun.customer.application.CustomerRelatedApplication;
import com.huigou.topsun.customer.domain.CustomerDebtContact;
import com.huigou.topsun.customer.domain.CustomerRelated; import com.huigou.topsun.customer.domain.CustomerRelated;
import com.huigou.topsun.customer.domain.query.CustomerRelatedQueryRequest; import com.huigou.topsun.customer.domain.query.CustomerRelatedQueryRequest;
import com.huigou.topsun.customer.domain.vo.CustomerRelatedVo; import com.huigou.topsun.customer.domain.vo.CustomerRelatedVo;
...@@ -51,5 +52,11 @@ public class CustomerRelatedApplicationImpl extends BaseApplication implements C ...@@ -51,5 +52,11 @@ public class CustomerRelatedApplicationImpl extends BaseApplication implements C
ids.forEach(id -> customerRelatedRepository.delete(id)); ids.forEach(id -> customerRelatedRepository.delete(id));
} }
@Override
public void deleteByCustomerId(String customerId) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "deleteCustomerRelated");
this.sqlExecutorDao.executeUpdate(queryDescriptor.getSql(), customerId);
}
} }
...@@ -2,9 +2,8 @@ package com.huigou.topsun.customer.controller; ...@@ -2,9 +2,8 @@ package com.huigou.topsun.customer.controller;
import com.huigou.topsun.customer.application.CustomerBaseInfoApplication; import com.huigou.topsun.customer.application.CustomerBaseInfoApplication;
import com.huigou.topsun.customer.application.CustomerApplication; import com.huigou.topsun.customer.application.CustomerApplication;
import com.huigou.topsun.customer.domain.CustomerBank; import com.huigou.topsun.customer.domain.*;
import com.huigou.topsun.customer.domain.query.CustomerQueryRequest; import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import com.huigou.topsun.customer.domain.Province;
import com.huigou.topsun.customer.domain.vo.CustomerVo; import com.huigou.topsun.customer.domain.vo.CustomerVo;
import com.huigou.uasp.annotation.ControllerMapping; import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.client.CommonController; import com.huigou.uasp.client.CommonController;
...@@ -70,6 +69,7 @@ public class CustomerController extends CommonController { ...@@ -70,6 +69,7 @@ public class CustomerController extends CommonController {
/** /**
* 转跳到客户详细信息页面 * 转跳到客户详细信息页面
*
* @return * @return
*/ */
public String forwardCustomerDetail() { public String forwardCustomerDetail() {
...@@ -84,6 +84,7 @@ public class CustomerController extends CommonController { ...@@ -84,6 +84,7 @@ public class CustomerController extends CommonController {
/** /**
* 新增客户,转跳到新增页面 * 新增客户,转跳到新增页面
*
* @return * @return
*/ */
public String addCustomerDetail() { public String addCustomerDetail() {
...@@ -92,6 +93,7 @@ public class CustomerController extends CommonController { ...@@ -92,6 +93,7 @@ public class CustomerController extends CommonController {
/** /**
* 根据id列表删除用户 * 根据id列表删除用户
*
* @return * @return
*/ */
public String deleteCustomer() { public String deleteCustomer() {
...@@ -105,15 +107,23 @@ public class CustomerController extends CommonController { ...@@ -105,15 +107,23 @@ public class CustomerController extends CommonController {
/** /**
* 保存客户信息(多表保存,添加事务) * 保存客户信息(多表保存,添加事务)
*
* @return * @return
*/ */
public String saveCustomer() { public String saveCustomer() {
SDO sdo = getSDO(); SDO sdo = getSDO();
String customerId = sdo.getString("customerId"); CustomerVo customerVo = sdo.toObject(CustomerVo.class);
//TODO List<CustomerContact> customerContactList = sdo.getList("contactList", CustomerContact.class);
//保存客户信息 List<CustomerDebtContact> baoshenEmailList = sdo.getList("baoshenEmailList", CustomerDebtContact.class);
return null; List<CustomerDebtContact> customerEmailList = sdo.getList("customerEmailList", CustomerDebtContact.class);
List<CustomerRelated> customerRelatedList = sdo.getList("customerRelatedList", CustomerRelated.class);
List<CustomerPayInfo> customerPayInfoList = sdo.getList("customerPayInfoList", CustomerPayInfo.class);
customerVo = customerApplication.saveCustomer(customerVo, customerContactList, baoshenEmailList, customerEmailList, customerRelatedList, customerPayInfoList);
return success(customerVo);
} }
/** /**
* 展示客户省市数据,如果客户的省份编码是省级行政单位,直接返回省份数据, * 展示客户省市数据,如果客户的省份编码是省级行政单位,直接返回省份数据,
* 如果客户的省份编码是二级或者三级行政单位,则需要返回对应的省级或者市级行政单位 * 如果客户的省份编码是二级或者三级行政单位,则需要返回对应的省级或者市级行政单位
...@@ -160,6 +170,7 @@ public class CustomerController extends CommonController { ...@@ -160,6 +170,7 @@ public class CustomerController extends CommonController {
/** /**
* 根据id列表删除联系人 * 根据id列表删除联系人
*
* @return * @return
*/ */
public String deleteContact() { public String deleteContact() {
...@@ -171,17 +182,17 @@ public class CustomerController extends CommonController { ...@@ -171,17 +182,17 @@ public class CustomerController extends CommonController {
/** /**
* 删除客户及其附属信息 * 删除客户及其附属信息
*
* @return * @return
*/ */
public String deleteCustomerAndAffiliatedInfoByCustomerId() { public String deleteCustomerAndAffiliatedInfoByCustomerId() {
SDO sdo = getSDO(); SDO sdo = getSDO();
String customerId = sdo.getString("customerId"); List<String> customerIds = sdo.getIds();
//TODO customerApplication.deleteCustomerAndAffiliatedInfoByCustomerId(customerIds);
//多表联删
return success(); return success();
}
}
} }
...@@ -8,17 +8,21 @@ import com.huigou.uasp.annotation.ControllerMapping; ...@@ -8,17 +8,21 @@ import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.annotation.SkipAuth; import com.huigou.uasp.annotation.SkipAuth;
import com.huigou.uasp.client.CommonController; import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO; import com.huigou.util.SDO;
import com.huigou.util.StringUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* title: * title:
* author:ZHT * author:ZHT
* date:2023/12/19 * date:2023/12/19
* description: * description:
* 催货款通知邮箱 * 催货款通知邮箱
*/ */
@Controller @Controller
@ControllerMapping("/customerDebtContact") @ControllerMapping("/customerDebtContact")
...@@ -44,6 +48,7 @@ public class CustomerDebtContactController extends CommonController { ...@@ -44,6 +48,7 @@ public class CustomerDebtContactController extends CommonController {
public String saveCustomerDebtContactDetail() { public String saveCustomerDebtContactDetail() {
return forward("customerDebtContactDetail"); return forward("customerDebtContactDetail");
} }
/** /**
* 获取催货款通知邮箱 * 获取催货款通知邮箱
*/ */
...@@ -52,7 +57,20 @@ public class CustomerDebtContactController extends CommonController { ...@@ -52,7 +57,20 @@ public class CustomerDebtContactController extends CommonController {
String customerId = sdo.getString("customerId"); String customerId = sdo.getString("customerId");
String customerEmailType = sdo.getString("customerEmailType"); String customerEmailType = sdo.getString("customerEmailType");
List<CustomerDebtContact> customerDebtContactList = customerDebtContactApplication.getCustomerDebtContactList(customerId, customerEmailType); List<CustomerDebtContact> customerDebtContactList = customerDebtContactApplication.getCustomerDebtContactList(customerId, customerEmailType);
return packGridDataAndResult(customerDebtContactList); List<CustomerDebtContactVo> customerDebtContactVoList = customerDebtContactList.stream().map(customerDebtContact -> {
CustomerDebtContactVo customerDebtContactVo = new CustomerDebtContactVo();
BeanUtils.copyProperties(customerDebtContact, customerDebtContactVo);
String sendEmail = customerDebtContact.getSendEmail();
if (!StringUtils.isEmpty(sendEmail)) {
if (sendEmail.equals("0")) {
customerDebtContactVo.setSendEmailTextView("否");
} else {
customerDebtContactVo.setSendEmailTextView("是");
}
}
return customerDebtContactVo;
}).collect(Collectors.toList());
return packGridDataAndResult(customerDebtContactVoList);
} }
/** /**
......
...@@ -2,6 +2,7 @@ package com.huigou.topsun.customer.controller; ...@@ -2,6 +2,7 @@ package com.huigou.topsun.customer.controller;
import com.huigou.topsun.customer.application.CustomerPayInfoApplication; import com.huigou.topsun.customer.application.CustomerPayInfoApplication;
import com.huigou.topsun.customer.domain.CustomerPayInfo; import com.huigou.topsun.customer.domain.CustomerPayInfo;
import com.huigou.topsun.customer.domain.CustomerRelated;
import com.huigou.topsun.customer.domain.query.CustomerPayInfoQueryRequest; import com.huigou.topsun.customer.domain.query.CustomerPayInfoQueryRequest;
import com.huigou.topsun.customer.domain.vo.CustomerPayInfoVo; import com.huigou.topsun.customer.domain.vo.CustomerPayInfoVo;
import com.huigou.uasp.annotation.ControllerMapping; import com.huigou.uasp.annotation.ControllerMapping;
...@@ -49,9 +50,9 @@ public class CustomerPayInfoController extends CommonController { ...@@ -49,9 +50,9 @@ public class CustomerPayInfoController extends CommonController {
*/ */
public String slicedCustomerPayInfoList() { public String slicedCustomerPayInfoList() {
SDO sdo = this.getSDO(); SDO sdo = this.getSDO();
CustomerPayInfoQueryRequest queryRequest = sdo.toQueryRequest(CustomerPayInfoQueryRequest.class); String customerId = sdo.getString("customerId");
List<CustomerPayInfo> customerPayInfoList = customerPayInfoApplication.getCustomerPayInfoList(customerId);
return toResult(customerPayInfoApplication.getCustomerPayInfoList(queryRequest)); return packGridDataAndResult(customerPayInfoList);
} }
/** /**
......
...@@ -42,6 +42,11 @@ public class CustomerDebtContactVo implements Serializable { ...@@ -42,6 +42,11 @@ public class CustomerDebtContactVo implements Serializable {
*/ */
private String sendEmail; private String sendEmail;
/**
* 前端展示字段
*/
private String sendEmailTextView;
/** /**
* 邮箱类型(customerEmailType)-(宝绅邮箱、客户邮箱) * 邮箱类型(customerEmailType)-(宝绅邮箱、客户邮箱)
*/ */
......
...@@ -5,4 +5,6 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -5,4 +5,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
public interface CustomerBankRepository extends JpaRepository<CustomerBank,String> { public interface CustomerBankRepository extends JpaRepository<CustomerBank,String> {
CustomerBank findCustomerBankByCustomerId(String customerId); CustomerBank findCustomerBankByCustomerId(String customerId);
} }
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<query-mappings> <query-mappings>
<query name="deleteCustomerBank" label="删除客户银行信息" table="customer_bank">
<sql-query>
delete
from customer_bank c
where customer_id = ?
</sql-query>
</query>
<query name="customerList" label="客户信息表" table="customer"> <query name="customerList" label="客户信息表" table="customer">
<sql-query> <sql-query>
select c.* from customer c where 1=1 select c.* from customer c where 1=1
...@@ -17,6 +25,15 @@ ...@@ -17,6 +25,15 @@
</sql-query> </sql-query>
</query> </query>
<query name="deleteCustomerDebtContact" label="删除催货款通知邮箱" table="customer_debt_contact">
<sql-query>
delete
from customer_debt_contact c
where customer_id = ?
</sql-query>
</query>
<query name="customerRelated" label="客户关系关联信息表" table="customer_related"> <query name="customerRelated" label="客户关系关联信息表" table="customer_related">
<sql-query> <sql-query>
select c.* select c.*
...@@ -24,6 +41,13 @@ ...@@ -24,6 +41,13 @@
where customer_id = ? where customer_id = ?
</sql-query> </sql-query>
</query> </query>
<query name="deleteCustomerRelated" label="删除客户关系关联信息" table="customer_related">
<sql-query>
delete
from customer_related c
where customer_id = ?
</sql-query>
</query>
<query name="CustomerPayInfo" label="客户付款信息表" table="customer_pay_info"> <query name="CustomerPayInfo" label="客户付款信息表" table="customer_pay_info">
<sql-query> <sql-query>
...@@ -32,12 +56,26 @@ ...@@ -32,12 +56,26 @@
where customer_id = ? where customer_id = ?
</sql-query> </sql-query>
</query> </query>
<query name="deleteCustomerPayInfo" label="删除客户付款信息" table="customer_pay_info">
<sql-query>
delete
from customer_pay_info c
where customer_id = ?
</sql-query>
</query>
<query name="contactList" label="联系人信息表" table="customerContact"> <query name="contactList" label="联系人信息表" table="customer_contact">
<sql-query> <sql-query>
select c.* from customer_contact c where c.customer_id = ? select c.* from customer_contact c where c.customer_id = ?
</sql-query> </sql-query>
</query> </query>
<query name="deleteContact" label="删除联系人信息" table="customer_contact">
<sql-query>
delete
from customer_contact c
where customer_id = ?
</sql-query>
</query>
<query name="monthlySettlementMethod" label="月结方式表" table="monthly_settlement_method"> <query name="monthlySettlementMethod" label="月结方式表" table="monthly_settlement_method">
<sql-query> <sql-query>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment