zjh
2023-10-12 8cde7ee1143bae70eb68d2b75f572d5b4dbadf98
zjh 2023/10/12--1
13个文件已修改
4个文件已添加
617 ■■■■■ 已修改文件
ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysLoginController.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjFlowingWaterController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjNewFlowingWaterController.java 252 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-admin/src/main/resources/application.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-admin/src/test/java/zjhTest.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-common/src/main/java/com/ltkj/common/core/domain/model/LoginUser.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-common/src/main/java/com/ltkj/common/exception/CustomException.java 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-common/src/main/java/com/ltkj/common/exception/user/SecretKeyException.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-common/src/main/java/com/ltkj/common/utils/SecurityUtils.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-framework/src/main/java/com/ltkj/framework/web/service/SysLoginService.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-hosp/src/main/java/com/ltkj/hosp/domain/DictHosp.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjFlowingWater.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjOrderService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjOrderServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-hosp/src/main/java/com/ltkj/hosp/vodomain/NewFlowingWaterVo.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-hosp/src/main/resources/mapper/hosp/TjOrderMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysLoginController.java
@@ -3,11 +3,20 @@
import java.awt.peer.LabelPeer;
import java.util.*;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.common.annotation.RepeatSubmit;
import com.ltkj.common.core.domain.entity.SysDept;
import com.ltkj.common.core.domain.entity.SysRole;
import com.ltkj.common.core.redis.RedisCache;
import com.ltkj.common.exception.CustomException;
import com.ltkj.common.exception.user.SecretKeyException;
import com.ltkj.common.utils.StringUtils;
import com.ltkj.framework.config.UserHoder;
import com.ltkj.hosp.domain.DictHosp;
import com.ltkj.hosp.domain.TjCustomer;
import com.ltkj.hosp.service.IDictHospService;
import com.ltkj.hosp.service.ITjCustomerService;
import com.ltkj.system.domain.SysPost;
import com.ltkj.system.domain.SysRoleMenu;
@@ -17,6 +26,7 @@
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import com.ltkj.common.constant.Constants;
import com.ltkj.common.core.domain.AjaxResult;
@@ -56,6 +66,17 @@
    private ISysRoleMenuService roleMenuService;
    @Autowired
    private ISysConfigService configService;
    @Resource
    private IDictHospService hospService;
    @Autowired
    private ISysDeptService deptService;
    @Value("${token.secret_key}")
    private String secret;
    @Value("${token.secret_key_login}")
    private boolean secretKeyLogin;
    @Autowired
    private RedisCache redisCache;
    /**
     * 登录方法
@@ -90,13 +111,50 @@
    @GetMapping("getInfo")
    public AjaxResult getInfo() {
        AjaxResult ajax = success();
        SysUser user = Objects.requireNonNull(SecurityUtils.getLoginUser()).getUser();
//        SysUser user = Objects.requireNonNull(SecurityUtils.getLoginUser()).getUser();
        SysUser user = UserHoder.getLoginUser().getUser();
        if (null != user.getUserId()) {
            String message=null;
            if (secretKeyLogin)
            {
                if(null !=user.getDeptId()){
                    if(!SecurityUtils.isAdmin(user.getUserId())){
                        SysDept sysDept = deptService.getById(user.getDeptId());
                        if (null != sysDept) {
                            DictHosp dictHosp = hospService.getById(sysDept.getHospId());
                            if(null !=dictHosp && dictHosp.getSecretKey() !=null && dictHosp.getExpirationTime() !=null){
                                if (!SecurityUtils.matchesMallMerchantSecretKey(secret,dictHosp.getHospAreaId(),dictHosp.getAreaid(),
                                        dictHosp.getExpirationTime(),dictHosp.getSecretKey())) {
                                    String userIdKey = Constants.LOGIN_USERID_KEY + user.getUserId();
                                    String userKey = redisCache.getCacheObject(userIdKey);
                                    if (org.apache.commons.lang3.StringUtils.isNotEmpty(userKey))
                                    {
                                        redisCache.deleteObject(userIdKey);
                                        redisCache.deleteObject(userKey);
                                    }
                                    throw new SecretKeyException("商家已过期请续费使用");
                                }
                                long between = DateUtil.between(new Date(), DateUtil.endOfDay(dictHosp.getExpirationTime()), DateUnit.DAY);
                                if(between<=30){
//                                    message="还有 "+between+" 天到期 请注意续费! 以免影响正常使用!";
                                    UserHoder.getLoginUser().setMessage("还有 "+between+" 天到期 请注意续费! 以免影响正常使用!");
                                }
                            }else {
                                throw new SecretKeyException("请缴费使用");
                            }
                        }
                    }
                }
            }
            Set<String> roles = permissionService.getRolePermission(user);
            Set<String> permissions = permissionService.getMenuPermission(user);
            ajax.put("user", user);
            ajax.put("roles", roles);
            ajax.put("permissions", permissions);
            ajax.put("securitMessage",UserHoder.getLoginUser().getMessage());
        } else {
            Set<String> roles = new HashSet<>();
            LambdaQueryWrapper<SysRole> wq = new LambdaQueryWrapper<>();
@@ -116,6 +174,7 @@
            ajax.put("roles", roles);
            ajax.put("permissions", permissions);
            ajax.put("post",null);
            ajax.put("securitMessage",null);
        }
        return ajax;
    }
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjFlowingWaterController.java
@@ -418,7 +418,7 @@
                                tjRefundVo.setTjName(MatchUtils.hideCusName(customer.getCusName()));
                                tjRefundVo.setTjPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
                                tjRefundVo.setSex(String.valueOf(customer.getCusSex()));
                                tjRefundVo.setIdCard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                               if(null !=customer.getCusIdcard()) tjRefundVo.setIdCard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
                                DictComp dictComp = compService.getById(order.getFirmId());
                                if(null !=dictComp){
                                    tjRefundVo.setTjComp(dictComp.getCnName());
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjNewFlowingWaterController.java
New file
@@ -0,0 +1,252 @@
package com.ltkj.web.controller.system;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateUtil;
import cn.hutool.extra.pinyin.PinyinUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.common.core.domain.AjaxResult;
import com.ltkj.common.core.domain.entity.SysUser;
import com.ltkj.common.utils.SecurityUtils;
import com.ltkj.framework.config.MatchUtils;
import com.ltkj.hosp.domain.*;
import com.ltkj.hosp.service.*;
import com.ltkj.hosp.vodomain.NewFlowingWaterVo;
import com.ltkj.hosp.vodomain.TjCollectFeesVo;
import com.ltkj.mall.domain.MallCheckLog;
import com.ltkj.mall.domain.MallOrder;
import com.ltkj.mall.mallOrderUtils.TjConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @Company: 西安路泰科技有限公司
 * @Author: zjh
 * @Date: 2023/10/12 08:42
 */
