Kaynağa Gözat

inss卡签续期指令接口调整

iaw卡签续期接口完成
master
huminghao 2 hafta önce
ebeveyn
işleme
5a13f88983
17 değiştirilmiş dosya ile 367 ekleme ve 284 silme
  1. 1
    2
      gly-base-core/src/main/java/cn/com/taiji/core/model/comm/protocol/inss/renewalInst/RenewalInstApplyRequest.java
  2. 1
    1
      gly-base-core/src/main/java/cn/com/taiji/core/model/comm/protocol/inss/renewalInst/RenewalInstApplyResponse.java
  3. 11
    10
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/api/ass/DeviceRenewalController.java
  4. 51
    0
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/CardAndObuRenewalRenewalRequestDTO.java
  5. 29
    0
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/CardAndObuRenewalRenewalResponseDTO.java
  6. 0
    26
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/CardRenewalRequestDTO.java
  7. 0
    27
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/CardRenewalResponseDTO.java
  8. 0
    26
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/ObuRenewalRequestDTO.java
  9. 0
    28
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/ObuRenewalResponseDTO.java
  10. 37
    0
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/ReadAndWriteRenewalInstRequestDTO.java
  11. 32
    0
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/ReadAndWriteRenewalInstResponseDTO.java
  12. 43
    5
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/RenewalConfirmRequestDTO.java
  13. 3
    3
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/manager/ass/DeviceRenewalManager.java
  14. 128
    154
      zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/manager/ass/DeviceRenewalManagerImpl.java
  15. 1
    2
      zhywpt-service-inss/src/main/java/cn/com/taiji/inss/manager/renewalInst/AbstractRenewalCallBackManager.java
  16. 3
    0
      zhywpt-service-inss/src/main/java/cn/com/taiji/inss/manager/renewalInst/RenewalInstOnlineActiveMananger.java
  17. 27
    0
      zhywpt-service-inss/src/main/java/cn/com/taiji/inss/manager/renewalInst/RenewalInstRandomReadHandler.java

+ 1
- 2
gly-base-core/src/main/java/cn/com/taiji/core/model/comm/protocol/inss/renewalInst/RenewalInstApplyRequest.java Dosyayı Görüntüle

@@ -17,9 +17,8 @@ public class RenewalInstApplyRequest extends AbstractSignTypeRequest<RenewalInst
super(RenewalInstServiceCmd.APPLY);
}

@NotBlank
private String cardId;//卡号
@NotBlank
private String obuId;//签号

