202506241715

This commit is contained in:
张潘 2025-06-24 17:15:20 +08:00
parent cf1bf2609d
commit 74257caefe
25 changed files with 1100 additions and 397 deletions

View File

@ -13,11 +13,10 @@ ruoyi:
# 验证码类型 math 数字计算 char 字符验证
captchaType: math
wechat:
pay:
app-id: wx73d0202b3c8a6d68
mch-id: 1672571923
api-key: sssssssssssssssssssssssssssssssS
cert-path: wechat/apiclient_cert.p12
appid: wx73d0202b3c8a6d68
mchid: 1672571923
apikey: sssssssssssssssssssssssssssssssS
certpath: wechat/apiclient_cert.p12
# 七牛云配置
qiniu:
# 是否启用七牛云上传 true-启用七牛云 false-使用本地上传

View File

@ -0,0 +1,46 @@
package com.ruoyi.system.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "wechat")
public class WechatConfig {
private String appid;
private String mchid;
private String apikey;
private String certpath;
public String getAppid() {
return appid;
}
public void setAppid(String appid) {
this.appid = appid;
}
public String getMchid() {
return mchid;
}
public void setMchid(String mchid) {
this.mchid = mchid;
}
public String getApikey() {
return apikey;
}
public void setApikey(String apikey) {
this.apikey = apikey;
}
public String getCertpath() {
return certpath;
}
public void setCertpath(String certpath) {
this.certpath = certpath;
}
}

View File

