@@ -0,0 +1,27 @@ | |||
package cn.com.taiji.core.entity.basic; | |||
import cn.com.taiji.common.entity.StringPropertyUUIDEntity; | |||
import cn.com.taiji.core.entity.dict.basic.DeviceVersion; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
import javax.persistence.*; | |||
import java.time.LocalDateTime; | |||
@Getter | |||
@Setter | |||
@Accessors(chain = true) | |||
@Table(name = "QTK_CARD_4X_SECTION") | |||
@Entity | |||
public class QtkCard4XSection extends StringPropertyUUIDEntity { | |||
@Column(name="START_ID") | |||
private String startId; | |||
@Column(name="END_ID") | |||
private String endId; | |||
@Enumerated(EnumType.STRING) | |||
@Column(name="VERSION") | |||
private DeviceVersion version; | |||
@Column(name="CREATE_TIME") | |||
private LocalDateTime createTime; | |||
} |
@@ -0,0 +1,27 @@ | |||
package cn.com.taiji.core.entity.basic; | |||
import cn.com.taiji.common.entity.StringPropertyUUIDEntity; | |||
import cn.com.taiji.core.entity.dict.basic.DeviceVersion; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import lombok.experimental.Accessors; | |||
import javax.persistence.*; | |||
import java.time.LocalDateTime; | |||
@Getter | |||
@Setter | |||
@Accessors(chain=true) | |||
@Table(name = "QTK_OBU_4X_SECTION") | |||
@Entity | |||
public class QtkObu4XSection extends StringPropertyUUIDEntity { | |||
@Column(name="START_ID") | |||
private String startId; | |||
@Column(name="END_ID") | |||
private String endId; | |||
@Enumerated(EnumType.STRING) | |||
@Column(name="VERSION") | |||
private DeviceVersion version; | |||
@Column(name="CREATE_TIME") | |||
private LocalDateTime createTime; | |||
} |
@@ -0,0 +1,13 @@ | |||
package cn.com.taiji.core.repo.jpa.basic; | |||
import cn.com.taiji.common.repo.jpa.AbstractJpaRepo; | |||
import cn.com.taiji.core.entity.basic.QtkObu4XSection; | |||
import org.springframework.data.jpa.repository.Query; | |||
import java.util.List; | |||
public interface QtkObu4XSectionRepo extends AbstractJpaRepo<QtkObu4XSection, String> { | |||
@Query("from QtkObu4XSection where ?1 >=startId and ?1 <=endId ") | |||
List<QtkObu4XSection> findByObuId(String cardId); | |||
} |
@@ -1,6 +1,8 @@ | |||
package cn.com.taiji.inss.manager.inst; | |||
import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.core.entity.basic.QtkCard4XSection; | |||
import cn.com.taiji.core.entity.basic.QtkObu4XSection; | |||
import cn.com.taiji.core.entity.dict.EnableStatus; | |||
import cn.com.taiji.core.entity.dict.basic.CardStatus; | |||
import cn.com.taiji.core.entity.dict.basic.DeviceVersion; | |||
@@ -23,6 +25,8 @@ import cn.com.taiji.core.model.comm.protocol.ats.notice.AtsChannelNoticeResponse | |||
import cn.com.taiji.core.model.comm.protocol.inss.inst.InstApplyRequest; | |||
import cn.com.taiji.core.model.comm.protocol.inss.inst.InstApplyResponse; | |||
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError; | |||
import cn.com.taiji.core.repo.jpa.basic.QtkCard4XSectionRepo; | |||
import cn.com.taiji.core.repo.jpa.basic.QtkObu4XSectionRepo; | |||
import cn.com.taiji.core.repo.jpa.invw.InvwCardDetailsRepo; | |||
import cn.com.taiji.core.repo.jpa.invw.InvwObuDetailsRepo; | |||
import cn.com.taiji.core.repo.jpa.invw.InvwWarehouseRepo; | |||
@@ -38,6 +42,7 @@ import cn.com.taiji.inss.manager.model.inst.IssueOrderVO; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
import java.util.UUID; | |||
import java.util.concurrent.TimeUnit; | |||
@@ -62,6 +67,10 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In | |||
private VfjCOSRecordRepo cosRecordRepo; | |||
@Autowired | |||
private IssueOrderConsigneeRepo consigneeRepo; | |||
@Autowired | |||
private QtkCard4XSectionRepo card4XSectionRepo; | |||
@Autowired | |||
private QtkObu4XSectionRepo obu4XSectionRepo; | |||
public InstApplyResponse serviceHandle(InstApplyRequest request) throws ServiceHandleException { | |||
try { | |||
@@ -153,7 +162,17 @@ public class InstApplyManager extends RedisCacheManager implements LogManager<In | |||
DeviceVersion cardVersion = DeviceVersion.getVersion(req.getCardVersion()); | |||
DeviceVersion obuVersion = DeviceVersion.getVersion(req.getObuVersion()); | |||
if (cardVersion != obuVersion) { | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("卡和OBU版本不一致"); | |||
List<QtkCard4XSection> card4XSections = card4XSectionRepo.findByCardId(req.getCardId()); | |||
if (!isEmpty(card4XSections)) { | |||
cardVersion = card4XSections.get(0).getVersion(); | |||
} | |||
List<QtkObu4XSection> obu4XSections = obu4XSectionRepo.findByObuId(req.getObuId()); | |||
if (!isEmpty(obu4XSections)) { | |||
obuVersion = obu4XSections.get(0).getVersion(); | |||
} | |||
if (cardVersion != obuVersion) { | |||
throw GlyServiceError.BUSINESS_VALIDATE_ERR.toHandleException("卡和OBU版本不一致"); | |||
} | |||
} | |||
// 卡类型校验 | |||
String realCardTypeStr = req.getCardId().substring(8, 10); |
@@ -117,6 +117,11 @@ public class InstOnlineActiveMananger extends AbstractCallBackManager { | |||
private ActiveRecordRepo activeRecordRepo; | |||
@Autowired | |||
private DaspOfflineHasSendRepo hasSendRepo; | |||
@Autowired | |||
private QtkCard4XSectionRepo card4XSectionRepo; | |||
@Autowired | |||
private QtkObu4XSectionRepo obu4XSectionRepo; | |||
@PostConstruct | |||
public void init() { | |||
@@ -620,7 +625,12 @@ public class InstOnlineActiveMananger extends AbstractCallBackManager { | |||
cardInfo.setCustomerId(customerInfo.getCustomerId()); | |||
cardInfo.setDebitType(0); | |||
cardInfo.setDeviceType(orderInfo.getDeviceType()); | |||
cardInfo.setCardVersion(DeviceVersion.getVersion(vo.getCardVersion())); | |||
List<QtkCard4XSection> card4XSections = card4XSectionRepo.findByCardId(vo.getCardId()); | |||
if (!isEmpty(card4XSections)) { | |||
cardInfo.setCardVersion(card4XSections.get(0).getVersion()); | |||
} else { | |||
cardInfo.setCardVersion(DeviceVersion.getVersion(vo.getCardVersion())); | |||
} | |||
cardInfo.setVehicleId(vehicleInfo.getVehicleId()); | |||
cardInfo.setCardIssuedType(orderInfo.getPromotionModes()); | |||
cardInfo.setUpdateTime(LocalDateTime.now()); | |||
@@ -670,7 +680,12 @@ public class InstOnlineActiveMananger extends AbstractCallBackManager { | |||
private QtkObuInfo saveObuInfo(IssueOrderVO vo, IssueOrderinfo orderInfo, QtkCustomerInfo customerInfo, QtkVehicleInfo vehicleInfo, InvwObuDetails obuDetails) { | |||
QtkObuInfo obuInfo = new QtkObuInfo(); | |||
obuInfo.setObuId(vo.getObuId()); | |||
obuInfo.setObuVersion(DeviceVersion.getVersion(vo.getObuVersion())); | |||
List<QtkObu4XSection> obu4XSections = obu4XSectionRepo.findByObuId(vo.getObuId()); | |||
if (!isEmpty(obu4XSections)) { | |||
obuInfo.setObuVersion(obu4XSections.get(0).getVersion()); | |||
} else { | |||
obuInfo.setObuVersion(DeviceVersion.getVersion(vo.getObuVersion())); | |||
} | |||
obuInfo.setObuStatus(ObuStatus.ZC); | |||
obuInfo.setInsertTime(LocalDateTime.now()); | |||
obuInfo.setCustomerId(customerInfo.getCustomerId()); |