public void relatedValid(ErrorMsgBuilder builder) {

+ 1
- 1
gly-base-core/src/main/java/cn/com/taiji/core/model/comm/protocol/inss/renewalInst/RenewalInstApplyResponse.java Dosyayı Görüntüle

@@ -13,7 +13,7 @@ public class RenewalInstApplyResponse extends AbstractSignTypeResponse {
private Integer stepNo;//步骤号
private String cmd;//指令
private String cmdType;//指令类型
private String transOrderId;//二发订单
private String transOrderId;//指令编


public RenewalInstApplyResponse() {

+ 11
- 10
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/api/ass/DeviceRenewalController.java Dosyayı Görüntüle

@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.io.IOException;

/**
* @Auther: humh
@@ -22,7 +23,7 @@ import javax.validation.Valid;
* @email: huminghao@mail.taiji.com.cn
* @version: 1.0
*/
@Api(tags = {"卡签续期"})
@Api(tags = {"卡签续期"})
@RestController
@RequestMapping("/api/renewal")
public class DeviceRenewalController extends MyValidController{
@@ -30,21 +31,21 @@ public class DeviceRenewalController extends MyValidController{
@Autowired
private DeviceRenewalManager manager;

@ApiOperation("卡续期")
@PostMapping("/cardRenewal")
public ApiResponse<CardRenewalResponseDTO> cardRenewal(@Valid @RequestBody CardRenewalRequestDTO dto) throws ManagerException {
return ApiResponse.of(manager.cardRenewal(dto)).setMessage("操作成功!");
@ApiOperation("卡续期")
@PostMapping("/cardAndObuRenewal")
public ApiResponse<CardAndObuRenewalRenewalResponseDTO> cardAndObuRenewal(@Valid @RequestBody CardAndObuRenewalRenewalRequestDTO dto) throws ManagerException {
return ApiResponse.of(manager.cardAndObuRenewal(dto)).setMessage("操作成功!");
}

@ApiOperation("签续期")
@PostMapping("/obuRenewal")
public ApiResponse<ObuRenewalResponseDTO> obuRenewal(@Valid @RequestBody ObuRenewalRequestDTO dto) throws ManagerException {
return ApiResponse.of(manager.obuRenewal(dto)).setMessage("操作成功!");
@ApiOperation(value = "获取读写指令")
@PostMapping("/readAndWriteRenewalInst")
public ApiResponse<ReadAndWriteRenewalInstResponseDTO> readAndWriteRenewalInst(@Valid @RequestBody ReadAndWriteRenewalInstRequestDTO dto) throws ManagerException{
return ApiResponse.of(manager.readAndWriteRenewalInst(dto)).setMessage("操作成功");
}


@ApiOperation(value = "卡签续期确认")
@PostMapping("/cardRenewal/confirm")
@PostMapping("/confirm")
public ApiResponse<RenewalConfirmResponseDTO> confirm(@Valid @RequestBody RenewalConfirmRequestDTO dto) throws ManagerException {
return ApiResponse.of(manager.confirm(dto)).setMessage("操作成功!");
}

+ 51
- 0
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/CardAndObuRenewalRenewalRequestDTO.java Dosyayı Görüntüle

@@ -0,0 +1,51 @@
package cn.com.taiji.iaw.dto.ass;

import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.valid.ViolationValidator;
import cn.com.taiji.core.dto.AbstractBizRequestDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import javax.validation.constraints.NotNull;

/**
* @Auther: humh
* @Description:
* @Date: 2025/6/25 21:26
* @email: huminghao@mail.taiji.com.cn
* @version: 1.0
*/
@Getter
@Setter
public class CardAndObuRenewalRenewalRequestDTO extends AbstractBizRequestDTO {


@ApiModelProperty(value = "续期类型,1-卡签续期,2-卡续期,3-签续期")
@NotNull(message = "续期类型不能为空")
private Integer renewalType;

@ApiModelProperty(value = "卡号")
private String cardId;

@ApiModelProperty(value = "签号")
private String obuId;


@Override
protected void validate(ViolationValidator validator) {
if (renewalType == 1){
validator.validFieldNotBlank("cardId", cardId);
validator.validFieldNotBlank("obuId", obuId);
}
if (renewalType == 2){
validator.validFieldNotBlank("cardId", cardId);
}
if (renewalType == 3){
validator.validFieldNotBlank("obuId", obuId);
}
}


}

+ 29
- 0
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/CardAndObuRenewalRenewalResponseDTO.java Dosyayı Görüntüle

@@ -0,0 +1,29 @@
package cn.com.taiji.iaw.dto.ass;

import cn.com.taiji.common.model.BaseModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;


/**
* @Auther: humh
* @Description:
* @Date: 2025/6/25 21:26
* @email: huminghao@mail.taiji.com.cn
* @version: 1.0
*/
@Getter
@Setter
public class CardAndObuRenewalRenewalResponseDTO extends BaseModel {

@ApiModelProperty(value = "下一步骤号")
private Integer stepNo;
@ApiModelProperty(value = "指令")
private String cmd;
@ApiModelProperty(value = "指令类型")
private String cmdType;
@ApiModelProperty(value = "指令编号")
private String transOrderId;

}

+ 0
- 26
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/CardRenewalRequestDTO.java Dosyayı Görüntüle

@@ -1,26 +0,0 @@
package cn.com.taiji.iaw.dto.ass;

import cn.com.taiji.core.dto.AbstractBizRequestDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;

/**
* @Auther: humh
* @Description:
* @Date: 2025/6/25 21:26
* @email: huminghao@mail.taiji.com.cn
* @version: 1.0
*/
@Getter
@Setter
public class CardRenewalRequestDTO extends AbstractBizRequestDTO {

@ApiModelProperty(value = "卡号")
@NotBlank
private String cardId;


}

+ 0
- 27
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/CardRenewalResponseDTO.java Dosyayı Görüntüle

@@ -1,27 +0,0 @@
package cn.com.taiji.iaw.dto.ass;

import cn.com.taiji.common.model.BaseModel;
import lombok.Getter;
import lombok.Setter;


/**
* @Auther: humh
* @Description:
* @Date: 2025/6/25 21:26
* @email: huminghao@mail.taiji.com.cn
* @version: 1.0
*/
@Getter
@Setter
public class CardRenewalResponseDTO extends BaseModel {

private String orderNo;

private String command;

public CardRenewalResponseDTO(String orderNo, String command){
this.orderNo = orderNo;
this.command = command;
}
}

+ 0
- 26
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/ObuRenewalRequestDTO.java Dosyayı Görüntüle

@@ -1,26 +0,0 @@
package cn.com.taiji.iaw.dto.ass;

import cn.com.taiji.core.dto.AbstractBizRequestDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;

/**
* @Auther: humh
* @Description:
* @Date: 2025/6/25 21:26
* @email: huminghao@mail.taiji.com.cn
* @version: 1.0
*/
@Getter
@Setter
public class ObuRenewalRequestDTO extends AbstractBizRequestDTO {

@ApiModelProperty(value = "签号")
@NotBlank
private String obuId;


}

+ 0
- 28
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/ObuRenewalResponseDTO.java Dosyayı Görüntüle

@@ -1,28 +0,0 @@
package cn.com.taiji.iaw.dto.ass;

import cn.com.taiji.common.model.BaseModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

/**
* @Auther: humh
* @Description:
* @Date: 2025/6/25 21:26
* @email: huminghao@mail.taiji.com.cn
* @version: 1.0
*/
@Getter
@Setter
public class ObuRenewalResponseDTO extends BaseModel {

@ApiModelProperty(value = "订单号")
private String orderNo;
@ApiModelProperty(value = "命令")
private String command;

public ObuRenewalResponseDTO(String orderNo, String command){
this.orderNo = orderNo;
this.command = command;
}
}

+ 37
- 0
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/ReadAndWriteRenewalInstRequestDTO.java Dosyayı Görüntüle

@@ -0,0 +1,37 @@
package cn.com.taiji.iaw.dto.ass;

import cn.com.taiji.core.dto.AbstractBizRequestDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
* @Auther: humh
* @Description:
* @Date: 2025/6/25 21:26
* @email: huminghao@mail.taiji.com.cn
* @version: 1.0
*/
@Getter
@Setter
public class ReadAndWriteRenewalInstRequestDTO extends AbstractBizRequestDTO {

@ApiModelProperty(value = "指令编号")
@NotBlank
private String transOrderId;
@ApiModelProperty(value = "指令")
@NotBlank
private String cmd;
@ApiModelProperty(value = "指令结果")
@NotBlank
private String cmdResult;
@ApiModelProperty(value = "步骤")
@NotNull
private Integer stepNo;



}

+ 32
- 0
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/ReadAndWriteRenewalInstResponseDTO.java Dosyayı Görüntüle

@@ -0,0 +1,32 @@
package cn.com.taiji.iaw.dto.ass;

import cn.com.taiji.common.model.BaseModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;


/**
* @Auther: humh
* @Description:
* @Date: 2025/6/25 21:26
* @email: huminghao@mail.taiji.com.cn
* @version: 1.0
*/
@Getter
@Setter
public class ReadAndWriteRenewalInstResponseDTO extends BaseModel {

@ApiModelProperty(value = "下一步骤号")
private Integer stepNo;

@ApiModelProperty(value = "指令")
private String cmd;

@ApiModelProperty(value = "指令类型")
private String cmdType;

@ApiModelProperty(value = "指令编号")
private String transOrderId;

}

+ 43
- 5
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/dto/ass/RenewalConfirmRequestDTO.java Dosyayı Görüntüle

@@ -1,12 +1,18 @@
package cn.com.taiji.iaw.dto.ass;

import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.valid.ViolationValidator;
import cn.com.taiji.core.dto.AbstractBizRequestDTO;
import cn.com.taiji.core.entity.dict.basic.ObuStatus;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

/**
* @Auther: humh
@@ -19,12 +25,44 @@ import javax.validation.constraints.NotBlank;
@Setter
public class RenewalConfirmRequestDTO extends AbstractBizRequestDTO {

@ApiModelProperty(value = "订单号")
@NotBlank
private String orderNo;
@ApiModelProperty(value = "续期指令步骤")
@NotNull(message = "续期指令步骤不能为空")
private Integer stepOrder;//

@ApiModelProperty(value = "结果")
private Boolean confirmResult;
@ApiModelProperty(value = "续期类型,1-卡签续期,2-卡续期,3-签续期")
@NotNull(message = "续期类型不能为空")
private Integer renewalType;

@ApiModelProperty(value = "卡号")
private String cardId;

@ApiModelProperty(value = "签号")
private String obuId;

@ApiModelProperty(value = "卡过期时间")
private LocalDateTime oldCardExpireTime;

@ApiModelProperty(value = "签过期时间")
private LocalDateTime oldObuExpireTime;

@Override
protected void validate(ViolationValidator validator) {
validator.validField("stepOrder", stepOrder != 100, "卡签续期指令步骤未结束");
if (renewalType == 1){
validator.validFieldNotBlank("cardId", cardId);
validator.validFieldNotBlank("obuId", obuId);
validator.validFieldNotNull("oldCardExpireTime", oldCardExpireTime);
validator.validFieldNotNull("oldObuExpireTime", oldObuExpireTime);
}
if (renewalType == 2){
validator.validFieldNotBlank("cardId", cardId);
validator.validFieldNotNull("oldCardExpireTime", oldCardExpireTime);
}
if (renewalType == 3){
validator.validFieldNotBlank("obuId", obuId);
validator.validFieldNotNull("oldObuExpireTime", oldObuExpireTime);
}
}


}

+ 3
- 3
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/manager/ass/DeviceRenewalManager.java Dosyayı Görüntüle

@@ -12,9 +12,9 @@ import cn.com.taiji.iaw.dto.ass.*;
*/
public interface DeviceRenewalManager {

CardRenewalResponseDTO cardRenewal(CardRenewalRequestDTO dto) throws ManagerException;

ObuRenewalResponseDTO obuRenewal(ObuRenewalRequestDTO dto) throws ManagerException;
CardAndObuRenewalRenewalResponseDTO cardAndObuRenewal(CardAndObuRenewalRenewalRequestDTO dto) throws ManagerException;

RenewalConfirmResponseDTO confirm(RenewalConfirmRequestDTO dto) throws ManagerException;

ReadAndWriteRenewalInstResponseDTO readAndWriteRenewalInst(ReadAndWriteRenewalInstRequestDTO dto) throws ManagerException;
}

+ 128
- 154
zhywpt-app-iaw/src/main/java/cn/com/taiji/iaw/manager/ass/DeviceRenewalManagerImpl.java Dosyayı Görüntüle

@@ -15,13 +15,14 @@ import cn.com.taiji.core.entity.dict.basic.CardStatus;
import cn.com.taiji.core.entity.dict.basic.ObuStatus;
import cn.com.taiji.core.entity.dict.basic.SourceType;
import cn.com.taiji.core.entity.dict.log.OperateType;
import cn.com.taiji.core.entity.dict.ygz.DataSourceEnum;
import cn.com.taiji.core.entity.dict.ygz.Operation;
import cn.com.taiji.core.entity.user.AccountInfo;
import cn.com.taiji.core.model.comm.COSConstant;
import cn.com.taiji.core.model.comm.protocol.ias.ygz.*;
import cn.com.taiji.core.model.comm.protocol.inss.renewalInst.RenewalInstApplyRequest;
import cn.com.taiji.core.model.comm.protocol.inss.renewalInst.RenewalInstApplyResponse;
import cn.com.taiji.core.model.comm.protocol.inss.renewalInst.RenewalInstCallBackRequest;
import cn.com.taiji.core.model.comm.protocol.inss.renewalInst.RenewalInstCallBackResponse;
import cn.com.taiji.core.repo.jpa.ass.AssDeviceRenewalRepo;
import cn.com.taiji.core.repo.jpa.ass.AssOrderinfoRepo;
import cn.com.taiji.core.repo.jpa.ass.AssRenewalCosRecordRepo;
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;
@@ -58,62 +59,83 @@ public class DeviceRenewalManagerImpl extends AbstractIawManager implements Devi

@Override
@Transactional(rollbackFor = Exception.class)
public CardRenewalResponseDTO cardRenewal(CardRenewalRequestDTO dto) throws ManagerException {
//卡续期校验
assOrderInfoCardValid(dto.getCardId());

QtkCardInfo cardInfo = cardInfoRepo.findByCardId(dto.getCardId());
//卡有效校验
cardValid(cardInfo);
//保存售后订单记录 卡续期订单
AssOrderinfo orderinfo = generateAssOrderInfo(dto, cardInfo, null, true);
//新增售后卡签续期信息
addAssDeviceRenewal(orderinfo, LocalDateTime.now(), true);
//保存操作记录
persistOperateLog(OperateType.CARD_RENEWAL, orderinfo.getId(), dto.getOrderSource(), findOpenIdByToken(dto.getAccessToken()), "卡续期!");
public CardAndObuRenewalRenewalResponseDTO cardAndObuRenewal(CardAndObuRenewalRenewalRequestDTO dto) throws ManagerException {
//参数校验
dto.validate();

QtkCardInfo cardInfo = null;
QtkObuInfo obuInfo = null;
if (!StringUtils.isEmpty(dto.getCardId()) && dto.getRenewalType() != 3){
cardInfo = cardInfoRepo.findByCardId(dto.getCardId());
}
if (!StringUtils.isEmpty(dto.getObuId()) && dto.getRenewalType() != 2){
obuInfo = obuInfoRepo.findByObuId(dto.getObuId());
}

return new CardRenewalResponseDTO(orderinfo.getOrderNo(), COSConstant.selectAndRead0015WithRandom);
//卡签校验
cardAndObuValid(dto.getRenewalType() ,cardInfo, obuInfo);

RenewalInstApplyRequest request = new RenewalInstApplyRequest();
request.setCardId(dto.getCardId());
request.setObuId(dto.getObuId());
RenewalInstApplyResponse response = null;
try {
response = jsonPostRepeat(request);
} catch (ManagerException e) {
logger.error("获取申请卡签续期指令异常信息:"+e.getMessage());
e.printStackTrace();
throw new ManagerException("获取申请卡签续期指令异常");
}
if (response == null) {
throw new ManagerException("未获取申请卡签续期指令");
}
//反白给前端
return copyProperties(response, new CardAndObuRenewalRenewalResponseDTO());
}

@Override
@Transactional(rollbackFor = Exception.class)
public ObuRenewalResponseDTO obuRenewal(ObuRenewalRequestDTO dto) throws ManagerException {
//签续期校验
assOrderInfoObuValid(dto.getObuId());

QtkObuInfo obuInfo = obuInfoRepo.findByObuId(dto.getObuId());
//签有效校验
obuValid(obuInfo);
//保存售后订单记录 卡续期订单
AssOrderinfo orderinfo = generateAssOrderInfo(dto, null, obuInfo, false);
//新增售后卡签续期信息
addAssDeviceRenewal(orderinfo, LocalDateTime.now(), false);
//保存操作记录
persistOperateLog(OperateType.OBU_RENEWAL, orderinfo.getId(), dto.getOrderSource(), findOpenIdByToken(dto.getAccessToken()), "签续期!");
@Override
public ReadAndWriteRenewalInstResponseDTO readAndWriteRenewalInst(ReadAndWriteRenewalInstRequestDTO dto) throws ManagerException {
RenewalInstCallBackRequest request = new RenewalInstCallBackRequest();
copyProperties(dto, request);
RenewalInstCallBackResponse response = null;
try {
response = jsonPostRepeat(request);
} catch (ManagerException e) {
logger.error("获取反馈卡签续期指令异常信息:"+e.getMessage());
e.printStackTrace();
throw new ManagerException("获取反馈卡签续期指令异常");
}
if (response == null) {
throw new ManagerException("未获取反馈卡签续期指令");
}

return new ObuRenewalResponseDTO(orderinfo.getOrderNo(), COSConstant.selectAndRead0015WithRandom);
return copyProperties(response, new ReadAndWriteRenewalInstResponseDTO());
}


@Override
@Transactional(rollbackFor = Exception.class)
public RenewalConfirmResponseDTO confirm(RenewalConfirmRequestDTO dto) throws ManagerException {
AssOrderinfo orderinfo = orderinfoRepo.findByOrderNo(dto.getOrderNo());
//校验
dto.validate();

if (dto.getConfirmResult()) {
orderinfo.setOrderStatus(AssOrderStatus.FINISHED);
orderinfo.setAuditStatus(AuditStatus.COMPLETE);
LocalDateTime now = LocalDateTime.now();
AssDeviceRenewal assDeviceRenewal = deviceRenewalRepo.findByOrderNo(dto.getOrderNo());
//更新卡签信息
updateCardOrObuInfo(orderinfo, now, assDeviceRenewal);
//卡签信息上传部中心
ygzCardBlackUpload(orderinfo,assDeviceRenewal);
} else {
orderinfo.setOrderStatus(AssOrderStatus.CLOSE);
orderinfo.setAuditStatus(AuditStatus.FAIL);
orderinfo.setAuditReason("命令执行失败");
orderinfo.setAuditFailureCase("命令执行失败");
QtkCardInfo cardInfo = null;
QtkObuInfo obuInfo = null;
if (!StringUtils.isEmpty(dto.getCardId()) && dto.getRenewalType() != 3){
cardInfo = cardInfoRepo.findByCardId(dto.getCardId());
}
if (!StringUtils.isEmpty(dto.getObuId()) && dto.getRenewalType() != 2){
obuInfo = obuInfoRepo.findByObuId(dto.getObuId());
}
//卡签校验
cardAndObuValid(dto.getRenewalType() ,cardInfo, obuInfo);

//生成售后订单
AssOrderinfo orderinfo = generateAssOrderInfo(dto, cardInfo, obuInfo);

addAssDeviceRenewal(dto, orderinfo, cardInfo, obuInfo);

orderinfo.setUpdateTime(LocalDateTime.now());
orderinfoRepo.save(orderinfo);

@@ -122,128 +144,84 @@ public class DeviceRenewalManagerImpl extends AbstractIawManager implements Devi
return new RenewalConfirmResponseDTO(orderinfo.getId());
}

private void ygzCardBlackUpload(AssOrderinfo orderinfo, AssDeviceRenewal assDeviceRenewal) throws ManagerException {
if (assDeviceRenewal.getRenewalType() == 2) {
QtkCardInfo cardInfo = cardInfoRepo.findByCardId(orderinfo.getCardId());
YgzCardUploadRequest uploadRequest = new YgzCardUploadRequest();
uploadRequest.setCard(cardInfo);
uploadRequest.setOperation(Operation.UPDATE);
uploadRequest.setDataSource(DataSourceEnum.DSI_INTERFACE);
try {
jsonPostRepeat(uploadRequest);
} catch (ManagerException e) {
logger.error("同步数据到部中心异常," + e.getMessage());
throw new ManagerException("同步数据到部中心异常," + e.getMessage());
}

} else if (assDeviceRenewal.getRenewalType() == 3) {
QtkObuInfo obuInfo = obuInfoRepo.findByObuId(orderinfo.getObuId());
YgzObuUploadRequest uploadRequest = new YgzObuUploadRequest();
uploadRequest.setObu(obuInfo);
uploadRequest.setOperation(Operation.UPDATE);
uploadRequest.setDataSource(DataSourceEnum.DSI_INTERFACE);
try {
jsonPostRepeat(uploadRequest);
} catch (ManagerException e) {
logger.error("同步数据到部中心异常," + e.getMessage());
throw new ManagerException("同步数据到部中心异常," + e.getMessage());
}

} else {
throw new ManagerException("订单类型异常!");
}
}

private void updateCardOrObuInfo(AssOrderinfo orderinfo, LocalDateTime now, AssDeviceRenewal assDeviceRenewal) throws ManagerException {
if (assDeviceRenewal.getRenewalType() == 2) {
QtkCardInfo cardInfo = cardInfoRepo.findByCardId(orderinfo.getCardId());
cardInfo.setCardExpireTime(now.plusYears(10));
cardInfo.setUpdateTime(now);
cardInfoRepo.merge(cardInfo);
} else if (assDeviceRenewal.getRenewalType() == 3) {
QtkObuInfo obuInfo = obuInfoRepo.findByObuId(orderinfo.getObuId());
obuInfo.setObuExpireTime(now.plusYears(10));
obuInfo.setUpdateTime(now);
obuInfoRepo.merge(obuInfo);
} else {
throw new ManagerException("订单类型异常!");
}

}


private void addAssDeviceRenewal(AssOrderinfo orderinfo, LocalDateTime now, Boolean isCard) throws ManagerException {
private void addAssDeviceRenewal(RenewalConfirmRequestDTO dto, AssOrderinfo orderinfo, QtkCardInfo cardInfo, QtkObuInfo obuInfo) throws ManagerException {
AssDeviceRenewal deviceRenewal = copyProperties(orderinfo, new AssDeviceRenewal(), "id", "insertTime");
if (isCard) {
QtkCardInfo cardInfo = cardInfoRepo.findByCardId(orderinfo.getCardId());
deviceRenewal.setRenewalType(2);
deviceRenewal.setCardExpireTime(now.plusYears(10));
deviceRenewal.setOldCardExpireTime(cardInfo.getCardExpireTime());
} else {
QtkObuInfo obuInfo = obuInfoRepo.findByObuId(orderinfo.getObuId());
deviceRenewal.setRenewalType(3);
deviceRenewal.setObuExpireTime(now.plusYears(10));
deviceRenewal.setOldObuExpireTime(obuInfo.getObuExpireTime());
deviceRenewal.setRenewalType(dto.getRenewalType());
if (cardInfo != null) {
deviceRenewal.setCardExpireTime(cardInfo.getCardExpireTime());
deviceRenewal.setOldCardExpireTime(dto.getOldCardExpireTime());
}
if (obuInfo != null){
deviceRenewal.setObuExpireTime(obuInfo.getObuExpireTime());
deviceRenewal.setOldObuExpireTime(dto.getOldObuExpireTime());
}
deviceRenewal.setVehiclePlate(orderinfo.getVehicleId().split("_")[0]);
deviceRenewal.setVehiclePlateColor(Integer.valueOf(orderinfo.getVehicleId().split("_")[1]));
deviceRenewal.setInsertTime(now);
deviceRenewal.setInsertTime(LocalDateTime.now());
deviceRenewalRepo.save(deviceRenewal);
}

private void obuValid(QtkObuInfo obuInfo) throws ManagerException {
//判断有效期时间
if (!obuInfo.getObuExpireTime().isAfter(LocalDateTime.now().minusYears(1))) {
throw new ManagerException("当前卡有效期为:" + obuInfo.getObuExpireTime() + ",有效期剩余1年内才可以续期!");
}
// 判断卡状态是否正常
if (!ObuStatus.ZC.equals(obuInfo.getObuStatus())) {
throw new ManagerException("该卡状态为:" + obuInfo.getObuStatus().getValue() + ",不能进行续期操作!");
}

}

private void assOrderInfoObuValid(String obuId) {
AssOrderinfo orderinfo = orderinfoRepo.findUnFinishOrderByCardId(obuId, AssOrderType.RENEWAL, AssOrderStatus.NORMAL);
if (orderinfo != null) {
orderinfo.setUpdateTime(LocalDateTime.now());
orderinfo.setOrderStatus(AssOrderStatus.CLOSE);
orderinfoRepo.merge(orderinfo);
private void cardAndObuValid(Integer renewalType, QtkCardInfo cardInfo, QtkObuInfo obuInfo) throws ManagerException {
if (renewalType == 1){
if (cardInfo == null || obuInfo == null){
throw new ManagerException("未获取到卡签信息");
}
}else if (renewalType == 2){
if (cardInfo == null){
throw new ManagerException("未获取到卡信息");
}
}else if (renewalType == 3){
if (obuInfo == null){
throw new ManagerException("未获取到签信息");
}
}else {
throw new ManagerException("续期类型错误");
}
}


private void cardValid(QtkCardInfo cardInfo) throws ManagerException {
//判断有效期时间
if (!cardInfo.getCardExpireTime().isAfter(LocalDateTime.now().minusYears(1))) {
throw new ManagerException("当前卡有效期为:" + cardInfo.getCardExpireTime() + ",有效期剩余1年内才可以续期!");
if (cardInfo != null){
if (!cardInfo.getCardExpireTime().isAfter(LocalDateTime.now().minusYears(1))) {
throw new ManagerException("当前卡有效期为:" + cardInfo.getCardExpireTime() + ",有效期剩余1年内才可以续期!");
}
// 判断卡状态是否正常
if (!CardStatus.ZC.equals(cardInfo.getCardStatus())) {
throw new ManagerException("该卡状态为:" + cardInfo.getCardStatus().getValue() + ",不能进行续期操作!");
}
}
// 判断卡状态是否正常
if (!CardStatus.ZC.equals(cardInfo.getCardStatus())) {
throw new ManagerException("该卡状态为:" + cardInfo.getCardStatus().getValue() + ",不能进行续期操作!");
if(obuInfo != null){
if (!obuInfo.getObuExpireTime().isAfter(LocalDateTime.now().minusYears(1))) {
throw new ManagerException("当前卡有效期为:" + obuInfo.getObuExpireTime() + ",有效期剩余1年内才可以续期!");
}
// 判断卡状态是否正常
if (!ObuStatus.ZC.equals(obuInfo.getObuStatus())) {
throw new ManagerException("该卡状态为:" + obuInfo.getObuStatus().getValue() + ",不能进行续期操作!");
}
}

}

private void assOrderInfoCardValid(String cardId) throws ManagerException {
AssOrderinfo orderinfo = orderinfoRepo.findUnFinishOrderByCardId(cardId, AssOrderType.RENEWAL, AssOrderStatus.NORMAL);
if (orderinfo != null) {
orderinfo.setUpdateTime(LocalDateTime.now());
orderinfo.setOrderStatus(AssOrderStatus.CLOSE);
orderinfoRepo.merge(orderinfo);
}
}


private AssOrderinfo generateAssOrderInfo(AbstractBizRequestDTO dto, QtkCardInfo cardInfo, QtkObuInfo obuInfo, boolean isCard) throws ServiceHandleException {
String customerId = isCard ? cardInfo.getCustomerId() : obuInfo.getCustomerId();
private AssOrderinfo generateAssOrderInfo(AbstractBizRequestDTO dto, QtkCardInfo cardInfo, QtkObuInfo obuInfo) throws ServiceHandleException {
LocalDateTime now = LocalDateTime.now();
AssOrderinfo orderinfo = new AssOrderinfo();

String customerId = "";
String vehicleId = "";
if (cardInfo != null){
orderinfo.setCardId(cardInfo.getCardId());
customerId = cardInfo.getCustomerId();
vehicleId =cardInfo.getVehicleId();
}else {
customerId = obuInfo.getCustomerId();
vehicleId = obuInfo.getVehicleId();
orderinfo.setObuId(obuInfo.getObuId());
}
orderinfo.setOrderNo(createOrderNo(findAgencyIdByToken(dto.getAccessToken())));
orderinfo.setOrderSource(dto.getOrderSource());
orderinfo.setOrderStatus(AssOrderStatus.NORMAL);
orderinfo.setOrderStatus(AssOrderStatus.FINISHED);
orderinfo.setAuditStatus(AuditStatus.COMPLETE);
orderinfo.setOrderType(AssOrderType.RENEWAL);
orderinfo.setAuditStatus(AuditStatus.AUDIT);
orderinfo.setChannelId(cardInfo.getChannelId());
orderinfo.setApplyTime(now);
String openId = findOpenIdByToken(dto.getAccessToken());
@@ -275,12 +253,8 @@ public class DeviceRenewalManagerImpl extends AbstractIawManager implements Devi
}
orderinfo.setInsertTime(now);
orderinfo.setUpdateTime(now);
orderinfo.setVehicleId(isCard ? cardInfo.getVehicleId() : obuInfo.getVehicleId());
if (isCard) {
orderinfo.setCardId(cardInfo.getCardId());
} else {
orderinfo.setObuId(obuInfo.getObuId());
}
orderinfo.setVehicleId(vehicleId);

orderinfoRepo.save(orderinfo);
return orderinfo;
}

+ 1
- 2
zhywpt-service-inss/src/main/java/cn/com/taiji/inss/manager/renewalInst/AbstractRenewalCallBackManager.java Dosyayı Görüntüle

@@ -21,7 +21,6 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;

import static cn.com.taiji.inss.manager.model.MyFinals.ASS_RENEWAL_KEY;
import static cn.com.taiji.inss.manager.model.MyFinals.ISSUE_KEY;
import static cn.com.taiji.inss.manager.model.inst.InstConstant.CMD_SUCCESS;


@@ -79,7 +78,7 @@ public abstract class AbstractRenewalCallBackManager extends AbstractCommManager
}

private void writeCache(RenewalInstVO vo) {
redisWrapManager.set(ISSUE_KEY + vo.getTransOrderId(), vo.toJson(), 3000000, TimeUnit.SECONDS);
redisWrapManager.set(ASS_RENEWAL_KEY + vo.getTransOrderId(), vo.toJson(), 3000000, TimeUnit.SECONDS);
}

private void valid(RenewalInstCallBackRequest request, RenewalInstVO vo) throws ServiceHandleException {

+ 3
- 0
zhywpt-service-inss/src/main/java/cn/com/taiji/inss/manager/renewalInst/RenewalInstOnlineActiveMananger.java Dosyayı Görüntüle

@@ -39,6 +39,8 @@ public class RenewalInstOnlineActiveMananger extends AbstractRenewalCallBackMana
@Autowired
private RenewalInstObuSystemInfoWriteHandler renewalInstObuSystemInfoWriteHandler;
@Autowired
private RenewalInstRandomReadHandler renewalInstRandomReadHandler;
@Autowired
private QtkCardInfoRepo cardInfoRepo;
@Autowired
private QtkObuInfoRepo obuInfoRepo;
@@ -49,6 +51,7 @@ public class RenewalInstOnlineActiveMananger extends AbstractRenewalCallBackMana
cmdHandlers.put(2, renewalInstCard0015WriteHandler);
cmdHandlers.put(3, renewalInstObuSystemInfoReadHandler);
cmdHandlers.put(4, renewalInstObuSystemInfoWriteHandler);
cmdHandlers.put(5, renewalInstRandomReadHandler);
}

@Override

+ 27
- 0
zhywpt-service-inss/src/main/java/cn/com/taiji/inss/manager/renewalInst/RenewalInstRandomReadHandler.java Dosyayı Görüntüle

@@ -0,0 +1,27 @@
package cn.com.taiji.inss.manager.renewalInst;

import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import cn.com.taiji.core.entity.ass.AssRenewalCosRecord;
import cn.com.taiji.core.model.comm.COSConstant;
import cn.com.taiji.inss.manager.model.renewalInst.RenewalInstVO;
import org.springframework.stereotype.Service;

@Service
public class RenewalInstRandomReadHandler extends AbstractRenewalCommandHandler {
@Override
RenewalInstVO handleInternal(RenewalInstVO vo, String cmdResultsStr) throws ServiceHandleException {
return vo;
}

@Override
String createCos(RenewalInstVO vo) throws ServiceHandleException {
return COSConstant.HOME_DIRECTORY;
}

@Override
void updateCosRecordInternal(AssRenewalCosRecord cosRecord, RenewalInstVO vo) {

}

}

Loading…
İptal
Kaydet