Commit 6cbd1e55 by guojuxing

资源解除失败发送短信

parent b2e90766
......@@ -54,6 +54,7 @@ public class UnionEnterpriseAuthResDetailApiServiceImpl implements UnionEnterpri
private static String SMS_CODE_TO_OWN = "GICSHHT002";
private static String SMS_CODE_TO_UNION = "GICSHHT012";
private static String SMS_CODE_TO_RELIEVE = "GICSHHT013";
@Override
public ServiceResponse<Void> authDataCallback() {
......@@ -111,6 +112,24 @@ public class UnionEnterpriseAuthResDetailApiServiceImpl implements UnionEnterpri
} else {
dto.setStatusFlag(UnionEnterpriseAuthStatusEnum.RELIEVING.getCode());
}
//如果是解除失败,则要发送短信
if (UnionEnterpriseAuthDetailStatusEnum.RELIEVE_FAIL.getCode().equals(authStatus)) {
Map<String, String> enterpriseMap = getEnterpriseNameMap(ownEnterpriseId, unionEnterpriseId);
//发送短信
String[] smsArrOfOwn = new String[] { enterpriseMap.get(unionEnterpriseId), UnionEnterpriseAuthResTypeEnum.getMessage(resourceType)};
ServiceResponse<UserDTO> userResponse = userApiService.getUserByEnterpriseId(ownEnterpriseId);
//发送手机验证码
ServiceResponse<Void> smsSendResult = smsSendApiService.sendPlatformSms(SMS_CODE_TO_RELIEVE,
ownEnterpriseId,
userResponse.getResult().getPhoneAreaCode(),
userResponse.getResult().getPhoneNumber(),
smsArrOfOwn);
if (!smsSendResult.isSuccess()) {
LOGGER.warn("资源解除失败发送短信错误信息:{}", JSON.toJSONString(smsSendResult));
}
}
unionEnterpriseAuthService.update(dto);
unionEnterpriseAuthResDetailService.union(detail.getUnionEnterpriseAuthResDetailId(), authStatus, null, null);
}
......@@ -140,12 +159,7 @@ public class UnionEnterpriseAuthResDetailApiServiceImpl implements UnionEnterpri
dto.setLastUnionTime(new Date());
unionEnterpriseAuthService.update(dto);
List<Integer> enterpriseIdList = new ArrayList<>(2);
enterpriseIdList.add(ownEnterpriseId);
enterpriseIdList.add(unionEnterpriseId);
List<TabEnterprise> enterpriseList = enterpriseService.listEnterpriseByIds(enterpriseIdList);
Map<String, String> enterpriseMap = enterpriseList.stream().collect(Collectors.toMap(e -> e.getEnterpriseId().toString(), e -> e.getEnterpriseName()));
Map<String, String> enterpriseMap = getEnterpriseNameMap(ownEnterpriseId, unionEnterpriseId);
sendSms(ownEnterpriseId, enterpriseMap.get(ownEnterpriseId), enterpriseMap.get(unionEnterpriseId), true);
sendSms(unionEnterpriseId, enterpriseMap.get(ownEnterpriseId), enterpriseMap.get(unionEnterpriseId), false);
}
......@@ -192,4 +206,13 @@ public class UnionEnterpriseAuthResDetailApiServiceImpl implements UnionEnterpri
return isAllDealSuccess;
}
private Map<String, String> getEnterpriseNameMap(Integer ownEnterpriseId, Integer unionEnterpriseId) {
List<Integer> enterpriseIdList = new ArrayList<>(2);
enterpriseIdList.add(ownEnterpriseId);
enterpriseIdList.add(unionEnterpriseId);
List<TabEnterprise> enterpriseList = enterpriseService.listEnterpriseByIds(enterpriseIdList);
Map<String, String> enterpriseMap = enterpriseList.stream().collect(Collectors.toMap(e -> e.getEnterpriseId().toString(), e -> e.getEnterpriseName()));
return enterpriseMap;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment