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

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

Signed-off-by: 全洪江's avatarHongjiang <hongjiang.quan@topsunit.com>
parent b8d581c7
......@@ -17,9 +17,7 @@ function loadCustomerInfoListGrid() {
updateHandler: function () {
updateHandler();
},
deleteHandler: function () {
updateHandler();
}
deleteHandler: deleteHandler,
});
gridManager = UICtrl.grid("#customerInfoListGrid", {
columns: [
......@@ -77,7 +75,7 @@ function addHandler() {
//删除按钮
function deleteHandler() {
DataUtil.del({
action: 'customer/deleteCustomer.ajax',
action: 'customer/deleteCustomerAndAffiliatedInfoByCustomerId.ajax',
gridManager: gridManager, idFieldName: 'customerId',
onSuccess: function () {
reloadGrid();
......
......@@ -14,17 +14,7 @@ public interface CustomerApplication {
Map<String, Object> findCustomerByPage(CustomerQueryRequest customerQueryRequest);
List<CustomerContact> findContactByPage(String customerId);
void deleteContactById(String id);
void deleteContactByIds(List<String> ids);
}
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.query.CustomerRelatedQueryRequest;
import com.huigou.topsun.customer.domain.vo.CustomerRelatedVo;
......@@ -14,9 +15,9 @@ import java.util.Map;
* description:
*/
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);
......
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.QueryModel;
import com.huigou.topsun.customer.application.CustomerApplication;
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.repository.CustomerRepository;
import com.huigou.topsun.customer.repository.CustomerContactRepository;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
......@@ -19,6 +20,8 @@ import java.util.Map;
@Service
public class CustomerApplicationImpl extends BaseApplication implements CustomerApplication {
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
List<CustomerContact> customerContactList = this.sqlExecutorDao.queryToList(queryDescriptor.getSql(), CustomerContact.class, customerId);
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;
*/
@Service
public class CustomerRelatedApplicationImpl extends BaseApplication implements CustomerRelatedApplication {
public static final String QUERY_XML_FILE_PATH = "config/topsun/customer/customerMapper.xml";
@Autowired
private CustomerRelatedRepository customerRelatedRepository;
@Override
public Map<String, Object> getCustomerRelatedList(CustomerRelatedQueryRequest queryRequest) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "customerRelated");
QueryModel queryModel = this.sqlExecutorDao.getQueryModel(queryDescriptor, queryRequest);
Map<String, Object> map = this.sqlExecutorDao.executeSlicedQuery(queryModel);
return map;
public List<CustomerRelated> getCustomerRelatedList(String customerId) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH,"customerRelated");
List<CustomerRelated> customerRelatedList = sqlExecutorDao.queryToList(queryDescriptor.getSql(), CustomerRelated.class, customerId);
return customerRelatedList;
}
@Override
......
......@@ -158,6 +158,29 @@ public class CustomerController extends CommonController {
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 {
SDO sdo = this.getSDO();
String customerId = sdo.getString("customerId");
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 {
*/
public String slicedCustomerRelatedList() {
SDO sdo = this.getSDO();
CustomerRelatedQueryRequest queryRequest = sdo.toQueryRequest(CustomerRelatedQueryRequest.class);
return toResult(customerRelatedApplication.getCustomerRelatedList(queryRequest));
String customerId = sdo.getString("customerId");
List<CustomerRelated> customerRelatedList = customerRelatedApplication.getCustomerRelatedList(customerId);
return packGridDataAndResult(customerRelatedList);
}
/**
......
......@@ -12,8 +12,8 @@
<sql-query>
select c.*
from customer_debt_contact c
where customer_email_type = ?
and customer_id = ?
where customer_id = ?
and customer_email_type = ?
</sql-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