Commit 4bb8ce10 by zhiwj

资源添加判空

parent e57f58fa
......@@ -3,12 +3,16 @@ package com.gic.auth.service.outer.impl;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.auth.dto.AuditorDTO;
import com.gic.auth.entity.*;
import com.gic.auth.entity.TabAuditor;
import com.gic.auth.entity.TabAuditorAuditedGroupRel;
import com.gic.auth.entity.TabAuditorProjectItemRel;
import com.gic.auth.entity.TabSysUser;
import com.gic.auth.qo.AuditorListQO;
import com.gic.auth.service.*;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GlobalInfo;
import com.gic.commons.util.PageHelperUtils;
import com.gic.enterprise.constants.Constants;
import com.gic.enterprise.dto.ProjectItemDTO;
import com.gic.enterprise.error.ErrorCode;
import com.gic.enterprise.qo.ProjectItemQO;
......@@ -59,7 +63,7 @@ public class AuditorApiServiceImpl implements AuditorApiService {
private ServiceUserApiService serviceUserApiService;
@Autowired
private UserService userService;
// 服务号APPKEY
public static final String APPKEY = "wxc6fd9beaf9a9dbe9";
@Override
......@@ -249,15 +253,34 @@ public class AuditorApiServiceImpl implements AuditorApiService {
@Override
public ServiceResponse<Void> genAuditProject(Integer projectItemId, Integer userId, Integer enterpriseId) {
ServiceResponse<List<AuditorDTO>> serviceResponse = this.listAuditorByProject(projectItemId, userId, enterpriseId);
if (serviceResponse.isSuccess()) {
List<AuditorDTO> auditorList = serviceResponse.getResult();
ServiceResponse<List<AuditorDTO>> auditorServiceResponse = this.listAuditorByProject(projectItemId, userId, enterpriseId);
if (!auditorServiceResponse.isSuccess()) {
return EnterpriseServiceResponse.failure(auditorServiceResponse.getCode(), auditorServiceResponse.getMessage());
}
ServiceResponse<ProjectItemDTO> projectItemService = projectItemApiService.getById(projectItemId);
if (!projectItemService.isSuccess()) {
return EnterpriseServiceResponse.failure(projectItemService.getCode(), projectItemService.getMessage());
}
List<AuditorDTO> auditorList = auditorServiceResponse.getResult();
for (AuditorDTO auditorDTO : auditorList) {
// todo 发送微信模板消息
// todo 如果审核员是管理员 插入后台待办事项
return ServiceResponse.success();
} else {
return EnterpriseServiceResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
// sendWxMessage();
if (auditorDTO.getUserId() != null) {
TabSysUser user = userService.getUserById(auditorDTO.getUserId());
if (user != null) {
// todo 如果审核员是管理员 插入后台待办事项
// saveToDoList();
}
}
}
ProjectItemDTO projectItemDTO = projectItemService.getResult();
if (Constants.NORMAL_STATUS.equals(projectItemDTO.getIsPlatform())) {
// todo 如果是平台审批项, 还要发送给实施
// sendWxMessage();
}
return ServiceResponse.success();
}
private String getTempQrCodeUrl(Integer auditorId) {
......@@ -289,4 +312,7 @@ public class AuditorApiServiceImpl implements AuditorApiService {
}
}
public static void main(String[] args) {
System.out.println(1);
}
}
......@@ -23,6 +23,7 @@ import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.store.dto.StoreWidgetDTO;
import com.gic.store.service.StoreWidgetApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -55,25 +56,29 @@ public class ResourceController {
if(storeWidgetResponse.isSuccess()){
resourceDTO.setStoreResource(storeWidgetResponse.getResult().longValue());
// 订单资源
List<OrderResourceQO> orderResource = resourceQO.getOrderResourceJSON();
JSONArray orderResourceArray = new JSONArray();
for (OrderResourceQO orderResourceQO : orderResource) {
List<Integer> storeIds;
if (OrderResourceChannelEnum.OFFLINE.getCode().equals(orderResourceQO.getChannel())) {
ServiceResponse<Integer> widgetResponse = saveStoreWidget(orderResourceQO.getStoreResouceJSON());
Integer storeId = widgetResponse.getResult();
storeIds = Collections.singletonList(storeId);
} else {
storeIds = orderResourceQO.getStoreContent();
if (CollectionUtils.isNotEmpty(resourceQO.getOrderResourceJSON())) {
List<OrderResourceQO> orderResource = resourceQO.getOrderResourceJSON();
JSONArray orderResourceArray = new JSONArray();
for (OrderResourceQO orderResourceQO : orderResource) {
List<Integer> storeIds;
if (OrderResourceChannelEnum.OFFLINE.getCode().equals(orderResourceQO.getChannel())) {
ServiceResponse<Integer> widgetResponse = saveStoreWidget(orderResourceQO.getStoreResouceJSON());
Integer storeId = widgetResponse.getResult();
storeIds = Collections.singletonList(storeId);
} else {
storeIds = orderResourceQO.getStoreContent();
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("channel", orderResourceQO.getChannel());
jsonObject.put("storeContent", storeIds);
orderResourceArray.add(jsonObject);
}
JSONObject jsonObject = new JSONObject();
jsonObject.put("channel", orderResourceQO.getChannel());
jsonObject.put("storeContent", storeIds);
orderResourceArray.add(jsonObject);
resourceDTO.setOrderResourceJson(JSON.toJSONString(orderResourceArray));
}
resourceDTO.setOrderResourceJson(JSON.toJSONString(orderResourceArray));
// 应用资源
resourceDTO.setAppResourceJson(JSON.toJSONString(resourceQO.getAppResourceJSON()));
if (CollectionUtils.isNotEmpty(resourceQO.getAppResourceJSON())) {
resourceDTO.setAppResourceJson(JSON.toJSONString(resourceQO.getAppResourceJSON()));
}
ServiceResponse<Integer> response = resourceApiService.saveOrUpdateResource(resourceDTO);
if(response.isSuccess()){
......
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