Commit 61d40d2b authored by 鲁鑫's avatar 鲁鑫

同步人员到SAP

parent 12a91a8a
......@@ -116,7 +116,7 @@ $(function () {
{ id: "addProjectOrgFun", text: "添加业务岗位", img: "fa-plus" },
{ id: "assignPerson", text: "分配人员", click: assignPerson, img: "fa-user-plus" },
{ id: "updateOrg", text: "修改", click: showUpdateOrg, img: "fa-edit" },
{ id: "deleteOrg", text: "删除", click: logicDeleteOrg, img: "fa-trash-o" },
//{ id: "deleteOrg", text: "删除", click: logicDeleteOrg, img: "fa-trash-o" },
{ id: "enableOrg", text: "启用", click: enableOrg, img: "fa-thumbs-o-up" },
{ id: "disableOrg", text: "禁用", click: disableOrg, img: "fa-thumbs-down" },
{ id: 'saveID', text:'保存排序号', click: updateOrgSequence, img: "fa-floppy-o"},
......@@ -155,7 +155,9 @@ $(function () {
render: function (item) {
return item.isVirtual == 1 ? "是": "否";
}
}
},
{ display: "消息类型", name: "typeTextView", width: 100, minWidth: 60, type: "string", align: "left" },
{ display: "消息文本", name: "message", width: 200, minWidth: 60, type: "string", align: "left" },
],
dataAction: "server",
url: web_app.name + "/org/slicedQueryOrgs.ajax",
......@@ -561,43 +563,45 @@ function sapMesShow(){
UICtrl.setElRequiredFlag("#country",true);
UICtrl.setElRequiredFlag("#bankCountry",true);
UICtrl.setElRequiredFlag("#bankCode",true);
UICtrl.setElRequiredFlag("#consultItem",true);
//UICtrl.setElRequiredFlag("#consultItem",true);
UICtrl.setElRequiredFlag("#companyCode",true);
UICtrl.setElRequiredFlag("#bankAccountNumber",true);
UICtrl.setElRequiredFlag("#langu",true);
UICtrl.setElRequiredFlag("#region",true);
UICtrl.setElRequiredFlag("#regionName",true);
}
function sapMesHide(){
UICtrl.setElRequiredFlag("#country",false);
UICtrl.setElRequiredFlag("#bankCountry",false);
UICtrl.setElRequiredFlag("#bankCode",false);
UICtrl.setElRequiredFlag("#consultItem",false);
//UICtrl.setElRequiredFlag("#consultItem",false);
UICtrl.setElRequiredFlag("#companyCode",false);
UICtrl.setElRequiredFlag("#bankAccountNumber",false);
UICtrl.setElRequiredFlag("#langu",false);
UICtrl.setElRequiredFlag("#region",false);
UICtrl.setElRequiredFlag("#regionName",false);
$("#country").val("");
$("#bankCountry").val("");
$("#bankCode").val("");
$("#consultItem").val("");
//$("#consultItem").val("");
$("#companyCode").val("");
$("#bankAccountNumber").val("");
$("#langu").val("");
$("#region").val("");
$("#regionName").val("");
}
function doSavePerson() {
var _self = this;
var id = getId();
var type = $("#type").val();
var param = {};
var url = web_app.name + (id ? '/org/updatePerson.ajax' : '/org/insertPerson.ajax');
$('#submitForm').ajaxSubmit({ url: url, param: param, success: function () {
Public.ajax(web_app.name + "/syncOrg/insertOrUpdatePersonToSap.ajax",{code:$("#code").val(),flag:type=='S'?"U":"I"},function () {
refreshFlag = true;
_self.close();
}
})}
});
}
......@@ -740,6 +744,7 @@ function enableOrg() {
param: params,
message: msg,
onSuccess: function () {
//Public.ajax("/syncOrg/enableOrDisablePerson.ajax",{id:row.id,flag:""})
Public.tip("启用“" + name + "”成功。");
reloadGrid();
}
......@@ -772,8 +777,10 @@ function disableOrg() {
param: params,
message: msg,
onSuccess: function () {
Public.ajax(web_app.name + "/syncOrg/enableOrDisablePerson.ajax",{id:row.id,flag:"D"},function () {
Public.tip("禁用“" + name + "”成功。");
reloadGrid();
})
}
});
}
......
......@@ -7,6 +7,8 @@
<x:hidden name="version" />
<x:hidden name="status" />
<x:hidden name="picturePath" />
<x:hidden name="type" />
<x:hidden name="message" />
<div class="hg-form-row">
<div class="col-md-8">
<div class="hg-form-row">
......@@ -26,7 +28,7 @@
</div>
<div class="hg-form-row">
<x:inputC name="sequence" required="true" label="排序号" spinner="true" mask="nnn" dataOptions="min:1" labelCol="2" fieldCol="4" />
<x:selectC name="isSapPerson" required="true" label="是否SAP员工" dictionary="yesorno" labelCol="2" fieldCol="4" />
<x:selectC name="isSapPerson" required="true" label="SAP员工" dictionary="yesorno" labelCol="2" fieldCol="4" />
</div>
<div class="hg-form-row" id="sapMes2">
<x:selectC name="langu" label="语言" labelCol="2" fieldCol="4" dictionary="langu"/>
......@@ -49,13 +51,11 @@
<x:hidden name="region"/>
<x:selectC dictionary="country" name="bankCountry" label="银行所属国家" labelCol="2" fieldCol="4" />
</div>
<div class="col-md-4">
<x:inputC name="bankCode" label="银行代码" labelCol="4" fieldCol="8" wrapper="select"/>
</div>
</div>
<div class="hg-form-row">
<div class="col-md-8">
<x:inputC name="consultItem" label="参考明细" labelCol="2" fieldCol="4" />
<x:inputC name="bankCode" label="银行代码" labelCol="2" fieldCol="4" wrapper="select"/>
<%--<x:inputC name="consultItem" label="参考明细" labelCol="2" fieldCol="4" />--%>
<x:inputC name="companyCode" label="公司代码" labelCol="2" fieldCol="4" wrapper="select"/>
</div>
<div class="col-md-4">
......@@ -65,7 +65,7 @@
</div>
<div class="hg-form-row">
<div class="col-md-8">
<x:selectC name="sex" dictionary="sexFlag" label="性别" labelCol="2" fieldCol="4" />
<x:selectC name="sex" dictionary="sexFlag" label="性别" required="true" labelCol="2" fieldCol="4" />
<x:selectC name="marriage" dictionary="maritalStatus" label="婚姻状况" labelCol="2" fieldCol="4" />
</div>
<div class="col-md-4">
......
......@@ -170,37 +170,37 @@ public class SapQualityInfoRecordItemVo implements Serializable {
/**
* 批次号
*/
@JsonProperty("BATCH_NO")
@JsonProperty("CHARG")
private String batchNo;
/**
* 检验数量
*/
@JsonProperty("CHECK_NUMBER")
@JsonProperty("LFMNG")
private BigDecimal checkNumber;
/**
* 单位
*/
@JsonProperty("UNIT")
@JsonProperty("LFMNE")
private String unit;
/**
* 凭证年份
*/
@JsonProperty("CERTIFICATE_YEAR")
@JsonProperty("MJAHR")
private String certificateYear;
/**
* 凭证号
*/
@JsonProperty("CERTIFICATE_NO")
@JsonProperty("MBLNR")
private String certificateNo;
/**
* 凭证项次
*/
@JsonProperty("CERTIFICATE_ITEM")
@JsonProperty("ZEILE")
private String certificateItem;
}
......@@ -3,8 +3,9 @@ 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.topsun.syncOrg.vo.SapPersonVo.SapPersonVo;
import com.huigou.uasp.bmp.opm.domain.model.org.Org;
import com.huigou.uasp.bmp.opm.domain.model.org.Person;
import java.io.IOException;
import java.util.List;
......@@ -43,11 +44,30 @@ public interface OrgSyncApplication {
/**
* 同步SAP人员
*/
public void syncOrgToSap() throws IOException;
public void syncPersonListToSap();
/**
* 同步SAP人员
*/
public void syncPersonToSap(String flag,List<String> codes);
/**
* 构建SAP人员
* @return
*/
List<SapPersonVo> slicedSapPersonVoList();
List<SapPersonVo> slicedSapPersonVo(List<String> codes);
void buildSapPerson(String flag,List<SapPersonVo> sapPersonVoList);
/**
* 根据fullid模糊查询下属人员编码
* @param fullId
* @return
*/
List<Person> queryPersonCodeByFullId(String fullId);
List<SapPersonVo> querySapPersonVoByFullId(String fullId);
}
package com.huigou.topsun.syncOrg.application.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.topsun.common.OrgKindId;
import com.huigou.topsun.sap.common.DefaultHttpClient;
import com.huigou.topsun.sap.common.application.SapMutualEpLogApplication;
import com.huigou.topsun.sap.common.domain.SapResult;
import com.huigou.topsun.syncOrg.application.OrgSyncApplication;
import com.huigou.topsun.syncOrg.vo.*;
import com.huigou.topsun.syncOrg.vo.SapPersonVo.BankVo;
import com.huigou.topsun.syncOrg.vo.SapPersonVo.CompanyCodeVo;
import com.huigou.topsun.syncOrg.vo.SapPersonVo.MdClientSapVo;
import com.huigou.topsun.syncOrg.vo.SapPersonVo.SapPersonVo;
import com.huigou.uasp.bmp.common.application.BaseApplication;
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.uasp.bmp.opm.repository.org.PersonRepository;
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 org.springframework.util.CollectionUtils;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -34,6 +43,10 @@ public class OrgSyncApplicationImpl extends BaseApplication implements OrgSyncAp
private OrgRepository orgRepository;
@Autowired
private DefaultHttpClient httpClient;
@Autowired
SapMutualEpLogApplication sapMutualEpLogApplication;
@Autowired
private PersonRepository personRepository;
@Override
public EpOrgVo buildOrgVo () {
......@@ -121,11 +134,114 @@ public class OrgSyncApplicationImpl extends BaseApplication implements OrgSyncAp
}
@Override
public void syncOrgToSap() throws IOException {
List<SapPersonVo> sapPersonVoList = this.slicedSapPersonVoList();
String execute = httpClient.execute(sapPersonVoList, "");
LOG.info("====同步到SAP返回消息===={}",execute);
LOG.info(DateUtil.getDateFormat(new Date())+"====同步的组织结构数据===={}",sapPersonVoList);
public void syncPersonListToSap() {
List<SapPersonVo> sapPersonVos = this.slicedSapPersonVoList();
this.buildSapPerson("",sapPersonVos);
}
@Override
public void syncPersonToSap(String flag, List<String> codes) {
List<SapPersonVo> sapPersonVos = this.slicedSapPersonVo(codes);
this.buildSapPerson(flag,sapPersonVos);
}
@Override
public void buildSapPerson(String flag,List<SapPersonVo> sapPersonVoList) {
List<MdClientSapVo> mdClientSapVoList = new ArrayList<>();
List<String> ids = new ArrayList<>();
for (SapPersonVo sapPersonVo : sapPersonVoList) {
MdClientSapVo mdClientSapVo = new MdClientSapVo();
mdClientSapVo.setUpdkz(StringUtil.isNotBlank(flag)?flag:sapPersonVo.getFlag());//第一次新增I,修改U,删除D
mdClientSapVo.setRltyp("FLCU00");//BP角色,财务客户
mdClientSapVo.setBuGroup("C007");//业务伙伴分类,员工客户
mdClientSapVo.setKunnr(sapPersonVo.getCode());//员工编码
mdClientSapVo.setNameOrg1(sapPersonVo.getName());//名称
mdClientSapVo.setNameOrg3(sapPersonVo.getEnglishName());//英文名称
mdClientSapVo.setBuSort1(sapPersonVo.getName());//搜索词
mdClientSapVo.setSmtpAddr(sapPersonVo.getEmail());//邮件
if ("0".equals(sapPersonVo.getSex())){
mdClientSapVo.setTitle("0002");//男
}else if ("1".equals(sapPersonVo.getSex())){
mdClientSapVo.setTitle("0001");//女
}
mdClientSapVo.setTelNumber(sapPersonVo.getOfficePhone());//办公电话
mdClientSapVo.setMobNumber(sapPersonVo.getMobilePhone());//移动电话
mdClientSapVo.setPostCode1(sapPersonVo.getZip());//邮编
mdClientSapVo.setStras(sapPersonVo.getFamilyAddress());//家庭住址
mdClientSapVo.setLand1(sapPersonVo.getCountry());//国家
mdClientSapVo.setLangu(sapPersonVo.getLangu());//语言
mdClientSapVo.setRegion(sapPersonVo.getRegion());//地区
mdClientSapVo.setKnozs(sapPersonVo.getKostl());//成本中心
//银行信息
List<BankVo> bankVoList = new ArrayList<>();
BankVo bankVo = new BankVo();
bankVo.setBanks(sapPersonVo.getBankCountry());//银行所属国家
bankVo.setBankl(sapPersonVo.getBankCode());//银行代码
//银行账户
if (sapPersonVo.getBankAccountNumber().length() > 18){
String bankn = sapPersonVo.getBankAccountNumber();
bankVo.setBankn(bankn.substring(0,18));
//账户明细放18位后的值
bankVo.setBkref(bankn.substring(18,bankn.length()));
}else {
bankVo.setBankn(sapPersonVo.getBankAccountNumber());
}
bankVo.setKoinh(sapPersonVo.getName());//账户持有人姓名
bankVo.setAccname(sapPersonVo.getName());//银行账户的名称
bankVoList.add(bankVo);
//公司信息
List<CompanyCodeVo> companyCodeVoList = new ArrayList<>();
CompanyCodeVo companyCodeVo = new CompanyCodeVo();
companyCodeVo.setBukrs(sapPersonVo.getCompanyCode());//公司代码
companyCodeVo.setAkont("1221050000");//其他应收款-个人往来款
companyCodeVo.setZuawa("001");//排序
companyCodeVoList.add(companyCodeVo);
mdClientSapVo.setBank(bankVoList);
mdClientSapVo.setKnb1(companyCodeVoList);
mdClientSapVoList.add(mdClientSapVo);
ids.add(sapPersonVo.getId());
}
Map<String, Object> resultMap = new HashMap<>();
resultMap.put("businessType", "人员部门主数据");
resultMap.put("businessId", DateUtil.getDateFormat(new Date(),"yyyy-MM-dd HH:mm:ss"));
resultMap.put("parameter", JSON.toJSONString(mdClientSapVoList));
resultMap.put("sequence", resultMap.get("row"));
try {
String result = httpClient.execute(mdClientSapVoList, "cud_custom/customer");
List<SapResult> sapResultList = JSONObject.parseArray(result, SapResult.class);
if (sapResultList.size()<1){
throw new RuntimeException("数据传输失败,没有收到返回结果:" + sapResultList);
}
List<Person> personList = personRepository.findAll(ids);
if (!CollectionUtils.isEmpty(sapPersonVoList) && !CollectionUtils.isEmpty(personList)){
for (Person person : personList) {
for (SapResult sapResult : sapResultList) {
if ("E".equals(sapResult.getTYPE())){
person.setType(sapResult.getTYPE());
person.setMessage(sapResult.getMESSAGE());
}else {
//根据返回的编码匹配是否传成功
if (sapResult.getMESSAGE().contains(person.getCode()) || sapResult.getMESSAGE_V1().contains(person.getCode())){
person.setType(sapResult.getTYPE());
person.setMessage(sapResult.getMESSAGE());
}
}
}
}
}
personRepository.save(personList);
resultMap.put("type", "S");
resultMap.put("message", "成功");
} catch (Exception e) {
resultMap.put("type", "E");
resultMap.put("message", e.getMessage());
throw new RuntimeException("数据传输失败请检查数据后重试!" + e.getMessage());
} finally {
//sapMutualEpLogApplication.saveSapMutualEpLog(resultMap);
}
}
@Override
......@@ -134,6 +250,27 @@ public class OrgSyncApplicationImpl extends BaseApplication implements OrgSyncAp
return this.sqlExecutorDao.queryToList(queryDescriptor.getSql(), SapPersonVo.class);
}
@Override
public List<SapPersonVo> slicedSapPersonVo(List<String> codes) {
String code = String.join(",", codes);
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "slicedSapPersonVo");
return this.sqlExecutorDao.queryToList(queryDescriptor.getSql(), SapPersonVo.class,code);
}
@Override
public List<Person> queryPersonCodeByFullId(String fullId) {
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "queryCodeByFullId");
return this.sqlExecutorDao.queryToList(queryDescriptor.getSql(),Person.class, fullId);
}
@Override
public List<SapPersonVo> querySapPersonVoByFullId(String fullId) {
StringBuilder stringBuffer = new StringBuilder();
StringBuilder append = stringBuffer.append("%").append(fullId).append("%");
QueryDescriptor queryDescriptor = this.sqlExecutorDao.getQuery(QUERY_XML_FILE_PATH, "querySapPersonVoByFullId");
return this.sqlExecutorDao.queryToList(queryDescriptor.getSql(),SapPersonVo.class, append.toString());
}
/**
* 字符串转hashcode
* @param value
......
......@@ -2,14 +2,22 @@ package com.huigou.topsun.syncOrg.controller;
import com.huigou.topsun.syncOrg.application.OrgSyncApplication;
import com.huigou.topsun.syncOrg.vo.EpOrgVo;
import com.huigou.topsun.syncOrg.vo.SapPersonVo.SapPersonVo;
import com.huigou.uasp.annotation.ControllerMapping;
import com.huigou.uasp.annotation.SkipAuth;
import com.huigou.uasp.bmp.opm.domain.model.org.Person;
import com.huigou.uasp.client.CommonController;
import com.huigou.util.SDO;
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;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Auther: xin.lu
* @Date: 2024/03/25/10:51
......@@ -27,4 +35,30 @@ public class SyncOrgController extends CommonController {
public EpOrgVo syncOrgInfo() {
return orgSyncApplication.buildOrgVo();
}
@SkipAuth
@RequestMapping( value = "/syncOrgToSap")
@ResponseBody
public void syncOrgToSap() throws IOException {
orgSyncApplication.syncPersonListToSap();
}
public String insertOrUpdatePersonToSap(){
SDO sdo = this.getSDO();
String code = sdo.getString("code");
String flag = sdo.getString("flag");
List<String> codes = new ArrayList<>();
codes.add(code);
orgSyncApplication.syncPersonToSap(flag,codes);
return success();
}
public String enableOrDisablePerson(){
SDO sdo = this.getSDO();
String id = sdo.getId();
String flag = sdo.getString("flag");
List<SapPersonVo> sapPersonVos = orgSyncApplication.querySapPersonVoByFullId(id);
orgSyncApplication.buildSapPerson(flag,sapPersonVos);
return success();
}
}
......@@ -20,6 +20,6 @@ public class OrgSync {
/** * 每10分钟执行一次 */
//@Scheduled(cron = "0 0/10 * * * ?")
public void syncOrgToSap() throws IOException {
orgSyncApplication.syncOrgToSap();
orgSyncApplication.syncPersonListToSap();
}
}
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther: xin.lu
* @Date: 2024/04/12/9:25
* @Description:
*/
@Data
public class BankVo implements Serializable {
/**
* 银行所属国家/地区代码
*/
@JsonProperty("BANKS")
private String banks;
/**
* 银行编号
*/
@JsonProperty("BANKL")
private String bankl;
/**
* 银行帐号
*/
@JsonProperty("BANKN")
private String bankn;
/**
* 账户持有人姓名
*/
@JsonProperty("KOINH")
private String koinh;
/**
* 账户名称
*/
@JsonProperty("ACCNAME")
private String accname;
/**
* 参考明细
*/
@JsonProperty("BKREF")
private String bkref;
}
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther: xin.lu
* @Date: 2024/04/12/9:25
* @Description:
*/
@Data
public class BrandContactVo implements Serializable {
/**
* 品牌
*/
@JsonProperty("ZF01")
private String zf01;
/**
* 部门
*/
@JsonProperty("ZSECTION")
private String zsection;
/**
* 职位
*/
@JsonProperty("ZF02")
private String zf02;
/**
* 联系人
*/
@JsonProperty("ZF03")
private String zf03;
/**
* 电话号码
*/
@JsonProperty("ZF04")
private String zf04;
/**
* e_Mail
*/
@JsonProperty("ZF05")
private String zf05;
/**
* 经营类型
*/
@JsonProperty("ZF06")
private String zf06;
/**
* 工厂代号
*/
@JsonProperty("ZF07")
private String zf07;
/**
* 跟单员
*/
@JsonProperty("ZKUNR")
private String zkunr;
}
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther: xin.lu
* @Date: 2024/04/12/9:26
* @Description:
*/
@Data
public class CompanyCodeVo implements Serializable {
/**
* 公司代码
*/
@JsonProperty("BUKRS")
private String bukrs;
/**
* 总帐中的统驭科目
*/
@JsonProperty("AKONT")
private String akont;
/**
* 付款条件代码
*/
@JsonProperty("ZTERM")
private String zterm;
/**
* 催款程序
*/
@JsonProperty("MAHNA")
private String mahna;
/**
* 排序代码
*/
@JsonProperty("ZUAWA")
private String zuawa;
}
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
@Data
public class MdClientSapVo {
/**
* 业务伙伴分组
*/
@JsonProperty("BU_GROUP")
private String buGroup;
/**
* 屏幕用途的BP角色
*/
@JsonProperty("RLTYP")
private String rltyp;
/**
* 客户编号
*/
@JsonProperty("KUNNR")
private String kunnr;
/**
* 客户名称
*/
@JsonProperty("NAME_ORG1")
private String nameOrg1;
/**
* 性别
*/
@JsonProperty("TITLE_MEDI")
private String title;
/**
* 客户英文名称
*/
@JsonProperty("NAME_ORG3")
private String nameOrg3;
/**
* 客户简称
*/
@JsonProperty("BU_SORT1")
private String buSort1;
/**
* 注册地址
*/
@JsonProperty("STRAS")
private String stras;
/**
* 客户送货地址
*/
@JsonProperty("STR_SUPPL3")
private String strSuppl3;
/**
* 税号类比
*/
@JsonProperty("TAXTYPE")
private String taxtype;
/**
* 税号
*/
@JsonProperty("TAXNUMXL")
private String taxnumxl;
/**
* 成本中心
*/
@JsonProperty("KNOZS")
private String knozs;
/**
* 城市
*/
@JsonProperty("CITY1")
private String city1;
/**
* 国家
*/
@JsonProperty("LAND1")
private String land1;
/**
* 地区
*/
@JsonProperty("REGION")
private String region;
/**
* 语言代码
*/
@JsonProperty("LANGU")
private String langu;
/**
* 城市邮政编码
*/
@JsonProperty("POST_CODE1")
private String postCode1;
/**
* 电话号码
*/
@JsonProperty("TEL_NUMBER")
private String telNumber;
/**
* 移动电话
*/
@JsonProperty("MOB_NUMBER")
private String mobNumber;
/**
* 电子邮件地址
*/
@JsonProperty("SMTP_ADDR")
private String smtpAddr;
/**
* 做账难度等级
*/
@JsonProperty("KUKLA")
private String kukla;
/**
* 要求用客户系统货单
*/
@JsonProperty("KATR1")
private String katr1;
/**
* 盖章方式
*/
@JsonProperty("KATR2")
private String katr2;
/**
* 请款联
*/
@JsonProperty("KATR3")
private String katr3;
/**
* 客户联
*/
@JsonProperty("KATR4")
private String katr4;
/**
* 订单要求
*/
@JsonProperty("KATR5")
private String katr5;
/**
* 验收单要求
*/
@JsonProperty("KATR6")
private String katr6;
/**
* 客户系统验收要求
*/
@JsonProperty("KATR7")
private String katr7;
/**
* 要求签回货单
*/
@JsonProperty("KATR8")
private String katr8;
/**
* 货单是否打印送货日期
*/
@JsonProperty("KATR9")
private String katr9;
/**
* 不开发票
*/
@JsonProperty("KATR10")
private String katr10;
/**
* 请款要求
*/
@JsonProperty("ZT01")
private String zt01;
/**
* 客户工作时间
*/
@JsonProperty("ZT02")
private String zt02;
/**
* 收货方签字要求
*/
@JsonProperty("ZT03")
private String zt03;
/**
* 货单打印要求
*/
@JsonProperty("ZT04")
private String zt04;
/**
* 产品检验报告类型
*/
@JsonProperty("ZF08")
private String zf08;
/**
* 货单签回方式
*/
@JsonProperty("ZF09")
private String zf09;
/**
* 出货方式
*/
@JsonProperty("ZF10")
private String zf10;
/**
* 线路
*/
@JsonProperty("ZF11")
private String zf11;
/**
* 送货单打印默认设置
*/
@JsonProperty("ZF12")
private String zf12;
/**
* 送货单统计异常期限
*/
@JsonProperty("ZF13")
private String zf13;
/**
* 生产发货方式
*/
@JsonProperty("ZF14")
private String zf14;
/**
* 月结方式
*/
@JsonProperty("ZF15")
private String zf15;
/**
* 请款期限
*/
@JsonProperty("ZF16")
private String zf16;
/**
* 做账截止日
*/
@JsonProperty("ZF17")
private String zf17;
/**
* 客户收账截止日
*/
@JsonProperty("ZF18")
private String zf18;
/**
* 订单统计异常期限
*/
@JsonProperty("ZF19")
private String zf19;
/**
* 所属集团
*/
@JsonProperty("ZF21")
private String zf21;
/**
* 更新标识
*/
@JsonProperty("UPDKZ")
private String updkz;
/**
* 客户品牌联系人列表
*/
@JsonProperty("KNA1_ZPP")
private List<BrandContactVo> kna1Zpp;
/**
* 公司代码视图
*/
@JsonProperty("KNB1")
private List<CompanyCodeVo> knb1;
/**
* 销售组织视图
*/
@JsonProperty("KNVV")
private List<SaleOrgVo> knvv;
/**
* 银行账号列表
*/
@JsonProperty("BANK")
private List<BankVo> bank;
}
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Auther: xin.lu
* @Date: 2024/04/12/9:27
* @Description:
*/
@Data
public class SaleOrgVo implements Serializable {
/**
* 销售组织
*/
@JsonProperty("VKORG")
private String vkorg;
/**
* 分销渠道
*/
@JsonProperty("VKORG")
private String vtweg;
/**
* 产品组
*/
@JsonProperty("SPART")
private String spart;
/**
* 客户组
*/
@JsonProperty("KDGRP")
private String kdgrp;
/**
* 销售部门
*/
@JsonProperty("VKBUR")
private String vkbur;
/**
* 销售组
*/
@JsonProperty("VKGRP")
private String vkgrp;
/**
* 客户分类
*/
@JsonProperty("KLABC")
private String klabc;
/**
* 货币码
*/
@JsonProperty("WAERS")
private String waers;
/**
* 价格清单类型
*/
@JsonProperty("PLTYP")
private String pltyp;
/**
* 国际贸易条款
*/
@JsonProperty("INCO1")
private String inco1;
/**
* 国际贸易条款位置
*/
@JsonProperty("INCO2")
private String inco2;
/**
* 付款条件代码
*/
@JsonProperty("ZTERM")
private String zterm;
/**
* 客户科目分配组
*/
@JsonProperty("KTGRD")
private String ktgrd;
/**
* 客户税分类
*/
@JsonProperty("TAXKD")
private String taxkd;
/**
* 装运条件用于定价过程确定的客户分类
*/
@JsonProperty("KALKS")
private String kalks;
}
package com.huigou.topsun.syncOrg.vo;
package com.huigou.topsun.syncOrg.vo.SapPersonVo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
......@@ -13,6 +13,9 @@ import java.io.Serializable;
*/
@Data
public class SapPersonVo implements Serializable {
private String id;
private String flag;
/**
* 上级
......
......@@ -213,6 +213,12 @@ public class Person extends BaseInfoWithTenantAbstractEntity {
@Column(name = "REGION")
private String region;
/**
* 地区描述
*/
@Column(name = "REGION_NAME")
private String regionName;
/**
* 银行所属国家
*/
......@@ -243,6 +249,42 @@ public class Person extends BaseInfoWithTenantAbstractEntity {
@Column(name = "COMPANY_CODE")
private String companyCode;
/**
* SAP返回消息状态
*/
@Column(name = "TYPE")
private String type;
/**
* SAP返回的消息内容
*/
@Column(name = "MESSAGE")
private String message;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getRegionName() {
return regionName;
}
public void setRegionName(String regionName) {
this.regionName = regionName;
}
public String getLangu() {
return langu;
}
......
......@@ -5,6 +5,7 @@
SELECT
o.FULL_NAME AS PARENT_FULL_NAME,
p.CODE,
p.ID,
p.NAME,
p.EMAIL,
p.ENGLISH_NAME,
......@@ -20,10 +21,88 @@
p.COMPANY_CODE,
p.REGION,
p.LANGU,
op.PROPERTY_VALUE AS KOSTL
op.PROPERTY_VALUE AS KOSTL,
CASE WHEN ( p.type = 'S' AND (p.STATUS = - 1 || p.STATUS = 0)) THEN 'D'
WHEN ( p.type = 'S' AND p.STATUS = 1 ) THEN 'U'
WHEN ( P.type IS NULL || p.type = '' ) THEN 'I'
ELSE '' END AS flag
FROM sa_opperson p
LEFT JOIN sa_oporg o ON p.MAIN_ORG_ID = o.id
LEFT JOIN sa_oporgproperty op ON o.DEPT_ID = op.ORG_ID and p.is_sap_person = '1'
</sql-query>
</query>
<query name="slicedSapPersonVo" label="构建SAP人员结构">
<sql-query>
SELECT
o.FULL_NAME AS PARENT_FULL_NAME,
p.CODE,
p.ID,
p.NAME,
p.EMAIL,
p.ENGLISH_NAME,
p.sex,
p.OFFICE_PHONE,
p.MOBILE_PHONE,
p.ZIP,
p.FAMILY_ADDRESS,
p.COUNTRY,
p.BANK_COUNTRY,
p.BANK_CODE,
p.BANK_ACCOUNT_NUMBER,
p.COMPANY_CODE,
p.REGION,
p.LANGU,
op.PROPERTY_VALUE AS KOSTL,
CASE WHEN ( p.type = 'S' AND (p.STATUS = - 1 || p.STATUS = 0) ) THEN 'D'
WHEN ( p.type = 'S' AND p.STATUS = 1 ) THEN 'U'
WHEN ( P.type IS NULL || p.type = '' ) THEN 'I'
ELSE '' END AS flag
FROM sa_opperson p
LEFT JOIN sa_oporg o ON p.MAIN_ORG_ID = o.id
LEFT JOIN sa_oporgproperty op ON o.DEPT_ID = op.ORG_ID
where p.code in ( ? ) and p.is_sap_person = '1'
</sql-query>
</query>
<query name="queryCodeByFullId" label="查询组织下人员">
<sql-query>
SELECT p.* FROM
sa_opperson p
LEFT JOIN sa_oporg o ON p.id = o.PERSON_ID
WHERE o.FULL_ID LIKE ?
</sql-query>
</query>
<query name="querySapPersonVoByFullId" label="查询组织下人员">
<sql-query>
SELECT
o.FULL_NAME AS PARENT_FULL_NAME,
p.CODE,
p.ID,
p.NAME,
p.EMAIL,
p.ENGLISH_NAME,
p.sex,
p.OFFICE_PHONE,
p.MOBILE_PHONE,
p.ZIP,
p.FAMILY_ADDRESS,
p.COUNTRY,
p.BANK_COUNTRY,
p.BANK_CODE,
p.BANK_ACCOUNT_NUMBER,
p.COMPANY_CODE,
p.REGION,
p.LANGU,
op.PROPERTY_VALUE AS KOSTL,
CASE WHEN ( p.type = 'S' AND (p.STATUS = - 1 || p.STATUS = 0) ) THEN 'D'
WHEN ( p.type = 'S' AND p.STATUS = 1 ) THEN 'U'
WHEN ( P.type IS NULL || p.type = '' ) THEN 'I'
ELSE '' END AS flag
FROM sa_opperson p
LEFT JOIN sa_oporg o ON p.MAIN_ORG_ID = o.id
LEFT JOIN sa_oporgproperty op ON o.DEPT_ID = op.ORG_ID
where p.code in ( SELECT p.code FROM sa_opperson p LEFT JOIN sa_oporg o ON p.id = o.PERSON_ID WHERE o.FULL_ID LIKE ? ) and p.is_sap_person = '1'
</sql-query>
</query>
</query-mappings>
\ No newline at end of file
This diff is collapsed.
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