Commit de0e8818 authored by wanghang's avatar wanghang

Merge remote-tracking branch 'origin/dev' into dev

parents 2dc4dc6b 4b45e918
/**
* 监听页面动作,维护数据映射及数据集
* 当前主要使用遍历实现。
* 后期优化项目, window.dataSet.newData.backColors.compares 需要向外抛出、并且单独维护。
* @createDate 2019-04-12
*/
......@@ -177,7 +178,10 @@ function checkArrayMapper(str) {
}
/**
* Grid 编辑前触发。 这里记录当前编辑框 对应的 Grid 行索引 GridRowIndex
*     
* Grid 编辑前触发。 这里记录当前编辑框 对应的 Grid 行 rowIndex 和列 property <br> &nbsp;&nbsp;&nbsp;&nbsp;
* 这里根据 UI ID生成规则封装。 需要根据此规则维护。 <br> &nbsp;&nbsp;&nbsp;&nbsp;
* 编辑前,根据 UI 生成的编辑框命名规则,定位到当前编辑栏目。修改数据时以此栏目位置为定位标准修改对应数据集。只记录当前栏目,使用完后需要清除。
* @param options
* @private
*/
......@@ -186,53 +190,105 @@ function onBeforeEdit_(options) {
options.onBeforeEdit = function(editParm, gg){
let domIds = editParm.column.__domid.split('|'), recordId = editParm.record.__id, colName = editParm.column.name;
let parentDomId = domIds[0]+'|'+2+'|'+recordId; // +'|'+domIds[2];
let domId = domIds[0]+'|'+2+'|'+recordId +'|'+domIds[2];
let rowDOM;
if(!(rowDOM = document.getElementById(parentDomId))) {
parentDomId = domIds[0]+'|'+1+'|'+recordId;
rowDOM = document.getElementById(parentDomId)
}
let mapper = window.dataMapping.mapper;
let rowId = rowDOM.childNodes[0].childNodes[0].innerText;
let rowIndex = rowDOM.childNodes[0].childNodes[0].innerText;
let mapperEntry = mapper[colName];
let currentMapper = checkArrayMapper(domIds[0]);
if(currentMapper.hasOwnProperty("beanName")) {
if(!mapperEntry[currentMapper.beanName]) {
console.error("dataMapping 中,无法找到该 DOMId 的映射。请检查!");
if(mapperEntry[currentMapper.beanName]) {
mapperEntry[currentMapper.beanName]['rowIndex'] = rowIndex;
mapperEntry[currentMapper.beanName]['colName'] = colName;
mapperEntry[currentMapper.beanName]['domId'] = domId;
mapperEntry[currentMapper.beanName][rowIndex] = editParm.rowindex;
} else {
//mapperEntry[currentMapper.beanName]['rowId'] = parentDomId;
mapperEntry[currentMapper.beanName][rowId]['rowIndex'] = editParm.rowindex;
// mapperEntry[currentMapper.beanName][rowIndex] = colName;
// console.error("dataMapping 中,无法找到该 DOMId 的映射。请检查!");
}
}
originalOnBeforeEdit.call(this, editParm, '11');
}
}
function listeningSearchbox(elId, options) {
/**
* 监听 下拉框初始化 ,使选中值时维护 dataSet。显示值需要自己处理。
* @param elId 需要渲染的下拉框的 DOMId
* @param options
*/
function listeningSearchbox(elId, options, gridId) {
const originalOnChange = options.onChange;
options.onChange = function(value, data) {
let eleName = this.element[0].name;
options.onChange = function(value, data, fillInValue) {
let eleName = this.element[0].name, beanName = '';
let currentMapper = window.dataMapping.mapper[eleName];
if(!currentMapper) {
console.error("找不到该映射,请检查映射配置是否存在该配置: "+ eleName);
}
let fillInValue;
Object.entries(currentMapper).forEach(mapper => {
let property = "";
if(eleName.split('_').length > 1) {
property = eleName.split('_')[1];
} else {
beanName = mapper[0];
property = mapper[1];
}
let beanName = mapper[0];
if(typeof property== 'string') {
// ------------------ Form 下拉框执行此逻辑 ------------------
window.dataSet.newData[beanName][property] = data[property];
fillInValue = data[property];
} else if(property instanceof Object) {
// ------------------ Grid 下拉框执行此逻辑 ------------------
if(property.rowIndex) {
let rowIndex = property.rowIndex;
let propertyName = property.colName;
let domId = property.domId;
window.dataSet.newData[beanName].compares[rowIndex][propertyName] = data[propertyName];
fillInValue = domId;
let gridEdit = window.dataGrid['fronColorsGrid'].editor;
if(gridEdit.editParm.column.editor.type === 'select') {
let showProperty = gridEdit.editParm.column.editor.showProperty
window.dataGrid[gridId].editor.editParm.record[propertyName] = data[showProperty];
}
property.rowIndex = null;
property.colName = null;
property.domId = null;
}
window.dataSet.newData[beanName][property] = data[property];
fillInValue = data[property];
}
}
})
originalOnChange.call(this, value, data, fillInValue);
if(fillInValue) {
originalOnChange.call(this, value, data, fillInValue);
}
}
$(elId).searchbox(options);
}
/**
* &nbsp;&nbsp;&nbsp;&nbsp;
* Gria 中的下拉框 用此方式初始化。此下拉框维护 dataSet, 显示值需要自己处理。
* @param propertyName GridId_propertyName,需要以此定位到需要展开下拉框的栏目(临时)
* @param options
*/
function listeningGridSearchbox(propertyName, options) {
if(!window.gridSearchboxOptions) {
window.gridSearchboxOptions = {};
}
window.gridSearchboxOptions[propertyName] = options;
}
function DropdownTrigger(node) {
let nodeId = node.id;
let tempId = nodeId.slice(0, nodeId.lastIndexOf('_'));
if(node.getAttribute('select')) {
listeningSearchbox('#'+nodeId, window.gridSearchboxOptions[tempId], nodeId.split('_')[0]);
}
}
/**
* 若需要监听 Grid 数据,必须在此调用组件初始化,此处获取元素 ID
* @param elId
......@@ -280,8 +336,8 @@ function listeningGrid(elId, options) {
// ------------- 设置 mapper -------------
settingGridMapper(currentMapper.property.columns, mapper, rowId, beanName, data);
data[idProperty] = rowId;
data['rowIndex'] =rowId
// data[idProperty] = rowId;
data['rowIndex'] = rowId
// ------------- 设置 compares -------------
if(!window.dataSet.newData[beanName]) {
window.dataSet.newData[beanName] = {};
......@@ -296,7 +352,7 @@ function listeningGrid(elId, options) {
}
window.dataSet.newData[beanName].ids.push(rowId);
UICtrl.addGridRow(gridManager, data);
originalOnClick.call(this, data);
originalOnClick.call(this, data, gridManager);
}
}
if(but.id === "menuDelete") {
......@@ -316,13 +372,17 @@ function listeningGrid(elId, options) {
});
gridManager.deleteSelectedRow();
debugger;
originalOnClick.call(this, selectRow);
originalOnClick.call(this, selectRow, gridManager);
}
}
})
}
addObserver(elId);
var gridManager = UICtrl.grid(elId, options);
if(!window.dataGrid){
window.dataGrid = {};
}
window.dataGrid[elId.slice(1)] = gridManager;
return gridManager;
}
......@@ -359,13 +419,12 @@ function listenerContent(event) {
// Grid 时执行此逻辑
if(control === 'grid') {
debugger;
tryForEach(Object.entries(beanMapping), mapperEntry => {
Object.entries(beanMapping).forEach(mapperEntry => {
let mapperKey = mapperEntry[0], mapperVal = mapperEntry[1];
Object.entries(mapperEntry[1]).forEach(rowEntry => {
let rowId = rowEntry[0];
if(rowEntry[1].rowIndex != undefined) {
if(rowEntry[1].rowIndex === inputIds[2] * 1) {
if(rowEntry[1] !== undefined) {
if(rowEntry[1] === inputIds[2] * 1) {
window.dataSet.newData[mapperKey].compares[rowId][inputIds[1]] = event.target.value;
console.log('Input value changed:', event.target.value);
}
......@@ -424,7 +483,8 @@ const observer = new MutationObserver((mutations) => {
let childNodes = addNodes[0].childNodes;
if(childNodes.length === 1 && childNodes[0].nodeName === 'INPUT') {
let node = childNodes[0];
node.addEventListener('input', gridEditor)
node.addEventListener('input', gridEditor);
DropdownTrigger(node);
}
}
let removeNodes = mutation.removedNodes;
......@@ -469,6 +529,7 @@ function checkUpdata() {
let rawIds = raw.ids, nowIds = now.ids;
dataSet.upData[beanName] = {};
dataSet.upData[beanName].del = [];
debugger;
let delIds = rawIds.filter(x => !nowIds.includes(x));
tryForEach(delIds, id => {
dataSet.upData[beanName].del.push(rawCompares[id]);
......
......@@ -70,7 +70,7 @@ function loadContactListGrid() {
}
},
{
display: "邮箱", name: "contactMail", width: 300, minWidth: 60, type: "string", align: "left",
display: "邮箱", name: "contactEmail", width: 300, minWidth: 60, type: "string", align: "left",
editor: {
required: true, type: "text"
}
......
......@@ -4,6 +4,7 @@ $(document).ready(function() {
initializeToobarContainer();
initializeTab();
initializateSelectC();
initGridSearchbox();
// runObserver();
});
......@@ -51,13 +52,23 @@ function initializateSelectC() {
$('#submitForm').formSet(showData);
processedGrid('#processedGrid', window.dataSet.rawData.processed);
});
// $('#selectedTechnology').val(data.productTechnologyName)
}
});
}
function initGridSearchbox() {
listeningGridSearchbox('fronColorsGrid_colorId', {
type: "product",
name: "color",
onChange: function (value, data, fillInValue) {
console.log('fillInValue : '+ fillInValue);
}
})
}
function initializeUI() {
UICtrl.layout("#layout",{
heigth:'280px',
......@@ -168,11 +179,11 @@ var dataMapping = {
},
fronColors: {
id: "productFaceColorId",
columns: [ "productFaceColorId", "coverageRate" ]
columns: [ "productFaceColorId", "coverageRate", "productFaceId", "colorId" ]
},
backColors: {
id: "productFaceColorId",
columns: [ "productFaceColorId", "coverageRate" ]
columns: [ "productFaceColorId", "coverageRate", "productFaceId", "colorId" ]
},
processed: {
id: "productTechnologyId",
......@@ -186,23 +197,29 @@ var dataMapping = {
function faceGrid(elId, data) {
var toolbarOptions = UICtrl.getDefaultToolbarOptions({
addHandler: function(rawData){
debugger;
addHandler: function(rawData, gridManager){
let isBack = true;
if(gridManager.id.indexOf('fronColors') >= 0) { isBack = false; }
window.dataSet.newData.frontFaces.raw.forEach(item=> {
if(isBack === item.back) {
if(isBack) {
window.dataSet.newData.backColors.compares[rawData.rowIndex].productFaceId = item.productFaceId;
} else {
window.dataSet.newData.fronColors.compares[rawData.rowIndex].productFaceId = item.productFaceId;
}
}
})
},
updateHandler: function(){
updateHandler();
},
deleteHandler: (rowData) => {
deleteHandler: (rowData, gridManager) => {
console.log(rowData.rowIndex);
},
});
var gridManager = listeningGrid(elId, {
columns: [
{ display: "颜色名称", name: "productFaceColorId", width: 140, minWidth: 60, type: "string", align: "left", editor: {
type: 'text',
required: true
{ display: "颜色名称", name: "colorId", width: 140, minWidth: 60, type: "string", align: "left", editor: {
type: 'select', showProperty: 'colorName'
}},
{ display: "油墨覆盖率(%)", name: "coverageRate", width: 120, minWidth: 60, type: "string", align: "left", editor: { type: 'text', required: true } }
{ display: "油墨覆盖率(%)", name: "coverageRate", width: 120, minWidth: 60, type: "string", align: "left", editor: { type: 'text'} }
],
toolbar: toolbarOptions,
dataType: "local",
......@@ -211,12 +228,13 @@ function faceGrid(elId, data) {
checkbox: true,
usePager: false,
width: "98%",
height: "98%",
height: "90%",
onBeforeEdit : function(editParm, gg) {
console.log('original run onBeforeEdit()');
},
onDblClickRow : function(data, rowindex, rowobj) {
}
onAfterEdit: function() {
debugger;
},
});
}
......
package com.huigou.topsun.customer.application;
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.*;
import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import com.huigou.topsun.customer.domain.vo.CustomerListVo;
import com.huigou.topsun.customer.domain.vo.CustomerVo;
import com.huigou.topsun.customer.domain.vo.ReturnCustomerListVo;
import java.util.List;
import java.util.Map;
......@@ -25,4 +23,9 @@ public interface CustomerApplication {
CustomerVo saveCustomer(CustomerVo customerVo, List<CustomerContact> customerContactList, List<CustomerDebtContact> baoshenEmailList, List<CustomerDebtContact> customerEmailList, List<CustomerRelated> customerRelatedList, List<CustomerPayInfo> customerPayInfoList);
void deleteCustomerAndAffiliatedInfoByCustomerId(List<String> customerIds);
List<CustomerListVo> getCustomerList();
List<ReturnCustomerListVo> getReturnCustomerListVoList(List<CustomerListVo> customerListVoList);
}
package com.huigou.topsun.customer.application;
import com.huigou.topsun.customer.domain.CustomerOrder;
public interface CustomerOrderApplication {
CustomerOrder getCustomerOrderByCustomerId(String customerId);
}
package com.huigou.topsun.customer.application.Impl;
import cn.hutool.core.bean.BeanUtil;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.customer.application.*;
import com.huigou.topsun.customer.domain.*;
import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import com.huigou.topsun.customer.domain.vo.CustomerContactVo;
import com.huigou.topsun.customer.domain.vo.CustomerListVo;
import com.huigou.topsun.customer.domain.vo.CustomerVo;
import com.huigou.topsun.customer.domain.vo.ReturnCustomerListVo;
import com.huigou.topsun.customer.repository.*;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.springframework.beans.BeanUtils;
......@@ -16,8 +20,11 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
......@@ -129,12 +136,12 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer
// customerDebtContact.setCustomerEmailType("1");
// CustomerDebtContactRepository.saveAndFlush(customerDebtContact);
// }
customerEmailList.forEach(customerDebtContact ->{
customerEmailList.forEach(customerDebtContact -> {
customerDebtContact.setCustomerId(customerId);
customerDebtContact.setCustomerEmailType("1");
CustomerDebtContactRepository.saveAndFlush(customerDebtContact);
});
baoshenEmailList.forEach(customerDebtContact ->{
baoshenEmailList.forEach(customerDebtContact -> {
customerDebtContact.setCustomerId(customerId);
customerDebtContact.setCustomerEmailType("0");
CustomerDebtContactRepository.saveAndFlush(customerDebtContact);
......@@ -169,6 +176,56 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer
}
@Override
public List<CustomerListVo> getCustomerList() {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "getCustomerList");
List<CustomerListVo> customerListVoList = this.sqlExecutorDao.queryToList(queryDescriptor.getSql(), CustomerListVo.class);
return customerListVoList;
}
@Override
public List<ReturnCustomerListVo> getReturnCustomerListVoList(List<CustomerListVo> customerListVoList) {
List<ReturnCustomerListVo> returnCustomerListVoList = new ArrayList<>();
List<String> customerIdList = new ArrayList<>();
for (CustomerListVo customerListVo : customerListVoList) {
if (!BeanUtil.isEmpty(customerListVo)) {
String customerId = customerListVo.getCustomerId();
customerIdList.add(customerId);
}
}
List<String> idList = customerIdList.stream().distinct().collect(Collectors.toList());
for (String s : idList) {
ReturnCustomerListVo returnCustomerListVo = new ReturnCustomerListVo();
List<CustomerContactVo> customerContactVoList = new ArrayList<>();
for (CustomerListVo customerListVo : customerListVoList) {
if (!BeanUtil.isEmpty(customerListVo)) {
if (s.equals(customerListVo.getCustomerId())) {
CustomerContactVo customerContactVo = new CustomerContactVo();
BeanUtil.copyProperties(customerListVo, customerContactVo);
customerContactVoList.add(customerContactVo);
returnCustomerListVo.setCustomerContactVoList(customerContactVoList);
// BeanUtil.copyProperties(returnCustomerListVo,customerContactVo);
String provinceCode = customerListVo.getProvinceCode();
List<Province> provinceList = customerBaseInfoApplication.findByProvinceCode(provinceCode);
StringBuffer provinceInfoList = new StringBuffer();
for (Province province : provinceList) {
provinceInfoList.append(province.getProvinceName());
}
String provinceInfo = provinceInfoList.toString();
BeanUtils.copyProperties(customerListVo, returnCustomerListVo);
returnCustomerListVo.setBelongArea(provinceInfo);
}
}
}
returnCustomerListVoList.add(returnCustomerListVo);
}
return returnCustomerListVoList;
}
public Customer getCustomer(CustomerVo customerVo) {
Customer customer = new Customer();
BeanUtils.copyProperties(customerVo, customer);
......
......@@ -90,7 +90,7 @@ public class CustomerBaseInfoApplicationImpl extends BaseApplication implements
@Override
public CustomerOrder findCustomerOrderByCustomerId(String customerId) {
CustomerOrder customerOrder = customerOrderRepository.findCustomerBankByCustomerId(customerId);
CustomerOrder customerOrder = customerOrderRepository.findCustomerOrderByCustomerId(customerId);
return customerOrder;
}
......
package com.huigou.topsun.customer.application.Impl;
import com.huigou.topsun.customer.application.CustomerOrderApplication;
import com.huigou.topsun.customer.domain.CustomerOrder;
import com.huigou.topsun.customer.repository.CustomerOrderRepository;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class CustomerOrderApplicationImpl extends BaseApplication implements CustomerOrderApplication {
@Autowired
private CustomerOrderRepository customerOrderRepository;
@Override
public CustomerOrder getCustomerOrderByCustomerId(String customerId) {
CustomerOrder customerOrder = customerOrderRepository.findCustomerOrderByCustomerId(customerId);
return customerOrder;
}
}
package com.huigou.topsun.customer.controller;
import cn.hutool.core.bean.BeanUtil;
import com.huigou.topsun.customer.application.CustomerBaseInfoApplication;
import com.huigou.topsun.customer.application.CustomerApplication;
import com.huigou.topsun.customer.application.CustomerOrderApplication;
import com.huigou.topsun.customer.domain.*;
import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import com.huigou.topsun.customer.domain.vo.CustomerListVo;
import com.huigou.topsun.customer.domain.vo.CustomerVo;
import com.huigou.topsun.customer.domain.vo.ReturnCustomerListVo;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.annotation.SkipAuth;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
import org.apache.commons.lang.StringUtils;
......@@ -27,12 +32,31 @@ public class CustomerController extends CommonController {
private CustomerBaseInfoApplication customerBaseInfoApplication;
@Autowired
private CustomerApplication customerApplication;
@Autowired
private CustomerOrderApplication customerOrderApplication;
@Override
protected String getPagePath() {
return "/biz/topsun/customer/";
}
@SkipAuth
public String getCustomerList() {
List<CustomerListVo> customerListVoList = customerApplication.getCustomerList();
List<ReturnCustomerListVo> returnCustomerListVoList = customerApplication.getReturnCustomerListVoList(customerListVoList);
Map<String, Object> returnCustomerListVoMap = new HashMap<>();
returnCustomerListVoMap.put("customerList", returnCustomerListVoList);
return toResult(returnCustomerListVoMap);
}
/**
* 转跳到客户信息列表页面
*
......@@ -96,7 +120,6 @@ public class CustomerController extends CommonController {
}
/**
* 保存客户信息(多表保存,添加事务)
*
......@@ -162,6 +185,7 @@ public class CustomerController extends CommonController {
/**
* 加载订单信息
*
* @return
*/
public CustomerOrder loadCustomerOrder() {
......
......@@ -50,8 +50,8 @@ public class CustomerContact implements Serializable {
/**
* 邮件
*/
@Column(name = "contact_mail")
private String contactMail;
@Column(name = "contact_email")
private String contactEmail;
private static final long serialVersionUID = 1L;
......
......@@ -35,7 +35,7 @@ public class ContactQueryRequest extends QueryAbstractRequest {
/**
* 邮件
*/
private String contactMail;
private String contactEmail;
public String getCustomerContactId() {
return customerContactId;
......@@ -77,11 +77,11 @@ public class ContactQueryRequest extends QueryAbstractRequest {
this.contactFax = contactFax;
}
public String getContactMail() {
return contactMail;
public String getContactEmail() {
return contactEmail;
}
public void setContactMail(String contactMail) {
this.contactMail = contactMail;
public void setContactEmail(String contactEmail) {
this.contactEmail = contactEmail;
}
}
package com.huigou.topsun.customer.domain.query;
import com.huigou.data.domain.query.QueryAbstractRequest;
public class CustomerOrderQueryRequest extends QueryAbstractRequest{
}
package com.huigou.topsun.customer.domain.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CustomerContactVo implements Serializable {
/**
* 联系人
*/
private String contactName;
/**
* 电话号码 contactPhone
*/
private String contactPhone;
/**
* 传真 contactFax
*/
private String contactFax;
/**
* email contactEmail
*/
private String contactEmail;
}
package com.huigou.topsun.customer.domain.vo;
import lombok.Data;
import java.io.Serializable;
@Data
public class CustomerListVo implements Serializable {
/**
* 客户id
*/
private String customerId;
/**
* 客户全称
*/
private String customerName;
/**
* 地区编码
*/
private String provinceCode;
/**
* 报价币别 quotationCurrency
*/
private String quotationCurrency;
/**
* 结算方式 monthlySettlementMethod
*/
private String monthlySettlementMethod;
/**
* 订单性质 orderKind
*/
private String orderKind;
/**
* 联系人
*/
private String contactName;
/**
* 电话号码 contactPhone
*/
private String contactPhone;
/**
* 传真 contactFax
*/
private String contactFax;
/**
* email contactEmail
*/
private String contactEmail;
/**
* 备注 remark
*/
private String remark;
}
......@@ -281,11 +281,11 @@ public class CustomerVo implements Serializable {
return customerId;
}
public static CustomerVo getCustomerVo(CustomerVo customerVo){
return JSON.parseObject(JSON.toJSONString(customerVo), CustomerVo.class);
public static CustomerVo getCustomerVo(Customer customer){
return JSON.parseObject(JSON.toJSONString(customer), CustomerVo.class);
}
public static Customer getCustomer(Customer customer){
return JSON.parseObject(JSON.toJSONString(customer),Customer.class);
public static Customer getCustomer(CustomerVo customerVo){
return JSON.parseObject(JSON.toJSONString(customerVo),Customer.class);
}
}
package com.huigou.topsun.customer.domain.vo;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class ReturnCustomerListVo implements Serializable {
/**
* 客户全称
*/
private String customerName;
/**
* 所属地区 belongArea
*/
private String belongArea;
/**
* 报价币别 quotationCurrency
*/
private String quotationCurrency;
/**
* 结算方式 monthlySettlementMethod
*/
private String monthlySettlementMethod;
/**
* 订单性质 orderKind
*/
private String orderKind;
// /**
// * 联系人
// */
// private String contactName;
// /**
// * 电话号码 contactPhone
// */
// private String contactPhone;
//
// /**
// * 传真 contactFax
// */
// private String contactFax;
// /**
// * email contactEmail
// */
// private String contactEmail;
/**
* 联系人列表
*/
private List<CustomerContactVo> customerContactVoList;
/**
* 备注 remark
*/
private String remark;
}
......@@ -4,5 +4,7 @@ import com.huigou.topsun.customer.domain.CustomerOrder;
import org.springframework.data.jpa.repository.JpaRepository;
public interface CustomerOrderRepository extends JpaRepository<CustomerOrder, String> {
CustomerOrder findCustomerBankByCustomerId(String customerId);
CustomerOrder findCustomerOrderByCustomerId(String customerId);
}
......@@ -42,4 +42,6 @@ public interface ProductApplication {
* @createDate 2023/12/8 17:19
*/
HashMap<String, Object> saveOrUpdataOnAllDetail(HashMap<String, Object> newData);
HashMap<String, Object> queryProductList();
}
......@@ -6,6 +6,7 @@ import com.huigou.topsun.product.application.ProductApplication;
import com.huigou.topsun.product.domain.*;
import com.huigou.topsun.product.repository.*;
import com.huigou.topsun.util.Snowflake;
import com.huigou.uasp.bmp.common.application.BaseApplication;
import lombok.RequiredArgsConstructor;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Service;
......@@ -29,7 +30,7 @@ import java.util.stream.Stream;
*/
@Service
@RequiredArgsConstructor
public class ProductApplicationImpl implements ProductApplication {
public class ProductApplicationImpl extends BaseApplication implements ProductApplication {
@PersistenceContext(unitName = "system")
private EntityManager entityManager;
......@@ -107,9 +108,10 @@ public class ProductApplicationImpl implements ProductApplication {
if(productDetail != null) {
ArrayList<ProductFace> frontFaces = new ArrayList<>();
if(productDetail.getBackProductFaceId() != null) {
ProductFace frontFace = faceRepository.findByProductFaceId(productDetail.getBackProductFaceId());
ProductFace frontFace = faceRepository.findByProductFaceId(productDetail.getRightProductFaceId());
frontFace.setBack(false);
ArrayList <ProductFaceColor> fronColors =
(ArrayList<ProductFaceColor>) faceColorRepository.findByProductFaceId(productDetail.getBackProductFaceId());
(ArrayList<ProductFaceColor>) faceColorRepository.findByProductFaceId(productDetail.getRightProductFaceId());
frontFaces.add(frontFace);
assemble.put("fronColors", fronColors == null ? new ArrayList<>() : fronColors);
} else {
......@@ -122,6 +124,7 @@ public class ProductApplicationImpl implements ProductApplication {
}
if(productDetail.getBackProductFaceId() != null) {
ProductFace backFace = faceRepository.findByProductFaceId(productDetail.getBackProductFaceId());
backFace.setBack(true);
ArrayList <ProductFaceColor> backColors =
(ArrayList<ProductFaceColor>) faceColorRepository.findByProductFaceId(productDetail.getBackProductFaceId());
frontFaces.add(backFace);
......@@ -221,6 +224,27 @@ public class ProductApplicationImpl implements ProductApplication {
return map;
}
@Override
public HashMap<String, Object> queryProductList() {
String sql = "SELECT\n" +
"\tt.product_id,\n" +
"\tt.product_category_id,\n" +
"\tt.product_unit,\n" +
"\tt.is_only_code,\n" +
"\tt.brand_name,\n" +
"\tpc.dispatch_multiple,\n" +
"\tpc.row_num,\n" +
"\tpt.product_technology_name\n" +
"FROM\n" +
"\tproduct t\n" +
"\tLEFT JOIN product_published_conf pc ON t.product_id = pc.product_id\n" +
"\tLEFT JOIN product_technology pt ON t.product_id = pt.product_id";
ArrayList<Map<String, Object>> list = (ArrayList<Map<String, Object>>) this.sqlExecutorDao.queryToListMap(sql);
HashMap<String, Object> map = new HashMap<>(3);
map.put("productList", list);
return map;
}
@SuppressWarnings("unchecked")
public static <T> T uncheckedCast(Object obj) {
if(obj != null) {
......@@ -230,10 +254,10 @@ public class ProductApplicationImpl implements ProductApplication {
}
/**
* description 持久化数据.
* <br>&nbsp;&nbsp;Entity 时,如果 ID 为空执行 Persist,否则执行 Merge
* <br>&nbsp;&nbsp;List 时,要求数据集格式 :
* <br>&nbsp;&nbsp;&nbsp;&nbsp;HashMap { ”add“: List< Entity >, ”up“: List< Entity >, ”del“: List< Entity > }
* description 持久化数据. <br>&nbsp;&nbsp;&nbsp;&nbsp;
* Entity 时,如果 ID 为空执行 Persist,否则执行 Merge <br>&nbsp;&nbsp;&nbsp;&nbsp;
* List 时,要求数据集格式 : <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
* HashMap {”add“: List< Entity >,”up“: List< Entity >,”del“: List< Entity >}
* @param entitys 持久化数据集合 Set { Entity, HashMap }
* @author qinzhenguan
* @createDate 2023/12/26 16:44
......
......@@ -11,6 +11,7 @@ import com.huigou.topsun.product.application.ProductProcessApplication;
import com.huigou.topsun.product.domain.Product;
import com.huigou.topsun.product.domain.ProductProcess;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.annotation.SkipAuth;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -118,4 +119,16 @@ public class ProductController extends CommonController {
return success(list);
}
@SkipAuth
public String queryProductList() {
HashMap<String, Object> aa = productService.queryProductList();
String json = "";
try {
json = objectMapper.writeValueAsString(aa);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
return success(aa);
}
}
\ No newline at end of file
......@@ -7,10 +7,7 @@ import com.huigou.topsun.common.NumberToStringSerializer;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -38,6 +35,9 @@ public class ProductFace implements Serializable {
@Column(name = "product_image", nullable = true, length = 512)
private String productImage;
@Transient
private Boolean isBack;
@Override
public boolean equals(Object o) {
if (this == o) return true;
......@@ -66,4 +66,12 @@ public class ProductFace implements Serializable {
public void setProductImage(String productImage) {
this.productImage = productImage;
}
public Boolean getBack() {
return isBack;
}
public void setBack(Boolean back) {
isBack = back;
}
}
package com.huigou.topsun.product.repository;
import java.math.BigDecimal;
/**
* A Projection for the {@link com.huigou.topsun.product.domain.ProductDetail} entity
*/
public interface ProductDetailInfo {
String getFactoryName();
BigDecimal getBackProductFaceId();
}
\ No newline at end of file
package com.huigou.topsun.product.repository;
import java.math.BigDecimal;
/**
* A Projection for the {@link com.huigou.topsun.product.domain.Product} entity
*/
public interface ProductInfo {
BigDecimal getProductId();
String getProductName();
}
\ No newline at end of file
......@@ -4,6 +4,8 @@ import com.huigou.topsun.product.domain.Product;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author: xin.lu
* @Date: 2023/11/22/10:40
......@@ -12,4 +14,6 @@ import org.springframework.stereotype.Repository;
@Repository
public interface ProductRepository extends JpaRepository<Product,String> {
@Override
List<Product> findAll();
}
......@@ -16,6 +16,17 @@
<condition column="customer_name" name="customerName" type="java.lang.String" symbol="like" alias="c"/>
</query>
<query name="getCustomerList" label="对外查询客户信息" table="customer">
<sql-query>
SELECT customer.customer_id,customer.customer_name,customer.province_code,co.quotation_currency,co.monthly_settlement_method,co.order_kind,ccc.contact_name,ccc.contact_phone,ccc.contact_fax,ccc.contact_email,co.remark
FROM customer LEFT JOIN
(SELECT c.customer_id,cc.contact_name,cc.contact_phone,cc.contact_fax,cc.contact_email FROM customer c LEFT JOIN customer_contact cc ON c.customer_id = cc.customer_id) AS ccc
ON customer.customer_id = ccc.customer_id LEFT JOIN customer_order co
ON customer.customer_id = co.customer_id
</sql-query>
</query>
<query name="customerDebtContact" label="催货款通知邮箱表" table="customer_debt_contact">
<sql-query>
select c.*
......
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