Merge remote-tracking branch 'origin/jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支' into jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支

This commit is contained in:
赵旭 2023-10-20 09:42:13 +08:00
commit a865b49fa4
25 changed files with 577 additions and 111 deletions

View File

@ -60,6 +60,11 @@ public enum GooodsOrderStatusEnum {
* 已评价
*/
EVALUATED("EVALUATED"),
/**
* 已完成
*/
COMPLETED("COMPLETED"),
;
final private String info;

View File

@ -106,11 +106,14 @@ public class AppletScreeningRecordController extends BaseController {
public R<ScreeningRecordVo> detail(@PathVariable String screeningId) {
ScreeningRecordVo screeningRecordVo = screeningRecordService.detail(screeningId);
if (screeningRecordVo != null) {
File file = new File(screeningRecordVo.getAttachment());
if (StringUtils.isNotBlank(screeningRecordVo.getAttachment())){
String fileDir = XinELuConfig.getProfile() + screeningRecordVo.getAttachment().replaceAll("/profile", "");
File file = new File(fileDir);
if (file.exists() && file.isFile()) {
String fileName = file.getName();
screeningRecordVo.setFileType(fileName.substring(fileName.lastIndexOf(".") + 1));
}
}
if (!StringUtils.contains(screeningRecordVo.getProjectName(), ScreeningProjectConstants.ALZHEIMER)) {
screeningRecordService.getRecordDetail(screeningRecordVo);

View File

@ -1,5 +1,6 @@
package com.xinelu.applet.controller.nursingorder;
import com.xinelu.applet.dto.nurseorder.NurseOrderDTO;
import com.xinelu.applet.service.nursingorder.INursingOrderService;
import com.xinelu.applet.vo.nursingorder.AppletGoodsOrderVO;
import com.xinelu.applet.vo.nursingorder.NursingOrderInfoVO;
@ -14,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ -31,7 +33,7 @@ public class NursingOrderController extends BaseController {
private INursingOrderService nursingOrderService;
/**
* 根据登录id查询订单列表
* 根据登录id查询订单列表(暂时不用)
*/
@GetMapping("/userPage")
public TableDataInfo page(Long parentId) {
@ -93,4 +95,16 @@ public class NursingOrderController extends BaseController {
}
return nursingOrderService.getAppointmentDetailsInfo(orderNo);
}
/**
* 根据openid编号查询对应得订单
*/
//@MobileRequestAuthorization
@GetMapping("/getAppletOrderList")
public TableDataInfo getAppletOrderList(NurseOrderDTO nurseOrder) {
if (Objects.isNull(nurseOrder) || Objects.isNull(nurseOrder.getParentId()) || StringUtils.isBlank(nurseOrder.getCardNo()) || StringUtils.isBlank(nurseOrder.getOrderStatus())) {
return getDataTable(new ArrayList<>());
}
return getDataTable(nursingOrderService.getAppletOrderList(nurseOrder));
}
}

View File

@ -3,6 +3,7 @@ package com.xinelu.applet.controller.wechatpaymentinfo;
import com.xinelu.applet.service.wechatpaymentinfo.WeChatPayNotifyService;
import com.xinelu.applet.service.wechatpaymentinfo.WeChatPaymentService;
import com.xinelu.applet.service.wechatpaymentinfo.WeChatRefundService;
import com.xinelu.applet.vo.wechatpaymentinfo.dto.CloseOrderDTO;
import com.xinelu.applet.vo.wechatpaymentinfo.dto.PaymentDTO;
import com.xinelu.applet.vo.wechatpaymentinfo.dto.RefundDTO;
import com.xinelu.common.annotation.MobileRequestAuthorization;
@ -105,19 +106,6 @@ public class WeChatPaymentController extends BaseController {
return weChatPayNotifyService.xylWeChatPayNotify(request, response);
}
/**
* 医路优品微信支付回调通知接口
*
* @param request 请求头信息
* @param response 响应信息
* @return 应答信息避免微信平台重复发送回调通知
* @throws Exception 异常信息
*/
@PostMapping("/ylypWeChatPayNotify")
public String ylypWeChatPayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
return weChatPayNotifyService.ylypWeChatPayNotify(request, response);
}
/**
* 微信确认退款接口
*
@ -143,16 +131,13 @@ public class WeChatPaymentController extends BaseController {
}
/**
* 医路优品微信退款回调通知接口
* 专家咨询订单-医生端App拒单接口
*
* @param request 请求头信息
* @param response 响应信息
* @return 应答信息避免微信平台重复发送回调通知
* @throws Exception 异常信息
* @param closeOrderDTO 订单关闭参数
* @return 退款申请结果
*/
@PostMapping("/ylypWeChatRefundNotify")
public String ylypWeChatRefundNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
return weChatPayNotifyService.ylypWeChatRefundNotify(request, response);
@PostMapping("/closeHealthConsultationOrder")
public AjaxResult closeHealthConsultationOrder(@Validated(Insert.class) @RequestBody CloseOrderDTO closeOrderDTO) {
return weChatRefundService.closeHealthConsultationOrder(closeOrderDTO);
}
}

View File

@ -84,4 +84,8 @@ public class OrderEvaluateAndPictureDTO implements Serializable {
*/
private List<OrderEvaluatePictureInfo> orderEvaluatePictureInfoList;
/**
* 订单来源泉医模块SPRING_DOCTOR家医模块FAMILY_DOCTOR
*/
private String orderSource;
}

View File

@ -0,0 +1,38 @@
package com.xinelu.applet.dto.nurseorder;
import com.xinelu.common.core.domain.BaseDomain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
/**
* @Description 个人中心订单查询
* @Author zhangheng
* @Date 2022-10-18
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class NurseOrderDTO extends BaseDomain implements Serializable {
/**
* 用户信息
*/
private Long parentId;
/**
* 订单状态
*/
private String orderStatus;
/**
* 居民身份证号
*/
private String cardNo;
/**
* 地区标识
*/
private String region;
}

View File

@ -3,9 +3,11 @@ package com.xinelu.applet.mapper.nursingorder;
import com.xinelu.applet.vo.nursingorder.AppletGoodsOrderVO;
import com.xinelu.applet.vo.nursingorder.NursingOrderInfoVO;
import com.xinelu.applet.vo.nursingorder.PatientOrder;
import com.xinelu.applet.vo.specialdisease.AppointmentOrderDetailsInfoVO;
import com.xinelu.common.core.domain.entity.SysDictData;
import com.xinelu.manage.domain.goodsOrder.GoodsOrder;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -63,4 +65,30 @@ public interface NursingOrderMapper {
* @return 护理站信息
*/
AppointmentOrderDetailsInfoVO getNurseStationByItemId(Long nurseStationItemId);
/**
* 根据openid编号查询对应得订单
*
* @param patientId openid编号
* @param orderStatus 订单状态
* @return AjaxResult
*/
List<PatientOrder> getAppointmentOrderListByParentId(@Param("patientId") Long patientId, @Param("orderStatus") String orderStatus);
/**
* 根据openid编号查询对应得订单
*
* @param patientId openid编号
* @param orderStatus 订单状态
* @return AjaxResult
*/
List<PatientOrder> getGoodsOrderAndConsultationOrder(@Param("patientId") Long patientId, @Param("orderStatus") String orderStatus);
/**
* 根据patientId编号查询评价信息
*
* @param patientId openid编号
* @return AjaxResult
*/
List<PatientOrder> getOrderEvaluateByPatientId(Long patientId);
}

View File

@ -6,6 +6,7 @@ import com.xinelu.applet.service.apporderevaluate.IAppOrderEvaluateService;
import com.xinelu.common.config.XinELuConfig;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.enums.GooodsOrderStatusEnum;
import com.xinelu.common.enums.OrderSourceEnum;
import com.xinelu.common.enums.OrderStatusEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.bean.BeanUtils;
@ -85,6 +86,7 @@ public class AppOrderEvaluateServiceImpl implements IAppOrderEvaluateService {
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult insertGoodsOrderEvaluate(OrderEvaluateAndPictureDTO orderEvaluateAndPictureDTO) {
if (OrderSourceEnum.SPRING_DOCTOR.getInfo().equals(orderEvaluateAndPictureDTO.getOrderSource())) {
GoodsOrder goodsOrder = appOrderEvaluateMapper.selectGoodsOrderByOrderNo(orderEvaluateAndPictureDTO.getOrderNo());
if (Objects.isNull(goodsOrder) || StringUtils.isBlank(goodsOrder.getOrderStatus()) || !goodsOrder.getOrderStatus().equals(GooodsOrderStatusEnum.RECEIVED_GOODS.getInfo())) {
return AjaxResult.error("当前订单未确认收货,请先确认收货后进行评价!");
@ -92,6 +94,7 @@ public class AppOrderEvaluateServiceImpl implements IAppOrderEvaluateService {
if (StringUtils.equals(GooodsOrderStatusEnum.EVALUATED.getInfo(), goodsOrder.getOrderStatus())) {
return AjaxResult.error("当前订单已评价!");
}
}
//新增评价信息
OrderEvaluateInfo orderEvaluateInfo = new OrderEvaluateInfo();
BeanUtils.copyProperties(orderEvaluateAndPictureDTO, orderEvaluateInfo);
@ -100,9 +103,12 @@ public class AppOrderEvaluateServiceImpl implements IAppOrderEvaluateService {
if (insertOrderEvaluateInfo <= 0) {
throw new ServiceException("评价失败,请联系管理员!");
}
if (OrderSourceEnum.FAMILY_DOCTOR.getInfo().equals(orderEvaluateAndPictureDTO.getOrderSource())) {
return AjaxResult.success();
}
//新增评价图片
List<OrderEvaluatePictureInfo> afferentEvaluatePicture = orderEvaluateAndPictureDTO.getOrderEvaluatePictureInfoList();
if (CollectionUtils.isNotEmpty(orderEvaluateAndPictureDTO.getOrderEvaluatePictureInfoList())) {
if (CollectionUtils.isNotEmpty(afferentEvaluatePicture)) {
afferentEvaluatePicture.forEach(item -> {
item.setOrderEvaluateId(orderEvaluateInfo.getId());
item.setCreateTime(LocalDateTime.now());

View File

@ -1,8 +1,10 @@
package com.xinelu.applet.service.nursingorder;
import com.xinelu.applet.dto.nurseorder.NurseOrderDTO;
import com.xinelu.applet.vo.nursingorder.AppletGoodsOrderVO;
import com.xinelu.applet.vo.nursingorder.NursingOrderInfoVO;
import com.xinelu.applet.vo.nursingorder.PatientOrder;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.domain.entity.SysDictData;
import com.xinelu.manage.domain.goodsOrder.GoodsOrder;
@ -55,4 +57,12 @@ public interface INursingOrderService {
* @return 详情信息
*/
AjaxResult getAppointmentDetailsInfo(String orderNo);
/**
* 根据openid编号查询对应得订单
*
* @param nurseOrder nurseOrder
* @return AjaxResult
*/
List<PatientOrder> getAppletOrderList(NurseOrderDTO nurseOrder);
}

View File

@ -1,23 +1,37 @@
package com.xinelu.applet.service.nursingorder.impl;
import com.alibaba.fastjson2.JSON;
import com.xinelu.applet.dto.nurseorder.NurseOrderDTO;
import com.xinelu.applet.mapper.nursingorder.NursingOrderMapper;
import com.xinelu.applet.service.nursingorder.INursingOrderService;
import com.xinelu.applet.vo.nursingorder.AppletGoodsOrderVO;
import com.xinelu.applet.vo.nursingorder.NursingOrderInfoVO;
import com.xinelu.applet.vo.nursingorder.PatientOrder;
import com.xinelu.applet.vo.nursingorder.PatientOrderVO;
import com.xinelu.applet.vo.specialdisease.AppointmentOrderDetailsInfoVO;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.domain.entity.SysDictData;
import com.xinelu.common.enums.ConfirmRefundStatusEnum;
import com.xinelu.common.enums.GooodsOrderStatusEnum;
import com.xinelu.common.enums.OrderSourceEnum;
import com.xinelu.common.enums.OrderStatusEnum;
import com.xinelu.common.exception.ServiceException;
import com.xinelu.common.utils.http.HttpUtils;
import com.xinelu.common.utils.spring.SpringUtils;
import com.xinelu.manage.domain.goodsOrder.GoodsOrder;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static com.xinelu.common.utils.PageUtils.startPage;
/**
* @Description 订单分页
@ -31,6 +45,16 @@ public class NursingOrderServiceImpl implements INursingOrderService {
@Resource
private NursingOrderMapper nursingOrderMapper;
/**
* 未评价标识
*/
private final String NOT_EVALUATED = "NOT_EVALUATED";
/**
* 已评价标识
*/
private final String EVALUATED = "EVALUATED";
/**
* 查询个人订单列表并分页
*
@ -107,4 +131,56 @@ public class NursingOrderServiceImpl implements INursingOrderService {
}
return AjaxResult.success(detailsInfoVO);
}
/**
* 根据openid编号查询对应得订单
*
* @param nurseOrder nurseOrder
* @return AjaxResult
*/
@Override
public List<PatientOrder> getAppletOrderList(NurseOrderDTO nurseOrder) {
List<PatientOrder> patientOrders = new ArrayList<>();
List<PatientOrder> appletOrderList = new ArrayList<>();
List<PatientOrder> goodsOrderAndConsultationOrder = new ArrayList<>();
if (NOT_EVALUATED.equals(nurseOrder.getOrderStatus())) {
appletOrderList = nursingOrderMapper.getAppointmentOrderListByParentId(nurseOrder.getParentId(), OrderStatusEnum.COMPLETE.getInfo());
goodsOrderAndConsultationOrder = nursingOrderMapper.getGoodsOrderAndConsultationOrder(nurseOrder.getParentId(), GooodsOrderStatusEnum.RECEIVED_GOODS.getInfo());
}
if (EVALUATED.equals(nurseOrder.getOrderStatus())) {
appletOrderList = nursingOrderMapper.getAppointmentOrderListByParentId(nurseOrder.getParentId(), OrderStatusEnum.EVALUATED.getInfo());
goodsOrderAndConsultationOrder = nursingOrderMapper.getGoodsOrderAndConsultationOrder(nurseOrder.getParentId(), GooodsOrderStatusEnum.EVALUATED.getInfo());
}
if (CollectionUtils.isNotEmpty(appletOrderList)) {
patientOrders.addAll(appletOrderList);
}
if (CollectionUtils.isNotEmpty(goodsOrderAndConsultationOrder)) {
patientOrders.addAll(goodsOrderAndConsultationOrder);
}
String result = HttpUtils.sendGet(SpringUtils.getFdUrl(nurseOrder.getRegion()) + "/performance/recordV2/" + nurseOrder.getCardNo());
if (StringUtils.isBlank(result)) {
throw new ServiceException("获取微信小程序用户信息失败", 201);
}
PatientOrderVO resultHttp = JSON.parseObject(result, PatientOrderVO.class);
if (Objects.nonNull(resultHttp) && CollectionUtils.isNotEmpty(resultHttp.getData())) {
List<PatientOrder> data = resultHttp.getData();
List<PatientOrder> orderEvaluate = nursingOrderMapper.getOrderEvaluateByPatientId(nurseOrder.getParentId());
if (CollectionUtils.isNotEmpty(orderEvaluate) && EVALUATED.equals(nurseOrder.getOrderStatus())) {
for (PatientOrder patientOrder : orderEvaluate) {
PatientOrder dataFirst = data.stream().filter(Objects::nonNull).filter(item -> Objects.nonNull(item.getOrderNo()) && patientOrder.getOrderNo().equals(item.getOrderNo())).findFirst().orElse(new PatientOrder());
dataFirst.setCompositeScore(patientOrder.getCompositeScore());
dataFirst.setOrderSource(OrderSourceEnum.FAMILY_DOCTOR.getInfo());
patientOrders.add(dataFirst);
}
}
if (CollectionUtils.isNotEmpty(orderEvaluate) && NOT_EVALUATED.equals(nurseOrder.getOrderStatus())) {
data.removeAll(orderEvaluate);
data.forEach(item ->item.setOrderSource(OrderSourceEnum.FAMILY_DOCTOR.getInfo()));
}
patientOrders.addAll(data);
}
startPage();
patientOrders.sort((t1, t2) -> t2.getCreateTime().compareTo(t1.getCreateTime()));
return patientOrders;
}
}

View File

@ -21,16 +21,6 @@ public interface WeChatPayNotifyService {
*/
String xylWeChatPayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception;
/**
* 医路优品支付回调接口
*
* @param request 请求信息
* @param response 响应信息
* @return 应答信息避免微信平台重复发送回调通知
* @throws Exception 异常信息
*/
String ylypWeChatPayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception;
/**
* 新医路退款回调接口
*
@ -40,14 +30,4 @@ public interface WeChatPayNotifyService {
* @throws Exception 异常信息
*/
String xylWeChatRefundNotify(HttpServletRequest request, HttpServletResponse response) throws Exception;
/**
* 医路优品退款回调接口
*
* @param request 请求信息
* @param response 响应信息
* @return 应答信息避免微信平台重复发送回调通知
* @throws Exception 异常信息
*/
String ylypWeChatRefundNotify(HttpServletRequest request, HttpServletResponse response) throws Exception;
}

View File

@ -1,5 +1,6 @@
package com.xinelu.applet.service.wechatpaymentinfo;
import com.xinelu.applet.vo.wechatpaymentinfo.dto.CloseOrderDTO;
import com.xinelu.applet.vo.wechatpaymentinfo.dto.RefundDTO;
import com.xinelu.applet.vo.wechatpaymentinfo.vo.WeChatRefundInfoVO;
import com.xinelu.common.core.domain.AjaxResult;
@ -36,4 +37,12 @@ public interface WeChatRefundService {
* @return 退款信息
*/
WeChatRefundInfoVO queryGoodsOrderRefundStatus(String refundNo, String buySource);
/**
* 专家咨询订单-医生端App拒单接口
*
* @param closeOrderDTO 订单关闭参数
* @return 返回信息
*/
AjaxResult closeHealthConsultationOrder(CloseOrderDTO closeOrderDTO);
}

View File

@ -105,20 +105,6 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
return weChatPayNotifyInfo(request, response, PaymentMerchantTypeEnum.XINYILU.getInfo(), PAY);
}
/**
* 医路优品支付回调接口
*
* @param request 请求信息
* @param response 响应信息
* @return 应答信息避免微信平台重复发送回调通知
* @throws Exception 异常信息
*/
@Override
public String ylypWeChatPayNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
log.info("医路优品微信支付回调开始执行");
return weChatPayNotifyInfo(request, response, PaymentMerchantTypeEnum.YILUYOUPIN.getInfo(), PAY);
}
/**
* 新医路退款回调接口
*
@ -133,20 +119,6 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
return weChatPayNotifyInfo(request, response, PaymentMerchantTypeEnum.XINYILU.getInfo(), REFUND);
}
/**
* 医路优品退款回调接口
*
* @param request 请求信息
* @param response 响应信息
* @return 应答信息避免微信平台重复发送回调通知
* @throws Exception 异常信息
*/
@Override
public String ylypWeChatRefundNotify(HttpServletRequest request, HttpServletResponse response) throws Exception {
log.info("医路优品微信退款回调开始执行");
return weChatPayNotifyInfo(request, response, PaymentMerchantTypeEnum.YILUYOUPIN.getInfo(), REFUND);
}
/**
* 微信支付回调通知公共方法
*
@ -194,11 +166,9 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
resultMap.put("message", "解密失败!");
return JSON.toJSONString(resultMap);
}
//记录支付日志和修改订单状态
if (Constants.PAY_NOTIFY.equals(refundAndPaymentFlag)) {
this.processPaymentInfo(plainText);
}
//修改订单状态以及增加库存以及退还用户所使用的优惠券信息
if (Constants.REFUND_NOTIFY.equals(refundAndPaymentFlag)) {
this.processRefundInfo(plainText);
}

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.xinelu.applet.service.goodstock.GoodsStockService;
import com.xinelu.applet.service.wechatpaymentinfo.WeChatRefundService;
import com.xinelu.applet.vo.wechatpaymentinfo.dto.CloseOrderDTO;
import com.xinelu.applet.vo.wechatpaymentinfo.dto.RefundDTO;
import com.xinelu.applet.vo.wechatpaymentinfo.vo.WeChatRefundInfoVO;
import com.xinelu.common.config.WeChatPaymentUrlConfig;
@ -115,7 +116,8 @@ public class WeChatRefundServiceImpl implements WeChatRefundService {
Long patientId = Objects.isNull(appointmentOrderInfo.getPatientId()) ? 0 : appointmentOrderInfo.getPatientId();
String outRefundNo = com.xinelu.common.utils.StringUtils.fillZeroByPatientId(patientId, 5) + System.nanoTime();
String refundParam = buildRefundParam(null, appointmentOrderInfo, refundDTO, outRefundNo);
this.applyWeRefund(refundParam, appointmentOrderInfo, null, patientId, refundDTO);
String refundReason = StringUtils.isBlank(refundDTO.getRefundReason()) ? "" : refundDTO.getRefundReason();
this.applyWeRefund(refundParam, appointmentOrderInfo, null, patientId, refundReason);
return AjaxResult.success();
}
GoodsOrder goodsOrderInfo = goodsOrderMapper.getGoodsOrderByOrderNo(refundDTO.getOrderNo());
@ -136,7 +138,8 @@ public class WeChatRefundServiceImpl implements WeChatRefundService {
Long patientId = Objects.isNull(goodsOrderInfo.getPatientId()) ? 0 : goodsOrderInfo.getPatientId();
String outRefundNo = com.xinelu.common.utils.StringUtils.fillZeroByPatientId(patientId, 5) + System.nanoTime();
String refundParam = buildRefundParam(goodsOrderInfo, null, refundDTO, outRefundNo);
this.applyWeRefund(refundParam, null, goodsOrderInfo, patientId, refundDTO);
String refundReason = StringUtils.isBlank(refundDTO.getRefundReason()) ? "" : refundDTO.getRefundReason();
this.applyWeRefund(refundParam, null, goodsOrderInfo, patientId, refundReason);
return AjaxResult.success();
}
return AjaxResult.success();
@ -204,6 +207,38 @@ public class WeChatRefundServiceImpl implements WeChatRefundService {
}
}
/**
* 专家咨询订单-医生端App拒单接口
*
* @param closeOrderDTO 订单关闭参数
* @return 返回信息
*/
@Transactional(rollbackFor = Exception.class)
@Override
public AjaxResult closeHealthConsultationOrder(CloseOrderDTO closeOrderDTO) {
GoodsOrder goodsOrderInfo = goodsOrderMapper.getGoodsOrderByOrderNo(closeOrderDTO.getOrderNo());
if (Objects.isNull(goodsOrderInfo) || StringUtils.isBlank(goodsOrderInfo.getOrderNo())) {
return AjaxResult.error("当前订单信息不存在,无法拒单!");
}
if (StringUtils.isBlank(goodsOrderInfo.getOrderType())
|| !StringUtils.equals(OrderTypeEnum.HEALTH_CONSULTATION.getInfo(), goodsOrderInfo.getOrderType())) {
return AjaxResult.error("当前订单非专家咨询订单,无法拒单!");
}
if (StringUtils.isBlank(goodsOrderInfo.getOrderStatus())
|| !StringUtils.equals(GooodsOrderStatusEnum.WAIT_RECEIVED_GOODS.getInfo(), goodsOrderInfo.getOrderStatus())) {
return AjaxResult.error("当前订单状态异常,无法拒单!");
}
if (Objects.isNull(goodsOrderInfo.getTotalPrice()) || goodsOrderInfo.getTotalPrice().compareTo(BigDecimal.ZERO) <= 0) {
return AjaxResult.error("当前订单金额异常,无法拒单!");
}
Long patientId = Objects.isNull(goodsOrderInfo.getPatientId()) ? 0 : goodsOrderInfo.getPatientId();
String outRefundNo = com.xinelu.common.utils.StringUtils.fillZeroByPatientId(patientId, 5) + System.nanoTime();
String refundParam = this.buildHealthConsultationRefundParam(goodsOrderInfo, outRefundNo);
String refundReason = StringUtils.isBlank(closeOrderDTO.getRemark()) ? "" : closeOrderDTO.getRemark();
this.applyWeRefund(refundParam, null, goodsOrderInfo, patientId, refundReason);
return AjaxResult.success();
}
/**
* 退款参数检验
*
@ -257,10 +292,10 @@ public class WeChatRefundServiceImpl implements WeChatRefundService {
* @param appointmentOrderInfo 预约服务订单信息
* @param goodsOrderInfo 商品订单信息
* @param patientId 会员id
* @param refundDTO 申请信息
* @param refundReason 退款原因
*/
public void applyWeRefund(String refundParam, AppointmentOrder appointmentOrderInfo,
GoodsOrder goodsOrderInfo, Long patientId, RefundDTO refundDTO) {
GoodsOrder goodsOrderInfo, Long patientId, String refundReason) {
String requestUrl = weChatPaymentUrlConfig.getRefundApplyUrl();
HttpPost httpPost = new HttpPost(requestUrl);
StringEntity entity = new StringEntity(refundParam, "utf-8");
@ -286,7 +321,7 @@ public class WeChatRefundServiceImpl implements WeChatRefundService {
WeChatRefundInfoVO weChatRefundInfoVO = JSONObject.parseObject(body, WeChatRefundInfoVO.class);
int refundInfoCount = refundInfoMapper.getRefundInfoByOrderNo(weChatRefundInfoVO.getOutTradeNo());
if (refundInfoCount <= 0) {
RefundInfo refundInfo = buildRefundInfo(patientId, weChatRefundInfoVO, refundDTO, body, refundMerchantType);
RefundInfo refundInfo = buildRefundInfo(patientId, weChatRefundInfoVO, refundReason, body, refundMerchantType);
int insertCunt = refundInfoMapper.insertRefundInfo(refundInfo);
if (insertCunt <= 0) {
throw new ServiceException("记录退款信息失败,请联系管理员!");
@ -302,19 +337,19 @@ public class WeChatRefundServiceImpl implements WeChatRefundService {
*
* @param patientId 会员id
* @param refundInfoVO 退款信息参数
* @param refundDTO 退款申请参数
* @param refundReason 退款原因
* @param refundBody 返回体
* @param refundMerchantType 退款账户类型新医路或者医路优品
*/
private RefundInfo buildRefundInfo(Long patientId, WeChatRefundInfoVO refundInfoVO,
RefundDTO refundDTO, String refundBody, String refundMerchantType) {
String refundReason, String refundBody, String refundMerchantType) {
RefundInfo refundInfo = new RefundInfo();
refundInfo.setPatientId(patientId);
refundInfo.setOrderNo(refundInfoVO.getOutTradeNo());
refundInfo.setRefundNo(refundInfoVO.getRefundId());
refundInfo.setOutRefundNo(refundInfoVO.getOutRefundNo());
refundInfo.setTransactionNo(StringUtils.isBlank(refundInfoVO.getTransactionId()) ? "" : refundInfoVO.getTransactionId());
refundInfo.setRefundReason(StringUtils.isBlank(refundDTO.getRefundReason()) ? "" : refundDTO.getRefundReason());
refundInfo.setRefundReason(refundReason);
refundInfo.setRefundType(RefundTypeEnum.WE_CHAT.getInfo());
refundInfo.setWechatRefundStatus(RefundStatusEnum.PROCESSING.getInfo());
refundInfo.setOrderTotalPrice(BigDecimal.valueOf(refundInfoVO.getAmount().getTotal()).divide(BigDecimal.valueOf(100), 2, BigDecimal.ROUND_DOWN));
@ -393,4 +428,24 @@ public class WeChatRefundServiceImpl implements WeChatRefundService {
}
return null;
}
/**
* 构建专家咨询微信退款参数信息
*
* @param goodsOrderInfo 专家咨询订单信息
* @param outRefundNo 退款单号
* @return 退款申请Json串
*/
private String buildHealthConsultationRefundParam(GoodsOrder goodsOrderInfo, String outRefundNo) {
Map<String, Object> paramMap = new LinkedHashMap<>();
paramMap.put("out_trade_no", goodsOrderInfo.getOrderNo());
paramMap.put("out_refund_no", outRefundNo);
Map<String, Object> amountMap = new LinkedHashMap<>();
paramMap.put("notify_url", xylWeChatPaymentConfig.getXylWeChatNotifyUrl() + XINYILU_WE_CHAT_REFUND_URL);
amountMap.put("refund", goodsOrderInfo.getTotalPrice().multiply(BigDecimal.valueOf(100)).intValue());
amountMap.put("total", goodsOrderInfo.getTotalPrice().multiply(BigDecimal.valueOf(100)).intValue());
amountMap.put("currency", "CNY");
paramMap.put("amount", amountMap);
return JSON.toJSONString(paramMap);
}
}

View File

@ -75,7 +75,6 @@ public class NursingOrderInfoVO extends BaseDomain implements Serializable {
*/
private BigDecimal nurseItemPrice;
/**
* 是否删除标识01
*/

View File

@ -0,0 +1,80 @@
package com.xinelu.applet.vo.nursingorder;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @Description 服务评价
* @Author zhangheng
* @Date 2022-10-18
*/
@Data
public class PatientOrder implements Serializable {
/**
* 被护理人信息表id
*/
@ApiModelProperty(value = "被护理人信息表id")
private Long patientId;
/**
* 预约订单编号
*/
@ApiModelProperty(value = "订单编号")
private String orderNo;
/**
* 预约订单状态
*/
@ApiModelProperty(value = "订单状态")
private String orderStatus;
/**
* 下单时间
*/
private LocalDateTime createTime;
/**
* 订单名称
*/
@ApiModelProperty(value = "订单名称")
private String orderName;
/**
* 护理站护理项目表id
*/
@ApiModelProperty(value = "护理站护理项目表id")
private Long nurseStationItemId;
/**
* 护理项目图片地址
*/
@ApiModelProperty(value = "护理项目图片地址")
private String pictureUrl;
/**
* 订单类型
*/
private String orderType;
/**
* 预约服务满意度一般COMMONLY满意SATISFIED不满意DISSATISFIED
*/
@ApiModelProperty(value = "预约服务满意度一般COMMONLY满意SATISFIED不满意DISSATISFIED")
private String evaluateSatisfaction;
/**
* 商品订单综合评分取值1代表1颗星2代表两颗星3代表三颗星4代表四颗星5代表五颗星
*/
@ApiModelProperty(value = "商品订单综合评分取值1代表1颗星2代表两颗星3代表三颗星4代表四颗星5代表五颗星")
private Integer compositeScore;
/**
* 订单来源泉医模块SPRING_DOCTOR家医模块FAMILY_DOCTOR
*/
private String orderSource;
}

View File

@ -0,0 +1,31 @@
package com.xinelu.applet.vo.nursingorder;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Description 服务评价
* @Author zhangheng
* @Date 2022-10-18
*/
@Data
public class PatientOrderVO implements Serializable {
/**
* 成功标识
*/
private String code;
/**
* 文字描述
*/
private String msg;
/**
* 信息集合
*/
private List<PatientOrder> data;
}

View File

@ -0,0 +1,27 @@
package com.xinelu.applet.vo.wechatpaymentinfo.dto;
import com.xinelu.common.custominterface.Insert;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Description 订单关闭DTO
* @Author 纪寒
* @Date 2023-10-19 14:28:07
* @Version 1.0
*/
@Data
public class CloseOrderDTO implements Serializable {
private static final long serialVersionUID = -1681680608523099847L;
/**
* 订单编号必传字段
*/
@NotBlank(message = "订单编号不能为空!", groups = {Insert.class})
private String orderNo;
/**
* 拒单原因
*/
private String remark;
}

View File

@ -338,4 +338,57 @@
</select>
<select id="getAppointmentOrderListByParentId" resultType="com.xinelu.applet.vo.nursingorder.PatientOrder">
SELECT
ao.patient_id,
ao.order_no,
ao.order_status,
ao.create_time,
aod.nurse_item_name orderName,
nsi.item_picture_url pictureUrl,
'APPOINTMENT_ORDER' AS orderType,
nei.evaluate_satisfaction,
'SPRING_DOCTOR' AS orderSource
FROM
appointment_order ao
LEFT JOIN appointment_order_details aod ON ao.order_no = aod.order_no
LEFT JOIN nurse_station_item nsi ON nsi.id = aod.nurse_station_item_id
LEFT JOIN order_evaluate_info nei ON nei.order_no = ao.order_no
where
ao.order_status = #{orderStatus}
and ao.patient_id = #{patientId}
and ao.del_flag = 0
</select>
<select id="getGoodsOrderAndConsultationOrder"
resultType="com.xinelu.applet.vo.nursingorder.PatientOrder">
SELECT
gor.patient_id,
gor.order_no,
gor.order_status,
gor.order_time,
gor.order_type,
god.goods_name orderName,
gad.attribute_piture_url pictureUrl,
hpi.person_picture_url,
nei.composite_score,
'SPRING_DOCTOR' AS orderSource
FROM
goods_order gor
LEFT JOIN goods_order_details god ON god.order_no = gor.order_no
LEFT JOIN goods_attribute_details gad ON gad.id = god.goods_attribute_details_id
LEFT JOIN hospital_person_info hpi ON hpi.id = gor.hospital_person_id
LEFT JOIN order_evaluate_info nei ON nei.order_no = gor.order_no
where
gor.order_status = #{orderStatus}
and gor.patient_id = #{patientId}
and gor.del_flag = 0
</select>
<select id="getOrderEvaluateByPatientId" resultType="com.xinelu.applet.vo.nursingorder.PatientOrder">
SELECT order_no
FROM order_evaluate_info
where patient_id = #{patientId}
</select>
</mapper>

View File

@ -62,9 +62,9 @@ public class OrderEvaluateInfoController extends BaseController {
/**
* 新增预约服务订单和商品订单评价信息
*/
@PreAuthorize("@ss.hasPermi('system:orderEvaluateInfo:add')")
//@PreAuthorize("@ss.hasPermi('system:orderEvaluateInfo:add')")
@Log(title = "预约服务订单和商品订单评价信息", businessType = BusinessType.INSERT)
@PostMapping("add")
@PostMapping("/add")
public AjaxResult add(@RequestBody OrderEvaluateInfo orderEvaluateInfo) {
return toAjax(orderEvaluateInfoService.insertOrderEvaluateInfo(orderEvaluateInfo));
}
@ -74,7 +74,7 @@ public class OrderEvaluateInfoController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:orderEvaluateInfo:edit')")
@Log(title = "预约服务订单和商品订单评价信息", businessType = BusinessType.UPDATE)
@PostMapping("edit")
@PostMapping("/edit")
public AjaxResult edit(@RequestBody OrderEvaluateInfo orderEvaluateInfo) {
return toAjax(orderEvaluateInfoService.updateOrderEvaluateInfo(orderEvaluateInfo));
}

View File

@ -286,11 +286,14 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService {
if(recordVo == null) {
return null;
}
File file = new File(recordVo.getAttachment());
if(StringUtils.isNotBlank(recordVo.getAttachment())) {
String fileDir = XinELuConfig.getProfile() + recordVo.getAttachment().replaceAll("/profile", "");
File file = new File(fileDir);
if (file.exists() && file.isFile()) {
String fileName = file.getName();
recordVo.setFileType(fileName.substring(fileName.lastIndexOf(".") + 1));
}
}
if (!StringUtils.contains(recordVo.getProjectName(), ScreeningProjectConstants.ALZHEIMER)) {
getRecordDetail(recordVo);
}
@ -432,16 +435,18 @@ public class ScreeningRecordServiceImpl implements IScreeningRecordService {
/** 获取图片附件转base64 */
private void setAttachment(ScreeningRecordVo record) {
if(!StringUtils.isBlank(record.getAttachment())) {
File file = new File(record.getAttachment());
if(file.exists()) {
record.setAttachment(FileUtils.PicToBase64(record.getAttachment()));
if(StringUtils.isNotBlank(record.getAttachment())) {
String fileDir = XinELuConfig.getProfile() + record.getAttachment().replaceAll("/profile", "");
File file = new File(fileDir);
if(file.exists() && file.isFile()) {
record.setAttachment(FileUtils.PicToBase64(fileDir));
}
}
if(!StringUtils.isBlank(record.getAttachmentTwo())) {
File file = new File(record.getAttachmentTwo());
if (file.exists()) {
record.setAttachmentTwo(FileUtils.PicToBase64(record.getAttachmentTwo()));
if(StringUtils.isNotBlank(record.getAttachmentTwo())) {
String fileDir = XinELuConfig.getProfile() + record.getAttachmentTwo().replaceAll("/profile", "");
File file = new File(fileDir);
if (file.exists() && file.isFile()) {
record.setAttachmentTwo(FileUtils.PicToBase64(fileDir));
}
}
}

View File

@ -1,5 +1,6 @@
package com.xinelu.quartz.controller;
import com.xinelu.quartz.task.RefundHealthConsultationOrderTask;
import com.xinelu.quartz.task.RefundInfoTask;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -19,14 +20,22 @@ public class RefundInfoTaskController {
@Resource
private RefundInfoTask refundInfoTask;
@Resource
private RefundHealthConsultationOrderTask refundHealthConsultationOrderTask;
/**
* 手动执行修改退款单状态定时任务
*
* @throws Exception 异常信息
*/
@GetMapping("/handleRefundStatus")
public void handleRefundStatus() throws Exception {
public void handleRefundStatus() {
refundInfoTask.automaticProcessRefundInfo();
}
/**
* 手动执行处理专家咨询订单医生手动拒单定时任务
*/
@GetMapping("/handleHealthConsultationStatus")
public void handleHealthConsultationRefund() {
refundHealthConsultationOrderTask.automaticProcessHealthConsultationRefund();
}
}

View File

@ -13,4 +13,9 @@ public interface RefundInfoTaskService {
* 防止由于网络等其它原因未接受到退款回调通知进而导致的退款单状态修改不及时
*/
void automaticProcessRefundInfo();
/**
* 自动处理专家咨询订单医生手动拒单定时任务
*/
void automaticProcessHealthConsultationRefund();
}

View File

@ -93,6 +93,26 @@ public class RefundInfoTaskServiceImpl implements RefundInfoTaskService {
}
}
/**
* 自动处理专家咨询订单医生手动拒单定时任务
*/
@Override
public void automaticProcessHealthConsultationRefund() {
List<RefundOrderInfoVO> refundGoodsOrderLit = goodsOrderMapper.getRefundGoodsOrderInfo(GooodsOrderStatusEnum.WAIT_RECEIVED_GOODS.getInfo(), RefundStatusEnum.PROCESSING.getInfo(), ConfirmRefundStatusEnum.CONFIRMED.getInfo());
if (CollectionUtils.isEmpty(refundGoodsOrderLit)) {
return;
}
TransactionStatus transactionStatus = transactionManager.getTransaction(new DefaultTransactionDefinition());
try {
processHealthConsultationRefund(refundGoodsOrderLit);
transactionManager.commit(transactionStatus);
} catch (Exception e) {
transactionManager.rollback(transactionStatus);
log.error("处理专家咨询订单医生手动拒单定时任务异常,异常信息 =====> {}", e.getMessage());
throw e;
}
}
/**
* 处理退款的预约订单信息
*
@ -158,4 +178,28 @@ public class RefundInfoTaskServiceImpl implements RefundInfoTaskService {
}
}
/**
* 处理退款成功的专家咨询订单信息
*
* @param refundGoodsOrderLit 专家咨询订单信息
*/
private void processHealthConsultationRefund(List<RefundOrderInfoVO> refundGoodsOrderLit) {
List<String> orderNoList = Lists.newArrayList();
for (RefundOrderInfoVO refundOrderInfoVO : refundGoodsOrderLit) {
if (StringUtils.isBlank(refundOrderInfoVO.getOrderNo())
|| StringUtils.isBlank(refundOrderInfoVO.getOutRefundNo()) || StringUtils.isBlank(refundOrderInfoVO.getBuySource())) {
continue;
}
WeChatRefundInfoVO weChatRefundInfoVO = weChatRefundService.queryGoodsOrderRefundStatus(refundOrderInfoVO.getOutRefundNo(), refundOrderInfoVO.getBuySource());
if (StringUtils.isNotBlank(weChatRefundInfoVO.getStatus())
&& RefundStatusEnum.SUCCESS.getInfo().equals(weChatRefundInfoVO.getStatus())) {
orderNoList.add(refundOrderInfoVO.getOrderNo());
}
LocalDateTime successTime = StringUtils.isBlank(weChatRefundInfoVO.getSuccessTime()) ? LocalDateTime.now() : LocalDateTime.parse(weChatRefundInfoVO.getSuccessTime(), DateTimeFormatter.ISO_DATE_TIME);
refundInfoMapper.updateBatchRefundStatus(refundOrderInfoVO.getOrderNo(), successTime, weChatRefundInfoVO.getStatus());
}
if (CollectionUtils.isNotEmpty(orderNoList)) {
goodsOrderMapper.updateBatchGoodsOrderStatus(orderNoList, OrderStatusEnum.REFUNDED.getInfo());
}
}
}

View File

@ -0,0 +1,30 @@
package com.xinelu.quartz.task;
import com.xinelu.quartz.service.RefundInfoTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
/**
* @Description 专家咨询订单医生手动拒单定时任务
* @Author 纪寒
* @Date 2022-10-25 14:35:59
* @Version 1.0
*/
@Slf4j
@Component("refundHealthConsultationOrderTask")
public class RefundHealthConsultationOrderTask {
@Resource
private RefundInfoTaskService refundInfoTaskService;
/**
* 自动处理专家咨询订单医生手动拒单定时任务
*/
public void automaticProcessHealthConsultationRefund() {
log.info("开始执行专家咨询订单医生手动拒单定时任务........");
refundInfoTaskService.automaticProcessHealthConsultationRefund();
log.info("完成专家咨询订单医生手动拒单定时任务........");
}
}