package com.dsh.other.service.impl;
|
|
import cn.hutool.core.date.DateUtil;
|
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONObject;
|
import com.alipay.api.AlipayClient;
|
import com.alipay.api.DefaultAlipayClient;
|
import com.alipay.api.request.AlipayTradeOrderSettleRequest;
|
import com.alipay.api.response.AlipayTradeOrderSettleResponse;
|
import com.alipay.api.response.AlipayTradeQueryResponse;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.dsh.other.entity.*;
|
import com.dsh.other.feignclient.StoreClient;
|
import com.dsh.other.feignclient.account.AppUserClient;
|
import com.dsh.other.feignclient.account.model.AppUser;
|
import com.dsh.other.feignclient.activity.CouponClient;
|
import com.dsh.other.feignclient.activity.UserCouponClient;
|
import com.dsh.other.feignclient.activity.model.Coupon;
|
import com.dsh.other.feignclient.activity.model.QueryUserCouponByIdAndUserId;
|
import com.dsh.other.feignclient.activity.model.UserCoupon;
|
import com.dsh.other.feignclient.model.SiteChangeStateVO;
|
import com.dsh.other.mapper.SiteMapper;
|
import com.dsh.other.model.*;
|
import com.dsh.other.service.*;
|
import com.dsh.other.util.*;
|
import io.swagger.models.auth.In;
|
import org.aspectj.weaver.ast.Var;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.util.StringUtils;
|
|
import javax.annotation.Resource;
|
import java.math.BigDecimal;
|
import java.math.RoundingMode;
|
import java.text.ParseException;
|
import java.text.SimpleDateFormat;
|
import java.time.LocalTime;
|
import java.util.*;
|
|
/**
|
* @author zhibing.pu
|
* @date 2023/7/13 16:11
|
*/
|
@Service
|
public class SiteServiceImpl extends ServiceImpl<SiteMapper, Site> implements ISiteService {
|
|
@Autowired
|
private ISiteTypeService siteTypeService;
|
|
@Autowired
|
private StoreService storeService;
|
|
@Autowired
|
private ISiteBookingService siteBookingService;
|
|
@Autowired
|
private ISiteLockService siteLockService;
|
|
@Resource
|
private AppUserClient appUserClient;
|
|
@Resource
|
private UserCouponClient userCouponClient;
|
|
@Resource
|
private CouponClient couponClient;
|
|
@Autowired
|
private PayMoneyUtil payMoneyUtil;
|
@Autowired
|
private SiteMapper siteMapper;
|
|
@Autowired
|
private TBackRecordService backRecordService;
|
|
@Autowired
|
private ISiteBookingService iSiteBookingService;
|
|
@Autowired
|
private ISiteService siteService;
|
|
|
/**
|
* 获取场地列表
|
*
|
* @param querySiteList
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public List<QuerySiteListVo> querySiteList(QuerySiteList querySiteList) throws Exception {
|
querySiteList.setPageNum((querySiteList.getPageNum() - 1) * querySiteList.getPageSize());
|
List<QuerySiteListVo> querySiteListVos = this.baseMapper.querySiteList(querySiteList);
|
for (QuerySiteListVo querySiteListVo : querySiteListVos) {
|
if (ToolUtil.isEmpty(querySiteList.getLon())) {
|
querySiteListVo.setDistance(0D);
|
continue;
|
}
|
Map<String, Double> distance = GeodesyUtil.getDistance(querySiteList.getLon() + "," + querySiteList.getLat(), querySiteListVo.getStoreLon() + "," + querySiteListVo.getStoreLat());
|
double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
querySiteListVo.setDistance(wgs84);
|
}
|
return querySiteListVos;
|
}
|
|
|
/**
|
* 获取场地详情
|
*
|
* @param id
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public QuerySiteInfoVo querySiteInfo(Integer id, String lon, String lat) throws Exception {
|
Site site = this.getById(id);
|
SiteType siteType = siteTypeService.getById(site.getSiteTypeId());
|
Store store = storeService.getById(site.getStoreId());
|
QuerySiteInfoVo querySiteInfoVo = new QuerySiteInfoVo();
|
querySiteInfoVo.setId(site.getId());
|
querySiteInfoVo.setTypeName(site.getTypeName());
|
querySiteInfoVo.setName(site.getName());
|
querySiteInfoVo.setSiteTypeName(siteType.getName());
|
querySiteInfoVo.setStoreName(store.getName());
|
querySiteInfoVo.setStoreCoverDrawing(store.getCoverDrawing());
|
querySiteInfoVo.setStoreAddress(store.getAddress());
|
querySiteInfoVo.setStoreLon(store.getLon());
|
querySiteInfoVo.setStoreLat(store.getLat());
|
querySiteInfoVo.setStorePhone(store.getPhone());
|
querySiteInfoVo.setImgs(site.getImgs());
|
|
querySiteInfoVo.setDistance(0D);
|
|
|
querySiteInfoVo.setCashPriceOne(site.getCashPriceOne());
|
if (site.getPlayPaiCoinOne() != null) {
|
querySiteInfoVo.setPlayPaiCoinOne(site.getPlayPaiCoinOne().intValue());
|
}
|
|
querySiteInfoVo.setIntroduce(site.getIntroduce());
|
ArrayList<String> nextName = new ArrayList<>();
|
ArrayList<String> halfName = new ArrayList<>();
|
String nextName1 = site.getNextName();
|
String halfName1 = site.getHalfName();
|
querySiteInfoVo.setIshalf(site.getIshalf());
|
String[] split = nextName1.split(",");
|
for (String s : split) {
|
nextName.add(s);
|
}
|
String[] split1 = halfName1.split(",");
|
for (String s : split1) {
|
halfName.add(s);
|
}
|
querySiteInfoVo.setHalfName(halfName);
|
querySiteInfoVo.setNextName(nextName);
|
if (ToolUtil.isNotEmpty(lon) && ToolUtil.isNotEmpty(lat)) {
|
Map<String, Double> distance = GeodesyUtil.getDistance(lon + "," + lat, store.getLon() + "," + store.getLat());
|
double wgs84 = new BigDecimal(distance.get("WGS84")).divide(new BigDecimal(1000)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
querySiteInfoVo.setDistance(wgs84);
|
}
|
querySiteInfoVo.setCashPrice(site.getCashPrice());
|
querySiteInfoVo.setPlayPaiCoin(site.getPlayPaiCoin());
|
return querySiteInfoVo;
|
}
|
|
|
|
|
/**
|
* 获取场地预约日期数据
|
*
|
* @param id
|
* @param day
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public List<QuerySiteTimes> querySiteTimes(Integer id, String day, String halfName, String siteName) throws Exception {
|
|
System.out.println("=======date======" + day);
|
List<String> strings = new ArrayList<>();
|
|
List<SiteBooking> siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).ne("status", 5).eq("nextName", siteName).like("times", day));
|
|
if (siteName == null || siteName.equals("")) {
|
siteBookings = iSiteBookingService.list(new QueryWrapper<SiteBooking>().eq("siteId", id).ne("status", 5).like("times", day));
|
}
|
|
|
System.out.println("=======siteBookings======" + siteBookings);
|
for (SiteBooking siteBooking : siteBookings) {
|
|
|
String[] split = siteBooking.getTimes().split(";");
|
|
if (siteBooking.getIsHalf() == 2) {
|
for (String s : split) {
|
String convertedValue = s.substring(11);
|
strings.add(convertedValue);
|
}
|
} else {
|
if (halfName == null) {
|
for (String s : split) {
|
String convertedValue = s.substring(11);
|
strings.add(convertedValue);
|
}
|
}
|
|
if (siteBooking.getHalfName().equals(halfName)) {
|
for (String s : split) {
|
String convertedValue = s.substring(11);
|
strings.add(convertedValue);
|
}
|
|
}
|
}
|
}
|
System.out.println("======strings=======" + strings);
|
|
|
List<QuerySiteTimes> timeRanges = new ArrayList<>();
|
|
|
Site site = siteService.getById(id);
|
System.out.println("================" + site);
|
String appointmentStartTime = site.getAppointmentStartTime();
|
String appointmentEndTime = site.getAppointmentEndTime();
|
|
String currentTime = appointmentStartTime;
|
while (currentTime.compareTo(appointmentEndTime) < 0) {
|
String nextTime = null;
|
if ("智慧场地".equals(site.getTypeName())) {
|
nextTime = getNextTimeOne(currentTime);
|
} else {
|
nextTime = getNextTime(currentTime);
|
}
|
|
|
String timeRange = currentTime + "-" + nextTime;
|
QuerySiteTimes orderDto = new QuerySiteTimes();
|
orderDto.setTime(timeRange);
|
|
LocalTime currentTime1 = LocalTime.now();
|
LocalTime targetTime = LocalTime.parse(currentTime);
|
|
boolean hasExceeded = currentTime1.isAfter(targetTime);
|
// if (hasExceeded){
|
// orderDto.setSelectable(0);
|
// }
|
if (strings.contains(timeRange)) {
|
|
orderDto.setSelectable(0);
|
} else {
|
|
String stime = day + " " + currentTime;
|
String etime = day + " " + nextTime;
|
orderDto.setSelectable(1);
|
// 查出lock
|
List<SiteLock> list = siteLockService.list(new LambdaQueryWrapper<SiteLock>().eq(SiteLock::getSiteId, id));
|
for (SiteLock siteLock : list) {
|
boolean stringDateBetween = DateComparisonExample.isStringDateBetween(stime + " - " + etime, siteLock.getStartTime(), siteLock.getEndTime());
|
if (stringDateBetween) {
|
orderDto.setSelectable(0);
|
}
|
if (DateComparisonExample.isStringWithinTimeRange(stime, siteLock.getStartTime(), siteLock.getEndTime())) {
|
orderDto.setSelectable(0);
|
}
|
if (DateComparisonExample.isStringWithinTimeRange(etime, siteLock.getStartTime(), siteLock.getEndTime())) {
|
orderDto.setSelectable(0);
|
}
|
|
}
|
|
|
}
|
|
|
timeRanges.add(orderDto);
|
currentTime = nextTime;
|
}
|
System.out.println("-------------" + timeRanges);
|
|
return timeRanges;
|
|
|
}
|
|
|
public static String getNextTime(String currentTime) {
|
String[] parts = currentTime.split(":");
|
int hour = Integer.parseInt(parts[0]);
|
int minute = Integer.parseInt(parts[1]);
|
|
if (minute == 30) {
|
hour++;
|
minute = 0;
|
} else {
|
minute = 30;
|
}
|
|
return String.format("%02d:%02d", hour, minute);
|
|
}
|
|
public static String getNextTimeOne(String currentTime) {
|
|
String[] parts = currentTime.split(":");
|
int hour = Integer.parseInt(parts[0]);
|
int minute = Integer.parseInt(parts[1]);
|
|
if (minute == 45) {
|
hour++;
|
minute = 0;
|
} else if (minute == 0) {
|
minute = 15;
|
} else if (minute == 15) {
|
minute = 30;
|
} else if (minute == 30) {
|
minute = 45;
|
}
|
|
return String.format("%02d:%02d", hour, minute);
|
|
}
|
|
|
/**
|
* 预约场地
|
*
|
* @param reservationSite
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public ResultUtil reservationSite(Integer uid, ReservationSite reservationSite) throws Exception {
|
Site site = this.getById(reservationSite.getId());
|
AppUser appUser = appUserClient.queryAppUser(uid);
|
String[] split = reservationSite.getTimes().split(";");
|
for (String s : split) {
|
String day = s.split(" ")[0];
|
String time = s.split(" ")[1];
|
List<QuerySiteTimes> querySiteTimes = querySiteTimes(reservationSite.getId(), day, reservationSite.getHalfName(), reservationSite.getNextName());
|
for (QuerySiteTimes querySiteTime : querySiteTimes) {
|
if (querySiteTime.getTime().equals(time) && querySiteTime.getSelectable() == 0) {
|
return ResultUtil.error("【" + s + "】" +
|
"时间段已被使用");
|
}
|
}
|
}
|
|
String s_time = split[0];
|
String e_time = split[split.length - 1];
|
s_time = s_time.substring(0, s_time.lastIndexOf("-"));
|
String[] s1 = e_time.split(" ");
|
e_time = s1[0] + " " + s1[1].split("-")[1];
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
Double payMoney = 0D;
|
if (reservationSite.getPayType() == 3) {
|
if (reservationSite.getIsHalf() == 2) {
|
payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
} else {
|
payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
if (appUser.getPlayPaiCoins().compareTo(payMoney.intValue()) < 0) {
|
return new ResultUtil(3, "玩湃币不足");
|
}
|
} else {
|
if (reservationSite.getIsHalf() == 2) {
|
payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
} else {
|
payMoney = new BigDecimal(site.getCashPriceOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
}
|
|
//校验优惠券
|
Long couponId = reservationSite.getCouponId();
|
if (couponId != null && couponId != 0) {
|
if (null != couponId && reservationSite.getPayType() != 3) {
|
UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(reservationSite.getCouponId(), uid));
|
if (userCoupon != null && userCoupon.getStatus() == 2) {
|
return ResultUtil.error("优惠券已被核销");
|
}
|
Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId());
|
long time = coupon.getEndTime().getTime();
|
if (System.currentTimeMillis() >= time) {
|
return ResultUtil.error("优惠券已过期");
|
}
|
if (userCoupon != null && coupon.getType() == 1) {//满减
|
JSONObject jsonObject = JSON.parseObject(coupon.getContent());
|
Double num1 = jsonObject.getDouble("conditionalAmount");
|
Double num2 = jsonObject.getDouble("deductionAmount");
|
if (payMoney.compareTo(num1) < 0) {
|
return ResultUtil.error("该优惠券无法使用");
|
}
|
|
payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
if (userCoupon != null && coupon.getType() == 2) {//代金券
|
JSONObject jsonObject = JSON.parseObject(coupon.getContent());
|
Double num1 = jsonObject.getDouble("conditionalAmount");
|
if (payMoney.compareTo(num1) <= 0) {
|
return ResultUtil.error("该优惠券无法使用");
|
}
|
payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
userCoupon.setStatus(2);
|
userCouponClient.updateUserCoupon(userCoupon);
|
}
|
}
|
|
|
SiteBooking siteBooking = new SiteBooking();
|
siteBooking.setOrderNo(sdf.format(new Date()) + UUIDUtil.getNumberRandom(3));
|
siteBooking.setProvince(site.getProvince());
|
siteBooking.setProvinceCode(site.getProvinceCode());
|
siteBooking.setCity(site.getCity());
|
siteBooking.setCityCode(site.getCityCode());
|
siteBooking.setStoreId(site.getStoreId());
|
siteBooking.setSiteId(reservationSite.getId());
|
siteBooking.setAppUserId(uid);
|
siteBooking.setTimes(reservationSite.getTimes());
|
siteBooking.setStartTime(sdf1.parse(s_time));
|
siteBooking.setEndTime(sdf1.parse(e_time));
|
siteBooking.setBooker(reservationSite.getBooker());
|
siteBooking.setPhone(reservationSite.getPhone());
|
siteBooking.setPayType(reservationSite.getPayType());
|
siteBooking.setPayMoney(payMoney);
|
siteBooking.setUserCouponId(reservationSite.getCouponId());
|
siteBooking.setStatus(0);
|
siteBooking.setState(1);
|
siteBooking.setInsertTime(new Date());
|
|
siteBooking.setNextName(reservationSite.getNextName());
|
siteBooking.setIsHalf(reservationSite.getIsHalf());
|
siteBooking.setHalfName(reservationSite.getHalfName());
|
siteBookingService.save(siteBooking);
|
|
|
if (reservationSite.getPayType() == 1) {//微信支付
|
ResultUtil resultUtil = weChatPaymentSite(payMoney, siteBooking);
|
return resultUtil;
|
}
|
if (reservationSite.getPayType() == 2) {//支付宝支付
|
return aliPaymentSite(payMoney, siteBooking);
|
}
|
if (reservationSite.getPayType() == 3) {//玩湃币支付
|
if (reservationSite.getIsHalf() == 2) {
|
return playPaiCoinPaymentSite(appUser, Double.valueOf(site.getPlayPaiCoin()), siteBooking);
|
} else {
|
return playPaiCoinPaymentSite(appUser, site.getPlayPaiCoinOne(), siteBooking);
|
}
|
}
|
return ResultUtil.success();
|
}
|
|
|
/**
|
* 课程微信支付
|
*
|
* @param paymentPrice
|
* @return
|
* @throws Exception
|
*/
|
public ResultUtil weChatPaymentSite(Double paymentPrice, SiteBooking siteBooking) throws Exception {
|
String code = siteBooking.getOrderNo();
|
Integer id = siteBooking.getId();
|
Site byId = siteService.getById(siteBooking.getSiteId());
|
// 是否分账 0否1是
|
int isFenZhang= 1;
|
String merchantNumber = "";
|
if (byId.getOperatorId()==null || byId.getOperatorId()==0){
|
// 平台
|
isFenZhang = 0;
|
}
|
ResultUtil weixinpay = payMoneyUtil.weixinpay("预约场地-"+isFenZhang, id.toString(), code, paymentPrice.toString(),
|
"/base/site/weChatPaymentSiteCallback", "APP", "");
|
if (weixinpay.getCode() == 200) {
|
new Thread(new Runnable() {
|
@Override
|
public void run() {
|
try {
|
int num = 1;
|
int wait = 0;
|
while (num <= 10) {
|
int min = 5000;
|
wait += (min * num);
|
Thread.sleep(wait);
|
SiteBooking siteBooking = siteBookingService.getById(id);
|
if (siteBooking.getStatus() != 0) {
|
break;
|
}
|
ResultUtil<Map<String, String>> resultUtil = payMoneyUtil.queryWXOrder(siteBooking.getOrderNo(), "");
|
if (resultUtil.getCode() == 200 && siteBooking.getStatus() == 0) {
|
/**
|
* SUCCESS—支付成功,
|
* REFUND—转入退款,
|
* NOTPAY—未支付,
|
* CLOSED—已关闭,
|
* REVOKED—已撤销(刷卡支付),
|
* USERPAYING--用户支付中,
|
* PAYERROR--支付失败(其他原因,如银行返回失败)
|
*/
|
Map<String, String> data1 = resultUtil.getData();
|
String s = data1.get("trade_state");
|
String transaction_id = data1.get("transaction_id");
|
if ("REFUND".equals(s) || "CLOSED".equals(s) || "REVOKED".equals(s) || "PAYERROR".equals(s) || num == 10) {
|
break;
|
}
|
if ("SUCCESS".equals(s)) {
|
siteBooking.setPayTime(new Date());
|
siteBooking.setStatus(1);
|
siteBooking.setPayOrderNo(transaction_id);
|
siteBookingService.updateById(siteBooking);
|
|
if (byId.getOperatorId()!=null && byId.getOperatorId()!=0){
|
// 休眠两分钟后再调用分账接口 避免提示订单正在处理中
|
Thread.sleep(120000);
|
// 根据运营商id获取对应运营商分账比例 返回格式: 微信分账比例,支付宝分账比例
|
OperatorUser operatorId = operatorUserService.getOne(
|
new QueryWrapper<OperatorUser>().eq("operatorId",byId.getOperatorId())
|
);
|
if (operatorId.getWechatProportion() == null){
|
operatorId.setWechatProportion("0");
|
}
|
if (operatorId.getAlipayProportion() == null){
|
operatorId.setAlipayProportion("0");
|
}
|
String proportion= operatorId.getWechatProportion()+","+operatorId.getAlipayProportion();
|
String[] split = proportion.split(",");
|
String s1 = split[0];
|
if (!s1.equals("未设置")){
|
BigDecimal bigDecimal = new BigDecimal(s1);
|
// 分账比例
|
BigDecimal bigDecimal1 = bigDecimal.divide(new BigDecimal(100)).setScale(2);
|
// 微信商户号
|
String s2 =siteService.getmerchantNumberByOperatorId(byId.getOperatorId());
|
String nonce_str = UUIDUtil.getRandomCode(16);
|
BigDecimal bigDecimal2 = new BigDecimal(paymentPrice);
|
ResultUtil fenzhang = payMoneyUtil.fenzhang(transaction_id, bigDecimal2.multiply(bigDecimal1), s2,nonce_str);
|
if (!fenzhang.getCode().equals(500)){
|
System.err.println("分账失败 原因是:"+fenzhang.getMsg());
|
}else{
|
siteBooking.setFenzhangNo(fenzhang.getMsg());
|
siteBooking.setFenzhangOrderNo(nonce_str);
|
siteBooking.setFenzhangAmount(bigDecimal2.multiply(bigDecimal1));
|
siteBookingService.updateById(siteBooking);
|
}
|
}
|
}
|
|
break;
|
}
|
if ("USERPAYING".equals(s) || "NOTPAY".equals(s)) {
|
num++;
|
}
|
}
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
}
|
}).start();
|
}
|
return weixinpay;
|
}
|
|
private String smid = "2088330203191220";//平台支付宝商户号
|
@Autowired
|
private IOperatorUserService operatorUserService;
|
@Autowired
|
private StoreClient storeClient;
|
/**
|
* 课程支付宝支付
|
*
|
* @param paymentPrice
|
* @return
|
* @throws Exception
|
*/
|
public ResultUtil aliPaymentSite(Double paymentPrice, SiteBooking siteBooking) throws Exception {
|
String code = siteBooking.getOrderNo();
|
Integer id = siteBooking.getId();
|
// 判断预约的门店 属于哪个运营商
|
Integer storeId = siteBooking.getStoreId();
|
Store byId = storeService.getById(storeId);
|
Integer operatorId = byId.getOperatorId();
|
String smid1 = "";
|
if (operatorId == null ){
|
// 平台的门店
|
smid1 = smid;
|
}else if (operatorId == 0){
|
smid1 = smid;
|
}else{
|
smid1 = siteService.getSMIDByOperatorId(operatorId);
|
|
}
|
ResultUtil alipay = payMoneyUtil.alipay(smid1,"预约场地", "预约场地", id.toString(), code, paymentPrice.toString(), "/base/site/aliPaymentSiteCallback");
|
System.out.println("预约场地----" + alipay.getCode());
|
if (alipay.getCode() == 200) {
|
new Thread(new Runnable() {
|
@Override
|
public void run() {
|
try {
|
int num = 1;
|
int wait = 0;
|
while (num <= 10) {
|
int min = 5000;
|
wait += (min * num);
|
Thread.sleep(wait);
|
SiteBooking siteBooking = siteBookingService.getById(id);
|
if (siteBooking.getStatus() != 0) {
|
break;
|
}
|
AlipayTradeQueryResponse resultUtil = payMoneyUtil.queryALIOrder(code);
|
if (resultUtil.getCode().equals("10000") && siteBooking.getStatus() == 0) {
|
/**
|
* WAIT_BUYER_PAY(交易创建,等待买家付款)、
|
* TRADE_CLOSED(未付款交易超时关闭,或支付完成后全额退款)、
|
* TRADE_SUCCESS(交易支付成功)、
|
* TRADE_FINISHED(交易结束,不可退款)
|
*/
|
// Map<String, String> data1 = resultUtil.getData();
|
// String s = data1.get("tradeStatus");
|
String tradeNo = resultUtil.getTradeNo();
|
String s = resultUtil.getTradeStatus();
|
System.out.println("ssssss" + s);
|
if ("TRADE_CLOSED".equals(s) || "TRADE_FINISHED".equals(s) || num == 10) {
|
break;
|
}
|
if ("TRADE_SUCCESS".equals(s)) {
|
siteBooking.setPayTime(new Date());
|
siteBooking.setStatus(1);
|
siteBooking.setPayOrderNo(tradeNo);
|
siteBookingService.updateById(siteBooking);
|
System.err.println("======完成支付");
|
// 判断预约的门店 属于哪个运营商
|
Integer storeId = siteBooking.getStoreId();
|
Store byId = storeService.getById(storeId);
|
Integer operatorId = byId.getOperatorId();
|
String smid1 = "";
|
if (operatorId == null || operatorId == 0){
|
// 平台的门店 不冻结资金不做分账处理
|
payMoneyUtil.confirm1(smid1,code,tradeNo,paymentPrice.toString());
|
}else{
|
smid1 = siteService.getSMIDByOperatorId(operatorId);
|
payMoneyUtil.confirm(smid1,code,tradeNo,paymentPrice.toString());
|
// 分账
|
extracted(operatorId, new BigDecimal(paymentPrice.toString()), tradeNo);
|
}
|
|
break;
|
}
|
if ("WAIT_BUYER_PAY".equals(s)) {
|
num++;
|
}
|
}
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
}
|
}).start();
|
}
|
return alipay;
|
}
|
|
private void extracted(Integer operatorId, BigDecimal coursePackageOrder1, String tradeNo) throws Exception {
|
// 分账
|
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",
|
"2021004105665036",
|
"MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCi5i9nW/hGLJ3A06cZxTQdviFC7THpdSihoTYGLr9q006hu0V26ecBMY/o4w5bvIX0Ok/yofmZsVcCJpAPvbXL/uqVrIjnRRxXiaeBFThlxoBUTdunvbUSDYfzlEhJr5NvUKI6H6lz2niXlQGx4qy8Hau4ccWit9kM8jwUvsBVQoFgJA+xrjMvooA7YLopQtpOD+UJr5thApTSf1xrnr1W12yolTLEH15JmNV372cqXrYUuqnY0QsaPtxeqJUGAOcGdVLllQ7easEznP8DFBvDdHATcmp2SHNQDUEWN6MCVPbMgY06NQVqAXxqjTAYSVh+6TRu6bofPmpYC3TZB003AgMBAAECggEBAJAcR2+PA3NBYUYHeFrqBRMS8uX8ZR19kjZ7IgoSLTFaQsP9opRylPSPXhrPVBKAE5leRQAHn4MCSlESwHvMfxo7KFjFTFAc6dffZZpipYQUOc9bGampwJh58/3e/pyBgVMG6J23CPf/HJQtNFSkjd/V9+ayb/9l2dUEL3bC0fAZ/dbx8HsxdLw8wn3fLlWLj68hOMqa2deCZe3JdSVsPbeWqkh56FFsMLug0Nd+Ar4TgRl9/jnhXF0JWiD0LmPUYLhboY7EfUBzN4w1iYbDi1P+3zvoOYsiVKAXox9GMhQ2VzOO2UcSTuizSza2e98mGpabl/GpKmCz+RDFjtkX6eECgYEA2MyCij65eO3aGIm3FUe93DULRBYTfX8qJQSJq2WOWA3mmQlEW6L3O2B5/lG2h+8WmN6iLEs9eHpgycGYp7vAqgrANEn16ACVcuyx0scFtrZfZ+kmHMzFfiUWxJjVYk/6YngsGVBLdw6ueM42C8TTP67X9tU5TdVGoGWuqEj4W98CgYEAwFqwprXOch5Pqk/RPbb49r0Ou03K/UbciWnWWKzUhFFNS8MdlQPoDvQZbMwHLeWsa2VhaKITK3x5biLQb3U+0GLOn6lTvEyrEUH+ucREyLgVYTRAvwBPtnvlrzpyxPk2HnslQjju8WrvvLLBMKWUjlTrTOzhaHT21gz3pHMiOakCgYEAhLmfaXdBITGshb054sNLDtdCkGpbgEcrzAHdLps769iGxkYQHXHFngpQZUwtTUcoNGqIKknd1jZFrv7gsD+XkgKG7PwimehRlkwmCX5ilxtLiVgJRzRt6+5U5AMVD90a0tHzXYP0z2yjj73fBJF5KtGl0a10KZxaYrQdm1UhB00CgYBZZgzx/k9rtHC8LAqIj1CYhHejT92G53c6Gkl3vyOqN4sgKhfGmSEySfrDGPRBPZxr8ZtbIPCd5mUdberH0osWGMYFaJI1UsCy7aQwvGpniz7MhZeN7dweaOjwDs8mgtjHQ96mL4XGCDhR0BZ/wIURvZ/6iaGdhbbu9unlsWj3uQKBgQCmZYdsbbZkd3ev6f8rwyvMz+DrCQyYpY44cegBYuJgrZiQnL2fJioeN7ixX0UM48SfwsZEIrzshP/LGAwnc2MdjxKUl4jLN8SEe0NAjXOnz9Zaw740+aOmLpXcLWdP4uM2gIhWsvW1tEkQZCXmm7c9s/RsU8Pmzv+YL3+fSijOzA==",
|
"json", "GBK",
|
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmu8n/4yTHWbn7VOrNc9OsLtDL1bEQ8gC1dHkj8Wy5z0mkaOsjJRIG/28ze12M0V8jdCKuuDr5Z1OPKiqf+XO3ypguEh+mYUVMBM/cZodDFQfTY1TKLWjvQCuaqlA+QUTCK6f7T7stsgyQ1o9Jj0rXZDz6PM4QHSTzjrLIBaeqM5WIBvH+fy/X+QG5Utd+/UT0kc0JyvuKhZ65yVUd/C9VcwJJAPliRsAQNrqYterwAJ9zvw9tF11wj9W0XgJ8Ccu4x3gR1vrlLRJJo/OA97RmxPQ+5hSacWQZCUd1dwiBq+YCrKVHGTj14izRHXrLc0yBlRXo7tBOIqcy3IsvKVthQIDAQAB",
|
"RSA2");
|
AlipayTradeOrderSettleRequest request = new AlipayTradeOrderSettleRequest();
|
String randomCode = UUIDUtil.getRandomCode(16);
|
|
String proportionByOperatorId = operatorUserService.getOne(new QueryWrapper<OperatorUser>()
|
.eq("operatorId",operatorId)).getAlipayProportion();
|
// 支付宝分账比例
|
String s1 = proportionByOperatorId.split(",")[1];
|
double i = Double.parseDouble(s1);
|
double v = i * 0.01;
|
BigDecimal bigDecimal1 = new BigDecimal(String.valueOf(v));
|
// 分账金额
|
BigDecimal bigDecimal2 = coursePackageOrder1.multiply(bigDecimal1).setScale(2, RoundingMode.DOWN);
|
request.setBizContent("{" +
|
" \"out_request_no\":\"" + randomCode + "\"," +
|
" \"trade_no\":\"" + tradeNo + "\"," +
|
" \"royalty_parameters\":[" +
|
" {" +
|
" \"royalty_type\":\"transfer\"," +
|
" \"trans_out\":\"" + storeClient.getSMIDByOperatorId(operatorId)+ "\"," +
|
" \"trans_out_type\":\"userId\"," +
|
" \"trans_in_type\":\"userId\"," +
|
" \"trans_in\":\"" + smid + "\"," +
|
" \"amount\":" + bigDecimal2 + "," +
|
" \"desc\":\"平台服务费\"," +
|
" \"royalty_scene\":\"平台服务费\"," +
|
" }" +
|
" ]," +
|
" \"extend_params\":{" +
|
" \"royalty_finish\":\"true\"" +
|
" }," +
|
" \"royalty_mode\":\"async\"" +
|
"}");
|
AlipayTradeOrderSettleResponse response = alipayClient.execute(request);
|
if (response.isSuccess()) {
|
System.out.println("调用成功");
|
} else {
|
System.out.println("调用失败");
|
}
|
}
|
/**
|
* 玩湃币支付
|
*
|
* @param appUser
|
* @param paymentPrice
|
* @return
|
* @throws Exception
|
*/
|
public ResultUtil playPaiCoinPaymentSite(AppUser appUser, Double paymentPrice, SiteBooking siteBooking) throws Exception {
|
Integer playPaiCoins = appUser.getPlayPaiCoins();
|
appUser.setPlayPaiCoins(playPaiCoins - paymentPrice.intValue());
|
appUserClient.updateAppUser(appUser);
|
siteBooking.setPayTime(new Date());
|
siteBooking.setStatus(1);
|
siteBookingService.updateById(siteBooking);
|
HashMap<String, String> map = new HashMap<>();
|
map.put("siteBooking", siteBooking.getId().toString());
|
return ResultUtil.success(map);
|
}
|
|
|
/**
|
* 获取我的场地预约
|
*
|
* @param uid
|
* @param status
|
* @param pageNo
|
* @param pageSize
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public List<QueryMySiteVo> queryMySite(Integer uid, Integer status, Integer pageNo, Integer pageSize) throws Exception {
|
pageNo = (pageNo - 1) * pageSize;
|
List<QueryMySiteVo> queryMySiteVos = this.baseMapper.queryMySite(uid, status, pageNo, pageSize);
|
for (QueryMySiteVo queryMySiteVo : queryMySiteVos) {
|
SiteBooking siteBooking = siteBookingService.getById(queryMySiteVo.getId());
|
Site site = this.getById(siteBooking.getSiteId());
|
String[] split = siteBooking.getTimes().split(";");
|
if (site != null) {
|
if (queryMySiteVo.getIsHalf() == 1) {
|
queryMySiteVo.setPlayPaiCoin((int) (site.getPlayPaiCoinOne() * split.length));
|
|
} else {
|
queryMySiteVo.setPlayPaiCoin(site.getPlayPaiCoin() * split.length);
|
|
}
|
}
|
}
|
return queryMySiteVos;
|
}
|
|
|
/**
|
* 取消我的预约场地
|
*
|
* @param id
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public ResultUtil cancelMySite(Integer uid, Integer id) throws Exception {
|
SiteBooking siteBooking = siteBookingService.getById(id);
|
Site byId = siteService.getById(siteBooking.getSiteId());
|
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
|
Date startTime = siteBooking.getStartTime();
|
if (format.format(new Date()).equals(format.format(startTime)) && siteBooking.getStatus() != 0) {
|
return ResultUtil.error("预约当天,不能取消");
|
}
|
|
if (siteBooking.getStatus() == 0) {
|
siteBooking.setStatus(5);
|
siteBookingService.updateById(siteBooking);
|
AppUser appUser = appUserClient.queryAppUser(siteBooking.getAppUserId());
|
|
if (null != siteBooking.getUserCouponId() && siteBooking.getUserCouponId() != 0) {
|
UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), appUser.getId()));
|
userCoupon.setStatus(1);
|
userCouponClient.updateUserCoupon(userCoupon);
|
}
|
|
return ResultUtil.success();
|
}
|
if (siteBooking.getStatus() != 1 && siteBooking.getStatus() != 2) {
|
return ResultUtil.error("不能进行取消操作");
|
}
|
if (siteBooking.getPayType() == 1) {//微信支付
|
if (StringUtils.hasLength(siteBooking.getFenzhangNo())){
|
// 是分账订单 如果分账金额不为0 那么回退分账金额
|
if (siteBooking.getFenzhangAmount()!=null && siteBooking.getFenzhangAmount().compareTo(BigDecimal.ZERO)>0){
|
String randomCode = UUIDUtil.getRandomCode(16);
|
String randomCode1 = UUIDUtil.getRandomCode(16);
|
if (byId.getOperatorId()!=null && byId.getOperatorId()!=0){
|
// 休眠两分钟后再调用分账接口 避免提示订单正在处理中
|
// 微信商户号
|
String s2 =siteService.getmerchantNumberByOperatorId(byId.getOperatorId());
|
ResultUtil resultUtil = payMoneyUtil.fenzhangRefund(siteBooking.getFenzhangNo(), siteBooking.getFenzhangAmount(), s2, randomCode, randomCode1);
|
if (!resultUtil.getCode().equals(500)){
|
System.err.println("分账回退失败 原因是:"+resultUtil.getMsg());
|
}else{
|
siteBooking.setFenzhangRefundNo(resultUtil.getMsg());
|
siteBookingService.updateById(siteBooking);
|
}
|
|
}
|
}
|
}
|
Map<String, String> map = payMoneyUtil.wxRefund(siteBooking.getPayOrderNo(), siteBooking.getOrderNo(), siteBooking.getPayMoney().toString(),
|
siteBooking.getPayMoney().toString(), "/base/site/cancelMySiteCallback");
|
if (null == map) {
|
return ResultUtil.error("取消退款异常");
|
}
|
String return_code = map.get("return_code");
|
if (!"SUCCESS".equals(return_code)) {
|
return ResultUtil.error(map.get("return_msg"));
|
}
|
siteBooking.setCancelUserId(uid);
|
siteBookingService.updateById(siteBooking);
|
|
TBackRecord tBackRecord = new TBackRecord();
|
tBackRecord.setMoney(siteBooking.getPayMoney());
|
tBackRecord.setUserId(siteBooking.getAppUserId());
|
tBackRecord.setTime(new Date());
|
backRecordService.save(tBackRecord);
|
|
}
|
if (siteBooking.getPayType() == 2) {//支付宝
|
Map<String, String> map = payMoneyUtil.aliRefund(siteBooking.getPayOrderNo(), siteBooking.getPayMoney().toString());
|
if (null == map) {
|
return ResultUtil.error("取消退款异常");
|
}
|
String code = map.get("code");
|
if (!"10000".equals(code)) {
|
return ResultUtil.error(map.get("return_msg"));
|
}
|
String trade_no = map.get("trade_no");
|
siteBooking.setStatus(5);
|
siteBooking.setCancelUserId(uid);
|
siteBooking.setCancelTime(new Date());
|
siteBooking.setRefundOrderNo(trade_no);
|
siteBookingService.updateById(siteBooking);
|
if (null != siteBooking.getUserCouponId() && siteBooking.getUserCouponId() != 0) {
|
UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), siteBooking.getAppUserId()));
|
userCoupon.setStatus(1);
|
userCouponClient.updateUserCoupon(userCoupon);
|
}
|
|
|
TBackRecord tBackRecord = new TBackRecord();
|
tBackRecord.setMoney(siteBooking.getPayMoney());
|
tBackRecord.setUserId(siteBooking.getAppUserId());
|
tBackRecord.setTime(new Date());
|
backRecordService.save(tBackRecord);
|
}
|
|
if (siteBooking.getPayType() == 3) {//玩湃币
|
AppUser appUser = appUserClient.queryAppUser(siteBooking.getAppUserId());
|
appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() + siteBooking.getPayMoney().intValue());
|
appUserClient.updateAppUser(appUser);
|
|
siteBooking.setStatus(5);
|
siteBooking.setCancelUserId(uid);
|
siteBooking.setCancelTime(new Date());
|
siteBookingService.updateById(siteBooking);
|
if (null != siteBooking.getUserCouponId() && siteBooking.getUserCouponId() != 0) {
|
UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), appUser.getId()));
|
userCoupon.setStatus(1);
|
userCouponClient.updateUserCoupon(userCoupon);
|
}
|
}
|
|
return ResultUtil.success();
|
}
|
|
|
/**
|
* 继续支付我预约的场地
|
*
|
* @param id
|
* @param payType
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public ResultUtil continuePaymentMySite(Integer uid, Integer id, Integer payType) throws Exception {
|
SiteBooking siteBooking = siteBookingService.getById(id);
|
if (siteBooking.getStatus() != 0) {
|
return ResultUtil.error("不能继续支付");
|
}
|
Site site = this.getById(siteBooking.getSiteId());
|
AppUser appUser = appUserClient.queryAppUser(uid);
|
String[] split = siteBooking.getTimes().split(";");
|
Double payMoney = 0D;
|
if (payType == 3) {
|
// payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
if (appUser.getPlayPaiCoins().compareTo(payMoney.intValue()) < 0) {
|
return ResultUtil.error("玩湃币不足");
|
}
|
|
if (siteBooking.getIsHalf() == 2) {
|
payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
} else {
|
payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
} else {
|
if (siteBooking.getIsHalf() == 2) {
|
payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
} else {
|
payMoney = new BigDecimal(site.getCashPriceOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
}
|
|
//校验优惠券
|
Long couponId = siteBooking.getUserCouponId();
|
if (null != couponId && payType != 3) {
|
UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), appUser.getId()));
|
Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId());
|
if (coupon.getType() == 1) {//满减
|
// {"conditionalAmount":50,"deductionAmount":10,"experienceName":""}
|
JSONObject jsonObject = JSON.parseObject(coupon.getContent());
|
Double num1 = jsonObject.getDouble("conditionalAmount");
|
Double num2 = jsonObject.getDouble("deductionAmount");
|
payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
if (coupon.getType() == 2) {//代金券
|
JSONObject jsonObject = JSON.parseObject(coupon.getContent());
|
Double num1 = jsonObject.getDouble("conditionalAmount");
|
payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
userCoupon.setStatus(2);
|
userCouponClient.updateUserCoupon(userCoupon);
|
}
|
if (null != couponId && payType == 3) {
|
UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), appUser.getId()));
|
userCoupon.setStatus(1);
|
userCouponClient.updateUserCoupon(userCoupon);
|
}
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
siteBooking.setOrderNo(sdf.format(new Date()) + UUIDUtil.getNumberRandom(3));
|
siteBooking.setPayType(payType);
|
siteBooking.setPayMoney(payMoney);
|
if (payType == 3) {
|
siteBooking.setUserCouponId(null);
|
}
|
siteBookingService.updateById(siteBooking);
|
if (payType == 1) {//微信支付
|
return weChatPaymentSite(payMoney, siteBooking);
|
}
|
if (payType == 2) {//支付宝支付
|
return aliPaymentSite(payMoney, siteBooking);
|
}
|
if (payType == 3) {//玩湃币支付
|
return playPaiCoinPaymentSite(appUser, payMoney, siteBooking);
|
}
|
return ResultUtil.success();
|
}
|
|
|
/**
|
* 获取继续支付金额
|
*
|
* @param id
|
* @return
|
* @throws Exception
|
*/
|
@Override
|
public ResultUtil<Map<String, Double>> queryContinuePaymentMySitePrice(Integer id) throws Exception {
|
SiteBooking siteBooking = siteBookingService.getById(id);
|
if (siteBooking.getStatus() != 0) {
|
return ResultUtil.error("不能继续支付");
|
}
|
Site site = this.getById(siteBooking.getSiteId());
|
String[] split = siteBooking.getTimes().split(";");
|
Map<String, Double> map = new HashMap<>();
|
Double payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
if (siteBooking.getIsHalf() == 2) {
|
payMoney = new BigDecimal(site.getPlayPaiCoin()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
} else {
|
payMoney = new BigDecimal(site.getPlayPaiCoinOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
|
map.put("playPaiCoin", payMoney);
|
payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
|
if (siteBooking.getIsHalf() == 2) {
|
payMoney = new BigDecimal(site.getCashPrice()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
} else {
|
payMoney = new BigDecimal(site.getCashPriceOne()).multiply(new BigDecimal(split.length)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
|
//校验优惠券
|
Long couponId = siteBooking.getUserCouponId();
|
if (null != couponId && couponId != 0) {
|
UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(siteBooking.getUserCouponId(), siteBooking.getAppUserId()));
|
Coupon coupon = couponClient.queryCouponById(userCoupon.getCouponId());
|
if (coupon.getType() == 1) {//满减
|
// {"conditionalAmount":50,"deductionAmount":10,"experienceName":""}
|
JSONObject jsonObject = JSON.parseObject(coupon.getContent());
|
Double num1 = jsonObject.getDouble("conditionalAmount");
|
Double num2 = jsonObject.getDouble("deductionAmount");
|
payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num2)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
if (coupon.getType() == 2) {//代金券
|
JSONObject jsonObject = JSON.parseObject(coupon.getContent());
|
Double num1 = jsonObject.getDouble("conditionalAmount");
|
payMoney = new BigDecimal(payMoney).subtract(new BigDecimal(num1)).setScale(2, RoundingMode.HALF_EVEN).doubleValue();
|
}
|
}
|
map.put("cash", payMoney);
|
return ResultUtil.success(map);
|
}
|
|
@Override
|
public Object changeState(SiteChangeStateVO vo) {
|
|
List<Integer> siteIds = vo.getSiteIds();
|
Integer type = vo.getType();
|
return siteMapper.changeState(siteIds, type);
|
|
}
|
|
@Override
|
public String getSMIDByOperatorId(Integer id) {
|
return siteMapper.getSMIDByOperatorId(id);
|
}
|
@Override
|
public String getmerchantNumberByOperatorId(Integer id) {
|
return siteMapper.getmerchantNumberByOperatorId(id);
|
}
|
}
|