@ -1,10 +1,15 @@
package com.ruoyi.system.controller;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.system.ControllerUtil.WorkerApplyUtil;
import com.ruoyi.system.domain.Users;
import com.ruoyi.system.domain.WorkerLevel;
import com.ruoyi.system.service.IUsersService;
import com.ruoyi.system.service.IWorkerLevelService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -38,6 +43,9 @@ public class WorkerApplyController extends BaseController
private IWorkerApplyService workerApplyService;
@Autowired
private IUsersService usersService;
@Autowired
private IWorkerLevelService workerLevelService;
/**
* 查询师傅申请记录列表
*/
@ -97,8 +105,66 @@ for(WorkerApply data:list){
@PreAuthorize("@ss.hasPermi('system:WorkerApply:edit')")
@Log(title = "师傅申请记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WorkerApply workerApply)
{
public AjaxResult edit(@RequestBody WorkerApply workerApply) throws Exception {
WorkerApply oldworkerApply=workerApplyService.selectWorkerApplyById(workerApply.getId());
if (oldworkerApply.getStatus()==1){
return error("该条数据已被处理为师傅,不允许重复提交");
}
if (workerApply.getImage()==null){
return error("请上传电子照片");
}
if (workerApply.getCardNo()==null){
return error("身份证号不能为空");
}
if (workerApply.getName()==null){
return error("真是姓名不能为空");
}
if (workerApply.getPhone()==null){
return error("手机号码不能为空");
}
//同意师傅申请
if (workerApply.getStatus()==1){
Users users = usersService.selectUsersById(workerApply.getUid());
//查询最低的师傅级别进行赋值
WorkerLevel workerLevel = workerLevelService.selectWorkerLevelByLevel(1L);
//工号
int jobnumber=0;
Users usersMax =usersService.selectUsersIsMaxNumber() ;
if (usersMax!=null){
jobnumber=usersMax.getJobNumber()+1;
}
//已经是师傅了就不用处理
if(!users.getType().equals("2")){
users.setType("2");
users.setCommission(new BigDecimal("0.00"));
users.setTotalComm(new BigDecimal("0.00"));
users.setMargin(new BigDecimal("0.00"));
users.setProhibitTimeNum(0);
users.setIsWork(1);
users.setLevel(Math.toIntExact(workerLevel.getLevel()));
users.setJobNumber(jobnumber);
users.setServiceCityIds(workerApply.getCityIds());
users.setSkillIds(workerApply.getSkillId());
users.setServiceCityPid(workerApply.getCityPid());
usersService.updateUsers(users);
Map verifyResult =WorkerApplyUtil.virtualVerify(workerApply.getImage(),
workerApply.getPhone(),
workerApply.getCardNo(),
workerApply.getName(),
"",//回调地址暂时不用写等需要的时候再去写吧
"https://img.huafurenjia.cn/",//七牛云的地址
"https://101.37.133.245:11008/voice/1.0.0/");//"实名API地址"
System.out.println("34344334电子照片" + verifyResult.get("message"));
System.out.println("34344334电子照片" + verifyResult.get("result"));
if (!"000000".equals(verifyResult.get("result"))) {
System.out.println("电子照片" + verifyResult.get("message"));
}
}
}
return toAjax(workerApplyService.updateWorkerApply(workerApply));
}

View File

@ -0,0 +1,76 @@
package com.ruoyi.system.ControllerUtil;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.ruoyi.system.service.ICouponUserService;
import com.ruoyi.system.service.ICouponsService;
import com.ruoyi.system.domain.Coupons;
import com.ruoyi.system.domain.CouponUser;
public class CouponUtil {
public static List<Coupons> iscoupon(Long uid, ICouponsService couponsService, ICouponUserService couponUserService){
Map<String,Object> map=new HashMap<>();
List<Coupons> canReceiveList = new java.util.ArrayList<>();
long now = System.currentTimeMillis() / 1000; // 当前时间戳
// 1. 查询所有可领取的手动领取优惠券type=2status=1
Coupons couponsQuery = new Coupons();
couponsQuery.setStatus(1L); // 启用
couponsQuery.setType(2L); // 手动领取
List<Coupons> allCanReceive = couponsService.selectCouponsList(couponsQuery);
// 2. 查询用户已领取的优惠券
CouponUser userQuery = new CouponUser();
userQuery.setUid(uid);
List<CouponUser> userCouponList = couponUserService.selectCouponUserList(userQuery);
java.util.Set<Long> receivedCouponIds = new java.util.HashSet<>();
for (CouponUser cu : userCouponList) {
if (cu.getCouponId() != null) {
receivedCouponIds.add(cu.getCouponId());
}
}
// 3. 过滤掉已领取的和已过期的
for (Coupons coupon : allCanReceive) {
// 计算过期时间
long expireTime = (coupon.getEndTime() != null ? coupon.getEndTime() : 0L) + (coupon.getCouponTime() != null ? coupon.getCouponTime() * 24 * 60 * 60 : 0L);
if (expireTime > 0 && expireTime < now) {
// 已过期设置为关闭
coupon.setStatus(0L);
couponsService.updateCoupons(coupon);
continue;
}
if (coupon.getCount() != null && coupon.getCount() > 0 && !receivedCouponIds.contains(coupon.getId())) {
canReceiveList.add(coupon);
}
}
// 4. 判断是否已领取过新人券假设新人券type=3或有特殊标记
Coupons newUserCouponQuery = new Coupons();
newUserCouponQuery.setStatus(1L);
newUserCouponQuery.setType(3L); // 新人券类型
List<Coupons> newUserCoupons = couponsService.selectCouponsList(newUserCouponQuery);
boolean hasNewUserCoupon = false;
for (CouponUser cu : userCouponList) {
for (Coupons nc : newUserCoupons) {
if (cu.getCouponId() != null && cu.getCouponId().equals(nc.getId())) {
hasNewUserCoupon = true;
break;
}
}
if (hasNewUserCoupon) break;
}
// 5. 如果没领过新人券把新人券加进来也要判断新人券是否过期
for (Coupons nc : newUserCoupons) {
long expireTime = (nc.getEndTime() != null ? nc.getEndTime() : 0L) + (nc.getCouponTime() != null ? nc.getCouponTime() * 24 * 60 * 60 : 0L);
if (expireTime > 0 && expireTime < now) {
nc.setStatus(0L);
couponsService.updateCoupons(nc);
continue;
}
if (!hasNewUserCoupon) {
canReceiveList.add(nc);
}
}
return canReceiveList;
}
}

View File

@ -1,6 +1,9 @@
package com.ruoyi.system.ControllerUtil;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.config.QiniuConfig;
import com.ruoyi.system.config.WechatConfig;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@ -12,11 +15,11 @@ import org.springframework.stereotype.Component;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.cert.*;
import java.text.SimpleDateFormat;
import java.util.*;
@ -49,17 +52,24 @@ public class WechatPayUtil {
* wechat.pay.api-key=xxx
* wechat.pay.cert-path=xxx
*/
@Value("${wechat.pay.app-id}")
private String wechatAppId;
// @Value("${wechat.pay.app-id}")
// private String wechatAppId;
//
// @Value("${wechat.pay.mch-id}")
// private String wechatMchId;
//
// @Value("${wechat.pay.api-key}")
// private String wechatApiKey;
//
// @Value("/wechat/apiclient_cert.p12")
// private String wechatCertPath;
@Value("${wechat.pay.mch-id}")
private String wechatMchId;
@Value("${wechat.pay.api-key}")
private String wechatApiKey;
@Value("${wechat.pay.cert-path}")
private String wechatCertPath;
/**
* 获取七牛云配置
*/
private static WechatConfig wechatConfig() {
return SpringUtils.getBean(WechatConfig.class);
}
/**
* 微信支付API地址仅保留小程序相关接口
@ -131,8 +141,8 @@ public class WechatPayUtil {
// 2. 构建参数
Map<String, String> params = new HashMap<>();
params.put("appid", wechatAppId);
params.put("mch_id", wechatMchId);
params.put("appid", wechatConfig().getAppid());
params.put("mch_id", wechatConfig().getMchid());
String nonceStr = generateNonceStr();
params.put("nonce_str", nonceStr);
params.put("body", body);
@ -147,7 +157,7 @@ public class WechatPayUtil {
}
// 3. 生成签名
String sign = generateSign(params, wechatApiKey);
String sign = generateSign(params, wechatConfig().getApikey());
params.put("sign", sign);
// 4. 发送请求
@ -207,8 +217,8 @@ public class WechatPayUtil {
return failResult("订单号和微信订单号不能同时为空");
}
Map<String, String> params = new HashMap<>();
params.put("appid", wechatAppId);
params.put("mch_id", wechatMchId);
params.put("appid", wechatConfig().getAppid());
params.put("mch_id", wechatConfig().getMchid());
params.put("nonce_str", generateNonceStr());
if (orderNo != null && !orderNo.trim().isEmpty()) {
params.put("out_trade_no", orderNo.trim());
@ -216,7 +226,7 @@ public class WechatPayUtil {
if (transactionId != null && !transactionId.trim().isEmpty()) {
params.put("transaction_id", transactionId.trim());
}
String sign = generateSign(params, wechatApiKey);
String sign = generateSign(params, wechatConfig().getApikey());
params.put("sign", sign);
String xmlRequest = mapToXml(params);
@ -269,7 +279,7 @@ public class WechatPayUtil {
// 2. 解析XML数据
Map<String, String> notifyData = xmlToMap(xmlData.toString());
// 3. 验证签名
if (!verifySign(notifyData, wechatApiKey)) {
if (!verifySign(notifyData, wechatConfig().getApikey())) {
return failResult("签名验证失败");
}
// 4. 检查支付结果
@ -316,7 +326,7 @@ public class WechatPayUtil {
Map<String, String> params = buildRefundParams(refundInfo);
// 3. 生成签名
String sign = generateSign(params, wechatApiKey);
String sign = generateSign(params, wechatConfig().getApikey());
params.put("sign", sign);
// 4. 发送请求需要证书
@ -377,17 +387,24 @@ public class WechatPayUtil {
Map<String, String> params = buildTransferParams(transferInfo);
// 3. 生成签名
String sign = generateSign(params, wechatApiKey);
String sign = generateSign(params, wechatConfig().getApikey());
params.put("sign", sign);
// 设置请求头指定字符编码为UTF-8
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", "application/xml;charset=UTF-8");
headers.set("Accept", "application/xml;charset=UTF-8");
headers.set("User-Agent", "Mozilla/5.0");
// 4. 发送请求需要证书
String xmlRequest = mapToXml(params);
// HttpEntity<String> requestEntity = new HttpEntity<>(xmlRequest, headers);
// 注意企业付款接口需要使用客户端证书这里简化处理
ResponseEntity<String> response = restTemplate.postForEntity(WECHAT_TRANSFER_URL, xmlRequest, String.class);
String resourcePath = getClass().getClassLoader().getResource(wechatConfig().getCertpath()).getPath();
ResponseEntity<String> response = restTemplate.postForEntity(WECHAT_TRANSFER_URL, xmlRequest,String.class, resourcePath);
// 5. 解析响应
Map<String, String> responseMap = xmlToMap(response.getBody());
if (SUCCESS_CODE.equals(responseMap.get("return_code")) &&
SUCCESS_CODE.equals(responseMap.get("result_code"))) {
@ -414,6 +431,35 @@ public class WechatPayUtil {
return result;
}
/**
* 获取证书
*
* @param filename 证书文件路径 (required)
* @return X509证书
*/
public static X509Certificate getCertificate(String filename) throws IOException {
InputStream fis = new FileInputStream(filename);
BufferedInputStream bis = new BufferedInputStream(fis);
try {
CertificateFactory cf = CertificateFactory.getInstance("X509");
X509Certificate cert = (X509Certificate) cf.generateCertificate(bis);
cert.checkValidity();
return cert;
} catch (CertificateExpiredException e) {
throw new RuntimeException("证书已过期", e);
} catch (CertificateNotYetValidException e) {
throw new RuntimeException("证书尚未生效", e);
} catch (CertificateException e) {
throw new RuntimeException("无效的证书文件", e);
} finally {
bis.close();
}
}
public static void main(String[] args) throws IOException {
getCertificate("D:/javacode/RuoYi-Vue-master/ruoyi-admin/target/classes/wechat/apiclient_cert.p12");
}
/**
* 批量订单统一下单并返回前端支付参数用于多商品批量下单场景
@ -483,13 +529,13 @@ public class WechatPayUtil {
// 构建签名参数
Map<String, String> signParams = new HashMap<>();
signParams.put("appId", wechatAppId);
signParams.put("appId", wechatConfig().getAppid());
signParams.put("timeStamp", timeStamp);
signParams.put("nonceStr", nonceStr);
signParams.put("package", packageStr);
signParams.put("signType", signType);
String paySign = generateSign(signParams, wechatApiKey);
String paySign = generateSign(signParams, wechatConfig().getApikey());
payParams.put("timeStamp", timeStamp);
payParams.put("nonceStr", nonceStr);
@ -738,8 +784,10 @@ public class WechatPayUtil {
*/
private Map<String, String> buildRefundParams(Map<String, Object> refundInfo) {
Map<String, String> params = new HashMap<>();
params.put("appid", wechatAppId);
params.put("mch_id", wechatMchId);
// params.put("appid", wechatAppId);
// params.put("mch_id", wechatMchId);
params.put("appid","wx73d0202b3c8a6d68");
params.put("mch_id","1672571923");
params.put("nonce_str", generateNonceStr());
params.put("out_trade_no", refundInfo.get("orderNo").toString());
params.put("out_refund_no", refundInfo.get("refundNo").toString());
@ -761,8 +809,10 @@ public class WechatPayUtil {
*/
private Map<String, String> buildTransferParams(Map<String, Object> transferInfo) {
Map<String, String> params = new HashMap<>();
params.put("mch_appid", wechatAppId);
params.put("mchid", wechatMchId);
// params.put("mch_appid", wechatAppId);
// params.put("mchid", wechatMchId);
params.put("mch_appid","wx73d0202b3c8a6d68");
params.put("mchid","1672571923");
params.put("nonce_str", generateNonceStr());
params.put("partner_trade_no", transferInfo.get("partnerTradeNo").toString());
params.put("openid", transferInfo.get("openid").toString());
@ -778,4 +828,6 @@ public class WechatPayUtil {
return params;
}
}

View File

@ -0,0 +1,88 @@
package com.ruoyi.system.ControllerUtil;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
import javax.net.ssl.*;
import java.security.cert.X509Certificate;
import org.springframework.http.*;
import org.springframework.web.client.RestTemplate;
public class WorkerApplyUtil {
public static String aesEncrypt(String data, String key) throws Exception {
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
byte[] encrypted = cipher.doFinal(data.getBytes("UTF-8"));
return Base64.getEncoder().encodeToString(encrypted);
}
public static String getImageBase64(String imageUrl) throws Exception {
java.net.URL url = new java.net.URL(imageUrl);
java.io.InputStream in = url.openStream();
byte[] bytes = in.readAllBytes();
in.close();
return Base64.getEncoder().encodeToString(bytes);
}
//自定义 RestTemplate 禁用 SSL 验证
public static RestTemplate getUnsafeRestTemplate() throws Exception {
TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; }
public void checkClientTrusted(X509Certificate[] certs, String authType) {}
public void checkServerTrusted(X509Certificate[] certs, String authType) {}
}
};
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
HttpsURLConnection.setDefaultHostnameVerifier((hostname, session) -> true);
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
return new RestTemplate(requestFactory);
}
public static Map virtualVerify(String image, String phone, String cardNo, String name, String callbackUrl, String qiniuPrefix, String apiUrl) throws Exception {
long time = System.currentTimeMillis();
String key = "ecf5ae04c52b4d85";
// 1. 处理图片URL
String imageUrl = image.startsWith(qiniuPrefix) ? image : (qiniuPrefix + image);
String base64Image = getImageBase64(imageUrl);
String encryptedImage = aesEncrypt(base64Image, key);
// 2. 加密其他字段
String encryptedPhone = aesEncrypt(phone, key);
String encryptedName = aesEncrypt(name, key);
String encryptedCardNo = aesEncrypt(cardNo, key);
// 3. 组装header和body
String sign = org.apache.commons.codec.digest.DigestUtils.md5Hex("256339ecf5ae04c52b4d85a0e4255d7d0ebb71" + time);
String authorization = Base64.getEncoder().encodeToString(("256339:" + time).getBytes("UTF-8"));
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.set("Authorization", authorization);
Map<String, Object> body = new HashMap<>();
body.put("phoneNo", encryptedPhone);
body.put("name", encryptedName);
body.put("identifyCardNO", encryptedCardNo);
body.put("photo", encryptedImage);
body.put("callbackUrl", callbackUrl);
HttpEntity<Map<String, Object>> entity = new HttpEntity<>(body, headers);
RestTemplate restTemplate = getUnsafeRestTemplate();
// RestTemplate restTemplate = new getUnsafeRestTemplate();
String url = apiUrl + "/realNameAuth/256339/" + sign;
ResponseEntity<Map> response = restTemplate.postForEntity(url, entity, Map.class);
return response.getBody();
}
}

View File

@ -85,6 +85,10 @@ public class GoodsOrder extends BaseEntity
@Excel(name = "支付金额")
private BigDecimal payPrice;
/** 支付金额 */
@Excel(name = "优惠券id")
private Long couponId;
/** 抵扣金额 */
@Excel(name = "抵扣金额")
private BigDecimal deduction;
@ -494,7 +498,13 @@ public class GoodsOrder extends BaseEntity
this.payPriceMin = payPriceMin;
}
public Long getCouponId() {
return couponId;
}
public void setCouponId(Long couponId) {
this.couponId = couponId;
}
@Override
public String toString() {

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.CouponUser;
import org.apache.ibatis.annotations.Param;
/**
* 优惠券领取记录Mapper接口
@ -23,6 +24,12 @@ public interface CouponUserMapper
public int selectCountCouponUserbycouponId(Long couponId);
public int selectCountCouponsByUid(@Param("uid") Long uid, @Param("status") Long status);
/**
* 查询优惠券领取记录列表
*

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.GoodsOrder;
import org.apache.ibatis.annotations.Param;
/**
* 商品订单Mapper接口
@ -19,6 +20,12 @@ public interface GoodsOrderMapper
*/
public GoodsOrder selectGoodsOrderById(Long id);
public int selectCountGoodsOrderByUid(@Param("uid") Long uid, @Param("status") Long status);
public int selectAllCountGoodsOrderByUid(Long uid);
/**
* 查询商品订单列表
*

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.system.domain.AppleDoMain.OrderApple;
import com.ruoyi.system.domain.Order;
import org.apache.ibatis.annotations.Param;
/**
* 服务订单Mapper接口
@ -22,8 +23,10 @@ public interface OrderMapper
public Order selectOrderById(Long id);
public int selectCountOrderByUid(@Param("uid") Long uid,@Param("status") Long status);
public int selectAllCountOrderByUid(Long uid);
/**
* 小程序查询服务订单列表
*

View File

@ -19,6 +19,9 @@ public interface UsersMapper
*/
public Users selectUsersById(Long id);
public Users selectUsersIsMaxNumber();
/**
* 查询请填写功能名称
*

View File

@ -2,6 +2,7 @@ package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.CouponUser;
import org.apache.ibatis.annotations.Param;
/**
* 优惠券领取记录Service接口
@ -28,6 +29,8 @@ public interface ICouponUserService
public int deleteCouponUserBycouponId (Long couponId);
public int selectCountCouponUserbycouponId(Long couponId);
public int selectCountCouponsByUid(Long uid,Long status);
/**
* 查询优惠券领取记录列表
*

View File

@ -27,6 +27,13 @@ public interface IGoodsOrderService
*/
public List<GoodsOrder> selectGoodsOrderList(GoodsOrder goodsOrder);
public int selectCountGoodsOrderByUid(Long uid,Long status);
public int selectAllCountGoodsOrderByUid(Long uid);
/**
* 新增商品订单
*

View File

@ -38,6 +38,11 @@ public interface IOrderService
*/
public List<Order> selectOrderList(Order order);
public int selectCountOrderByUid(Long uid,Long status);
public int selectAllCountOrderByUid(Long uid);
/**
* 新增服务订单
*

View File

@ -27,6 +27,9 @@ public interface IUsersService
public Users selectUsersByRememberToken(String rememberToken);
public Users selectUsersIsMaxNumber();
/**
* 查询请填写功能名称
*

View File

@ -31,6 +31,11 @@ public class CouponUserServiceImpl implements ICouponUserService
return couponUserMapper.selectCouponUserById(id);
}
public int selectCountCouponsByUid(Long uid,Long status){
return couponUserMapper.selectCountCouponsByUid(uid,status);
}
/**
* 批量删除优惠券领取记录
*

View File

@ -31,6 +31,16 @@ public class GoodsOrderServiceImpl implements IGoodsOrderService
return goodsOrderMapper.selectGoodsOrderById(id);
}
public int selectCountGoodsOrderByUid(Long uid,Long status) {
return goodsOrderMapper.selectCountGoodsOrderByUid(uid,status);
}
public int selectAllCountGoodsOrderByUid(Long uid) {
return goodsOrderMapper.selectAllCountGoodsOrderByUid(uid);
}
/**
* 查询商品订单列表
*

View File

@ -35,6 +35,14 @@ public class OrderServiceImpl implements IOrderService
public int selectCountOrderByUid(Long uid,Long status) {
return orderMapper.selectCountOrderByUid(uid,status);
}
public int selectAllCountOrderByUid(Long uid) {
return orderMapper.selectAllCountOrderByUid(uid);
}
/**
* 小程序查询服务订单列表
*

View File

@ -44,7 +44,10 @@ public class UsersServiceImpl implements IUsersService
}
public Users selectUsersIsMaxNumber() {
return usersMapper.selectUsersIsMaxNumber();
}
/**
* 查询请填写功能名称
*

View File

@ -30,6 +30,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select count(0) from coupon_user where coupon_id=#{couponId}
</select>
<select id="selectCountCouponsByUid" resultType="Integer">
select count(1) from coupon_user where uid = #{uid} and status=#{status}
</select>
<select id="selectCouponUserNoList" parameterType="CouponUser" resultMap="CouponUserResult">
<include refid="selectCouponUserVo"/>
<where>

View File

@ -30,6 +30,11 @@
<collection property="couponUserList" ofType="CouponUser" column="id" select="selectCouponUserList" />
</resultMap>
<resultMap type="CouponUser" id="CouponUserResult">
<result property="id" column="id" />
<result property="uid" column="uid" />

View File

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="orderId" column="order_id" />
<result property="transactionId" column="transaction_id" />
<result property="uid" column="uid" />
<result property="couponId" column="coupon_id" />
<result property="productId" column="product_id" />
<result property="name" column="name" />
<result property="phone" column="phone" />
@ -66,6 +67,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<select id="selectCountGoodsOrderByUid" resultType="Integer">
select count(1) from goods_order where uid = #{uid} and status=#{status}
</select>
<select id="selectAllCountGoodsOrderByUid" resultType="Integer">
select count(1) from goods_order where uid = #{uid}
</select>
<insert id="insertGoodsOrder" parameterType="GoodsOrder" useGeneratedKeys="true" keyProperty="id">
insert into goods_order
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -74,6 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null and orderId != ''">order_id,</if>
<if test="transactionId != null">transaction_id,</if>
<if test="uid != null">uid,</if>
<if test="couponId"> coupon_id,</if>
<if test="productId != null">product_id,</if>
<if test="name != null and name != ''">name,</if>
<if test="phone != null and phone != ''">phone,</if>
@ -103,6 +116,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null and orderId != ''">#{orderId},</if>
<if test="transactionId != null">#{transactionId},</if>
<if test="uid != null">#{uid},</if>
<if test="couponId != null">#{couponId},</if>
<if test="productId != null">#{productId},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="phone != null and phone != ''">#{phone},</if>
@ -138,6 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="transactionId != null">transaction_id = #{transactionId},</if>
<if test="uid != null">uid = #{uid},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="couponId != null">coupon_id = #{couponId},</if>
<if test="name != null and name != ''">name = #{name},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="address != null and address != ''">address = #{address},</if>

View File

@ -192,6 +192,15 @@
</select>
<select id="selectCountOrderByUid" resultType="Integer">
select count(1) from order_data where uid = #{uid} and status=#{status}
</select>
<select id="selectAllCountOrderByUid" resultType="Integer">
select count(1) from order_data where uid = #{uid}
</select>
<select id="selectOrderByOrderId" parameterType="String" resultMap="OrderResult">
<include refid="selectOrderVo"/>
where order_id = #{orderId}

View File

@ -101,6 +101,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectUsersIsMaxNumber" parameterType="Long" resultMap="UsersResult">
<include refid="selectUsersVo"/>
ORDER BY job_number DESC
LIMIT 1;
</select>
<select id="selectUsersByRememberToken" parameterType="String" resultMap="UsersResult">
<include refid="selectUsersVo"/>
where remember_token = #{rememberToken}