|
|
@ -7,6 +7,7 @@ import com.ruoyi.common.core.redis.RedisCache;
|
|
|
|
import com.ruoyi.common.utils.PdfUtils;
|
|
|
|
import com.ruoyi.common.utils.PdfUtils;
|
|
|
|
import com.ruoyi.flyingbook.LarkHelper.LarkFileHelper;
|
|
|
|
import com.ruoyi.flyingbook.LarkHelper.LarkFileHelper;
|
|
|
|
import com.ruoyi.flyingbook.domain.EventLog;
|
|
|
|
import com.ruoyi.flyingbook.domain.EventLog;
|
|
|
|
|
|
|
|
import com.ruoyi.flyingbook.domain.edi.CJTEdiCallbackRequestVo;
|
|
|
|
import com.ruoyi.flyingbook.domain.edi.EdiResponseVo;
|
|
|
|
import com.ruoyi.flyingbook.domain.edi.EdiResponseVo;
|
|
|
|
import com.ruoyi.flyingbook.domain.edi.SyncToTableRequest;
|
|
|
|
import com.ruoyi.flyingbook.domain.edi.SyncToTableRequest;
|
|
|
|
import com.ruoyi.flyingbook.domain.edi.CJTEdiRequestVo;
|
|
|
|
import com.ruoyi.flyingbook.domain.edi.CJTEdiRequestVo;
|
|
|
@ -41,6 +42,7 @@ public class EdiController extends BaseController {
|
|
|
|
private IEventLogService iEventLogService;
|
|
|
|
private IEventLogService iEventLogService;
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private RedisCache redisCache;
|
|
|
|
private RedisCache redisCache;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 同步数据到飞书表格
|
|
|
|
* 同步数据到飞书表格
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -55,7 +57,7 @@ public class EdiController extends BaseController {
|
|
|
|
log1.setErrorMessage("asd");
|
|
|
|
log1.setErrorMessage("asd");
|
|
|
|
iEventLogService.insertEventLog(log1);
|
|
|
|
iEventLogService.insertEventLog(log1);
|
|
|
|
EventLog log2 = new EventLog();
|
|
|
|
EventLog log2 = new EventLog();
|
|
|
|
iEventLogService.insertBatchEventLog(Arrays.asList(log1,log2));
|
|
|
|
iEventLogService.insertBatchEventLog(Arrays.asList(log1, log2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -64,31 +66,48 @@ public class EdiController extends BaseController {
|
|
|
|
@PostMapping("/cjtTicket")
|
|
|
|
@PostMapping("/cjtTicket")
|
|
|
|
public JSONObject receiveCjtTicket(@RequestBody CJTEdiRequestVo request) {
|
|
|
|
public JSONObject receiveCjtTicket(@RequestBody CJTEdiRequestVo request) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
log.error("receiveWscTicket request:{}",JSONObject.toJSONString(request));
|
|
|
|
log.error("receiveWscTicket request:{}", JSONObject.toJSONString(request));
|
|
|
|
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
|
|
|
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
|
|
|
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec("ND2ANZB8F7NplUqc".getBytes(StandardCharsets.UTF_8), "AES"));
|
|
|
|
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec("ND2ANZB8F7NplUqc".getBytes(StandardCharsets.UTF_8), "AES"));
|
|
|
|
byte[] bytes = Base64.decodeBase64(request.getEncryptMsg());
|
|
|
|
byte[] bytes = Base64.decodeBase64(request.getEncryptMsg());
|
|
|
|
bytes = cipher.doFinal(bytes);
|
|
|
|
bytes = cipher.doFinal(bytes);
|
|
|
|
String encryptMsg = new String(bytes, StandardCharsets.UTF_8);
|
|
|
|
String encryptMsg = new String(bytes, StandardCharsets.UTF_8);
|
|
|
|
log.info("receiveWscTicket encryptMsg:{}",encryptMsg);
|
|
|
|
log.info("receiveWscTicket encryptMsg:{}", encryptMsg);
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(encryptMsg);
|
|
|
|
JSONObject jsonObject = JSONObject.parseObject(encryptMsg);
|
|
|
|
|
|
|
|
execeuteByType(jsonObject);
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
log.error("receiveWscTicket error request:{}", JSONObject.toJSONString(request), e);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
|
|
result.put("result", "success");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void execeuteByType(JSONObject jsonObject) {
|
|
|
|
JSONObject bizContent = jsonObject.getJSONObject("bizContent");
|
|
|
|
JSONObject bizContent = jsonObject.getJSONObject("bizContent");
|
|
|
|
|
|
|
|
String msgType = jsonObject.getString("msgType");
|
|
|
|
|
|
|
|
log.info("畅捷通回调接口 {}",msgType);
|
|
|
|
|
|
|
|
if ("APP_TICKET".equals(msgType)) {
|
|
|
|
|
|
|
|
log.info("同步畅捷通 ticket");
|
|
|
|
String appTicket = bizContent.getString("appTicket");
|
|
|
|
String appTicket = bizContent.getString("appTicket");
|
|
|
|
if (StringUtils.isNotBlank(appTicket)) {
|
|
|
|
if (StringUtils.isNotBlank(appTicket)) {
|
|
|
|
String appKey = jsonObject.getString("appKey");
|
|
|
|
String appKey = jsonObject.getString("appKey");
|
|
|
|
redisCache.deleteObject(buildUniqueKey(RedisConstants.CJT_TOKEN_CACHE_KEY,appKey));
|
|
|
|
redisCache.deleteObject(buildUniqueKey(RedisConstants.CJT_TOKEN_CACHE_KEY, appKey));
|
|
|
|
redisCache.setCacheObject(buildUniqueKey(RedisConstants.CJT_TICKET_CACHE_KEY,appKey),appTicket,10, TimeUnit.MINUTES);
|
|
|
|
redisCache.setCacheObject(buildUniqueKey(RedisConstants.CJT_TICKET_CACHE_KEY, appKey), appTicket, 10, TimeUnit.MINUTES);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}catch (Exception e){
|
|
|
|
}else if ("SaleDispatchVoucher_Delete".equals(msgType)){
|
|
|
|
log.error("receiveWscTicket error request:{}",JSONObject.toJSONString(request),e);
|
|
|
|
log.info("畅捷通删除接口回调");
|
|
|
|
|
|
|
|
String voucherCode = bizContent.getString("voucherCode");
|
|
|
|
|
|
|
|
CJTEdiCallbackRequestVo cjtEdiCallbackRequestVo = new CJTEdiCallbackRequestVo(msgType, voucherCode);
|
|
|
|
|
|
|
|
ediOperateService.cjtCallback(cjtEdiCallbackRequestVo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
|
|
result.put("result","success");
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String buildUniqueKey(String key,String appKey){
|
|
|
|
private String buildUniqueKey(String key, String appKey) {
|
|
|
|
return String.format("%s:%s",key,appKey);
|
|
|
|
return String.format("%s:%s", key, appKey);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|