This commit is contained in:
sxu 2025-02-01 11:50:03 +08:00
parent 5e72852426
commit 4b5d194d99
19 changed files with 34 additions and 432 deletions

View File

@ -1,8 +1,8 @@
package net.xnzn.core.notice.notice.v2.api;
package net.xnzn.api;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.common.redis.service.RedisService;
import net.xnzn.core.merchant.dto.SmsCodeVerifyDTO;
import net.xnzn.domain.SmsCodeVerifyDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

View File

@ -1,4 +1,4 @@
package net.xnzn.core.merchant.dto;
package net.xnzn.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

View File

@ -2,6 +2,7 @@ package com.bonus.auth;
import com.bonus.common.security.annotation.EnableCustomConfig;
import com.bonus.common.swagger.annotation.EnableCustomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;

View File

@ -2,6 +2,7 @@ package com.bonus.auth.controller;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.util.IdUtil;
import net.xnzn.api.SmsCodeApi;
import net.xnzn.constant.CustLoginTypeEnum;
import net.xnzn.constant.DelFlagEnum;
import net.xnzn.constant.LeConstants;
@ -12,6 +13,7 @@ import com.bonus.auth.form.LoginBody;
import com.bonus.auth.mapper.CustCasualMapper;
import com.bonus.auth.mapper.CustInfoMapper;
import com.bonus.auth.service.*;
import net.xnzn.domain.SmsCodeVerifyDTO;
import net.xnzn.utils.AesEncryptUtil;
import net.xnzn.utils.Id;
import net.xnzn.utils.SM4EncryptUtils;
@ -66,6 +68,10 @@ public class TokenController {
@Resource
private RemoteConfigService configService;
@Autowired
@Lazy
private SmsCodeApi smsCodeApi;
@Autowired
private CustInfoMapper custInfoMapper;
@ -119,17 +125,17 @@ public class TokenController {
} else if (CustLoginTypeEnum.TEL_PWD.key().equals(content.getLoginType())) {
custInfo.setMobile(SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile()));
} else if (CustLoginTypeEnum.TEL_CODE.key().equals(content.getLoginType())) {
// SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO();
// smsCodeVerifyDTO.setCode(content.getCode());
// smsCodeVerifyDTO.setTelephoneNumber(content.getMobile());
// boolean flag = this.smsCodeApi.verifySmsCode(smsCodeVerifyDTO);
// if (!flag) {
// throw new ServiceException("验证码错误");
// }
R<?> result = sysLoginService.getPhoneCode(content.getMobile(), content.getVerificationCodeType());
if (result.getCode() != 200) {
SmsCodeVerifyDTO smsCodeVerifyDTO = new SmsCodeVerifyDTO();
smsCodeVerifyDTO.setCode(content.getCode());
smsCodeVerifyDTO.setTelephoneNumber(content.getMobile());
boolean flag = this.smsCodeApi.verifySmsCode(smsCodeVerifyDTO);
if (!flag) {
throw new ServiceException("验证码错误");
}
// R<?> result = sysLoginService.getPhoneCode(content.getMobile(), content.getVerificationCodeType());
// if (result.getCode() != 200) {
// throw new ServiceException("验证码错误");
// }
custInfo.setMobile(SM4EncryptUtils.sm4Encryptbyconfig(content.getMobile()));
} else {
if (!CustLoginTypeEnum.ID_CARD_PWD.key().equals(content.getLoginType())) {

View File

@ -1,5 +1,5 @@
package com.bonus.auth.form;
public enum LoginType {
PASSWORD, MOBILE
}
//package com.bonus.auth.form;
//
//public enum LoginType {
// PASSWORD, MOBILE
//}

View File

@ -3,6 +3,7 @@ package net.xnzn.core;
import com.bonus.common.security.annotation.EnableCustomConfig;
import com.bonus.common.security.annotation.EnableRyFeignClients;
import com.bonus.common.swagger.annotation.EnableCustomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@ -18,6 +19,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@EnableRyFeignClients
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@MapperScan("net.xnzn.core")
public class BonusSmartCanteenApplication
{
public static void main(String[] args)

View File

@ -2,12 +2,14 @@ package net.xnzn.core.customer.api;
import net.xnzn.core.customer.service.CustCasualRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@Service
public class CustCasualApi {
@Autowired
@Lazy
private CustCasualRelationService custCasualRelationService;

View File

@ -4,6 +4,7 @@ import net.xnzn.constant.LeConstants;
import net.xnzn.core.customer.mapper.CustCasualRelationMapper;
import net.xnzn.core.customer.model.CustCasualRelation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -11,7 +12,8 @@ import javax.annotation.Resource;
@Service
public class CustCasualRelationService {
@Resource
@Autowired
@Lazy
private CustCasualRelationMapper custCasualRelationMapper;
public void updateBycustIdAndOpenid(Long custId, String openId) {

View File

@ -2,22 +2,20 @@ package net.xnzn.core.customer.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.bonus.common.core.exception.ServiceException;
import net.xnzn.api.SmsCodeApi;
import net.xnzn.constant.RetCodeEnum;
import net.xnzn.core.customer.api.CustCasualApi;
import net.xnzn.core.customer.constants.PersonalStatusEnum;
import net.xnzn.core.customer.dto.CustChangePasswordDTO;
import net.xnzn.core.customer.dto.CustForgetPasswordDTO;
import net.xnzn.core.customer.mapper.CustInfoMapper;
import net.xnzn.core.customer.service.*;
import net.xnzn.core.merchant.dto.SmsCodeVerifyDTO;
import net.xnzn.core.notice.notice.v2.api.SmsCodeApi;
import net.xnzn.domain.SmsCodeVerifyDTO;
import net.xnzn.domain.CustInfo;
import net.xnzn.utils.AesEncryptUtil;
import net.xnzn.utils.SM4EncryptUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

View File

@ -1,150 +0,0 @@
package net.xnzn.core.pay.controller;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.AlipayConfig;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.domain.AlipayTradeWapPayModel;
import com.alipay.api.request.AlipayTradeWapPayRequest;
import com.alipay.api.response.AlipayTradeWapPayResponse;
import com.bonus.common.core.web.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.xnzn.core.pay.domain.CustQueryDTO;
import net.xnzn.core.pay.service.IPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static com.bonus.common.core.web.domain.AjaxResult.success;
@RestController
@RequestMapping({"/leopen"})
@Slf4j
public class PayController {
@Value("${alipay.URL}")
private String URL;
@Value("${alipay.APPID}")
private String APPID;
@Value("${alipay.PID}")
private String PID;
@Value("${alipay.PRIVATE_KEY}")
private String PRIVATE_KEY;
@Value("${alipay.FORMAT}")
private String FORMAT;
@Value("${alipay.CHARSET}")
private String CHARSET;
@Value("${alipay.SIGN_TYPE}")
private String SIGN_TYPE;
@Value("${alipay.ALIPAY_PUBLIC_KEY}")
private String ALIPAY_PUBLIC_KEY;
@Autowired
IPayService payService;
/**
* 获取订单详细信息
*/
@ApiOperation(value = "获取支付二维码")
@PostMapping(value = "/getOrderQRCode")
public AjaxResult getOrderQRCode(@RequestBody CustQueryDTO custQueryDTO) {
return success(payService.getOrderQRCode("1", String.valueOf(custQueryDTO.getCustId())));
}
// @ApiOperation("钱包余额查询")
// @PostMapping({"/account/balance/query"})
// public String getBalanceQuery(@RequestBody PayResDTO payResDTO) {
//
// String api = siteurl + "/tengyun-api/leopen/account/balance/query";
// HashMap<String, Object> bodyMap = (HashMap<String, Object>) LeniuApiUtil.convertObjectToMap(payResDTO);
// return LeniuApiUtil.callLeniuApi(api, bodyMap).body();
// }
//
// @ApiOperation("钱包充值")
// @PostMapping({"/account/charge"})
// public String getAccountCharge(@RequestBody RechargeResDTO rechargeResDTO) {
// rechargeResDTO.setThirdRechargeNum(StringUtil.generateRandomString(18));
//
// String api = siteurl + "/tengyun-api/leopen/account/charge";
// HashMap<String, Object> bodyMap = (HashMap<String, Object>) LeniuApiUtil.convertObjectToMap(rechargeResDTO);
// //支付宝进行支付
// AlipayTradeWapPayModel model = new AlipayTradeWapPayModel();
// model.setOutTradeNo(rechargeResDTO.getThirdRechargeNum());//商户订单号
// model.setTotalAmount(rechargeResDTO.getRechargeAmount().toString());//订单总金额
// model.setSubject("充值");//订单标题
// model.setProductCode("QUICK_WAP_WAY");//产品码
// model.setSellerId(PID);//卖家支付宝 Id
// AlipayTradeWapPayResponse response = getPayGoods(model);
// if (response.isSuccess()) {
// System.err.println("调用成功");
// return LeniuApiUtil.callLeniuApi(api, bodyMap).body();
// } else {
// System.err.println("调用失败");
// // sdk 版本是"4.38.0.ALL"及以上,可以参考下面的示例获取诊断链接
// // String diagnosisUrl = DiagnosisUtils.getDiagnosisUrl(response);
// // System.out.println(diagnosisUrl); }
// return "充值失败";
// }
//
// }
//
//
// @ApiOperation("下单支付(食堂)")
// @PostMapping({"/pay/device"})
// public String getPayDevice(@RequestBody PayDeviceDTO payDeviceDTO) {
//
// String api = siteurl + "/tengyun-api/leopen/pay/device";
// HashMap<String, Object> bodyMap = (HashMap<String, Object>) LeniuApiUtil.convertObjectToMap(payDeviceDTO);
// return LeniuApiUtil.callLeniuApi(api, bodyMap).body();
// }
public AlipayTradeWapPayResponse getPayGoods(AlipayTradeWapPayModel model) {
try {
AlipayConfig alipayConfig = new AlipayConfig();
//设置网关地址
alipayConfig.setServerUrl(URL);
//设置应用ID
alipayConfig.setAppId(APPID);
//设置应用私钥
alipayConfig.setPrivateKey(PRIVATE_KEY);
//设置请求格式固定值json
alipayConfig.setFormat(FORMAT);
//设置字符集
alipayConfig.setCharset(CHARSET);
//设置签名类型
alipayConfig.setSignType(SIGN_TYPE);
//设置支付宝公钥
alipayConfig.setAlipayPublicKey(ALIPAY_PUBLIC_KEY);
AlipayClient alipayClient = new DefaultAlipayClient(alipayConfig);
AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest();
request.setBizModel(model);
AlipayTradeWapPayResponse response = alipayClient.pageExecute(request, "POST");
// 如果需要返回GET请求请使用
// AlipayTradeWapPayResponse response = alipayClient.pageExecute(request, "GET");
String pageRedirectionData = response.getBody();
System.err.println(pageRedirectionData);
return response;
/* if (response.isSuccess()) {
System.out.println("调用成功");
} else {
System.out.println("调用失败");
// sdk版本是"4.38.0.ALL"及以上,可以参考下面的示例获取诊断链接
// String diagnosisUrl = DiagnosisUtils.getDiagnosisUrl(response);
// System.out.println(diagnosisUrl);
}*/
} catch (AlipayApiException e) {
e.printStackTrace();
log.info("充值链接支付宝错误信息为: " + e);
return null;
}
}
}

View File

@ -1,43 +0,0 @@
package net.xnzn.core.pay.domain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Max;
import java.time.LocalDateTime;
@ApiModel("查询人员信息入参")
@Data
public class CustListQueryDTO {
@ApiModelProperty("页号")
private Integer pageNum;
@ApiModelProperty("页长")
private @Max(
value = 200L,
message = "页长最大200"
) Integer pageSize;
@ApiModelProperty("更新时间-起点时间")
private LocalDateTime startDateTime;
@ApiModelProperty("更新时间-终点时间")
private LocalDateTime endDateTime;
@ApiModelProperty("人员id")
private Long custId;
@ApiModelProperty("第三方人员id")
private String custThirdId;
@ApiModelProperty("人员编号")
private String custNum;
@ApiModelProperty("组织编号")
private String orgNum;
@ApiModelProperty("卡物理号")
private String serialNum;
@ApiModelProperty("手机号")
private String mobile;
@ApiModelProperty("身份证号")
private String idCard;
@ApiModelProperty("人员状态")
private Integer custState;
@ApiModelProperty("微信openid")
private String wechatOpenid;
}

View File

@ -1,53 +0,0 @@
package net.xnzn.core.pay.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class CustQueryDTO {
@ApiModelProperty("起点时间")
private LocalDateTime startDateTime;
@ApiModelProperty("终点时间")
private LocalDateTime endDateTime;
@ApiModelProperty("页号")
private Integer pageNum;
@ApiModelProperty("页长")
private Integer pageSize;
@ApiModelProperty("第三方人员id")
private String custThirdId;
@ApiModelProperty("人员编号")
private String custNum;
@ApiModelProperty("组织编号")
private String orgNum;
@ApiModelProperty("卡物理号")
private String serialNum;
@ApiModelProperty("手机号")
private String mobile;
@ApiModelProperty("身份证号")
private String idCard;
@ApiModelProperty("人员状态")
private Integer custState;
@ApiModelProperty("微信openid")
private String wechatOpenid;
@ApiModelProperty("custId")
private Long custId;
public CustListQueryDTO ofCustListQueryDTO(Long custId) {
CustListQueryDTO custListQueryDTO = new CustListQueryDTO();
custListQueryDTO.setCustId(custId);
custListQueryDTO.setCustState(this.custState);
custListQueryDTO.setCustNum(this.custNum);
custListQueryDTO.setMobile(this.mobile);
custListQueryDTO.setIdCard(this.idCard);
custListQueryDTO.setPageNum(this.pageNum);
custListQueryDTO.setPageSize(this.pageSize);
custListQueryDTO.setStartDateTime(this.startDateTime);
custListQueryDTO.setEndDateTime(this.endDateTime);
custListQueryDTO.setSerialNum(this.serialNum);
custListQueryDTO.setWechatOpenid(this.wechatOpenid);
return custListQueryDTO;
}
}

View File

@ -1,18 +0,0 @@
package net.xnzn.core.pay.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class OrdDetailDTO {
@ApiModelProperty("商品类型 1菜品 2商品 3套餐 4按键金额")
private Number detailType;
@ApiModelProperty("商品名称")
private String goodsName;
@ApiModelProperty("价格")
private Number price;
@ApiModelProperty("数量/重量")
private Number quantity;
}

View File

@ -1,50 +0,0 @@
package net.xnzn.core.pay.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.time.LocalDate;
import java.util.List;
@Data
public class PayDeviceDTO {
@ApiModelProperty("订单总金额 单位为分")
private Number amount;
@ApiModelProperty("二维码信息(小牛系统个人身份码) 扫码支付必传")
private String authCode;
@ApiModelProperty("人员id (身份支付二选一必填)")
private Long custId;
@ApiModelProperty("第三方人员id (身份支付二选一必填)")
private String custThirdId;
@ApiModelProperty("乐牛餐次号(默认使用ordTime所在餐次)")
private Number intervalId;
@ApiModelProperty("第三方订单流水号")
private String macOrdId;
@ApiModelProperty("乐牛设备SN码由该商户管理员在乐牛后台创建供open接口使用的设备虚拟设备提供设备sn号此设备若被删除则无法调用建议起名【open支付专用设备-xxx对接】")
private String machineSn;
@ApiModelProperty("核身方式 (1刷卡,2身份,3扫码)")
private Number nuClearMode;
@ApiModelProperty("下单时间 yyyy-MM-dd HH:mm:ss")
private String ordTime;
@ApiModelProperty("订单类型 1食堂 2商城10外部预定对支付过程不影响只是记录类型")
private Number ordType;
@ApiModelProperty("配送方式 1:自取堂食,2:商家配送,5:取餐柜配送,6:自取外带,7:取餐点配送")
private String deliveryType;
@ApiModelProperty("取餐柜id配送方式为5时必填")
private Number counterId;
@ApiModelProperty("配送费")
private Number deliveryFee;
@ApiModelProperty("支付方式")
private Number payType;
@ApiModelProperty("配送地址")
private String deliveryAddr;
@ApiModelProperty("订单备注")
private String remark;
@ApiModelProperty("预定日期仅在ordType=10时有效")
private LocalDate reserveDate;
@ApiModelProperty("卡序列号(物理卡号) 刷卡支付必传")
private String serialNum;
@ApiModelProperty("订单详情")
private List<OrdDetailDTO> ordDetailList;
}

View File

@ -1,14 +0,0 @@
package net.xnzn.core.pay.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class PayResDTO {
@ApiModelProperty("人员id (以此为唯一标识)custId和custThirdId二选一")
private Long custId;
@ApiModelProperty("第三方人员id")
private String custThirdId;
}

View File

@ -1,40 +0,0 @@
package net.xnzn.core.pay.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class RechargeResDTO {
/**
* 账户交易类型 (支付渠道+支付方式为一组) 二者选择一个 账户交易类型存在值 优先走账户交易类型
*/
@ApiModelProperty("账户交易类型 8微信扫码充值 9支付宝扫码充值 10现金充值")
private Integer accTradeType;
@ApiModelProperty("钱包类型 1个人钱包2补贴钱包")
private Integer accType;
/**
* custId和custThirdId二选一
*/
@ApiModelProperty("人员id (以此为唯一标识)")
private Long custId;
/**
* custId和custThirdId二选一
*/
@ApiModelProperty("第三方人员id (以此为唯一标识)")
private String custThirdId;
@ApiModelProperty("支付渠道(详情见支付渠道code-名称对照表)")
private Integer payChannel;
@ApiModelProperty("支付方式(详情见支付方式code-名称对照表)")
private Integer payType;
@ApiModelProperty("充值金额(单位分)")
private Integer rechargeAmount;
@ApiModelProperty("充值备注")
private String remark;
@ApiModelProperty("第三方充值订单号")
private String thirdRechargeNum;
}

View File

@ -1,12 +0,0 @@
package net.xnzn.core.pay.service;
/**
* Service接口
*
* @author xsheng
* @date 2025-01-14
*/
public interface IPayService {
public String getOrderQRCode(String sourceType, String paramValue);
}

View File

@ -1,29 +0,0 @@
package net.xnzn.core.pay.service.impl;
import net.xnzn.constant.LeCodeUseSceneEnum;
import net.xnzn.core.pay.service.IPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 订单Service业务层处理
*
* @author xsheng
* @date 2025-01-14
*/
@Service
public class PayServiceImpl implements IPayService {
/**
* 支付二维码
*
* @param sourceType
* @param paramValue
* @return 结果
*/
@Override
public String getOrderQRCode(String sourceType, String paramValue) {
String stime = String.valueOf(System.currentTimeMillis() / 1000L);
return "xnzn{\"s\":" + sourceType + ",\"y\":" + LeCodeUseSceneEnum.PAY.key() + ",\"p\":\"" + paramValue + "\",\"t\":" + stime + "}";
}
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<module version="4">
<component name="AdditionalModuleElements">
<content url="file://$MODULE_DIR$" dumb="true">
<excludeFolder url="file://$MODULE_DIR$/target" />