|
@@ -17,6 +17,7 @@ import com.dragoninfo.dcuc.app.service.IApplyInfoService;
|
|
|
import com.dragoninfo.dcuc.app.service.IResourceService;
|
|
|
import com.dragoninfo.dcuc.app.service.IResourceSyncService;
|
|
|
import com.dragoninfo.dcuc.app.service.IServiceResourceService;
|
|
|
+import com.dragoninfo.dcuc.app.service.impl.ResourceServiceImpl;
|
|
|
import com.dragoninfo.dcuc.auth.auth.enumresources.YesNotEnum;
|
|
|
import com.dragoninfo.dcuc.common.http.HttpUtil;
|
|
|
import com.dragoninfo.duceap.core.response.Result;
|
|
@@ -45,6 +46,8 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static com.dragoninfo.dcuc.app.service.impl.ResourceServiceImpl.convertToMenuDTOs;
|
|
|
+
|
|
|
/**
|
|
|
* @author mazq
|
|
|
* @date 2021/2/26
|
|
@@ -117,7 +120,7 @@ public class ResourceBusiness implements IResourceBusiness {
|
|
|
logger.info("appIncrSync get appInfo is null. appCode is:{}", appCode);
|
|
|
return false;
|
|
|
}
|
|
|
- acceptAppResource(appMenuDTO);
|
|
|
+ acceptAppResource(appStr,appMenuDTO);
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@@ -139,7 +142,7 @@ public class ResourceBusiness implements IResourceBusiness {
|
|
|
logger.info("appIncrSync get serviceInfo is null. serviceCode is:{}", serviceCode);
|
|
|
return false;
|
|
|
}
|
|
|
- acceptServiceResource(serviceDTO);
|
|
|
+ acceptServiceResource(serviceStr,serviceDTO);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -288,19 +291,22 @@ public class ResourceBusiness implements IResourceBusiness {
|
|
|
|
|
|
/**
|
|
|
* 增量新增/更新应用资源和应用相关的菜单资源
|
|
|
- *
|
|
|
+ * @param appStr
|
|
|
* @param acceptDTO
|
|
|
* @return
|
|
|
*/
|
|
|
- public boolean acceptAppResource(AppResourceAcceptDTO acceptDTO) {
|
|
|
+ public boolean acceptAppResource(String appStr, AppResourceAcceptDTO acceptDTO) {
|
|
|
+ AppStrAcceptDTO strAcceptDTO = JSON.parseObject(appStr, AppStrAcceptDTO.class);
|
|
|
+
|
|
|
ResourceTypeEnum appEnum = ResourceTypeEnum.TJ_APP;
|
|
|
ResourceSyncDTO syncDTO = new ResourceSyncDTO(appEnum.getResourceId()
|
|
|
, appEnum.getResourceType(), appEnum.getResouProvider());
|
|
|
AppInfoAcceptDTO appAcceptDTO = acceptDTO.getTappSystem();
|
|
|
+
|
|
|
syncDTO.setAppCode(appAcceptDTO.getYyxtbh());
|
|
|
syncDTO.setAppName(appAcceptDTO.getYyxtmc());
|
|
|
syncDTO.setExtId(appAcceptDTO.getId());
|
|
|
- syncDTO.setContent(JSON.toJSONString(appAcceptDTO));
|
|
|
+ syncDTO.setContent(strAcceptDTO.getTappSystem());
|
|
|
syncDTO.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
syncDTO.setSync(BooleanEnum.TRUE.getValue());
|
|
|
syncService.insertRemoteResourceSync(syncDTO);
|
|
@@ -311,7 +317,7 @@ public class ResourceBusiness implements IResourceBusiness {
|
|
|
menuSyncDTO.setAppCode(appAcceptDTO.getYyxtbh());
|
|
|
menuSyncDTO.setAppName(appAcceptDTO.getYyxtmc());
|
|
|
menuSyncDTO.setExtId(appAcceptDTO.getId());
|
|
|
- menuSyncDTO.setContent(JSON.toJSONString(acceptDTO.getTappFunctionList()));
|
|
|
+ menuSyncDTO.setContent(strAcceptDTO.getTappFunctionList());
|
|
|
menuSyncDTO.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
menuSyncDTO.setSync(BooleanEnum.TRUE.getValue());
|
|
|
syncService.insertRemoteResourceSync(menuSyncDTO);
|
|
@@ -324,56 +330,16 @@ public class ResourceBusiness implements IResourceBusiness {
|
|
|
|
|
|
/**
|
|
|
* 应用资源接收类转为应用DTO
|
|
|
- *
|
|
|
* @param acceptDTO
|
|
|
* @return
|
|
|
*/
|
|
|
private AppResourceDTO convertToAppDTO(AppResourceAcceptDTO acceptDTO) {
|
|
|
AppInfoAcceptDTO appInfoAcceptDTO = acceptDTO.getTappSystem();
|
|
|
- AppResourceDTO dto = new AppResourceDTO();
|
|
|
- dto.setDeleted(appInfoAcceptDTO.getXtzxbs());
|
|
|
- dto.setAppCode(appInfoAcceptDTO.getYyxtbh());
|
|
|
- dto.setAppName(appInfoAcceptDTO.getYyxtmc());
|
|
|
- String xtzybs = appInfoAcceptDTO.getXtzybs();
|
|
|
- if (StringUtils.isNotBlank(xtzybs)) {
|
|
|
- if (BooleanEnum.TRUE.getValue().equals(xtzybs)) {
|
|
|
- xtzybs = BooleanEnum.FALSE.getValue();
|
|
|
- } else {
|
|
|
- xtzybs = BooleanEnum.TRUE.getValue();
|
|
|
- }
|
|
|
- }
|
|
|
- dto.setAppStatus(xtzybs);
|
|
|
- dto.setAppUrl(appInfoAcceptDTO.getYyxtfwdz());
|
|
|
- dto.setBuildUnitCode(appInfoAcceptDTO.getYyxtsqdwdm());
|
|
|
- dto.setManagerUnitCode(appInfoAcceptDTO.getYyxtgldwdm());
|
|
|
- dto.setContractUnit(appInfoAcceptDTO.getYyxtcjdwmc());
|
|
|
- dto.setResourceId(ResourceTypeEnum.TJ_APP.getResourceId());
|
|
|
- dto.setResourceType(ResourceTypeEnum.TJ_APP.getResourceType());
|
|
|
- dto.setResourceProvider(ResourceTypeEnum.TJ_APP.getResouProvider());
|
|
|
- String sxrq = appInfoAcceptDTO.getSxrq();
|
|
|
- if (!org.springframework.util.StringUtils.isEmpty(sxrq)) {
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- try {
|
|
|
- Date parse = format.parse(sxrq);
|
|
|
- dto.setRegistrationTime(parse);
|
|
|
- } catch (Exception e) {
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- dto.setApplyCategory(appInfoAcceptDTO.getYyxtfldm());
|
|
|
- dto.setPoliceSpecies(appInfoAcceptDTO.getGajzfldm());
|
|
|
+ AppResourceDTO dto = ResourceServiceImpl.convertToAppDTO(appInfoAcceptDTO);
|
|
|
//设置菜单资源
|
|
|
List<MenuResourceAcceptDTO> tAppFunctionList = acceptDTO.getTappFunctionList();
|
|
|
- List<MenuResourceDTO> menusDTOs = new ArrayList<>();
|
|
|
- for (MenuResourceAcceptDTO mADTO : tAppFunctionList) {
|
|
|
- MenuResourceDTO menuDTO = new MenuResourceDTO();
|
|
|
- menuDTO.setFunCode(mADTO.getGnbh());
|
|
|
- menuDTO.setPFunCode(mADTO.getSjgnbh());
|
|
|
- menuDTO.setFunName(mADTO.getGnmc());
|
|
|
- menuDTO.setAppCode(appInfoAcceptDTO.getYyxtbh());
|
|
|
- menuDTO.setStatus(mADTO.getZyzt());
|
|
|
- menusDTOs.add(menuDTO);
|
|
|
- }
|
|
|
+ String appCode = appInfoAcceptDTO.getYyxtbh();
|
|
|
+ List<MenuResourceDTO> menusDTOs = convertToMenuDTOs(appCode,tAppFunctionList);
|
|
|
dto.setMenusResources(menusDTOs);
|
|
|
return dto;
|
|
|
}
|
|
@@ -381,50 +347,27 @@ public class ResourceBusiness implements IResourceBusiness {
|
|
|
/**
|
|
|
* 增量新增服务资源
|
|
|
*
|
|
|
+ * @param serviceStr
|
|
|
* @param acceptDTO
|
|
|
* @return
|
|
|
*/
|
|
|
- public boolean acceptServiceResource(ServiceResourceAcceptDTO acceptDTO) {
|
|
|
+ public boolean acceptServiceResource(String serviceStr, ServiceResourceAcceptDTO acceptDTO) {
|
|
|
ResourceTypeEnum serviceEnum = ResourceTypeEnum.TJ_SERVICE;
|
|
|
-// ResourceSyncDTO syncDTO = new ResourceSyncDTO(serviceEnum.getResourceId()
|
|
|
-// , serviceEnum.getResourceType(), serviceEnum.getResouProvider());
|
|
|
-// syncDTO.setServiceCode(acceptDTO.getFWZYBSF());
|
|
|
-// syncDTO.setServiceName(acceptDTO.getFWZYMC());
|
|
|
-// syncDTO.setExtId(acceptDTO.getId());
|
|
|
-// syncDTO.setContent(JSON.toJSONString(acceptDTO));
|
|
|
-// syncDTO.setSync(BooleanEnum.TRUE.getValue());
|
|
|
-// syncDTO.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
-// syncService.insertRemoteResourceSync(syncDTO);
|
|
|
+ ResourceSyncDTO syncDTO = new ResourceSyncDTO(serviceEnum.getResourceId()
|
|
|
+ , serviceEnum.getResourceType(), serviceEnum.getResouProvider());
|
|
|
+ syncDTO.setServiceCode(acceptDTO.getFWZYBSF());
|
|
|
+ syncDTO.setServiceName(acceptDTO.getFWZYMC());
|
|
|
+ syncDTO.setExtId(acceptDTO.getId());
|
|
|
+ syncDTO.setContent(serviceStr);
|
|
|
+ syncDTO.setSync(BooleanEnum.TRUE.getValue());
|
|
|
+ syncDTO.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
+ syncService.insertRemoteResourceSync(syncDTO);
|
|
|
//同步更新服务表
|
|
|
- ServiceResourceDTO serviceResourceDTO = convertToServiceDTO(acceptDTO);
|
|
|
- serviceResourceDTO.setResourceId(serviceEnum.getResourceId());
|
|
|
- serviceResourceDTO.setResourceType(serviceEnum.getResourceType());
|
|
|
- serviceResourceDTO.setResourceProvider(serviceEnum.getResouProvider());
|
|
|
+ ServiceResourceDTO serviceResourceDTO = ResourceServiceImpl.convertToServiceDTO(acceptDTO);
|
|
|
resourceService.insertServiceResource(serviceResourceDTO);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
- private ServiceResourceDTO convertToServiceDTO(ServiceResourceAcceptDTO acceptDTO) {
|
|
|
- ServiceResourceDTO dto = new ServiceResourceDTO();
|
|
|
- dto.setServiceCode(acceptDTO.getFWZYBSF());
|
|
|
- dto.setServiceName(acceptDTO.getFWZYMC());
|
|
|
- dto.setManagerUnitCode(acceptDTO.getFWZYGLDW_GAJGJGDM());
|
|
|
- dto.setBuildUnitCode(acceptDTO.getFWZYSQDW_JGDM());
|
|
|
- dto.setServiceUrl(acceptDTO.getFWFWDZ());
|
|
|
- String fwzyztdm = acceptDTO.getFWZYZTDM();
|
|
|
- dto.setServiceStatus(fwzyztdm);
|
|
|
- dto.setDeleted(BooleanEnum.FALSE.getValue());
|
|
|
- if (ServiceStatusCons.STATUS_DELETED.equals(fwzyztdm)) {
|
|
|
- dto.setDeleted(BooleanEnum.TRUE.getValue());
|
|
|
- }
|
|
|
- dto.setServiceType(acceptDTO.getFWLXDM());
|
|
|
- dto.setServiceProvideWay(acceptDTO.getFWTGFSDM());
|
|
|
- //是否自用服务,服务资源未返回
|
|
|
-// dto.setMustSelf();
|
|
|
- dto.setAppCode(acceptDTO.getTGFWZYD_YYZYBS());
|
|
|
- return dto;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
@Override
|
|
|
public List<ResourceRequestResultDTO> getResourceRequestResults(ResourceRequestParamDTO requestParamDTO) {
|