|
@@ -12,6 +12,7 @@ import com.technology.huahai.common.utils.JsonUtils;
|
|
import com.technology.huahai.common.utils.RedisUtils;
|
|
import com.technology.huahai.common.utils.RedisUtils;
|
|
import com.technology.huahai.common.utils.StringUtils;
|
|
import com.technology.huahai.common.utils.StringUtils;
|
|
import com.technology.huahai.common.utils.file.FileUtils;
|
|
import com.technology.huahai.common.utils.file.FileUtils;
|
|
|
|
+import com.technology.huahai.web.dto.ChannelDto;
|
|
import com.technology.huahai.web.dto.ScanRecordDto;
|
|
import com.technology.huahai.web.dto.ScanRecordDto;
|
|
import com.technology.huahai.web.vo.*;
|
|
import com.technology.huahai.web.vo.*;
|
|
import com.technology.huahai.web.mapper.coremapper.CsmMapper;
|
|
import com.technology.huahai.web.mapper.coremapper.CsmMapper;
|
|
@@ -73,47 +74,15 @@ public class CsmServiceImpl implements CsmService {
|
|
@Value("${zx.ctUrl}")
|
|
@Value("${zx.ctUrl}")
|
|
private String ctUrl;
|
|
private String ctUrl;
|
|
|
|
|
|
- @Value("${zx.redirectUrl}")
|
|
|
|
- private String redirectUrl;
|
|
|
|
-
|
|
|
|
@Value("${zx.csmCtMethodKey}")
|
|
@Value("${zx.csmCtMethodKey}")
|
|
private String csmCtMethodKey;
|
|
private String csmCtMethodKey;
|
|
|
|
|
|
- @Value("${zx.getCsmListMethodKey}")
|
|
|
|
- private String getCsmListMethodKey;
|
|
|
|
-
|
|
|
|
- @Value("${zx.getDdSelectMethodKey}")
|
|
|
|
- private String getDdSelectMethodKey;
|
|
|
|
-
|
|
|
|
- @Value("${zx.saveCsmMethodKey}")
|
|
|
|
- private String saveCsmMethodKey;
|
|
|
|
-
|
|
|
|
- @Value("${zx.saveScanRecordMethodKey}")
|
|
|
|
- private String saveScanRecordMethodKey;
|
|
|
|
-
|
|
|
|
- @Value("${zx.getAdressByBzdzbmMethodKey}")
|
|
|
|
- private String getAdressByBzdzbmMethodKey;
|
|
|
|
-
|
|
|
|
@Value("${zx.gdUrl}")
|
|
@Value("${zx.gdUrl}")
|
|
private String gdUrl;
|
|
private String gdUrl;
|
|
|
|
|
|
- @Value("${zx.feedbackMethodKey}")
|
|
|
|
- private String feedbackMethodKey;
|
|
|
|
-
|
|
|
|
@Value("${csm.mode}")
|
|
@Value("${csm.mode}")
|
|
private String mode;
|
|
private String mode;
|
|
|
|
|
|
- @Value("${wx.xcxTokenUrl}")
|
|
|
|
- private String xcxTokenUrl;
|
|
|
|
- @Value("${wx.grant_type}")
|
|
|
|
- private String grant_type;
|
|
|
|
-
|
|
|
|
- @Value("${wx.appid}")
|
|
|
|
- private String appid;
|
|
|
|
-
|
|
|
|
- @Value("${wx.secret}")
|
|
|
|
- private String secret;
|
|
|
|
-
|
|
|
|
@Value("${wx.ewmUrl}")
|
|
@Value("${wx.ewmUrl}")
|
|
private String ewmUrl;
|
|
private String ewmUrl;
|
|
|
|
|
|
@@ -163,7 +132,7 @@ public class CsmServiceImpl implements CsmService {
|
|
public void saveScanCodeRecord(ScanCodeRecordVo scanCodeRecordVo) {
|
|
public void saveScanCodeRecord(ScanCodeRecordVo scanCodeRecordVo) {
|
|
//本地留存一份只保留扫码时间及姓名及场所码id
|
|
//本地留存一份只保留扫码时间及姓名及场所码id
|
|
csmMapper.saveScanRecord(scanCodeRecordVo);
|
|
csmMapper.saveScanRecord(scanCodeRecordVo);
|
|
- AjaxResult ajaxResult = cmsEmsInterfaceOperation(saveScanRecordMethodKey,JsonUtils.writeValueAsString(scanCodeRecordVo));
|
|
|
|
|
|
+ AjaxResult ajaxResult = cmsEmsInterfaceOperation(csmCtMethodKey,scanCodeRecordVo,"saveScanRecord");
|
|
if(0!=ajaxResult.getCode()){
|
|
if(0!=ajaxResult.getCode()){
|
|
throw new CsmException(ajaxResult.getMsg());
|
|
throw new CsmException(ajaxResult.getMsg());
|
|
}
|
|
}
|
|
@@ -186,7 +155,7 @@ public class CsmServiceImpl implements CsmService {
|
|
ResponseEntity<TableDataInfo> response = restTemplate.postForEntity(url, requestEntity, TableDataInfo.class);
|
|
ResponseEntity<TableDataInfo> response = restTemplate.postForEntity(url, requestEntity, TableDataInfo.class);
|
|
tableDataInfo = response.getBody();
|
|
tableDataInfo = response.getBody();
|
|
}else{
|
|
}else{
|
|
- tableDataInfo = cmsEmsInterfaceQueryList(getCsmListMethodKey, JsonUtils.writeValueAsString(technologyQueryVo));
|
|
|
|
|
|
+ tableDataInfo = cmsEmsInterfaceQueryList(csmCtMethodKey, technologyQueryVo,"getCsmList");
|
|
}
|
|
}
|
|
return tableDataInfo;
|
|
return tableDataInfo;
|
|
}
|
|
}
|
|
@@ -208,7 +177,7 @@ public class CsmServiceImpl implements CsmService {
|
|
ResponseEntity<TableDataInfo> response = restTemplate.postForEntity(url, requestEntity, TableDataInfo.class);
|
|
ResponseEntity<TableDataInfo> response = restTemplate.postForEntity(url, requestEntity, TableDataInfo.class);
|
|
tableDataInfo = response.getBody();
|
|
tableDataInfo = response.getBody();
|
|
}else{
|
|
}else{
|
|
- tableDataInfo = cmsEmsInterfaceQueryList(getDdSelectMethodKey, JsonUtils.writeValueAsString(technologyQueryVo));
|
|
|
|
|
|
+ tableDataInfo = cmsEmsInterfaceQueryList(csmCtMethodKey, technologyQueryVo,"getDdSelect");
|
|
}
|
|
}
|
|
return tableDataInfo;
|
|
return tableDataInfo;
|
|
}
|
|
}
|
|
@@ -232,7 +201,7 @@ public class CsmServiceImpl implements CsmService {
|
|
// 解码Base64字符串
|
|
// 解码Base64字符串
|
|
byte[] imageBytes = Base64.getDecoder().decode(technologyCode);
|
|
byte[] imageBytes = Base64.getDecoder().decode(technologyCode);
|
|
String fileName = FileUtils.writeBytesWeekPackage(imageBytes,csmPath,technologyGenerateVo.getId()+".png");
|
|
String fileName = FileUtils.writeBytesWeekPackage(imageBytes,csmPath,technologyGenerateVo.getId()+".png");
|
|
- technologyGenerateVo.setFileName(fileName);
|
|
|
|
|
|
+ technologyGenerateVo.setEwmwjdz(fileName);
|
|
technologyGenerateVo.setTechnologyCode(technologyCode);
|
|
technologyGenerateVo.setTechnologyCode(technologyCode);
|
|
AjaxResult ajaxResult = new AjaxResult();
|
|
AjaxResult ajaxResult = new AjaxResult();
|
|
if("dev".equals(mode)){
|
|
if("dev".equals(mode)){
|
|
@@ -250,7 +219,7 @@ public class CsmServiceImpl implements CsmService {
|
|
ajaxResult = response.getBody();*/
|
|
ajaxResult = response.getBody();*/
|
|
ajaxResult.setData(fileName);
|
|
ajaxResult.setData(fileName);
|
|
}else{
|
|
}else{
|
|
- ajaxResult = cmsEmsInterfaceOperation(saveCsmMethodKey,JsonUtils.writeValueAsString(technologyGenerateVo));
|
|
|
|
|
|
+ ajaxResult = cmsEmsInterfaceOperation(csmCtMethodKey,technologyGenerateVo,"saveCsm");
|
|
if(0!=ajaxResult.getCode()){
|
|
if(0!=ajaxResult.getCode()){
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
}
|
|
}
|
|
@@ -260,7 +229,7 @@ public class CsmServiceImpl implements CsmService {
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
logger.error("二维码生成失败:",e);
|
|
logger.error("二维码生成失败:",e);
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
- return AjaxResult.error("二维码生成失败");
|
|
|
|
|
|
+ return AjaxResult.error("二维码生成失败!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -281,14 +250,14 @@ public class CsmServiceImpl implements CsmService {
|
|
ResponseEntity<AjaxResult> response = restTemplate.postForEntity(url, requestEntity, AjaxResult.class);
|
|
ResponseEntity<AjaxResult> response = restTemplate.postForEntity(url, requestEntity, AjaxResult.class);
|
|
ajaxResult = response.getBody();
|
|
ajaxResult = response.getBody();
|
|
}else{
|
|
}else{
|
|
- ajaxResult = cmsEmsInterfaceOperation(getAdressByBzdzbmMethodKey,JsonUtils.writeValueAsString(queryAdressVo));
|
|
|
|
|
|
+ ajaxResult = cmsEmsInterfaceOperation(csmCtMethodKey,queryAdressVo,"getAdressByBzdzbm");
|
|
}
|
|
}
|
|
return ajaxResult;
|
|
return ajaxResult;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public AjaxResult getAdressByDz(QueryAdressByDzVo queryAdressByDzVo) {
|
|
public AjaxResult getAdressByDz(QueryAdressByDzVo queryAdressByDzVo) {
|
|
- return cmsEmsInterfaceOperation(csmCtMethodKey,JsonUtils.writeValueAsString(queryAdressByDzVo));
|
|
|
|
|
|
+ return cmsEmsInterfaceOperation(csmCtMethodKey,queryAdressByDzVo,"getAdressByDz");
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -336,7 +305,7 @@ public class CsmServiceImpl implements CsmService {
|
|
throw new CsmException(ajaxResult.getMsg());
|
|
throw new CsmException(ajaxResult.getMsg());
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- ajaxResult = cmsEmsInterfaceOperation(feedbackMethodKey,JsonUtils.writeValueAsString(feedbackVo));
|
|
|
|
|
|
+ ajaxResult = cmsEmsInterfaceOperation(csmCtMethodKey,feedbackVo,"generateFeedback");
|
|
if(0!=ajaxResult.getCode()){
|
|
if(0!=ajaxResult.getCode()){
|
|
throw new CsmException(ajaxResult.getMsg());
|
|
throw new CsmException(ajaxResult.getMsg());
|
|
}
|
|
}
|
|
@@ -345,14 +314,14 @@ public class CsmServiceImpl implements CsmService {
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public TableDataInfo queryLevelByLevelId(QueryDdLevelVo queryDdLevelVo) {
|
|
|
|
- TableDataInfo tableDataInfo = cmsEmsInterfaceQueryList(csmCtMethodKey,JsonUtils.writeValueAsString(queryDdLevelVo));
|
|
|
|
- return tableDataInfo;
|
|
|
|
|
|
+ public AjaxResult queryLevelByLevelId(QueryDdLevelVo queryDdLevelVo) {
|
|
|
|
+ AjaxResult ajaxResult = cmsEmsInterfaceOperation(csmCtMethodKey,queryDdLevelVo,"queryLevelByLevelId");
|
|
|
|
+ return ajaxResult;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public TableDataInfo queryDdByLevelAndName(QueryDdLevelVo queryDdLevelVo) {
|
|
public TableDataInfo queryDdByLevelAndName(QueryDdLevelVo queryDdLevelVo) {
|
|
- TableDataInfo tableDataInfo = cmsEmsInterfaceQueryList(csmCtMethodKey,JsonUtils.writeValueAsString(queryDdLevelVo));
|
|
|
|
|
|
+ TableDataInfo tableDataInfo = cmsEmsInterfaceQueryList(csmCtMethodKey,queryDdLevelVo,"queryDdByLevelAndName");
|
|
return tableDataInfo;
|
|
return tableDataInfo;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -457,14 +426,20 @@ public class CsmServiceImpl implements CsmService {
|
|
/**
|
|
/**
|
|
* 场所码内网透传接口(操作类)
|
|
* 场所码内网透传接口(操作类)
|
|
* @param emsMethodkey
|
|
* @param emsMethodkey
|
|
- * @param jsonStr
|
|
|
|
|
|
+ * @param o
|
|
|
|
+ * @param o
|
|
|
|
+ * methodName
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public AjaxResult cmsEmsInterfaceOperation(String emsMethodkey,String jsonStr){
|
|
|
|
|
|
+ public AjaxResult cmsEmsInterfaceOperation(String emsMethodkey,Object o,String methodName){
|
|
String token = getZxTokenByRedis();
|
|
String token = getZxTokenByRedis();
|
|
if(StringUtils.isBlank(token)){
|
|
if(StringUtils.isBlank(token)){
|
|
throw new CsmException("总线token获取失败");
|
|
throw new CsmException("总线token获取失败");
|
|
}else{
|
|
}else{
|
|
|
|
+ ChannelDto channelDto = new ChannelDto();
|
|
|
|
+ channelDto.setMethod(methodName);
|
|
|
|
+ channelDto.setData(o);
|
|
|
|
+ String jsonStr = JsonUtils.writeValueAsString(channelDto);
|
|
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
|
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
|
formData.add("methodkey", emsMethodkey);
|
|
formData.add("methodkey", emsMethodkey);
|
|
formData.add("postDataJson", jsonStr);
|
|
formData.add("postDataJson", jsonStr);
|
|
@@ -477,8 +452,9 @@ public class CsmServiceImpl implements CsmService {
|
|
|
|
|
|
// 5. 构造请求实体(包含头和体)
|
|
// 5. 构造请求实体(包含头和体)
|
|
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(formData, headers);
|
|
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(formData, headers);
|
|
- // 6. 发送请求并获取响应(假设返回的是 String 类型)
|
|
|
|
- //zxResultDto zxResultDto = restTemplate.postForObject(outinterfaceUrl, requestEntity, zxResultDto.class);
|
|
|
|
|
|
+ // 6. 发送请求并获取响应
|
|
|
|
+ logger.info("本次总线请求参数为:{}",jsonStr);
|
|
|
|
+ logger.info("本次总线请求token为:{}",headers.get("Authorization"));
|
|
ResponseEntity<String> zxResult = restTemplate.postForEntity(outinterfaceUrl, requestEntity, String.class);
|
|
ResponseEntity<String> zxResult = restTemplate.postForEntity(outinterfaceUrl, requestEntity, String.class);
|
|
logger.info("总线响应结果 {}", zxResult.getBody());
|
|
logger.info("总线响应结果 {}", zxResult.getBody());
|
|
ZxResultDto zxResultDto = JsonUtils.parseJson(zxResult.getBody(),ZxResultDto.class);
|
|
ZxResultDto zxResultDto = JsonUtils.parseJson(zxResult.getBody(),ZxResultDto.class);
|
|
@@ -495,14 +471,19 @@ public class CsmServiceImpl implements CsmService {
|
|
/**
|
|
/**
|
|
* 场所码内网透传接口(查询列表类)
|
|
* 场所码内网透传接口(查询列表类)
|
|
* @param emsMethodkey
|
|
* @param emsMethodkey
|
|
- * @param jsonStr
|
|
|
|
|
|
+ * @param o
|
|
|
|
+ * @param methodName
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public TableDataInfo cmsEmsInterfaceQueryList(String emsMethodkey,String jsonStr){
|
|
|
|
|
|
+ public TableDataInfo cmsEmsInterfaceQueryList(String emsMethodkey,Object o,String methodName){
|
|
String token = getZxTokenByRedis();
|
|
String token = getZxTokenByRedis();
|
|
if(StringUtils.isBlank(token)){
|
|
if(StringUtils.isBlank(token)){
|
|
throw new CsmException("总线token获取失败");
|
|
throw new CsmException("总线token获取失败");
|
|
}else{
|
|
}else{
|
|
|
|
+ ChannelDto channelDto = new ChannelDto();
|
|
|
|
+ channelDto.setMethod(methodName);
|
|
|
|
+ channelDto.setData(o);
|
|
|
|
+ String jsonStr = JsonUtils.writeValueAsString(channelDto);
|
|
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
|
MultiValueMap<String, String> formData = new LinkedMultiValueMap<>();
|
|
formData.add("methodkey", emsMethodkey);
|
|
formData.add("methodkey", emsMethodkey);
|
|
formData.add("postDataJson", jsonStr);
|
|
formData.add("postDataJson", jsonStr);
|
|
@@ -515,8 +496,9 @@ public class CsmServiceImpl implements CsmService {
|
|
|
|
|
|
// 5. 构造请求实体(包含头和体)
|
|
// 5. 构造请求实体(包含头和体)
|
|
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(formData, headers);
|
|
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(formData, headers);
|
|
- // 6. 发送请求并获取响应(假设返回的是 String 类型)
|
|
|
|
- //ZxResultDto zxResultDto = restTemplate.postForObject(outinterfaceUrl, requestEntity, ZxResultDto.class);
|
|
|
|
|
|
+ // 6. 发送请求并获取响应
|
|
|
|
+ logger.info("本次总线请求参数为:{}",jsonStr);
|
|
|
|
+ logger.info("本次总线请求token为:{}",headers.get("Authorization"));
|
|
ResponseEntity<String> zxResult = restTemplate.postForEntity(outinterfaceUrl, requestEntity, String.class);
|
|
ResponseEntity<String> zxResult = restTemplate.postForEntity(outinterfaceUrl, requestEntity, String.class);
|
|
logger.info("总线响应结果 {}", zxResult.getBody());
|
|
logger.info("总线响应结果 {}", zxResult.getBody());
|
|
ZxResultDto zxResultDto = JsonUtils.parseJson(zxResult.getBody(),ZxResultDto.class);
|
|
ZxResultDto zxResultDto = JsonUtils.parseJson(zxResult.getBody(),ZxResultDto.class);
|