pom.xml
@@ -29,6 +29,11 @@ <dependencies> <dependency> <groupId>com.aliyun</groupId> <artifactId>dysmsapi20170525</artifactId> <version>2.0.18</version> </dependency> <dependency> <groupId>com.aliyun.oss</groupId> <artifactId>aliyun-sdk-oss</artifactId> <version>${aliyun-oss.version}</version> src/main/java/cc/mrbird/febs/common/configure/WebMvcConfigure.java
@@ -26,7 +26,7 @@ registration.excludePathPatterns("/api/member/cashOutSetting"); registration.excludePathPatterns("/api/leader/leaderList"); registration.excludePathPatterns("/api/leader/leaderListInFence"); registration.excludePathPatterns("/api/leader/leaderTitle"); registration.excludePathPatterns("/api/leader/noLoginLeaderTitle"); registration.excludePathPatterns("/api/xcxPay/wxpayCallback"); registration.excludePathPatterns("/api/xcxPay/rechargeCallBack"); } src/main/java/cc/mrbird/febs/common/utils/ZzSmsSend.java
@@ -6,7 +6,11 @@ import cn.hutool.core.util.XmlUtil; import cn.hutool.crypto.SecureUtil; import cn.hutool.http.HttpUtil; import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.aliyun.dysmsapi20170525.models.SendSmsResponse; import lombok.extern.slf4j.Slf4j; import com.aliyun.tea.*; import java.util.Date; import java.util.HashMap; @@ -18,6 +22,60 @@ **/ @Slf4j public class ZzSmsSend { public static com.aliyun.dysmsapi20170525.Client createClient(String accessKeyId, String accessKeySecret) throws Exception { com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config() // 您的 AccessKey ID .setAccessKeyId(accessKeyId) // 您的 AccessKey Secret .setAccessKeySecret(accessKeySecret); // 访问的域名 config.endpoint = "dysmsapi.aliyuncs.com"; return new com.aliyun.dysmsapi20170525.Client(config); } private static final String SIGNNAME = "汇达农业"; private static final String TEMPLATECODE = "SMS_251041117"; public static boolean sendALiYun(String phone,String TemplateParam){ com.aliyun.dysmsapi20170525.Client client = null; try { client = createClient("LTAI4GBuydqbJ5bTsDP97Lpd", "vbCjQtPxABWjqtUlQfzjlA0qAY96fh"); } catch (Exception e) { e.printStackTrace(); return false; } com.aliyun.dysmsapi20170525.models.SendSmsRequest sendSmsRequest = new com.aliyun.dysmsapi20170525.models.SendSmsRequest() // .setSignName("阿里云短信测试") .setSignName(SIGNNAME) // .setTemplateCode("SMS_154950909") .setTemplateCode(TEMPLATECODE) // .setPhoneNumbers("15274802129") .setPhoneNumbers(phone) // .setTemplateParam("{\"code\":\"1234\"}"); .setTemplateParam("{\"code\":\""+TemplateParam+"\"}"); com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions(); try { // 复制代码运行请自行打印 API 的返回值 SendSmsResponse sendSmsResponse = client.sendSmsWithOptions(sendSmsRequest, runtime); log.info("短信发送:{}", sendSmsResponse); JSONObject jsonObject = JSONUtil.parseObj(sendSmsResponse); System.out.print(jsonObject); if(200 == sendSmsResponse.getStatusCode()) { return true; }else{ return false; } } catch (TeaException error) { // 如有需要,请打印 error com.aliyun.teautil.Common.assertAsString(error.message); } catch (Exception _error) { TeaException error = new TeaException(_error.getMessage(), _error); // 如有需要,请打印 error com.aliyun.teautil.Common.assertAsString(error.message); } return false; } private static final String URL = "http://zzsms365.com/v2sms.aspx?action=send"; @@ -52,17 +110,19 @@ } public static void main(String[] args) { Map<String, Object> data = new HashMap<>(); Long time = System.currentTimeMillis(); data.put("userid", USER_ID); data.put("timestamp", time); data.put("mobile", "15773002834"); String signStr = ACCOUNT + PWD + time; String sign = SecureUtil.md5(signStr); data.put("sign", sign); data.put("content", "【HiBit】尊敬的用户,恭喜您于2010-03-25有一笔充值已成功到账,充值数量为10。"); String post = HttpUtil.post(URL, data); System.out.println(post); // Map<String, Object> data = new HashMap<>(); // Long time = System.currentTimeMillis(); // data.put("userid", USER_ID); // data.put("timestamp", time); // data.put("mobile", "15773002834"); // String signStr = ACCOUNT + PWD + time; // String sign = SecureUtil.md5(signStr); // data.put("sign", sign); // data.put("content", "【HiBit】尊敬的用户,恭喜您于2010-03-25有一笔充值已成功到账,充值数量为10。"); // // String post = HttpUtil.post(URL, data); // System.out.println(post); boolean b = sendALiYun( "15274802129", "123456"); System.out.println(b); } } src/main/java/cc/mrbird/febs/mall/controller/AdminMallOrderController.java
@@ -349,7 +349,7 @@ orderStateDto.setGoodsName(StrUtil.sub(productNames,0,15)+"..."); String takeUniqueCode = mallOrderInfo.getTakeUniqueCode(); MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(takeUniqueCode); orderStateDto.setAddressArea(StrUtil.sub(mallTeamLeader.getAddressArea(),0,20)+"..."); orderStateDto.setAddressArea(mallTeamLeader.getAddressArea()); orderStateDto.setDetailAddress(StrUtil.sub(mallTeamLeader.getDetailAddress(),0,20)+"..."); orderStateDto.setRemark("果蔬等生鲜,请尽快取货"); orderStateDto.setLeaderPhone(mallTeamLeader.getPhone()); src/main/java/cc/mrbird/febs/mall/controller/ApiMallTeamLeaderController.java
@@ -134,6 +134,21 @@ return iApiMallTeamLeaderService.leaderTitle(apiLeaderTitleDto); } /** * 商品列表页的团长信息 * 有团长特征码直接显示该团长, * 有经纬度,按照经纬度选择距离最近的 * 没有选择团长列表的第一个 */ @ApiOperation(value = "商品列表页的团长信息", notes = "商品列表页的团长信息") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiLeaderInfoVo.class) }) @PostMapping("/noLoginLeaderTitle") public FebsResponse noLoginLeaderTitle(@RequestBody ApiLeaderTitleDto apiLeaderTitleDto) { return iApiMallTeamLeaderService.noLoginLeaderTitle(apiLeaderTitleDto); } @ApiOperation(value = "获取团长订单角标数量") @GetMapping(value = "/findTeamOrderMarkCnt") public FebsResponse findTeamOrderMarkCnt() { src/main/java/cc/mrbird/febs/mall/controller/CommonController.java
@@ -76,6 +76,42 @@ return new FebsResponse().fail().message("验证码发送失败"); } @ApiOperation(value = "获取阿里云验证码接口", notes = "获取阿里云验证码接口") @GetMapping(value = "/aliVerifyCode") public FebsResponse aliVerifyCode(@ApiParam(name = "account", value = "手机号", required = true) @RequestParam(value = "account") String account, @ApiParam(name = "type", value = "类型1-手机号", required = true) @RequestParam("type") String type) { log.info("#账号:{}, 类型:{}#", account, type); Integer code = (int) ((Math.random() * 9 + 1) * 100000); if (StrUtil.isNotBlank(redisUtils.getString(AppContants.VERIFY_CODE_PREFIX + account))) { throw new FebsException("验证码已发送"); } // 发送手机验证码 if (AppContants.ACCOUNT_TYPE_MOBILE.equals(type)) { boolean result = ZzSmsSend.sendALiYun(account, code.toString()); if (result) { Map<String, Object> map = new HashMap<>(); boolean flag = redisUtils.set(AppContants.VERIFY_CODE_PREFIX + account, code, 120); map.put("code", flag); return new FebsResponse().success().message("验证码发送成功"); } // 发送邮件验证码 } else if (AppContants.ACCOUNT_TYPE_EMAIL.equals(type)) { boolean flag = SubMailSend.sendMail(account, code.toString()); if (flag) { redisUtils.set(AppContants.VERIFY_CODE_PREFIX + account, code, 120); return new FebsResponse().success().message("验证码发送成功"); } else { return new FebsResponse().fail().message("验证码发送失败"); } } else { log.info("未定义账号类型"); throw new FebsException("未定义账号类型"); } return new FebsResponse().fail().message("验证码发送失败"); } /** * 图片上传 * @return src/main/java/cc/mrbird/febs/mall/entity/MallLeaderDefault.java
New file @@ -0,0 +1,19 @@ package cc.mrbird.febs.mall.entity; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; //默认团长 @Data @TableName("mall_leader_default") public class MallLeaderDefault { @TableId(value = "id",type = IdType.AUTO) private Long id; private Long memberId; private String uniqueCode; } src/main/java/cc/mrbird/febs/mall/mapper/MallGoodsMapper.java
@@ -50,4 +50,6 @@ MallGoodsCommentVo findMallGoodsCommentLevelByGoodsId(@Param("id")Long id); Integer upDateStockAndVolumeByGoodsId(@Param("id")Long id,@Param("cnt")Integer cnt); Integer updateStockAndVolumeByGoodsId(@Param("id")Long id,@Param("cnt")Integer cnt); } src/main/java/cc/mrbird/febs/mall/mapper/MallGoodsSkuMapper.java
@@ -21,4 +21,6 @@ int delSkuByIds(@Param("list") List<Long> ids); Integer upDateStockAndVolumeBySkuId(@Param("id")Long id, @Param("cnt")Integer cnt); Integer updateStockAndVolumeBySkuId(@Param("id")Long id, @Param("cnt")Integer cnt); } src/main/java/cc/mrbird/febs/mall/mapper/MallLeaderDefaultMapper.java
New file @@ -0,0 +1,11 @@ package cc.mrbird.febs.mall.mapper; import cc.mrbird.febs.mall.entity.MallLeaderDefault; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Param; public interface MallLeaderDefaultMapper extends BaseMapper<MallLeaderDefault> { MallLeaderDefault selectByMemberId(@Param("memberId")Long id); } src/main/java/cc/mrbird/febs/mall/mapper/MallOrderInfoMapper.java
@@ -45,6 +45,8 @@ List<MallOrderInfo> selectOrderInfoByStatus(@Param("status") Integer status); List<MallOrderInfo> selectOrderInfoUpTime(@Param("status") Integer status); Integer selectCntDirectOrTeam(@Param("type") Integer type, @Param("inviteId") String inviteId); Integer selectCntDirect(@Param("inviteId") String inviteId); src/main/java/cc/mrbird/febs/mall/quartz/OrderOvertimeJob.java
@@ -1,6 +1,7 @@ package cc.mrbird.febs.mall.quartz; import cc.mrbird.febs.common.enumerates.OrderStatusEnum; import cc.mrbird.febs.common.exception.FebsException; import cc.mrbird.febs.mall.entity.MallGoods; import cc.mrbird.febs.mall.entity.MallGoodsSku; import cc.mrbird.febs.mall.entity.MallOrderInfo; @@ -45,31 +46,35 @@ @Scheduled(cron = "0 0/5 * * * ? ") public void overtimeJob() { log.info("订单超时任务执行"); List<MallOrderInfo> orderList = orderInfoMapper.selectOrderInfoByStatus(OrderStatusEnum.WAIT_PAY.getValue()); List<MallOrderInfo> orderList = orderInfoMapper.selectOrderInfoUpTime(OrderStatusEnum.WAIT_PAY.getValue()); if (CollUtil.isNotEmpty(orderList)) { for (MallOrderInfo orderInfo : orderList) { long subTime = DateUtil.between(orderInfo.getOrderTime(), new Date(), DateUnit.MINUTE, false); //更新订单状态 orderInfo.setStatus(OrderStatusEnum.CANCEL.getValue()); orderInfo.setCancelType(MallOrderInfo.CANCEL_OVERTIME_NO_PAY); orderInfoMapper.updateById(orderInfo); if (subTime > 15) { orderInfo.setStatus(OrderStatusEnum.CANCEL.getValue()); orderInfo.setCancelType(MallOrderInfo.CANCEL_OVERTIME_NO_PAY); orderInfoMapper.updateById(orderInfo); List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(orderInfo.getId()); if(CollUtil.isNotEmpty(mallOrderItemList)){ for(MallOrderItem mallOrderItem : mallOrderItemList){ MallGoodsSku sku = mallGoodsSkuMapper.selectSkuInfoById(mallOrderItem.getSkuId()); if (sku == null) { throw new FebsException("购买商品或sku不存在"); } List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(orderInfo.getId()); if (CollUtil.isNotEmpty(mallOrderItemList)) { for (MallOrderItem mallOrderItem : mallOrderItemList) { Long goodsId = mallOrderItem.getGoodsId(); Long skuId = mallOrderItem.getSkuId(); Integer cnt = mallOrderItem.getCnt(); MallGoods mallGoods = mallGoodsMapper.selectById(goodsId); mallGoods.setVolume(mallGoods.getVolume() - cnt); mallGoods.setStock(mallGoods.getStock() + cnt); mallGoodsMapper.updateById(mallGoods); // if (sku.getStock() < mallOrderItem.getCnt()) { // throw new FebsException(sku.getSkuName() + "库存不足"); // } MallGoodsSku mallGoodsSku = mallGoodsSkuMapper.selectById(skuId); mallGoodsSku.setSkuVolume(mallGoodsSku.getSkuVolume() - cnt); mallGoodsSku.setStock(mallGoodsSku.getStock() + cnt); mallGoodsSkuMapper.updateById(mallGoodsSku); MallGoods mallGoods = mallGoodsMapper.selectById(sku.getGoodsId()); Integer goodsResult = mallGoodsMapper.updateStockAndVolumeByGoodsId(mallGoods.getId(), mallOrderItem.getCnt()); if(1 != goodsResult){ throw new FebsException(mallGoods.getGoodsName() + "库存不足"); } Integer skuResult = mallGoodsSkuMapper.updateStockAndVolumeBySkuId(sku.getId(),mallOrderItem.getCnt()); if(1 != skuResult){ throw new FebsException(sku.getSkuName() + "库存不足"); } } } src/main/java/cc/mrbird/febs/mall/service/IApiMallTeamLeaderService.java
@@ -37,4 +37,6 @@ List<ApiOrderProfitVo> findLeaderProfitListInPage(ApiOrderProfitDto apiOrderProfitDto); FebsResponse findSomeLeaderListInPage(ApiLeaderListDto apiLeaderListDto); FebsResponse noLoginLeaderTitle(ApiLeaderTitleDto apiLeaderTitleDto); } src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallOrderInfoServiceImpl.java
@@ -100,6 +100,9 @@ //订单范围内才允许下单 MallAddressInfo address = mallAddressInfoMapper.selectAddressInfoByMemberIdAndId(member.getId(), addOrderDto.getAddressId()); if(ObjectUtil.isEmpty(address)){ throw new FebsException("请重新选择提货人信息"); } // MallElectronicFence mallElectronicFence = mallElectronicFenceMapper.selectByTeamLeaderCode(mallTeamLeader.getUniqueCode()); // if(ObjectUtil.isNotEmpty(mallElectronicFence)){ // String inStr = iMallElectronicFenceService.fenceToLocation(mallElectronicFence.getGKey(), @@ -260,23 +263,34 @@ orderInfo.setStatus(OrderStatusEnum.CANCEL.getValue()); orderInfo.setCancelType(MallOrderInfo.CANCEL_BY_SELF); this.baseMapper.updateById(orderInfo); List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(id); List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(orderInfo.getId()); if(CollUtil.isNotEmpty(mallOrderItemList)){ for(MallOrderItem mallOrderItem : mallOrderItemList){ Long goodsId = mallOrderItem.getGoodsId(); Long skuId = mallOrderItem.getSkuId(); Integer cnt = mallOrderItem.getCnt(); MallGoods mallGoods = mallGoodsMapper.selectById(goodsId); mallGoods.setVolume(mallGoods.getVolume() - cnt); mallGoods.setStock(mallGoods.getStock() + cnt); mallGoodsMapper.updateById(mallGoods); MallGoodsSku sku = mallGoodsSkuMapper.selectSkuInfoById(mallOrderItem.getSkuId()); if (sku == null) { throw new FebsException("购买商品或sku不存在"); } MallGoodsSku mallGoodsSku = mallGoodsSkuMapper.selectById(skuId); mallGoodsSku.setSkuVolume(mallGoodsSku.getSkuVolume() - cnt); mallGoodsSku.setStock(mallGoodsSku.getStock() + cnt); mallGoodsSkuMapper.updateById(mallGoodsSku); if (sku.getStock() < mallOrderItem.getCnt()) { throw new FebsException(sku.getSkuName() + "库存不足"); } MallGoods mallGoods = mallGoodsMapper.selectById(sku.getGoodsId()); Integer goodsResult = mallGoodsMapper.updateStockAndVolumeByGoodsId(mallGoods.getId(), mallOrderItem.getCnt()); if(1 != goodsResult){ throw new FebsException(mallGoods.getGoodsName() + "库存不足"); } Integer skuResult = mallGoodsSkuMapper.updateStockAndVolumeBySkuId(sku.getId(),mallOrderItem.getCnt()); if(1 != skuResult){ throw new FebsException(sku.getSkuName() + "库存不足"); } } } } /** @@ -483,7 +497,8 @@ IPage<MallOrderInfo> page = new Page<>(orderListDto.getPageNum(), orderListDto.getPageSize()); orderListDto.setMemberId(member.getId()); IPage<MallOrderInfo> mallOrderInfos = this.baseMapper.selectApiOrderListInPage(page, orderListDto); // IPage<MallOrderInfo> mallOrderInfos = this.baseMapper.selectApiOrderListInPage(page, orderListDto); IPage<MallOrderInfo> mallOrderInfos = this.baseMapper.selectNewApiOrderListInPage(page, orderListDto); if (CollUtil.isNotEmpty(mallOrderInfos.getRecords())) { mallOrderInfos.getRecords().forEach(item -> { item.setItems(mallOrderItemMapper.selectListByOrderId(item.getId())); @@ -688,6 +703,31 @@ orderInfo.setStatus(OrderStatusEnum.CANCEL.getValue()); orderInfo.setCancelType(MallOrderInfo.CANCEL_OVERTIME_NO_PAY); this.baseMapper.updateById(orderInfo); List<MallOrderItem> mallOrderItemList = mallOrderItemMapper.selectListByOrderId(orderInfo.getId()); if(CollUtil.isNotEmpty(mallOrderItemList)){ for(MallOrderItem mallOrderItem : mallOrderItemList){ MallGoodsSku sku = mallGoodsSkuMapper.selectSkuInfoById(mallOrderItem.getSkuId()); if (sku == null) { throw new FebsException("购买商品或sku不存在"); } // if (sku.getStock() < mallOrderItem.getCnt()) { // throw new FebsException(sku.getSkuName() + "库存不足"); // } MallGoods mallGoods = mallGoodsMapper.selectById(sku.getGoodsId()); Integer goodsResult = mallGoodsMapper.updateStockAndVolumeByGoodsId(mallGoods.getId(), mallOrderItem.getCnt()); if(1 != goodsResult){ throw new FebsException(mallGoods.getGoodsName() + "库存不足"); } Integer skuResult = mallGoodsSkuMapper.updateStockAndVolumeBySkuId(sku.getId(),mallOrderItem.getCnt()); if(1 != skuResult){ throw new FebsException(sku.getSkuName() + "库存不足"); } } } } } src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java
@@ -64,6 +64,7 @@ private final MallGoodsSkuMapper mallGoodsSkuMapper; private final MallElectronicFenceMapper mallElectronicFenceMapper; private final IMallElectronicFenceServiceImpl iMallElectronicFenceService; private final MallLeaderDefaultMapper mallLeaderDefaultMapper; @Override @Transactional @@ -154,6 +155,7 @@ @Override public FebsResponse getApiLeaderInfoVoById(Long id) { MallMember member = LoginUserUtil.getLoginUser(); MallTeamLeader mallTeamLeader = this.baseMapper.selectById(id); ApiLeaderInfoVo apiLeaderInfoVo = new ApiLeaderInfoVo(); apiLeaderInfoVo.setId(mallTeamLeader.getId()); @@ -171,6 +173,14 @@ String longLatStr = mallElectronicFence.getLonglatiarr(); apiLeaderInfoVo.setLonglatiarr(longLatStr); } MallLeaderDefault mallLeaderDefault1 = mallLeaderDefaultMapper.selectByMemberId(member.getId()); if(ObjectUtil.isNotEmpty(mallLeaderDefault1)){ mallLeaderDefaultMapper.deleteById(mallLeaderDefaultMapper.selectByMemberId(member.getId()).getId()); } MallLeaderDefault mallLeaderDefault = new MallLeaderDefault(); mallLeaderDefault.setMemberId(member.getId()); mallLeaderDefault.setUniqueCode(mallTeamLeader.getUniqueCode()); mallLeaderDefaultMapper.insert(mallLeaderDefault); return new FebsResponse().success().data(apiLeaderInfoVo); } @@ -222,7 +232,7 @@ orderStateDto.setGoodsName(StrUtil.sub(productNames,0,20)+"..."); String takeUniqueCode = mallOrderInfo.getTakeUniqueCode(); MallTeamLeader mallTeamLeader = mallTeamLeaderMapper.selectLeaderByUniqueCode(takeUniqueCode); orderStateDto.setAddressArea(StrUtil.sub(mallTeamLeader.getAddressArea(),0,20)+"..."); orderStateDto.setAddressArea(mallTeamLeader.getAddressArea()); orderStateDto.setDetailAddress(StrUtil.sub(mallTeamLeader.getDetailAddress(),0,20)+"..."); orderStateDto.setLeaderPhone(mallTeamLeader.getPhone()); orderStateDto.setOpenId(mallMemberMapper.selectById(mallOrderInfo.getMemberId()).getOpenId()); @@ -279,20 +289,29 @@ Double latitude = apiLeaderTitleDto.getLatitude() == null ? 0 : apiLeaderTitleDto.getLatitude(); ApiLeaderInfoVo apiLeaderInfoVo = new ApiLeaderInfoVo(); MallTeamLeader mallTeamLeader = new MallTeamLeader(); //特征码扫码 if(StrUtil.isNotEmpty(uniqueCode)){ mallTeamLeader = this.baseMapper.selectLeaderByUniqueCode(uniqueCode); //经纬度定位 }else if(longitude != 0 && latitude != 0){ mallTeamLeader = this.baseMapper.selectLeaderByLonAndLat(longitude,latitude); //直接进入,默认选择列表第一个 MallMember member = LoginUserUtil.getLoginUser(); if(ObjectUtil.isNotEmpty(member)){ MallLeaderDefault mallLeaderDefault = mallLeaderDefaultMapper.selectByMemberId(member.getId()); if(ObjectUtil.isNotEmpty(mallLeaderDefault)){ mallTeamLeader = this.baseMapper.selectLeaderByUniqueCode(mallLeaderDefault.getUniqueCode()); } }else{ List<MallTeamLeader> mallTeamLeaderList = this.baseMapper.getMallTeamLeaderList(); if(CollUtil.isNotEmpty(mallTeamLeaderList)){ mallTeamLeader = mallTeamLeaderList.get(0); //特征码扫码 if(StrUtil.isNotEmpty(uniqueCode)){ mallTeamLeader = this.baseMapper.selectLeaderByUniqueCode(uniqueCode); //经纬度定位 }else if(longitude != 0 && latitude != 0){ mallTeamLeader = this.baseMapper.selectLeaderByLonAndLat(longitude,latitude); //直接进入,默认选择列表第一个 }else{ List<MallTeamLeader> mallTeamLeaderList = this.baseMapper.getMallTeamLeaderList(); if(CollUtil.isNotEmpty(mallTeamLeaderList)){ mallTeamLeader = mallTeamLeaderList.get(0); } } } if(ObjectUtil.isNotEmpty(mallTeamLeader)){ apiLeaderInfoVo.setId(mallTeamLeader.getId()); apiLeaderInfoVo.setName(mallTeamLeader.getName()); @@ -543,4 +562,50 @@ return new FebsResponse().success().data(apiLeaderListVos); } @Override public FebsResponse noLoginLeaderTitle(ApiLeaderTitleDto apiLeaderTitleDto) { String uniqueCode = apiLeaderTitleDto.getUniqueCode(); Double longitude = apiLeaderTitleDto.getLongitude() == null ? 0 : apiLeaderTitleDto.getLongitude(); Double latitude = apiLeaderTitleDto.getLatitude() == null ? 0 : apiLeaderTitleDto.getLatitude(); ApiLeaderInfoVo apiLeaderInfoVo = new ApiLeaderInfoVo(); MallTeamLeader mallTeamLeader = new MallTeamLeader(); //特征码扫码 if(StrUtil.isNotEmpty(uniqueCode)){ mallTeamLeader = this.baseMapper.selectLeaderByUniqueCode(uniqueCode); //经纬度定位 }else if(longitude != 0 && latitude != 0){ mallTeamLeader = this.baseMapper.selectLeaderByLonAndLat(longitude,latitude); //直接进入,默认选择列表第一个 }else{ List<MallTeamLeader> mallTeamLeaderList = this.baseMapper.getMallTeamLeaderList(); if(CollUtil.isNotEmpty(mallTeamLeaderList)){ mallTeamLeader = mallTeamLeaderList.get(0); } } if(ObjectUtil.isNotEmpty(mallTeamLeader)){ apiLeaderInfoVo.setId(mallTeamLeader.getId()); apiLeaderInfoVo.setName(mallTeamLeader.getName()); apiLeaderInfoVo.setPhone(mallTeamLeader.getPhone()); apiLeaderInfoVo.setAddressPic(mallTeamLeader.getAddressPic()); apiLeaderInfoVo.setUniqueCode(mallTeamLeader.getUniqueCode()); apiLeaderInfoVo.setProvince(mallTeamLeader.getProvince()); apiLeaderInfoVo.setCity(mallTeamLeader.getCity()); apiLeaderInfoVo.setTownship(mallTeamLeader.getTownship()); apiLeaderInfoVo.setDetailAddress(mallTeamLeader.getDetailAddress()); apiLeaderInfoVo.setAddressArea(mallTeamLeader.getAddressArea()); MallElectronicFence mallElectronicFence = mallElectronicFenceMapper.selectByTeamLeaderCode(mallTeamLeader.getUniqueCode()); if(ObjectUtil.isNotEmpty(mallElectronicFence)){ apiLeaderInfoVo.setLonglatiarr(mallElectronicFence.getLonglatiarr()); } apiLeaderInfoVo.setLongitude(mallTeamLeader.getLongitude()); apiLeaderInfoVo.setLatitude(mallTeamLeader.getLatitude()); } if(ObjectUtil.isEmpty(apiLeaderInfoVo)){ return new FebsResponse().success(); } return new FebsResponse().success().data(apiLeaderInfoVo); } } src/main/java/cc/mrbird/febs/pay/service/impl/XcxPayServiceImpl.java
@@ -225,10 +225,9 @@ orderStateMsgVo.setTemplate_id(info.getTemplateId());//订阅消息模板id orderStateMsgVo.setPage(info.getPage()); Map<String, WxTemplateData> m = new HashMap<>(4); m.put("thing4.DATA", new WxTemplateData(info.getAddressArea())); m.put("phone_number14.DATA", new WxTemplateData(info.getLeaderPhone())); m.put("thing19.DATA", new WxTemplateData(info.getAddressArea())); m.put("phone_number18.DATA", new WxTemplateData(info.getLeaderPhone())); m.put("thing3.DATA", new WxTemplateData(info.getGoodsName())); m.put("thing5.DATA", new WxTemplateData(info.getDetailAddress())); m.put("thing15.DATA", new WxTemplateData(info.getRemark())); orderStateMsgVo.setData(m); String s = JSONUtil.toJsonStr(orderStateMsgVo); src/main/resources/mapper/modules/MallGoodsMapper.xml
@@ -271,4 +271,11 @@ where id=#{id} and stock - #{cnt} <![CDATA[ >= ]]> 0 </update> <update id="updateStockAndVolumeByGoodsId"> update mall_goods set stock = stock + #{cnt}, volume = volume - #{cnt} where id=#{id} and volume - #{cnt} <![CDATA[ >= ]]> 0 </update> </mapper> src/main/resources/mapper/modules/MallGoodsSkuMapper.xml
@@ -45,4 +45,11 @@ sku_volume = sku_volume + #{cnt} where id=#{id} and stock - #{cnt} <![CDATA[ >= ]]> 0 </update> <update id="updateStockAndVolumeBySkuId"> update mall_goods_sku set stock = stock + #{cnt}, sku_volume = sku_volume - #{cnt} where id=#{id} and sku_volume - #{cnt} <![CDATA[ >= ]]> 0 </update> </mapper> src/main/resources/mapper/modules/MallLeaderDefaultMapper.xml
New file @@ -0,0 +1,8 @@ <?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="cc.mrbird.febs.mall.mapper.MallLeaderDefaultMapper"> <select id="selectByMemberId" resultType="cc.mrbird.febs.mall.entity.MallLeaderDefault"> select * from mall_leader_default where member_id=#{memberId} </select> </mapper> src/main/resources/mapper/modules/MallOrderInfoMapper.xml
@@ -71,7 +71,6 @@ left join mall_member b on a.member_id = b.id left join mall_team_leader c on a.take_unique_code = c.unique_code <where> a.del_flag=2 <if test="record != null"> <if test="record.payResult != null and record.payResult != ''"> and a.pay_result = #{record.payResult} @@ -259,6 +258,10 @@ select * from mall_order_info where status=#{status} </select> <select id="selectOrderInfoUpTime" resultType="cc.mrbird.febs.mall.entity.MallOrderInfo"> select * from mall_order_info where status=#{status} and now() > date_add(order_time,interval 15 minute) </select> <select id="selectCntDirectOrTeam" resultType="java.lang.Integer"> select IFNULL(count(1), 0) from mall_order_info a inner join mall_member b on a.member_id=b.ID @@ -366,4 +369,77 @@ select * from mall_order_info where status=#{status} and date_format(pay_time, '%Y-%m-%d') = date_format(#{paytime}, '%Y-%m-%d') </select> <resultMap id="NewOrderInfoMap" type="cc.mrbird.febs.mall.entity.MallOrderInfo"> <id column="id" property="id" /> <result column="order_no" property="orderNo" /> <result column="member_id" property="memberId" /> <result column="order_time" property="orderTime" /> <result column="pay_time" property="payTime" /> <result column="amount" property="amount" /> <result column="pay_method" property="payMethod" /> <result column="pay_order_no" property="payOrderNo" /> <result column="pay_result" property="payResult" /> <result column="status" property="status" /> <result column="cancel_type" property="cancelType" /> <result column="name" property="name" /> <result column="phone" property="phone" /> <result column="address" property="address" /> <result column="longitude" property="longitude" /> <result column="latitude" property="latitude" /> <result column="order_type" property="orderType" /> <result column="comment_state" property="commentState" /> <result column="carriage" property="carriage" /> <result column="remark" property="remark" /> <result column="take_code" property="takeCode" /> <result column="take_unique_code" property="takeUniqueCode" /> <result column="delivery_state" property="deliveryState" /> <result column="is_home" property="isHome" /> <result column="del_flag" property="delFlag" /> <result column="leader_name" property="leaderName" /> <result column="leader_phone" property="leaderPhone" /> <result column="address_pic" property="addressPic" /> <result column="address_area" property="addressArea" /> <result column="province" property="province" /> <result column="leaderLongitude" property="leaderLongitude" /> <result column="leaderLatitude" property="leaderLatitude" /> <result column="province" property="province" /> <result column="city" property="city" /> <result column="township" property="township" /> <result column="detail_address" property="detailAddress" /> </resultMap> <select id="selectNewApiOrderListInPage" resultMap="NewOrderInfoMap"> select a.*, c.name leader_name, c.phone leader_phone, c.address_pic, c.address_area, c.province, c.city, c.township, c.detail_address from mall_order_info a inner join mall_team_leader c on a.take_unique_code=c.unique_code <where> a.del_flag=2 <if test="record.memberId != null"> and a.member_id=#{record.memberId} </if> <if test="record.status == 4 and record.status != 0"> and a.status = 4 </if> <if test="record.status != 4 and record.status != 0 and record.status != 5"> and a.status = #{record.status} </if> <if test="record.status == 5"> and a.status = 7 or b.state in (2,3) </if> <if test="record.orderType != null"> and a.order_type=#{record.orderType} </if> </where> order by a.created_time desc </select> </mapper>