Commit 437d5634 authored by zhangyingbin's avatar zhangyingbin

工商信息接口开发调试

parent bbfdfba4
...@@ -4,9 +4,8 @@ import com.yeejoin.amos.api.common.restful.utils.ResponseHelper; ...@@ -4,9 +4,8 @@ import com.yeejoin.amos.api.common.restful.utils.ResponseHelper;
import com.yeejoin.amos.api.common.restful.utils.ResponseModel; import com.yeejoin.amos.api.common.restful.utils.ResponseModel;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaAccessConfig; import com.yeejoin.amos.api.openapi.face.orm.entity.TaAccessConfig;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseBaseInfo;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseDetailInfo;
import com.yeejoin.amos.api.openapi.face.service.TaAccessConfigServiceImpl; import com.yeejoin.amos.api.openapi.face.service.TaAccessConfigServiceImpl;
import com.yeejoin.amos.api.openapi.face.service.TaBusinessServiceImpl;
import com.yeejoin.amos.api.openapi.face.service.TaLicenseBaseInfoServiceImpl; import com.yeejoin.amos.api.openapi.face.service.TaLicenseBaseInfoServiceImpl;
import com.yeejoin.amos.api.openapi.face.service.TaLicenseDetailInfoServiceImpl; import com.yeejoin.amos.api.openapi.face.service.TaLicenseDetailInfoServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -21,6 +20,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -21,6 +20,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.List; import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping(value = "/business") @RequestMapping(value = "/business")
...@@ -31,66 +31,78 @@ public class BusinessController { ...@@ -31,66 +31,78 @@ public class BusinessController {
private TaAccessConfigServiceImpl taAccessConfigService; private TaAccessConfigServiceImpl taAccessConfigService;
@Autowired @Autowired
private TaBusinessServiceImpl taBusinessService;
@Autowired
private TaLicenseDetailInfoServiceImpl taLicenseDetailInfoService; private TaLicenseDetailInfoServiceImpl taLicenseDetailInfoService;
@Autowired @Autowired
private TaLicenseBaseInfoServiceImpl taLicenseBaseInfoService; private TaLicenseBaseInfoServiceImpl taLicenseBaseInfoService;
// /** /**
// * 新增许可信息-接入配置表 * 新增许可信息-接入配置表
// * @return * @return
// */ */
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @RequestMapping(value = "/saveAccessConfig", method = RequestMethod.POST) @RequestMapping(value = "/saveAccessConfig", method = RequestMethod.POST)
// @ApiOperation(httpMethod = "POST", value = "新增许可信息-接入配置表", notes = "新增许可信息-接入配置表") @ApiOperation(httpMethod = "POST", value = "新增许可信息-接入配置表", notes = "新增许可信息-接入配置表")
// @RestEventTrigger(value = "openapiLogEventHandler") @RestEventTrigger(value = "openapiLogEventHandler")
// public ResponseModel<String> saveTaAccessConfig (@RequestBody List<TaAccessConfig> produceInfo) throws Exception public ResponseModel<String> saveTaAccessConfig (@RequestBody List<TaAccessConfig> produceInfo) throws Exception
// { {
// return ResponseHelper.buildResponse(taAccessConfigService.saveAccessConfig(produceInfo)); return ResponseHelper.buildResponse(taAccessConfigService.saveAccessConfig(produceInfo));
// } }
//
// /** /**
// * 新增许可信息-许可基本信息表 * 新增许可信息-许可基本信息表
// * *
// * @return * @return
// */ */
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @RequestMapping(value = "/saveLinceseBaseInfo", method = RequestMethod.GET) @RequestMapping(value = "/saveLinceseBaseInfo", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "新增许可信息-许可基本信息表", notes = "新增许可信息-许可基本信息表") @ApiOperation(httpMethod = "GET", value = "新增许可信息-许可基本信息表", notes = "新增许可信息-许可基本信息表")
// @RestEventTrigger(value = "openapiLogEventHandler") @RestEventTrigger(value = "openapiLogEventHandler")
// public ResponseModel<String> saveTaLicenseBaseInfo() throws Exception { public ResponseModel<String> saveTaLicenseBaseInfo() throws Exception {
// taLicenseBaseInfoService.syncLicenseData(); taLicenseBaseInfoService.syncLicenseData();
// return ResponseHelper.buildResponse(""); return ResponseHelper.buildResponse("");
// } }
//
// /** /**
// * 新增许可信息-许可详细信息表 * 新增许可信息-许可详细信息表
// * *
// * @return * @return
// */ */
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @RequestMapping(value = "/saveLinceseDetailInfo", method = RequestMethod.GET) @RequestMapping(value = "/saveLinceseDetailInfo", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "新增许可信息-许可详细信息表", notes = "新增许可信息-许可详细信息表") @ApiOperation(httpMethod = "GET", value = "新增许可信息-许可详细信息表", notes = "新增许可信息-许可详细信息表")
// @RestEventTrigger(value = "openapiLogEventHandler") @RestEventTrigger(value = "openapiLogEventHandler")
// public ResponseModel<String> saveTaLicenseDetailInfo() public ResponseModel<String> saveTaLicenseDetailInfo()
// throws Exception { throws Exception {
// taLicenseDetailInfoService.syncLicenseData(); taLicenseDetailInfoService.syncLicenseData();
// return ResponseHelper.buildResponse(""); return ResponseHelper.buildResponse("");
// } }
//
// /** /**
// * 新增许可信息-许可详细信息表 * 新增许可信息-许可详细信息表
// * *
// * @return * @return
// */ */
// @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
// @RequestMapping(value = "/refreshConfig", method = RequestMethod.GET) @RequestMapping(value = "/refreshConfig", method = RequestMethod.GET)
// @ApiOperation(httpMethod = "GET", value = "更新配置", notes = "更新配置") @ApiOperation(httpMethod = "GET", value = "更新配置", notes = "更新配置")
// @RestEventTrigger(value = "openapiLogEventHandler") @RestEventTrigger(value = "openapiLogEventHandler")
// public ResponseModel<String> refreshConfig() public ResponseModel<String> refreshConfig()
// throws Exception { throws Exception {
// taAccessConfigService.refreshConfig(); taAccessConfigService.refreshConfig();
// return ResponseHelper.buildResponse(""); return ResponseHelper.buildResponse("");
// } }
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/getData", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取map", notes = "获取map")
@RestEventTrigger(value = "openapiLogEventHandler")
public ResponseModel<Map<String, Object>> getData(String code) throws Exception {
return ResponseHelper.buildResponse(taBusinessService.getData(code));
}
} }
package com.yeejoin.amos.api.openapi.face.orm.dao;
public interface DataDictionaryMapper {
String getData(String code);
}
package com.yeejoin.amos.api.openapi.face.service; package com.yeejoin.amos.api.openapi.face.service;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -8,6 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -8,6 +9,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler; import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.scheduling.support.CronTrigger; import org.springframework.scheduling.support.CronTrigger;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -15,6 +18,7 @@ import com.yeejoin.amos.api.openapi.face.model.TaAccessConfigModel; ...@@ -15,6 +18,7 @@ import com.yeejoin.amos.api.openapi.face.model.TaAccessConfigModel;
import com.yeejoin.amos.api.openapi.face.orm.dao.TaAccessConfigMapper; import com.yeejoin.amos.api.openapi.face.orm.dao.TaAccessConfigMapper;
import com.yeejoin.amos.api.openapi.face.orm.entity.TaAccessConfig; import com.yeejoin.amos.api.openapi.face.orm.entity.TaAccessConfig;
import com.yeejoin.amos.openapi.enums.TaAccessConfigBizeEnum; import com.yeejoin.amos.openapi.enums.TaAccessConfigBizeEnum;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
/** /**
* 附件表 服务实现类 * 附件表 服务实现类
...@@ -40,20 +44,20 @@ public class TaAccessConfigServiceImpl extends BaseService<TaAccessConfigModel, ...@@ -40,20 +44,20 @@ public class TaAccessConfigServiceImpl extends BaseService<TaAccessConfigModel,
* @param model 接入配置实体类集合 * @param model 接入配置实体类集合
* @return 成功返回“OK” * @return 成功返回“OK”
*/ */
// @Transactional(rollbackFor = { Exception.class }) @Transactional(rollbackFor = { Exception.class })
// public String saveAccessConfig(List<TaAccessConfig> model) { public String saveAccessConfig(List<TaAccessConfig> model) {
// // TODO Auto-generated method stub // TODO Auto-generated method stub
// if (ValidationUtil.isEmpty(model)) { if (ValidationUtil.isEmpty(model)) {
// throw new BadRequest("接入配置表信息为空."); throw new BadRequest("接入配置表信息为空.");
// } }
// for (TaAccessConfig models : model) { for (TaAccessConfig models : model) {
//// checkModel(models); // checkModel(models);
// models.setRecDate(new Date()); models.setRecDate(new Date());
//// models.setAppId(getAppId()); // models.setAppId(getAppId());
// } }
// this.saveBatch(model); this.saveBatch(model);
// return "OK"; return "OK";
// } }
public void refreshConfig() { public void refreshConfig() {
licenseConfig.clear(); licenseConfig.clear();
......
...@@ -6,6 +6,11 @@ import java.util.HashMap; ...@@ -6,6 +6,11 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.csoft.sdk.domain.CsoftDataApiXixianParam;
import com.csoft.sdk.domain.request.CsoftDataApiXixianRequest;
import com.csoft.sdk.domain.response.CsoftDataApiXixianResponse;
import com.yeejoin.amos.api.openapi.face.orm.dao.DataDictionaryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
...@@ -29,49 +34,65 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseBaseInfo; ...@@ -29,49 +34,65 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseBaseInfo;
@Service @Service
public class TaBusinessServiceImpl extends BaseService<TaAccessConfigModel, TaAccessConfig, TaAccessConfigMapper> { public class TaBusinessServiceImpl extends BaseService<TaAccessConfigModel, TaAccessConfig, TaAccessConfigMapper> {
// public Map<String, Object> getData(String code) throws Exception { @Autowired
// Map<String, String> map = TaAccessConfigServiceImpl.licenseConfig; private DataDictionaryMapper dataDictionaryMapper;
// String appId = map.get("appId");
// String appKey = map.get("appKey"); public Map<String, Object> getData(String code) throws Exception {
// String appSecret = map.get("appSecret"); Map<String, String> map = TaAccessConfigServiceImpl.licenseConfig;
// String server = map.get("server"); String appId = map.get("appId");
// App app = App.of(appId, appKey, appSecret, server); String appKey = map.get("appKey");
// CsoftDefaultSdkClient client = CsoftDefaultSdkClient.of(app); String appSecret = map.get("appSecret");
// // 3.设置参数,发送请求,并处理结果 String server = map.get("server");
// CsoftDataApiXixianParam csoftDataApiXixianParam = new CsoftDataApiXixianParam(); App app = App.of(appId, appKey, appSecret, server);
// csoftDataApiXixianParam.setUniscid(code); CsoftDefaultSdkClient client = CsoftDefaultSdkClient.of(app);
// CsoftDataApiXixianRequest request = new CsoftDataApiXixianRequest(csoftDataApiXixianParam); // 3.设置参数,发送请求,并处理结果
// CsoftDataApiXixianResponse response = client.execute(request); CsoftDataApiXixianParam csoftDataApiXixianParam = new CsoftDataApiXixianParam();
// Map<String, Object> result = new HashMap<>(); csoftDataApiXixianParam.setUniscid(code);
// // 4.返回校验 CsoftDataApiXixianRequest request = new CsoftDataApiXixianRequest(csoftDataApiXixianParam);
// if (response.isSuccess()) { CsoftDataApiXixianResponse response = client.execute(request);
// System.out.println("成功:" + response.getData()); Map<String, Object> result = new HashMap<>();
// System.out.println(response.getResult()); // 4.返回校验
// JSONObject jsonObject = JSONObject.parseObject(response.getData()); if (response.isSuccess()) {
// JSONObject data = jsonObject.getJSONObject("data"); System.out.println("成功:" + response.getData());
// JSONArray jsonArray = data.getJSONArray("objList"); System.out.println(response.getResult());
// //所属行业 JSONObject jsonObject = JSONObject.parseObject(response.getData());
// result.put("industry", value); JSONObject data = jsonObject.getJSONObject("data");
// //注册地址 省/市/区
// result.put("area", value); //分割字符串 根据详细地址分割出 省/市/区、街道地址、小区地址
// //注册地址 街道地址 String address = data.getString("dom");
// result.put("street", value); String area = address.substring(0,address.indexOf("区")+1);
// //注册地址 小区地址 String street = address.substring(area.length()).substring(0,address.substring(area.length()).indexOf("号")+1);
// result.put("community", value); String community = address.substring(area.length()+street.length());
// //注册地址 详细地址
// result.put("address", value); String industry = getIndustry(data.getString("hydm"));
// //登记机关
// result.put("registration_authority", value); //所属行业
// //核准时间 result.put("industry", industry);
// result.put("approval_time", value); //注册地址 省/市/区
// //经营状态 result.put("area", area);
// result.put("operating_status", value); //注册地址 街道地址
// } else { result.put("street", street);
// System.out.println("失败:" + response.getErrorMsg()); //注册地址 小区地址
// System.out.println("失败:" + response.getErrorCode()); result.put("community", community);
// throw new Exception(response.getErrorMsg()); //注册地址 详细地址
// } result.put("address", data.get("dom"));
// return result; //登记机关
// } result.put("registration_authority", data.get("regorg"));
//核准时间
result.put("approval_time", data.get("hzrq"));
//经营状态
result.put("operating_status", data.get("opstate"));
} else {
System.out.println("失败:" + response.getErrorMsg());
System.out.println("失败:" + response.getErrorCode());
throw new Exception(response.getErrorMsg());
}
return result;
}
public String getIndustry(String code){
return dataDictionaryMapper.getData(code.substring(0,2));
}
} }
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.api.openapi.face.orm.dao.DataDictionaryMapper">
<select id="getData" resultType="java.lang.String">
select `name` FROM cb_data_dictionary WHERE code=#{code} and type="IndustryCode"
</select>
</mapper>
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