Commit 58469903 by 不悦

“ycf0810

parent aac575c1
package com.yami.shop.admin.controller;
import com.yami.shop.bean.model.Coupon;
import com.yami.shop.service.CouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/coupon")
@Api(tags = "优惠卷")
public class CouponController {
@Autowired
private CouponService couponService;
@PostMapping("/selectAdminCouponList")
@ApiOperation(value = "获取优惠卷列表", notes = "获取优惠卷列表")
public ResponseEntity<List<Coupon>> selectAdminCouponList(@Valid @RequestBody Coupon coupon) {
List<Coupon> merchantList = couponService.selectAdminCouponList(coupon);
return ResponseEntity.ok(merchantList);
}
@PostMapping("/edit")
@ApiOperation(value = "修改", notes = "修改")
public ResponseEntity<String> edit(@Valid @RequestBody Coupon coupon) {
couponService.updateByPrimaryKeySelective(coupon);
return ResponseEntity.ok().build();
}
@PostMapping("/save")
@ApiOperation(value = "新增优惠卷", notes = "新增优惠卷")
public ResponseEntity<String> save(@Valid @RequestBody Coupon coupon) {
couponService.insertSelective(coupon);
return ResponseEntity.ok().build();
}
@GetMapping("/delete/{couponId}")
@ApiOperation(value = "删除优惠卷", notes = "删除优惠卷")
public ResponseEntity<String> delete(@PathVariable("couponId") Long couponId) {
couponService.deleteByPrimaryKey(couponId);
return ResponseEntity.ok().build();
}
}
package com.yami.shop.admin.controller;
import com.yami.shop.bean.model.Merchant;
import com.yami.shop.service.MerchantService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
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 javax.validation.Valid;
import java.util.List;
@RestController
@RequestMapping("/merchant")
@Api(tags = "商户")
public class MerchantController {
@Autowired
private MerchantService merchantService;
@PostMapping("/selectMerchantList")
@ApiOperation(value = "获取商户列表", notes = "获取商户列表")
public ResponseEntity<List<Merchant>> selectMerchantList(@Valid @RequestBody Merchant merchant) {
List<Merchant> merchantList = merchantService.selectMerchantList(merchant);
return ResponseEntity.ok(merchantList);
}
@PostMapping("/edit")
@ApiOperation(value = "审核", notes = "审核")
public ResponseEntity<String> edit(@Valid @RequestBody Merchant merchant) {
merchantService.updateByPrimaryKeySelective(merchant);
return ResponseEntity.ok().build();
}
}
......@@ -34,6 +34,36 @@
<artifactId>jdom</artifactId>
<version>2.0.2</version>
</dependency>
<!--七牛云上传相关-->
<dependency>
<groupId>com.qiniu</groupId>
<artifactId>qiniu-java-sdk</artifactId>
<version>7.2.11</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.3.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.6.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.qiniu</groupId>
<artifactId>happy-dns-java</artifactId>
<version>0.1.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.github.wxpay</groupId>
<artifactId>wxpay-sdk</artifactId>
<version>0.0.3</version>
</dependency>
</dependencies>
<build>
......
......@@ -193,7 +193,10 @@ public class BargainController {
for(BargainHelp bargainHelp:bargainHelpList){
cutMoneys += bargainHelp.getBargainMoney();
}
double canCut = product.getPrice()-cutMoneys;//能砍的价格
double canCut = product.getPrice()-cutMoneys-bargain.getMinPrice();//能砍的价格
if(canCut==0){
return ResponseEntity.ok("已砍到最低价");
}
double randNumber = 0;
//对比
Random rand = new Random();
......@@ -231,7 +234,10 @@ public class BargainController {
MIN = bargain.getNewMin();
}
if(canCut<MAX){
randNumber = rand.nextDouble() * (MAX - MIN) + MIN;
if(randNumber>canCut){
randNumber = canCut;
}
}else{
randNumber = rand.nextDouble() * (MAX - MIN) + MIN;
}
......
package com.yami.shop.api.controller;
import cn.hutool.core.util.ObjectUtil;
import com.yami.shop.bean.model.Coupon;
import com.yami.shop.bean.model.UserCoupon;
import com.yami.shop.security.util.SecurityUtils;
import com.yami.shop.service.CouponService;
import com.yami.shop.service.UserCouponService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/coupon")
@Api(tags = "优惠卷")
public class CouponController {
@Autowired
private CouponService couponService;
@Autowired
private UserCouponService userCouponService;
@PostMapping("/info")
@ApiOperation(value = "优选活动(领卷中心)", notes = "优选活动(领卷中心)")
public ResponseEntity<List<Coupon>> info(@Valid @RequestBody Coupon coupon) {
List<Coupon> couponList = couponService.selectCouponList(coupon);
return ResponseEntity.ok(couponList);
}
@PostMapping("/saveUserCoupon")
@ApiOperation(value = "领取优惠券", notes = "领取优惠券")
public ResponseEntity<HashMap> saveUserCoupon(@Valid @RequestBody UserCoupon userCoupon) {
HashMap map = new HashMap();
String userId = SecurityUtils.getUser().getUserId();
userCoupon.setUserId(userId);
UserCoupon u =userCouponService.selectMyUserCoupon(userId,userCoupon.getCouponId());
if(ObjectUtil.isNotNull(u)){
map.put("code","已领取该优惠券");
return ResponseEntity.ok(map);
}
Coupon coupon = couponService.selectByPrimaryKey(userCoupon.getCouponId());
if(coupon.getNum()>0){
userCouponService.insertSelective(userCoupon);
map.put("code","领劵成功");
}else{
map.put("code","该优惠券数量为零");
}
return ResponseEntity.ok(map);
}
@PostMapping("/selectMyCouponList")
@ApiOperation(value = "我的优惠券", notes = "我的优惠券")
public ResponseEntity<List<Coupon>> selectMyCouponList(@Valid @RequestBody UserCoupon userCoupon) {
String userId = SecurityUtils.getUser().getUserId();
userCoupon.setUserId(userId);
List<Coupon> couponList = couponService.selectMyCouponList(userCoupon);
return ResponseEntity.ok(couponList);
}
}
package com.yami.shop.api.controller;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yami.shop.bean.model.ChargeOff;
import com.yami.shop.bean.model.Coupon;
import com.yami.shop.bean.model.Merchant;
import com.yami.shop.bean.model.UserCoupon;
import com.yami.shop.security.util.SecurityUtils;
import com.yami.shop.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Random;
@RestController
@RequestMapping("/merchant")
@Api(tags = "商户")
public class MerchantController {
@Autowired
private MerchantService merchantService;
@Autowired
private CouponService couponService;
@Autowired
private SmsLogService smsLogService;
@Autowired
private UserCouponService userCouponService;
@Autowired
private ChargeOffService chargeOffService;
@GetMapping("/selectByUserId")
@ApiOperation(value = "商家入驻", notes = "商家入驻")
public ResponseEntity<Merchant> selectByUserId() {
String userId = SecurityUtils.getUser().getUserId();
Merchant merchant = merchantService.selectByUserId(userId);
return ResponseEntity.ok(merchant);
}
@PostMapping("/save")
@ApiOperation(value = "商家入驻(注册)", notes = "商家入驻(注册)")
public HashMap save(@Valid @RequestBody Merchant merchant) {
HashMap map =new HashMap();
List<Merchant> merchantList =merchantService.list(new LambdaQueryWrapper<Merchant>()
.eq(Merchant::getContactPhone, merchant.getContactPhone()));
if(merchantList.size()>0){
map.put("code","该手机号已注册");
return map;
}
String checkoutUtil=smsLogService.smsCheckout(merchant.getContactPhone(),merchant.getCode());
if(!checkoutUtil.equals("验证通过")){
map.put("code","验证不通过");
return map;
}
String userId = SecurityUtils.getUser().getUserId();
merchant.setStatus(0);//未填写
merchant.setCreatedUser(userId);
merchant.setCreatedAt(new Date());
merchant.setUpdateTime(new Date());
merchant.setMerchantPassword(DigestUtils.md5Hex(merchant.getMerchantPassword()));
Long merchantId = merchantService.insertSelective(merchant);
Merchant m = merchantService.selectByPrimaryKey(merchantId);
map.put("merchant",m);
return map;
}
@PostMapping("/edit")
@ApiOperation(value = "修改商户信息(填写资料)", notes = "修改商户信息(填写资料)")
public ResponseEntity<String> edit(@Valid @RequestBody Merchant merchant) {
merchantService.updateByPrimaryKeySelective(merchant);
return ResponseEntity.ok().build();
}
@PostMapping("/login")
@ApiOperation(value = "我的门店登录", notes = "我的门店登录")
public HashMap login(@Valid @RequestBody Merchant merchant) {
HashMap map =new HashMap();
String checkoutUtil=smsLogService.smsCheckout(merchant.getContactPhone(),merchant.getCode());
map.put("code",checkoutUtil);
if(checkoutUtil.equals("验证通过")){
Merchant m = merchantService.selectByContactPhone(merchant.getContactPhone());
if(ObjectUtil.isNotNull(m)){
if(DigestUtils.md5Hex(merchant.getMerchantPassword()).equals(m.getMerchantPassword())){
map.put("merchant",m);
}else{
map.put("code","密码错误");
}
}
}
return map;
}
@PostMapping("/forget")
@ApiOperation(value = "我的门店忘记密码", notes = "我的门店忘记密码")
public HashMap forget(@Valid @RequestBody Merchant merchant) {
HashMap map =new HashMap();
String checkoutUtil=smsLogService.smsCheckout(merchant.getContactPhone(),merchant.getCode());
map.put("code",checkoutUtil);
if(checkoutUtil.equals("验证通过")){
Merchant m = merchantService.selectByContactPhone(merchant.getContactPhone());
if(ObjectUtil.isNotNull(m)){
merchant.setMerchantPassword(DigestUtils.md5Hex(merchant.getNewPassword()));
merchantService.updateByPhone(merchant);
map.put("code","密码修改成功");
}
}
return map;
}
@PostMapping("/editPassword")
@ApiOperation(value = "我的门店修改密码", notes = "我的门店修改密码")
public HashMap editPassword(@Valid @RequestBody Merchant merchant) {
HashMap map =new HashMap();
Merchant m = merchantService.selectByContactPhone(merchant.getContactPhone());
if(ObjectUtil.isNotNull(m)){
if(DigestUtils.md5Hex(merchant.getMerchantPassword()).equals(m.getMerchantPassword())){
merchant.setMerchantPassword(DigestUtils.md5Hex(merchant.getNewPassword()));
merchantService.updateByPhone(merchant);
map.put("code","密码修改成功");
}else{
map.put("code","密码错误");
}
}
return map;
}
@PostMapping("/selectNearbyMerchant")
@ApiOperation(value = "优选活动(附近商户)", notes = "获取附近商户")
public ResponseEntity<List<Merchant>> selectNearbyMerchant(@Valid @RequestBody Merchant merchant) {
List<Merchant> merchantList = merchantService.selectNearbyMerchant(merchant);
if(merchantList.size()>0){
for(Merchant m:merchantList){
List<Coupon> couponList = couponService.selectByMerchantId(m.getMerchantId());
merchant.setCouponList(couponList);
if(couponList.size()>0){
double amount =0.0;
for(Coupon coupon:couponList){
amount +=coupon.getCouponAmount();
}
m.setCouponAmount(amount);
}
}
}
return ResponseEntity.ok(merchantList);
}
@GetMapping("/selectByPrimaryKey/{merchantId}")
@ApiOperation(value = "商家信息", notes = "商家信息")
public ResponseEntity<Merchant> selectByPrimaryKey(@PathVariable("merchantId") Long merchantId) {
Merchant merchantList = merchantService.selectByPrimaryKey(merchantId);
List<Coupon> couponList = couponService.selectByMerchantId(merchantId);
merchantList.setCouponList(couponList);
return ResponseEntity.ok(merchantList);
}
@PostMapping("/chargeOff")
@ApiOperation(value = "扫码核销or填写优惠码核销", notes = "扫码核销or填写优惠码核销")
@Transactional
public HashMap chargeOff(@Valid @RequestBody ChargeOff chargeOff) {
HashMap map =new HashMap();
Coupon coupon = userCouponService.selectCouponByNumber(chargeOff.getCouponNumber());
if(coupon.getCouponType() == 1){
if(coupon.getMerchantId() != chargeOff.getMerchantId()){
map.put("code","该优惠券不是本店的优惠券");
return map;
}
}
Date date =new Date();
if (coupon.getStartTime().getTime()>date.getTime()||date.getTime()>coupon.getOverTime().getTime()) {
map.put("code","目前不是该优惠券活动时间");
return map;
}
if(coupon.getUcStatus() == 0){
map.put("code","该优惠券已使用");
return map;
}
chargeOff.setChargeOffAmount(coupon.getCouponAmount());//核销金额
chargeOff.setMerchantIncome(coupon.getCouponAmount()+coupon.getMerchantAmount());//我的收入
chargeOff.setCreatedAt(new Date());
chargeOffService.insertSelective(chargeOff);
Merchant merchant = merchantService.selectByPrimaryKey(chargeOff.getMerchantId());
merchant.setMerchantBalance(merchant.getMerchantBalance()+coupon.getCouponAmount()+coupon.getMerchantAmount());
merchantService.updateByPrimaryKeySelective(merchant);
UserCoupon userCoupon = new UserCoupon();
userCoupon.setUserCouponId(coupon.getUserCouponId());
userCoupon.setStatus(0);
userCouponService.updateByPrimaryKeySelective(userCoupon);
map.put("code","核销成功");
return map;
}
@GetMapping("/selectChargeOffList/{merchantId}")
@ApiOperation(value = "核销记录", notes = "核销记录")
public ResponseEntity<List<ChargeOff>> selectChargeOffList(@PathVariable("merchantId") Long merchantId) {
return ResponseEntity.ok(chargeOffService.selectChargeOffList(merchantId));
}
public static void main(String[] args) {
System.out.println(DigestUtils.md5Hex("12345678"));
Random random =new Random();
System.out.println(random.nextInt(2));
}
}
......@@ -123,7 +123,7 @@ public class OrderController {
shopCartOrder.setShopCartItemDiscounts(shopCartItemDiscounts);
applicationContext.publishEvent(new ConfirmOrderEvent(shopCartOrder,orderParam,shopAllShopCartItems));
applicationContext.publishEvent(new ConfirmOrderEvent(shopCartOrder,orderParam,shopAllShopCartItems,orderParam.getOrderItem().getIsBargain()));
actualTotal = Arith.add(actualTotal,shopCartOrder.getActualTotal());
total = Arith.add(total,shopCartOrder.getTotal());
totalCount = totalCount + shopCartOrder.getTotalCount();
......
package com.yami.shop.api.controller;
import cn.hutool.core.lang.UUID;
import com.qiniu.util.Auth;
import com.qiniu.util.StringMap;
import com.yami.shop.bean.model.QiNiu;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/qiNiu")
@Api(tags = "七牛云")
public class QiNiuYunController {
// 获取 七牛云的 token
@RequestMapping(value = "/getToken", method = RequestMethod.GET)
@ApiOperation(value = "七牛云", notes = "七牛云")
public QiNiu getToken() {
QiNiu qiNiu = new QiNiu();
String accessKey = "f-hGiQbSWdHJTHWWJsv5tr_MZ_aerL74WVKdz01W";
String secretKey = "6dmqNFgMGP_H6K4obnEPjQbMMf6m2EvXlf7WHDfo";
String bucket = "kszz-jkkm";
long expireSeconds = 600; //过期时间
StringMap putPolicy = new StringMap();
Auth auth = Auth.create(accessKey, secretKey);
String upToken = auth.uploadToken(bucket,null, expireSeconds,putPolicy);
qiNiu.setKey(UUID.randomUUID().toString().replaceAll("\\-", ""));
qiNiu.setToken(upToken);
return qiNiu;
}
}
package com.yami.shop.api.controller;
import com.alibaba.fastjson.JSONObject;
import com.github.wxpay.sdk.WXPayUtil;
import com.yami.shop.bean.model.WxPayParm;
import com.yami.shop.bean.vo.ResultVO;
import com.yami.shop.security.service.AppConnectService;
import com.yami.shop.service.MerchantService;
import com.zero.jimu.utils.withdrawal.CollectionUtil;
import com.zero.jimu.utils.withdrawal.HttpUtils;
import com.zero.jimu.utils.withdrawal.PayUtil;
import com.zero.jimu.utils.withdrawal.XmlUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
* 提现相关接口
*/
@RestController
@RequestMapping("/transfer")
public class TransferController {
@Autowired
private AppConnectService appConnectService;
@Autowired
private MerchantService merchantService;
private static final Logger logger = LoggerFactory.getLogger(TransferController.class);
private static final String TRANSFERS_PAY = "https://api.mch.weixin.qq.com/mmpaymkttransfers/promotion/transfers"; // 企业付款API
// private static final String TRANSFERS_PAY_QUERY = "https://api.mch.weixin.qq.com/mmpaymkttransfers/gettransferinfo"; // 企业付款查询API
private static final String APP_ID = "wx72780b89fe2ee6f4" ;//公众账号appid
private static final String MCH_ID = "1600352176";//商户号
private static final String API_SECRET = "9db5b7176865482695f9b5534e47171b";//API密钥
/**
* 企业向个人支付转账
* @param request
*/
@PostMapping(value = "/pay")
@ResponseBody
@Transactional
public ResultVO transferPay(@RequestBody WxPayParm wxPayParm, HttpServletRequest request) {
/**==============================================设置局部变量=================================================*/
String userId = wxPayParm.getUserId();//用户id
String openid = "";//用户openid
double applyMoney = wxPayParm.getAmount();//用户申请提现金额 0.3-5000
String amount;//企业付款金额
double poundage = 0f;//手续费
String desc;//企业付款描述信息
String id = UUID.randomUUID().toString().replaceAll("-", "");//提现记录表id
if(applyMoney<0.3||applyMoney>5000){
return new ResultVO(ResultVO.Result.MONEYFAIL);
}
/** ======================================业务判断 1.userId是否有收款资格=====================================*/
openid = appConnectService.getOpenIdByUserId(userId);
if(openid==null||openid.equals("")){
return new ResultVO(ResultVO.Result.USERFAIL);
}
/** ======================================业务判断 2.openid可提现金额校验=====================================*/
double account = 0f;
account = merchantService.selectByUserId(userId).getMerchantBalance();
if(applyMoney>account){
return new ResultVO(ResultVO.Result.MONEYFAILTWO);
}
/** =================================业务判断 4.一个商户同一日付款总额限额10万元==================================*/
// Float amountWithdrawn = withdrawalRecordService.selectAllWithdrawalRecordNumOfToday();//商户同一日付款总额
// if(amountWithdrawn>100000){
// return ResultUtil.fail("00000001","今日商户付款总额限额,请明天再试");
// }
/** ========================校验实际提现金额是否在微信企业付款实际允许的提现(0.3-5000)范围内=========================*/
double actualMoney = (applyMoney*1000-poundage*1000)/1000;//实际提现金额
if(actualMoney<0.3||actualMoney>5000){
return new ResultVO(ResultVO.Result.MONEYFAILTHREE);
}
amount = Integer.parseInt((int)((actualMoney)*10)+"")*10+"";//微信企业付款金额 30-500000
/** ==================================================================================================================*/
/** ==================================================封装提现所需参数================================================*/
/** ==================================================================================================================*/
Map<String, String> restmap = null;
try {
Map<String, String> parm = new HashMap<String, String>();
parm.put("mch_appid", APP_ID); //公众账号appid
parm.put("mchid", MCH_ID); //商户号
parm.put("nonce_str", WXPayUtil.generateNonceStr()); //随机字符串
parm.put("partner_trade_no", PayUtil.getTransferNo()); //商户订单号
parm.put("openid", openid); //用户openid oCVr20N2YLH9VQztnkZTaCj2aYYY
parm.put("check_name", "NO_CHECK"); //校验用户姓名选项 OPTION_CHECK
//parm.put("re_user_name", "安迪"); //check_name设置为FORCE_CHECK或OPTION_CHECK,则必填
parm.put("amount",amount); //转账金额
parm.put("desc", "用户提现"+applyMoney); //企业付款描述信息
// parm.put("spbill_create_ip", IpAddrUtil.getIpAddr(request)); //Ip地址
parm.put("sign", WXPayUtil.generateSignature(parm, API_SECRET));
String restxml = HttpUtils.posts(TRANSFERS_PAY, XmlUtil.xmlFormat(parm, false));
restmap = XmlUtil.xmlParse(restxml);
System.out.println(restmap);
} catch (Exception e) {
logger.error(e.getMessage(), e);
return new ResultVO(ResultVO.Result.PAY_FAIL);
}
/** ========================================================提现结果处理===================================================*/
/** ===================================================生成提现及流水记录,改变余额==================================================*/
// if (CollectionUtil.isNotEmpty(restmap) && "SUCCESS".equals(restmap.get("result_code"))) {
// logger.info("转账成功");
// Map<String, String> transferMap = new HashMap<>();
// transferMap.put("partnerTradeNo", restmap.get("partner_trade_no"));//商户转账订单号
// transferMap.put("paymentNo", restmap.get("payment_no")); //微信订单号
// transferMap.put("paymentTime", restmap.get("payment_time")); //微信支付成功时间
//
// //生成提现记录
// withdrawalRecordService.insert(new WithdrawalRecord(id,userType,userId,applyMoney,poundage,actualMoney,1,restmap.get("partner_trade_no"),restmap.get("payment_no"),
// restmap.get("payment_time")==null?null:DateUtil.strToDate(restmap.get("payment_time"),"yyyy-MM-dd HH:mm:ss"),openid,desc,restmap.get("spbill_create_ip"),"0"));
// //生成流水表
// String waterId = UUID.randomUUID().toString().replaceAll("-", "");
// Map<String,Object> map = new HashMap<>();
// map.put("id",waterId);//编号
// map.put("userId",userId);//用户id
// map.put("title","提现");//该流水的标题
// map.put("waterType",2);//商家流水类型1.场地收入 2.提现 用户流水类型1.分销收入 2.提现 3.预订场地
// map.put("incomeExpense",1);//收入还是支出 0.收入 1.支出
// map.put("applyMoney",applyMoney);//申请提现金额
// map.put("poundage",poundage);//手续费
// map.put("actualMoney",actualMoney);//实际金额
// map.put("whetherToAccount",1);//是否到账0.未到账1.已到账
// if(userType==1){
// sysUserService.insertUserWater(map);
// //改变用户可提现余额
//
//
// }
// if(userType==2){
// appUserService.insertUserWater1(map);
// //改变用户可提现余额
// appUserService.updateUserAccount(userId,(account*1000-applyMoney*1000)/1000);//float精度问题
// }
// return ResultUtil.success(transferMap);
// }
//
// /** =================================================3.转账失败========================================================*/
// else {
// if (CollectionUtil.isNotEmpty(restmap)) {
// logger.info("转账失败:" + restmap.get("err_code") + ":" + restmap.get("err_code_des"));
// }
// return ResultUtil.fail("00000001","转账失败"+restmap.get("err_code_des"));
// }
return new ResultVO(ResultVO.Result.SUCCESS);
}
/**
* 企业向个人转账查询
* @param request
* @param response
* @param tradeno 商户转账订单号
* @param callback
*/
// @PostMapping(value = "/pay/query")
// public Result orderPayQuery(HttpServletRequest request, HttpServletResponse response, String tradeno,
// String callback) {
// if (StringUtil.isEmpty(tradeno)) {
// return ResultUtil.fail("00000001","转账订单号不能为空");
// }
//
// Map<String, String> restmap = null;
// try {
// Map<String, String> parm = new HashMap<String, String>();
// parm.put("appid", APP_ID);
// parm.put("mch_id", MCH_ID);
// parm.put("partner_trade_no", tradeno);
// parm.put("nonce_str", PayUtil.getNonceStr());
// parm.put("sign", PayUtil.getSign(parm, API_SECRET));
//
// String restxml = HttpUtils.posts(TRANSFERS_PAY_QUERY, XmlUtil.xmlFormat(parm, true));
// restmap = XmlUtil.xmlParse(restxml);
// } catch (Exception e) {
// logger.error(e.getMessage(), e);
// }
//
// if (CollectionUtil.isNotEmpty(restmap) && "SUCCESS".equals(restmap.get("result_code"))) {
// // 订单查询成功 处理业务逻辑
// logger.info("订单查询:订单" + restmap.get("partner_trade_no") + "支付成功");
// Map<String, String> transferMap = new HashMap<>();
// transferMap.put("partnerTradeNo", restmap.get("partner_trade_no"));//商户转账订单号
// transferMap.put("openid", restmap.get("openid")); //收款微信号
// transferMap.put("paymentAmount", restmap.get("payment_amount")); //转账金额
// transferMap.put("transferTime", restmap.get("transfer_time")); //转账时间
// transferMap.put("desc", restmap.get("desc")); //转账描述
// return ResultUtil.success(transferMap);
// }else {
// if (CollectionUtil.isNotEmpty(restmap)) {
// logger.info("订单转账失败:" + restmap.get("err_code") + ":" + restmap.get("err_code_des"));
// }
// return ResultUtil.fail("00000001","订单转账失败");
// }
// }
}
......@@ -85,10 +85,11 @@ public class ConfirmOrderListener {
if (product == null || sku == null) {
throw new YamiShopBindException("购物车包含无法识别的商品");
}
if(!event.getIsBargain().equals("1")){
if (product.getStatus() != 1 || sku.getStatus() != 1) {
throw new YamiShopBindException("商品[" + sku.getProdName() + "]已下架");
}
}
totalCount = shopCartItem.getProdCount() + totalCount;
total = Arith.add(shopCartItem.getProductTotalAmount(), total);
// 用户地址如果为空,则表示该用户从未设置过任何地址相关信息
......
......@@ -121,7 +121,7 @@ public class SubmitOrderListener {
List<ShopCartItemDto> shopCartItems = shopCartItemDiscount.getShopCartItems();
for (ShopCartItemDto shopCartItem : shopCartItems) {
Sku sku = checkAndGetSku(shopCartItem.getSkuId(), shopCartItem, skuStocksMap);
Product product = checkAndGetProd(shopCartItem.getProdId(), shopCartItem, prodStocksMap);
Product product = checkAndGetProd(shopCartItem.getProdId(), shopCartItem, prodStocksMap,event.getIsBargain());
OrderItem orderItem = new OrderItem();
orderItem.setShopId(shopId);
......@@ -234,15 +234,17 @@ public class SubmitOrderListener {
}
@SuppressWarnings({"Duplicates"})
private Product checkAndGetProd(Long prodId, ShopCartItemDto shopCartItem, Map<Long, Product> prodStocksMap) {
private Product checkAndGetProd(Long prodId, ShopCartItemDto shopCartItem, Map<Long, Product> prodStocksMap,String isBargain) {
Product product = productService.getProductByProdId(prodId);
if (product == null) {
throw new YamiShopBindException("购物车包含无法识别的商品");
}
if(!isBargain.equals("1")){
if (product.getStatus() != 1) {
throw new YamiShopBindException("商品[" + product.getProdName() + "]已下架");
}
}
// 商品需要改变的库存
Product mapProduct = prodStocksMap.get(prodId);
......
package com.zero.jimu.utils.withdrawal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 集合类工具
*/
public class CollectionUtil {
private CollectionUtil() {
super();
}
// 判断一个集合是否为空
public static <T> boolean isEmpty(Collection<T> col) {
if (col == null || col.isEmpty()) {
return true;
}
return false;
}
// 判断一个集合是否不为空
public static <T> boolean isNotEmpty(Collection<T> col) {
return !isEmpty(col);
}
// 判断Map是否为空
public static <K, V> boolean isEmpty(Map<K, V> map) {
if (map == null || map.isEmpty()) {
return true;
}
return false;
}
// 判断Map是否不为空为空
public static <K, V> boolean isNotEmpty(Map<K, V> map) {
return !isEmpty(map);
}
// 去除list中的重复数据
public static <T> List<T> removeRepeat(List<T> list) {
if (isEmpty(list)) {
return list;
}
List<T> result = new ArrayList<T>();
for (T e : list) {
if (!result.contains(e)) {
result.add(e);
}
}
return result;
}
// 将集合转换为String数组
public static <T> String[] toArray(List<T> list) {
if (isEmpty(list)) {
return null;
}
String[] result = new String[list.size()];
for (int i = 0; i < list.size(); i++) {
result[i] = String.valueOf(list.get(i));
}
return result;
}
}
\ No newline at end of file
package com.zero.jimu.utils.withdrawal;
import org.apache.http.NameValuePair;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import javax.net.ssl.SSLContext;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.KeyStore;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
public class HttpUtils {
private static final String DEFAULT_CHARSET = "UTF-8";
private static final int CONNECT_TIME_OUT = 5000; //链接超时时间3秒
private static final RequestConfig REQUEST_CONFIG = RequestConfig.custom().setConnectTimeout(CONNECT_TIME_OUT).build();
private static SSLContext wx_ssl_context = null; //微信支付ssl证书
private static final String MCH_ID = "1600352176";//证书密码默认是商户号
static{
Resource resource = new ClassPathResource("apiclient_cert.p12");//该证书名字最好改为别人猜不到的
try {
KeyStore keystore = KeyStore.getInstance("PKCS12");
char[] keyPassword = MCH_ID.toCharArray(); //证书密码
keystore.load(resource.getInputStream(), keyPassword);
wx_ssl_context = SSLContexts.custom().loadKeyMaterial(keystore, keyPassword).build();
} catch (Exception e) {
e.printStackTrace();
}
}
// /**
// * @description 功能描述: get 请求
// * @param url 请求地址
// * @param params 参数
// * @param headers headers参数
// * @return 请求失败返回null
// */
// public static String get(String url, Map<String, String> params, Map<String, String> headers) {
//
// CloseableHttpClient httpClient = null;
// if (params != null && !params.isEmpty()) {
// StringBuffer param = new StringBuffer();
// boolean flag = true; // 是否开始
// for (Entry<String, String> entry : params.entrySet()) {
// if (flag) {
// param.append("?");
// flag = false;
// } else {
// param.append("&");
// }
// param.append(entry.getKey()).append("=");
//
// try {
// param.append(URLEncoder.encode(entry.getValue(), DEFAULT_CHARSET));
// } catch (UnsupportedEncodingException e) {
// //编码失败
// }
// }
// url += param.toString();
// }
//
// String body = null;
// CloseableHttpResponse response = null;
// try {
// httpClient = HttpClients.custom().setDefaultRequestConfig(REQUEST_CONFIG).build();
// HttpGet httpGet = new HttpGet(url);
// response = httpClient.execute(httpGet);
// body = EntityUtils.toString(response.getEntity(), DEFAULT_CHARSET);
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// if (response != null) {
// try {
// response.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// if (httpClient != null) {
// try {
// httpClient.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// return body;
// }
/**
* @description 功能描述: get 请求
* @param url 请求地址
* @return 请求失败返回null
*/
// public static String get(String url) {
// return get(url, null);
// }
/**
* @description 功能描述: get 请求
* @param url 请求地址
* @param params 参数
* @return 请求失败返回null
*/
// public static String get(String url, Map<String, String> params) {
// return get(url, params, null);
// }
// /**
// * @description 功能描述: post 请求
// * @param url 请求地址
// * @param params 参数
// * @return 请求失败返回null
// */
// public static String post(String url, Map<String, String> params) {
// CloseableHttpClient httpClient = null;
// HttpPost httpPost = new HttpPost(url);
// List<NameValuePair> nameValuePairs = new ArrayList<>();
// if (params != null && !params.isEmpty()) {
// for (Entry<String, String> entry : params.entrySet()) {
// nameValuePairs.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
// }
// }
//
// String body = null;
// CloseableHttpResponse response = null;
// try {
// httpClient = HttpClients.custom().setDefaultRequestConfig(REQUEST_CONFIG).build();
// httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, DEFAULT_CHARSET));
// response = httpClient.execute(httpPost);
// body = EntityUtils.toString(response.getEntity(), DEFAULT_CHARSET);
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// if (response != null) {
// try {
// response.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// if (httpClient != null) {
// try {
// httpClient.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// return body;
// }
/**
// * @description 功能描述: post 请求
// * @param url 请求地址
// * @param s 参数xml
// * @return 请求失败返回null
// */
// public static String post(String url, String s) {
// CloseableHttpClient httpClient = null;
// HttpPost httpPost = new HttpPost(url);
// String body = null;
// CloseableHttpResponse response = null;
// try {
// httpClient = HttpClients.custom().setDefaultRequestConfig(REQUEST_CONFIG).build();
// httpPost.setEntity(new StringEntity(s, DEFAULT_CHARSET));
// response = httpClient.execute(httpPost);
// body = EntityUtils.toString(response.getEntity(), DEFAULT_CHARSET);
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// if (response != null) {
// try {
// response.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// if (httpClient != null) {
// try {
// httpClient.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// return body;
// }
// /**
// * @description 功能描述: post https请求,服务器双向证书验证
// * @param url 请求地址
// * @param params 参数
// * @return 请求失败返回null
// */
// public static String posts(String url, Map<String, String> params) {
// CloseableHttpClient httpClient = null;
// HttpPost httpPost = new HttpPost(url);
// List<NameValuePair> nameValuePairs = new ArrayList<>();
// if (params != null && !params.isEmpty()) {
// for (Entry<String, String> entry : params.entrySet()) {
// nameValuePairs.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
// }
// }
//
// String body = null;
// CloseableHttpResponse response = null;
// try {
// httpClient = HttpClients.custom().setDefaultRequestConfig(REQUEST_CONFIG).setSSLSocketFactory(getSSLConnectionSocket()).build();
// httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, DEFAULT_CHARSET));
// response = httpClient.execute(httpPost);
// body = EntityUtils.toString(response.getEntity(), DEFAULT_CHARSET);
// } catch (Exception e) {
// e.printStackTrace();
// } finally {
// if (response != null) {
// try {
// response.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// if (httpClient != null) {
// try {
// httpClient.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// }
// return body;
// }
/**
* @description 功能描述: post https请求,服务器双向证书验证
* @param url 请求地址
* @param s 参数xml
* @return 请求失败返回null
*/
public static String posts(String url, String s) {
CloseableHttpClient httpClient = null;
HttpPost httpPost = new HttpPost(url);
String body = null;
CloseableHttpResponse response = null;
try {
httpClient = HttpClients.custom().setDefaultRequestConfig(REQUEST_CONFIG).setSSLSocketFactory(getSSLConnectionSocket()).build();
httpPost.setEntity(new StringEntity(s, DEFAULT_CHARSET));
response = httpClient.execute(httpPost);
body = EntityUtils.toString(response.getEntity(), DEFAULT_CHARSET);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (httpClient != null) {
try {
httpClient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return body;
}
//获取ssl connection链接
private static SSLConnectionSocketFactory getSSLConnectionSocket() {
return new SSLConnectionSocketFactory(wx_ssl_context, new String[] {"TLSv1", "TLSv1.1", "TLSv1.2"}, null, SSLConnectionSocketFactory.getDefaultHostnameVerifier());
}
}
package com.zero.jimu.utils.withdrawal;
import cn.hutool.core.util.StrUtil;
import javax.servlet.http.HttpServletRequest;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;
public class PayUtil {
/**
* 生成订单号
*
* @return
*/
public static String getTradeNo() {
// 自增8位数 00000001
Random random =new Random();
return "TNO" + System.currentTimeMillis() + random.nextInt(1000000);
}
/**
* 退款单号
*
* @return
*/
public static String getRefundNo() {
// 自增8位数 00000001
Random random =new Random();
return "RNO" + System.currentTimeMillis() + random.nextInt(1000000);
}
/**
* 退款单号
*
* @return
*/
public static String getTransferNo() {
// 自增8位数 00000001
Random random =new Random();
return "TNO" + System.currentTimeMillis() + random.nextInt(1000000);
}
/**
* 返回客户端ip
*
* @param request
* @return
*/
public static String getRemoteAddrIp(HttpServletRequest request) {
String ip = request.getHeader("X-Forwarded-For");
if (StrUtil.isNotEmpty(ip) && !"unKnown".equalsIgnoreCase(ip)) {
// 多次反向代理后会有多个ip值,第一个ip才是真实ip
int index = ip.indexOf(",");
if (index != -1) {
return ip.substring(0, index);
} else {
return ip;
}
}
ip = request.getHeader("X-Real-IP");
if (StrUtil.isNotEmpty(ip) && !"unKnown".equalsIgnoreCase(ip)) {
return ip;
}
return request.getRemoteAddr();
}
/**
* 获取服务器的ip地址
*
* @param request
* @return
*/
public static String getLocalIp(HttpServletRequest request) {
return request.getLocalAddr();
}
// public static String getSign(Map<String, String> params, String paternerKey) throws UnsupportedEncodingException {
// return Encrypt.getMD5(createSign(params, false) + "&key=" + paternerKey).toUpperCase();
// }
/**
* 构造签名
*
* @param params
* @param encode
* @return
* @throws UnsupportedEncodingException
*/
public static String createSign(Map<String, String> params, boolean encode) throws UnsupportedEncodingException {
Set<String> keysSet = params.keySet();
Object[] keys = keysSet.toArray();
Arrays.sort(keys);
StringBuffer temp = new StringBuffer();
boolean first = true;
for (Object key : keys) {
if (key == null || StrUtil.isEmpty(params.get(key))) // 参数为空不参与签名
continue;
if (first) {
first = false;
} else {
temp.append("&");
}
temp.append(key).append("=");
Object value = params.get(key);
String valueStr = "";
if (null != value) {
valueStr = value.toString();
}
if (encode) {
temp.append(URLEncoder.encode(valueStr, "UTF-8"));
} else {
temp.append(valueStr);
}
}
return temp.toString();
}
/**
* 创建支付随机字符串
* @return
*/
public static String getNonceStr(){
String s = UUID.randomUUID().toString();
// 去掉“-”符号
return s.replaceAll( "\\-","").toUpperCase();
}
/**
* 支付时间戳
* @return
*/
public static String payTimestamp() {
return Long.toString(System.currentTimeMillis() / 1000);
}
}
\ No newline at end of file
package com.zero.jimu.utils.withdrawal;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
public class XmlUtil {
private static final String PREFIX_XML = "<xml>";
private static final String SUFFIX_XML = "</xml>";
private static final String PREFIX_CDATA = "<![CDATA[";
private static final String SUFFIX_CDATA = "]]>";
/**
* 转化成xml, 单层无嵌套
*
* @param parm
* @param isAddCDATA
* @return
*/
public static String xmlFormat(Map<String, String> parm, boolean isAddCDATA) {
StringBuffer strbuff = new StringBuffer(PREFIX_XML);
if (CollectionUtil.isNotEmpty(parm)) {
for (Entry<String, String> entry : parm.entrySet()) {
strbuff.append("<").append(entry.getKey()).append(">");
if (isAddCDATA) {
strbuff.append(PREFIX_CDATA);
if (StrUtil.isNotEmpty(entry.getValue())) {
strbuff.append(entry.getValue());
}
strbuff.append(SUFFIX_CDATA);
} else {
if (StrUtil.isNotEmpty(entry.getValue())) {
strbuff.append(entry.getValue());
}
}
strbuff.append("</").append(entry.getKey()).append(">");
}
}
return strbuff.append(SUFFIX_XML).toString();
}
/**
* 解析xml
*
* @param xml
* @return
* @throws XmlPullParserException
* @throws IOException
*/
public static Map<String, String> xmlParse(String xml) throws XmlPullParserException, IOException {
Map<String, String> map = null;
if (StrUtil.isNotEmpty(xml)) {
InputStream inputStream = new ByteArrayInputStream(xml.getBytes());
XmlPullParser pullParser = XmlPullParserFactory.newInstance().newPullParser();
pullParser.setInput(inputStream, "UTF-8"); // 为xml设置要解析的xml数据
int eventType = pullParser.getEventType();
while (eventType != XmlPullParser.END_DOCUMENT) {
switch (eventType) {
case XmlPullParser.START_DOCUMENT:
map = new HashMap<String, String>();
break;
case XmlPullParser.START_TAG:
String key = pullParser.getName();
if (key.equals("xml"))
break;
String value = pullParser.nextText().trim();
map.put(key, value);
break;
case XmlPullParser.END_TAG:
break;
}
eventType = pullParser.next();
}
}
return map;
}
}
......@@ -42,4 +42,9 @@ public class ConfirmOrderEvent {
* 店铺中的所有商品项
*/
private List<ShopCartItemDto> shopCartItems;
/**
* 砍价进来
*/
private String isBargain;
}
......@@ -34,4 +34,9 @@ public class SubmitOrderEvent {
private List<Order> orders;
/**
* 砍价进来
*/
private String isBargain;
}
package com.yami.shop.bean.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@TableName("cftz_charge_off")
public class ChargeOff {
@TableId
@ApiModelProperty(value = "核销主键自增", required = false)
private Long chargeOffId;
@ApiModelProperty(value = "核销金额", required = false)
private double chargeOffAmount;
@ApiModelProperty(value = "我的收入", required = false)
private double merchantIncome;
@ApiModelProperty(value = "用户优惠卷id", required = false)
private Long userCouponId;
@ApiModelProperty(value = "商户id", required = false)
private Long merchantId;
@ApiModelProperty(value = "核销类型(0:线上核销;1:线下核销)", required = false)
private Integer type;
@ApiModelProperty(value = "创建时间", required = false)
private Date createdAt;
@ApiModelProperty(value = "优惠码", required = false)
@TableField(exist = false)
private String couponNumber;
}
\ No newline at end of file
package com.yami.shop.bean.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
@Data
@TableName("cftz_coupon")
public class Coupon {
@TableId
@ApiModelProperty(value = "主键自增", required = false)
private Long couponId;
@ApiModelProperty(value = "优惠金额", required = false)
private double couponAmount;
@ApiModelProperty(value = "优惠券名称", required = false)
private String couponName;
@ApiModelProperty(value = "发放数量", required = false)
private Integer num;
@ApiModelProperty(value = "使用门槛", required = false)
private double usingThreshold;
@ApiModelProperty(value = "开始时间", required = false)
private Date startTime;
@ApiModelProperty(value = "结束时间", required = false)
private Date overTime;
@ApiModelProperty(value = "商户id", required = false)
private Long merchantId;
@ApiModelProperty(value = "小程序id", required = false)
private String appId;
@ApiModelProperty(value = "小程序路径", required = false)
private String appUrl;
@ApiModelProperty(value = "优惠卷类型:(1:商家;2:通用)", required = false)
private Integer couponType;
@ApiModelProperty(value = "状态(0:已过期;1:正常)", required = false)
private Integer status;
@ApiModelProperty(value = "创建时间", required = false)
private Date createdAt;
@ApiModelProperty(value = "修改时间", required = false)
private Date updateAt;
@ApiModelProperty(value = "商家额外获得的金额", required = false)
private double merchantAmount;
@TableField(exist = false)
@ApiModelProperty(value = "优惠码", required = false)
private String couponNumber;
@TableField(exist = false)
@ApiModelProperty(value = "用户优惠券表id", required = false)
private Long userCouponId;
@TableField(exist = false)
@ApiModelProperty(value = "状态(0:已使用;1:未使用)", required = false)
private Integer ucStatus;
}
\ No newline at end of file
package com.yami.shop.bean.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
@TableName("cftz_merchant")
public class Merchant {
@TableId
@ApiModelProperty(value = "主键自增", required = false)
private Long merchantId;
@ApiModelProperty(value = "商家名称", required = false)
private String merchantName;
@ApiModelProperty(value = "商家地址", required = false)
private String merchantAddr;
@ApiModelProperty(value = "联系人", required = false)
private String contact;
@ApiModelProperty(value = "联系电话", required = false)
private String contactPhone;
@ApiModelProperty(value = "门店照片", required = false)
private String storePhotos;
@ApiModelProperty(value = "店内环境照片", required = false)
private String environmentPhotos;
@ApiModelProperty(value = "开店人身份证正面照片", required = false)
private String cardFrontPhotos;
@ApiModelProperty(value = "开店人身份证反面照片", required = false)
private String cardBackPhotos;
@ApiModelProperty(value = "开店人手持身份证正面照片", required = false)
private String cardHandPhotos;
@ApiModelProperty(value = "营业执照", required = false)
private String businessPhotos;
@ApiModelProperty(value = "许可证", required = false)
private String licencePhotos;
@ApiModelProperty(value = "经度", required = false)
private double longitude;
@ApiModelProperty(value = "纬度", required = false)
private double latitude;
@ApiModelProperty(value = "开始时间", required = false)
private Date startTime;
@ApiModelProperty(value = "结束时间", required = false)
private Date overTime;
@ApiModelProperty(value = "主营", required = false)
private String mainBusiness;
@ApiModelProperty(value = "状态:(0:未填写;1,待审核;2,已审核)", required = false)
private Integer status;
@ApiModelProperty(value = "创建人id", required = false)
private String createdUser;
@ApiModelProperty(value = "创建时间", required = false)
private Date createdAt;
@ApiModelProperty(value = "修改时间", required = false)
private Date updateTime;
@ApiModelProperty(value = "密码", required = false)
private String merchantPassword;
@ApiModelProperty(value = "余额" , required = false)
private double merchantBalance;
@ApiModelProperty(value = "距离", required = false)
@TableField(exist = false)
private Long juli;
@ApiModelProperty(value = "优惠券金额", required = false)
@TableField(exist = false)
private double couponAmount;
@ApiModelProperty(value = "商店优惠券列表", required = false)
@TableField(exist = false)
private List<Coupon> couponList;
@ApiModelProperty(value = "验证码", required = false)
@TableField(exist = false)
private String code;
@ApiModelProperty(value = "新密码", required = false)
@TableField(exist = false)
private String newPassword;
}
\ No newline at end of file
package com.yami.shop.bean.model;
import lombok.Data;
@Data
public class QiNiu {
private String token;
private String key;
}
package com.yami.shop.bean.model;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@TableName("cftz_user_coupon")
public class UserCoupon {
@TableId
@ApiModelProperty(value = "用户优惠券表id", required = false)
private Long userCouponId;
@ApiModelProperty(value = "用户id", required = false)
private String userId;
@ApiModelProperty(value = "优惠券id", required = false)
private Long couponId;
@ApiModelProperty(value = "优惠码", required = false)
private String couponNumber;
@ApiModelProperty(value = "创建时间", required = false)
private Date createAt;
@ApiModelProperty(value = "修改时间", required = false)
private Date updateAt;
@ApiModelProperty(value = "状态(0:已使用;1:未使用)", required = false)
private Integer status;
@ApiModelProperty(value = "我的优惠券类型(1:未使用;2:已使用;3:已过期)",required = false)
@TableField(exist = false)
private Integer type;
}
\ No newline at end of file
package com.yami.shop.bean.model;
import lombok.Data;
@Data
public class WxPayParm {
private String userId;
private double amount;
}
package com.yami.shop.bean.vo;
/**
* result vo
*
* @author zm.xue
* @version 2019/1/4 v1.00 init
*/
@SuppressWarnings("all")
public class ResultVO<T> {
private Result result;
private int code;
private String msg;
private T object;
public ResultVO(Result result) {
this.result = result;
}
public ResultVO(Result result, T object) {
this.result = result;
this.object = object;
}
public int getCode() {
return result.code;
}
public String getMsg() {
return "[" + result.code + "]" + result.msg;
}
public T getObject() {
return object;
}
public enum Result {
SUCCESS(200, "成功"),
DATA_NOT_EXIST(300, "数据不存在,请刷新后重试"),
DATA_EXIST(301, "已存在主键相同的数据"),
ACCOUNT_OR_PASSWORD_ERROR(302, "账号不存在或密码错误"),
MISS_ACCOUNT(303, "账号不存在"),
OLD_PASSWORD_ERROR(304, "旧密码错误"),
MISS_VIP_ERROR(308, "VIP用户无法登入后台"),
MISS_PERMISSION(400, "缺少相关权限,请联系系统管理员"),
LOGIN_LOSE(401, "登录失效,请重新登录"),
FAIL(500, "系统异常,请联系系统管理员"),
USERFAIL(501, "该用户不可提现"),
MONEYFAIL(502, "申请提现金额不符:低于最小金额0.30元或高于5000.00元"),
MONEYFAILTWO(503, "申请提现金额大于可提现金额"),
MONEYFAILTHREE(505, "转账发生异常"),
PAY_FAIL(506, "转账发生异常"),
SMSCODEFAIL(509, "验证码不一致,请重新输入"),
PHONE_UNREGISTERED(510 , "该手机号未注册"),
ERROR_WXAPI(511 , "调用微信统一下单接口api失败"),
LOSE_PARAM(512 , "丢失关键参数"),
INIT_USER_FAIL(514 , "支付失败,请重试"),
GOODS_AMOUNT_INSUFFICIENT(515,"您的货款已经不足,请联系管理员充值"),
NOT_LEVELID(516,"level_id为空"),
GOODS_AMOUNT_ERROR(517,"输入正确的货款"),
NOT_MONEY_INSUFFICIENT(515, "余额不足"),
NOT_PARENT(518, "没有找到此上级,请确认上级手机号是否正确"),
UPLOADFAILURE(520,"上传失败,上传图片数据为空"),
COMPANY_EXISTENCE(521,"该公司名已存在"),
BANK_ERROR(519,"该用户不可提现");
private int code;
private String msg;
Result(int code, String msg) {
this.code = code;
this.msg = msg;
}
}
}
......@@ -23,4 +23,6 @@ public interface AppConnectMapper extends BaseMapper<AppConnect> {
AppConnect getByUserId(@Param("userId") String userId, @Param("appId") Integer appId);
String getUserIdByUnionId(@Param("bizUnionId") String bizUnionId);
String getOpenIdByUserId(@Param("userId") String userId);
}
\ No newline at end of file
......@@ -22,4 +22,5 @@ import com.yami.shop.security.model.AppConnect;
public interface AppConnectService extends IService<AppConnect> {
AppConnect getByBizUserId(String bizUserId, App app);
String getOpenIdByUserId(String userId);
}
......@@ -44,4 +44,9 @@ public class AppConnectServiceImpl extends ServiceImpl<AppConnectMapper, AppConn
return appConnectMapper.getByBizUserId(bizUserId, app.value());
}
@Override
public String getOpenIdByUserId(String userId) {
return appConnectMapper.getOpenIdByUserId(userId);
}
}
......@@ -24,4 +24,7 @@
<select id="getUserIdByUnionId" resultType="java.lang.String">
SELECT user_id from tz_app_connect where biz_unionid = #{bizUnionId} limit 1
</select>
<select id="getOpenIdByUserId" resultType="java.lang.String">
SELECT biz_user_id from tz_app_connect where user_id = #{userId} limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -10,4 +10,5 @@ public interface BargainHelpMapper extends BaseMapper<BargainHelp> {
List<BargainHelp> selectListByBargainOrderId(@Param("bargainOrderId") Long bargainOrderId);
BargainHelp selectBargainHelp(@Param("bargainOrderId") Long bargainOrderId,@Param("assistorId")String assistorId);
int deleteByBargaiOrderId(@Param("bargainOrderId") Long bargainOrderId);
}
......@@ -17,4 +17,6 @@ public interface BargainSendMapper extends BaseMapper<BargainSend> {
int updateCount(@Param("id") Long id);
int updateStatus(@Param("userId") String userId,@Param("activityId") Long activityId);
int deleteByActivityId(@Param("activityId")Long activityId);
}
package com.yami.shop.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yami.shop.bean.model.ChargeOff;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ChargeOffMapper extends BaseMapper<ChargeOff> {
List<ChargeOff> selectChargeOffList(@Param("merchantId") Long merchantId);
int insertSelective(ChargeOff chargeOff);
}
package com.yami.shop.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yami.shop.bean.model.Coupon;
import com.yami.shop.bean.model.UserCoupon;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface CouponMapper extends BaseMapper<Coupon> {
Coupon selectByPrimaryKey(Long couponId);
int deleteByPrimaryKey(Long couponId);
int insertSelective(Coupon record);
int updateByPrimaryKeySelective(Coupon record);
List<Coupon> selectByMerchantId(@Param("merchantId")Long merchantId);
List<Coupon> selectCouponList(Coupon coupon);
List<Coupon> selectMyCouponList(UserCoupon userCoupon);
List<Coupon> selectAdminCouponList(Coupon coupon);
}
\ No newline at end of file
package com.yami.shop.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yami.shop.bean.model.Merchant;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MerchantMapper extends BaseMapper<Merchant> {
int updateByPrimaryKeySelective(Merchant record);
int insertSelective(Merchant record);
List<Merchant> selectNearbyMerchant(Merchant merchant);
Merchant selectByPrimaryKey(@Param("merchantId")Long merchantId);
Merchant selectByUserId(@Param("createdUser") String createdUser);
Merchant selectByContactPhone(@Param("contactPhone")String contactPhone);
int updateByPhone(Merchant merchant);
List<Merchant> selectMerchantList(Merchant merchant);
}
package com.yami.shop.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yami.shop.bean.model.Coupon;
import com.yami.shop.bean.model.UserCoupon;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface UserCouponMapper extends BaseMapper<UserCoupon> {
int updateByPrimaryKeySelective(UserCoupon record);
int insertSelective(UserCoupon record);
UserCoupon selectMyUserCoupon(UserCoupon record);
int deleteByCouponId(@Param("couponId")Long couponId);
Coupon selectCouponByNumber(@Param("couponNumber")String couponNumber);
}
package com.yami.shop.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.model.ChargeOff;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ChargeOffService extends IService<ChargeOff> {
List<ChargeOff> selectChargeOffList(@Param("merchantId") Long merchantId);
int insertSelective(ChargeOff chargeOff);
}
package com.yami.shop.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.model.Coupon;
import com.yami.shop.bean.model.UserCoupon;
import java.util.List;
public interface CouponService extends IService<Coupon> {
Coupon selectByPrimaryKey(Long couponId);
int deleteByPrimaryKey(Long couponId);
int insertSelective(Coupon record);
int updateByPrimaryKeySelective(Coupon record);
List<Coupon> selectByMerchantId(Long merchantId);
List<Coupon> selectCouponList(Coupon coupon);
List<Coupon> selectMyCouponList(UserCoupon userCoupon);
List<Coupon> selectAdminCouponList(Coupon coupon);
}
package com.yami.shop.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.model.Merchant;
import java.util.List;
public interface MerchantService extends IService<Merchant> {
int updateByPrimaryKeySelective(Merchant record);
Long insertSelective(Merchant record);
List<Merchant> selectNearbyMerchant(Merchant merchant);
Merchant selectByPrimaryKey(Long merchantId);
Merchant selectByUserId(String createdUser);
Merchant selectByContactPhone(String contactPhone);
void updateByPhone(Merchant merchant);
List<Merchant> selectMerchantList(Merchant merchant);
}
......@@ -29,4 +29,6 @@ public interface SmsLogService extends IService<SmsLog> {
public boolean checkValidCode(String mobile, String code,SmsType smsType);
SmsLog selectSmsByMobileAndType(String mobile,Integer status);
String smsCheckout(String phone,String code);
}
package com.yami.shop.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yami.shop.bean.model.Coupon;
import com.yami.shop.bean.model.UserCoupon;
public interface UserCouponService extends IService<UserCoupon> {
void updateByPrimaryKeySelective(UserCoupon record);
int insertSelective(UserCoupon record);
UserCoupon selectMyUserCoupon(String userId,Long couponId);
Coupon selectCouponByNumber(String couponNumber);
}
......@@ -4,10 +4,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.model.Bargain;
import com.yami.shop.bean.model.BargainDetailParm;
import com.yami.shop.bean.model.BargainParm;
import com.yami.shop.bean.model.BargainSend;
import com.yami.shop.dao.BargainHelpMapper;
import com.yami.shop.dao.BargainMapper;
import com.yami.shop.dao.BargainSendMapper;
import com.yami.shop.service.BargainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
......@@ -15,6 +19,10 @@ import java.util.List;
public class BargainServiceImpl extends ServiceImpl<BargainMapper, Bargain> implements BargainService{
@Autowired
private BargainMapper bargainMapper;
@Autowired
private BargainSendMapper bargainSendMapper;
@Autowired
private BargainHelpMapper bargainHelpMapper;
@Override
public Long insertSelective(Bargain bargain) {
......@@ -28,8 +36,17 @@ public class BargainServiceImpl extends ServiceImpl<BargainMapper, Bargain> impl
}
@Override
@Transactional
public void deleteByPrimaryKey(Long id) {
bargainMapper.deleteByPrimaryKey(id);
List<BargainSend> bargainSendList = bargainSendMapper.selectBargainSendList(id);
if(bargainSendList.size()>0){
for(BargainSend bargainSend:bargainSendList){
bargainHelpMapper.deleteByBargaiOrderId(bargainSend.getId());
}
}
bargainSendMapper.deleteByActivityId(id);
}
@Override
......
package com.yami.shop.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.model.ChargeOff;
import com.yami.shop.dao.ChargeOffMapper;
import com.yami.shop.service.ChargeOffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
@Service
public class ChargeOffServiceImpl extends ServiceImpl<ChargeOffMapper, ChargeOff> implements ChargeOffService {
@Autowired
private ChargeOffMapper chargeOffMapper;
@Override
public List<ChargeOff> selectChargeOffList(Long merchantId) {
return chargeOffMapper.selectChargeOffList(merchantId);
}
@Override
public int insertSelective(ChargeOff chargeOff) {
return chargeOffMapper.insertSelective(chargeOff);
}
}
package com.yami.shop.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.model.Coupon;
import com.yami.shop.bean.model.UserCoupon;
import com.yami.shop.dao.CouponMapper;
import com.yami.shop.dao.UserCouponMapper;
import com.yami.shop.service.CouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@Service
public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements CouponService {
@Autowired
private CouponMapper couponMapper;
@Autowired
private UserCouponMapper userCouponMapper;
@Override
public Coupon selectByPrimaryKey(Long couponId) {
return couponMapper.selectByPrimaryKey(couponId);
}
@Override
@Transactional
public int deleteByPrimaryKey(Long couponId) {
userCouponMapper.deleteByCouponId(couponId);
return couponMapper.deleteByPrimaryKey(couponId);
}
@Override
@Transactional
public int insertSelective(Coupon record) {
record.setStatus(1);
record.setCreatedAt(new Date());
record.setUpdateAt(new Date());
return couponMapper.insertSelective(record);
}
@Override
@Transactional
public int updateByPrimaryKeySelective(Coupon record) {
record.setUpdateAt(new Date());
return couponMapper.updateByPrimaryKeySelective(record);
}
@Override
public List<Coupon> selectByMerchantId(Long merchantId) {
return couponMapper.selectByMerchantId(merchantId);
}
@Override
public List<Coupon> selectCouponList(Coupon coupon) {
coupon.setStartTime(new Date());
return couponMapper.selectCouponList(coupon);
}
@Override
public List<Coupon> selectMyCouponList(UserCoupon userCoupon) {
return couponMapper.selectMyCouponList(userCoupon);
}
@Override
public List<Coupon> selectAdminCouponList(Coupon coupon) {
return couponMapper.selectAdminCouponList(coupon);
}
}
package com.yami.shop.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.model.Merchant;
import com.yami.shop.dao.MerchantMapper;
import com.yami.shop.service.MerchantService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService {
@Autowired
private MerchantMapper merchantMapper;
@Override
@Transactional
public int updateByPrimaryKeySelective(Merchant record) {
return merchantMapper.updateByPrimaryKeySelective(record);
}
@Override
@Transactional
public Long insertSelective(Merchant record) {
merchantMapper.insertSelective(record);
return record.getMerchantId();
}
@Override
public List<Merchant> selectNearbyMerchant(Merchant merchant) {
return merchantMapper.selectNearbyMerchant(merchant);
}
@Override
public Merchant selectByPrimaryKey(Long merchantId) {
return merchantMapper.selectByPrimaryKey(merchantId);
}
@Override
public Merchant selectByUserId(String createdUser) {
return merchantMapper.selectByUserId(createdUser);
}
@Override
public Merchant selectByContactPhone(String contactPhone) {
return merchantMapper.selectByContactPhone(contactPhone);
}
@Transactional
public void updateByPhone(Merchant merchant){
merchantMapper.updateByPhone(merchant);
}
@Override
public List<Merchant> selectMerchantList(Merchant merchant) {
return merchantMapper.selectMerchantList(merchant);
}
}
......@@ -98,7 +98,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
mergerOrder.getShopCartOrders().get(0).setTotal(0.01);
}
// 通过事务提交订单
eventPublisher.publishEvent(new SubmitOrderEvent(mergerOrder, orderList));
eventPublisher.publishEvent(new SubmitOrderEvent(mergerOrder, orderList,isBargain));
if("1".equals(isBargain)){
for(Order o: orderList){
o.setIsBargain(isBargain);
......
......@@ -13,6 +13,7 @@ package com.yami.shop.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
......@@ -225,4 +226,18 @@ public class SmsLogServiceImpl extends ServiceImpl<SmsLogMapper, SmsLog> impleme
}
return content;
}
public String smsCheckout(String phone,String code){
SmsLog smsLog = smsLogMapper.selectSmsByMobileAndType(phone,1);
if(ObjectUtil.isNull(smsLog)){
return "验证码已失效";
}
if(!code.equals(smsLog.getMobileCode())){
return "验证码错误";
}
if((System.currentTimeMillis()-smsLog.getRecDate().getTime())>1000 * 60 * 5){
return "验证码已过期";
}
return "验证通过";
}
}
package com.yami.shop.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.model.Coupon;
import com.yami.shop.bean.model.UserCoupon;
import com.yami.shop.dao.UserCouponMapper;
import com.yami.shop.service.UserCouponService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Random;
@Service
public class UserCouponServiceImpl extends ServiceImpl<UserCouponMapper, UserCoupon> implements UserCouponService {
@Autowired
private UserCouponMapper userCouponMapper;
@Override
public void updateByPrimaryKeySelective(UserCoupon record) {
userCouponMapper.updateByPrimaryKeySelective(record);
}
@Override
public int insertSelective(UserCoupon record) {
Random random =new Random();
record.setCouponNumber((System.currentTimeMillis()+random.nextInt(1000))+"");
record.setCreateAt(new Date());
record.setUpdateAt(new Date());
record.setStatus(1);//未使用
return userCouponMapper.insertSelective(record);
}
@Override
public UserCoupon selectMyUserCoupon(String userId,Long couponId) {
UserCoupon userCoupon = new UserCoupon();
userCoupon.setUserId(userId);
userCoupon.setCouponId(couponId);
return userCouponMapper.selectMyUserCoupon(userCoupon);
}
@Override
public Coupon selectCouponByNumber(String couponNumber) {
return userCouponMapper.selectCouponByNumber(couponNumber);
}
}
......@@ -22,4 +22,8 @@
<select id="selectBargainHelp" resultType="com.yami.shop.bean.model.BargainHelp">
select * from tz_bargain_help WHERE bargain_order_id=#{bargainOrderId} and assistor_id = #{assistorId}
</select>
<delete id="deleteByBargaiOrderId" parameterType="java.lang.Long" >
delete from tz_bargain_help
where bargain_order_id = #{bargainOrderId}
</delete>
</mapper>
......@@ -17,6 +17,10 @@
</resultMap>
<delete id="deleteByActivityId" parameterType="java.lang.Long" >
delete from tz_bargain_send
where activity_id = #{activityId,jdbcType=BIGINT}
</delete>
<select id="selectBargainSendList" resultType="com.yami.shop.bean.model.BargainSend">
select bs.*,u.pic userImg from tz_bargain_send bs
left join tz_user u
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yami.shop.dao.ChargeOffMapper" >
<resultMap id="BaseResultMap" type="com.yami.shop.bean.model.ChargeOff" >
<id column="charge_off_id" property="chargeOffId" jdbcType="BIGINT" />
<result column="charge_off_amount" property="chargeOffAmount" jdbcType="DECIMAL" />
<result column="merchant_income" property="merchantIncome" jdbcType="DECIMAL" />
<result column="user_coupon_id" property="userCouponId" jdbcType="BIGINT" />
<result column="merchant_id" property="merchantId" jdbcType="BIGINT"/>
<result column="type" property="type" jdbcType="INTEGER" />
<result column="created_at" property="createdAt" jdbcType="TIMESTAMP" />
</resultMap>
<insert id="insertSelective" parameterType="com.yami.shop.bean.model.ChargeOff" >
insert into cftz_charge_off
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="chargeOffAmount != null" >
charge_off_amount,
</if>
<if test="merchantIncome != null" >
merchant_income,
</if>
<if test="userCouponId != null" >
user_coupon_id,
</if>
<if test="merchantId != null">
merchant_id,
</if>
<if test="type != null" >
type,
</if>
<if test="createdAt != null" >
created_at,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="chargeOffAmount != null" >
#{chargeOffAmount,jdbcType=DECIMAL},
</if>
<if test="merchantIncome != null" >
#{merchantIncome,jdbcType=DECIMAL},
</if>
<if test="userCouponId != null" >
#{userCouponId,jdbcType=BIGINT},
</if>
<if test="merchantId != null">
#{merchantId,jdbcType=BIGINT},
</if>
<if test="type != null" >
#{type,jdbcType=TINYINT},
</if>
<if test="createdAt != null" >
#{createdAt,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
*
from cftz_charge_off
where charge_off_id = #{chargeOffId,jdbcType=BIGINT}
</select>
<select id="selectChargeOffList" resultType="com.yami.shop.bean.model.ChargeOff">
select
*
from cftz_charge_off
where merchant_id = #{merchantId,jdbcType=BIGINT}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yami.shop.dao.CouponMapper" >
<resultMap id="BaseResultMap" type="com.yami.shop.bean.model.Coupon" >
<id column="coupon_id" property="couponId" jdbcType="BIGINT" />
<result column="coupon_amount" property="couponAmount" jdbcType="DECIMAL" />
<result column="coupon_name" property="couponName" jdbcType="VARCHAR" />
<result column="num" property="num" jdbcType="INTEGER" />
<result column="using_threshold" property="usingThreshold" jdbcType="DECIMAL" />
<result column="start_time" property="startTime" jdbcType="TIMESTAMP" />
<result column="over_time" property="overTime" jdbcType="TIMESTAMP" />
<result column="merchant_id" property="merchantId" jdbcType="BIGINT" />
<result column="app_id" property="appId" jdbcType="VARCHAR" />
<result column="app_url" property="appUrl" jdbcType="VARCHAR" />
<result column="coupon_type" property="couponType" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="created_at" property="createdAt" jdbcType="TIMESTAMP" />
<result column="update_at" property="updateAt" jdbcType="TIMESTAMP" />
<result column="merchant_amount" property="merchantAmount" jdbcType="DECIMAL"/>
<result column="user_coupon_id" property="userCouponId" jdbcType="BIGINT" />
<result column="coupon_number" property="couponNumber" jdbcType="VARCHAR"/>
<result column="ucStatus" property="ucStatus" jdbcType="INTEGER" />
</resultMap>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select *
from cftz_coupon
where coupon_id = #{couponId,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from cftz_coupon
where coupon_id = #{couponId,jdbcType=BIGINT}
</delete>
<insert id="insertSelective" parameterType="com.yami.shop.bean.model.Coupon" >
insert into cftz_coupon
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="couponId != null" >
coupon_id,
</if>
<if test="couponAmount != null" >
coupon_amount,
</if>
<if test="couponName != null" >
coupon_name,
</if>
<if test="num != null" >
num,
</if>
<if test="usingThreshold != null" >
using_threshold,
</if>
<if test="startTime != null" >
start_time,
</if>
<if test="overTime != null" >
over_time,
</if>
<if test="merchantId != null" >
merchant_id,
</if>
<if test="appId != null" >
app_id,
</if>
<if test="appUrl != null">
app_url,
</if>
<if test="couponType != null" >
coupon_type,
</if>
<if test="status != null" >
status,
</if>
<if test="createdAt != null" >
created_at,
</if>
<if test="updateAt != null" >
update_at,
</if>
<if test="merchantAmount != null">
merchant_amount,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="couponId != null" >
#{couponId,jdbcType=BIGINT},
</if>
<if test="couponAmount != null" >
#{couponAmount,jdbcType=DECIMAL},
</if>
<if test="couponName != null" >
#{couponName,jdbcType=VARCHAR},
</if>
<if test="num != null" >
#{num,jdbcType=INTEGER},
</if>
<if test="usingThreshold != null" >
#{usingThreshold,jdbcType=DECIMAL},
</if>
<if test="startTime != null" >
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="overTime != null" >
#{overTime,jdbcType=TIMESTAMP},
</if>
<if test="merchantId != null" >
#{merchantId,jdbcType=BIGINT},
</if>
<if test="appId != null" >
#{appId,jdbcType=VARCHAR},
</if>
<if test="appUrl != null ">
#{appUrl,jdbcType=VARCHAR},
</if>
<if test="couponType != null" >
#{couponType,jdbcType=INTEGER},
</if>
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
<if test="createdAt != null" >
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updateAt != null" >
#{updateAt,jdbcType=TIMESTAMP},
</if>
<if test="merchantAmount != null">
#{merchantAmount,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yami.shop.bean.model.Coupon" >
update cftz_coupon
<set >
<if test="couponAmount != null" >
coupon_amount = #{couponAmount,jdbcType=DECIMAL},
</if>
<if test="couponName != null" >
coupon_name = #{couponName,jdbcType=VARCHAR},
</if>
<if test="num != null" >
num = #{num,jdbcType=INTEGER},
</if>
<if test="usingThreshold != null" >
using_threshold = #{usingThreshold,jdbcType=DECIMAL},
</if>
<if test="startTime != null" >
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="overTime != null" >
over_time = #{overTime,jdbcType=TIMESTAMP},
</if>
<if test="merchantId != null and merchantId != ''" >
merchant_id = #{merchantId,jdbcType=BIGINT},
</if>
<if test="appId != null and appId != ''" >
app_id = #{appId,jdbcType=VARCHAR},
</if>
<if test="appUrl !=null and appUrl !=''">
app_url = #{appUrl,jdbcType=VARCHAR},
</if>
<if test="couponType != null" >
coupon_type = #{couponType,jdbcType=INTEGER},
</if>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
<if test="createdAt != null" >
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updateAt != null" >
update_at = #{updateAt,jdbcType=TIMESTAMP},
</if>
<if test="merchantAmount != null">
merchant_amount = #{merchantAmount,jdbcType=DECIMAL},
</if>
</set>
where coupon_id = #{couponId,jdbcType=BIGINT}
</update>
<select id="selectByMerchantId" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
*
from cftz_coupon
where status = 1 and coupon_type = 1
and merchant_id = #{merchantId,jdbcType=BIGINT}
</select>
<select id="selectCouponList" resultMap="BaseResultMap" parameterType="com.yami.shop.bean.model.Coupon">
select
c.*
,uc.coupon_number coupon_number
,uc.user_coupon_id user_coupon_id
from cftz_coupon c
left join cftz_user_coupon uc
on c.coupon_id = uc.coupon_id
where c.status = 1
and c.start_time &lt;= #{startTime}
and c.over_time &gt;= #{startTime}
<if test="couponName !=null and couponName !=''">
and c.coupon_name like concat('%',#{couponName},'%')
</if>
group by c.coupon_id
</select>
<select id="selectMyCouponList" resultMap="BaseResultMap" parameterType="com.yami.shop.bean.model.UserCoupon">
select c.*,
uc.coupon_number coupon_number,
uc.user_coupon_id user_coupon_id,
uc.status ucStatus
from cftz_user_coupon uc
LEFT JOIN cftz_coupon c
ON uc.coupon_id = c.coupon_id
where uc.user_id = #{userId}
group by uc.user_coupon_id
</select>
<select id="selectAdminCouponList" resultMap="BaseResultMap" parameterType="com.yami.shop.bean.model.Coupon">
select *
from cftz_coupon
where 1=1
<if test="couponName !=null and couponName != ''">
and coupon_name like concat('%',#{couponName},'%')
</if>
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yami.shop.dao.MerchantMapper" >
<resultMap id="BaseResultMap" type="com.yami.shop.bean.model.Merchant" >
<id column="merchant_id" property="merchantId" jdbcType="BIGINT" />
<result column="merchant_name" property="merchantName" jdbcType="VARCHAR" />
<result column="merchant_addr" property="merchantAddr" jdbcType="VARCHAR" />
<result column="contact" property="contact" jdbcType="VARCHAR" />
<result column="contact_phone" property="contactPhone" jdbcType="VARCHAR" />
<result column="store_photos" property="storePhotos" jdbcType="VARCHAR" />
<result column="environment_photos" property="environmentPhotos" jdbcType="VARCHAR" />
<result column="card_front_photos" property="cardFrontPhotos" jdbcType="VARCHAR" />
<result column="card_back_photos" property="cardBackPhotos" jdbcType="VARCHAR" />
<result column="card_hand_photos" property="cardHandPhotos" jdbcType="VARCHAR" />
<result column="business_photos" property="businessPhotos" jdbcType="VARCHAR" />
<result column="licence_photos" property="licencePhotos" jdbcType="VARCHAR" />
<result column="longitude" property="longitude" jdbcType="DECIMAL" />
<result column="latitude" property="latitude" jdbcType="DECIMAL" />
<result column="start_time" property="startTime" jdbcType="TIMESTAMP" />
<result column="over_time" property="overTime" jdbcType="TIMESTAMP" />
<result column="main_business" property="mainBusiness" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="created_user" property="createdUser" jdbcType="VARCHAR" />
<result column="created_at" property="createdAt" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="merchant_password" property="merchantPassword" jdbcType="VARCHAR"/>
<result column="merchant_balance" property="merchantBalance" jdbcType="DECIMAL"/>
<result column="coupon_amount" property="couponAmount" jdbcType="DECIMAL"/>
<result column="juli" property="juli" jdbcType="BIGINT"/>
</resultMap>
<insert id="insertSelective" parameterType="com.yami.shop.bean.model.Merchant" >
<selectKey keyProperty="merchantId" resultType="Long" order="AFTER">
SELECT LAST_INSERT_ID()
</selectKey>
insert into cftz_merchant
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="merchantId != null" >
merchant_id,
</if>
<if test="merchantName != null" >
merchant_name,
</if>
<if test="merchantAddr != null" >
merchant_addr,
</if>
<if test="contact != null" >
contact,
</if>
<if test="contactPhone != null" >
contact_phone,
</if>
<if test="storePhotos != null" >
store_photos,
</if>
<if test="environmentPhotos != null" >
environment_photos,
</if>
<if test="cardFrontPhotos != null" >
card_front_photos,
</if>
<if test="cardBackPhotos != null" >
card_back_photos,
</if>
<if test="cardHandPhotos != null" >
card_hand_photos,
</if>
<if test="businessPhotos != null" >
business_photos,
</if>
<if test="licencePhotos != null" >
licence_photos,
</if>
<if test="longitude != null" >
longitude,
</if>
<if test="latitude != null" >
latitude,
</if>
<if test="startTime != null" >
start_time,
</if>
<if test="overTime != null" >
over_time,
</if>
<if test="mainBusiness != null" >
main_business,
</if>
<if test="status != null" >
status,
</if>
<if test="createdUser != null" >
created_user,
</if>
<if test="createdAt != null" >
created_at,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="merchantPassword != null" >
merchant_password,
</if>
<if test="merchantBalance != null" >
merchant_balance,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="merchantId != null" >
#{merchantId,jdbcType=BIGINT},
</if>
<if test="merchantName != null" >
#{merchantName,jdbcType=VARCHAR},
</if>
<if test="merchantAddr != null" >
#{merchantAddr,jdbcType=VARCHAR},
</if>
<if test="contact != null" >
#{contact,jdbcType=VARCHAR},
</if>
<if test="contactPhone != null" >
#{contactPhone,jdbcType=VARCHAR},
</if>
<if test="storePhotos != null" >
#{storePhotos,jdbcType=VARCHAR},
</if>
<if test="environmentPhotos != null" >
#{environmentPhotos,jdbcType=VARCHAR},
</if>
<if test="cardFrontPhotos != null" >
#{cardFrontPhotos,jdbcType=VARCHAR},
</if>
<if test="cardBackPhotos != null" >
#{cardBackPhotos,jdbcType=VARCHAR},
</if>
<if test="cardHandPhotos != null" >
#{cardHandPhotos,jdbcType=VARCHAR},
</if>
<if test="businessPhotos != null" >
#{businessPhotos,jdbcType=VARCHAR},
</if>
<if test="licencePhotos != null" >
#{licencePhotos,jdbcType=VARCHAR},
</if>
<if test="longitude != null" >
#{longitude,jdbcType=DECIMAL},
</if>
<if test="latitude != null" >
#{latitude,jdbcType=DECIMAL},
</if>
<if test="startTime != null" >
#{startTime,jdbcType=TIMESTAMP},
</if>
<if test="overTime != null" >
#{overTime,jdbcType=TIMESTAMP},
</if>
<if test="mainBusiness != null" >
#{mainBusiness,jdbcType=VARCHAR},
</if>
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
<if test="createdUser != null" >
#{createdUser,jdbcType=VARCHAR},
</if>
<if test="createdAt != null" >
#{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="merchantPassword != null" >
#{merchantPassword,jdbcType=VARCHAR},
</if>
<if test="merchantBalance != null" >
#{merchantBalance,jdbcType=DECIMAL},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yami.shop.bean.model.Merchant" >
update cftz_merchant
<set >
<if test="merchantName != null" >
merchant_name = #{merchantName,jdbcType=VARCHAR},
</if>
<if test="merchantAddr != null" >
merchant_addr = #{merchantAddr,jdbcType=VARCHAR},
</if>
<if test="contact != null" >
contact = #{contact,jdbcType=VARCHAR},
</if>
<if test="contactPhone != null" >
contact_phone = #{contactPhone,jdbcType=VARCHAR},
</if>
<if test="storePhotos != null" >
store_photos = #{storePhotos,jdbcType=VARCHAR},
</if>
<if test="environmentPhotos != null" >
environment_photos = #{environmentPhotos,jdbcType=VARCHAR},
</if>
<if test="cardFrontPhotos != null" >
card_front_photos = #{cardFrontPhotos,jdbcType=VARCHAR},
</if>
<if test="cardBackPhotos != null" >
card_back_photos = #{cardBackPhotos,jdbcType=VARCHAR},
</if>
<if test="cardHandPhotos != null" >
card_hand_photos = #{cardHandPhotos,jdbcType=VARCHAR},
</if>
<if test="businessPhotos != null" >
business_photos = #{businessPhotos,jdbcType=VARCHAR},
</if>
<if test="licencePhotos != null" >
licence_photos = #{licencePhotos,jdbcType=VARCHAR},
</if>
<if test="longitude != null and longitude>0.0" >
longitude = #{longitude,jdbcType=DECIMAL},
</if>
<if test="latitude != null and latitude>0.0" >
latitude = #{latitude,jdbcType=DECIMAL},
</if>
<if test="startTime != null" >
start_time = #{startTime,jdbcType=TIMESTAMP},
</if>
<if test="overTime != null" >
over_time = #{overTime,jdbcType=TIMESTAMP},
</if>
<if test="mainBusiness != null" >
main_business = #{mainBusiness,jdbcType=VARCHAR},
</if>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
<if test="createdUser != null" >
created_user = #{createdUser,jdbcType=VARCHAR},
</if>
<if test="createdAt != null" >
created_at = #{createdAt,jdbcType=TIMESTAMP},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="merchantPassword != null" >
merchant_password = #{merchantPassword,jdbcType=VARCHAR},
</if>
<if test="merchantBalance != null and merchantBalance > 0.0" >
merchant_balance = #{merchantBalance,jdbcType=DECIMAL},
</if>
</set>
where merchant_id = #{merchantId,jdbcType=BIGINT}
</update>
<select id="selectNearbyMerchant" resultMap="BaseResultMap" parameterType="com.yami.shop.bean.model.Merchant" >
select
m.*,
ROUND(6378.138*2*ASIN(SQRT(POW(SIN((#{latitude}*PI()/180-m.latitude*PI()/180)/2),2)
+COS(#{latitude}*PI()/180)*COS(m.latitude*PI()/180)*POW(SIN((#{longitude}*PI()/180-m.longitude*PI()/180)/2),2)))*1000) AS juli
from cftz_merchant m
where m.status = 2
<if test="merchantName != null and merchantName != ''">
and merchant_name like concat('%',#{merchantName},'%')
</if>
order by juli asc
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
*
from cftz_merchant
where merchant_id = #{merchantId,jdbcType=BIGINT}
</select>
<select id="selectByUserId" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
*
from cftz_merchant
where created_user = #{createdUser,jdbcType=VARCHAR}
</select>
<select id="selectByContactPhone" resultMap="BaseResultMap" parameterType="java.lang.String" >
select
*
from cftz_merchant
where contact_phone = #{contactPhone,jdbcType=VARCHAR}
</select>
<update id="updateByPhone" parameterType="com.yami.shop.bean.model.Merchant" >
update cftz_merchant
<set >
<if test="merchantPassword != null" >
merchant_password = #{merchantPassword,jdbcType=VARCHAR},
</if>
</set>
where contact_phone = #{contactPhone,jdbcType=VARCHAR}
</update>
<select id="selectMerchantList" resultMap="BaseResultMap" parameterType="com.yami.shop.bean.model.Merchant" >
select
*
from cftz_merchant
where 1=1
<if test="merchantName != null and merchantName != '' ">
and merchant_name like concat('%',#{merchantName},'%')
</if>
<if test="status != null">
and status = #{status}
</if>
order by created_at desc
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yami.shop.dao.UserCouponMapper" >
<resultMap id="BaseResultMap" type="com.yami.shop.bean.model.UserCoupon" >
<id column="user_coupon_id" property="userCouponId" jdbcType="BIGINT" />
<result column="user_id" property="userId" jdbcType="VARCHAR" />
<result column="coupon_id" property="couponId" jdbcType="BIGINT" />
<result column="coupon_number" property="couponNumber" jdbcType="VARCHAR"/>
<result column="create_at" property="createAt" jdbcType="TIMESTAMP" />
<result column="update_at" property="updateAt" jdbcType="TIMESTAMP" />
<result column="status" property="status" jdbcType="INTEGER" />
</resultMap>
<insert id="insertSelective" parameterType="com.yami.shop.bean.model.UserCoupon" >
insert into cftz_user_coupon
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="userCouponId != null" >
user_coupon_id,
</if>
<if test="userId != null" >
user_id,
</if>
<if test="couponId != null" >
coupon_id,
</if>
<if test="couponNumber != null" >
coupon_number,
</if>
<if test="createAt != null" >
create_at,
</if>
<if test="updateAt != null" >
update_at,
</if>
<if test="status != null" >
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="userCouponId != null" >
#{userCouponId,jdbcType=BIGINT},
</if>
<if test="userId != null" >
#{userId,jdbcType=VARCHAR},
</if>
<if test="couponId != null" >
#{couponId,jdbcType=BIGINT},
</if>
<if test="couponNumber != null" >
#{couponNumber,jdbcType=VARCHAR},
</if>
<if test="createAt != null" >
#{createAt,jdbcType=TIMESTAMP},
</if>
<if test="updateAt != null" >
#{updateAt,jdbcType=TIMESTAMP},
</if>
<if test="status != null" >
#{status,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yami.shop.bean.model.UserCoupon" >
update cftz_user_coupon
<set >
<if test="userId != null" >
user_id = #{userId,jdbcType=VARCHAR},
</if>
<if test="couponId != null" >
coupon_id = #{couponId,jdbcType=BIGINT},
</if>
<if test="couponNumber != null" >
coupon_number = #{couponNumber,jdbcType=VARCHAR},
</if>
<if test="createAt != null" >
create_at = #{createAt,jdbcType=TIMESTAMP},
</if>
<if test="updateAt != null" >
update_at = #{updateAt,jdbcType=TIMESTAMP},
</if>
<if test="status != null" >
status = #{status,jdbcType=INTEGER},
</if>
</set>
where user_coupon_id = #{userCouponId,jdbcType=BIGINT}
</update>
<select id="selectMyUserCoupon" resultMap="BaseResultMap" parameterType="com.yami.shop.bean.model.UserCoupon" >
select
*
from cftz_user_coupon
where status = 1
and user_id = #{userId}
and coupon_id = #{couponId,jdbcType=BIGINT}
</select>
<delete id="deleteByCouponId" parameterType="java.lang.Long" >
delete from cftz_user_coupon
where coupon_id = #{couponId,jdbcType=BIGINT}
</delete>
<select id="selectCouponByNumber" resultType="com.yami.shop.bean.model.Coupon" parameterType="java.lang.String" >
select
c.*,uc.user_coupon_id,uc.status ucStatus
from cftz_user_coupon uc
left join cftz_coupon c
on uc.coupon_id = c.coupon_id
where uc.coupon_number = #{couponNumber}
</select>
</mapper>
\ No newline at end of file
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