1. 江苏工行相关代码
This commit is contained in:
parent
88ff8ad9b1
commit
e41669ed0a
|
|
@ -0,0 +1,127 @@
|
|||
package com.chushang.inspection.work.dto;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
|
||||
@Data
|
||||
public class WrkIcbcJsPush implements Serializable {
|
||||
|
||||
/**
|
||||
* 交易码
|
||||
*/
|
||||
private String transCode;
|
||||
|
||||
/**
|
||||
* 商户 id
|
||||
*/
|
||||
private String merId;
|
||||
|
||||
/**
|
||||
* 商户名
|
||||
*/
|
||||
private String merName;
|
||||
|
||||
/**
|
||||
* 终端编号
|
||||
*/
|
||||
private String termId;
|
||||
|
||||
/**
|
||||
* 工单创建日期(yyyyMMdd)
|
||||
*/
|
||||
@JsonFormat(pattern = DatePattern.PURE_DATE_PATTERN)
|
||||
private LocalDate startDate;
|
||||
|
||||
/**
|
||||
* 工单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
|
||||
/**
|
||||
* 工单类型
|
||||
*/
|
||||
private String orderType;
|
||||
|
||||
/**
|
||||
* 联系人
|
||||
*/
|
||||
private String linkName;
|
||||
|
||||
/**
|
||||
* 联系方式
|
||||
*/
|
||||
private String contactWay;
|
||||
|
||||
/**
|
||||
* 商户地址
|
||||
*/
|
||||
private String merAddress;
|
||||
|
||||
/**
|
||||
* 商户类型
|
||||
*/
|
||||
private String merType;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
private String deviceNo;
|
||||
|
||||
/**
|
||||
* 备注信息
|
||||
*/
|
||||
private String noteMsg;
|
||||
|
||||
/**
|
||||
* 服务商编号
|
||||
*/
|
||||
private String agentId;
|
||||
|
||||
/**
|
||||
* 请求日期
|
||||
*/
|
||||
@JsonFormat(pattern = DatePattern.PURE_DATE_PATTERN)
|
||||
private LocalDate reqDate;
|
||||
|
||||
/**
|
||||
* 请求时间
|
||||
*/
|
||||
@JsonFormat(pattern = DatePattern.PURE_TIME_PATTERN)
|
||||
private LocalTime reqTime;
|
||||
|
||||
/**
|
||||
* 工单完成日期
|
||||
*/
|
||||
@JsonFormat(pattern = DatePattern.PURE_DATE_PATTERN)
|
||||
private LocalDate compDate;
|
||||
|
||||
/**
|
||||
* 工单完成时间
|
||||
*/
|
||||
@JsonFormat(pattern = DatePattern.PURE_TIME_PATTERN)
|
||||
private LocalTime compTime;
|
||||
|
||||
/**
|
||||
* 工单状态
|
||||
*/
|
||||
private String orderStatus;
|
||||
|
||||
/**
|
||||
* 描述信息
|
||||
*/
|
||||
private String descInfo;
|
||||
|
||||
/**
|
||||
* 分行地区号
|
||||
*/
|
||||
private String area;
|
||||
}
|
||||
|
|
@ -55,4 +55,6 @@ public interface TerminalService extends IService<Terminal>{
|
|||
List<DispatchDTO> getStoreByTasKIdOrIds(DispatchQuery query);
|
||||
|
||||
JSONObject save(Store store, WrkIcbcJsReceive dto);
|
||||
|
||||
JSONObject getTerMap(Long terminalId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,4 +141,9 @@ public class TerminalServiceImpl extends ServiceImpl<TerminalMapper, Terminal> i
|
|||
return JSONObject.of("terminal", terminal, "terminalIns", terminalIns);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getTerMap(Long terminalId) {
|
||||
return JSONObject.of("terminal", getById(terminalId), "terminalIns", terminalInsService.getById(terminalId));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,24 +2,39 @@ package com.chushang.inspection.work.service.impl;
|
|||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.chushang.common.core.constant.SecurityConstants;
|
||||
import com.chushang.common.core.exception.utils.AssertUtil;
|
||||
import com.chushang.common.core.web.Result;
|
||||
import com.chushang.common.mybatis.page.CommonParam;
|
||||
import com.chushang.common.mybatis.utils.PageResult;
|
||||
import com.chushang.common.mybatis.utils.WrapperUtils;
|
||||
import com.chushang.datascope.annotation.DataScope;
|
||||
import com.chushang.inspection.project.po.PollingTask;
|
||||
import com.chushang.inspection.project.po.WrkProjectPayment;
|
||||
import com.chushang.inspection.project.service.PollingTaskService;
|
||||
import com.chushang.inspection.terminal.po.Store;
|
||||
import com.chushang.inspection.terminal.po.Terminal;
|
||||
import com.chushang.inspection.terminal.po.TerminalIns;
|
||||
import com.chushang.inspection.terminal.service.StoreService;
|
||||
import com.chushang.inspection.terminal.service.TerminalService;
|
||||
import com.chushang.inspection.utils.BeanCopyUtils;
|
||||
import com.chushang.inspection.utils.PoolUtils;
|
||||
import com.chushang.inspection.utils.TaskConfigUtils;
|
||||
import com.chushang.inspection.work.dto.BankDispatchQuery;
|
||||
import com.chushang.inspection.work.dto.DispatchDTO;
|
||||
import com.chushang.inspection.work.dto.WrkIcbcJsPush;
|
||||
import com.chushang.inspection.work.dto.WrkIcbcJsReceive;
|
||||
import com.chushang.inspection.work.enums.BankBranchesEnum;
|
||||
import com.chushang.inspection.work.enums.WorkTypeOperation;
|
||||
|
|
@ -31,6 +46,7 @@ import com.chushang.inspection.work.vo.BankDispatchDTO;
|
|||
import com.chushang.security.entity.po.SysUser;
|
||||
import com.chushang.system.feign.RemoteUserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.chushang.inspection.work.mapper.WrkIcbcJsMapper;
|
||||
|
|
@ -61,6 +77,13 @@ public class WrkIcbcJsServiceImpl extends ServiceImpl<WrkIcbcJsMapper, WrkIcbcJs
|
|||
WrkInfoService wrkInfoService;
|
||||
@Resource
|
||||
WrkInfoDispatchService dispatchService;
|
||||
private static final String SIGN = "sign";
|
||||
|
||||
@Value("${push.icbc-js.url:''}")
|
||||
private String url;
|
||||
|
||||
@Value("${push.icbc-js.sign:''}")
|
||||
private String sign;
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -70,9 +93,7 @@ public class WrkIcbcJsServiceImpl extends ServiceImpl<WrkIcbcJsMapper, WrkIcbcJs
|
|||
JSONObject terJson = terminalService.save(store, dto);
|
||||
WrkIcbcJs wrkIcbcJs = save(dto, terJson, store);
|
||||
// 派单
|
||||
PoolUtils.SENTINEL.getInstance().execute(()->{
|
||||
dispatchOrder(wrkIcbcJs, terJson, store, null);
|
||||
});
|
||||
PoolUtils.SENTINEL.getInstance().execute(()-> dispatchOrder(wrkIcbcJs, terJson, store, null));
|
||||
}
|
||||
|
||||
private WrkIcbcJs save(WrkIcbcJsReceive dto, JSONObject terJson, Store store) {
|
||||
|
|
@ -88,26 +109,43 @@ public class WrkIcbcJsServiceImpl extends ServiceImpl<WrkIcbcJsMapper, WrkIcbcJs
|
|||
}
|
||||
|
||||
@Override
|
||||
@DataScope
|
||||
public PageResult queryDispatchPage(BankDispatchQuery query) {
|
||||
return null;
|
||||
CommonParam commonParam = CommonParam.buildPageRequest();
|
||||
LambdaQueryWrapper<WrkIcbcJs> sql = WrapperUtils.builder(query, commonParam);
|
||||
IPage<WrkIcbcJs> page = this.page(
|
||||
new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(commonParam.getPage(), commonParam.getLimit()),
|
||||
sql
|
||||
);
|
||||
return new PageResult(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BankDispatchDTO info(Long id) {
|
||||
return null;
|
||||
return BeanUtil.copyProperties(getById(id), BankDispatchDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(BankDispatchDTO dispatch) {
|
||||
|
||||
WrkIcbcJs entity = BeanUtil.copyProperties(dispatch, WrkIcbcJs.class);
|
||||
entity.setStatus(null);
|
||||
entity.setReqDate(null);
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispatchOrder(WrkIcbcJs entity, Long userId) {
|
||||
|
||||
Long id = entity.getId();
|
||||
WrkIcbcJs wrkIcbcJs = getById(id);
|
||||
AssertUtil.invalidate(ObjectUtil.isEmpty(wrkIcbcJs), "未找寻到对应银行工单");
|
||||
Store store = storeService.getById(wrkIcbcJs.getStoreId());
|
||||
AssertUtil.invalidate(ObjectUtil.isEmpty(store), "未找寻到对应商户信息");
|
||||
JSONObject terJson = terminalService.getTerMap(wrkIcbcJs.getTerminalId());
|
||||
dispatchOrder(entity, terJson, store, userId);
|
||||
}
|
||||
|
||||
public void dispatchOrder(WrkIcbcJs entity, JSONObject terJson, Store store, Long userId) {
|
||||
public void dispatchOrder(WrkIcbcJs entity, JSONObject terJson, Store store, Long userId)
|
||||
{
|
||||
Terminal terminal = terJson.getObject("terminal", Terminal.class);
|
||||
TerminalIns terminalIns = terJson.getObject("terminalIns", TerminalIns.class);
|
||||
WrkIcbcJs icbcJs = entity.getArea() != null ? entity : getById(entity.getId());
|
||||
|
|
@ -158,6 +196,35 @@ public class WrkIcbcJsServiceImpl extends ServiceImpl<WrkIcbcJsMapper, WrkIcbcJs
|
|||
|
||||
@Override
|
||||
public void manualPush(Long id) {
|
||||
WrkIcbcJs entity = getById(id);
|
||||
Assert.notNull(entity, "选择的数据不存在");
|
||||
Assert.isTrue(entity.getStatus().equals(4), "只有自动推送失败时才能手动推送");
|
||||
com.chushang.inspection.work.vo.Result result = sendHttp(BeanCopyUtils.copy(entity, WrkIcbcJsPush.class));
|
||||
if (result != null && result.getRespCode().equals("00")) {
|
||||
entity.setStatus(3);
|
||||
updateById(entity);
|
||||
} else {
|
||||
entity.setStatus(4);
|
||||
updateById(entity);
|
||||
Assert.isTrue(false, result != null ? result.getRespMssg() : "推送江苏工行数据失败");
|
||||
}
|
||||
}
|
||||
|
||||
private com.chushang.inspection.work.vo.Result sendHttp(WrkIcbcJsPush wrkIcbcJsPush) {
|
||||
HttpRequest request = HttpRequest.post(url);
|
||||
String parse = JSONObject.toJSONString(wrkIcbcJsPush);
|
||||
request.header(SIGN, SecureUtil.md5(parse + sign));
|
||||
request.body(parse, "application/json");
|
||||
request.timeout(3000);
|
||||
log.info("推送数据 :url【{}】header【{}】body【{}】", url, request.headers(), parse);
|
||||
try (HttpResponse response = request.execute()) {
|
||||
com.chushang.inspection.work.vo.Result result = JSONObject.parseObject(response.body(),
|
||||
com.chushang.inspection.work.vo.Result.class);
|
||||
log.info("江苏工行工单推送:【{}】,返回数据【{}】", parse, result);
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("解析回送数据失败", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ public class GenInsTest {
|
|||
wrkInfo.setUserName("admin");
|
||||
wrkInfo.setWorkNo(IdUtil.getSnowflakeNextId());
|
||||
wrkInfo.setWorkSort(1);
|
||||
// wrkInfo.setWrkId(1814239505998278658L);
|
||||
wrkInfoService.save(wrkInfo);
|
||||
|
||||
// generatedIns.generated();
|
||||
|
|
|
|||
Loading…
Reference in New Issue