Commit c8d3ae01 authored by 全洪江's avatar 全洪江

客户模块前端页面调整,后端查询删除

Signed-off-by: 全洪江's avatarHongjiang <hongjiang.quan@topsunit.com>
parent b8d581c7
...@@ -17,9 +17,7 @@ function loadCustomerInfoListGrid() { ...@@ -17,9 +17,7 @@ function loadCustomerInfoListGrid() {
updateHandler: function () { updateHandler: function () {
updateHandler(); updateHandler();
}, },
deleteHandler: function () { deleteHandler: deleteHandler,
updateHandler();
}
}); });
gridManager = UICtrl.grid("#customerInfoListGrid", { gridManager = UICtrl.grid("#customerInfoListGrid", {
columns: [ columns: [
...@@ -77,7 +75,7 @@ function addHandler() { ...@@ -77,7 +75,7 @@ function addHandler() {
//删除按钮 //删除按钮
function deleteHandler() { function deleteHandler() {
DataUtil.del({ DataUtil.del({
action: 'customer/deleteCustomer.ajax', action: 'customer/deleteCustomerAndAffiliatedInfoByCustomerId.ajax',
gridManager: gridManager, idFieldName: 'customerId', gridManager: gridManager, idFieldName: 'customerId',
onSuccess: function () { onSuccess: function () {
reloadGrid(); reloadGrid();
......
...@@ -14,17 +14,7 @@ public interface CustomerApplication { ...@@ -14,17 +14,7 @@ public interface CustomerApplication {
Map<String, Object> findCustomerByPage(CustomerQueryRequest customerQueryRequest); Map<String, Object> findCustomerByPage(CustomerQueryRequest customerQueryRequest);
List<CustomerContact> findContactByPage(String customerId); List<CustomerContact> findContactByPage(String customerId);
void deleteContactById(String id);
void deleteContactByIds(List<String> ids);
} }
package com.huigou.topsun.customer.application; package com.huigou.topsun.customer.application;
import com.huigou.topsun.customer.controller.CustomerRelatedController;
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;
...@@ -14,9 +15,9 @@ import java.util.Map; ...@@ -14,9 +15,9 @@ import java.util.Map;
* description: * description:
*/ */
public interface CustomerRelatedApplication { public interface CustomerRelatedApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/customer/customerMapper.xml";
Map<String, Object> getCustomerRelatedList(CustomerRelatedQueryRequest queryRequest);
List<CustomerRelated> getCustomerRelatedList(String customerId);
CustomerRelatedVo saveCustomerRelated(CustomerRelated customerRelated); CustomerRelatedVo saveCustomerRelated(CustomerRelated customerRelated);
......
package com.huigou.topsun.customer.application.Impl; package com.huigou.topsun.customer.application.Impl;
import com.huigou.cache.DictUtil;
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.CustomerApplication;
import com.huigou.topsun.customer.domain.CustomerContact; import com.huigou.topsun.customer.domain.CustomerContact;
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.repository.CustomerRepository; import com.huigou.topsun.customer.repository.CustomerContactRepository;
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.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -19,6 +20,8 @@ import java.util.Map; ...@@ -19,6 +20,8 @@ import java.util.Map;
@Service @Service
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
private CustomerContactRepository customerContactRepository;
/** /**
...@@ -44,4 +47,25 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer ...@@ -44,4 +47,25 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer
List<CustomerContact> customerContactList = this.sqlExecutorDao.queryToList(queryDescriptor.getSql(), CustomerContact.class, customerId); List<CustomerContact> customerContactList = this.sqlExecutorDao.queryToList(queryDescriptor.getSql(), CustomerContact.class, customerId);
return customerContactList; return customerContactList;
} }
/**
* 根据单个id删除
* @param id
*/
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void deleteContactById(String id) {
customerContactRepository.delete(id);
}
/**
* 批量进行删除
* @param ids
*/
@Override
@Transactional
public void deleteContactByIds(List<String> ids) {
ids.forEach(this::deleteContactById);
}
} }
...@@ -23,16 +23,15 @@ import java.util.Map; ...@@ -23,16 +23,15 @@ import java.util.Map;
*/ */
@Service @Service
public class CustomerRelatedApplicationImpl extends BaseApplication implements CustomerRelatedApplication { public class CustomerRelatedApplicationImpl extends BaseApplication implements CustomerRelatedApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/customer/customerMapper.xml";
@Autowired @Autowired
private CustomerRelatedRepository customerRelatedRepository; private CustomerRelatedRepository customerRelatedRepository;
@Override @Override
public Map<String, Object> getCustomerRelatedList(CustomerRelatedQueryRequest queryRequest) { public List<CustomerRelated> getCustomerRelatedList(String customerId) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "customerRelated"); QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH,"customerRelated");
QueryModel queryModel = this.sqlExecutorDao.getQueryModel(queryDescriptor, queryRequest); List<CustomerRelated> customerRelatedList = sqlExecutorDao.queryToList(queryDescriptor.getSql(), CustomerRelated.class, customerId);
Map<String, Object> map = this.sqlExecutorDao.executeSlicedQuery(queryModel); return customerRelatedList;
return map;
} }
@Override @Override
......
...@@ -158,6 +158,29 @@ public class CustomerController extends CommonController { ...@@ -158,6 +158,29 @@ public class CustomerController extends CommonController {
return customerBank; return customerBank;
} }
/**
* 根据id列表删除联系人
* @return
*/
public String deleteContact() {
SDO sdo = getSDO();
List<String> ids = sdo.getIds();
customerApplication.deleteContactByIds(ids);
return success();
}
/**
* 删除客户及其附属信息
* @return
*/
public String deleteCustomerAndAffiliatedInfoByCustomerId() {
SDO sdo = getSDO();
String customerId = sdo.getString("customerId");
//TODO
//多表联删
return success();
}
......
...@@ -51,7 +51,8 @@ public class CustomerDebtContactController extends CommonController { ...@@ -51,7 +51,8 @@ public class CustomerDebtContactController extends CommonController {
SDO sdo = this.getSDO(); SDO sdo = this.getSDO();
String customerId = sdo.getString("customerId"); String customerId = sdo.getString("customerId");
String customerEmailType = sdo.getString("customerEmailType"); String customerEmailType = sdo.getString("customerEmailType");
return packGridDataAndResult(customerDebtContactApplication.getCustomerDebtContactList(customerId,customerEmailType)); List<CustomerDebtContact> customerDebtContactList = customerDebtContactApplication.getCustomerDebtContactList(customerId, customerEmailType);
return packGridDataAndResult(customerDebtContactList);
} }
/** /**
......
...@@ -47,9 +47,9 @@ public class CustomerRelatedController extends CommonController { ...@@ -47,9 +47,9 @@ public class CustomerRelatedController extends CommonController {
*/ */
public String slicedCustomerRelatedList() { public String slicedCustomerRelatedList() {
SDO sdo = this.getSDO(); SDO sdo = this.getSDO();
CustomerRelatedQueryRequest queryRequest = sdo.toQueryRequest(CustomerRelatedQueryRequest.class); String customerId = sdo.getString("customerId");
List<CustomerRelated> customerRelatedList = customerRelatedApplication.getCustomerRelatedList(customerId);
return toResult(customerRelatedApplication.getCustomerRelatedList(queryRequest)); return packGridDataAndResult(customerRelatedList);
} }
/** /**
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
<sql-query> <sql-query>
select c.* select c.*
from customer_debt_contact c from customer_debt_contact c
where customer_email_type = ? where customer_id = ?
and customer_id = ? and customer_email_type = ?
</sql-query> </sql-query>
</query> </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