getDefault获取证照信息修改逻辑

This commit is contained in:
guohb
2024-05-08 14:40:10 +08:00
parent baf2e86c7f
commit a2e999444a
2 changed files with 14 additions and 22 deletions

View File

@@ -91,19 +91,16 @@ public class SubmitLicenseResponse {
@ApiModelProperty("流程记录")
private List<ShopAuditInfoVO> processRecords;
public static SubmitLicenseResponse from(GetStoreInfoByCodeResponse storeInfoCode){
if (Objects.isNull(storeInfoCode)){
return null;
public static SubmitLicenseResponse from(GetStoreInfoByCodeResponse storeInfoCode,
SubmitLicenseResponse submitLicenseResponse){
if (Objects.isNull(submitLicenseResponse)){
submitLicenseResponse = new SubmitLicenseResponse();
}
GetStoreInfoByCodeResponse.InnerData data = storeInfoCode.getData();
GetStoreInfoByCodeResponse.StoreDocument storeDocument = data.getStoreDocument();
GetStoreInfoByCodeResponse.StoreDocument storeDocument = storeInfoCode.getData().getStoreDocument();
boolean storeBusinessValidPeriod = storeDocument.getStoreBusinessValidPeriod().equals("9");
SubmitLicenseResponse submitLicenseResponse = new SubmitLicenseResponse();
submitLicenseResponse.setId(null);
submitLicenseResponse.setShopId(null);
submitLicenseResponse.setLicenseType(LicenseTypeEnum.matchName(storeDocument.getStoreBusinessType()).getCode());
submitLicenseResponse.setLicenseLegalPerson(storeDocument.getStoreDirector());
submitLicenseResponse.setIssueTime(DateUtil.parseTime(storeDocument.getStoreBusinessDate()));
submitLicenseResponse.setIssueTime(DateUtil.parseDate(storeDocument.getStoreBusinessDate()));
submitLicenseResponse.setLicenseAddress(storeDocument.getStoreBusinessAdd());
submitLicenseResponse.setValidity(storeBusinessValidPeriod ? null : DateUtil.parseTime(storeDocument.getStoreBusinessValidPeriod()));
submitLicenseResponse.setOperator(storeDocument.getStoreDirector());
@@ -111,18 +108,14 @@ public class SubmitLicenseResponse {
submitLicenseResponse.setMainBusiness(storeDocument.getStoreFoodLicenseMainBusiness());
submitLicenseResponse.setBusinessProject(storeDocument.getStoreFoodLicenseBusinessScope());
submitLicenseResponse.setRemark(storeDocument.getStoreRemark());
submitLicenseResponse.setRemarkUrl(null);
submitLicenseResponse.setSubmitStatus(null);
submitLicenseResponse.setLicenseUrl(storeDocument.getStoreBusinessImg());
submitLicenseResponse.setLicenseName(storeDocument.getStoreBusinessName());
submitLicenseResponse.setSocialCreditCode(storeDocument.getStoreBusinessNumber());
submitLicenseResponse.setIdCardAndLicense1(null);
submitLicenseResponse.setIdCardAndLicense2(null);
submitLicenseResponse.setFoodLicenseUrl(storeDocument.getStoreFoodLicenseImg());
submitLicenseResponse.setBusinessPremises(storeDocument.getStoreFoodLicenseBusinessAddress());
submitLicenseResponse.setFoodLicenseCode(storeDocument.getStoreFoodLicense());
submitLicenseResponse.setFoodLicenseStartTime(DateUtil.parseTime(storeDocument.getStoreFoodLicenseBeginDate()));
submitLicenseResponse.setFoodLicenseEndTime(DateUtil.parseTime(storeDocument.getStoreFoodLicenseEndDate()));
submitLicenseResponse.setFoodLicenseStartTime(DateUtil.parseDate(storeDocument.getStoreFoodLicenseBeginDate()));
submitLicenseResponse.setFoodLicenseEndTime(DateUtil.parseDate(storeDocument.getStoreFoodLicenseEndDate()));
return submitLicenseResponse;
}

View File

@@ -107,8 +107,7 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
@Override
public SubmitLicenseResponse getDefault(Long shopId) {
//todo 业务逻辑问题 @zhy
//1.如果已经提交过证照信息,直接查询后组装数据返回
//1.如果已经提交过证照信息,直接查询后组装数据
LicenseTransactDO result = applyLicenseMapper.selectByShopId(shopId);
SubmitLicenseResponse submitLicenseResponse = new SubmitLicenseResponse();
if (Objects.nonNull(result)){
@@ -131,19 +130,19 @@ public class ApplyLicenseServiceImpl implements ApplyLicenseService {
});
}
submitLicenseResponse.setProcessRecords(listByShopIdAndType);
return submitLicenseResponse;
}
//2.未查到证照信息,所以查询鲜丰的默认值
//2.未查到证照信息,所以查询鲜丰的默认值(只要鲜丰接口内有值,总是优先使用鲜丰数据)
ShopInfoDO shopInfoDO = shopInfoMapper.selectByPrimaryKey(shopId);
if (Objects.nonNull(shopInfoDO.getStoreNum())) {
GetStoreInfoByCodeResponse storeInfoCode = coolStoreStartFlowService.getStoreInfoCode(shopInfoDO.getStoreNum());
if (Objects.nonNull(storeInfoCode) && Objects.nonNull(storeInfoCode.getData()) && storeInfoCode.getCode() == 0) {
submitLicenseResponse = SubmitLicenseResponse.from(storeInfoCode);
if (Objects.nonNull(storeInfoCode.getData().getStoreDocument()) && storeInfoCode.getCode() == 0) {
//替换落库的值
submitLicenseResponse = SubmitLicenseResponse.from(storeInfoCode,submitLicenseResponse);
return submitLicenseResponse;
}
}
//3.既没有提交数据,也没有在鲜丰端查到证照信息,则返回空自由填写
return null;
return submitLicenseResponse;
}
@Override