|
|
@@ -18,6 +18,7 @@ import cn.com.taiji.common.pub.StringTools; |
|
|
|
import cn.com.taiji.common.validation.MyViolationException; |
|
|
|
import cn.com.yskj.zfdm.entity.User; |
|
|
|
import cn.com.yskj.zfdm.entity.dict.ApprovalType; |
|
|
|
import cn.com.yskj.zfdm.entity.dict.ServiceApplicationManagementStatus; |
|
|
|
import cn.com.yskj.zfdm.entity.zfd.ZfdServiceApply; |
|
|
|
import cn.com.yskj.zfdm.entity.zfd.ZfdServiceApplyDetail; |
|
|
|
import cn.com.yskj.zfdm.manager.comm.handler.hlt.HltResponse; |
|
|
@@ -30,6 +31,7 @@ import cn.com.yskj.zfdm.manager.comm.handler.hlt.service.HltService; |
|
|
|
import cn.com.yskj.zfdm.repo.request.service.application.ServiceRequestManagementRequest; |
|
|
|
import cn.com.yskj.zfdm.repo.zfd.ZfdServiceApplyDetailRepo; |
|
|
|
import cn.com.yskj.zfdm.repo.zfd.ZfdServiceApplyRepo; |
|
|
|
import cn.hutool.core.collection.CollectionUtil; |
|
|
|
@Service |
|
|
|
public class ServiceRequestInquiryManagerImpl extends AbstractManager implements ServiceRequestInquiryManager{ |
|
|
|
|
|
|
@@ -67,8 +69,6 @@ public class ServiceRequestInquiryManagerImpl extends AbstractManager implements |
|
|
|
//业务校验 |
|
|
|
ZfdServiceApply applyInDb = zfdServiceApplyRepo.findByAllId(zfdServiceApply.getId()); |
|
|
|
if(applyInDb == null) throw new ManagerException("未找到该申请,申请编号:"+ zfdServiceApply.getId()); |
|
|
|
List<ZfdServiceApplyDetail> applyDetailList = zfdServiceApplyDetailRepo.findByApplyId(applyInDb.getId()); |
|
|
|
if(applyDetailList==null || applyDetailList.size()==0) throw new ManagerException("未找到该申请的详情,申请编号:"+ zfdServiceApply.getId()); |
|
|
|
|
|
|
|
//如果审批状态为"审批不通过" |
|
|
|
if(zfdServiceApply.getStatus() == ApprovalType.REFUSED){ |
|
|
@@ -76,16 +76,20 @@ public class ServiceRequestInquiryManagerImpl extends AbstractManager implements |
|
|
|
if(!StringTools.hasText(zfdServiceApply.getReasonForFailure())) throw new MyViolationException("reasonForFailure", "审批不通过原因不能为空"); |
|
|
|
} |
|
|
|
//如果审批状态为"审批通过" |
|
|
|
List<ZfdServiceApplyDetail> applyDetailList = null; |
|
|
|
if(zfdServiceApply.getStatus() == ApprovalType.PASSED){ |
|
|
|
//审批不通过原因不能填写 |
|
|
|
if(StringTools.hasText(zfdServiceApply.getReasonForFailure())) throw new MyViolationException("reasonForFailure", "审批通过请不要填写不通过原因"); |
|
|
|
|
|
|
|
// 调用油券购买接口并更新本地数据 |
|
|
|
String rechargeOrderId = rechargeCommRequest(applyDetailList); |
|
|
|
|
|
|
|
// 调用油券激活接口 |
|
|
|
rechargeOrderCommRequest(applyDetailList, rechargeOrderId); |
|
|
|
|
|
|
|
if (ServiceApplicationManagementStatus.GAS_COUPON == zfdServiceApply.getServiceType()) { |
|
|
|
// 只有服务类型为加油券的服务申请,才有服务申请详情. |
|
|
|
applyDetailList = zfdServiceApplyDetailRepo.findByApplyId(applyInDb.getId()); |
|
|
|
if(applyDetailList==null || applyDetailList.size()==0) throw new ManagerException("未找到该申请的详情,申请编号:"+ zfdServiceApply.getId()); |
|
|
|
// 调用油券购买接口并更新本地数据 |
|
|
|
String rechargeOrderId = rechargeCommRequest(applyDetailList); |
|
|
|
|
|
|
|
// 调用油券激活接口 |
|
|
|
rechargeOrderCommRequest(applyDetailList, rechargeOrderId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//将从库里面查询的值进行非空校验 |
|
|
@@ -104,7 +108,9 @@ public class ServiceRequestInquiryManagerImpl extends AbstractManager implements |
|
|
|
|
|
|
|
//保存数据 |
|
|
|
zfdServiceApplyRepo.save(applyInDb); |
|
|
|
zfdServiceApplyDetailRepo.saveAll(applyDetailList); |
|
|
|
if (!CollectionUtil.isEmpty(applyDetailList)) { |
|
|
|
zfdServiceApplyDetailRepo.saveAll(applyDetailList); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void rechargeOrderCommRequest(List<ZfdServiceApplyDetail> applyDetailList, String rechargeOrderId) |