@RestController
@RequestMapping("/hosp/new/water")
@Api(tags = "PC端 体检 新 登记收费功能接口")
public class TjNewFlowingWaterController {
    @Resource
    private ITjFlowingWaterService flowingWaterService;
    @Resource
    private ITjOrderService orderService;
    @Resource
    private ITjOrderDetailService detailService;
    @Resource
    private ITjTollCollectorService collectorService;
    @Resource
    private ITjTollCollectorDetailService collectorDetailService;
    @Resource
    private ITjCustomerService customerService;
    @Resource
    private ITjProjectService projectService;
    @Resource
    private ITjChargingStandardService chargingStandardService;
    @GetMapping("/getFlowingWaterList")
    @ApiOperation(value = "获取体检收费记录接口")
    public AjaxResult getFlowingWaterList(@RequestParam(required = false) @ApiParam(value = "体检号") String phone,
                                          @RequestParam(required = false) @ApiParam(value = "体检人姓名") String name,
                                          @RequestParam(defaultValue = "1") @ApiParam(value = "收费1 退费2") Long type) {
        List<TjFlowingWater> waterList =null;
        List<Long> collect =null;
        TjCustomer one =null;
        LambdaQueryWrapper<TjFlowingWater> wq1 = new LambdaQueryWrapper<>();
        if(null !=phone || null !=name){
            LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>();
            if(null !=name){
                wq.like(TjCustomer::getCusName,name);
            }
            if (null != phone) {
                wq.eq(TjCustomer::getCusPhone, phone);
            }
             one = customerService.getOne(wq);
        }
        if (null != one) {
            collect = orderService.getOrderList(one.getCusId()).stream().map(TjOrder::getOrderId).collect(Collectors.toList());
        }
        if(null !=collect){
            wq1.in(TjFlowingWater::getOrderId, collect);
        }
        wq1.between(TjFlowingWater::getCreateTime,DateUtil.beginOfDay(new Date()),DateUtil.endOfDay(new Date()));
        wq1.eq(TjFlowingWater::getPayStasus,type);
        waterList = flowingWaterService.list(wq1);
        if(null !=waterList && waterList.size()>0){
            for (TjFlowingWater flowingWater : waterList) {
                TjOrder order = orderService.getById(flowingWater.getOrderId());
                if (null != order) {
                    if (null != customerService.getById(order.getUserId())) {
                        flowingWater.setCustomer(customerService.getById(order.getUserId()));
                    }
                }
            }
        }
        return AjaxResult.success(waterList);
    }
    @GetMapping("/getTjPrice")
    @ApiOperation(value = "获取体检费用")
    public AjaxResult getTjPrice() {
        TjProject project = projectService.getOne(new LambdaQueryWrapper<TjProject>().eq(TjProject::getProName, "体检费")
                .eq(TjProject::getProId, 1712272744924446722L));
        if (null != project) {
            return AjaxResult.success(project.getProPrice());
        }
        return AjaxResult.error("没找到对应项目 请自定义费用");
    }
    /**
     * 体检签到登记接口
     */
    @PostMapping("/addOrderAndDetail")
    @ApiOperation(value = "体检收费接口")
    @Transactional
    public AjaxResult addOrderAndDetail(@RequestBody NewFlowingWaterVo vo) {
        if (!MatchUtils.isMobileNO(vo.getPhone())) {
            return AjaxResult.error("手机号格式有误!");
        }
//        Long cusId = null;
//        LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>();
//        wq.eq(TjCustomer::getCusName, vo.getName());
//        wq.eq(TjCustomer::getCusPhone, vo.getPhone());
//        TjCustomer one = customerService.getOne(wq);
//        if (null == one) {
            TjCustomer customer = new TjCustomer();
            if(null !=vo.getPhone())customer.setCusPhone(vo.getPhone());
            customer.setCusName(vo.getName());
            customer.setCusBrithday(new Date());
            customer.setCusSex(0L);
            customerService.save(customer);
//            cusId = customer.getCusId();
//        } else {
//            cusId = one.getCusId();
//        }
        TjOrder tjOrder = new TjOrder();
        tjOrder.setUserId(customer.getCusId());
        tjOrder.setTjType("2");
        //生成体检号
        String tjNumber = (SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmss").format(new Date()));
        tjOrder.setTjNumber(tjNumber);
        tjOrder.setFirmId("0");
        tjOrder.setStatus(TjConstants.TJ_BEGIN);
        if (orderService.save(tjOrder)) {
            LambdaQueryWrapper<TjFlowingWater> wq = new LambdaQueryWrapper<>();
            wq.eq(TjFlowingWater::getOrderId,tjOrder.getOrderId());
            wq.eq(TjFlowingWater::getPayStasus,1L);
            if(null !=flowingWaterService.getOne(wq)){
                return AjaxResult.error("该订单已缴费!");
            }
            TjOrderDetail detail = new TjOrderDetail();
            detail.setOrderId(tjOrder.getOrderId());
            detail.setProId(1712272744924446722L);
            detail.setProType("0");
            detailService.save(detail);
            TjFlowingWater tjFlowingWater = new TjFlowingWater();
            tjFlowingWater.setOrderId(tjOrder.getOrderId());
            tjFlowingWater.setPayType(Long.valueOf(vo.getType()));
            tjFlowingWater.setCopeWith(vo.getYs());
            tjFlowingWater.setPaidIn(vo.getSs());
            tjFlowingWater.setDiscount(vo.getZk());
            tjFlowingWater.setPayStasus(1L);
            Date date1 = new Date(System.currentTimeMillis());
            String s1 = SecurityUtils.getUsername() + new SimpleDateFormat("yyMMddHHmmssSSS").format(date1);
            tjFlowingWater.setWaterId(s1);
            tjFlowingWater.setRemarks("已收费");
            if (flowingWaterService.save(tjFlowingWater)) {
                tjOrder.setTjSerialNumber(String.valueOf(tjFlowingWater.getTjSerialNumber()));
                orderService.updateById(tjOrder);
                detail.setFlowingWaterId(tjFlowingWater.getWaterId());
                detailService.updateById(detail);
                TjChargingStandard tjChargingStandard = new TjChargingStandard();
                tjChargingStandard.setTjNum(tjOrder.getTjNumber());
                tjChargingStandard.setProId(1712272744924446722L);
                tjChargingStandard.setPrice(vo.getYs().divide(BigDecimal.valueOf(Long.parseLong(vo.getNumber()))));
                tjChargingStandard.setProName("体检项目");
                tjChargingStandard.setCount(Long.valueOf(vo.getNumber()));
                chargingStandardService.save(tjChargingStandard);
            }
            return AjaxResult.success();
        }
        return AjaxResult.error();
    }
    /**
     * 体检退费接口
     */
    @PostMapping("/tjRefund")
    @ApiOperation(value = "体检退费按钮接口")
    public AjaxResult tjRefund(@RequestBody @ApiParam(value = "流水对象") TjFlowingWater water) {
        TjFlowingWater flowingWater = flowingWaterService.getOne(new LambdaQueryWrapper<TjFlowingWater>().eq(TjFlowingWater::getWaterId, water.getWaterId()));
        LambdaQueryWrapper<TjFlowingWater> wq = new LambdaQueryWrapper<>();
        wq.eq(TjFlowingWater::getOrderId,flowingWater.getOrderId());
        wq.eq(TjFlowingWater::getPayStasus,2L);
        if(null !=flowingWaterService.getOne(wq)){
            return AjaxResult.error("该订单已退费  不可重复退费!");
        }
        TjFlowingWater tjFlowingWater=new TjFlowingWater();
        tjFlowingWater.setOrderId(flowingWater.getOrderId());
        tjFlowingWater.setWaterId(SecurityUtils.getUsername() + DateUtil.format(new Date(), "yyMMddHHmmssSSS"));
        tjFlowingWater.setTollCollectorId(String.valueOf(SecurityUtils.getLoginUser().getUserId()));
        tjFlowingWater.setRefundPersonId(String.valueOf(SecurityUtils.getLoginUser().getUserId()));
        tjFlowingWater.setRefundTime(new Date());
        tjFlowingWater.setRefundPrice(flowingWater.getPaidIn());
        tjFlowingWater.setIsAddition("N");
        tjFlowingWater.setPayStasus(2L);
        tjFlowingWater.setPaidIn(BigDecimal.valueOf(0.00).subtract(tjFlowingWater.getRefundPrice()));
        tjFlowingWater.setCopeWith(flowingWater.getCopeWith());
        tjFlowingWater.setRemarks("已退费");
        if (flowingWaterService.save(tjFlowingWater)) {
            flowingWater.setRemarks("已退费");
            flowingWaterService.updateById(flowingWater);
            TjOrder order = orderService.getById(tjFlowingWater.getOrderId());
            LambdaQueryWrapper<TjOrderDetail> wq1 = new LambdaQueryWrapper<>();
            wq1.eq(TjOrderDetail::getOrderId, tjFlowingWater.getOrderId());
            wq1.isNotNull(TjOrderDetail::getFlowingWaterId);
            List<TjOrderDetail> list = detailService.list(wq1);
            if (null != list && list.size() > 0) {
                for (TjOrderDetail orderDetail : list) {
                    orderDetail.setFlowingWaterId(null);
                    detailService.updateById(orderDetail);
                    LambdaQueryWrapper<TjChargingStandard> wqq = new LambdaQueryWrapper<>();
                    wqq.eq(TjChargingStandard::getTjNum, order.getTjNumber());
                    wqq.eq(TjChargingStandard::getProId, orderDetail.getProId());
                    chargingStandardService.remove(wqq);
                }
            }
            return AjaxResult.success("退费成功");
        }
        return AjaxResult.error();
    }
}
ltkj-admin/src/main/resources/application.yml
@@ -124,10 +124,14 @@
  header: Authorization
  # 令牌密钥
  secret: xaltjdkjyxgs_sjh&1987
  secret_key: ltkj_xaltjdkjsjh
  # 令牌有效期(默认30分钟)
  expireTime: 180
  # 是否允许账户多终端同时登录(true允许 false不允许)
  soloLogin: true
  #是否开启登录时判断商户秘钥是否过期
  secret_key_login: true
# MyBatis Plus配置
mybatis-plus:
ltkj-admin/src/test/java/zjhTest.java
@@ -1,11 +1,15 @@
import cn.hutool.core.date.DateUtil;
import com.ltkj.LtkjApplication;
import com.ltkj.common.core.redis.RedisCache;
import com.ltkj.common.utils.SecurityUtils;
import com.ltkj.hosp.domain.DictHosp;
import com.ltkj.hosp.service.*;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
@@ -14,6 +18,8 @@
import org.springframework.test.context.junit4.SpringRunner;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
/**
@@ -25,31 +31,39 @@
@Slf4j
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class})
public class zjhTest {
    @Autowired
    private ITjGroupingProService groupingProService;
    @Autowired
    private ITjProjectService projectService;
//
//    @Autowired
//    private ITjGroupingProService groupingProService;
//    @Autowired
//    private ITjProjectService projectService;
//
//    @Resource
//    private ITjOrderService tjOrderService;
//    @Resource
//    private ITjOrderDetailService tjOrderDetailService;
//    @Resource
//    private ITjOrderRemarkService remarkService;
//
//    @Resource
//    private RedisCache redisCache;
//
//    @Autowired
//    public RedisTemplate<String,String> redisTemplate;
//    @Resource
//    private StringRedisTemplate stringRedisTemplate;
    @Resource
    private ITjOrderService tjOrderService;
    @Resource
    private ITjOrderDetailService tjOrderDetailService;
    @Resource
    private ITjOrderRemarkService remarkService;
    @Resource
    private RedisCache redisCache;
    @Autowired
    public RedisTemplate<String,String> redisTemplate;
    @Resource
    private StringRedisTemplate stringRedisTemplate;
private IDictHospService dictHospService;
    @Value("${token.secret_key}")
    private String secret;
    @Test
    public void test() {
//        redisCache.setCacheObject("赵佳豪","hahahahaha");
//        log.info("嘿嘿!!!");
//        List<DictHosp> list = dictHospService.list();
//        for (DictHosp dictHosp : list) {
//            String mallMerchantSecretKey = SecurityUtils.getMallMerchantSecretKey(secret,dictHosp.getHospAreaId(),dictHosp.getAreaid(), dictHosp.getExpirationTime());
//            dictHosp.setSecretKey(mallMerchantSecretKey);
//            dictHosp.setExpirationTime(DateUtil.offsetDay(new Date(),30));
//            dictHospService.updateById(dictHosp);
//        }
    }
ltkj-common/src/main/java/com/ltkj/common/core/domain/model/LoginUser.java
@@ -77,6 +77,8 @@
     */
    private SysUser user;
    private String message;
    /*    */
    /**
@@ -96,6 +98,16 @@
    {
        this.wxUser = wxUser;
    }*/
    public String getMessage()
    {
        return message;
    }
    public void setMessage(String message)
    {
        this.message = message;
    }
    public Long getDeptId() {
        return deptId;
    }
ltkj-common/src/main/java/com/ltkj/common/exception/CustomException.java
New file
@@ -0,0 +1,41 @@
package com.ltkj.common.exception;
/**
 * 自定义异常
 */
public class CustomException extends RuntimeException
{
    private static final long serialVersionUID = 1L;
    private Integer code;
    private String message;
    public CustomException(String message)
    {
        this.message = message;
    }
    public CustomException(String message, Integer code)
    {
        this.message = message;
        this.code = code;
    }
    public CustomException(String message, Throwable e)
    {
        super(message, e);
        this.message = message;
    }
    @Override
    public String getMessage()
    {
        return message;
    }
    public Integer getCode()
    {
        return code;
    }
}
ltkj-common/src/main/java/com/ltkj/common/exception/user/SecretKeyException.java
New file
@@ -0,0 +1,43 @@
package com.ltkj.common.exception.user;
/**
 * @Company: 西安路泰科技有限公司
 * @Author: zjh
 * @Date: 2023/10/8 14:00
 */
public class SecretKeyException extends RuntimeException{
    private static final long serialVersionUID = 1L;
    private Integer code;
    private String message;
    public SecretKeyException(String message)
    {
        this.message = message;
    }
    public SecretKeyException(String message, Integer code)
    {
        this.message = message;
        this.code = code;
    }
    public SecretKeyException(String message, Throwable e)
    {
        super(message, e);
        this.message = message;
    }
    @Override
    public String getMessage()
    {
        return message;
    }
    public Integer getCode()
    {
        return code;
    }
}
ltkj-common/src/main/java/com/ltkj/common/utils/SecurityUtils.java
@@ -1,11 +1,17 @@
package com.ltkj.common.utils;
import cn.hutool.core.date.DateUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
import cn.hutool.crypto.symmetric.SymmetricCrypto;
import com.ltkj.common.constant.HttpStatus;
import com.ltkj.common.exception.ServiceException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import com.ltkj.common.core.domain.model.LoginUser;
import java.util.Date;
/**
 * 安全服务工具类
@@ -96,4 +102,28 @@
    public static boolean isAdmin(Long userId) {
        return userId != null && 1L == userId;
    }
    public static String getMallMerchantSecretKey(String secret,String certificateNumber, String number, Date date) {
        String secrets = SecureUtil.md5(secret);
        String certificateNumbers = SecureUtil.md5(certificateNumber);
        String taxNumber = SecureUtil.md5(number);
        String expirationTime = SecureUtil.md5(DateUtil.format(DateUtil.endOfDay(date),"yyyy-MM-dd HH:mm:ss"));
        //随机生成密钥
        SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, secret.getBytes());
        return aes.encryptHex(secrets+certificateNumbers+taxNumber+expirationTime);
    }
    public static boolean matchesMallMerchantSecretKey(String secret,String certificateNumber, String number, Date date,String ordSecretKey) {
        String secrets = SecureUtil.md5(secret);
        String certificateNumbers = SecureUtil.md5(certificateNumber);
        String taxNumber = SecureUtil.md5(number);
        String expirationTime = SecureUtil.md5(DateUtil.format(DateUtil.endOfDay(date),"yyyy-MM-dd HH:mm:ss"));
        SymmetricCrypto aes = new SymmetricCrypto(SymmetricAlgorithm.AES, secret.getBytes());
        String encryptHex = aes.encryptHex(secrets+certificateNumbers+taxNumber+expirationTime);
        if(encryptHex.equals(ordSecretKey)){
            return true;
        }
        return false;
    }
}
ltkj-framework/src/main/java/com/ltkj/framework/web/service/SysLoginService.java
@@ -2,16 +2,24 @@
import javax.annotation.Resource;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ltkj.common.constant.CacheConstants;
import com.ltkj.common.core.domain.entity.SysDept;
import com.ltkj.common.exception.CustomException;
import com.ltkj.common.exception.user.CaptchaException;
import com.ltkj.common.exception.user.CaptchaExpireException;
import com.ltkj.common.exception.user.SecretKeyException;
import com.ltkj.common.utils.*;
import com.ltkj.common.utils.sign.RsaUtils;
import com.ltkj.framework.config.JwtUtils;
import com.ltkj.framework.config.UserHoder;
import com.ltkj.hosp.domain.DictHosp;
import com.ltkj.hosp.domain.TjCustomer;
import com.ltkj.hosp.service.IDictHospService;
import com.ltkj.hosp.service.ITjCustomerService;
import com.ltkj.system.service.ISysDeptService;
import com.ltkj.system.service.ISysMenuService;
import com.ltkj.system.service.SysParametersDisposeService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -33,6 +41,7 @@
import com.ltkj.framework.security.context.AuthenticationContextHolder;
import com.ltkj.system.service.ISysUserService;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -60,13 +69,22 @@
    @Resource
    private ISysMenuService menuService;
    @Resource
    private IDictHospService hospService;
    @Autowired
    private ISysDeptService deptService;
    @Autowired
    private SysParametersDisposeService parametersDisposeService;
    // 是否允许账户多终端同时登录(true允许 false不允许)
    @Value("${token.soloLogin}")
    private boolean soloLogin;
    @Value("${token.secret_key}")
    private String secret;
    @Value("${token.secret_key_login}")
    private boolean secretKeyLogin;
    /**
@@ -116,6 +134,41 @@
        LoginUser loginUser = (LoginUser) authentication.getPrincipal();
        recordLoginInfo(Long.valueOf(loginUser.getUserId()));
        //校验商家过期否
        if (secretKeyLogin)
        {
            Long userId =loginUser.getUser().getUserId();
            SysUser user = userService.getById(userId);
            if(null !=user && null !=user.getDeptId()){
//                loginUser.getUser().setOrgId(user.getOrgId());
                if(!SecurityUtils.isAdmin(user.getUserId())){
                    SysDept sysDept = deptService.getById(user.getDeptId());
                    if (null != sysDept) {
                        DictHosp dictHosp = hospService.getById(sysDept.getHospId());
                        if(null !=dictHosp && dictHosp.getSecretKey() !=null && dictHosp.getExpirationTime() !=null){
                            if (!SecurityUtils.matchesMallMerchantSecretKey(secret,dictHosp.getHospAreaId(),dictHosp.getAreaid(),
                                    dictHosp.getExpirationTime(),dictHosp.getSecretKey())) {
                                throw new SecretKeyException("商家已过期请续费使用");
                            }
                            long between = DateUtil.between(new Date(), DateUtil.endOfDay(dictHosp.getExpirationTime()), DateUnit.DAY);
                            if(between<=30){
                                loginUser.setMessage("还有 "+between+" 天到期 请注意续费! 以免影响正常使用!");
                            }else {
                                loginUser.setMessage(null);
                            }
                        }else {
                            throw new SecretKeyException("请缴费使用");
                        }
                    }
                }
            }else {
                throw new CustomException("请绑定商家");
            }
        }
//       限制账户不允许多终端登录
        if (!soloLogin) {
            // 如果用户不允许多终端同时登录,清除缓存信息
ltkj-hosp/src/main/java/com/ltkj/hosp/domain/DictHosp.java
@@ -167,6 +167,12 @@
    @ApiModelProperty(value = "图片")
    private String imgbase64;
    //秘钥
    private String secretKey;
    //到期时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date expirationTime;
    @Override
    public String toString() {
ltkj-hosp/src/main/java/com/ltkj/hosp/domain/TjFlowingWater.java
@@ -165,6 +165,8 @@
    @ApiModelProperty(value = "是否结账")
    private String isCheckout;
    private String remarks;
    @Override
    public String toString() {
ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjOrderMapper.java
@@ -75,7 +75,8 @@
    public int deleteTjOrderByOrderIds(Long[] orderIds);
    List<TjOrder> getOrderList(Integer cusId);
    @Select(" select * from tj_order where 1 = 1 and deleted=0  and user_id = #{cusId}")
    List<TjOrder> getOrderList(Long cusId);
    List<TjOrder> getOrderList1();
ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjOrderService.java
@@ -77,7 +77,7 @@
     * @param cusId
     * @return
     */
    public List<TjOrder> getOrderList(Integer cusId);
    public List<TjOrder> getOrderList(Long cusId);
    public List<TjOrder> getOrderList1();
ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjOrderServiceImpl.java
@@ -143,7 +143,7 @@
    }
    @Override
    public List<TjOrder> getOrderList(Integer cusId) {
    public List<TjOrder> getOrderList(Long cusId) {
        return tjOrderMapper.getOrderList(cusId);
    }
ltkj-hosp/src/main/java/com/ltkj/hosp/vodomain/NewFlowingWaterVo.java
New file
@@ -0,0 +1,42 @@
package com.ltkj.hosp.vodomain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @Company: 西安路泰科技有限公司
 * @Author: zjh
 * @Date: 2023/10/12 09:49
 */
@Data
public class NewFlowingWaterVo {
    //姓名
    private String name;
    //手机号
    private String phone;
    //体检项目
    private String tjPro;
    //数量
    private String number;
    //应收
    private BigDecimal ys;
    //折扣
    private String zk;
    //实收
    private BigDecimal ss;
    //付款类型
    private String type;
}
ltkj-hosp/src/main/resources/mapper/hosp/TjOrderMapper.xml
@@ -281,7 +281,7 @@
    </delete>
    <select id="getOrderList" parameterType="Integer" resultMap="TjOrderResult">
    <select id="getOrderList" parameterType="java.lang.Long" resultMap="TjOrderResult">
        select *
        from tj_order
        where 1 = 1