@@ -54,6 +54,10 @@ public class AssReimburseOrder extends StringPropertyUUIDEntity { | |||
@Column(name = "VEHICLE_PLATECOLOR") | |||
private Integer vehiclePlateColor;//车牌颜色; | |||
@NotBlank | |||
@Size(max = 20) | |||
@Column(name = "CARD_ID") | |||
private String cardId; | |||
@NotBlank | |||
@Column(name = "INFO") | |||
private String info;//补缴原因 | |||
@NotNull | |||
@@ -67,7 +71,8 @@ public class AssReimburseOrder extends StringPropertyUUIDEntity { | |||
private Integer payee;// 收款方 1-黔通 2-渠道 | |||
/**审核相关*/ | |||
@NotNull | |||
@Column(name = "APPEAL_REASON") | |||
private String appealReason;// 申诉原因 | |||
@Column(name = "STATUS") | |||
@Enumerated(EnumType.STRING) | |||
private AuditStatus status;//审核状态 |
@@ -30,7 +30,7 @@ public class AssReimburseOrderTrans extends StringPropertyUUIDEntity { | |||
private String orderNo;//订单编号 | |||
@NotNull | |||
@Column(name = "FEE") | |||
private Long fee;//补缴金额 | |||
private Long fee;//流水金额 | |||
@NotBlank | |||
@Column(name = "VEHICLE_ID") | |||
private String vehicleId; |
@@ -126,6 +126,9 @@ public class DeviceCancelApplyRequest extends AbstractSignTypeRequest<CommDevice | |||
//退费金额 | |||
private Integer refundFee; | |||
//能否连接设备 | |||
private Boolean hasDevice; | |||
public void relatedValid(ErrorMsgBuilder builder) { | |||
if (SourceType.CHANNEL.equals(orderSource)) { | |||
builder.validFieldNotBlank("vehiclePlate", vehiclePlate); |
@@ -18,4 +18,6 @@ public class DeviceCancelInstApplyRequest extends AbstractSignTypeRequest<Device | |||
private String obuId;//签号 | |||
private String cancelOrRestore;//注销/恢复 1-注销 2-恢复 | |||
} |
@@ -8,7 +8,7 @@ import cn.com.taiji.core.entity.ass.AssReimburseOrder; | |||
public interface AssReimburseOrderRepo extends AbstractJpaRepo<AssReimburseOrder, String> { | |||
//根据订单号查询 | |||
@Query(" from AssReimburseOrder where reimburseOrderId=?1") | |||
public AssReimburseOrder findByReimburseOrderId(String reimburseOrderId); | |||
@Query(" from AssReimburseOrder where orderNo=?1") | |||
public AssReimburseOrder findByOrderNo(String orderNo); | |||
} |
@@ -0,0 +1,11 @@ | |||
package cn.com.taiji.core.repo.jpa.ass; | |||
import cn.com.taiji.core.entity.ass.AssReimburseOrderTrans; | |||
import org.springframework.data.jpa.repository.Query; | |||
import cn.com.taiji.common.repo.jpa.AbstractJpaRepo; | |||
import cn.com.taiji.core.entity.ass.AssReimburseOrder; | |||
public interface AssReimburseOrderTransRepo extends AbstractJpaRepo<AssReimburseOrderTrans, String> { | |||
} |
@@ -1,10 +1,11 @@ | |||
package cn.com.taiji.core.repo.request.ass; | |||
import java.util.List; | |||
import cn.com.taiji.common.pub.dao.HqlBuilder; | |||
import cn.com.taiji.common.repo.request.jpa.JpaDateTimePageableDataRequest; | |||
import cn.com.taiji.core.entity.ass.AssReimburseOrder; | |||
import cn.com.taiji.core.entity.dict.AuditStatus; | |||
import cn.com.taiji.core.entity.dict.basic.SourceType; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
@@ -12,15 +13,21 @@ import lombok.Setter; | |||
@Setter | |||
public class AssReimburseOrderPageRequest extends JpaDateTimePageableDataRequest<AssReimburseOrder> { | |||
private String reimburseOrderId; // 订单id | |||
private SourceType sourceType;//来源 | |||
private String operateStaffId;// 录入员工工号 | |||
private String customerId;//用户编号 | |||
private String cardId;//卡号 | |||
private String orderNo;//订单编号 | |||
// private SourceType orderSource;//订单来源 | |||
private List<String> agencyIds;//订单渠道编号 | |||
private String staffOpenId;//业务员openid | |||
private String customerId;//客户openID | |||
private String vehicleId; | |||
private String agencyIds; | |||
private String payOrderNo;//支付订单编号 自己规则生成 商户订单号 | |||
private AuditStatus status;//审核状态 | |||
private String vehiclePlate;//车牌号; | |||
private Integer vehiclePlateColor;//车牌颜色; | |||
private String cardId;//卡id; | |||
private Integer payee; | |||
private boolean isObjections;//是否申诉 | |||
private AuditStatus status; | |||
public AssReimburseOrderPageRequest() { | |||
this.orderBy="updateTime"; | |||
@@ -30,14 +37,13 @@ public class AssReimburseOrderPageRequest extends JpaDateTimePageableDataRequest | |||
@Override | |||
public HqlBuilder toSelectHql() { | |||
HqlBuilder hql = new HqlBuilder("from AssReimburseOrder where 1=1 "); | |||
hql.append(" and reimburseOrderId = :reimburseOrderId", reimburseOrderId); | |||
hql.append(" and sourceType = :sourceType", sourceType); | |||
hql.append(" and operateStaffId = :operateStaffId", operateStaffId); | |||
hql.append(" and customerId = :customerId", customerId); | |||
hql.append(" and cardId = :cardId", cardId); | |||
hql.append(" and vehicleId = :vehicleId", vehicleId); | |||
hql.append(" and orderNo = :orderNo", orderNo); | |||
// hql.append(" and orderSource = :orderSource", orderSource); | |||
hql.append(" and agencyId in (:agencyIds)", agencyIds); | |||
hql.append(" and payOrderNo = :payOrderNo", payOrderNo); | |||
hql.append(" and staffOpenId = :staffOpenId", staffOpenId); | |||
hql.append(" and vehicleId = :vehicleId", vehicleId); | |||
hql.append(" and vehiclePlate = :vehiclePlate", vehiclePlate); | |||
hql.append(" and vehiclePlateColor = :vehiclePlateColor", vehiclePlateColor); | |||
hql.append(" and status = :status", status); | |||
return hql; | |||
} |
@@ -3,13 +3,14 @@ package cn.com.taiji.iaw.api.ass; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.web.ApiResponse; | |||
import cn.com.taiji.iaw.api.MyValidController; | |||
import cn.com.taiji.iaw.dto.ass.signChange.SignChangeApplyReqDTO; | |||
import cn.com.taiji.iaw.dto.ass.signChange.SignChangeApplyResDTO; | |||
import cn.com.taiji.iaw.dto.ass.signChange.SignChangeCollectReqDTO; | |||
import cn.com.taiji.iaw.dto.CommRequestDTO; | |||
import cn.com.taiji.iaw.dto.ass.releasePlate.ReleasePlateListResponDTO; | |||
import cn.com.taiji.iaw.dto.ass.signChange.*; | |||
import cn.com.taiji.iaw.manager.ass.SignChangeManager; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.PostMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
@@ -43,6 +44,30 @@ public class SignChangeController extends MyValidController { | |||
return ApiResponse.success(); | |||
} | |||
//用户查询、列表 | |||
@ApiOperation("签约变更列表-小程序") | |||
@PostMapping("/list") | |||
public ApiResponse<ReleasePlateListResponDTO> list(@Validated @RequestBody CommRequestDTO req) throws ManagerException { | |||
ReleasePlateListResponDTO responDTO = manager.list(req); | |||
return ApiResponse.of(responDTO); | |||
} | |||
//用户查询、列表 | |||
@ApiOperation("订单详情-小程序") | |||
@PostMapping("/view") | |||
public ApiResponse<SignChangeDetailResDTO> view(@Validated @RequestBody SignChangeDetailReqDTO req) throws ManagerException { | |||
SignChangeDetailResDTO responDTO = manager.view(req); | |||
return ApiResponse.of(responDTO); | |||
} | |||
// //用户查询、列表 | |||
// @ApiOperation("订单详情-APP") | |||
// @PostMapping("/beforeReview") | |||
// public ApiResponse<ReleasePlateListResponDTO> beforeReview(@Validated @RequestBody CommRequestDTO req) throws ManagerException { | |||
// ReleasePlateListResponDTO responDTO = manager.beforeReview(req); | |||
// return ApiResponse.of(responDTO); | |||
// } | |||
//售后统一接口 todo | |||
} |
@@ -129,6 +129,10 @@ public class DeviceCancelApplyRequestDTO extends AbstractBizRequestDTO { | |||
@ApiModelProperty(value = "注销原因") | |||
private String reason; | |||
//能否连接设备 | |||
@ApiModelProperty(value = "能否连接设备") | |||
@NotNull(message = "能否连接设备不能为空") | |||
private Boolean hasDevice; | |||
@Override | |||
public void validate(ViolationValidator validator) { | |||
if(CardType.STORED_VALUE_CARD.equals(cardType)){ |
@@ -7,7 +7,6 @@ import lombok.Getter; | |||
import lombok.Setter; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.NotNull; | |||
@Getter | |||
@Setter | |||
@@ -19,4 +18,8 @@ public class DeviceCancelInstApplyRequestDTO extends AbstractBizRequestDTO { | |||
@ApiModelProperty(value = "签号") | |||
private String obuId; | |||
@ApiModelProperty(value = "注销/恢复 1-注销 2-恢复") | |||
@NotBlank | |||
private String cancelOrRestore; | |||
} |
@@ -0,0 +1,23 @@ | |||
package cn.com.taiji.iaw.dto.ass.signChange; | |||
import cn.com.taiji.core.dto.AbstractBizRequestDTO; | |||
import io.swagger.annotations.ApiModel; | |||
import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import javax.validation.constraints.NotBlank; | |||
/** | |||
* @Author:ChenChao | |||
* @Date:2025/9/22 11:43 | |||
* @Filename:SignChangeDetailReqDTO | |||
* @description: | |||
*/ | |||
@Data | |||
@ApiModel(description = "签约信息变更详情") | |||
public class SignChangeDetailReqDTO extends AbstractBizRequestDTO { | |||
@NotBlank | |||
@ApiModelProperty(value = "售后订单编号") | |||
private String orderNo; | |||
} |
@@ -0,0 +1,15 @@ | |||
package cn.com.taiji.iaw.dto.ass.signChange; | |||
import io.swagger.annotations.ApiModel; | |||
import lombok.Data; | |||
/** | |||
* @Author:ChenChao | |||
* @Date:2025/9/22 11:52 | |||
* @Filename:SignChangeDetailResDTO | |||
* @description: | |||
*/ | |||
@Data | |||
@ApiModel(description = "签约信息变更详情") | |||
public class SignChangeDetailResDTO { | |||
} |
@@ -57,7 +57,8 @@ public class AssOrderinfoManagerImpl extends AbstractIawManager implements AssOr | |||
public Pagination page(AssOrderinfoPageRequestDTO dto) throws ManagerException { | |||
AssOrderinfoPageRequest pageRequest = copyProperties(dto, new AssOrderinfoPageRequest()); | |||
Staff staff = staffRepo.findByOpenId(findOpenIdByToken(dto.getAccessToken())); | |||
if (!"MANAGER".equals(staff.getIdentityType()) || !MyFinals.QTZL_AGENCY_ID.equals(staff.getAgencyId())){ | |||
// if (!"MANAGER".equals(staff.getIdentityType()) || !MyFinals.QTZL_AGENCY_ID.equals(staff.getAgencyId())){ | |||
if (!MyFinals.QTZL_AGENCY_ID.equals(staff.getAgencyId())){ | |||
pageRequest.setAgencyId(staff.getAgencyId()); | |||
} | |||
return repo.page(pageRequest); | |||
@@ -88,6 +89,8 @@ public class AssOrderinfoManagerImpl extends AbstractIawManager implements AssOr | |||
List<String> releaseIds = issueProductPromotionRepo.findReleaseIds(LocalDateTime.now(), OrderType.AFTERSALE); | |||
ProductPageRequest request = new ProductPageRequest(); | |||
request.setNeedPay(true); | |||
if (isEmpty(releaseIds)) | |||
return null; | |||
request.setReleaseIdList(releaseIds); | |||
return issueProductRepo.page(request); | |||
} |
@@ -1,7 +1,6 @@ | |||
package cn.com.taiji.iaw.manager.ass; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.core.dto.AbstractBizRequestDTO; | |||
import cn.com.taiji.core.entity.ass.AssOrderinfo; | |||
import cn.com.taiji.core.entity.basic.QtkCardInfo; | |||
@@ -83,7 +82,7 @@ public class DeviceCancelManagerImpl extends AbstractIawManager implements Devic | |||
public DeviceCancelQueryResponseDTO query(DeviceCancelQueryRequestDTO request) throws ManagerException { | |||
QtkVehicleInfo vehicle = Optional.ofNullable(vehicleInfoRepo.findByVehicleId(request.getVehicleId())) | |||
.orElseThrow(() -> new ManagerException("车辆信息不存在")); | |||
QtkCustomerInfo customer = Optional.ofNullable(customerInfoRepo.findByCustomerId(request.getCustomerId())) | |||
QtkCustomerInfo customer = Optional.ofNullable(customerInfoRepo.findByCustomerId(vehicle.getCustomerId())) | |||
.orElseThrow(() -> new ManagerException("客户信息不存在")); | |||
QtkCardInfo card = Optional.ofNullable(cardInfoRepo.findByCardId(request.getCardId())) | |||
.orElseThrow(() -> new ManagerException("卡信息不存在")); | |||
@@ -312,8 +311,8 @@ public class DeviceCancelManagerImpl extends AbstractIawManager implements Devic | |||
return copyProperties(response, new DeviceCancelInstResponseDTO()); | |||
} catch (Exception e) { | |||
logger.error("获取指令出错", e); | |||
saveLog(OperateType.DEVICE_CANCEL_APPLY_INST_APPLY, "-1", reqDto, "失败"); | |||
throw new ManagerException("获取指令出错,请重试"); | |||
saveLog(OperateType.DEVICE_CANCEL_APPLY_INST_APPLY, "-1", reqDto, "失败:" + e.getMessage()); | |||
throw new ManagerException(e.getMessage()); | |||
} | |||
} | |||
@@ -330,8 +329,8 @@ public class DeviceCancelManagerImpl extends AbstractIawManager implements Devic | |||
return copyProperties(response, new DeviceCancelInstResponseDTO()); | |||
} catch (Exception e) { | |||
logger.error("获取指令出错", e); | |||
saveLog(OperateType.DEVICE_CANCEL_APPLY_INST_CALLBACK, "-1", reqDto, "失败"); | |||
throw new ManagerException("获取指令出错,请重试"); | |||
saveLog(OperateType.DEVICE_CANCEL_APPLY_INST_CALLBACK, "-1", reqDto, "失败:" + e.getMessage()); | |||
throw new ManagerException(e.getMessage()); | |||
} | |||
} | |||
@@ -1,9 +1,10 @@ | |||
package cn.com.taiji.iaw.manager.ass; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.iaw.dto.ass.signChange.SignChangeApplyReqDTO; | |||
import cn.com.taiji.iaw.dto.ass.signChange.SignChangeApplyResDTO; | |||
import cn.com.taiji.iaw.dto.ass.signChange.SignChangeCollectReqDTO; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.iaw.dto.CommRequestDTO; | |||
import cn.com.taiji.iaw.dto.ass.releasePlate.ReleasePlateListResponDTO; | |||
import cn.com.taiji.iaw.dto.ass.signChange.*; | |||
/** | |||
* @Author:ChenChao | |||
@@ -15,4 +16,8 @@ public interface SignChangeManager { | |||
SignChangeApplyResDTO apply(SignChangeApplyReqDTO dto) throws ManagerException; | |||
void collect(SignChangeCollectReqDTO dto) throws ManagerException; | |||
ReleasePlateListResponDTO list(CommRequestDTO req) throws ServiceHandleException; | |||
SignChangeDetailResDTO view(SignChangeDetailReqDTO req) throws ManagerException; | |||
} |
@@ -1,17 +1,28 @@ | |||
package cn.com.taiji.iaw.manager.ass; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.core.entity.ass.AssOrderinfo; | |||
import cn.com.taiji.core.entity.ass.AssSignChange; | |||
import cn.com.taiji.core.entity.dict.ass.AssOrderType; | |||
import cn.com.taiji.core.entity.dict.log.OperateType; | |||
import cn.com.taiji.core.model.comm.protocol.ias.ass.SignChangeApplyRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ias.ass.SignChangeApplyResponse; | |||
import cn.com.taiji.core.model.comm.protocol.ias.ass.SignChangeCollectRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ias.ass.SignChangeCollectResponse; | |||
import cn.com.taiji.iaw.dto.ass.signChange.SignChangeApplyReqDTO; | |||
import cn.com.taiji.iaw.dto.ass.signChange.SignChangeApplyResDTO; | |||
import cn.com.taiji.iaw.dto.ass.signChange.SignChangeCollectReqDTO; | |||
import cn.com.taiji.core.repo.jpa.ass.AssOrderinfoRepo; | |||
import cn.com.taiji.core.repo.jpa.ass.AssSignChangeRepo; | |||
import cn.com.taiji.iaw.dto.CommRequestDTO; | |||
import cn.com.taiji.iaw.dto.ass.AssOrderInfoResponseDTO; | |||
import cn.com.taiji.iaw.dto.ass.releasePlate.ReleasePlateListResponDTO; | |||
import cn.com.taiji.iaw.dto.ass.signChange.*; | |||
import cn.com.taiji.iaw.manager.AbstractIawManager; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Author:ChenChao | |||
* @Date:2025/9/18 14:38 | |||
@@ -21,6 +32,11 @@ import org.springframework.stereotype.Service; | |||
@Service | |||
public class SignChangeManagerImpl extends AbstractIawManager implements SignChangeManager{ | |||
@Autowired | |||
private AssOrderinfoRepo orderInfoRepo; | |||
@Autowired | |||
private AssSignChangeRepo assSignChangeRepo; | |||
@Override | |||
public SignChangeApplyResDTO apply(SignChangeApplyReqDTO dto) throws ManagerException { | |||
SignChangeApplyRequest request = new SignChangeApplyRequest(); | |||
@@ -46,4 +62,23 @@ public class SignChangeManagerImpl extends AbstractIawManager implements SignCha | |||
findOpenIdByToken(dto.getAccessToken()), "签约信息变更收集"); | |||
} | |||
@Override | |||
public ReleasePlateListResponDTO list(CommRequestDTO req) throws ServiceHandleException { | |||
ReleasePlateListResponDTO responDTO = new ReleasePlateListResponDTO(); | |||
List<AssOrderinfo> assOrderinfoList = orderInfoRepo.findByOrderTypeAndOpenId(AssOrderType.PLATE_INFO_CHANGE, findOpenIdByToken(req.getAccessToken())); | |||
if (!isEmpty(assOrderinfoList)){ | |||
List<AssOrderInfoResponseDTO> assOrderInfoList = assOrderinfoList.stream().map(a -> copyProperties(a, new AssOrderInfoResponseDTO())).collect(Collectors.toList()); | |||
responDTO.setAssOrders(assOrderInfoList); | |||
} | |||
return responDTO; | |||
} | |||
@Override | |||
public SignChangeDetailResDTO view(SignChangeDetailReqDTO req) throws ManagerException { | |||
AssOrderinfo orderInfo = orderInfoRepo.findByOrderNo(req.getOrderNo()); | |||
if (orderInfo == null) throw new ManagerException("未找到该订单"); | |||
AssSignChange assSignChange = assSignChangeRepo.findByOrderNo(req.getOrderNo()); | |||
return null; | |||
} | |||
} |
@@ -42,8 +42,12 @@ public class ProductPageRequest extends JpaPageableDataRequest<IssueProduct> { | |||
public HqlBuilder toSelectHql() { | |||
HqlBuilder hql = new HqlBuilder("from " + IssueProduct.class.getName() + " where 1=1 "); | |||
hql.append(" and (customerType = :userType or customerType = 3)", userType); | |||
hql.append(" and vanType like :vanType", like(vanType.toString())); | |||
hql.append(" and extensionTool like :orderSource", like(orderSource.name())); | |||
if (vanType != null) { | |||
hql.append(" and vanType like :vanType", like(vanType.toString())); | |||
} | |||
if (orderSource != null) { | |||
hql.append(" and extensionTool like :orderSource", like(orderSource.name())); | |||
} | |||
hql.append(" and promotionMode = :promotionMode", promotionMode); | |||
hql.append(" and releaseId in :releaseIdList", releaseIdList); | |||
hql.append(" and needPay = :needPay", needPay); |
@@ -69,18 +69,23 @@ public class ServiceHallManagerImpl extends AbstractUserwManager implements Serv | |||
public Pagination query(ServiceHallPageRequestDTO reqDto) throws ServiceHandleException { | |||
ServiceHallPageRequest request = copyProperties(reqDto, new ServiceHallPageRequest()); | |||
String agencyId = findAgencyIdByToken(reqDto.getAccessToken()); | |||
if (hasText(reqDto.getAgencyName())) { | |||
//渠道迷糊查出id | |||
List<String> agencyIds = agencyRepo.listByName("%"+reqDto.getAgencyName()+"%"); | |||
request.setAgencyIds(agencyIds); | |||
} | |||
if (!QTZL_AGENCY_ID.equals(agencyId)){ | |||
//非黔通员工,只能看自己渠道网点 | |||
List<String> agencyIds = new ArrayList<>(); | |||
agencyIds.add(agencyId); | |||
request.setAgencyIds(agencyIds); | |||
} | |||
Pagination page = serviceHallRepo.page(request); | |||
if (hasText(reqDto.getAgencyName())) { | |||
//渠道迷糊查出id | |||
List<String> agencyIds = agencyRepo.listByName("%"+reqDto.getAgencyName()+"%"); | |||
if (hasText(reqDto.getAgencyId())){ | |||
List<String> agencyIds = new ArrayList<>(); | |||
agencyIds.add(reqDto.getAgencyId()); | |||
request.setAgencyIds(agencyIds); | |||
} | |||
Pagination page = serviceHallRepo.page(request); | |||
// 提取并去重上级网点编号 | |||
List<String> superIds = page.getResult(QtkServiceHall.class).stream().map(QtkServiceHall::getSuperServiceHallId) | |||
.distinct().collect(Collectors.toList()); |
@@ -11,12 +11,16 @@ import cn.com.taiji.core.entity.dict.ass.AssOrderStatus; | |||
import cn.com.taiji.core.entity.dict.ass.AssOrderStep; | |||
import cn.com.taiji.core.entity.dict.ass.AssOrderType; | |||
import cn.com.taiji.core.entity.dict.basic.*; | |||
import cn.com.taiji.core.entity.dict.issue.FeeCategory; | |||
import cn.com.taiji.core.entity.dict.issue.OrderPayType; | |||
import cn.com.taiji.core.entity.dict.issue.OrderType; | |||
import cn.com.taiji.core.entity.issue.IssueProduct; | |||
import cn.com.taiji.core.entity.issue.IssueProductPay; | |||
import cn.com.taiji.core.entity.log.IasInterfaceLog; | |||
import cn.com.taiji.core.entity.user.AccountInfo; | |||
import cn.com.taiji.core.entity.user.Staff; | |||
import cn.com.taiji.core.manager.comm.LogManager; | |||
import cn.com.taiji.core.manager.tools.issue.PayTools; | |||
import cn.com.taiji.core.manager.tools.issue.QdCallUtil; | |||
import cn.com.taiji.core.manager.tools.minio.MinioUtil; | |||
import cn.com.taiji.core.model.comm.protocol.ats.model.DeviceCancelChannelNoticeModel; | |||
@@ -28,15 +32,16 @@ import cn.com.taiji.core.model.comm.protocol.bls.ObuQueryResponse; | |||
import cn.com.taiji.core.model.comm.protocol.ias.ass.CommDeviceCancelApplyResponse; | |||
import cn.com.taiji.core.model.comm.protocol.ias.ass.DeviceCancelApplyRequest; | |||
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError; | |||
import cn.com.taiji.core.repo.jpa.issue.IssueProductPayRepo; | |||
import cn.com.taiji.ias.manager.audit.VerificationRuleManager; | |||
import cn.com.taiji.ias.model.MyFinals; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.time.LocalDateTime; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
@Service | |||
@@ -46,8 +51,12 @@ public class DeviceCancelApplyManager extends CommDeviceCancelManager implements | |||
private QdCallUtil qdCallUtil; | |||
@Autowired | |||
private MinioUtil minioUtil; | |||
@Autowired | |||
private PayTools payTools; | |||
@Autowired | |||
private IssueProductPayRepo issueProductPayRepo; | |||
// @Value("${deviceCancel.noticeUrl}") | |||
// @Value("${deviceCancel.noticeUrl}") | |||
private String noticeUrl; | |||
@Autowired | |||
@@ -77,13 +86,17 @@ public class DeviceCancelApplyManager extends CommDeviceCancelManager implements | |||
//检测是否有未完成的订单 | |||
handleNormalOrder(customer.getCustomerId()); | |||
// 生成售后订单 | |||
AssOrderinfo orderInfo = initOrderInfo(request, customer); | |||
// 生成注销明细 | |||
AssDeviceCancel cancelInfo = initCancelInfo(request, orderInfo, dataStream); | |||
// ocr信息对比 | |||
ocrCompare(request, orderInfo); | |||
// 生成支付单 | |||
createOrder(orderInfo, cancelInfo, dataStream); | |||
// 通知渠道 | |||
noticeQd(orderInfo, cancelInfo); | |||
// 保存 | |||
saveOrderInfo(orderInfo); | |||
saveCancelInfo(cancelInfo); | |||
@@ -209,7 +222,7 @@ public class DeviceCancelApplyManager extends CommDeviceCancelManager implements | |||
cancel.setAgentIdType(IdType.findByCode(request.getAgentIdType())); | |||
cancel.setOrderNo(orderInfo.getOrderNo()); | |||
cancel.setCancelType(1); | |||
cancel.setHasDevice(false); | |||
cancel.setHasDevice(request.getHasDevice()); | |||
cancel.setCardExpireTime(card.getCardExpireTime()); | |||
cancel.setObuExpireTime(obu.getObuExpireTime()); | |||
@@ -251,8 +264,27 @@ public class DeviceCancelApplyManager extends CommDeviceCancelManager implements | |||
orderInfo.setAuditReason(builder.toString()); | |||
} | |||
// 生成支付单 | |||
public void createOrder(AssOrderinfo orderInfo, AssDeviceCancel cancelInfo, Map<String, Object> dataStream) throws ServiceHandleException { | |||
QtkCardInfo cardInfo = (QtkCardInfo) dataStream.get("cardInfo"); | |||
if (cancelInfo.getFee() == 0 || !hasText(orderInfo.getCardId()) || !hasText(cardInfo.getCardId())) { | |||
return; | |||
} | |||
// 查询支付配置 | |||
List<IssueProductPay> productPays = issueProductPayRepo.findByFeeCategoryAndReleaseId(FeeCategory.ZX_DEFAULT, cardInfo.getPackageId()); | |||
if (isEmpty(productPays)) { | |||
logger.info("卡号:{}的产品未配置注销违约金支付配置", cardInfo.getCardId()); | |||
return; | |||
} | |||
String payConfigId = productPays.get(0).getPayConfigId(); | |||
if (hasText(payConfigId)) { | |||
payTools.createPayOrder(orderInfo.getOrderNo(), OrderType.AFTERSALE, Long.valueOf(cancelInfo.getFee()), payConfigId, OrderPayType.CANCEL_AMOUNT, orderInfo.getAgencyId()); | |||
} | |||
} | |||
// 通知 | |||
public void noticeQd(AssOrderinfo orderInfo, AssDeviceCancel cancelInfo) throws ServiceHandleException { | |||
public void noticeQd(AssOrderinfo orderInfo, AssDeviceCancel cancelInfo) { | |||
// 判断是否需要渠道处理 | |||
if (!MyFinals.QTZL_AGENCY_ID.equals(orderInfo.getAgencyId()) && hasText(noticeUrl)) { | |||
DeviceCancelChannelNoticeModel model = new DeviceCancelChannelNoticeModel(); |
@@ -20,7 +20,7 @@ import java.time.LocalDateTime; | |||
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.ASS_DEVICE_CANCEL_KEY; | |||
import static cn.com.taiji.inss.manager.model.inst.InstConstant.CMD_SUCCESS; | |||
@@ -48,7 +48,7 @@ public abstract class AbstractDeviceCancelCallBackManager extends AbstractCommMa | |||
AbstractDeviceCancelCommandHandler cmdHandler = cmdHandlers.get(request.getStepNo()); | |||
if (cmdHandler == null) | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("未找到处理模块,请联系管理员"); | |||
logger.info("执行在线激活命令第{}步",request.getStepNo()); | |||
logger.info("执行注销命令第{}步",request.getStepNo()); | |||
Integer nextStep = nextStep(vo, request); | |||
vo.setNextStep(nextStep); | |||
DeviceCancelInstCallBackResponse response = cmdHandler.doHandle(request, vo); | |||
@@ -57,7 +57,7 @@ public abstract class AbstractDeviceCancelCallBackManager extends AbstractCommMa | |||
writeCache(cmdHandler.getOrderVo()); | |||
return onSuccess(request, response, InssInterfaceLog.class, System.currentTimeMillis() - begin); | |||
} catch (Exception e) { | |||
logger.error("续期异常", e); | |||
logger.error("注销异常", e); | |||
throw exception(request, InssInterfaceLog.class, e.getMessage()); | |||
} | |||
@@ -70,15 +70,15 @@ public abstract class AbstractDeviceCancelCallBackManager extends AbstractCommMa | |||
abstract void saveData(DeviceCancelInstVO vo) throws ServiceHandleException; | |||
private DeviceCancelInstVO readCache(String transOrderId) throws ServiceHandleException { | |||
DeviceCancelInstVO vo = redisWrapManager.findObj(DeviceCancelInstVO.class, ASS_RENEWAL_KEY + transOrderId); | |||
DeviceCancelInstVO vo = redisWrapManager.findObj(DeviceCancelInstVO.class, ASS_DEVICE_CANCEL_KEY + transOrderId); | |||
if (vo == null){ | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("未查询到缓存续期信息"); | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("未查询到缓存注销信息"); | |||
} | |||
return vo; | |||
} | |||
private void writeCache(DeviceCancelInstVO vo) { | |||
redisWrapManager.set(ASS_RENEWAL_KEY + vo.getTransOrderId(), vo.toJson(), 3000000, TimeUnit.SECONDS); | |||
redisWrapManager.set(ASS_DEVICE_CANCEL_KEY + vo.getTransOrderId(), vo.toJson(), 3000000, TimeUnit.SECONDS); | |||
} | |||
private void valid(DeviceCancelInstCallBackRequest request, DeviceCancelInstVO vo) throws ServiceHandleException { |
@@ -55,10 +55,10 @@ public class DeviceCancelInstApplyManager extends RedisCacheManager implements L | |||
throw GlyServiceError.FORMAT_VALIDATE_ERR.toHandleException("未查询到卡签信息"); | |||
} | |||
// 业务校验 | |||
businessValidate(cardInfo, obuInfo); | |||
businessValidate(cardInfo, obuInfo, request); | |||
//组装VO | |||
DeviceCancelInstVO vo = handleRenewalInstVO(cardInfo, obuInfo); | |||
DeviceCancelInstVO vo = handleDeviceCancelInstVO(cardInfo, obuInfo, request); | |||
//保存命令记录 | |||
AssDeviceCancelCosRecord record = saveAssDeviceCancelCosRecord(vo); | |||
@@ -106,7 +106,7 @@ public class DeviceCancelInstApplyManager extends RedisCacheManager implements L | |||
return record; | |||
} | |||
private DeviceCancelInstVO handleRenewalInstVO(QtkCardInfo cardInfo, QtkObuInfo obuInfo) { | |||
private DeviceCancelInstVO handleDeviceCancelInstVO(QtkCardInfo cardInfo, QtkObuInfo obuInfo, DeviceCancelInstApplyRequest request) { | |||
String transOrderId = UUID.randomUUID().toString().replace("-", ""); | |||
DeviceCancelInstVO vo = new DeviceCancelInstVO(); | |||
vo.setTransOrderId(transOrderId); | |||
@@ -118,7 +118,7 @@ public class DeviceCancelInstApplyManager extends RedisCacheManager implements L | |||
vo.setCardVersion(cardInfo.getCardVersion()); | |||
vo.setCardStatus(cardInfo.getCardStatus()); | |||
vo.setCardEnableTime(cardInfo.getCardEnableTime()); | |||
vo.setCardExpireTime(expireTime); | |||
vo.setCardExpireTime("2".equals(request.getCancelOrRestore()) ? cardInfo.getCardExpireTime() : expireTime); | |||
} | |||
if (obuInfo != null) { | |||
vo.setIsCancelObu(true); | |||
@@ -126,24 +126,43 @@ public class DeviceCancelInstApplyManager extends RedisCacheManager implements L | |||
vo.setObuVersion(obuInfo.getObuVersion()); | |||
vo.setObuStatus(obuInfo.getObuStatus()); | |||
vo.setObuEnableTime(obuInfo.getObuEnableTime()); | |||
vo.setObuExpireTime(expireTime); | |||
vo.setObuExpireTime("2".equals(request.getCancelOrRestore()) ? obuInfo.getObuExpireTime() : expireTime); | |||
} | |||
return vo; | |||
} | |||
private void businessValidate(QtkCardInfo cardInfo, QtkObuInfo obuInfo) throws ServiceHandleException { | |||
//判断有效期时间 | |||
private void businessValidate(QtkCardInfo cardInfo, QtkObuInfo obuInfo, DeviceCancelInstApplyRequest request) throws ServiceHandleException { | |||
if (cardInfo != null) { | |||
// 判断卡状态 | |||
if (CardStatus.WKZX.equals(cardInfo.getCardStatus()) || CardStatus.YKZX.equals(cardInfo.getCardStatus())) { | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该卡状态为:" + cardInfo.getCardStatus().getValue() + ",不能进行注销操作!"); | |||
if("1".equals(request.getCancelOrRestore())) { | |||
// 判断卡状态 | |||
if (CardStatus.WKZX.equals(cardInfo.getCardStatus()) | |||
|| CardStatus.YKZX.equals(cardInfo.getCardStatus()) | |||
|| CardStatus.DELETE.equals(cardInfo.getCardStatus())) { | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该卡状态为:" + cardInfo.getCardStatus().getValue() + ",不能进行注销操作!"); | |||
} | |||
}else { | |||
if (!(CardStatus.WKZX.equals(cardInfo.getCardStatus()) | |||
|| CardStatus.YKZX.equals(cardInfo.getCardStatus()) | |||
|| CardStatus.DELETE.equals(cardInfo.getCardStatus()))) { | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该卡状态为:" + cardInfo.getCardStatus().getValue() + ",不用恢复注销操作!"); | |||
} | |||
} | |||
} | |||
if (obuInfo != null) { | |||
// 判断卡状态是否正常 | |||
if (ObuStatus.YQZX.equals(obuInfo.getObuStatus()) || ObuStatus.WQZX.equals(obuInfo.getObuStatus()) || ObuStatus.DELETE.equals(obuInfo.getObuStatus())) { | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该OBU状态为:" + obuInfo.getObuStatus().getValue() + ",不能进行注销操作!"); | |||
// 判断签状态 | |||
if("1".equals(request.getCancelOrRestore())) { | |||
if (ObuStatus.YQZX.equals(obuInfo.getObuStatus()) | |||
|| ObuStatus.WQZX.equals(obuInfo.getObuStatus()) | |||
|| ObuStatus.DELETE.equals(obuInfo.getObuStatus())) { | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该OBU状态为:" + obuInfo.getObuStatus().getValue() + ",不能进行注销操作!"); | |||
}else { | |||
if(!(ObuStatus.YQZX.equals(obuInfo.getObuStatus()) | |||
|| ObuStatus.WQZX.equals(obuInfo.getObuStatus()) | |||
|| ObuStatus.DELETE.equals(obuInfo.getObuStatus()))){ | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("该OBU状态为:" + obuInfo.getObuStatus().getValue() + ",不用恢复注销操作!"); | |||
} | |||
} | |||
} | |||
} | |||
} |