From d3c4c2c396cd94b04937d0d316d2cb6f11832a5f Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 05 一月 2024 08:59:24 +0800
Subject: [PATCH] ERP接口
---
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java | 47 +++++++++++++++++++++++++++++++++--------------
1 files changed, 33 insertions(+), 14 deletions(-)
diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java
index 8d5026f..1db1024 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java
@@ -122,6 +122,9 @@
@Override
@Transactional
public String syncCompany(OrgListRequest param){
+ if(!StringUtils.equals(Constants.ONE+"", systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ORG_USER_ORIGIN).getCode())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝褰撳墠涓嶆敮鎸佺粍缁囧悓姝ユ搷浣渵");
+ }
//鑾峰彇ERP缁勭粐淇℃伅锛堝叏閲忓悓姝ワ級
List<ErpOrgListResponse> list = ErpTool.getErpOrgList(ErpConstants.orgListUrl,param);
if(list !=null && list.size()>0){
@@ -219,13 +222,16 @@
*/
private Company getAddCompanyModel(ErpOrgListResponse respone, Date date) {
Company company = new Company();
+ company.setStatus(respone.getStatus());
company.setIsdeleted(Constants.ZERO);
company.setName(respone.getName());
company.setErpId(respone.getId());
company.setCreateDate(date);
company.setType(Constants.ONE);
company.setCode(respone.getCode());
- company.setErpParentId(respone.getParentOrgId());
+ if(StringUtils.isNotBlank(respone.getParentOrgId())&&!respone.getParentOrgId().equals("orgRoot")){
+ company.setErpParentId(respone.getParentOrgId());
+ }
company.setErpDate(date);
company.setHkStatus(Constants.ZERO);
return company;
@@ -262,6 +268,9 @@
@Override
@Transactional
public String syncUsers(UserListRequest param){
+ if(!StringUtils.equals(Constants.ONE+"", systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.ORG_USER_ORIGIN).getCode())){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝褰撳墠涓嶆敮鎸佷汉鍛樺悓姝ユ搷浣渵");
+ }
List<ErpUserListResponse> list = ErpTool.getErpUserList(ErpConstants.userListUrl,param);
if(list !=null && list.size()>0) {
List<Member> addList = new ArrayList<>();
@@ -715,9 +724,9 @@
if(Objects.isNull(param)
||Objects.isNull(param.getId())
||StringUtils.isBlank(param.getName())
- ||StringUtils.isBlank(param.getLinkName())
- ||StringUtils.isBlank(param.getLinkPhone())
- ||Objects.isNull(param.getEditDate())
+// ||StringUtils.isBlank(param.getLinkName())
+// ||StringUtils.isBlank(param.getLinkPhone())
+// ||Objects.isNull(param.getEditDate())
){
throw new BusinessException(ResponseStatus.BAD_REQUEST);
}
@@ -729,6 +738,7 @@
throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"鏈煡璇㈠埌涓婄骇缁勭粐鏁版嵁");
}
}
+ String rootOrgId = systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.HK_ROOTORG_CODE).getCode();
if(Objects.isNull(company)){
company = new Company();
company.setId(null);
@@ -736,9 +746,14 @@
company.setHkStatus(Constants.ZERO);
company.setErpStatus(Constants.ONE);
company.setErpDate(new Date());
+ company.setName(param.getName());
+ /* if(StringUtils.isNotBlank(param.getParentId())){
+ company.setHkId(rootOrgId);
+ }*/
company.setErpId(param.getId());
company.setErpParentId(param.getParentId());
company.setParentId(Objects.isNull(parentCompany)?null:parentCompany.getId());
+ company.setErpParentId(param.getParentId());
company.setFsStatus(Constants.ZERO);
company.setType(Constants.ONE);
company.setLinkName(param.getLinkName());
@@ -749,8 +764,12 @@
// BeanUtils.copyProperties(param,company);
company.setEditDate(new Date());
company.setErpId(param.getId());
+ /* if(StringUtils.isNotBlank(param.getParentId())){
+ company.setHkId(rootOrgId);
+ }*/
company.setHkStatus(Constants.ZERO);
company.setErpDate(new Date());
+ company.setName(param.getName());
company.setErpParentId(param.getParentId());
company.setParentId(Objects.isNull(parentCompany)?null:parentCompany.getId());
company.setLinkName(param.getLinkName());
@@ -771,16 +790,16 @@
public void userUpdate(UserUpdateRequest param){
try{
if(Objects.isNull(param)
- ||Objects.isNull(param.getId())
- ||StringUtils.isBlank(param.getName())
- ||StringUtils.isBlank(param.getIdNo())
- ||Objects.isNull(param.getIdType())
- ||Objects.isNull(param.getSex())
- ||Objects.isNull(param.getOrgId())
- ||StringUtils.isNotBlank(param.getFaceImg())
- ||StringUtils.isNotBlank(param.getCode())
- ||StringUtils.isNotBlank(param.getPhone())
- ||Objects.isNull(param.getEditDate())){
+ ||Objects.isNull(param.getId())//缂栫爜
+ ||StringUtils.isBlank(param.getName())//鍚嶇О
+ ||StringUtils.isBlank(param.getIdNo())//璇佷欢鍙�
+ ||Objects.isNull(param.getIdType())//璇佷欢绫诲瀷
+ ||Objects.isNull(param.getSex())//鎬у埆
+ ||Objects.isNull(param.getOrgId())//鎵�灞炵粍缁囩紪鐮�
+ ||StringUtils.isBlank(param.getFaceImg())//浜鸿劯鐓х墖
+ ||StringUtils.isBlank(param.getCode())//宸ュ彿
+ ||StringUtils.isBlank(param.getPhone())//鎵嬫満鍙�
+ ){
throw new BusinessException(ResponseStatus.BAD_REQUEST);
}
Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda().eq(Member::getErpId,param.getId()).last("limit 1"));
--
Gitblit v1.9.3