private LocalDateTime returnTime;//返回扣款结果时间 | private LocalDateTime returnTime;//返回扣款结果时间 | ||||
@Column(name="return_handle_date") | @Column(name="return_handle_date") | ||||
private String returnHandleDate;//回盘处理日期 | private String returnHandleDate;//回盘处理日期 | ||||
@Column(name="under_take") | |||||
private boolean underTake = false;//是否渠道兜底 | |||||
@Column(name="after_pay") | |||||
private boolean afterPay = false;//是否补缴 | |||||
@Column(name="repeat_trade") | |||||
private boolean repeatTrade = false;//是否重复交易 | |||||
} | } |
PUSH("已推送", 2), | PUSH("已推送", 2), | ||||
SUCCESS("成功", 3), | SUCCESS("成功", 3), | ||||
FAILED("失败", 4), | FAILED("失败", 4), | ||||
UNDERTAKE("渠道兜底", 5), | |||||
AFTERPAY("补缴", 6), | |||||
REPEAT("重复交易",7), | |||||
; | ; | ||||
private final String value; | private final String value; | ||||
/** | |||||
* @Title DaspUserInfo.java | |||||
* @Package cn.com.taiji.dasp_channel.entity | |||||
* @Description TODO | |||||
* @author yaonanlin | |||||
* @date 2019年6月19日 下午8:41:42 | |||||
* @version V1.0 | |||||
*/ | |||||
package cn.com.taiji.core.entity.ygz; | |||||
import cn.com.taiji.core.entity.AbstractStringPropertyUUIDEntity; | |||||
import cn.com.taiji.core.entity.dict.ygz.NioTransferType; | |||||
import cn.com.taiji.core.entity.dict.ygz.OfflineSendType; | |||||
import cn.com.taiji.core.entity.dict.ygz.Operation; | |||||
import lombok.Getter; | |||||
import lombok.Setter; | |||||
import lombok.experimental.Accessors; | |||||
import javax.persistence.*; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* 老监管用户信息上传表 | |||||
*/ | |||||
@Getter | |||||
@Setter | |||||
@Accessors(chain = true) | |||||
@Entity | |||||
@Table(name = "DASP_YGZ_HAS_SEND") | |||||
public class DaspYgzHasSend extends AbstractStringPropertyUUIDEntity { | |||||
@Column(name = "YGZ_SENDRESULT") | |||||
private String ygzSendResult;// 发送结果 成功 失败 | |||||
@Column(name = "YGZ_SENDTIME") | |||||
private LocalDateTime ygzSendTime; | |||||
@Column(name = "CREATE_TIME", updatable = false) | |||||
private LocalDateTime createTime = LocalDateTime.now(); | |||||
@Column(name = "UPDATE_TIME") | |||||
private LocalDateTime updateTime; | |||||
@Enumerated(EnumType.STRING) | |||||
@Column(name = "YGZ_OPERATION") | |||||
private Operation ygzOperation; | |||||
@Enumerated(EnumType.STRING) | |||||
@Column(name = "YGZ_SEND_TYPE") | |||||
private NioTransferType ygzSendType; | |||||
@Column(name = "YGZ_REQUEST_STR") | |||||
private String ygzRequestStr;// 营改增请求信息 | |||||
@Column(name = "CURRENT_SEND_STATUS") | |||||
private Integer currentSendStatus;// 当前发送状态 0-待发 1-已发 | |||||
@Column(name = "IS_SUCCESS") | |||||
private Boolean success; | |||||
@Column(name = "SEND_TIMES") | |||||
private int sendTimes = 0; | |||||
} |
@Query(" from FundsDetail where fundsStatus = ?1") | @Query(" from FundsDetail where fundsStatus = ?1") | ||||
List<FundsDetail> listBy(FundsStatus fundsStatus); | List<FundsDetail> listBy(FundsStatus fundsStatus); | ||||
@Query(" from FundsDetail where fundsStatus = ?1 and underTake=false and afterPay=false and repeatTrade=false") | |||||
List<FundsDetail> listByStatusWithoutSpecial(FundsStatus fundsStatus); | |||||
@Query(" from FundsDetail where returnHandleDate = ?1") | @Query(" from FundsDetail where returnHandleDate = ?1") | ||||
List<FundsDetail> listBy(String returnHandleDate); | List<FundsDetail> listBy(String returnHandleDate); | ||||
package cn.com.taiji.core.repo.jpa.ygz; | |||||
import cn.com.taiji.common.repo.jpa.AbstractJpaRepo; | |||||
import cn.com.taiji.core.entity.dict.ygz.NioTransferType; | |||||
import cn.com.taiji.core.entity.dict.ygz.OfflineSendType; | |||||
import cn.com.taiji.core.entity.dict.ygz.Operation; | |||||
import cn.com.taiji.core.entity.ygz.DaspOfflineHasSend; | |||||
import cn.com.taiji.core.entity.ygz.DaspYgzHasSend; | |||||
import org.springframework.data.jpa.repository.Modifying; | |||||
import org.springframework.data.jpa.repository.Query; | |||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
public interface DaspYgzHasSendRepo extends AbstractJpaRepo<DaspYgzHasSend, String> { | |||||
List<DaspYgzHasSend> findBySuccessAndYgzSendType(Boolean success, NioTransferType ygzSendType); | |||||
@Query(" from DaspYgzHasSend where id=?1 and ygzSendType=?2 ") | |||||
DaspYgzHasSend findBy(String id, NioTransferType sendType); | |||||
} |
//重复交易处理 | //重复交易处理 | ||||
//FIXME 是否需要考虑listNo不一致,但是出入口一致,金额时间一致的重复交易,还是此类情形让ETC用户走客服退费 | //FIXME 是否需要考虑listNo不一致,但是出入口一致,金额时间一致的重复交易,还是此类情形让ETC用户走客服退费 | ||||
handleRepeat(detail); | handleRepeat(detail); | ||||
if (detail.getFundsStatus() == REPEAT) return detail; | |||||
if (detail.isRepeatTrade()) return detail; | |||||
String plateColor = cardInfo.getVehicleId().split("_")[1]; | String plateColor = cardInfo.getVehicleId().split("_")[1]; | ||||
if (config.getChannelPayType() == ChannelPayType.WECHAT && plateColor.equals("1")) {//黄牌车走微信V3请款接口 | if (config.getChannelPayType() == ChannelPayType.WECHAT && plateColor.equals("1")) {//黄牌车走微信V3请款接口 | ||||
return handleWechatV3(detail, cardInfo); | return handleWechatV3(detail, cardInfo); | ||||
switch (oldDetail.getFundsStatus()) { | switch (oldDetail.getFundsStatus()) { | ||||
case PUSH://已推送 | case PUSH://已推送 | ||||
case SUCCESS://扣款成功 | case SUCCESS://扣款成功 | ||||
case AFTERPAY://补缴 | |||||
case UNDERTAKE: //兜底 | |||||
detail.setFundsStatus(REPEAT); | |||||
detail.setRepeatTrade(true); | |||||
detail.setFundsStatus(FAILED); | |||||
detail.setFundsResult("重复交易,重复推送流水id:" + oldDetail.getId()); | detail.setFundsResult("重复交易,重复推送流水id:" + oldDetail.getId()); | ||||
detail.setReturnHandleDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); | detail.setReturnHandleDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); | ||||
fundsDetailRepo.save(detail); | fundsDetailRepo.save(detail); | ||||
break; | break; | ||||
case NEW://待推送 | case NEW://待推送 | ||||
oldDetail.setFundsStatus(REPEAT); | |||||
oldDetail.setRepeatTrade(true); | |||||
oldDetail.setFundsResult("重复交易,重复推送流水id:" + detail.getId()); | oldDetail.setFundsResult("重复交易,重复推送流水id:" + detail.getId()); | ||||
oldDetail.setReturnHandleDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); | oldDetail.setReturnHandleDate(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); | ||||
fundsDetailRepo.save(oldDetail); | fundsDetailRepo.save(oldDetail); | ||||
break; | break; | ||||
case FAILED://扣款失败 | case FAILED://扣款失败 | ||||
oldDetail.setFundsStatus(REPEAT); | |||||
oldDetail.setRepeatTrade(true); | |||||
oldDetail.setFundsResult("重复交易,重复推送流水id:" + detail.getId()); | oldDetail.setFundsResult("重复交易,重复推送流水id:" + detail.getId()); | ||||
fundsDetailRepo.save(oldDetail); | fundsDetailRepo.save(oldDetail); | ||||
break; | break; |
private FundsPushManager fundsPushManager; | private FundsPushManager fundsPushManager; | ||||
public void handle() { | public void handle() { | ||||
List<FundsDetail> failedDetailList = fundsDetailRepo.listBy(FAILED); | |||||
List<FundsDetail> failedDetailList = fundsDetailRepo.listByStatusWithoutSpecial(FAILED); | |||||
fundsPushManager.pushData(failedDetailList); | fundsPushManager.pushData(failedDetailList); | ||||
} | } | ||||
} | } |
package cn.com.taiji.oqs.client; | |||||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||||
import cn.com.taiji.common.pub.FileCopyTools; | |||||
import cn.com.taiji.common.pub.json.JsonTools; | |||||
import cn.com.taiji.core.entity.dict.ygz.DataSourceEnum; | |||||
import cn.com.taiji.core.entity.dict.ygz.Operation; | |||||
import cn.com.taiji.core.entity.issue.IssueOrderinfo; | |||||
import cn.com.taiji.core.manager.tools.encryption.SM4Util; | |||||
import cn.com.taiji.core.model.comm.protocol.ias.brz.BrzUserAccountModel; | |||||
import cn.com.taiji.core.model.comm.protocol.ias.ygz.YgzVehicleUploadRequest; | |||||
import cn.com.taiji.core.repo.jpa.basic.QtkCardInfoRepo; | |||||
import cn.com.taiji.core.repo.jpa.basic.QtkCustomerInfoRepo; | |||||
import cn.com.taiji.core.repo.jpa.basic.QtkObuInfoRepo; | |||||
import cn.com.taiji.core.repo.jpa.basic.QtkVehicleInfoRepo; | |||||
import cn.com.taiji.core.repo.jpa.issue.IssueOrderinfoRepo; | |||||
import cn.com.taiji.inss.Application; | |||||
import cn.com.taiji.inss.manager.AbstractCommManager; | |||||
import org.apache.commons.compress.utils.Lists; | |||||
import org.junit.jupiter.api.Test; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.beans.factory.annotation.Qualifier; | |||||
import org.springframework.boot.test.context.SpringBootTest; | |||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |||||
import java.io.File; | |||||
import java.io.IOException; | |||||
import java.util.List; | |||||
@SpringBootTest(classes = Application.class) | |||||
public class TestHandleDataManager extends AbstractCommManager { | |||||
@Autowired | |||||
private QtkCustomerInfoRepo customerInfoRepo; | |||||
@Autowired | |||||
private QtkVehicleInfoRepo vehicleInfoRepo; | |||||
@Autowired | |||||
private QtkCardInfoRepo cardInfoRepo; | |||||
@Autowired | |||||
private QtkObuInfoRepo obuInfoRepo; | |||||
@Autowired | |||||
private IssueOrderinfoRepo orderinfoRepo; | |||||
@Qualifier("myExecutor") | |||||
@Autowired | |||||
private ThreadPoolTaskExecutor executor; | |||||
@Test | |||||
public void handleYgzData() throws InterruptedException { | |||||
List<String> orderNos = Lists.newArrayList(); | |||||
for (String orderNo : orderNos) { | |||||
IssueOrderinfo orderinfo = orderinfoRepo.findByOrderNo(orderNo); | |||||
// YgzUserUploadRequest userRequest = new YgzUserUploadRequest(); | |||||
// userRequest.setCustomer(customerInfoRepo.findByCustomerId(orderinfo.getCustomerId())); | |||||
// userRequest.setDataSource(DataSourceEnum.DSI_INTERFACE); | |||||
// userRequest.setOperation(Operation.UPDATE); | |||||
// userRequest.setStatusChangeTime(LocalDateTime.now()); | |||||
// executor.execute(() -> { | |||||
// try { | |||||
// logger.info(userRequest.toJson()); | |||||
// jsonPostRepeat(userRequest); | |||||
// } catch (ServiceHandleException e) { | |||||
// throw new RuntimeException(e); | |||||
// } | |||||
// }); | |||||
YgzVehicleUploadRequest vehicleRequest = new YgzVehicleUploadRequest(); | |||||
vehicleRequest.setVehicle(vehicleInfoRepo.findByVehicleId(orderinfo.getVehicleId())); | |||||
vehicleRequest.setDataSource(DataSourceEnum.DSI_INTERFACE); | |||||
vehicleRequest.setOperation(Operation.ADD); | |||||
executor.execute(() -> { | |||||
try { | |||||
logger.info(vehicleRequest.toJson()); | |||||
jsonPostRepeat(vehicleRequest); | |||||
} catch (ServiceHandleException e) { | |||||
throw new RuntimeException(e); | |||||
} | |||||
}); | |||||
// YgzCardUploadRequest cardRequest = new YgzCardUploadRequest(); | |||||
// cardRequest.setCard(cardInfoRepo.findByCardId(orderinfo.getCardId())); | |||||
// cardRequest.setDataSource(DataSourceEnum.DSI_INTERFACE); | |||||
// cardRequest.setOperation(Operation.ADD); | |||||
// jsonPostRepeat(cardRequest); | |||||
// YgzObuUploadRequest obuRequest = new YgzObuUploadRequest(); | |||||
// obuRequest.setObu(obuInfoRepo.findByObuId(orderinfo.getObuId())); | |||||
// obuRequest.setDataSource(DataSourceEnum.DSI_INTERFACE); | |||||
// obuRequest.setOperation(Operation.ADD); | |||||
// jsonPostRepeat(obuRequest); | |||||
} | |||||
Thread.sleep(1000 * 60 * 5); | |||||
} | |||||
public static void main(String[] args) throws IOException { | |||||
File file = new File("C:\\Users\\liang\\Desktop\\新文件6.csv"); | |||||
List<String> lines = FileCopyTools.copyToLines(file, "utf-8"); | |||||
for (String line : lines) { | |||||
String result = SM4Util.decrypt(line); | |||||
try { | |||||
BrzUserAccountModel model = JsonTools.json2Object("{\"name\":\"" + result + "\"}", BrzUserAccountModel.class); | |||||
} catch (Exception e) { | |||||
System.out.println(result + "---" + line); | |||||
} | |||||
} | |||||
} | |||||
} |