Commit 034c09a3 by sdif

用户端代码提交

parent c8663b2b
--- # 临时文件存储位置 避免临时文件被系统清理报错
spring.servlet.multipart.location: /ruoyi/server/temp
--- # 监控中心配置 --- # 监控中心配置
spring.boot.admin.client: spring.boot.admin.client:
# 增加客户端开关 # 增加客户端开关
...@@ -52,37 +49,37 @@ spring: ...@@ -52,37 +49,37 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true url: jdbc:mysql://db1.prd.jianghuxx.com:3317/pz?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: root username: root
password: root password: 4f9fa23639242790
# 从库数据源 # 从库数据源
slave: # slave:
lazy: true # lazy: true
type: ${spring.datasource.type} # type: ${spring.datasource.type}
driverClassName: com.mysql.cj.jdbc.Driver # driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true # url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true
username: # username:
password: # password:
# oracle: # oracle:
# type: ${spring.datasource.type} # type: ${spring.datasource.type}
# driverClassName: oracle.jdbc.OracleDriver # driverClassName: oracle.jdbc.OracleDriver
# url: jdbc:oracle:thin:@//localhost:1521/XE # url: jdbc:oracle:thin:@//localhost:1521/XE
# username: ROOT # username: ROOT
# password: root # password: root
# hikari: # hikari:
# connectionTestQuery: SELECT 1 FROM DUAL # connectionTestQuery: SELECT 1 FROM DUAL
# postgres: # postgres:
# type: ${spring.datasource.type} # type: ${spring.datasource.type}
# driverClassName: org.postgresql.Driver # driverClassName: org.postgresql.Driver
# url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true # url: jdbc:postgresql://localhost:5432/postgres?useUnicode=true&characterEncoding=utf8&useSSL=true&autoReconnect=true&reWriteBatchedInserts=true
# username: root # username: root
# password: root # password: root
# sqlserver: # sqlserver:
# type: ${spring.datasource.type} # type: ${spring.datasource.type}
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver # driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
# url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true # url: jdbc:sqlserver://localhost:1433;DatabaseName=tempdb;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true
# username: SA # username: SA
# password: root # password: root
hikari: hikari:
# 最大连接池数量 # 最大连接池数量
maxPoolSize: 20 maxPoolSize: 20
...@@ -105,13 +102,13 @@ spring: ...@@ -105,13 +102,13 @@ spring:
spring: spring:
redis: redis:
# 地址 # 地址
host: localhost host: cluster1.prd.nyinhong.com
# 端口,默认为6379 # 端口,默认为6379
port: 6379 port: 6319
# 数据库索引 # 数据库索引
database: 0 database: 0
# 密码(如没有密码请注释掉) # 密码(如没有密码请注释掉)
# password: password: yongqi@2022
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
# 是否开启ssl # 是否开启ssl
...@@ -121,17 +118,17 @@ redisson: ...@@ -121,17 +118,17 @@ redisson:
# redis key前缀 # redis key前缀
keyPrefix: keyPrefix:
# 线程池数量 # 线程池数量
threads: 16 threads: 4
# Netty线程池数量 # Netty线程池数量
nettyThreads: 32 nettyThreads: 8
# 单节点配置 # 单节点配置
singleServerConfig: singleServerConfig:
# 客户端名称 # 客户端名称
clientName: ${ruoyi.name} clientName: ${ruoyi.name}
# 最小空闲连接数 # 最小空闲连接数
connectionMinimumIdleSize: 32 connectionMinimumIdleSize: 8
# 连接池大小 # 连接池大小
connectionPoolSize: 64 connectionPoolSize: 32
# 连接空闲超时,单位:毫秒 # 连接空闲超时,单位:毫秒
idleConnectionTimeout: 10000 idleConnectionTimeout: 10000
# 命令等待超时,单位:毫秒 # 命令等待超时,单位:毫秒
......
...@@ -102,15 +102,7 @@ public class AppletSysUserController extends BaseController { ...@@ -102,15 +102,7 @@ public class AppletSysUserController extends BaseController {
*/ */
@PutMapping @PutMapping
public R<Void> edit(@Validated @RequestBody SysUser user) { public R<Void> edit(@Validated @RequestBody SysUser user) {
userService.checkUserAllowed(user); user.setUserId(LoginHelper.getLoginUser().getUserId());
userService.checkUserDataScope(user.getUserId());
if (!userService.checkUserNameUnique(user)) {
return R.fail("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
} else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user)) {
return R.fail("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
} else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user)) {
return R.fail("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
return toAjax(userService.updateUser(user)); return toAjax(userService.updateUser(user));
} }
......
...@@ -191,10 +191,11 @@ public class AppletTotalOrderController extends BaseController { ...@@ -191,10 +191,11 @@ public class AppletTotalOrderController extends BaseController {
*/ */
@RepeatSubmit() @RepeatSubmit()
@PostMapping("/refundOrder") @PostMapping("/refundOrder")
public R<Void> refundOrder(@Validated(AddGroup.class) @RequestBody TotalOrderBo recordBo) { public R<Boolean> refundOrder(@Validated(AddGroup.class) @RequestBody TotalOrderBo recordBo) {
return toAjax(iTotalOrderService.refundOrder(recordBo)); return R.ok(iTotalOrderService.refundOrder(recordBo));
} }
/** /**
* 退款回调 * 退款回调
*/ */
......
...@@ -74,4 +74,10 @@ public interface ISonOrderService { ...@@ -74,4 +74,10 @@ public interface ISonOrderService {
throw new UnsupportedOperationException("不支持该操作"); throw new UnsupportedOperationException("不支持该操作");
} }
/**
* 查询服务开始时间
*/
default String getFinishTime(Integer totalId){
throw new UnsupportedOperationException("不支持该操作");
}
} }
...@@ -18,6 +18,7 @@ import java.util.HashMap; ...@@ -18,6 +18,7 @@ import java.util.HashMap;
*/ */
@Component @Component
@ConditionalOnBean({ @ConditionalOnBean({
StoreOrderServiceImpl.class,
DbwzOrderServiceImpl.class, YypzOrderServiceImpl.class, ZqghOrderServiceImpl.class, DbwzOrderServiceImpl.class, YypzOrderServiceImpl.class, ZqghOrderServiceImpl.class,
DbmyOrderServiceImpl.class, ZyphOrderServiceImpl.class, DbghOrderServiceImpl.class}) DbmyOrderServiceImpl.class, ZyphOrderServiceImpl.class, DbghOrderServiceImpl.class})
public class SonOrderServiceBuilder { public class SonOrderServiceBuilder {
...@@ -32,7 +33,9 @@ public class SonOrderServiceBuilder { ...@@ -32,7 +33,9 @@ public class SonOrderServiceBuilder {
DbmyOrderServiceImpl dbmyOrderService = SpringUtils.getBean(DbmyOrderServiceImpl.class); DbmyOrderServiceImpl dbmyOrderService = SpringUtils.getBean(DbmyOrderServiceImpl.class);
ZyphOrderServiceImpl zyphOrderService = SpringUtils.getBean(ZyphOrderServiceImpl.class); ZyphOrderServiceImpl zyphOrderService = SpringUtils.getBean(ZyphOrderServiceImpl.class);
DbghOrderServiceImpl dbghOrderService = SpringUtils.getBean(DbghOrderServiceImpl.class); DbghOrderServiceImpl dbghOrderService = SpringUtils.getBean(DbghOrderServiceImpl.class);
StoreOrderServiceImpl storeOrderService = SpringUtils.getBean(StoreOrderServiceImpl.class);
sonOrderHashMap = new HashMap<>(8); sonOrderHashMap = new HashMap<>(8);
sonOrderHashMap.put(0, storeOrderService);
sonOrderHashMap.put(1, yypzOrderService); sonOrderHashMap.put(1, yypzOrderService);
sonOrderHashMap.put(2, dbghOrderService); sonOrderHashMap.put(2, dbghOrderService);
sonOrderHashMap.put(3, dbwzOrderService); sonOrderHashMap.put(3, dbwzOrderService);
......
...@@ -97,4 +97,14 @@ public class TotalOrderBo extends BaseEntity { ...@@ -97,4 +97,14 @@ public class TotalOrderBo extends BaseEntity {
private String logisticsCode; private String logisticsCode;
private String phone; private String phone;
/**
* 区分退款和售后
*/
private Integer isRefund;
/**
* 凭证
*/
private String voucher;
} }
...@@ -128,6 +128,11 @@ public class TotalOrderVo { ...@@ -128,6 +128,11 @@ public class TotalOrderVo {
private Double salePrice; private Double salePrice;
/** /**
* 医生
*/
private String doctor;
/**
* 服务状态 * 服务状态
*/ */
private Integer serviceStatus; private Integer serviceStatus;
......
...@@ -40,4 +40,9 @@ public interface DbghOrderMapper extends BaseMapperPlus<DbghOrderMapper, DbghOrd ...@@ -40,4 +40,9 @@ public interface DbghOrderMapper extends BaseMapperPlus<DbghOrderMapper, DbghOrd
* @return 代办挂号订单 * @return 代办挂号订单
*/ */
DbghOrderItemVo selectDbghOrderDetailDateByTotalId(Integer totalId); DbghOrderItemVo selectDbghOrderDetailDateByTotalId(Integer totalId);
/**
* 查询子订单完成时间
*/
String selectFinishTime(Integer totalId);
} }
...@@ -40,4 +40,9 @@ public interface DbwzOrderMapper extends BaseMapperPlus<DbwzOrderMapper, DbwzOrd ...@@ -40,4 +40,9 @@ public interface DbwzOrderMapper extends BaseMapperPlus<DbwzOrderMapper, DbwzOrd
* @return 代办挂号 * @return 代办挂号
*/ */
DbwzOrderItemVo selectDbwzOrderDetailDataByTotalId(Integer totalId); DbwzOrderItemVo selectDbwzOrderDetailDataByTotalId(Integer totalId);
/**
* 查询子订单完成时间
*/
String selectFinishTime(Integer totalId);
} }
...@@ -38,4 +38,8 @@ public interface YypzOrderMapper extends BaseMapperPlus<YypzOrderMapper, YypzOrd ...@@ -38,4 +38,8 @@ public interface YypzOrderMapper extends BaseMapperPlus<YypzOrderMapper, YypzOrd
* @return 预约陪诊相关信息 * @return 预约陪诊相关信息
*/ */
YypzOrderItemVo selectYypzOrderDetailDataByTotalId(Integer totalId); YypzOrderItemVo selectYypzOrderDetailDataByTotalId(Integer totalId);
/**
* 查询子订单完成时间
*/
String selectFinishTime(Integer totalId);
} }
...@@ -42,4 +42,9 @@ public interface ZqghOrderMapper extends BaseMapperPlus<ZqghOrderMapper, ZqghOrd ...@@ -42,4 +42,9 @@ public interface ZqghOrderMapper extends BaseMapperPlus<ZqghOrderMapper, ZqghOrd
*/ */
ZqghOrderItemVo selectZqghOrderDetailDateByTotalId(Integer totalId); ZqghOrderItemVo selectZqghOrderDetailDateByTotalId(Integer totalId);
/**
* 查询服务时间
*/
String selectFinishTime(Integer totalId);
} }
...@@ -40,4 +40,10 @@ public interface ZyphOrderMapper extends BaseMapperPlus<ZyphOrderMapper, ZyphOrd ...@@ -40,4 +40,10 @@ public interface ZyphOrderMapper extends BaseMapperPlus<ZyphOrderMapper, ZyphOrd
* @return 住院陪护订单 * @return 住院陪护订单
*/ */
ZyphOrderItemVo selectZyphOrderDetailDataByTotalId(Integer totalId); ZyphOrderItemVo selectZyphOrderDetailDataByTotalId(Integer totalId);
/**
* 查询子订单完成时间
*/
String selectFinishTime(Integer totalId);
} }
...@@ -100,6 +100,7 @@ public interface ITotalOrderService { ...@@ -100,6 +100,7 @@ public interface ITotalOrderService {
*/ */
Boolean refundOrder(TotalOrderBo bo); Boolean refundOrder(TotalOrderBo bo);
boolean orderRefundCallBack(WxPayRefundNotifyResult wxPayRefundNotifyResult); boolean orderRefundCallBack(WxPayRefundNotifyResult wxPayRefundNotifyResult);
/** /**
......
...@@ -207,8 +207,13 @@ public class ArticleServiceImpl implements IArticleService { ...@@ -207,8 +207,13 @@ public class ArticleServiceImpl implements IArticleService {
for (String num : numberArray) { for (String num : numberArray) {
integerList.add(num.trim()); integerList.add(num.trim());
}*/ }*/
List<String> ids = JsonUtils.parseArray(articleVo.getCover(), String.class); //List<String> ids = JsonUtils.parseArray(articleVo.getCover(), String.class);
List<String> ids = new ArrayList<>();
// 使用逗号分割字符串,并逐个转换为 Integer 添加到 List 中
if(null != articleVo.getCover()){
Collections.addAll(ids, articleVo.getCover().split(","));
articleVo.setCoverList(ids); articleVo.setCoverList(ids);
}
// 设置点赞数 // 设置点赞数
articleVo.setAppreciateNum(appreciateNumMap.getOrDefault(articleVo.getId(), 0)); articleVo.setAppreciateNum(appreciateNumMap.getOrDefault(articleVo.getId(), 0));
......
...@@ -319,4 +319,9 @@ public class DbghOrderServiceImpl implements IDbghOrderService, ISonOrderService ...@@ -319,4 +319,9 @@ public class DbghOrderServiceImpl implements IDbghOrderService, ISonOrderService
delayQueue.addOrder(task); delayQueue.addOrder(task);
return true; return true;
} }
@Override
public String getFinishTime(Integer totalId) {
return baseMapper.selectFinishTime(totalId);
}
} }
...@@ -298,4 +298,5 @@ public class DbmyOrderServiceImpl implements IDbmyOrderService, ISonOrderService ...@@ -298,4 +298,5 @@ public class DbmyOrderServiceImpl implements IDbmyOrderService, ISonOrderService
delayQueue.addOrder(task); delayQueue.addOrder(task);
return true; return true;
} }
} }
...@@ -320,4 +320,9 @@ public class DbwzOrderServiceImpl implements IDbwzOrderService, ISonOrderService ...@@ -320,4 +320,9 @@ public class DbwzOrderServiceImpl implements IDbwzOrderService, ISonOrderService
delayQueue.addOrder(task); delayQueue.addOrder(task);
return true; return true;
} }
@Override
public String getFinishTime(Integer totalId) {
return baseMapper.selectFinishTime(totalId);
}
} }
...@@ -7,6 +7,9 @@ import com.pz.common.core.domain.PageQuery; ...@@ -7,6 +7,9 @@ import com.pz.common.core.domain.PageQuery;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.pz.merchant.domain.vo.SonOrderVo;
import com.pz.merchant.service.ISonOrderService;
import com.pz.system.domain.bo.OrderFinishedBo;
import com.pz.system.domain.vo.StoreAdminOrderVo; import com.pz.system.domain.vo.StoreAdminOrderVo;
import com.pz.system.mapper.CityMapper; import com.pz.system.mapper.CityMapper;
import com.pz.system.mapper.TotalOrderMapper; import com.pz.system.mapper.TotalOrderMapper;
...@@ -32,7 +35,7 @@ import java.util.Optional; ...@@ -32,7 +35,7 @@ import java.util.Optional;
*/ */
@RequiredArgsConstructor @RequiredArgsConstructor
@Service @Service
public class StoreOrderServiceImpl implements IStoreOrderService { public class StoreOrderServiceImpl implements IStoreOrderService, ISonOrderService {
private final StoreOrderMapper baseMapper; private final StoreOrderMapper baseMapper;
...@@ -132,4 +135,15 @@ public class StoreOrderServiceImpl implements IStoreOrderService { ...@@ -132,4 +135,15 @@ public class StoreOrderServiceImpl implements IStoreOrderService {
} }
return baseMapper.deleteBatchIds(ids) > 0; return baseMapper.deleteBatchIds(ids) > 0;
} }
@Override
public SonOrderVo getSonOrderSimpleDataByTotalId(Integer totalId) {
return null;
}
@Override
public boolean switchSonOrderStatus(Long totalId, Integer target) {
return false;
}
} }
...@@ -311,14 +311,14 @@ public class SysUserServiceImpl implements ISysUserService, UserService { ...@@ -311,14 +311,14 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public int updateUser(SysUser user) { public int updateUser(SysUser user) {
Long userId = user.getUserId(); Long userId = user.getUserId();
// 删除用户与角色关联 /*// 删除用户与角色关联
userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId)); userRoleMapper.delete(new LambdaQueryWrapper<SysUserRole>().eq(SysUserRole::getUserId, userId));
// 新增用户与角色管理 // 新增用户与角色管理
insertUserRole(user); insertUserRole(user);
// 删除用户与岗位关联 // 删除用户与岗位关联
userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, userId)); userPostMapper.delete(new LambdaQueryWrapper<SysUserPost>().eq(SysUserPost::getUserId, userId));
// 新增用户与岗位管理 // 新增用户与岗位管理
insertUserPost(user); insertUserPost(user);*/
return baseMapper.updateById(user); return baseMapper.updateById(user);
} }
......
package com.pz.system.service.impl; package com.pz.system.service.impl;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.TypeReference;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -9,7 +11,9 @@ import com.fasterxml.jackson.core.JsonProcessingException; ...@@ -9,7 +11,9 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult; import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
import com.github.binarywang.wxpay.bean.request.WxPayRefundRequest;
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.pz.common.config.KbProperties; import com.pz.common.config.KbProperties;
import com.pz.common.core.domain.model.LoginUser; import com.pz.common.core.domain.model.LoginUser;
import com.pz.common.core.page.TableDataInfo; import com.pz.common.core.page.TableDataInfo;
...@@ -23,6 +27,7 @@ import com.pz.common.enums.TotalOrderStatus; ...@@ -23,6 +27,7 @@ import com.pz.common.enums.TotalOrderStatus;
import com.pz.common.exception.ServiceException; import com.pz.common.exception.ServiceException;
import com.pz.common.utils.HttpUtils; import com.pz.common.utils.HttpUtils;
import com.pz.merchant.domain.vo.EmployeesVo; import com.pz.merchant.domain.vo.EmployeesVo;
import com.pz.common.utils.JsonUtils;
import com.pz.merchant.domain.vo.SonOrderVo; import com.pz.merchant.domain.vo.SonOrderVo;
import com.pz.merchant.mapper.EmployeesMapper; import com.pz.merchant.mapper.EmployeesMapper;
import com.pz.merchant.service.ISonOrderService; import com.pz.merchant.service.ISonOrderService;
...@@ -49,6 +54,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -49,6 +54,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.security.MessageDigest; import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Map; import java.util.Map;
import java.util.HashMap; import java.util.HashMap;
import java.util.Date; import java.util.Date;
...@@ -112,6 +119,8 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -112,6 +119,8 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
private final UserAddressMapper userAddressMapper; private final UserAddressMapper userAddressMapper;
private final SysUserMapper sysUserMapper;
@Override @Override
public TotalOrderVo queryById(Long id) { public TotalOrderVo queryById(Long id) {
return baseMapper.selectVoById(id); return baseMapper.selectVoById(id);
...@@ -167,6 +176,8 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -167,6 +176,8 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
dbwzOrder.getStatus() dbwzOrder.getStatus()
); );
// totalOrderVo = BeanUtil.toBean(dbwzOrder, TotalOrderVo.class); // totalOrderVo = BeanUtil.toBean(dbwzOrder, TotalOrderVo.class);
//totalOrderVo = BeanUtil.toBean(dbwzOrder, TotalOrderVo.class);
totalOrderVo.setProject(servicesMapper.selectVoById(totalOrderVo.getServiceId()).getName());
totalOrderVo.setDepartment(departmentMapper.selectById(dbwzOrder.getDid()).getTitle()); totalOrderVo.setDepartment(departmentMapper.selectById(dbwzOrder.getDid()).getTitle());
totalOrderVo.setVisitor(userVsitorMapper.selectById(dbwzOrder.getVisitor()).getName()); totalOrderVo.setVisitor(userVsitorMapper.selectById(dbwzOrder.getVisitor()).getName());
totalOrderVo.setVisitTime(dbwzOrder.getVisitTime()); totalOrderVo.setVisitTime(dbwzOrder.getVisitTime());
...@@ -222,9 +233,9 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -222,9 +233,9 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
zqghOrder.getStatus() zqghOrder.getStatus()
); );
totalOrderVo.setHospital(hospitalMapper.selectById(zqghOrder.getHid()).getName()); totalOrderVo.setHospital(hospitalMapper.selectById(zqghOrder.getHid()).getName());
totalOrderVo.setVisitor(doctorMapper.selectById(zqghOrder.getDoctorId()).getName());
totalOrderVo.setDepartment(departmentMapper.selectById(zqghOrder.getDid()).getTitle()); totalOrderVo.setDepartment(departmentMapper.selectById(zqghOrder.getDid()).getTitle());
totalOrderVo.setHospital(hospitalMapper.selectById(zqghOrder.getHid()).getName()); totalOrderVo.setHospital(hospitalMapper.selectById(zqghOrder.getHid()).getName());
totalOrderVo.setDoctor(doctorMapper.selectById(zqghOrder.getDoctorId()).getName());
totalOrderVo.setTimeOfAppointment(zqghOrder.getTimeOfAppointment()); totalOrderVo.setTimeOfAppointment(zqghOrder.getTimeOfAppointment());
totalOrderVo.setOverTime(zqghOrder.getOverTime()); totalOrderVo.setOverTime(zqghOrder.getOverTime());
totalOrderVo.setVoucher(zqghOrder.getVoucher()); totalOrderVo.setVoucher(zqghOrder.getVoucher());
...@@ -236,15 +247,17 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -236,15 +247,17 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
storeOrder.getStatus() storeOrder.getStatus()
); );
StoreGoodsVo storeGoods = storeGoodsMapper.selectVoById(storeOrder.getOrderId()); StoreGoodsVo storeGoods = storeGoodsMapper.selectVoById(storeOrder.getGoodsId());
List<StoreGoodsTag> storeGoodsTags = storeGoodsTagMapper.selectList(new LambdaQueryWrapper<StoreGoodsTag>().in(StoreGoodsTag::getId, getTages(storeGoods.getTags())).select(StoreGoodsTag::getTitle)); List<Integer> ids = JsonUtils.parseArray(storeGoods.getTags(), Integer.class);
List<StoreGoodsTag> storeGoodsTags = storeGoodsTagMapper.selectList(new LambdaQueryWrapper<StoreGoodsTag>().in(StoreGoodsTag::getId, ids).select(StoreGoodsTag::getTitle));
totalOrderVo.setTags(storeGoodsTags); totalOrderVo.setTags(storeGoodsTags);
totalOrderVo.setStoreGoodsVo(storeGoods); totalOrderVo.setStoreGoodsVo(storeGoods);
UserAddressVo userAddressVo = userAddressMapper.selectVoById(storeGoods.getAddressId()); UserAddressVo userAddressVo = userAddressMapper.selectVoById(storeOrder.getAddressId());
totalOrderVo.setUserAddressVo(userAddressVo); totalOrderVo.setUserAddressVo(userAddressVo);
TotalOrderBo totalOrderBo = new TotalOrderBo(); TotalOrderBo totalOrderBo = new TotalOrderBo();
totalOrderBo.setId(totalOrderVo.getId()); totalOrderBo.setId(totalOrderVo.getId());
totalOrderBo.setPhone(userAddressVo.getPhone()); totalOrderBo.setPhone(userAddressVo.getPhone());
totalOrderBo.setLogisticsCode(storeOrder.getLogisticsCode());
totalOrderVo.setObject(selectLogisticsStatus(totalOrderBo)); totalOrderVo.setObject(selectLogisticsStatus(totalOrderBo));
} }
return totalOrderVo; return totalOrderVo;
...@@ -268,7 +281,9 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -268,7 +281,9 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
// 业务 // 业务
Business business = businessMapper.selectById(totalOrderVo.getBusinessId()); Business business = businessMapper.selectById(totalOrderVo.getBusinessId());
if(null != business){
totalOrderVo.setName(business.getName()); totalOrderVo.setName(business.getName());
}
// 服务封面 // 服务封面
Services services = servicesMapper.selectById(totalOrderVo.getServiceId()); Services services = servicesMapper.selectById(totalOrderVo.getServiceId());
...@@ -322,8 +337,9 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -322,8 +337,9 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
storeOrder.getStatus() storeOrder.getStatus()
); );
StoreGoods storeGoods = storeGoodsMapper.selectById(storeOrder.getOrderId()); StoreGoods storeGoods = storeGoodsMapper.selectById(storeOrder.getGoodsId());
List<StoreGoodsTag> storeGoodsTags = storeGoodsTagMapper.selectList(new LambdaQueryWrapper<StoreGoodsTag>().in(StoreGoodsTag::getId, getTages(storeGoods.getTags())).select(StoreGoodsTag::getTitle)); List<Integer> ids = JsonUtils.parseArray(storeGoods.getTags(), Integer.class);
List<StoreGoodsTag> storeGoodsTags = storeGoodsTagMapper.selectList(new LambdaQueryWrapper<StoreGoodsTag>().in(StoreGoodsTag::getId, ids).select(StoreGoodsTag::getTitle));
totalOrderVo.setTags(storeGoodsTags); totalOrderVo.setTags(storeGoodsTags);
totalOrderVo.setName(storeGoods.getTitle()); totalOrderVo.setName(storeGoods.getTitle());
...@@ -395,16 +411,14 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -395,16 +411,14 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
totalOrderVo.setPayMoney(bo.getPayMoney()); totalOrderVo.setPayMoney(bo.getPayMoney());
// 计算订单过期时间(当前时间加上30分钟) // 计算订单过期时间(当前时间加上30分钟)
long expirationTime = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(24); long expirationTime = System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(30);
// 未付款的订单延迟24小时自动取消 // 未付款的订单延迟24小时自动取消
TotalOrderDelayOperator totalOrderDelayOperator = new TotalOrderDelayOperator(totalOrder.getId(), expirationTime, id -> { TotalOrderDelayOperator totalOrderDelayOperator = new TotalOrderDelayOperator(totalOrder.getId(), expirationTime, id -> {
TotalOrder order = baseMapper.selectById(id); TotalOrder order = baseMapper.selectById(id);
if (order.getEmId() == 0) {// 预约陪诊
order.setStatus(TotalOrderStatus.CANCEL.getCode()); order.setStatus(TotalOrderStatus.CANCEL.getCode());
baseMapper.updateById(totalOrder); baseMapper.updateById(totalOrder);
} else {
throw new ServiceException("该订单已分配给陪诊员,不允许取消订单!");
}
}); });
delayQueue.addOrder(totalOrderDelayOperator); delayQueue.addOrder(totalOrderDelayOperator);
...@@ -478,6 +492,38 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -478,6 +492,38 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
@Override @Override
public Boolean cancelOrder(TotalOrderBo bo) { public Boolean cancelOrder(TotalOrderBo bo) {
TotalOrder totalOrder = baseMapper.selectById(bo.getId()); TotalOrder totalOrder = baseMapper.selectById(bo.getId());
ISonOrderService orderService = serviceBuilder.getSonOrderService(totalOrder.getBusinessId());
Objects.requireNonNull(orderService, "订单业务属性出错");
SonOrderVo sonOrderSimpleDataByTotalId = orderService.getSonOrderSimpleDataByTotalId(totalOrder.getId().intValue());
//待办问诊 已接单下取消订单调用退款接口
//已接单、待服务状态下等待陪诊员开始服务或取消订单
TotalOrderBo totalOrderBo = new TotalOrderBo();
totalOrderBo.setId(totalOrder.getId());
if(totalOrder.getBusinessId() == 3 && totalOrder.getStatus() == 1 ){
totalOrderBo.setIsRefund(0);
return this.refundOrder(totalOrderBo);
}
//进行中、待完成状态下等待陪诊员完成服务
if(totalOrder.getBusinessId() == 3 && totalOrder.getStatus() == 6 ){
totalOrderBo.setIsRefund(1);
return this.refundOrder(totalOrderBo);
}
//待办买药已接单 代发货下取消订单调用退款接口
if(totalOrder.getBusinessId() == 5 && totalOrder.getStatus() == 1){
totalOrderBo.setIsRefund(0);
return this.refundOrder(totalOrderBo);
}
//已接单、待收货状态下等待药品到达后确认
if(totalOrder.getBusinessId() == 5 && totalOrder.getStatus() == 2){
totalOrderBo.setIsRefund(1);
return this.refundOrder(totalOrderBo);
}
if (totalOrder.getEmId() == 0) {// 预约陪诊 if (totalOrder.getEmId() == 0) {// 预约陪诊
// yypzOrderMapper.selectOne(new LambdaQueryWrapper<YypzOrder>().eq(YypzOrder::getOrderId,totalOrder)); // yypzOrderMapper.selectOne(new LambdaQueryWrapper<YypzOrder>().eq(YypzOrder::getOrderId,totalOrder));
totalOrder.setStatus(TotalOrderStatus.CANCEL.getCode()); totalOrder.setStatus(TotalOrderStatus.CANCEL.getCode());
...@@ -498,18 +544,19 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -498,18 +544,19 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
@Override @Override
public Object payOrder(TotalOrderBo bo) { public Object payOrder(TotalOrderBo bo) {
// LoginUser loginUser = LoginHelper.getLoginUser(); LoginUser loginUser = LoginHelper.getLoginUser();
TotalOrder totalOrder = baseMapper.selectById(Integer.parseInt(bo.getOrderSn())); TotalOrder totalOrder = baseMapper.selectById(Integer.parseInt(bo.getOrderSn()));
Object payment = null; Object payment = null;
int money = (int) (totalOrder.getPayMoney() * 100); int money = (int) (totalOrder.getPayMoney() * 100);
try { try {
WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest(); WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
orderRequest.setBody(bo.getOrderTitle()); orderRequest.setBody(bo.getOrderTitle());
orderRequest.setOutTradeNo(totalOrder.getOrderSn()); orderRequest.setOutTradeNo(totalOrder.getOrderSn());
orderRequest.setTotalFee(money);// 元转成分 orderRequest.setTotalFee(money);// 元转成分
orderRequest.setOpenid("o37SK64I29ISwKLPb3tfBEYgZHAM"); orderRequest.setOpenid(sysUserMapper.selectById(loginUser.getUserId()).getOpenId());
orderRequest.setSpbillCreateIp("127.0.0.1"); orderRequest.setSpbillCreateIp("127.0.0.1");
orderRequest.setNotifyUrl("http://127.0.0.1:8089/applet/totalOrder/orderPayCallBack"); orderRequest.setNotifyUrl("https://peizheng.shanpeikj.com/api/applet/totalOrder/orderPayCallBack");
orderRequest.setTradeType("JSAPI"); orderRequest.setTradeType("JSAPI");
payment = iPayService.createOrder(orderRequest); payment = iPayService.createOrder(orderRequest);
...@@ -544,12 +591,19 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -544,12 +591,19 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
@Override @Override
public boolean orderRefundCallBack(WxPayRefundNotifyResult wxPayRefundNotifyResult) { public boolean orderRefundCallBack(WxPayRefundNotifyResult wxPayRefundNotifyResult) {
WxPayRefundNotifyResult.ReqInfo reqInfo = wxPayRefundNotifyResult.getReqInfo(); WxPayRefundNotifyResult.ReqInfo reqInfo = wxPayRefundNotifyResult.getReqInfo();
// 订单号 // 订单号
String outTradeNo = reqInfo.getOutTradeNo(); String outTradeNo = reqInfo.getOutTradeNo();
TotalOrder totalOrder = baseMapper.selectOne(new LambdaQueryWrapper<TotalOrder>().eq(TotalOrder::getOrderSn, outTradeNo)); TotalOrder totalOrder = baseMapper.selectOne(new LambdaQueryWrapper<TotalOrder>().eq(TotalOrder::getOrderSn, outTradeNo));
totalOrder.setStatus(TotalOrderStatus.REFUND.getCode()); totalOrder.setStatus(TotalOrderStatus.REFUND.getCode());
ISonOrderService orderService = serviceBuilder.getSonOrderService(totalOrder.getBusinessId());
Objects.requireNonNull(orderService, "订单业务属性出错");
// 修改子订单状态
boolean sonOrderFlag = orderService.switchSonOrderStatus(totalOrder.getId(), CommonOrderStatus.REFUND.getCode());
if (!sonOrderFlag) {
throw new ServiceException("子订单状态修改出错,接单失败");
}
if (baseMapper.updateById(totalOrder) > 0) { if (baseMapper.updateById(totalOrder) > 0) {
// 添加退款记录 // 添加退款记录
PaymentRecord paymentRecord = new PaymentRecord(); PaymentRecord paymentRecord = new PaymentRecord();
...@@ -566,104 +620,95 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -566,104 +620,95 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
@Override @Override
public Boolean refundOrder(TotalOrderBo bo) { public Boolean refundOrder(TotalOrderBo bo) {
TotalOrder totalOrder = baseMapper.selectById(bo.getId()); TotalOrder totalOrder = baseMapper.selectById(bo.getId());
totalOrder.setRefundAmount(totalOrder.getPayMoney());
totalOrder.setRefundReason(bo.getRefundReason());
if (totalOrder.getBusinessId() == 1) {// 预约陪诊 ISonOrderService orderService = serviceBuilder.getSonOrderService(totalOrder.getBusinessId());
YypzOrder yypzOrder = yypzOrderMapper.selectOne(new LambdaQueryWrapper<YypzOrder>().eq(YypzOrder::getOrderId, totalOrder.getId())); Objects.requireNonNull(orderService, "订单业务属性出错");
if (yypzOrder.getStatus().equals(CommonOrderStatus.TAKE_ORDER.getCode())) {
throw new ServiceException("陪诊员已接单,不允许退款!");
}
} else if (totalOrder.getBusinessId() == 2) {// 代办挂号
DbghOrder dbghOrder = dbghOrderMapper.selectOne(new LambdaQueryWrapper<DbghOrder>().eq(DbghOrder::getOrderId, totalOrder.getId())); SonOrderVo sonOrderSimpleDataByTotalId = orderService.getSonOrderSimpleDataByTotalId(totalOrder.getId().intValue());
if (dbghOrder.getStatus().equals(CommonOrderStatus.TAKE_ORDER.getCode())) { if (null == sonOrderSimpleDataByTotalId) {
throw new ServiceException("陪诊员已接单,不允许退款!"); throw new ServiceException("子订单状态出错!");
} }
} else if (totalOrder.getBusinessId() == 3) {// 代办问诊 //订单退款金额
double money = 0;
DbwzOrder dbwzOrder = dbwzOrderMapper.selectOne(new LambdaQueryWrapper<DbwzOrder>().eq(DbwzOrder::getOrderId, totalOrder.getId())); if(bo.getIsRefund() == 0){//陪诊员订单未完成用户主动退款
if (dbwzOrder.getStatus().equals(CommonOrderStatus.TAKE_ORDER.getCode())) { //主订单必须为付款并且子订单为已接单
throw new ServiceException("陪诊员已接单,不允许退款!"); if(totalOrder.getStatus() != 1 && sonOrderSimpleDataByTotalId.getOrderStatus() != 1){
throw new ServiceException("退款出错!");
} }
/**
*责任归属:用户下单,陪诊人员接单后,客户单方面取消,客户为本次订单负责:
*
* (1)订单开始前12小时取消--无责退款
*
* (2)订单开始前6小时取消--需承担服务项目金额的30%
*
* (3)订单开始前3小时取消--需承担服务项目金额的50%
*/
} else if (totalOrder.getBusinessId() == 4) {// 住院陪护 //待办问诊和待办买药走取消订单退款
/*if(totalOrder.getBusinessId() == 3 || totalOrder.getBusinessId() == 5){
throw new ServiceException("待办问诊和待办买药退款失败!");
}*/
ZyphOrder zyphOrder = zyphOrderMapper.selectOne(new LambdaQueryWrapper<ZyphOrder>().eq(ZyphOrder::getOrderId, totalOrder.getId())); /**
if (zyphOrder.getStatus().equals(CommonOrderStatus.TAKE_ORDER.getCode())) { * 待办买药
throw new ServiceException("陪诊员已接单,不允许退款!"); */
} if(totalOrder.getBusinessId() == 5){
money = totalOrder.getPayMoney();
}else if(totalOrder.getBusinessId() == 0){//商城订单
} else if (totalOrder.getBusinessId() == 5) {// 代办买药 }else {//一般陪诊订单
//一般订单开始服务时间
DbmyOrder dbmyOrder = dbmyOrderMapper.selectOne(new LambdaQueryWrapper<DbmyOrder>().eq(DbmyOrder::getOrderId, totalOrder.getId())); String serveTime = orderService.getFinishTime(totalOrder.getBusinessId());
if (dbmyOrder.getStatus().equals(DBMYOrderStatus.TAKE_ORDER.getCode())) { if(StringUtils.isNotEmpty(serveTime)) {
throw new ServiceException("陪诊员已接单,不允许退款!"); money = getMoney(serveTime,totalOrder.getPayMoney());//计算退款金额
} }
} else if (totalOrder.getBusinessId() == 6) {// 诊前挂号
ZqghOrder zqghOrder = zqghOrderMapper.selectOne(new LambdaQueryWrapper<ZqghOrder>().eq(ZqghOrder::getOrderId, totalOrder.getId()));
if (zqghOrder.getStatus().equals(CommonOrderStatus.TAKE_ORDER.getCode())) {
throw new ServiceException("陪诊员已接单,不允许退款!");
} }
} else if (totalOrder.getBusinessId() == 0) {// 商城订单 WxPayRefundRequest request = new WxPayRefundRequest();
StoreOrder storeOrder = storeOrderMapper.selectOne(new LambdaQueryWrapper<StoreOrder>().eq(StoreOrder::getOrderId, totalOrder.getId())); request.setOutTradeNo(totalOrder.getOrderSn());
if (storeOrder.getStatus().equals(ShopOrderStatus.DELIVER.getCode())) { request.setOutRefundNo(UUID.randomUUID().toString());
throw new ServiceException("商品已发货,不允许退款!"); request.setTotalFee((int) (totalOrder.getPayMoney() * 100));
} request.setRefundFee((int) (money * 100));
request.setNotifyUrl("https://peizheng.shanpeikj.com/api/applet/totalOrder/orderRefundCallBack");
try {
iPayService.refund(request);
} catch (WxPayException e) {
e.printStackTrace();
}
totalOrder.setRefundAmount(totalOrder.getPayMoney());
}else if (bo.getIsRefund() == 1){//陪诊员订单完成走审批流程
if(sonOrderSimpleDataByTotalId.getOrderStatus() != 2){
throw new ServiceException("订单状态错误");
} }
// 修改主订单退款理由 // 修改主订单退款理由
baseMapper.updateById(totalOrder); totalOrder.setRefundAmount(totalOrder.getPayMoney());
totalOrder.setRefundReason(bo.getRefundReason());
if (totalOrder.getBusinessId() == 1) {// 预约陪诊
yypzOrderMapper.update(null, new LambdaUpdateWrapper<YypzOrder>()
.eq(YypzOrder::getOrderId, totalOrder.getId())
.set(YypzOrder::getStatus, CommonOrderStatus.BEING_REFUND.getCode()));
} else if (totalOrder.getBusinessId() == 2) {// 代办挂号
dbghOrderMapper.update(null, new LambdaUpdateWrapper<DbghOrder>()
.eq(DbghOrder::getOrderId, totalOrder.getId())
.set(DbghOrder::getStatus, CommonOrderStatus.BEING_REFUND.getCode()));
} else if (totalOrder.getBusinessId() == 3) {// 代办问诊
dbwzOrderMapper.update(null, new LambdaUpdateWrapper<DbwzOrder>()
.eq(DbwzOrder::getOrderId, totalOrder.getId())
.set(DbwzOrder::getStatus, CommonOrderStatus.BEING_REFUND.getCode()));
} else if (totalOrder.getBusinessId() == 4) {// 住院陪护
zyphOrderMapper.update(null, new LambdaUpdateWrapper<ZyphOrder>()
.eq(ZyphOrder::getOrderId, totalOrder.getId())
.set(ZyphOrder::getStatus, CommonOrderStatus.BEING_REFUND.getCode()));
} else if (totalOrder.getBusinessId() == 5) {// 代办买药
dbmyOrderMapper.update(null, new LambdaUpdateWrapper<DbmyOrder>() }
.eq(DbmyOrder::getOrderId, totalOrder.getId())
.set(DbmyOrder::getStatus, DBMYOrderStatus.BEING_REFUND.getCode()));
} else if (totalOrder.getBusinessId() == 6) {// 诊前挂号
zqghOrderMapper.update(null, new LambdaUpdateWrapper<ZqghOrder>() // 修改子订单状态
.eq(ZqghOrder::getOrderId, totalOrder.getId()) boolean sonOrderFlag = orderService.switchSonOrderStatus(totalOrder.getId(), CommonOrderStatus.REFUND.getCode());
.set(ZqghOrder::getStatus, CommonOrderStatus.BEING_REFUND.getCode()));
} else if (totalOrder.getBusinessId() == 0) {// 商城订单 if (!sonOrderFlag) {
throw new ServiceException("子订单状态修改出错");
}
if (totalOrder.getBusinessId() == 0) {// 商城订单
storeOrderMapper.update(null, new LambdaUpdateWrapper<StoreOrder>() storeOrderMapper.update(null, new LambdaUpdateWrapper<StoreOrder>()
.eq(StoreOrder::getOrderId, totalOrder.getId()) .eq(StoreOrder::getOrderId, totalOrder.getId())
.set(StoreOrder::getStatus, ShopOrderStatus.BEING_REFUND.getCode())); .set(StoreOrder::getStatus, ShopOrderStatus.BEING_REFUND.getCode()));
} }
baseMapper.updateById(totalOrder);
return true; return true;
} }
...@@ -847,8 +892,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -847,8 +892,7 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
} }
// data参数是个json格式的字符串 建议使用函数或方法去生成 // data参数是个json格式的字符串 建议使用函数或方法去生成
bodys.put("data", jsonStr); bodys.put("data", jsonStr);
System.out.println(bodys);
try { try {
/** /**
* 重要提示如下: * 重要提示如下:
...@@ -861,7 +905,10 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -861,7 +905,10 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
*/ */
HttpResponse response = HttpUtils.doPost(host, path, requestMethod, headers, querys, bodys); HttpResponse response = HttpUtils.doPost(host, path, requestMethod, headers, querys, bodys);
System.out.println(response.toString()); System.out.println(response.toString());
return EntityUtils.toString(response.getEntity()); String responseBody = EntityUtils.toString(response.getEntity());
// 将响应体数据转换为 JSON 对象
JSONObject jsonResponse = new JSONObject(responseBody);
return jsonResponse;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -925,4 +972,39 @@ public class TotalOrderServiceImpl implements ITotalOrderService { ...@@ -925,4 +972,39 @@ public class TotalOrderServiceImpl implements ITotalOrderService {
return null; return null;
} }
} }
public long getHour(String date){
LocalDateTime startTime = LocalDateTime.parse(date);
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 计算当前时间和订单开始时间之间的时间差
Duration duration = Duration.between(now, startTime);
return duration.toHours();
}
public double getMoney(String serveTime,double payMoney){
double money = 0;
double deduction = 0;
double remainingAmount = 0;
long hour = getHour(serveTime);
if (hour >= 12 || (hour <= 12 && hour > 6)) {
money = payMoney;
} else if ((hour <= 6) && (hour >= 3)) {
// 计算扣除30%后的金额
deduction = payMoney * 0.3;
remainingAmount = payMoney - deduction;
money = remainingAmount;
} else if ((hour <= 3) && (hour >= 0)) {
// 计算扣除50%后的金额
deduction = payMoney * 0.5;
remainingAmount = payMoney - deduction;
money = remainingAmount;
}
return money;
}
} }
...@@ -320,4 +320,9 @@ public class YypzOrderServiceImpl implements IYypzOrderService, ISonOrderService ...@@ -320,4 +320,9 @@ public class YypzOrderServiceImpl implements IYypzOrderService, ISonOrderService
delayQueue.addOrder(task); delayQueue.addOrder(task);
return true; return true;
} }
@Override
public String getFinishTime(Integer totalId) {
return baseMapper.selectFinishTime(totalId);
}
} }
...@@ -177,4 +177,8 @@ public class ZqghOrderServiceImpl implements IZqghOrderService, ISonOrderService ...@@ -177,4 +177,8 @@ public class ZqghOrderServiceImpl implements IZqghOrderService, ISonOrderService
return baseMapper.updateById(sonOrder) > 0; return baseMapper.updateById(sonOrder) > 0;
} }
@Override
public String getFinishTime(Integer totalId) {
return baseMapper.selectFinishTime(totalId);
}
} }
...@@ -331,4 +331,9 @@ public class ZyphOrderServiceImpl implements IZyphOrderService, ISonOrderService ...@@ -331,4 +331,9 @@ public class ZyphOrderServiceImpl implements IZyphOrderService, ISonOrderService
delayQueue.addOrder(task); delayQueue.addOrder(task);
return true; return true;
} }
@Override
public String getFinishTime(Integer totalId) {
return baseMapper.selectFinishTime(totalId);
}
} }
...@@ -91,6 +91,11 @@ ...@@ -91,6 +91,11 @@
left join department on department.id = dbgh_order.did left join department on department.id = dbgh_order.did
where total_order.id = #{id} where total_order.id = #{id}
</select> </select>
<select id="selectFinishTime" resultType="java.lang.String">
select visit_time
from total_order t left join dbgh_order d on d.order_id = t.id
where t.id = #{id}
</select>
</mapper> </mapper>
...@@ -95,6 +95,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -95,6 +95,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join services on total_order.service_id = services.id left join services on total_order.service_id = services.id
where total_order.id = #{id} where total_order.id = #{id}
</select> </select>
<select id="selectFinishTime" resultType="java.lang.String">
select over_time
from total_order t left join dbmy_order d on d.order_id = t.id
where d.status = 2 and t.id = #{id}
</select>
</mapper> </mapper>
...@@ -101,6 +101,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -101,6 +101,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join department on department.id = dbwz_order.did left join department on department.id = dbwz_order.did
where total_order.id = #{id} where total_order.id = #{id}
</select> </select>
<select id="selectFinishTime" resultType="java.lang.String">
select visit_time
from total_order t left join dbwz_order d on d.order_id = t.id
where t.id = #{id}
</select>
</mapper> </mapper>
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
t.update_by, t.update_by,
t.update_time, t.update_time,
t.remark, t.remark,
e.name as emName,
b.name as business, b.name as business,
s.name as service s.name as service
from total_order t from total_order t
......
...@@ -95,4 +95,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -95,4 +95,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join department on department.id = yypz_order.did left join department on department.id = yypz_order.did
where total_order.id = #{id} where total_order.id = #{id}
</select> </select>
<select id="selectFinishTime" resultType="java.lang.String">
select visit_time
from total_order t left join yypz_order d on d.order_id = t.id
where t.id = #{id}
</select>
</mapper> </mapper>
...@@ -80,5 +80,10 @@ ...@@ -80,5 +80,10 @@
left join doctor on zqgh_order.doctor_id = doctor.id left join doctor on zqgh_order.doctor_id = doctor.id
where total_order.id = #{id} where total_order.id = #{id}
</select> </select>
<select id="selectFinishTime" resultType="java.lang.String">
select DATE_FORMAT(time_of_appointment, '%Y-%m-%d')
FROM total_order t left join zqgh_order d on d.order_id = t.id
where t.id = #{id}
</select>
</mapper> </mapper>
...@@ -99,5 +99,11 @@ ...@@ -99,5 +99,11 @@
where total_order.id = #{id} where total_order.id = #{id}
</select> </select>
<select id="selectFinishTime" resultType="java.lang.String">
select start_day
from total_order t left join zyph_order d on d.order_id = t.id
where t.id = #{id}
</select>
</mapper> </mapper>
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