Commit eafc45f0 authored by 刘学辉's avatar 刘学辉

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

parents 036cb5be d753d9a9
...@@ -56,5 +56,5 @@ ...@@ -56,5 +56,5 @@
<!– 上科大 –> <!– 上科大 –>
<import resource="classpath:config/spring/spring-tech.xml" />--> <import resource="classpath:config/spring/spring-tech.xml" />-->
<import resource="classpath:config/spring/spring-mybatis-plus.xml"/> <!--<import resource="classpath:config/spring/spring-mybatis-plus.xml"/>-->
</beans> </beans>
\ No newline at end of file
...@@ -496,8 +496,45 @@ function initPersonDialog() { ...@@ -496,8 +496,45 @@ function initPersonDialog() {
return {bizCode: 'PersonPicture', bizId: id, flag: 'false', deleteOld: 'true', returnPath: 'true'}; return {bizCode: 'PersonPicture', bizId: id, flag: 'false', deleteOld: 'true', returnPath: 'true'};
} }
}); });
var isSapPerson = $("#isSapPerson").val();
if (isSapPerson == "1"){
sapMesShow();
}
$("#isSapPerson").combox({onChange:function(data){
if (data.value == "1"){
sapMesShow();
}else {
$("#sapMes").hide();
sapMesHide();
}
}
});
} }
function sapMesShow(){
$("#sapMes").show();
UICtrl.setElRequiredFlag("#country",true);
UICtrl.setElRequiredFlag("#bankCountry",true);
UICtrl.setElRequiredFlag("#bankCode",true);
UICtrl.setElRequiredFlag("#consultItem",true);
UICtrl.setElRequiredFlag("#companyCode",true);
UICtrl.setElRequiredFlag("#bankAccountNumber",true);
}
function sapMesHide(){
UICtrl.setElRequiredFlag("#country",false);
UICtrl.setElRequiredFlag("#bankCountry",false);
UICtrl.setElRequiredFlag("#bankCode",false);
UICtrl.setElRequiredFlag("#consultItem",false);
UICtrl.setElRequiredFlag("#companyCode",false);
UICtrl.setElRequiredFlag("#bankAccountNumber",false);
$("#country").val("");
$("#bankCountry").val("");
$("#bankCode").val("");
$("#bankCode").val("");
$("#companyCode").val("");
$("#bankAccountNumber").val("");
}
function doSavePerson() { function doSavePerson() {
var _self = this; var _self = this;
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
<x:inputC name="certificateNo" id="certificateNo" label="证件号码" required="false" labelCol="2" fieldCol="4" maxlength="30"/> <x:inputC name="certificateNo" id="certificateNo" label="证件号码" required="false" labelCol="2" fieldCol="4" maxlength="30"/>
</div> </div>
<div class="hg-form-row"> <div class="hg-form-row">
<x:inputC name="caNo" label="CA序号" labelCol="2" fieldCol="4" maxlength="16"/> <x:inputC name="sequence" required="true" label="排序号" spinner="true" mask="nnn" dataOptions="min:1" labelCol="2" fieldCol="4" />
<x:selectC name="caStatus" label="CA状态" dictionary="caStatus" labelCol="2" fieldCol="4" /> <x:selectC name="isSapPerson" required="true" label="是否SAP员工" dictionary="yesorno" labelCol="2" fieldCol="4" />
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
...@@ -38,6 +38,26 @@ ...@@ -38,6 +38,26 @@
</div> </div>
</div> </div>
</div> </div>
<div id="sapMes" hidden="hidden">
<div class="hg-form-row">
<div class="col-md-8">
<x:inputC name="country" label="国家" labelCol="2" fieldCol="4" maxlength="16"/>
<x:inputC name="bankCountry" label="银行所属国家" labelCol="2" fieldCol="4" />
</div>
<div class="col-md-4">
<x:inputC name="bankCode" label="银行代码" labelCol="4" fieldCol="8" />
</div>
</div>
<div class="hg-form-row">
<div class="col-md-8">
<x:inputC name="consultItem" label="参考明细" labelCol="2" fieldCol="4" />
<x:inputC name="companyCode" label="公司代码" labelCol="2" fieldCol="4" />
</div>
<div class="col-md-4">
<x:inputC name="bankAccountNumber" required="false" label="银行账号" labelCol="4" fieldCol="8" />
</div>
</div>
</div>
<div class="hg-form-row"> <div class="hg-form-row">
<div class="col-md-8"> <div class="col-md-8">
<x:selectC name="sex" dictionary="sex" label="性别" labelCol="2" fieldCol="4" /> <x:selectC name="sex" dictionary="sex" label="性别" labelCol="2" fieldCol="4" />
...@@ -92,15 +112,6 @@ ...@@ -92,15 +112,6 @@
<x:inputC name="familyAddress" id="familyAddress" label="家庭地址" labelCol="2" fieldCol="10" maxlength="120" /> <x:inputC name="familyAddress" id="familyAddress" label="家庭地址" labelCol="2" fieldCol="10" maxlength="120" />
</div> </div>
</div> </div>
<div class="hg-form-row">
<div class="col-md-8">
<x:selectC name="securityGrade" label="密级" dictionary="securityGrade" labelCol="2" fieldCol="4" />
<x:selectC name="personSecurityGrade" label="涉密等级" dictionary="personSecurityGrade" labelCol="2" fieldCol="4" />
</div>
<div class="col-md-4">
<x:inputC name="sequence" required="true" label="排序号" spinner="true" mask="nnn" dataOptions="min:1" labelCol="4" fieldCol="8" />
</div>
</div>
<div class="hg-form-row"> <div class="hg-form-row">
<div class="col-md-8"> <div class="col-md-8">
<x:textareaC name="description" label="描述" maxlength="100" rows="2" labelCol="2" fieldCol="10" /> <x:textareaC name="description" label="描述" maxlength="100" rows="2" labelCol="2" fieldCol="10" />
......
...@@ -347,18 +347,18 @@ ...@@ -347,18 +347,18 @@
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus --> <!-- https://mvnrepository.com/artifact/com.baomidou/mybatis-plus -->
<dependency> <!--<dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId> <artifactId>mybatis-plus</artifactId>
<version>3.5.4</version> <version>3.5.4</version>
</dependency> </dependency>
<!--自3.5.4开始,传统Spring项目集成需要手动引入一下mybatis-spring.--> &lt;!&ndash;自3.5.4开始,传统Spring项目集成需要手动引入一下mybatis-spring.&ndash;&gt;
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId> <artifactId>mybatis-spring</artifactId>
<version>2.1.1</version> <version>2.1.1</version>
</dependency> </dependency>
-->
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
......
...@@ -185,10 +185,10 @@ ...@@ -185,10 +185,10 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <!--<dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId> <artifactId>mybatis-plus</artifactId>
</dependency> </dependency>-->
</dependencies> </dependencies>
<build> <build>
<finalName>topsun-xt</finalName> <finalName>topsun-xt</finalName>
......
...@@ -8,6 +8,10 @@ function initializateUI() { ...@@ -8,6 +8,10 @@ function initializateUI() {
var isEnable = $("#isEnable").val(); var isEnable = $("#isEnable").val();
if (isEnable == "0"){ if (isEnable == "0"){
UICtrl.setDisable($("#submitForm")); UICtrl.setDisable($("#submitForm"));
if (isApplyProcUnit()){
UICtrl.enable($("#telePhone"))
UICtrl.enable($("#reason"))
}
$(".subject").html("冻结成本中心") $(".subject").html("冻结成本中心")
} }
} }
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
<x:selectC name="kosar" required="true" label="成本中心类型" labelCol="2" dictionary="KOSAR" fieldCol="4"/> <x:selectC name="kosar" required="true" label="成本中心类型" labelCol="2" dictionary="KOSAR" fieldCol="4"/>
<x:inputC name="datbi" required="true" label="有限期自" labelCol="2" wrapper="date" fieldCol="4"/> <x:inputC name="datbi" required="true" label="有限期自" labelCol="2" wrapper="date" fieldCol="4"/>
<x:inputC name="datab" required="true" label="有限截止日" labelCol="2" wrapper="date" fieldCol="4"/> <x:inputC name="datab" required="true" label="有限截止日" labelCol="2" wrapper="date" fieldCol="4"/>
<x:inputC name="verak" required="false" label="负责人" labelCol="2" maxLength="64" fieldCol="4"/> <x:inputC name="verak" required="true" label="负责人" labelCol="2" maxLength="64" fieldCol="4"/>
<x:selectC name="prctr" required="true" label="利润中心" labelCol="2" dictionary="PRCTR" fieldCol="4"/> <x:selectC name="prctr" required="true" label="利润中心" labelCol="2" dictionary="PRCTR" fieldCol="4"/>
<x:inputC name="telePhone" required="false" label="联系方式" labelCol="2" maxLength="64" fieldCol="4"/> <x:inputC name="telePhone" required="false" label="联系方式" labelCol="2" maxLength="64" fieldCol="4"/>
<x:inputC name="reason" required="false" label="原因" labelCol="2" maxLength="255" fieldCol="4"/> <x:inputC name="reason" required="false" label="原因" labelCol="2" maxLength="255" fieldCol="4"/>
......
...@@ -15,11 +15,11 @@ function loadCostCenterListGrid() { ...@@ -15,11 +15,11 @@ function loadCostCenterListGrid() {
addHandler: function () { addHandler: function () {
addHandler(); addHandler();
}, },
updateHandler: function () { // updateHandler: function () {
updateHandler(); // updateHandler();
}, // },
deleteHandler: deleteHandler, // deleteHandler: deleteHandler,
disableHandler: disableHandler, // disableHandler: disableHandler,
frozenHandler: { frozenHandler: {
id: 'frozenHandler', text: '冻结', img: 'fa-clipboard', click: function () { id: 'frozenHandler', text: '冻结', img: 'fa-clipboard', click: function () {
var row = DataUtil.getUpdateRow(gridManager); var row = DataUtil.getUpdateRow(gridManager);
......
...@@ -15,16 +15,17 @@ ...@@ -15,16 +15,17 @@
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
<div class="ui-hide"> <div class="ui-hide">
<%-- <x:select name="processType" dictionary="processType" />--%>
<%-- <x:select name="yesorno" dictionary="yesorno" />--%>
</div> </div>
<div id="layout"> <div id="layout">
<div position="center" title="成本中心"> <div position="center" title="成本中心">
<x:title title="common.button.search" hideTable="queryMainForm" isHide="true" /> <x:title title="common.button.search" hideTable="queryMainForm" isHide="true" />
<%-- <form class="hg-form ui-hide" method="post" action="" id="queryMainForm">--%> <form class="hg-form ui-hide" method="post" action="" id="queryMainForm">
<%-- <x:inputC name="ruleKind" required="false" label="成本中心名称" labelCol="1"/>--%> <x:inputC name="kostl" required="false" label="成本中心编码" labelCol="1"/>
<%-- <x:searchButtons />--%> <x:inputC name="ktext" required="false" label="成本中心名称" labelCol="1"/>
<%-- </form>--%> <x:selectC name="kosar" required="false" label="成本中心类型" labelCol="1" dictionary="KOSAR"/>
<x:inputC name="verak" required="false" label="负责人" labelCol="1"/>
<x:searchButtons />
</form>
<div class="blank_div clearfix"></div> <div class="blank_div clearfix"></div>
<div id="sapCostCenterListGrid" style="margin: 2px;"></div> <div id="sapCostCenterListGrid" style="margin: 2px;"></div>
</div> </div>
......
...@@ -85,7 +85,10 @@ function loadGrid() { ...@@ -85,7 +85,10 @@ function loadGrid() {
}, },
{ {
display: "资产起息日", name: "bzdat", width: 120, minWidth: 60, type: "date", align: "left", display: "资产起息日", name: "bzdat", width: 120, minWidth: 60, type: "date", align: "left",
editor: {required: false, type: "date"} editor: {required: false, type: "date"},
render : function (record) {
return record.bzdat = record.budat;
}
}, },
{ {
display: "文本", name: "sgtxt", width: 260, minWidth: 60, type: "string", align: "left", display: "文本", name: "sgtxt", width: 260, minWidth: 60, type: "string", align: "left",
......
...@@ -7,6 +7,12 @@ $(document).ready(function () { ...@@ -7,6 +7,12 @@ $(document).ready(function () {
function initializateUI() { function initializateUI() {
UICtrl.layout("#layout", {leftWidth: 3}); UICtrl.layout("#layout", {leftWidth: 3});
var anlkl = $('#anlkl').val();
if (anlkl.indexOf("Z7")>=0){
disable();
}else {
enable();
}
} }
function bindQueryEvent() { function bindQueryEvent() {
...@@ -14,6 +20,7 @@ function bindQueryEvent() { ...@@ -14,6 +20,7 @@ function bindQueryEvent() {
type: "system", name: "queryCostCenter", type: "system", name: "queryCostCenter",
onChange: function (value, data) { onChange: function (value, data) {
$('#kostl').val(data.kostl); $('#kostl').val(data.kostl);
$('#kostlv').val(data.kostl);
} }
}); });
$('#kostlv').searchbox({ $('#kostlv').searchbox({
...@@ -29,6 +36,12 @@ function bindQueryEvent() { ...@@ -29,6 +36,12 @@ function bindQueryEvent() {
}, },
onChange: function (value, data) { onChange: function (value, data) {
$('#anlkl').val(data.ANLKL); $('#anlkl').val(data.ANLKL);
//当资产类别为Z701-Z703时,成本中心字段设置为灰色不允许填写,当资产类别为其他时成本中心字段设置为必输项。
if (data.ANLKL.indexOf("Z7")>=0){
disable();
}else {
enable();
}
} }
}); });
$('#bukrs').searchbox({ $('#bukrs').searchbox({
...@@ -51,6 +64,24 @@ function bindQueryEvent() { ...@@ -51,6 +64,24 @@ function bindQueryEvent() {
}); });
} }
function disable(){
UICtrl.setElRequiredFlag("#kostl",false);
UICtrl.setElRequiredFlag("#kostlv",false);
UICtrl.disable("#kostl")
UICtrl.disable("#kostlv")
$("#kostl").val("")
$("#kostlv").val("")
}
function enable(){
UICtrl.setElRequiredFlag("#kostl",true);
UICtrl.setElRequiredFlag("#kostlv",true);
UICtrl.enable("#kostl")
UICtrl.enable("#kostlv")
$("#kostl").val("")
$("#kostlv").val("")
}
function getFixedAssetsDetail(fixedAssetsAction) { function getFixedAssetsDetail(fixedAssetsAction) {
//采购订单保存时数据不进行必填验证,提交时数据才进行必填验证 //采购订单保存时数据不进行必填验证,提交时数据才进行必填验证
var op = {}; var op = {};
......
...@@ -3,6 +3,7 @@ var gridManager = null; ...@@ -3,6 +3,7 @@ var gridManager = null;
$(document).ready(function () { $(document).ready(function () {
initializateUI(); initializateUI();
loadCostCenterListGrid(); loadCostCenterListGrid();
bindEvent();
}); });
...@@ -15,10 +16,10 @@ function loadCostCenterListGrid() { ...@@ -15,10 +16,10 @@ function loadCostCenterListGrid() {
addHandler: function () { addHandler: function () {
addHandler(); addHandler();
}, },
updateHandler: function () { // updateHandler: function () {
updateHandler(); // updateHandler();
}, // },
deleteHandler: deleteHandler, // deleteHandler: deleteHandler,
}); });
gridManager = UICtrl.grid("#sapFixedAssetsListGrid", { gridManager = UICtrl.grid("#sapFixedAssetsListGrid", {
columns: [ columns: [
...@@ -34,7 +35,6 @@ function loadCostCenterListGrid() { ...@@ -34,7 +35,6 @@ function loadCostCenterListGrid() {
{display: "成本中心", name: "kostl", width: 140, minWidth: 60, type: "string", align: "left"}, {display: "成本中心", name: "kostl", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "责任成本中心", name: "kostlv", width: 140, minWidth: 60, type: "string", align: "left"}, {display: "责任成本中心", name: "kostlv", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "填报日期", name: "fillinDate", width: 140, minWidth: 60, type: "string", align: "left"}, {display: "填报日期", name: "fillinDate", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "单据编号", name: "billCode", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "流程状态", name: "statusId", width: 140, minWidth: 60, type: "string", align: "left"}, {display: "流程状态", name: "statusId", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "人员名称", name: "personMemberName", width: 140, minWidth: 60, type: "string", align: "left"}, {display: "人员名称", name: "personMemberName", width: 140, minWidth: 60, type: "string", align: "left"},
{display: "消息类型", name: "type", width: 100, minWidth: 60, type: "string", align: "left"}, {display: "消息类型", name: "type", width: 100, minWidth: 60, type: "string", align: "left"},
...@@ -106,3 +106,15 @@ function deleteHandler() { ...@@ -106,3 +106,15 @@ function deleteHandler() {
}); });
} }
function bindEvent(){
$('#anlkl').searchbox({
type: "system", name: "dictionary",
getParam: function (item) {
return {fieldName: "ANLKL"}
},
onChange: function (value, data) {
$('#anlkl').val(data.ANLKL);
}
});
}
...@@ -15,14 +15,14 @@ ...@@ -15,14 +15,14 @@
<body> <body>
<div class="container-fluid"> <div class="container-fluid">
<div class="ui-hide"> <div class="ui-hide">
<%-- <x:select name="processType" dictionary="processType" />--%>
<%-- <x:select name="yesorno" dictionary="yesorno" />--%>
</div> </div>
<div id="layout"> <div id="layout">
<div position="center" title="固定资产"> <div position="center" title="固定资产">
<x:title title="common.button.search" hideTable="queryMainForm" isHide="true" /> <x:title title="common.button.search" hideTable="queryMainForm" isHide="true" />
<form class="hg-form ui-hide" method="post" action="" id="queryMainForm"> <form class="hg-form ui-hide" method="post" action="" id="queryMainForm">
<x:inputC name="ruleKind" required="false" label="固定资产名称" labelCol="1"/> <x:inputC name="billCode" required="false" label="单据编码" labelCol="1"/>
<x:inputC name="anln1" required="false" label="主资产号" labelCol="1"/>
<x:inputC name="anlkl" required="false" label="资产分类" labelCol="1" wrapper="select"/>
<x:searchButtons /> <x:searchButtons />
</form> </form>
<div class="blank_div clearfix"></div> <div class="blank_div clearfix"></div>
......
...@@ -76,7 +76,7 @@ function loadGrid() { ...@@ -76,7 +76,7 @@ function loadGrid() {
{ {
display: "申请日期", name: "adatu", width: 140, minWidth: 60, type: "date", align: "left", display: "申请日期", name: "adatu", width: 140, minWidth: 60, type: "date", align: "left",
editor: { editor: {
type: "date" type: "date",required: true
} }
}, },
{ {
......
...@@ -114,7 +114,7 @@ function loadGrid() { ...@@ -114,7 +114,7 @@ function loadGrid() {
{ {
display: "购置业务年度", name: "xa", width: 160, minWidth: 60, type: "string", align: "left", display: "购置业务年度", name: "xa", width: 160, minWidth: 60, type: "string", align: "left",
// editor: {required: false, type: "text"} // editor: {required: false, type: "text"}
editor: {type:'dictionary',data:{name:'sapFixedRetirementYear'} ,textField:'xaTextView',valueField:'xa'} editor: {required: true, type:'dictionary',data:{name:'sapFixedRetirementYear'} ,textField:'xaTextView',valueField:'xa'}
} }
], ],
dataAction: "server", dataAction: "server",
......
...@@ -63,10 +63,17 @@ function getGridColumns(){ ...@@ -63,10 +63,17 @@ function getGridColumns(){
display: "序号", name: "sequence", width: 100, minWidth: 60, type: "string", align: "left", display: "序号", name: "sequence", width: 100, minWidth: 60, type: "string", align: "left",
},) },)
columns.push({ columns.push({
display: "品类", name: "wasteType", width: 200, minWidth: 60, type: "string", align: "left", display: "品类", name: "wasteTypeTextView", width: 200, minWidth: 60, type: "string", align: "left",
editor: { editor: {
required: true, type: "text" type: 'dictionary',
} data: {name: 'wasteType'},
textField: 'wasteTypeTextView',
valueField: 'wasteType',
required: true,
render: function (item) {
return item.wasteTypeTextView;
}
},
},) },)
columns.push({ columns.push({
display: "数量", name: "quantity", width: 200, minWidth: 60, type: "string", align: "left", display: "数量", name: "quantity", width: 200, minWidth: 60, type: "string", align: "left",
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
</div> </div>
<div class="hg-form-cols"> <div class="hg-form-cols">
<div class="hg-form-row"> <div class="hg-form-row">
<x:inputC name="paymentMethod" required="false" label="收款方式" labelCol="2" fieldCol="2" /> <x:selectC name="paymentMethod" required="false" dictionary="paymentMethod" label="收款方式" labelCol="2" fieldCol="2" />
<x:inputC name="totalMoney" readonly="true" label="合计" labelCol="2" fieldCol="2" /> <x:inputC name="totalMoney" readonly="true" label="合计" labelCol="2" fieldCol="2" />
</div> </div>
</div> </div>
......
...@@ -21,7 +21,7 @@ function loadGrid() { ...@@ -21,7 +21,7 @@ function loadGrid() {
{display: "公司代码", name: "burks", width: 200, minWidth: 60, type: "string", align: "left"}, {display: "公司代码", name: "burks", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "回收商", name: "bktxt", width: 200, minWidth: 60, type: "string", align: "left"}, {display: "回收商", name: "bktxt", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "回收日期", name: "budat", width: 200, minWidth: 60, type: "string", align: "left"}, {display: "回收日期", name: "budat", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "收款方式", name: "paymentMethod", width: 200, minWidth: 60, type: "string", align: "left"}, {display: "收款方式", name: "paymentMethodTextView", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "合计", name: "totalMoney", width: 200, minWidth: 60, type: "string", align: "left"}, {display: "合计", name: "totalMoney", width: 200, minWidth: 60, type: "string", align: "left"},
{display: "消息类型", name: "type", width: 100, minWidth: 60, type: "string", align: "left"}, {display: "消息类型", name: "type", width: 100, minWidth: 60, type: "string", align: "left"},
{display: "会计凭证编号", name: "messageV1", width: 200, minWidth: 60, type: "string", align: "left"}, {display: "会计凭证编号", name: "messageV1", width: 200, minWidth: 60, type: "string", align: "left"},
......
...@@ -146,21 +146,21 @@ ...@@ -146,21 +146,21 @@
<artifactId>huigou-data</artifactId> <artifactId>huigou-data</artifactId>
</dependency> </dependency>
<dependency> <!--<dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId> <artifactId>mybatis-plus</artifactId>
</dependency> </dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId> <artifactId>mybatis</artifactId>
<version>3.5.13</version> <version>3.5.13</version>
<scope>compile</scope> <scope>compile</scope>
</dependency>-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId> <artifactId>protobuf-java</artifactId>
......
package com.huigou.topsun.base.dictionary.application.impl; package com.huigou.topsun.base.dictionary.application.impl;
import cn.hutool.core.util.NumberUtil;
import com.huigou.data.jdbc.util.BatchSqlUpdateDetail; import com.huigou.data.jdbc.util.BatchSqlUpdateDetail;
import com.huigou.data.query.model.QueryDescriptor; import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.topsun.base.dictionary.GlobalCode; import com.huigou.topsun.base.dictionary.GlobalCode;
import com.huigou.topsun.base.dictionary.application.DictionaryImportApplication; import com.huigou.topsun.base.dictionary.application.DictionaryImportApplication;
import com.huigou.topsun.base.dictionary.domain.DictionaryImportData; import com.huigou.topsun.base.dictionary.domain.DictionaryImportData;
import com.huigou.uasp.bmp.common.application.BaseApplication; import com.huigou.uasp.bmp.common.application.BaseApplication;
import com.huigou.uasp.bmp.configuration.application.DictionaryApplication;
import com.huigou.uasp.bmp.configuration.domain.model.SysDictionary;
import com.huigou.uasp.bmp.configuration.repository.SysDictionaryRepository;
import com.huigou.uasp.tool.dataimport.application.ExcelImportInterface; import com.huigou.uasp.tool.dataimport.application.ExcelImportInterface;
import com.huigou.util.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.sql.Types;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
......
package com.huigou.topsun.common;
public enum OrgKindId {
OGN("ogn", "机构"),
DPT("dpt", "部门"),
POS("pos", "岗位"),
PSM("psm", "人员"),
;
private String id;
private String name;
private OrgKindId(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.huigou.topsun.common;
public enum SystemType {
SAP("SAP", "SAP系统"),
EP("EP", "EP系统"),
MES("MES", "MES系统"),
;
private String id;
private String name;
private SystemType(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
package com.huigou.topsun.config; //package com.huigou.topsun.config;
//
import com.baomidou.mybatisplus.annotation.DbType; //import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.config.GlobalConfig; //import com.baomidou.mybatisplus.core.config.GlobalConfig;
import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator; //import com.baomidou.mybatisplus.core.incrementer.IKeyGenerator;
import org.springframework.context.annotation.Bean; //import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; //import org.springframework.context.annotation.Configuration;
//
import java.util.Arrays; //import java.util.Arrays;
//
//
@Configuration //@Configuration
public class MyBatisConfig { //public class MyBatisConfig {
//
@Bean // @Bean
public GlobalConfig globalConfiguration() { // public GlobalConfig globalConfiguration() {
GlobalConfig conf = new GlobalConfig(); // GlobalConfig conf = new GlobalConfig();
conf.setDbConfig(new GlobalConfig.DbConfig().setKeyGenerators(Arrays.asList( // conf.setDbConfig(new GlobalConfig.DbConfig().setKeyGenerators(Arrays.asList(
// h2 1.x 的写法(默认 2.x 的写法) // // h2 1.x 的写法(默认 2.x 的写法)
new IKeyGenerator() { // new IKeyGenerator() {
//
@Override // @Override
public String executeSql(String incrementerName) { // public String executeSql(String incrementerName) {
return "select " + incrementerName + ".nextval"; // return "select " + incrementerName + ".nextval";
} // }
//
@Override // @Override
public DbType dbType() { // public DbType dbType() {
return DbType.POSTGRE_SQL; // return DbType.POSTGRE_SQL;
} // }
} // }
))); // )));
return conf; // return conf;
} // }
} //}
...@@ -2,13 +2,11 @@ package com.huigou.topsun.controller; ...@@ -2,13 +2,11 @@ package com.huigou.topsun.controller;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import com.huigou.cache.DictUtil; import com.huigou.cache.DictUtil;
import com.huigou.topsun.sap.costCenter.application.CostCenterApplication;
import com.huigou.topsun.sap.sapApplication.application.SapAreaApplication; import com.huigou.topsun.sap.sapApplication.application.SapAreaApplication;
import com.huigou.topsun.sap.sapApplication.application.SapDictionaryApplication; import com.huigou.topsun.sap.sapApplication.application.SapDictionaryApplication;
import com.huigou.topsun.sap.sapApplication.application.SapMaterialApplication; import com.huigou.topsun.sap.sapApplication.application.SapMaterialApplication;
import com.huigou.topsun.sap.sapApplication.application.SapPaymentApplication; import com.huigou.topsun.sap.sapApplication.application.SapPaymentApplication;
import com.huigou.topsun.sap.sapApplication.domain.query.SapDialogQuery; import com.huigou.topsun.sap.sapApplication.domain.query.SapDialogQuery;
import com.huigou.topsun.sap.sapApplication.domain.vo.SapMaterialVo;
import com.huigou.uasp.annotation.ControllerMapping; import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.bmp.common.easysearch.EasySearch; import com.huigou.uasp.bmp.common.easysearch.EasySearch;
import com.huigou.uasp.bmp.common.easysearch.domain.model.EasySearchParse; import com.huigou.uasp.bmp.common.easysearch.domain.model.EasySearchParse;
......
...@@ -221,7 +221,7 @@ public class EpSaleOrderApplicationImpl extends FlowBroker implements EpSaleOrde ...@@ -221,7 +221,7 @@ public class EpSaleOrderApplicationImpl extends FlowBroker implements EpSaleOrde
//日志记录 //日志记录
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
try { try {
String execute = httpClient.executeByJsonForEp(map, "od/saleOrder/auditedResult"); String execute = httpClient.executeForEp(map, "od/saleOrder/auditedResult");
EpResult epResult = JSONObject.parseObject(execute, EpResult.class); EpResult epResult = JSONObject.parseObject(execute, EpResult.class);
resultMap.put("type", epResult.getCode()); resultMap.put("type", epResult.getCode());
resultMap.put("message", epResult.getMsg()); resultMap.put("message", epResult.getMsg());
......
...@@ -220,7 +220,7 @@ public class EpSaleOrderCancelApplicationImpl extends FlowBroker implements EpSa ...@@ -220,7 +220,7 @@ public class EpSaleOrderCancelApplicationImpl extends FlowBroker implements EpSa
//日志记录 //日志记录
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
try { try {
String execute = httpClient.executeByJsonForEp(map, "od/saleOrder/auditedResult"); String execute = httpClient.executeForEp(map, "od/saleOrder/auditedResult");
EpResult epResult = JSONObject.parseObject(execute, EpResult.class); EpResult epResult = JSONObject.parseObject(execute, EpResult.class);
resultMap.put("type", epResult.getCode()); resultMap.put("type", epResult.getCode());
resultMap.put("message", epResult.getMsg()); resultMap.put("message", epResult.getMsg());
......
...@@ -127,7 +127,7 @@ public class SapAcceptanceFormAckApplicationImpl implements SapAcceptanceFormAc ...@@ -127,7 +127,7 @@ public class SapAcceptanceFormAckApplicationImpl implements SapAcceptanceFormAc
String string = sdo.getString("params"); String string = sdo.getString("params");
String execute; String execute;
try { try {
execute = httpClient.executeByJson(string, url); execute = httpClient.execute(string, url);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; ...@@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.huigou.cache.SystemCache; import com.huigou.cache.SystemCache;
import com.huigou.topsun.sap.common.serializer.MessageSerializer; import com.huigou.topsun.sap.common.serializer.MessageSerializer;
import com.huigou.uasp.bmp.common.application.BaseApplication; import com.huigou.uasp.bmp.common.application.BaseApplication;
import org.apache.commons.io.IOUtils; import com.huigou.util.StringUtil;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus; import org.apache.http.HttpStatus;
import org.apache.http.StatusLine; import org.apache.http.StatusLine;
...@@ -20,8 +20,6 @@ import org.springframework.stereotype.Component; ...@@ -20,8 +20,6 @@ import org.springframework.stereotype.Component;
import java.io.IOException; import java.io.IOException;
import java.util.Base64; import java.util.Base64;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
*/ */
...@@ -37,14 +35,15 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient { ...@@ -37,14 +35,15 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient {
this.messageSerializer = messageSerializer; this.messageSerializer = messageSerializer;
} }
/**
* 访问SAP系统的ip、上下文httpClient配置
* @param param 非JSON数据对象
* @param url 控制层地址
* @return 返回
* @throws IOException
*/
@Override @Override
public String execute(Object param,String url) throws IOException { public String execute(Object param,String url) throws IOException {
String paramJson = new ObjectMapper().writeValueAsString(param);
return executeByJson(paramJson, url);
}
@Override
public String executeByJson(String param,String url) throws IOException {
//系统接口地址 //系统接口地址
// ip地址 // ip地址
String ip = SystemCache.getParameter("sap.service.ip", String.class); String ip = SystemCache.getParameter("sap.service.ip", String.class);
...@@ -64,56 +63,72 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient { ...@@ -64,56 +63,72 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient {
.append(url) .append(url)
.append("?") .append("?")
.append(client); .append(client);
HttpPost post = new HttpPost(serverUrl.toString());
post.setHeader("Content-type", "application/json;charset=utf-8");
String usernameAndPassword = username + ":" + password; String usernameAndPassword = username + ":" + password;
post.addHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(usernameAndPassword.getBytes())); return this.buildHttpClient(param, String.valueOf(serverUrl),usernameAndPassword);
LOG.info("requestText={}", param);
post.setEntity(new StringEntity(param, ContentType.APPLICATION_JSON));
LOG.info("post={}", post);
HttpResponse response;
String responseText = "";
try {
response = http.execute(post);
StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode();
if (statusLine.getStatusCode() < HttpStatus.SC_OK || statusLine.getStatusCode() >= HttpStatus.SC_MULTIPLE_CHOICES) {
throw new IOException(String.format("调用SAP系统出错,statusCode=%s, %s", statusCode, statusLine.getReasonPhrase()));
}
responseText = EntityUtils.toString(response.getEntity(), "UTF-8");
LOG.info("responseText={}", responseText);
LOG.info("----------->> 调用SAP接口 {} 成功 <<-----------", serverUrl);
}finally {
post.releaseConnection();
}
return responseText;
} }
/**
* 访问EP系统的ip、上下文httpClient配置
* @param param 非JSON数据对象
* @param url 控制层地址
* @return 返回
* @throws IOException
*/
@Override @Override
public String executeByJsonForEp(Object param,String url) throws IOException { public String executeForEp(Object param,String url) throws IOException {
//系统接口地址 //系统接口地址
// ip地址 // ip地址
String ip = SystemCache.getParameter("ep.service.ip", String.class); String ip = SystemCache.getParameter("ep.service.ip", String.class);
// 上下文 // 上下文
String applicationContext = SystemCache.getParameter("ep.service.application.context", String.class); String applicationContext = SystemCache.getParameter("ep.service.application.context", String.class);
// 用户名
// password = SystemCache.getParameter("ep.service.password", String.class);
// 密码
//String username = SystemCache.getParameter("ep.service.username", String.class);
// 客户端
//String client = SystemCache.getParameter("ep.service.client", String.class);
//String serverUrl = "http://192.168.23.15:8080/api/od/saleOrder/auditedResult.ajax"; //String serverUrl = "http://192.168.23.15:8080/api/od/saleOrder/auditedResult.ajax";
StringBuffer serverUrl = new StringBuffer(); StringBuffer serverUrl = new StringBuffer();
serverUrl serverUrl
.append(ip) .append(ip)
.append(applicationContext) .append(applicationContext)
.append(url); .append(url);
HttpPost post = new HttpPost(serverUrl.toString()); return this.buildHttpClient(param, String.valueOf(serverUrl),"");
}
/**
* 访问MES系统的ip、上下文httpClient配置
* @param param 非JSON数据对象
* @param url 控制层地址
* @return 返回
* @throws IOException
*/
@Override
public String executeForMes(Object param,String url) throws IOException {
//系统接口地址
// ip地址
String ip = SystemCache.getParameter("mes.service.ip", String.class);
// 上下文
String applicationContext = SystemCache.getParameter("mes.service.application.context", String.class);
//String serverUrl = "http://192.168.23.15:8080/api/od/saleOrder/auditedResult.ajax";
StringBuffer serverUrl = new StringBuffer();
serverUrl
.append(ip)
.append(applicationContext)
.append(url);
return this.buildHttpClient(param, String.valueOf(serverUrl),"");
}
/**
*
* @param obj 非JSON数据对象
* @param serverUrl 服务拼接地址
* @param usernameAndPassword 用户名密码拼接
* @return
* @throws IOException
*/
public String buildHttpClient(Object obj,String serverUrl,String usernameAndPassword) throws IOException {
HttpPost post = new HttpPost(serverUrl);
post.setHeader("Content-type", "application/json;charset=utf-8"); post.setHeader("Content-type", "application/json;charset=utf-8");
//String usernameAndPassword = username + ":" + password; //String usernameAndPassword = username + ":" + password;
//post.addHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(usernameAndPassword.getBytes())); if (StringUtil.isNotBlank(usernameAndPassword)){
String paramJson = new ObjectMapper().writeValueAsString(param); post.addHeader("Authorization", "Basic " + Base64.getEncoder().encodeToString(usernameAndPassword.getBytes()));
}
String paramJson = new ObjectMapper().writeValueAsString(obj);
LOG.info("requestText={}", paramJson); LOG.info("requestText={}", paramJson);
post.setEntity(new StringEntity(paramJson, ContentType.APPLICATION_JSON)); post.setEntity(new StringEntity(paramJson, ContentType.APPLICATION_JSON));
LOG.info("post={}", post); LOG.info("post={}", post);
...@@ -124,11 +139,10 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient { ...@@ -124,11 +139,10 @@ public class DefaultHttpClient extends BaseApplication implements HttpClient {
StatusLine statusLine = response.getStatusLine(); StatusLine statusLine = response.getStatusLine();
int statusCode = statusLine.getStatusCode(); int statusCode = statusLine.getStatusCode();
if (statusLine.getStatusCode() < HttpStatus.SC_OK || statusLine.getStatusCode() >= HttpStatus.SC_MULTIPLE_CHOICES) { if (statusLine.getStatusCode() < HttpStatus.SC_OK || statusLine.getStatusCode() >= HttpStatus.SC_MULTIPLE_CHOICES) {
throw new IOException(String.format("调用EP系统出错,statusCode=%s, %s", statusCode, statusLine.getReasonPhrase())); throw new IOException(String.format("调用系统出错,statusCode=%s, %s", statusCode, statusLine.getReasonPhrase()));
} }
responseText = EntityUtils.toString(response.getEntity(), "UTF-8"); responseText = EntityUtils.toString(response.getEntity(), "UTF-8");
LOG.info("responseText={}", responseText); LOG.info("responseText={}", responseText);
LOG.info("----------->> 调用EP接口 {} 成功 <<-----------", serverUrl);
}finally { }finally {
post.releaseConnection(); post.releaseConnection();
} }
......
package com.huigou.topsun.sap.common; package com.huigou.topsun.sap.common;
import java.io.IOException; import java.io.IOException;
import java.util.Map;
/** /**
* esb客户端,用于调用esb服务。 * 客户端,用于调用远程服务。
*/ */
public interface HttpClient { public interface HttpClient {
/** /**
...@@ -19,9 +16,9 @@ public interface HttpClient { ...@@ -19,9 +16,9 @@ public interface HttpClient {
* @throws IOException * @throws IOException
*/ */
String execute(Object param,String url) throws IOException; public String execute(Object param,String url) throws IOException;
public String executeByJson(String param,String url) throws IOException; public String executeForEp(Object param,String url) throws IOException;
public String executeByJsonForEp(Object param,String url) throws IOException; public String executeForMes(Object param,String url) throws IOException;
} }
package com.huigou.topsun.sap.common.domain; package com.huigou.topsun.sap.common.domain;
import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
......
...@@ -116,6 +116,7 @@ public class CostCenterController extends CommonController { ...@@ -116,6 +116,7 @@ public class CostCenterController extends CommonController {
costCenterVo.setStatusId(BizBillStatus.APPLYING.getId()); costCenterVo.setStatusId(BizBillStatus.APPLYING.getId());
costCenterVo.setIsEnable(0); costCenterVo.setIsEnable(0);
costCenterVo.setId(null); costCenterVo.setId(null);
costCenterVo.setReason(null);
return forward("sapCostCenterDetail", costCenterVo); return forward("sapCostCenterDetail", costCenterVo);
} }
......
package com.huigou.topsun.sap.nonProdApply.domain; package com.huigou.topsun.sap.nonProdApply.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.huigou.data.domain.model.FlowBillAbstractEntity; import com.huigou.data.domain.model.FlowBillAbstractEntity;
import lombok.Data; import lombok.Data;
......
...@@ -34,8 +34,7 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication { ...@@ -34,8 +34,7 @@ public class SapMaterialApplicationImpl implements SapMaterialApplication {
/*if (StringUtil.isBlank(queryRequest.getWerks()) || StringUtil.isBlank(queryRequest.getMatkl())){ /*if (StringUtil.isBlank(queryRequest.getWerks()) || StringUtil.isBlank(queryRequest.getMatkl())){
return sapMaterialVoList; return sapMaterialVoList;
}*/ }*/
String paramJson = new ObjectMapper().writeValueAsString(queryRequest); String json = httpClient.execute(queryRequest, "search/sch_matnr");
String json = httpClient.executeByJson(paramJson, "search/sch_matnr");
Map<String, Object> map = JSONUtil.toMap(json); Map<String, Object> map = JSONUtil.toMap(json);
SapResult sapResult = JSONObject.parseObject(JSONUtil.toString(map.get("MSG")), SapResult.class); SapResult sapResult = JSONObject.parseObject(JSONUtil.toString(map.get("MSG")), SapResult.class);
if ("S".equals(sapResult.getTYPE())){ if ("S".equals(sapResult.getTYPE())){
......
...@@ -91,7 +91,7 @@ public class WasteSaleApplicationImpl extends FlowBroker implements WasteSaleApp ...@@ -91,7 +91,7 @@ public class WasteSaleApplicationImpl extends FlowBroker implements WasteSaleApp
sapWasteSaleItemVo.setShkzg("S"); sapWasteSaleItemVo.setShkzg("S");
sapWasteSaleItemVo.setKoart("S"); sapWasteSaleItemVo.setKoart("S");
sapWasteSaleItemVo.setBschl("40"); sapWasteSaleItemVo.setBschl("40");
sapWasteSaleItemVo.setKtonr("1001010000"); sapWasteSaleItemVo.setKtonr(wasteSale.getPaymentMethod());
sapWasteSaleItemVo.setWrbtr(wasteSaleItem.getAmount().toString()); sapWasteSaleItemVo.setWrbtr(wasteSaleItem.getAmount().toString());
sapWasteSaleItemVo.setSgtxt("废品回收-"+wasteSaleItem.getWasteType()+"-"+wasteSaleItem.getQuantity()+wasteSaleItem.getUnit()+"-"+wasteSaleItem.getAmount()); sapWasteSaleItemVo.setSgtxt("废品回收-"+wasteSaleItem.getWasteType()+"-"+wasteSaleItem.getQuantity()+wasteSaleItem.getUnit()+"-"+wasteSaleItem.getAmount());
sapWasteSaleItemVo.setRstgr("113"); sapWasteSaleItemVo.setRstgr("113");
...@@ -118,7 +118,7 @@ public class WasteSaleApplicationImpl extends FlowBroker implements WasteSaleApp ...@@ -118,7 +118,7 @@ public class WasteSaleApplicationImpl extends FlowBroker implements WasteSaleApp
throw new RuntimeException("数据传输失败,"+ sapResult.getMESSAGE()); throw new RuntimeException("数据传输失败,"+ sapResult.getMESSAGE());
} }
wasteSale.setType(sapResult.getTYPE()); wasteSale.setType(sapResult.getTYPE());
wasteSale.setMessageV1(sapResult.getMESSAGE_V2()); wasteSale.setMessageV1(sapResult.getMESSAGE_V2().substring(0,10));
wasteSaleRepository.save(wasteSale); wasteSaleRepository.save(wasteSale);
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
......
package com.huigou.topsun.syncOrg.application;
import com.huigou.topsun.syncOrg.vo.EpOrgVo;
import com.huigou.topsun.syncOrg.vo.OrgPersonVo;
import com.huigou.topsun.syncOrg.vo.PersonVo;
import com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.huigou.uasp.bmp.opm.domain.model.org.Org;
import java.util.List;
/**
* @Auther: xin.lu
* @Date: 2024/03/25/9:27
* @Description:
*/
public interface OrgSyncApplication {
/**
* 构建机构、部门、岗位、人员VO类
* @return
*/
public EpOrgVo buildOrgVo ();
/**
* 构建组织人员对应关系
* @param psmList
* @return
*/
public List<OrgPersonVo> buildOrgPersonVo(List<Org> psmList);
/**
* 构架人员
* @param psmList
* @return
*/
public List<PersonVo> buildPersonVo(List<Org> psmList);
/**
* 构建SAP人员
* @return
*/
public List<SapPersonVo> buildSapPersonVo();
/**
* 同步SAP人员
*/
public void syncOrgToSap();
}
package com.huigou.topsun.syncOrg.application.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.huigou.topsun.common.OrgKindId;
import com.huigou.topsun.syncOrg.application.OrgSyncApplication;
import com.huigou.topsun.syncOrg.vo.*;
import com.huigou.topsun.sap.common.DefaultHttpClient;
import com.huigou.topsun.sap.common.application.SapMutualEpLogApplication;
import com.huigou.topsun.sap.common.domain.EpResult;
import com.huigou.uasp.bmp.opm.domain.model.org.Org;
import com.huigou.uasp.bmp.opm.domain.model.org.Person;
import com.huigou.uasp.bmp.opm.repository.org.OrgRepository;
import com.huigou.util.DateUtil;
import com.huigou.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Auther: xin.lu
* @Date: 2024/03/25/9:28
* @Description:
*/
@Service("orgSyncApplication")
public class OrgSyncApplicationImpl implements OrgSyncApplication {
private final static Logger LOG = LoggerFactory.getLogger(OrgSyncApplicationImpl.class);
@Autowired
private OrgRepository orgRepository;
@Autowired
private DefaultHttpClient httpClient;
@Autowired
SapMutualEpLogApplication sapMutualEpLogApplication;
@Override
public EpOrgVo buildOrgVo () {
List<Org> orgList = orgRepository.findAll();
orgList = orgList
.stream()
.filter(org -> org.getFullId().contains("/E3B4E5C5C6454F81921CF58B7597CE2F"))
.collect(Collectors.toList());
//机构、部门、岗位
List<OrgVo> orgVoList = orgList
.stream()
.filter(org -> !OrgKindId.PSM.getId().equals(org.getOrgKindId()))
.map(org -> {
OrgVo orgVo = new OrgVo();
BeanUtil.copyProperties(org,orgVo);
orgVo.setDelFlag("0");
//把id做hash处理,得到int类型数据
orgVo.setId(convertHashCode(org.getId()));
//从全路径中获取当前组织的父节点名称
if (StringUtil.isNotBlank(org.getParentId())){
String fullName = org.getFullName();
String[] split = fullName.split("/");
orgVo.setParentName(split[split.length - 2]);
//把父id做hash处理,得到int类型数据
orgVo.setParentId(convertHashCode(org.getParentId()));
}
return orgVo;
})
.collect(Collectors.toList());
//人员
List<Org> psmList = orgList
.stream()
.filter(org -> OrgKindId.PSM.getId().equals(org.getOrgKindId()))
.collect(Collectors.toList());
//先同步机构、部门、岗位、再同步组织人员
List<OrgPersonVo> orgPersonVoList = this.buildOrgPersonVo(psmList);
//同步人员
List<PersonVo> personVoList = this.buildPersonVo(psmList);
EpOrgVo epOrgVo = new EpOrgVo();
epOrgVo.setOrgVoList(orgVoList);
epOrgVo.setOrgPersonVoList(orgPersonVoList);
epOrgVo.setPersonVoList(personVoList);
LOG.info(DateUtil.getDateFormat(new Date())+"====同步的组织结构数据===={}",epOrgVo);
return epOrgVo;
}
@Override
public List<OrgPersonVo> buildOrgPersonVo(List<Org> psmList){
return psmList
.stream()
.map(orgPerson -> {
OrgPersonVo orgPersonVo = new OrgPersonVo();
//组织人员id
orgPersonVo.setId(convertHashCode(orgPerson.getId()));
//部门id
orgPersonVo.setDeptId(convertHashCode(orgPerson.getDeptId()));
//岗位id
orgPersonVo.setPositionId(convertHashCode(orgPerson.getPositionId()));
//人员id
orgPersonVo.setPersonId(convertHashCode(orgPerson.getPerson().getId()));
return orgPersonVo;
}).collect(Collectors.toList());
}
@Override
public List<PersonVo> buildPersonVo(List<Org> psmList){
return psmList
.stream()
.map(psm -> {
Person person = psm.getPerson();
PersonVo personVo = new PersonVo();
BeanUtil.copyProperties(person, personVo);
personVo.setDelFlag("0");
//把人员id做hash处理,得到int类型数据
personVo.setId(convertHashCode(person.getId()));
personVo.setDeptId(convertHashCode(psm.getDeptId()));
return personVo;
}).collect(Collectors.toList());
}
@Override
public List<SapPersonVo> buildSapPersonVo(){
List<Org> orgList = orgRepository.findAll();
//人员
return orgList
.stream()
.filter(org -> OrgKindId.PSM.getId().equals(org.getOrgKindId()))
.map(org -> {
SapPersonVo sapPersonVo = new SapPersonVo();
Person person = org.getPerson();
BeanUtil.copyProperties(person,sapPersonVo);
sapPersonVo.setParentFullName(org.getFullName());
return sapPersonVo;
})
.collect(Collectors.toList());
}
@Override
public void syncOrgToSap() {
}
/**
* 字符串转hashcode
* @param value
* @return
*/
public String convertHashCode(String value){
if (StringUtil.isBlank(value)){
return "";
}
int abs = Math.abs(value.hashCode());
return String.valueOf(abs);
}
/**
* 记录日志
* @param epResult
* @param epOrgVo
*/
public void saveMutualEpLog(EpResult epResult,EpOrgVo epOrgVo,String systemType){
//日志记录
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("type", epResult.getCode());
resultMap.put("message", epResult.getMsg());
resultMap.put("businessType", systemType);
resultMap.put("businessId", "syncOrg");
resultMap.put("parameter", JSON.toJSONString(epOrgVo));
resultMap.put("sequence", resultMap.get("row"));
sapMutualEpLogApplication.saveSapMutualEpLog(resultMap);
}
}
package com.huigou.topsun.syncOrg.controller;
import com.huigou.topsun.syncOrg.application.OrgSyncApplication;
import com.huigou.topsun.syncOrg.vo.EpOrgVo;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.annotation.SkipAuth;
import com.huigou.uasp.client.CommonController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* @Auther: xin.lu
* @Date: 2024/03/25/10:51
* @Description: 获取同步的机构、部门、岗位、人员
*/
@Controller
@ControllerMapping("/syncOrg")
public class SyncOrgController extends CommonController {
@Autowired
private OrgSyncApplication orgSyncApplication;
@SkipAuth
@RequestMapping( value = "/syncOrgInfo")
@ResponseBody
public EpOrgVo syncOrgInfo() {
return orgSyncApplication.buildOrgVo();
}
}
package com.huigou.topsun.syncOrg.scheduled;
import com.huigou.topsun.syncOrg.application.OrgSyncApplication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.Date;
/**
* @Auther: xin.lu
* @Date: 2024/03/24/9:45
* @Description:
*/
@Component
@EnableScheduling
public class OrgSync {
@Autowired
private OrgSyncApplication orgSyncApplication;
/** * 每10分钟执行一次 */
//@Scheduled(cron = "0 0/10 * * * ?")
public void syncOrgToSap() {
orgSyncApplication.syncOrgToSap();
System.out.println("十分钟了======="+(new Date()).toString());
}
}
package com.huigou.topsun.syncOrg.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Auther: xin.lu
* @Date: 2024/03/24/14:49
* @Description:
*/
@Data
public class EpOrgVo implements Serializable {
/**
* 机构、部门、岗位
*/
@JsonProperty("orgVoList")
private List<OrgVo> orgVoList;
/**
* 部门、岗位、人员关系
*/
@JsonProperty("orgPersonVoList")
private List<OrgPersonVo> orgPersonVoList;
/**
* 人员
*/
@JsonProperty("personVoList")
private List<PersonVo> personVoList;
}
package com.huigou.topsun.syncOrg.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* @Auther: xin.lu
* @Date: 2024/03/23/15:18
* @Description: 人员组织对应关系
*/
@Data
public class OrgPersonVo {
/**
* 组织人员id
*/
@JsonProperty("id")
private String id;
/**
* 岗位id
*/
@JsonProperty("positionId")
private String positionId;
/**
* 部门id
*/
@JsonProperty("deptId")
private String deptId;
/**
* 人员id
*/
@JsonProperty("personId")
private String personId;
}
package com.huigou.topsun.syncOrg.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* @Auther: xin.lu
* @Date: 2024/03/23/10:30
* @Description: 同步到EP系统机构/部门/岗位Vo类
*/
@Data
public class OrgVo {
@JsonProperty("deptId")
private String id;
/**
* 父节点ID
*/
@JsonProperty("parentId")
private String parentId;
/**
* 编码全路径
*/
@JsonProperty("deptCode")
private String fullCode;
/**
* 名称
*/
@JsonProperty("deptName")
private String name;
/**
* 顺序
*/
@JsonProperty("orderNum")
private Integer sequence;
/**
* 负责人
*/
@JsonProperty("leader")
private String leader;
/**
* 邮箱
*/
@JsonProperty("email")
private String email;
/**
* 联系电话
*/
@JsonProperty("phone")
private String phone;
/**
* 状态(0代表禁用 1代表启用)
*/
@JsonProperty("status")
private Integer status;
/**
* 删除标志(0代表存在 2代表删除)
*/
@JsonProperty("delFlag")
private String delFlag;
/**
* 父部门名称
*/
@JsonProperty("parentName")
private String parentName;
/**
* 组织节点类型
*/
@JsonProperty("orgKindId")
private String orgKindId;
}
package com.huigou.topsun.syncOrg.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* @Auther: xin.lu
* @Date: 2024/03/23/11:23
* @Description:
*/
@Data
public class PersonVo {
/**
* 用户ID
*/
@JsonProperty("userId")
private String id;
/**
* 编码
*/
@JsonProperty("userCode")
private String code;
/**
* 部门ID
*/
@JsonProperty("deptId")
private String deptId;
/**
* 登录名
*/
@JsonProperty("userName")
private String loginName;
/**
* 名称
*/
@JsonProperty("nickName")
private String name;
/**
* 英文名称
*/
@JsonProperty("enName")
private String englishName;
/**
* email
*/
@JsonProperty("email")
private String email;
/**
* 移动电话
*/
@JsonProperty("phonenumber")
private String mobilePhone;
/**
* 性别
*/
@JsonProperty("sex")
private Integer sex;
/**
* 密码
*/
@JsonProperty("password")
private String password;
/**
* 删除标志(0代表存在 2代表删除)
*/
@JsonProperty(value = "delFlag",defaultValue = "0")
private String delFlag;
/**
* 状态
* "0=正常,1=停用"
*/
@JsonProperty("status")
private Integer status;
}
package com.huigou.topsun.syncOrg.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther: xin.lu
* @Date: 2024/03/23/9:46
* @Description: 映射SAP人员
*/
@Data
public class SapPersonVo implements Serializable {
/**
* 上级
*/
@JsonProperty("PARENT_FULL_NAME")
private String parentFullName;
/**
* 员工编号
*/
@JsonProperty("CODE")
private String code;
/**
* 姓名
*/
@JsonProperty("NAME")
private String name;
/**
* 邮件
*/
@JsonProperty("EMAIL")
private String email;
/**
* 英文名称
*/
@JsonProperty("ENGLISH_NAME")
private String englishName;
/**
* 性别
*/
@JsonProperty("SEX")
private String sex;
/**
* 办公电话
*/
@JsonProperty("OFFICE_PHONE")
private String officePhone;
/**
* 移动电话
*/
@JsonProperty("MOBILE_PHONE")
private String mobilePhone;
/**
* 邮编
*/
@JsonProperty("ZIP")
private String zip;
/**
* 家庭住址
*/
@JsonProperty("FAMILY_ADDRESS")
private String familyAddress;
/**
* 国家
*/
@JsonProperty("COUNTRY")
private String country;
/**
* 银行所属国家
*/
@JsonProperty("BANK_COUNTRY")
private String bankCountry;
/**
* 银行代码
*/
@JsonProperty("BANK_CODE")
private String bankCode;
/**
* 银行账号
*/
@JsonProperty("BANK_ACCOUNT_NUMBER")
private String bankAccountNumber;
/**
* 参考明细
*/
@JsonProperty("CONSULT_ITEM")
private String consultItem;
/**
* 公司代码
*/
@JsonProperty("COMPANY_CODE")
private String companyCode;
}
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
<sql-query> <sql-query>
select t.* from sap_cost_center t where t.is_delete = 0 select t.* from sap_cost_center t where t.is_delete = 0
</sql-query> </sql-query>
<condition column="kostl" name="kostl" type="java.lang.String" symbol="like" alias="t"/>
<condition column="ktext" name="ktext" type="java.lang.String" symbol="like" alias="t"/>
<condition column="kosar" name="kosar" type="java.lang.String" symbol="=" alias="t"/>
<condition column="verak" name="verak" type="java.lang.String" symbol="like" alias="t"/>
</query> </query>
<query name="slicedCostCenterList" label="成本中心表" table="sap_cost_center"> <query name="slicedCostCenterList" label="成本中心表" table="sap_cost_center">
......
...@@ -4,5 +4,8 @@ ...@@ -4,5 +4,8 @@
<sql-query> <sql-query>
select t.* from sap_fixed_assets t select t.* from sap_fixed_assets t
</sql-query> </sql-query>
<condition column="bill_code" name="billCode" type="java.lang.String" symbol="like" alias="t"/>
<condition column="anln1" name="anln1" type="java.lang.String" symbol="like" alias="t"/>
<condition column="anlkl" name="anlkl" type="java.lang.String" symbol="=" alias="t"/>
</query> </query>
</query-mappings> </query-mappings>
\ No newline at end of file
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