| | |
| | | package com.kidgrow.oprationcenter.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.kidgrow.common.constant.CommonConstant; |
| | | import com.kidgrow.common.model.*; |
| | | import com.kidgrow.common.service.impl.SuperServiceImpl; |
| | | import com.kidgrow.common.utils.AesUtils; |
| | | import com.kidgrow.common.utils.DateUtils; |
| | | import com.kidgrow.common.utils.StringUtils; |
| | | import com.kidgrow.oprationcenter.feign.DiagnosticService; |
| | |
| | | import org.springframework.cglib.beans.BeanCopier; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | return ResultBody.failed("医院和科室数据有误!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 私有云套餐验证 |
| | | * @param hospitalId 医院ID |
| | | * @param departmentId 科室ID |
| | | * @return com.kidgrow.common.model.ResultBody |
| | | */ |
| | | public ResultBody verificateProductOrderDetail(Long hospitalId, Long departmentId ){ |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | |
| | | // 查询科室可用的合同列表【当前日期在合同开始、结束日期之间】 |
| | | List<ProductOrder> productOrderList = iProductOrderService.list( |
| | | new QueryWrapper<ProductOrder>() |
| | | .eq("hospital_id",hospitalId) |
| | | .eq("department_id",departmentId) |
| | | //.le("contract_begin_time",dateFormat.format(DateTime.now())) |
| | | //.ge("contract_end_time",dateFormat.format(DateTime.now())) |
| | | .eq("enabled",1) |
| | | .eq("is_del",0) |
| | | ); |
| | | |
| | | if ((productOrderList != null) && (productOrderList.size() > 0)) { |
| | | for (int i = 0 ; i < productOrderList.size(); i++) { |
| | | |
| | | ProductOrder productOrder = productOrderList.get(i); |
| | | // 查询合同可用的套餐【当前日期在套餐开始、结束日期之间,剩余读片量大于零】 |
| | | List<ProductOrderDetail> productOrderDetailList = baseMapper.selectList( |
| | | new QueryWrapper<ProductOrderDetail>() |
| | | .eq("order_id",productOrder.getId()) |
| | | //.le("pro_begintime",dateFormat.format(DateTime.now())) |
| | | //.ge("pro_endtime",dateFormat.format(DateTime.now())) |
| | | //.gt("order_ailight_count",0) |
| | | //.gt("order_ailight_count - ailight_count",0) |
| | | .eq("enabled",1) |
| | | .eq("is_del",0) |
| | | |
| | | ); |
| | | if ((productOrderDetailList != null) && (productOrderDetailList.size() > 0)) { |
| | | try { |
| | | for (int j = 0; j < productOrderDetailList.size(); j++) { |
| | | ProductOrderDetail productOrderDetail = productOrderDetailList.get(j); |
| | | if ((productOrderDetail.getAilightCountEncryption() == null) || (productOrderDetail.getAilightCountEncryption().isEmpty())) { |
| | | log.error("可用读片数量验证串为空"); |
| | | return ResultBody.failed("可用读片数量验证串为空"); |
| | | } |
| | | if ((productOrderDetail.getProBegintimeEncryption() == null) || (productOrderDetail.getProBegintimeEncryption().isEmpty())) { |
| | | log.error("套餐开始日期验证串为空"); |
| | | return ResultBody.failed("套餐开始日期验证串为空"); |
| | | } |
| | | if ((productOrderDetail.getProEndtimeEncryption() == null) || (productOrderDetail.getProEndtimeEncryption().isEmpty())) { |
| | | log.error("套餐结束日期验证串为空"); |
| | | return ResultBody.failed("套餐结束日期验证串为空"); |
| | | } |
| | | |
| | | String ailightCount = AesUtils.desEncrypt(productOrderDetail.getAilightCountEncryption()); |
| | | String proBeginTime = AesUtils.desEncrypt(productOrderDetail.getProBegintimeEncryption()); |
| | | String proEndTime = AesUtils.desEncrypt(productOrderDetail.getProEndtimeEncryption()); |
| | | |
| | | if ((ailightCount.isEmpty()) || (!productOrderDetail.getAilightCount().toString().equals(ailightCount))) { |
| | | log.error("可用读片数量验证失败"); |
| | | return ResultBody.failed("可用读片数量验证失败"); |
| | | } |
| | | if ((proBeginTime.isEmpty()) || (!dateFormat.format(productOrderDetail.getProBegintime()).equals(proBeginTime))) { |
| | | log.error("套餐开始日期验证失败"); |
| | | return ResultBody.failed("套餐开始日期验证失败"); |
| | | } |
| | | if ((proEndTime.isEmpty()) || (!dateFormat.format(productOrderDetail.getProEndtime()).equals(proEndTime))) { |
| | | log.error("套餐结束日期验证失败"); |
| | | return ResultBody.failed("套餐结束日期验证失败"); |
| | | } |
| | | |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultBody.failed(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | // } else { |
| | | // return ResultBody.failed("无有效的合同"); |
| | | } |
| | | log.error("私有云套餐验证通过"); |
| | | return ResultBody.ok().msg("私有云套餐验证通过"); |
| | | } |
| | | } |