|
|
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.google.gson.Gson;
|
|
|
+import com.google.gson.reflect.TypeToken;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.aspect.annotation.PermissionData;
|
|
|
@@ -17,6 +19,8 @@ import org.jeecg.common.utils.OauthTokenUtils;
|
|
|
import org.jeecg.modules.platmanager.entity.HwPlatform;
|
|
|
import org.jeecg.modules.platmanager.service.IHwPlatformService;
|
|
|
import org.jeecg.modules.subcontratormanager.entity.HwSubcontractor;
|
|
|
+import org.jeecg.modules.util.essutils.EssChannel;
|
|
|
+import org.jeecg.modules.util.essutils.EssProperties;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
|
@@ -31,10 +35,8 @@ import org.springframework.web.servlet.ModelAndView;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.lang.reflect.Type;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
@@ -49,6 +51,8 @@ import java.util.stream.Collectors;
|
|
|
public class HwPlatformController {
|
|
|
@Autowired
|
|
|
private IHwPlatformService hwPlatformService;
|
|
|
+ @Autowired
|
|
|
+ private EssProperties essProperties;
|
|
|
|
|
|
/**
|
|
|
* 分页列表查询
|
|
|
@@ -296,13 +300,62 @@ public class HwPlatformController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 应用配置服务商列表
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/applicationSubContractorList")
|
|
|
+ public Result<Object> applicationSubContractorListNew(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
+ String requestUrl = OauthApi.applicationSubcontractorList;
|
|
|
+ Map<String, Object> parameters = new HashMap<>();
|
|
|
+ parameters.put("pageNo", pageNo);
|
|
|
+ parameters.put("pageSize", pageSize);
|
|
|
+ String biz_content = CryptTool.encode(JSONObject.toJSONString(parameters));
|
|
|
+ JSONObject jsonObject = OauthTokenUtils.doRequest(requestUrl, HttpsContants.POST, biz_content, "");
|
|
|
+ log.info("jsonObject===={}", jsonObject);
|
|
|
+ if (jsonObject != null) {
|
|
|
+ if (jsonObject.getBoolean("success")) {
|
|
|
+ log.info("配置选择列表===={}", jsonObject);
|
|
|
+ JSONObject jsonObject1 = jsonObject.getJSONObject("result");
|
|
|
+ //类型转换
|
|
|
+ Type type = new TypeToken<List<HwSubcontractor>>() {
|
|
|
+ }.getType();
|
|
|
+ List<HwSubcontractor> list = new Gson().fromJson(jsonObject1.get("records").toString(), type);
|
|
|
+ for (HwSubcontractor hwSubcontractor : list) {
|
|
|
+ List<EssChannel> channelList = essProperties.getChannel();
|
|
|
+ Optional<EssChannel> optionalEssChannel = channelList.stream().filter(item -> item.getProxyOrganizationName().equals(hwSubcontractor.getName())).findFirst();
|
|
|
+ if (optionalEssChannel.isPresent()) {
|
|
|
+ EssChannel essChannel = optionalEssChannel.get();
|
|
|
+ hwSubcontractor.setProxyAppId(essChannel.getProxyAppId());
|
|
|
+ hwSubcontractor.setProxyOrganizationOpenId(essChannel.getProxyOrganizationOpenId());
|
|
|
+ hwSubcontractor.setProxyOperatorOpenId(essChannel.getProxyOperatorOpenId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Page<HwSubcontractor> pageList = new Page<HwSubcontractor>();
|
|
|
+ pageList.setRecords(list);
|
|
|
+ pageList.setTotal(jsonObject1.getInteger("total"));
|
|
|
+ pageList.setCurrent(jsonObject1.getInteger("current"));
|
|
|
+ pageList.setSize(jsonObject1.getInteger("size"));
|
|
|
+ return Result.ok(pageList);
|
|
|
+ } else {
|
|
|
+ //抛出异常
|
|
|
+ throw new JeecgBootException("查询失败");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new JeecgBootException("查询失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 生成电签控制台链接
|
|
|
*
|
|
|
* @param hwmSubcontractor
|
|
|
* @return
|
|
|
*/
|
|
|
- @GetMapping(value = "/createConsoleLoginUrl")
|
|
|
- public Result<?> createConsoleLoginUrl(HwSubcontractor hwmSubcontractor) {
|
|
|
+ @PutMapping(value = "/createConsoleLoginUrl")
|
|
|
+ public Result<?> createConsoleLoginUrl(@RequestBody HwSubcontractor hwmSubcontractor) {
|
|
|
Result<?> result = hwPlatformService.createConsoleLoginUrl(hwmSubcontractor);
|
|
|
return result;
|
|
|
}
|