From 947688a33cd6b76917eedd3765e88bd05fdeb20d Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期日, 17 三月 2024 18:09:33 +0800
Subject: [PATCH] ERP接口
---
server/dmvisit_service/src/main/java/com/doumee/service/business/impl/erp/ErpSyncServiceImpl.java | 151 ++++++++++++++++----------------------------------
1 files changed, 49 insertions(+), 102 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 c9965cf..70c1451 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
@@ -4,6 +4,7 @@
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.doumee.biz.system.SystemDictDataBiz;
import com.doumee.config.DataSyncConfig;
@@ -505,50 +506,44 @@
@Override
public List<RoleListResponse> erpQueryDeviceList(RoleListRequest param){
List<RoleListResponse> result = new ArrayList<>();
- try{
- List<DeviceRole> deviceRoleList = this.deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda()
- .eq(DeviceRole::getIsdeleted,Constants.ZERO)
- .eq(!Objects.isNull(param.getId()),DeviceRole::getId,param.getId())
- .like(StringUtils.isNotBlank(param.getName()),DeviceRole::getName,param.getName())
- .orderByAsc(DeviceRole::getCreateDate)
- );
- List<String> roleIds = new ArrayList<String>();
- if(CollectionUtils.isNotEmpty(deviceRoleList)){
- for (DeviceRole deviceRole:deviceRoleList) {
- if(StringUtils.isNotBlank(deviceRole.getDoorIds())){
- List<String> doorList = Arrays.asList(deviceRole.getDoorIds().split(","));
- roleIds.addAll(doorList);
- }
- }
- if(CollectionUtils.isNotEmpty(roleIds)){
- List<Device> deviceList = deviceMapper.selectList(new QueryWrapper<Device>().lambda().in(Device::getId,roleIds));
- for (DeviceRole deviceRole:deviceRoleList) {
- RoleListResponse roleListResponse = new RoleListResponse();
- BeanUtils.copyProperties(deviceRole,roleListResponse);
- if(deviceRole.getType().equals("2")){
- roleListResponse.setType(Constants.ONE);
- }else{
- roleListResponse.setType(Constants.ZERO);
- }
- if(StringUtils.isNotBlank(deviceRole.getDoorIds())){
- List<DeviceListResponse> DeviceListResponseList = new ArrayList<>();
- List<String> doorList = Arrays.asList(deviceRole.getDoorIds().split(","));
- List<Device> roleDeviceList = deviceList.stream().filter(m-> doorList.contains(m.getId().toString())).collect(Collectors.toList());
- for (Device device:roleDeviceList) {
- DeviceListResponse deviceListResponse = new DeviceListResponse();
- BeanUtils.copyProperties(device,deviceListResponse);
- DeviceListResponseList.add(deviceListResponse);
- }
- roleListResponse.setDeviceList(DeviceListResponseList);
- }
- result.add(roleListResponse);
- }
+ List<DeviceRole> deviceRoleList = this.deviceRoleMapper.selectList(new QueryWrapper<DeviceRole>().lambda()
+ .eq(DeviceRole::getIsdeleted,Constants.ZERO)
+ .eq(!Objects.isNull(param.getId()),DeviceRole::getId,param.getId())
+ .like(StringUtils.isNotBlank(param.getName()),DeviceRole::getName,param.getName())
+ .orderByAsc(DeviceRole::getCreateDate)
+ );
+ List<String> roleIds = new ArrayList<String>();
+ if(CollectionUtils.isNotEmpty(deviceRoleList)){
+ for (DeviceRole deviceRole:deviceRoleList) {
+ if(StringUtils.isNotBlank(deviceRole.getDoorIds())){
+ List<String> doorList = Arrays.asList(deviceRole.getDoorIds().split(","));
+ roleIds.addAll(doorList);
}
}
- }catch (BusinessException e){
- throw e;
- }finally {
- saveInterfaceLog(param,"/visitBiz/resource/role/list",JSONObject.toJSONString(result),Constants.ZERO);
+ if(CollectionUtils.isNotEmpty(roleIds)){
+ List<Device> deviceList = deviceMapper.selectList(new QueryWrapper<Device>().lambda().in(Device::getId,roleIds));
+ for (DeviceRole deviceRole:deviceRoleList) {
+ RoleListResponse roleListResponse = new RoleListResponse();
+ BeanUtils.copyProperties(deviceRole,roleListResponse);
+ if(deviceRole.getType().equals("2")){
+ roleListResponse.setType(Constants.ONE);
+ }else{
+ roleListResponse.setType(Constants.ZERO);
+ }
+ if(StringUtils.isNotBlank(deviceRole.getDoorIds())){
+ List<DeviceListResponse> DeviceListResponseList = new ArrayList<>();
+ List<String> doorList = Arrays.asList(deviceRole.getDoorIds().split(","));
+ List<Device> roleDeviceList = deviceList.stream().filter(m-> doorList.contains(m.getId().toString())).collect(Collectors.toList());
+ for (Device device:roleDeviceList) {
+ DeviceListResponse deviceListResponse = new DeviceListResponse();
+ BeanUtils.copyProperties(device,deviceListResponse);
+ DeviceListResponseList.add(deviceListResponse);
+ }
+ roleListResponse.setDeviceList(DeviceListResponseList);
+ }
+ result.add(roleListResponse);
+ }
+ }
}
return result;
}
@@ -564,23 +559,17 @@
@Override
public List<ParkListResponse> parkList(ParkListRequest param){
List<ParkListResponse> result = new ArrayList<>();
- try{
- List<Parks> parksList = this.parksMapper.selectList(new QueryWrapper<Parks>().lambda()
- .eq(Parks::getIsdeleted,Constants.ZERO)
- .eq(!Objects.isNull(param.getId()),Parks::getId,param.getId())
- .like(StringUtils.isNotBlank(param.getName()),Parks::getName,param.getName())
- );
- if(CollectionUtils.isNotEmpty(parksList)){
- for (Parks parks:parksList) {
- ParkListResponse parkListResponse = new ParkListResponse();
- BeanUtils.copyProperties(parks,parkListResponse);
- result.add(parkListResponse);
- }
+ List<Parks> parksList = this.parksMapper.selectList(new QueryWrapper<Parks>().lambda()
+ .eq(Parks::getIsdeleted,Constants.ZERO)
+ .eq(!Objects.isNull(param.getId()),Parks::getId,param.getId())
+ .like(StringUtils.isNotBlank(param.getName()),Parks::getName,param.getName())
+ );
+ if(CollectionUtils.isNotEmpty(parksList)){
+ for (Parks parks:parksList) {
+ ParkListResponse parkListResponse = new ParkListResponse();
+ BeanUtils.copyProperties(parks,parkListResponse);
+ result.add(parkListResponse);
}
- }catch (BusinessException e){
- throw e;
- }finally {
- saveInterfaceLog(param,"/visitBiz/resource/park/list",JSONObject.toJSONString(result),Constants.ZERO);
}
return result;
}
@@ -593,7 +582,6 @@
@Override
public PageData<VisitEventListResponse> visitListPage(PageWrap<VisitListRequest> param) {
PageData<VisitEventListResponse> result = new PageData<>();
- try{
VisitListRequest visitListRequest = param.getModel();
IPage<VisitEvent> page = new Page<>(param.getPage(), param.getCapacity());
MPJLambdaWrapper<VisitEvent> queryWrapper = new MPJLambdaWrapper<>();
@@ -632,11 +620,6 @@
}
IPage<VisitEventListResponse> pageData = visitEventJoinMapper.selectJoinPage(page, VisitEventListResponse.class,queryWrapper);
result = PageData.from(pageData);
- }catch (BusinessException e){
- throw e;
- }finally {
- saveInterfaceLog(param,"/visitBiz/resource/visit/list",JSONObject.toJSONString(result),Constants.ZERO);
- }
return result;
}
@@ -644,7 +627,7 @@
@Override
public PageData<DoorEventListResponse> doorEventListPage(PageWrap<DoorEventListRequest> param) {
PageData<DoorEventListResponse> result = new PageData<>();
- try{
+
DoorEventListRequest doorEventListRequest = param.getModel();
IPage<DeviceEvent> page = new Page<>(param.getPage(), param.getCapacity());
MPJLambdaWrapper<DeviceEvent> queryWrapper = new MPJLambdaWrapper<>();
@@ -686,11 +669,6 @@
IPage<DoorEventListResponse> pageData = deviceEventJoinMapper.selectJoinPage(page, DoorEventListResponse.class,queryWrapper);
result = PageData.from(pageData);
- }catch (BusinessException e){
- throw e;
- }finally {
- saveInterfaceLog(param,"/visitBiz/resource/doorEvent/list",JSONObject.toJSONString(result),Constants.ZERO);
- }
return result;
}
@@ -698,7 +676,6 @@
@Override
public PageData<CarEventListResponse> carEventList(PageWrap<CarEventListRequest> param) {
PageData<CarEventListResponse> result = new PageData<>();
- try{
CarEventListRequest carEventListRequest = param.getModel();
IPage<CarEvent> page = new Page<>(param.getPage(), param.getCapacity());
MPJLambdaWrapper<CarEvent> queryWrapper = new MPJLambdaWrapper<>();
@@ -750,12 +727,6 @@
i.setVehiclePicUrl(null);
}
});
- }catch (BusinessException e){
- throw e;
- }finally {
- saveInterfaceLog(param,"/visitBiz/resource/carEventList",JSONObject.toJSONString(result),Constants.ZERO);
- }
-
return result;
}
@@ -764,7 +735,6 @@
@Override
public void orgUpdate(OrgUpdateRequest param){
- try{
if(Objects.isNull(param)
||Objects.isNull(param.getId())
||StringUtils.isBlank(param.getName())
@@ -823,16 +793,10 @@
companyMapper.updateById(company);
//TODO 娴峰悍鏁版嵁鏇存柊
}
- }catch (BusinessException e){
- throw e;
- }finally {
- saveInterfaceLog(param,"/visitBiz/resource/orgUpdate",null,Constants.ZERO);
- }
}
@Override
public void userUpdate(UserUpdateRequest param){
- try{
if(param.getIsdeleted() == 1){
if( Objects.isNull(param.getId()) ){
throw new BusinessException(ResponseStatus.BAD_REQUEST);
@@ -909,11 +873,6 @@
//娣诲姞浜哄憳鍗$墖鏁版嵁
dealMemberCard(member,param);
}
- }catch (BusinessException e){
- throw e;
- }finally {
- saveInterfaceLog(param,"/visitBiz/resource/userUpdate",null,Constants.ZERO);
- }
}
/**
@@ -1012,7 +971,6 @@
@Override
public void roleUserAuthor(UserAuthorRequest param){
- try{
if(Objects.isNull(param)
||StringUtils.isBlank(param.getUserId())){
throw new BusinessException(ResponseStatus.BAD_REQUEST);
@@ -1038,17 +996,11 @@
.set(Member::getEndTime,param.getValidEndTime())
.set(Member::getEditDate,new Date())
.set(Member::getHkStatus,Constants.ZERO ));
- }catch (BusinessException e){
- throw e;
- }finally {
- saveInterfaceLog(param,"/event/role/userAuthor",null,Constants.ZERO);
- }
}
@Override
public void parkCarAuthor(CarAuthorRequest param){
- try{
if(Objects.isNull(param)
||StringUtils.isBlank(param.getCarCode())){
throw new BusinessException(ResponseStatus.BAD_REQUEST);
@@ -1095,11 +1047,6 @@
throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"瀵逛笉璧凤紝鍋滆溅搴撲俊鎭笉瀛樺湪锛屾巿鏉冨け璐�");
}
}
- }catch (BusinessException e){
- throw e;
- }finally {
- saveInterfaceLog(param,"/event/park/carAuthor",null,Constants.ZERO);
- }
}
@@ -1145,7 +1092,7 @@
}
- @Transactional(propagation = Propagation.NOT_SUPPORTED)
+ @Override
public void saveInterfaceLog(Object param, String path, String result, Integer type) {
InterfaceLog interfaceLog=new InterfaceLog();
interfaceLog.setType(type);
--
Gitblit v1.9.3