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

客户信息模块

parent 90386387
<%@ page contentType="text/html; charset=utf-8" language="java"%>
<%@ taglib uri="/WEB-INF/taglib.tld" prefix="x"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<x:base include="layout,dialog,grid,dateTime,tree,combox,attachment" />
<html>
<head>
<title>Title</title>
</head>
<body>
</body>
</html>
var gridManager = null;
$(document).ready(function() {
initializationUI();
loadCustomerListGrid();
});
function initializationUI() {
UICtrl.layout("#layout",{leftWidth: 3});
}
function loadCustomerListGrid() {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
updateHandler: function(){
updateHandler();
}
});
gridManager = UICtrl.grid("#customerInfoListGrid", {
columns: [
{ display: "客户编码", name: "customerCode", width: 100, minWidth: 60, type: "string", align: "left" },
{ display: "客户名称", name: "customerShortName", width: 120, minWidth: 60, type: "string", align: "left" },
// { display: "客户工作时间", name: "customerWorkTime", width: 120, minWidth: 60, type: "datetime", align: "left" },
{ display: "客户英文名称", name: "customerEnName", width: 120, minWidth: 60, type: "string", align: "left" },
{ display: "客户英文名称简称", name: "customer_en_short_name", width: 100, minWidth: 60, type: "string", align: "left" },
{ display: "所属地区", name: "provinceId", width: 150, minWidth: 60, type: "string", align: "left" }
// { display: "客户等级", name: "customerLevel", width: 100, minWidth: 60, type: "string", align: "left" },
// { display: "工厂代号", name: "customerFactoryCode", width: 140, minWidth: 60, type: "string", align: "left" },
// { display: "地址", name: "customer_address", width: 140, minWidth: 60, type: "string", align: "left" },
// { display: "所属集团", name: "customerGroup", width: 140, minWidth: 60, type: "string", align: "left" },
// { display: "邮编", name: "customerZipCode", width: 140, minWidth: 60, type: "string", align: "left" }
],
dataType: "server",
url: web_app.name + '/customer/findCustomerInfo.ajax',
pageSize: 20,
usePager: true,
toolbar: toolbarOptions,
width: "50%",
height: "100%",
heightDiff: -8,
checkbox: true,
fixedCellHeight: true,
selectRowButtonOnly: true,
onDblClickRow : function(data, rowindex, rowobj) {
updateHandler(data);
}
});
UICtrl.setSearchAreaToggle(gridManager);
}
// parms: {
// page: 0,
// size: 30
// },
function updateHandler(data) {
var id = data.customerId;
if (!id) {
id = DataUtil.getUpdateRowId(gridManager);
if (!id) {
return;
}
}
var url=DataUtil.composeURLByParam('/customer/forwardCustomerInfoDetails.do',{ data: JSON.stringify(data) });
UICtrl.addTabItem({tabid:'viewFlowChart' + id, text:"客户详细信息",url:url});
// debugger;
// UICtrl.addTabItem({
// tabid: 'viewFlowChart' + id,
// text: "产品信息",
// url: web_app.name + '/bizFlowChart/showViewFlowchart.load?businessProcessId=' + id
// });
}
<%@ page language="java" contentType="text/html; charset=utf-8"%>
<%@taglib uri="/WEB-INF/taglib.tld" prefix="x"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<title>Title</title>
<x:base include="layout,dialog,grid,tree,combox,commonTree" />
<x:script src='/system/opm/js/OpmUtil.js'/>
<x:script src='/biz/topsun/common/purchaseCommon.js'/>
<x:script src='/biz/topsun/customer/customerInfoList.js'/>
</head>
<body>
<div position="center" title="客户信息管理">
<div id="customerInfoListGrid" style="margin: 2px;"></div>
</div>
</body>
</html>
package com.huigou.topsun.customer.application;
import com.huigou.topsun.customer.domain.Province;
import java.util.List;
public interface CustomerBaseInfoApplication {
Province findByProvinceParentId(String provinceCode);
List<Province> findByProvinceCode(String provinceCode);
}
package com.huigou.topsun.customer.application;
public interface CustomerDebtContactApplication {
}
package com.huigou.topsun.customer.application;
import java.util.List;
import java.util.Map;
/**
* 分页查询客户信息数据
*/
public interface CustomerInfoApplication {
List<Map<String, Object>> findCustomerInfoPage(int page, int size);
}
package com.huigou.topsun.customer.application;
public interface CustomerOtherInfoApplication {
}
package com.huigou.topsun.customer.application.Impl;
import com.huigou.topsun.customer.application.CustomerBaseInfoApplication;
import com.huigou.topsun.customer.domain.Province;
import com.huigou.topsun.customer.repository.ProvinceRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
@Service
public class CustomerBaseInfoApplicationImpl implements CustomerBaseInfoApplication {
@Autowired
private ProvinceRepository provinceRepository;
@Override
public List<Province> findByProvinceCode(String provinceCode) {
Province province = provinceRepository.findByProvinceCode(provinceCode);
List<Province> provinceList = new ArrayList<>();
if (province != null) {
String provinceParentId = province.getProvinceParentId();
//获取上一级信息
Province parentProvince = findByProvinceParentId(provinceParentId);
if (parentProvince != null || !parentProvince.getProvinceParentId().equals(0)) {
//获取上一级信息
Province grandParentProvince = findByProvinceParentId(parentProvince.getProvinceParentId());
provinceList.add(parentProvince);
provinceList.add(grandParentProvince);
}
provinceList.add(parentProvince);
}
provinceList.add(province);
return provinceList;
}
/**
* @param provinceParentId
* @return provinceList
*/
@Override
public Province findByProvinceParentId(String provinceParentId) {
Province province = provinceRepository.findByProvinceParentId(provinceParentId);
return province;
}
}
package com.huigou.topsun.customer.application.Impl;
import com.huigou.topsun.customer.application.CustomerDebtContactApplication;
public class CustomerDebtContactApplicationImpl implements CustomerDebtContactApplication {
}
package com.huigou.topsun.customer.application.Impl;
import com.huigou.topsun.customer.application.CustomerInfoApplication;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
@Service
public class CustomerInfoApplicationImpl implements CustomerInfoApplication {
/**
* 分页查询客户信息数据
* @param page
* @param size
* @return
*/
@Override
public List<Map<String, Object>> findCustomerInfoPage(int page, int size) {
return null;
}
}
package com.huigou.topsun.customer.application.Impl;
import com.huigou.topsun.customer.application.CustomerOtherInfoApplication;
public class CustomerOtherInfoApplicationImpl implements CustomerOtherInfoApplication {
}
package com.huigou.topsun.customer.controller;
import com.huigou.topsun.customer.application.CustomerBaseInfoApplication;
import com.huigou.topsun.customer.application.CustomerInfoApplication;
import com.huigou.topsun.customer.domain.Province;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Controller
@ControllerMapping("/customerInfo")
public class CustomerInfoController extends CommonController {
@Autowired
private CustomerBaseInfoApplication customerBaseInfoApplication;
@Autowired
private CustomerInfoApplication customerInfoApplication;
@Override
protected String getPagePath() {
return "/biz/topsun/customer/";
}
/**
* 转跳到客户信息列表页面
* @return
*/
public String forwardCustomerInfoList() {
return forward("customerInfoList");
}
/**
* 展示客户信息列表
* @return
*/
public String findCustomerInfo() {
List<Map<String,Object>> customerInfoPage = customerInfoApplication.findCustomerInfoPage(0,30);
HashMap<Object, Object> map = new HashMap<>(3);
map.put("Rows",customerInfoPage);
return toResult(map);
}
/**
* 转跳到客户列表页面
* @return
*/
public String forwardCustomerInfo() {
return forward("customerInfoList");
}
/**
* 转跳到客户详细信息页面
* @return
*/
public String forwardCustomerDetail() {
return forward("customerInfoDetail");
}
/**
* 展示客户省市数据,如果客户的省份编码是省级行政单位,直接返回省份数据,
* 如果客户的省份编码是二级或者三级行政单位,则需要返回对应的省级或者市级行政单位
* @return
*/
public String findProvinceInfo() {
SDO sdo = this.getSDO();
//获取省份编码
String provinceCode = sdo.getString("provinceCode");
List<Province> provinceList = new ArrayList<>();
if (!StringUtils.isEmpty(provinceCode)) {
provinceList = customerBaseInfoApplication.findByProvinceCode(provinceCode);
}
List<String> provinceNameList = provinceList.stream().map(province -> province.getProvinceName()).collect(Collectors.toList());
Map<Object, Object> map = new HashMap<>();
map.put("provinceNameList",provinceNameList);
return toResult(map);
}
/**
* 客户详细信息展示
* @return
*/
// public String loadProductDetail() {
//
// }
}
package com.huigou.topsun.customer.domain;
import java.io.Serializable;
import javax.persistence.*;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
/**
* 省市
*
* @TableName province
*/
@Table(name = "province")
@Data
@Entity
public class Province implements Serializable {
/**
* 主键id
*/
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "guid")
@Column(name = "province_id")
private String provinceId;
/**
* 省
*/
@Column(name = "province_name")
private String provinceName;
/**
* 编码
*/
@Column(name = "province_code")
private String provinceCode;
/**
* 父id
*/
@Column(name = "province_parent_id")
private String provinceParentId;
/**
* 删除标记
*/
@Column(name = "del_flag")
private Integer delFlag;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
package com.huigou.topsun.customer.repository;
import com.huigou.topsun.customer.domain.Province;
import org.springframework.data.jpa.repository.JpaRepository;
public interface ProvinceRepository extends JpaRepository<Province,String> {
Province findByProvinceParentId(String provinceParentId);
Province findByProvinceCode(String provinceCode);
}
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