Commit 748b2ca1 authored by lisong's avatar lisong

添加通用表单提交远程接口

parent 668db2bc
......@@ -29,7 +29,7 @@ public interface PrivilegeFeginService {
//获取单位树
@RequestMapping(value = "/privilege/v1/company/tree", method = RequestMethod.GET)
FeignClientResult tree();
FeignClientResult tree(@RequestHeader("token")String token,@RequestHeader("appKey")String appKey,@RequestHeader("product")String product);
//获取省级行政区划
@RequestMapping(value = "systemctl/v1/region/level", method = RequestMethod.GET)
......
......@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.dto.RegUnitInfoDto;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 单位注册信息表接口类
......@@ -70,4 +71,6 @@ public interface IRegUnitInfoService {
Boolean creatQrCode();
RegUnitInfoDto adminInfo(String unitCode);
String submit(Long pageId, String taskId, String planInstanceId, String topic, String tableName , Map<String, Object>objectMap) throws Exception;
}
......@@ -302,7 +302,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override
public List<LinkedHashMap> creatTree() {
FeignClientResult tree = privilegeFeginService.tree();
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(),RequestContext.getAppKey(),RequestContext.getProduct());
List<LinkedHashMap> result = (List<LinkedHashMap>) tree.getResult();
List<LinkedHashMap> treeData = deleteRegulatorTreeData(result);
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.entity.DataDictionary;
......@@ -29,10 +30,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
import java.util.*;
/**
* 单位注册信息表
......@@ -85,6 +83,18 @@ public class RegUnitInfoController extends BaseController {
return ResponseHelper.buildResponse(iRegUnitInfoService.creatQrCode());
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/submit")
@ApiOperation(httpMethod = "POST", value = "", notes = "")
public ResponseModel<Object> submit(@RequestParam(value = "pageId") long pageId,
@RequestParam(value = "taskId",required = false) String taskId,
@RequestParam(value = "planInstanceId",required = false) String planInstanceId,
@RequestParam(value = "topic",required = false) String topic,
@RequestParam(value = "tableName",required = false) String tableName,
@RequestBody Map<String, Object> kv
) throws Exception {
return ResponseHelper.buildResponse(iRegUnitInfoService.submit(pageId, taskId, planInstanceId, topic, tableName, kv));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/adminInfo", method = RequestMethod.GET)
......
......@@ -29,6 +29,7 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.dto.RegUnitInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.RegUnitIc;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.RegUnitInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.feign.AccessFeignService;
import com.yeejoin.amos.boot.module.tzs.flc.api.feign.IdxFeignService;
import com.yeejoin.amos.boot.module.tzs.flc.api.feign.UgpServiceFeignClient;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.RegUnitInfoMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IRegUnitInfoService;
......@@ -44,6 +45,7 @@ import org.apache.http.entity.ContentType;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -117,6 +119,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
@Autowired
EquipmentCategoryServiceImpl equipmentCategoryService;
@Autowired
IdxFeignService idxFeignService;
/**
* 使用单位的类型,数据来源:cb_data_dictionary code = 1232
*/
......@@ -698,6 +703,46 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
}
}
@Override
public String submit(Long pageId, String taskId, String planInstanceId, String topic, String tableName, Map<String, Object> objectMap) throws Exception {
// 企业下所有用户(上送工作流)
ArrayList<String> flow = new ArrayList<>();
// 企业下所有用户(更新任务)
ArrayList<String> task = new ArrayList<>();
// 查询第一个填报信息获取企业
String companyName = "";
FeignClientResult<JSONObject> firstTask = idxFeignService.getFirstTask(taskId);
if (!ObjectUtils.isEmpty(firstTask)) {
companyName = String.valueOf(firstTask.getResult().get("CHECKED_COMPANY"));
}
if (!ObjectUtils.isEmpty(objectMap)) {
FeignClientResult<CompanyModel> companyModelFeignClientResult = Privilege.companyClient.queryByCompanyName(companyName);
if (!ObjectUtils.isEmpty(companyModelFeignClientResult.getResult()) && !ObjectUtils.isEmpty(companyModelFeignClientResult.getResult().getOrgCode())) {
FeignClientResult<Set<AgencyUserModel>> setFeignClientResult = Privilege.agencyUserClient.queryByOrgCode(companyModelFeignClientResult.getResult().getOrgCode(), null);
if (!ObjectUtils.isEmpty(setFeignClientResult)) {
setFeignClientResult.getResult().forEach(item -> {
flow.add(item.getUserName());
task.add(item.getUserId());
});
}
}
}
String userIds = String.join(",", flow);
String userIdsTask = String.join(",", task);
// 添加被检查企业下的人员id
objectMap.put("CHECKED_COMPANY_USERS", userIds);
// 表单信息提交
FeignClientResult<String> submit = idxFeignService.submit(pageId, taskId, planInstanceId, topic, tableName, objectMap);
if ("200".equals(String.valueOf(submit.getStatus()))) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("title", "企业整改");
jsonObject.put("userIds", userIdsTask);
idxFeignService.updateAmosTask(taskId, jsonObject);
}
return "ok";
}
private String dealNull2EmptyString(String t) {
return StringUtils.isEmpty(t) ? "" : t;
}
......
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