driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java
@@ -1,6 +1,7 @@ package com.supersavedriving.driver.modular.system.api; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.supersavedriving.driver.modular.system.model.Driver; import com.supersavedriving.driver.modular.system.model.DriverBank; import com.supersavedriving.driver.modular.system.model.Edition; import com.supersavedriving.driver.modular.system.model.JoiningRequirements; @@ -161,8 +162,9 @@ @ApiImplicitParams({ @ApiImplicitParam(value = "国家代码+86", name = "receiver", required = true, dataType = "string"), @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "string"), @ApiImplicitParam(value = "1=登录,2=注册", name = "type", required = true, dataType = "int"), }) public ResponseWarpper getVerificationCode(String receiver, String phone){ public ResponseWarpper getVerificationCode(String receiver, String phone, Integer type){ if(ToolUtil.isEmpty(receiver)){ return ResponseWarpper.success(ResultUtil.paranErr("receiver")); } @@ -170,6 +172,21 @@ return ResponseWarpper.success(ResultUtil.paranErr("phone")); } try { if(type == 1){ Driver driver = driverService.selectOne(new EntityWrapper<Driver>().eq("phone", phone).ne("status", 3)); if(null == driver){ return ResponseWarpper.success(ResultUtil.error("账号未注册")); } if(driver.getApprovalStatus() == 1){ return ResponseWarpper.success(ResultUtil.error("账号正在审核中")); } if(driver.getApprovalStatus() == 3){ return ResponseWarpper.success(ResultUtil.error("账号审核未通过")); } if(driver.getStatus() == 2){ return ResponseWarpper.success(ResultUtil.error("账号已冻结")); } } String numberRandom = UUIDUtil.getNumberRandom(5); SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]"); redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/OrderController.java
@@ -26,6 +26,8 @@ import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; @@ -382,10 +384,11 @@ @ApiOperation(value = "服务完成后修改订单状态", tags = {"司机端-服务中"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), @ApiImplicitParam(value = "107(线上支付),108(完成线下支付)", name = "state", required = true, dataType = "int"), @ApiImplicitParam(value = "支付方式(1=线上,2=线下)", name = "payType", required = true, dataType = "int"), @ApiImplicitParam(value = "107(待支付),108(已完成)", name = "state", required = true, dataType = "int"), @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResponseWarpper setOrderStatus(Long orderId, Integer state){ public ResponseWarpper setOrderStatus(Long orderId, Integer payType, Integer state){ if(ToolUtil.isEmpty(orderId)){ return ResponseWarpper.success(ResultUtil.paranErr("orderId")); } @@ -397,7 +400,7 @@ if(null == uid){ return ResponseWarpper.tokenErr(); } ResultUtil resultUtil = orderService.setOrderStatus(uid, orderId, state); ResultUtil resultUtil = orderService.setOrderStatus(uid, orderId, payType, state); return ResponseWarpper.success(resultUtil); }catch (Exception e){ e.printStackTrace(); @@ -447,8 +450,9 @@ @PostMapping("/base/order/cloudRecordingCallback") public void cloudRecordingCallback(HttpServletRequest request, HttpServletResponse response){ CloudRecordingCallback cloudRecordingCallback = RongYunUtil.cloudRecordingCallback(request); // System.err.println("-------------------云端录制状态回调!-------------------"); // System.err.println(JSON.toJSONString(cloudRecordingCallback)); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); System.err.println(sdf.format(new Date()) + "-------------------云端录制状态回调!-------------------"); System.err.println(JSON.toJSONString(cloudRecordingCallback)); if(null == cloudRecordingCallback){ System.err.println("云端录制状态回调解析出错!"); return; driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/CouponMapper.java
New file @@ -0,0 +1,7 @@ package com.supersavedriving.driver.modular.system.dao; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.supersavedriving.driver.modular.system.model.Coupon; public interface CouponMapper extends BaseMapper<Coupon> { } driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/UserToCouponMapper.java
New file @@ -0,0 +1,27 @@ package com.supersavedriving.driver.modular.system.dao; import com.baomidou.mybatisplus.mapper.BaseMapper; import com.supersavedriving.driver.modular.system.model.Coupon; import com.supersavedriving.driver.modular.system.model.UserToCoupon; import org.apache.ibatis.annotations.Param; /** * 用户优惠券 * @author zhibing.pu * @date 2023/3/2 11:44 */ public interface UserToCouponMapper extends BaseMapper<UserToCoupon> { /** * 获取可用优惠券 * @param uid * @param price * @return */ Coupon queryCoupon(@Param("uid") Integer uid, @Param("price") Double price); } driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/AccountChangeDetailMapper.xml
@@ -70,7 +70,7 @@ code, changeType as `type`, UNIX_TIMESTAMP(createTime) * 1000 as createTime, (newData - oldData) as money, (newData - oldData) as amount, newData as balance from t_account_change_detail where userType = 2 and userId = #{driverId} and changeType in (1, 3, 4, 7, 8) <if test="null != time and '' != time"> driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/CouponMapper.xml
New file @@ -0,0 +1,23 @@ <?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.supersavedriving.driver.modular.system.dao.CouponMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.Coupon"> <id column="id" property="id"/> <result column="agent_id" property="agentId"/> <result column="branch_office_id" property="branchOfficeId"/> <result column="create_time" property="createTime"/> <result column="coupon_name" property="couponName"/> <result column="coupon_type" property="couponType"/> <result column="coupon_code" property="couponCode"/> <result column="coupon_service_type" property="couponServiceType"/> <result column="coupon_conditional_amount" property="couponConditionalAmount"/> <result column="coupon_preferential_amount" property="couponPreferentialAmount"/> <result column="coupon_validity" property="couponValidity"/> <result column="coupon_send_quantity" property="couponSendQuantity"/> <result column="coupon_state" property="couponState"/> <result column="coupon_count" property="couponCount"/> <result column="remaining_quantity" property="remainingQuantity"/> </resultMap> </mapper> driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml
@@ -70,8 +70,8 @@ b.avatar, a.userName, a.userPhone, (select count(1) from t_order where userPhone = a.userPhone and state in (107, 108)) as orderTimes, (select count(1) from t_order where userPhone = a.userPhone and state in (301)) as cancelTimes, (select count(1) from t_order where userId = a.userId and state in (107, 108, 109)) as orderTimes, (select count(1) from t_order where userId = a.userId and state in (301)) as cancelTimes, a.source, UNIX_TIMESTAMP(a.createTime) * 1000 as createTime, a.startAddress, @@ -97,8 +97,8 @@ b.avatar, a.userName, a.userPhone, (select count(1) from t_order where userPhone = a.userPhone and state in (107, 108)) as orderTimes, (select count(1) from t_order where userPhone = a.userPhone and state in (301)) as cancelTimes, (select count(1) from t_order where userId = a.userId and state in (107, 108, 109)) as orderTimes, (select count(1) from t_order where userId = a.userId and state in (301)) as cancelTimes, a.source, UNIX_TIMESTAMP(a.createTime) * 1000 as createTime, a.startAddress, @@ -109,6 +109,7 @@ a.endLng, a.estimatedPrice, a.estimatedMileage, a.estimatedTime, a.startPrice, a.waitTime, a.actualMileage, @@ -190,7 +191,7 @@ count(1) as number from t_order a left join t_driver b on (a.driverId = b.id) where a.state in (107, 108, 108) and a.`status` = 1 where a.state in (107, 108, 109) and a.`status` = 1 <if test="null != dayType and 1 == dayType"><!--天--> <if test="null != time and '' != time"> and DATE_FORMAT(a.createTime, '%Y年%m月%d日') = #{time} driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/UserToCouponMapper.xml
New file @@ -0,0 +1,44 @@ <?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.supersavedriving.driver.modular.system.dao.UserToCouponMapper"> <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.UserToCoupon"> <id column="id" property="id" /> <result column="userId" property="userId" /> <result column="couponId" property="couponId" /> <result column="couponTotal" property="couponTotal" /> <result column="validCount" property="validCount" /> <result column="expireCount" property="expireCount" /> <result column="expireTime" property="expireTime" /> <result column="createTime" property="createTime" /> <result column="status" property="status" /> </resultMap> <select id="queryCoupon" resultType="com.supersavedriving.driver.modular.system.model.Coupon"> select b.id, a.agent_id as agentId, a.branch_office_id as branchOfficeId, a.create_time as createTime, a.coupon_name as couponName, a.coupon_type as couponType, a.coupon_code as couponCode, a.coupon_service_type as couponServiceType, a.coupon_conditional_amount as couponConditionalAmount, a.coupon_preferential_amount as couponPreferentialAmount, a.coupon_validity as couponValidity, a.coupon_send_quantity as couponSendQuantity, a.coupon_state as couponState, a.coupon_count as couponCount, a.remaining_quantity as remainingQuantity from t_coupon a left join t_user_to_coupon b on (a.id = b.couponId) where b.status = 1 and b.expireTime > now() and b.validCount > 0 and b.userId = #{uid} and a.coupon_conditional_amount <= #{price} and a.coupon_preferential_amount < #{price} order by a.coupon_preferential_amount desc limit 0, 1 </select> </mapper> driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Coupon.java
New file @@ -0,0 +1,95 @@ package com.supersavedriving.driver.modular.system.model; import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.enums.IdType; import lombok.Data; import java.util.Date; /** * 优惠券 * @author pzb * @Date 2023/2/28 11:57 */ @Data @TableName("t_coupon") public class Coupon { /** * 主键 */ @TableId(value = "id", type = IdType.AUTO) @TableField("id") private Integer id; /** * 代理商id */ @TableField("agent_id") private Integer agentId; /** * 分公司id */ @TableField("branch_office_id") private Integer branchOfficeId; /** * 创建时间 */ @TableField("create_time") private Date createTime; /** * 优惠券名称 */ @TableField("coupon_name") private String couponName; /** * 优惠券类型 1活动券 2新人券 */ @TableField("coupon_type") private Integer couponType; /** * 优惠券码 */ @TableField("coupon_code") private String couponCode; /** * 服务类型 1通用券 */ @TableField("coupon_service_type") private Integer couponServiceType; /** * 条件金额 */ @TableField("coupon_conditional_amount") private Double couponConditionalAmount; /** * 优惠金额 */ @TableField("coupon_preferential_amount") private Double couponPreferentialAmount; /** * 有效期 */ @TableField("coupon_validity") private Integer couponValidity; /** * 赠送数量 */ @TableField("coupon_send_quantity") private Integer couponSendQuantity; /** * 是否冻结 1正常 2冻结 */ @TableField("coupon_state") private Integer couponState; /** * 优惠券数量 */ @TableField("coupon_count") private Integer couponCount; /** * 剩余数量 */ @TableField("remaining_quantity") private Integer remainingQuantity; } driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/UserToCoupon.java
New file @@ -0,0 +1,65 @@ package com.supersavedriving.driver.modular.system.model; import com.baomidou.mybatisplus.annotations.TableField; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; import com.baomidou.mybatisplus.enums.IdType; import lombok.Data; import java.util.Date; /** * 用户优惠券关系 * @author pzb * @Date 2023/3/2 11:04 */ @Data @TableName("t_user_to_coupon") public class UserToCoupon { /** * 主键 */ @TableId(value = "id", type = IdType.AUTO) @TableField("id") private Integer id; /** * 用户id */ @TableField("userId") private Integer userId; /** * 优惠券id */ @TableField("couponId") private Integer couponId; /** * 领取总数 */ @TableField("couponTotal") private Integer couponTotal; /** * 有效数据 */ @TableField("validCount") private Integer validCount; /** * 过期数量 */ @TableField("expireCount") private Integer expireCount; /** * 过期时间 */ @TableField("expireTime") private Date expireTime; /** * 添加时间 */ @TableField("createTime") private Date createTime; /** * 状态 1正常 2冻结 3删除 */ @TableField("status") private Integer status; } driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/ICouponService.java
New file @@ -0,0 +1,7 @@ package com.supersavedriving.driver.modular.system.service; import com.baomidou.mybatisplus.service.IService; import com.supersavedriving.driver.modular.system.model.Coupon; public interface ICouponService extends IService<Coupon> { } driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IOrderService.java
@@ -153,7 +153,7 @@ * @return * @throws Exception */ ResultUtil setOrderStatus(Integer uid, Long orderId, Integer state) throws Exception; ResultUtil setOrderStatus(Integer uid, Long orderId, Integer payType, Integer state) throws Exception; /** driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IUserToCouponService.java
New file @@ -0,0 +1,24 @@ package com.supersavedriving.driver.modular.system.service; import com.baomidou.mybatisplus.service.IService; import com.supersavedriving.driver.modular.system.model.Coupon; import com.supersavedriving.driver.modular.system.model.UserToCoupon; /** * @author zhibing.pu * @date 2023/3/2 14:21 */ public interface IUserToCouponService extends IService<UserToCoupon> { /** * 获取可用优惠券 * @param uid * @param price * @return * @throws Exception */ Coupon queryCoupon(Integer uid, Double price) throws Exception; } driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/CouponServiceImpl.java
New file @@ -0,0 +1,11 @@ package com.supersavedriving.driver.modular.system.service.impl; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.supersavedriving.driver.modular.system.dao.CouponMapper; import com.supersavedriving.driver.modular.system.model.Coupon; import com.supersavedriving.driver.modular.system.service.ICouponService; import org.springframework.stereotype.Service; @Service public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon> implements ICouponService { } driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java
@@ -179,6 +179,7 @@ driver.setApprovalTime(null); driver.setApprovalUserId(null); driver.setStatus(1); driver.setSource(driverRegisterWarpper.getSource()); return driver; } @@ -545,7 +546,7 @@ DriverInfoWarpper driverInfo = new DriverInfoWarpper(); BeanUtils.copyProperties(driver, driverInfo); driverInfo.setBalance(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); driverInfo.setWithdrawBalance(driver.getBalance()); YouTuiDriver youTuiDriver = youTuiDriverService.selectOne(new EntityWrapper<YouTuiDriver>().eq("driverId", uid) .eq("state", 2).last(" and failureTime > now() order by failureTime limit 0, 1")); if(null != youTuiDriver){ driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverWorkServiceImpl.java
@@ -66,7 +66,7 @@ if(null != orderTransfer){ int i = Double.valueOf((System.currentTimeMillis() - orderTransfer.getSuccessTime().getTime()) / 60000).intValue(); if(num5 > i){ return ResultUtil.error("暂时还无法上班,请稍后重试"); return ResultUtil.error("暂时还无法上班,请" + (num5 - i) + "分钟后重试"); } } driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java
@@ -13,12 +13,8 @@ import com.supersavedriving.driver.modular.system.util.mongodb.model.Location; import com.supersavedriving.driver.modular.system.warpper.*; import com.supersavedriving.driver.core.util.ToolUtil; import com.supersavedriving.driver.modular.system.util.*; import com.supersavedriving.driver.modular.system.util.GaoDe.model.District; import com.supersavedriving.driver.modular.system.util.juhe.WeatherUtil; import com.supersavedriving.driver.modular.system.warpper.*; import com.supersavedriving.driver.modular.system.model.*; import com.supersavedriving.driver.modular.system.service.*; import com.supersavedriving.driver.modular.system.util.PushUtil; import com.supersavedriving.driver.modular.system.warpper.AddOrderWarpper; import com.supersavedriving.driver.modular.system.warpper.HallOrderList; @@ -93,6 +89,12 @@ @Autowired private IRevenueService revenueService; @Autowired private ICouponService couponService; @Autowired private IUserToCouponService userToCouponService; private Map<String, Timer> timerMap = new HashMap<>(); @@ -580,7 +582,7 @@ orderRefusal.setOrderId(orderId); orderRefusalService.insert(orderRefusal); Driver driver = driverService.selectById(order.getDriverId()); Driver driver = driverService.selectById(uid); //扣除积分 SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); if(null != systemConfig) { @@ -591,8 +593,10 @@ AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); accountChangeDetail.setUserType(2); accountChangeDetail.setUserId(order.getDriverId()); accountChangeDetail.setUserId(uid); accountChangeDetail.setType(2); accountChangeDetail.setChangeType(2); accountChangeDetail.setOrderId(orderId); accountChangeDetail.setOldData(null == driver.getIntegral() ? 0 : driver.getIntegral().doubleValue()); driver.setIntegral((null == driver.getIntegral() ? 0 : driver.getIntegral()) - num10); accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); @@ -635,7 +639,7 @@ redisUtil.unlock(); return ResultUtil.error("订单已被取消"); } if(state != 101){ if(state != 101 && state != 201){ redisUtil.unlock(); return ResultUtil.error("手速慢了哦"); } @@ -650,6 +654,7 @@ if(null != order.getUserId()){ AppUser appUser = appUserService.selectById(order.getUserId()); appUser.setCancelCount(0); appUser.setIsException(1); appUserService.updateById(appUser); } @@ -758,6 +763,10 @@ } if(order.getState() == 201){ return ResultUtil.error("订单正在转单中"); } if(order.getState() == 301){ redisUtil.unlock(); return ResultUtil.error("订单已被取消"); } order.setState(processOperationsWarpper.getState()); switch (processOperationsWarpper.getState()){ @@ -928,10 +937,16 @@ int travelTime = Double.valueOf((System.currentTimeMillis() - order.getStartTime().getTime()) / 60000).intValue(); pushOrderInfoWarpper.setTravelTime(travelTime); } pushUtil.pushOrderInfo(uid, 2, pushOrderInfoWarpper); if(null != order.getUserId()){ pushUtil.pushOrderInfo(order.getUserId(), 1, pushOrderInfoWarpper); } if(order.getState() == 301){//司机取消不推送给司机 CancelOrder cancelOrder = cancelOrderService.selectOne(new EntityWrapper<CancelOrder>().eq("orderId", order.getId()).eq("status", 1)); if(null != cancelOrder && cancelOrder.getUserType() == 2){ return; } } pushUtil.pushOrderInfo(uid, 2, pushOrderInfoWarpper); } },0, 10000); timerMap.put(orderId.toString(), timer); @@ -1073,6 +1088,8 @@ driver.setServerStatus(1); driverService.updateById(driver); } pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getStatus()); return ResultUtil.success(); } @@ -1122,17 +1139,59 @@ * @throws Exception */ @Override public ResultUtil setOrderStatus(Integer uid, Long orderId, Integer state) throws Exception { public ResultUtil setOrderStatus(Integer uid, Long orderId, Integer payType, Integer state) throws Exception { List<Integer> s = Arrays.asList(107, 108); if(!s.contains(state)){ return ResultUtil.error("操作失败"); } Order order = this.selectById(orderId); order.setState(state); // TODO: 2023/5/18 临时 payType = 1; if(state == 108){ payType = 2; } if(payType == 2 && state == 107){ Coupon coupon = userToCouponService.queryCoupon(order.getUserId(), order.getOrderMoney()); if(null != coupon){ order.setCouponId(coupon.getId()); order.setDiscountAmount(coupon.getCouponPreferentialAmount()); order.setPayMoney(order.getOrderMoney() - coupon.getCouponPreferentialAmount()); } } if(payType == 2 && state == 108){ order.setPayType(3); order.setPayTime(new Date()); order.setPayMoney(order.getOrderMoney() - order.getDiscountAmount()); if(null != order.getCouponId()){ UserToCoupon userToCoupon = userToCouponService.selectById(order.getCouponId()); if(userToCoupon.getValidCount() > 0){ userToCoupon.setValidCount(userToCoupon.getValidCount() - 1); userToCouponService.updateById(userToCoupon); Coupon coupon = couponService.selectById(userToCoupon.getCouponId()); order.setPayMoney(order.getPayMoney() - coupon.getCouponPreferentialAmount()); order.setCouponId(coupon.getId()); order.setDiscountedPrice(coupon.getCouponPreferentialAmount()); Driver driver = driverService.selectById(order.getDriverId()); AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); accountChangeDetail.setUserType(2); accountChangeDetail.setUserId(order.getDriverId()); accountChangeDetail.setCreateTime(new Date()); accountChangeDetail.setOldData(driver.getCouponBalance()); accountChangeDetail.setType(1); accountChangeDetail.setChangeType(7); accountChangeDetail.setOrderId(order.getId()); accountChangeDetail.setExplain("优惠券收入"); driver.setCouponBalance(driver.getCouponBalance() + coupon.getCouponPreferentialAmount()); accountChangeDetail.setNewData(driver.getCouponBalance()); driverService.updateById(driver); accountChangeDetailService.insert(accountChangeDetail); } } } this.updateById(order); @@ -1211,9 +1270,9 @@ //开始处理层级抽佣 if(null != driver.getInviterType() && driver.getInviterType() == 2){ Driver driver1 = driverService.selectById(driver.getInviterId());//一级司机 if(null != driver1.getInviterType() && driver1.getInviterType() == 2){ if(null != driver1 && null != driver1.getInviterType() && driver1.getInviterType() == 2){ Driver driver2 = driverService.selectById(driver1.getInviterId());//二级司机 if(null != driver2.getInviterType() && driver2.getInviterType() == 2){ if(null != driver2 && null != driver2.getInviterType() && driver2.getInviterType() == 2){ Driver driver3 = driverService.selectById(driver2.getInviterId());//三级级司机 Double num5 = jsonObject1.getDouble("num5"); Double num6 = jsonObject1.getDouble("num6"); @@ -1505,9 +1564,9 @@ @Override public List<MyAchievementWarpper> queryMyAchievement(Integer driverId, String time) throws Exception { List<MyAchievementWarpper> list = new ArrayList<>(); time = time.replaceAll("-", "年") + "月"; // time = time.replaceAll("-", "年"); //订单量 List<PerformanceRankingWarpper> performanceRankingWarppers = performanceRankingWarppers = this.baseMapper.queryDriverRank(time, 2); List<PerformanceRankingWarpper> performanceRankingWarppers = this.baseMapper.queryDriverRank(time, 2); int position = 0; Double d = 0D; for (int i = 0; i < performanceRankingWarppers.size(); i++) { driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/UserToCouponServiceImpl.java
New file @@ -0,0 +1,33 @@ package com.supersavedriving.driver.modular.system.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.supersavedriving.driver.modular.system.dao.UserToCouponMapper; import com.supersavedriving.driver.modular.system.model.Coupon; import com.supersavedriving.driver.modular.system.model.UserToCoupon; import com.supersavedriving.driver.modular.system.service.IUserToCouponService; import org.springframework.stereotype.Service; import java.util.List; /** * @author zhibing.pu * @date 2023/3/2 14:22 */ @Service public class UserToCouponServiceImpl extends ServiceImpl<UserToCouponMapper, UserToCoupon> implements IUserToCouponService { /** * 获取可用优惠券 * @param uid * @param price * @return * @throws Exception */ @Override public Coupon queryCoupon(Integer uid, Double price) throws Exception { return this.baseMapper.queryCoupon(uid, price); } } driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfoWarpper.java
@@ -23,6 +23,8 @@ private Long youTuiEnd; @ApiModelProperty("账户余额") private Double balance; @ApiModelProperty("可提现余额") private Double withdrawBalance; @ApiModelProperty("佣金余额") private Double commission; @ApiModelProperty("积分") driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverRegisterWarpper.java
@@ -32,4 +32,6 @@ private Integer inviterType; @ApiModelProperty(value = "邀约人Id", required = false, dataType = "int") private Integer inviterId; @ApiModelProperty(value = "注册来源(1=司机端注册,2=其他端注册)", required = true, dataType = "int") private Integer source; } driver/guns-admin/src/main/resources/application.yml
@@ -13,8 +13,8 @@ application: name: driver-server profiles: active: dev # active: produce # active: dev active: produce mvc: static-path-pattern: /static/** view: @@ -55,8 +55,8 @@ datasource: url: jdbc:mysql://127.0.0.1:3306/super_save_driving?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai username: root # password: f4OfRjqoN3jSiNGiUoiNsQdOBtCOKYRj password: 123456 password: f4OfRjqoN3jSiNGiUoiNsQdOBtCOKYRj # password: 123456 db-name: guns #用来搜集数据库的所有表 filters: wall,mergeStat @@ -116,8 +116,8 @@ spring: data: mongodb: # uri: mongodb://root:CEtyLdKjPk0yeHNo@127.0.0.1:27017/admin uri: mongodb://127.0.0.1:27017/admin uri: mongodb://root:CEtyLdKjPk0yeHNo@127.0.0.1:27017/admin # uri: mongodb://127.0.0.1:27017/admin --- driver/guns-admin/src/main/resources/redis.properties
@@ -2,19 +2,19 @@ # RedisÊý¾Ý¿âË÷Òý£¨Ä¬ÈÏΪ0£© spring.redis.database=0 # Redis·þÎñÆ÷µØÖ· spring.redis.host=127.0.0.1 # Redis·þÎñÆ÷Á¬½Ó¶Ë¿Ú spring.redis.port=16379 # Redis·þÎñÆ÷Á¬½ÓÃÜÂ루ĬÈÏΪ¿Õ£© spring.redis.password=cKsEeyffDXG5PzNg8CIbrWxFluXrCprZ ## Redis·þÎñÆ÷µØÖ· #spring.redis.host=127.0.0.1 ## Redis·þÎñÆ÷Á¬½Ó¶Ë¿Ú #spring.redis.port=16379 #spring.redis.port=6379 ## Redis·þÎñÆ÷Á¬½ÓÃÜÂ루ĬÈÏΪ¿Õ£© #spring.redis.password=cKsEeyffDXG5PzNg8CIbrWxFluXrCprZ ## Redis·þÎñÆ÷µØÖ· spring.redis.host=127.0.0.1 ## Redis·þÎñÆ÷Á¬½Ó¶Ë¿Ú spring.redis.port=6379 ## Redis·þÎñÆ÷Á¬½ÓÃÜÂ루ĬÈÏΪ¿Õ£© spring.redis.password=123456 #spring.redis.password=123456 # Á¬½Ó³Ø×î´óÁ¬½ÓÊý£¨Ê¹ÓøºÖµ±íʾûÓÐÏÞÖÆ£© spring.redis.jedis.pool.max-active=1024 driver/guns-admin/src/test/java/com/supersavedriving/driver/GunsApplicationTest.java
@@ -2,7 +2,9 @@ // //import com.supersavedriving.driver.modular.system.model.WeatherCity; //import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService; //import com.supersavedriving.driver.modular.system.service.IOrderService; //import com.supersavedriving.driver.modular.system.service.IWeatherCityService; //import com.supersavedriving.driver.modular.system.util.ResultUtil; //import com.supersavedriving.driver.modular.system.util.juhe.WeatherCityInfo; //import com.supersavedriving.driver.modular.system.util.juhe.WeatherUtil; //import org.junit.Test; @@ -18,11 +20,11 @@ //public class GunsApplicationTest { // // @Autowired // private IAccountChangeDetailService accountChangeDetailService; // private IOrderService orderService; // // // @Test // public void test(){ // accountChangeDetailService.deductionInsurance(); // public void test() throws Exception { // ResultUtil resultUtil = orderService.rejectionOrder(1, 1L); // } //}