Commit 47bf80b9 authored by 刘学辉's avatar 刘学辉

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

parents 23a3665a ce80bd7d
...@@ -15,6 +15,7 @@ function loadCostCenterListGrid() { ...@@ -15,6 +15,7 @@ function loadCostCenterListGrid() {
addHandler: function () { addHandler: function () {
addHandler(); addHandler();
}, },
impExcelDataHandler:{id:'impExcelData',img:'fa-table',text:'导入数据',click:impExcelDataHandler},
// updateHandler: function () { // updateHandler: function () {
// updateHandler(); // updateHandler();
// }, // },
...@@ -105,6 +106,13 @@ function addHandler() { ...@@ -105,6 +106,13 @@ function addHandler() {
}) })
} }
//从EXCEL导入数据
function impExcelDataHandler(){
ExcelImpManager.showImpDialog('导入', 'sapCostCenterData', '100', function (){
reloadGrid();
});
}
function updateHandler(row) { function updateHandler(row) {
if (!row) { if (!row) {
row = DataUtil.getUpdateRow(gridManager); row = DataUtil.getUpdateRow(gridManager);
......
...@@ -9,7 +9,8 @@ ...@@ -9,7 +9,8 @@
<%@ 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,combox,commonTree,date,attachment" />
<x:script src="/system/excelimport/AssignCodeImp.js"/>
<x:script src='/biz/topsun/sap/costCenter/sapCostCenterList.js'/> <x:script src='/biz/topsun/sap/costCenter/sapCostCenterList.js'/>
</head> </head>
<body> <body>
......
...@@ -83,7 +83,7 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA ...@@ -83,7 +83,7 @@ public class CostCenterApplicationImpl extends FlowBroker implements CostCenterA
@Override @Override
public void saveCostCenter(CostCenter costCenter) { public void saveCostCenter(CostCenter costCenter) {
costCenterRepository.save(costCenter);
} }
@Override @Override
......
package com.huigou.topsun.sap.costCenter.application.impl;
import com.huigou.cache.DictUtil;
import com.huigou.context.OrgUnit;
import com.huigou.topsun.sap.costCenter.application.CostCenterApplication;
import com.huigou.topsun.sap.costCenter.domain.CostCenter;
import com.huigou.topsun.sap.costCenter.domain.TmpCostCenterData;
import com.huigou.topsun.sap.costCenter.repository.TmpCostCenterDataRepository;
import com.huigou.topsun.sap.fixedAssets.domain.TmpFixedAssessData;
import com.huigou.topsun.sap.fixedAssets.repository.TmpFixedAssessDataRepository;
import com.huigou.uasp.bmp.common.BizBillStatus;
import com.huigou.uasp.bmp.opm.application.OrgApplication;
import com.huigou.uasp.bmp.opm.domain.model.org.Org;
import com.huigou.uasp.tool.dataimport.application.ExcelImportInterface;
import com.huigou.util.StringUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
@Service("costCenterDataExcelImport")
public class CostCenterDataExcelImport implements ExcelImportInterface {
@Autowired
private TmpCostCenterDataRepository tmpCostCenterDataRepository;
@Autowired
private OrgApplication orgApplication;
@Autowired
private CostCenterApplication costCenterApplication;
@Override
public void executeImport(String batchNumer) {
List<TmpCostCenterData> centerDataList = tmpCostCenterDataRepository.findByBatchNumber(batchNumer);
if (!CollectionUtils.isEmpty(centerDataList)){
for (TmpCostCenterData tmpCostCenterData : centerDataList) {
CostCenter costCenter = new CostCenter();
BeanUtils.copyProperties(tmpCostCenterData,costCenter);
costCenter.setIsDelete(0);
costCenter.setIsEnable(1);
costCenter.setTYPE("S");
costCenter.setMESSAGE("成本中心主数据创建成功!");
costCenter.setStatusId(BizBillStatus.COMPLETED.getId());
// String value = DictUtil.getDictionaryDetailValue("KOSAR", tmpCostCenterData.getKosar());
// if (StringUtil.isBlank(value)){
// throw new RuntimeException("未识别的成本中心类型");
// }
//costCenter.setKosar(tmpCostCenterData.getKosar());
// String prctr = DictUtil.getDictionaryDetailValue("PRCTR", tmpCostCenterData.getPrctr());
// if (StringUtil.isBlank(prctr)){
// throw new RuntimeException("未识别的利润中心类型");
// }
//costCenter.setPrctr(prctr);
if (StringUtil.isBlank(tmpCostCenterData.getCreatedCode())){
throw new RuntimeException("创建人编码不能为空");
}
Org org = orgApplication.loadMainOrgByLoginName(tmpCostCenterData.getCreatedCode());
costCenter.setDefaultValues(new OrgUnit(org.getFullId(), org.getFullName()));
costCenterApplication.saveCostCenter(costCenter);
}
}
}
}
package com.huigou.topsun.sap.costCenter.domain;
import com.huigou.topsun.common.AbstractPortalOrg;
import com.topsunit.query.annotations.Dictionary;
import lombok.Data;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
* @Auther: xin.lu
* @Date: 2023/12/13/10:42
* @Description:
*/
@Table(name = "tmp_cost_center_data")
@Entity
@Data
public class TmpCostCenterData extends AbstractPortalOrg {
/**
* 成本中心编码
*/
@Column(name = "kostl")
private String kostl;
/**
* 有效截至日 默认9999.12.31
*/
@Column(name = "datab")
private Date datab;
/**
* 有效期自 默认当年1月1日
*/
@Column(name = "datbi")
private Date datbi;
/**
* 名称
*/
@Column(name = "ktext")
private String ktext;
/**
* 描述
*/
@Column(name = "ltext")
private String ltext;
/**
* 成本中心类型
* 管理类 L
* 销售类 V
* 研发类 E
* 间接生产类 G
* 直接生产类 F
*/
@Column(name = "kosar")
@Dictionary("KOSAR")
private String kosar;
/**
* 负责人
*/
@Column(name = "verak")
private String verak;
/**
* 层次结构范围
*/
@Column(name = "KHINR")
private String khinr;
/**
* 利润中心
* 10001000 广州宝绅科技利润中心
* 10001001 广州宝绅RFID利润中心
*/
@Column(name = "prctr")
@Dictionary("PRCTR")
private String prctr;
/**
* 创建人编码
*/
@Column(name = "created_code")
private String createdCode;
/**
* 创建人名称
*/
@Column(name = "created_name")
private String createdName;
}
package com.huigou.topsun.sap.costCenter.repository;
import com.huigou.topsun.sap.costCenter.domain.TmpCostCenterData;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
/**
* @Auther: xin.lu
* @Date: 2024/05/16/15:38
* @Description:
*/
public interface TmpCostCenterDataRepository extends JpaRepository<TmpCostCenterData,String> {
List<TmpCostCenterData> findByBatchNumber(String batchNumber);
}
package com.huigou.topsun.sap.customerDelayPay.application.impl; package com.huigou.topsun.sap.customerDelayPay.application.impl;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.huigou.data.domain.model.CommonDomainConstants; import com.huigou.data.domain.model.CommonDomainConstants;
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.sap.common.DefaultHttpClient;
import com.huigou.topsun.sap.customerDelayPay.application.CustomerDelayPayApplication; import com.huigou.topsun.sap.customerDelayPay.application.CustomerDelayPayApplication;
import com.huigou.topsun.sap.customerDelayPay.application.CustomerDelayPayItemApplication; import com.huigou.topsun.sap.customerDelayPay.application.CustomerDelayPayItemApplication;
import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPay; import com.huigou.topsun.sap.customerDelayPay.domain.CustomerDelayPay;
...@@ -20,6 +23,8 @@ import org.springframework.stereotype.Service; ...@@ -20,6 +23,8 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -35,6 +40,9 @@ public class CustomerDelayPayApplicationImpl extends FlowBroker implements Custo ...@@ -35,6 +40,9 @@ public class CustomerDelayPayApplicationImpl extends FlowBroker implements Custo
@Autowired @Autowired
private CustomerDelayPayItemApplication customerDelayPayItemApplication; private CustomerDelayPayItemApplication customerDelayPayItemApplication;
@Autowired
DefaultHttpClient defaultHttpClient;
@Override @Override
public CustomerDelayPay findCustomerDelayPayById(String id) { public CustomerDelayPay findCustomerDelayPayById(String id) {
return customerDelayPayRepository.findOne(id); return customerDelayPayRepository.findOne(id);
...@@ -122,6 +130,7 @@ public class CustomerDelayPayApplicationImpl extends FlowBroker implements Custo ...@@ -122,6 +130,7 @@ public class CustomerDelayPayApplicationImpl extends FlowBroker implements Custo
CustomerDelayPay customerDelayPay = customerDelayPayRepository.findOne(bizId); CustomerDelayPay customerDelayPay = customerDelayPayRepository.findOne(bizId);
customerDelayPay.setStatusId(status.getId()); customerDelayPay.setStatusId(status.getId());
customerDelayPayRepository.save(customerDelayPay); customerDelayPayRepository.save(customerDelayPay);
this.sendCustomerDelayPayToSap(customerDelayPay);
} }
@Override @Override
...@@ -148,4 +157,28 @@ public class CustomerDelayPayApplicationImpl extends FlowBroker implements Custo ...@@ -148,4 +157,28 @@ public class CustomerDelayPayApplicationImpl extends FlowBroker implements Custo
} }
} }
public void sendCustomerDelayPayToSap(CustomerDelayPay customerDelayPay){
Map<String,Object> param = new HashMap<>();
param.put("BUKRS",customerDelayPay.getBukrs());
param.put("KUNNR",customerDelayPay.getCustomer());
param.put("ZBPMNR",customerDelayPay.getBillCode());
List<Map<String,Object>> mapList = new ArrayList<>();
mapList.add(param);
ObjectMapper objectMapper = new ObjectMapper();
String url = "overdue_rel";
try {
String result = defaultHttpClient.execute(mapList, url);
List<Map<String, Object>> resultList = objectMapper.readValue(result, new TypeReference<List<Map<String, Object>>>() {});
Map<String, Object> resultMap = resultList.get(0);
if (!"S".equals(resultMap.get("TYPE"))) {
throw new RuntimeException("数据传输失败,请稍后手动重试!"+resultMap.get("MESSAGE"));
}
customerDelayPay.setType((String) resultMap.get("TYPE"));
customerDelayPay.setMessage((String) resultMap.get("MESSAGE"));
customerDelayPayRepository.save(customerDelayPay);
} catch (Exception e) {
throw new RuntimeException("数据传输失败请检查数据后重试!"+e.getMessage());
}
}
} }
...@@ -53,6 +53,12 @@ public class CustomerDelayPay extends FlowBillAbstractEntity { ...@@ -53,6 +53,12 @@ public class CustomerDelayPay extends FlowBillAbstractEntity {
*/ */
@Column(name = "PAY_DATE") @Column(name = "PAY_DATE")
private Date payDate; private Date payDate;
@Column(name = "TYPE")
private String type;
@Column(name = "MESSGAE")
private String message;
@Override @Override
protected String getCodeRuleId() { protected String getCodeRuleId() {
return "customerDelayPay"; return "customerDelayPay";
......
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