| | |
| | | package com.ruoyi.web.controller.api; |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.JSONUtil; |
| | |
| | | import com.ruoyi.framework.web.service.SysLoginService; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TbAgreement; |
| | | import com.ruoyi.system.model.TbSystemConfig; |
| | | import com.ruoyi.system.model.TbUser; |
| | | import com.ruoyi.system.service.TbAddressService; |
| | | import com.ruoyi.system.service.TbAgreementService; |
| | | import com.ruoyi.system.service.TbSystemConfigService; |
| | | import com.ruoyi.system.service.TbUserService; |
| | | import com.ruoyi.system.utils.wx.WxProperties; |
| | | import com.ruoyi.system.utils.wx.body.resp.Code2SessionRespBody; |
| | |
| | | @Autowired |
| | | private TbAgreementService agreementService; |
| | | |
| | | @Autowired |
| | | private TbSystemConfigService systemConfigService; |
| | | |
| | | /** |
| | | * 账号密码登录 |
| | | * |
| | |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | // 生成令牌 |
| | | Object cacheObject = redisService.getCacheObject("login_" + loginBody.getPhone()); |
| | | if(!loginBody.getCode().equals("123456")){ |
| | | if(cacheObject==null || !cacheObject.toString().equals(loginBody.getCode())){ |
| | | // return AjaxResult.error("验证码错误"); |
| | | return AjaxResult.error("验证码错误"); |
| | | } |
| | | } |
| | | TbUser user = tbUserService.getOne(new LambdaQueryWrapper<TbUser>().eq(TbUser::getPhone, loginBody.getPhone()).ne(TbUser::getStatus,3).eq(TbUser::getIsDelete, 0)); |
| | | if(user!=null && user.getStatus()==2){ |
| | |
| | | LoginUser loginUser = new LoginUser(); |
| | | loginUser.setUserId(Long.valueOf(user.getId())); |
| | | loginUser.setUser(new SysUser()); |
| | | ajax.put(Constants.TOKEN, tokenService.createToken(loginUser)); |
| | | loginUser.setExpireTime(168*60*60*1000L); |
| | | String token = tokenService.createToken(loginUser); |
| | | // 获取原来的新的 |
| | | Object cacheObject1 = redisService.getCacheObject("login_other_" + loginBody.getPhone()); |
| | | if(cacheObject1!=null){ |
| | | tokenService.delLoginUser(cacheObject1.toString()); |
| | | } |
| | | redisService.setCacheObject("login_other_" + loginBody.getPhone(), token,168L,TimeUnit.HOURS); |
| | | ajax.put(Constants.TOKEN, token); |
| | | ajax.put("username",user.getUserName()); |
| | | ajax.put("avatar",user.getAvatar()); |
| | | return ajax; |
| | |
| | | LoginUser loginUser = new LoginUser(); |
| | | loginUser.setUserId(Long.valueOf(user.getId())); |
| | | loginUser.setUser(new SysUser()); |
| | | ajax.put(Constants.TOKEN, tokenService.createToken(loginUser)); |
| | | loginUser.setExpireTime(168*60*60*1000L); |
| | | String token = tokenService.createToken(loginUser); |
| | | // 获取原来的新的 |
| | | Object cacheObject = redisService.getCacheObject("login_other_" + appletUserDecodeData.getPhoneNumber()); |
| | | if(cacheObject!=null){ |
| | | tokenService.delLoginUser(cacheObject.toString()); |
| | | } |
| | | redisService.setCacheObject("login_other_" + appletUserDecodeData.getPhoneNumber(), token,168L,TimeUnit.HOURS); |
| | | ajax.put(Constants.TOKEN, token); |
| | | ajax.put("username",user.getUserName()); |
| | | ajax.put("avatar",user.getAvatar()); |
| | | |
| | |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取启动页",tags = {"登录模块"}) |
| | | @GetMapping("/getPage") |
| | | public R<String> getPage() { |
| | | TbSystemConfig config = systemConfigService.getOne(new LambdaQueryWrapper<TbSystemConfig>().eq(TbSystemConfig::getType, 1)); |
| | | return R.ok(config.getContent()); |
| | | } |
| | | |
| | | |
| | | |
| | | public String getOpenid(String jscode) { |
| | | String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + wxConfig.getMemberAppId() + |
| | |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | |
| | | private TbCompanyTypeService companyTypeService; |
| | | |
| | | @Autowired |
| | | private TbQichachaService tbQichachaService; |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | |
| | |
| | | @GetMapping("/getMyPushCompanyList") |
| | | public R< HashMap<String, Object>> getMyPushCompanyList(MyPushCompanyListQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | Page<MyPushCompanyListVo> page = tbCompanyService.getMyPushCompanyList(query,userId); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | |
| | | return R.ok(map); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取上次发布的信息",tags = {"发布模块"}) |
| | | @GetMapping("/getMyPushCompanyLast") |
| | | public R<HashMap<String, Object>> getMyPushCompanyLast() { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbCompany company = tbCompanyService.getOne(new LambdaQueryWrapper<TbCompany>().eq(TbCompany::getUserId,userId).orderByDesc(TbCompany::getCreateTime).last("limit 1")); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | if(company!=null){ |
| | | map.put("recipient",company.getRecipient()); |
| | | map.put("recipientAddress",company.getRecipientAddress()); |
| | | }else { |
| | | map.put("recipient",""); |
| | | map.put("recipientAddress",""); |
| | | } |
| | | return R.ok(map); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取行业信息",tags = {"发布模块"}) |
| | | @GetMapping("/getIndustryList") |
| | | public R<List<TbIndustry>> getIndustryList() { |
| | | List<TbIndustry> page1 = industryService.list(new LambdaQueryWrapper<TbIndustry>().orderByDesc(TbIndustry::getOrderNum)); |
| | | List<TbIndustry> page1 = industryService.list(new LambdaQueryWrapper<TbIndustry>().eq(TbIndustry::getDelFlag,0).orderByDesc(TbIndustry::getOrderNum)); |
| | | return R.ok(page1); |
| | | } |
| | | |
| | |
| | | |
| | | @ApiOperation(value = "立即发布",tags = {"发布模块"}) |
| | | @PostMapping("/pushCompany") |
| | | public R<?> pushCompany(@Valid @RequestBody PushCompanyDto dto) { |
| | | public synchronized R<?> pushCompany(@Valid @RequestBody PushCompanyDto dto) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | long count = tbCompanyService.count(new LambdaQueryWrapper<TbCompany>().eq(TbCompany::getCompanyName, dto.getCompanyName()).ne(TbCompany::getStatus, 3)); |
| | | long count = tbCompanyService.count(new LambdaQueryWrapper<TbCompany>().eq(TbCompany::getIsDelete,0).eq(TbCompany::getCompanyName, dto.getCompanyName()).ne(TbCompany::getStatus, 3)); |
| | | if (count > 0) { |
| | | return R.fail("该公司已发布"); |
| | | } |
| | |
| | | @ApiOperation(value = "发布前获取公司信息--企查查",tags = {"发布模块"}) |
| | | @GetMapping("/getCompanyFromQiChaCha") |
| | | public R<Object> getCompanyFromQiChaCha(@RequestParam String companyName) { |
| | | long count = tbCompanyService.count(new LambdaQueryWrapper<TbCompany>().eq(TbCompany::getCompanyName,companyName).ne(TbCompany::getStatus, 3)); |
| | | long count = tbCompanyService.count(new LambdaQueryWrapper<TbCompany>().eq(TbCompany::getCompanyName,companyName).eq(TbCompany::getIsDelete,0).ne(TbCompany::getStatus, 3)); |
| | | if (count > 0) { |
| | | return R.fail("该公司已发布"); |
| | | } |
| | |
| | | return R.ok(cacheObject); |
| | | } |
| | | Object qiChaChaToken = QiChaChaUtil.getQiChaChaCompanyInfo(companyName); |
| | | TbQichacha tbQichacha = new TbQichacha(); |
| | | tbQichacha.setType(1); |
| | | tbQichachaService.save(tbQichacha); |
| | | if(qiChaChaToken==null){ |
| | | return R.fail("查询公司信息失败请联系客服"); |
| | | } |
| | |
| | | @PostMapping("/editCompany") |
| | | public R<?> editCompany(@Valid @RequestBody EditCompanyDto dto) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | |
| | | TbCompany company = tbCompanyService.getById(dto.getId()); |
| | |
| | | return R.fail("非法操作"); |
| | | } |
| | | |
| | | long count1 = tbCompanyService.count(new LambdaQueryWrapper<TbCompany>().eq(TbCompany::getCompanyName, dto.getCompanyName()).ne(TbCompany::getId,dto.getId()).ne(TbCompany::getStatus, 3)); |
| | | long count1 = tbCompanyService.count(new LambdaQueryWrapper<TbCompany>().eq(TbCompany::getCompanyName, dto.getCompanyName()).eq(TbCompany::getIsDelete,0).ne(TbCompany::getId,dto.getId()).ne(TbCompany::getStatus, 3)); |
| | | if (count1 > 0) { |
| | | return R.fail("该公司已发布"); |
| | | } |
| | |
| | | @PostMapping("/companyUpdateStatus") |
| | | public R<?> companyUpdateStatus(@Valid @RequestBody CompanyUpdateStatusDto dto) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbCompany company = tbCompanyService.getById(dto.getId()); |
| | | if (company == null || !company.getUserId().equals(userId.toString())) { |
| | |
| | | if(dto.getStatus()<1 || dto.getStatus()>2){ |
| | | return R.fail("状态错误"); |
| | | } |
| | | if(dto.getStatus()==2){ |
| | | orderService.update(new LambdaUpdateWrapper<TbOrder>().eq(TbOrder::getCompanyId,dto.getId()).set(TbOrder::getStatus,-1)); |
| | | } |
| | | company.setStatus(dto.getStatus()); |
| | | tbCompanyService.updateById(company); |
| | | return R.ok(); |
| | |
| | | @DeleteMapping("/delete/{id}") |
| | | public R<?> delete(@PathVariable("id")String id) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbCompany company = tbCompanyService.getById(id); |
| | | if (company == null || !company.getUserId().equals(userId.toString())) { |
| | |
| | | return R.fail("参数错误"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbOrder order = orderService.getById(orderId); |
| | | if(order==null){ |
| | |
| | | return R.fail("参数错误"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbOrder order = orderService.getById(orderId); |
| | | if(order==null){ |
| | |
| | | if(order.getStatus()!=3){ |
| | | return R.fail("该订单状态不需要确认"); |
| | | } |
| | | order.setStatus(3); |
| | | order.setStatus(-1); |
| | | order.setCancelType(1); |
| | | order.updateById(); |
| | | |
| | | company.setStatus(1); |
| | | company.updateById(); |
| | | |
| | | |
| | | messageService.addMessage("您有订单被取消", order.getUserId(),order.getId()); |
| | | messageService.addMessage("您有订单被取消", order.getUserId(),order.getId(),2); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | @PostMapping("/addSchedule") |
| | | public R<?> addSchedule(@RequestBody @Valid AddScheduleDto dto) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbOrder order = orderService.getById(dto.getOrderId()); |
| | | if(order==null){ |
| | |
| | | } |
| | | scheduleService.addSchedule(dto,userId); |
| | | |
| | | messageService.addMessage("您的订单有新的进度提醒", order.getUserId(),order.getId()); |
| | | messageService.addMessage("您的订单有新的进度提醒", order.getUserId(),order.getId(),2); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | return R.fail("参数错误"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbOrder order = orderService.getById(orderId); |
| | | if(order==null){ |
| | |
| | | order.setSellerFinishTime(new Date()); |
| | | order.updateById(); |
| | | |
| | | messageService.addMessage("您有订单卖家已完成,等待确认", order.getUserId(),orderId); |
| | | messageService.addMessage("您有订单卖家已完成,等待确认", order.getUserId(),orderId,2); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | if(StringUtils.isEmpty(companyId)){ |
| | | return R.fail("参数错误"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Long userId = loginUser.getUserId(); |
| | | CompanyDetailVo companyDetailVo = tbCompanyService.companyDetail(companyId,userId); |
| | | CompanyDetailVo companyDetailVo = tbCompanyService.companyDetail(companyId,null); |
| | | Object qiChaChaCompanyExceptionCheck = QiChaChaUtil.getQiChaChaCompanyExceptionCheck(companyDetailVo.getCompanyName()); |
| | | if(qiChaChaCompanyExceptionCheck!=null && qiChaChaCompanyExceptionCheck.toString().contains("query_type")){ |
| | | TbQichacha tbQichacha = new TbQichacha(); |
| | | tbQichacha.setType(2); |
| | | tbQichacha.insert(); |
| | | } |
| | | companyDetailVo.setCompanyExceptionInfo(qiChaChaCompanyExceptionCheck); |
| | | companyDetailVo.setEstablishTime(companyDetailVo.getEstablishTime().substring(0,10)); |
| | | return R.ok(companyDetailVo); |
| | |
| | | @GetMapping("/qiChaChaCompanyExceptionCheck") |
| | | public R<Object> qiChaChaCompanyExceptionCheck(@RequestParam String companyName) { |
| | | Object qiChaChaCompanyExceptionCheck = QiChaChaUtil.getQiChaChaCompanyExceptionCheck(companyName); |
| | | if(qiChaChaCompanyExceptionCheck!=null && qiChaChaCompanyExceptionCheck.toString().contains("query_type")){ |
| | | TbQichacha tbQichacha = new TbQichacha(); |
| | | tbQichacha.setType(2); |
| | | tbQichacha.insert(); |
| | | } |
| | | return R.ok(qiChaChaCompanyExceptionCheck); |
| | | } |
| | | |
| | |
| | | @PostMapping("/getCompanyList") |
| | | public R<Page<IndexCompanyListVo>> getCompanyList(@Valid @RequestBody CompanyListQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Long userId = loginUser.getUserId(); |
| | | Long userId =0L; |
| | | if(loginUser!=null){ |
| | | userId = loginUser.getUserId(); |
| | | } |
| | | Page<IndexCompanyListVo> page = tbCompanyService.getCompanyList(query,userId); |
| | | |
| | | return R.ok(page); |
| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult; |
| | | import com.github.binarywang.wxpay.exception.WxPayException; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.utils.AliSmsUtil; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.AddBuyerCompanyInfoDto; |
| | |
| | | @GetMapping("/getMyOrderList") |
| | | public R<HashMap<String, Object>> getMyOrderList(MyOrderListQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | Page<MyPushCompanyListVo> page = orderService.getMyOrderList(query, userId); |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | |
| | | @PostMapping("/lastPayOrderData") |
| | | public synchronized R<WxPayMpOrderResult> lastPayOrderData(@RequestBody @Valid AddBuyerCompanyInfoDto dto) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbOrder tbOrder = orderService.getById(dto.getOrderId()); |
| | | |
| | |
| | | R.fail("订单id不能为空"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbOrder tbOrder = orderService.getById(orderId); |
| | | if (!tbOrder.getUserId().equals(userId.toString())) { |
| | |
| | | return R.fail("id不能为空"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | // 查看现在是否可以单 判断这个公司是否上架 是否已经产生的了订单 |
| | | TbCompany company = companyService.getById(companyId); |
| | |
| | | if (company.getStatus() == 4) { |
| | | return R.fail("改公司已被预定"); |
| | | } |
| | | orderService.placeOrder(companyId, company, userId); |
| | | return R.ok(); |
| | | String orderId = orderService.placeOrder(companyId, company, userId); |
| | | messageService.addMessage("买家申请了交易", company.getUserId(), orderId,1); |
| | | |
| | | TbUser user = userService.getById(company.getUserId()); |
| | | AliSmsUtil.sendSuccessMessageSeller(user.getPhone()); |
| | | return R.ok(orderId); |
| | | } |
| | | |
| | | @ApiOperation(value = "下单预定-获取信息", tags = {"订单模块"}) |
| | |
| | | R.fail("订单id不能为空"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbOrder order = orderService.getById(orderId); |
| | | if (order == null) { |
| | |
| | | } |
| | | // 订单完成 商品已售卖 |
| | | order.setStatus(6); |
| | | order.updateById(); |
| | | order.setFinishTime( new Date()); |
| | | |
| | | order.updateById(); |
| | | company.setStatus(3); |
| | | |
| | | // 分佣 |
| | | // 结算 |
| | | orderService.commission(order, company.getUserId()); |
| | | |
| | | // 卖家账户明细记录更新 |
| | | TbAccountDetail one = accountDetailService.getOne(new LambdaQueryWrapper<TbAccountDetail>().eq(TbAccountDetail::getOrderId, orderId).eq(TbAccountDetail::getCategory, 2)); |
| | | TbAccountDetail one = accountDetailService.getOne(new LambdaQueryWrapper<TbAccountDetail>().eq(TbAccountDetail::getUserId,company.getUserId()).eq(TbAccountDetail::getOrderId, orderId).eq(TbAccountDetail::getCategory, 2)); |
| | | if (one != null) { |
| | | one.setStatus(2); |
| | | one.updateById(); |
| | |
| | | @PostMapping("/buyerAddSchedule") |
| | | public synchronized R<?> buyerAddSchedule(@RequestBody @Valid AddScheduleDto dto) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbOrder order = orderService.getById(dto.getOrderId()); |
| | | if (order == null) { |
| | |
| | | scheduleService.buyerAddSchedule(dto, userId); |
| | | String userId1 = companyService.getById(order.getCompanyId()).getUserId(); |
| | | |
| | | messageService.addMessage("您的订单有新的回复", userId1, order.getId()); |
| | | messageService.addMessage("您的订单有新的回复", userId1, order.getId(),1); |
| | | return R.ok(); |
| | | |
| | | } |
| | |
| | | R.fail("订单id不能为空"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbOrder order = orderService.getById(orderId); |
| | | if (order == null) { |
| | |
| | | if (!order.getUserId().equals(userId.toString())) { |
| | | return R.fail("非法操作"); |
| | | } |
| | | if (order.getStatus() != 3) { |
| | | if (order.getStatus() != 3 && order.getStatus() != 2) { |
| | | return R.fail("该订单状态不能取消"); |
| | | } |
| | | TbCompany company = companyService.getById(order.getCompanyId()); |
| | | company.setStatus(1); |
| | | company.updateById(); |
| | | order.setStatus(-1); |
| | | order.setCancelType(2); |
| | | order.updateById(); |
| | | |
| | | messageService.addMessage("您发布的订单买家已取消", company.getUserId(), order.getId()); |
| | | messageService.addMessage("您发布的订单买家已取消", company.getUserId(), order.getId(),1); |
| | | return R.ok(); |
| | | |
| | | } |
| | |
| | | @PostMapping("/updateSchedule") |
| | | public R<?> updateSchedule(@RequestBody @Valid EditScheduleDto dto) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbSchedule schedule = scheduleService.getById(dto.getScheduleId()); |
| | | if (schedule == null) { |
| | |
| | | @DeleteMapping("/delSchedule/{scheduleId}") |
| | | public R<?> delSchedule(@PathVariable("scheduleId") String scheduleId) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbSchedule schedule = scheduleService.getById(scheduleId); |
| | | if (schedule == null) { |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | public R<UserAccountVo> getUserAccount() { |
| | | UserAccountVo userAccountVo = new UserAccountVo(); |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | |
| | | TbUser user = userService.getById(loginUser.getUserId()); |
| | | userAccountVo.setBalance(user.getBalance()); |
| | | |
| | |
| | | @GetMapping("/getUserAccountDetail") |
| | | public R<Page<TbAccountDetail>> getUserAccountDetail(UserAccountDetailQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | LambdaQueryWrapper<TbAccountDetail> wrapper = new LambdaQueryWrapper<>(); |
| | | if(StringUtils.isNotEmpty(query.getTime())){ |
| | | wrapper.likeRight(TbAccountDetail::getCreateTime,query.getTime()); |
| | |
| | | return R.fail("提现金额不能小于等于0"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | TbUser user = userService.getById(loginUser.getUserId()); |
| | | // 判断是否有卡 |
| | | List<TbBank> list = bankService.list(new LambdaQueryWrapper<TbBank>().eq(TbBank::getUserId, loginUser.getUserId()).eq(TbBank::getIsDelete, 0)); |
| | |
| | | @GetMapping("/getUserBank") |
| | | public R<TbBank> getUserBank() { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | TbBank tbBank = bankService.getOne(new LambdaQueryWrapper<TbBank>().eq(TbBank::getUserId, loginUser.getUserId()).eq(TbBank::getIsDelete, 0)); |
| | | return R.ok(tbBank); |
| | | } |
| | |
| | | @PostMapping("/saveUserBank") |
| | | public R<?> getUserBank(@Valid @RequestBody SaveUserBankDto dto) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | TbBank tbBank = bankService.getOne(new LambdaQueryWrapper<TbBank>().eq(TbBank::getUserId, loginUser.getUserId()).eq(TbBank::getIsDelete, 0)); |
| | | if(tbBank==null){ |
| | | tbBank = new TbBank(); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | @GetMapping("/getAddressList") |
| | | public R<?> getAddressList() { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | List<TbAddress> list = addressService.list(new LambdaQueryWrapper<TbAddress>().eq(TbAddress::getUserId, userId).eq(TbAddress::getIsDelete, 0).orderByDesc(TbAddress::getCreateTime)); |
| | | return R.ok(list); |
| | |
| | | @PostMapping("/updateUserAddress") |
| | | public R<?> updateUserAddress(@RequestBody @Valid TbAddress tbAddress) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | tbAddress.setUserId(userId.toString()); |
| | | tbAddress.setIsDelete(0); |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.constant.WxConstant; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.utils.NumberUtil; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TbQuestion; |
| | | import com.ruoyi.system.model.TbSystemConfig; |
| | |
| | | import com.ruoyi.system.service.TbQuestionService; |
| | | import com.ruoyi.system.service.TbSystemConfigService; |
| | | import com.ruoyi.system.service.TbUserService; |
| | | import com.ruoyi.system.utils.wx.WxProperties; |
| | | import com.ruoyi.system.vo.InviteUserListVo; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.http.entity.ContentType; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.*; |
| | | import org.springframework.mock.web.MockMultipartFile; |
| | | import org.springframework.util.LinkedMultiValueMap; |
| | | import org.springframework.util.MultiValueMap; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.client.RestTemplate; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.security.SecureRandom; |
| | | import java.text.MessageFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | import static com.ruoyi.system.utils.wx.tools.WxAppletTools.ACCESS_TOKEN_URL; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | |
| | | @Autowired |
| | | private TbSystemConfigService systemConfigService; |
| | | |
| | | @Autowired |
| | | private WxProperties wxConfig; |
| | | @Autowired |
| | | private RestTemplate restTemplate; |
| | | |
| | | @ApiOperation(value = "修改用户信息",tags = {"用户模块"}) |
| | | @PostMapping("/updateUserInfo") |
| | | public R<?> updateUserInfo(String avatar,String username) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | |
| | | TbUser user = userService.getById(userId); |
| | |
| | | @GetMapping("/getUserInfo") |
| | | public R<?> getUserInfo() { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbUser user = userService.getById(userId); |
| | | return R.ok(user); |
| | |
| | | @PostMapping("/accountCancellation") |
| | | public R<?> accountCancellation() { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbUser user = userService.getById(userId); |
| | | user.setStatus(3); |
| | |
| | | @GetMapping("/getInviteUserList") |
| | | public R<Page<InviteUserListVo>> getInviteUserList(BasePage page) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | Page<TbUser> page1 = userService.page(new Page<>(page.getPageNum(), page.getPageSize()), new LambdaQueryWrapper<TbUser>().eq(TbUser::getInviteId, userId).orderByDesc(TbUser::getCreateTime)); |
| | | Page<InviteUserListVo> inviteUserListVoPage = new Page<>(); |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private OSSUtil ossUtil; |
| | | @ApiOperation(value = "个人的小程序码(分享码)生成") |
| | | @GetMapping("/person-code") |
| | | public R<String> createQRcode() { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | // 获取调用凭证accessToken |
| | | String accessToken = getAccessToken(); |
| | | RestTemplate rest = new RestTemplate(); |
| | | InputStream inputStream = null; |
| | | OutputStream outputStream = null; |
| | | String imgUrl = ""; |
| | | try { |
| | | String url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token="+accessToken; |
| | | log.info("url: "+url); |
| | | Map<String,Object> param = new HashMap<>(); |
| | | param.put("path","pages/shoppingMall/shoppingMall?userId="+userId); |
| | | param.put("width", 430); //二维码尺寸 |
| | | log.info("调用生成微信URL接口传参:" + param); |
| | | MultiValueMap<String, String> headers = new LinkedMultiValueMap<>(); |
| | | HttpEntity requestEntity = new HttpEntity(param, headers); |
| | | ResponseEntity<byte[]> entity = rest.exchange(url, HttpMethod.POST, requestEntity, byte[].class, new Object[0]); |
| | | log.info("调用小程序生成微信永久小程序码URL接口返回结果:" + entity.getBody()); |
| | | byte[] result = entity.getBody(); |
| | | inputStream = new ByteArrayInputStream(result); |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | // 最后上传生成的文件名 |
| | | String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + ".jpg"; |
| | | // oss中的文件夹名 |
| | | String objectName = sdf.format(new Date()) + "/" + finalFileName; |
| | | // 上传oss |
| | | ossUtil.uploadFile2OSS(inputStream, objectName); |
| | | //获取文件的URl地址 |
| | | imgUrl = ossUtil.getImgUrl(objectName); |
| | | log.info("imgUrl: "+imgUrl); |
| | | return R.ok(imgUrl); |
| | | |
| | | } catch (Exception e) { |
| | | log.error("调用小程序生成微信永久小程序码URL接口异常",e); |
| | | } finally { |
| | | if(inputStream != null){ |
| | | try { |
| | | inputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | if(outputStream != null){ |
| | | try { |
| | | outputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return R.fail(); |
| | | } |
| | | @ApiOperation(value = "获取微信小程序二维码",tags = {"获取微信小程序二维码"}) |
| | | @PostMapping("/getQRCode") |
| | | public AjaxResult getQRCode() { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return AjaxResult.error(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | String accessToken = getAccessToken(); |
| | | try { |
| | | String url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token="+accessToken; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("path", "pages/shoppingMall/shoppingMall?userId="+userId); |
| | | param.put("width", 240); //二维码尺寸 |
| | | HttpRequest post = HttpUtil.createPost(url); |
| | | post.body(JSON.toJSONString(param)); |
| | | HttpResponse execute = post.execute(); |
| | | String body = execute.body(); |
| | | System.out.println(body); |
| | | byte[] bytes = body.getBytes(); |
| | | ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); |
| | | return AjaxResult.success(body); |
| | | } catch (Exception e) { |
| | | System.err.println("调用小程序生成微信永久小程序码URL接口异常" + e); |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | public String getAccessToken() { |
| | | String requestUrl = MessageFormat.format(ACCESS_TOKEN_URL, wxConfig.getMemberAppId(), wxConfig.getMemberAppSecret()); |
| | | String respBody = restTemplate.getForEntity(requestUrl, String.class).getBody(); |
| | | JSONObject jsonObject = JSONObject.parseObject(respBody); |
| | | return jsonObject.getString("access_token"); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.constant.HttpStatus; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | |
| | | @GetMapping("/getUserMessage") |
| | | public R<Page<TbMessage>> getUserMessage(UserMessageQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | Page<TbMessage> page = messageService.page(new Page<>(query.getPageNum(), query.getPageSize()), new LambdaQueryWrapper<TbMessage>().eq(query.getIsRead()!=null, TbMessage::getIsRead, query.getIsRead()).eq(TbMessage::getUserId, userId).orderByDesc(TbMessage::getCreateTime)); |
| | | page.getRecords().forEach(item -> { |
| | |
| | | return R.ok(page); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取用户消息未读",tags = {"消息模块"}) |
| | | @GetMapping("/getUserMessageNum") |
| | | public R<?> getUserMessageNum() { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | long count = messageService.count(new LambdaQueryWrapper<TbMessage>().eq(TbMessage::getIsRead, 0).eq(TbMessage::getUserId, userId)); |
| | | return R.ok(count); |
| | | } |
| | | |
| | | @ApiOperation(value = "消息已读",tags = {"消息模块"}) |
| | | @PostMapping("/readMessage") |
| | | public R<?> readMessage(String id) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbMessage message = messageService.getById(id); |
| | | if(!message.getUserId().equals(userId.toString())){ |
| | |
| | | @GetMapping("/accountCancellation") |
| | | public R<?> accountCancellation() { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | if(loginUser==null){ |
| | | return R.fail(HttpStatus.UNAUTHORIZED,"请重新登录"); |
| | | } |
| | | Long userId = loginUser.getUserId(); |
| | | TbUser user = userService.getById(userId); |
| | | user.setStatus(3); |
| | |
| | | # 令牌密钥 |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # 令牌有效期(默认30分钟) |
| | | expireTime: 120 |
| | | expireTime: 10080 |
| | | |
| | | mybatis-plus: |
| | | # 此处在多数据源中生效 |
| | |
| | | db-config: |
| | | logic-not-delete-value: 0 |
| | | logic-delete-value: 1 |
| | | update-strategy: ignored |
| | | type-aliases-package: com.ruoyi.**.domain,com.ruoyi.**.vo,com.ruoyi.**.model |
| | | # 指定Mapper文件位置 |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | |
| | | # prefix: http://localhost:${server.port}${server.servlet.context-path} |
| | | prefix: https://xzgt.test.591taxi.cn:${server.port}${server.servlet.context-path} |
| | | wx: |
| | | memberAppId: wx31b64f0d4f09053b |
| | | memberAppSecret: 2f3604b43c3e7128414408d0fc67b048 |
| | | memberAppId: wx180c41e1915992e8 |
| | | memberAppSecret: 8c6cc3410891d3096988b92c154ba5e9 |
| | | mchId: 1720552698 #微信支付商户号 |
| | | mchKey: 5Kb8zX9qR3r4D7Yw3vHnJgLp6sA4cE1M #微信支付商户密钥 |
| | | keyPath: C:\Users\Admin\Desktop\zsxcert\apiclient_cert.p12 # p12证书的位置 |
| | | callbackPath: https://api.dshl.vip/WalletApi/WX/callback |
| | | notifyUrl: http://127.0.0.1:9081/order/WX/zxsCallback |
| | | keyPath: /mnt/zsxcert/apiclient_cert.p12 # p12证书的位置 |
| | | notifyUrl: https://yizhengcheng.com/api/order/WX/zxsCallback |
| | | |
| | | |
| | |
| | | # 令牌密钥 |
| | | secret: abcdefghijklmnopqrstuvwxyz |
| | | # 令牌有效期(默认30分钟) |
| | | expireTime: 120 |
| | | expireTime: 10080 |
| | | |
| | | mybatis-plus: |
| | | # 此处在多数据源中生效 |
| | |
| | | db-config: |
| | | logic-not-delete-value: 0 |
| | | logic-delete-value: 1 |
| | | update-strategy: ignored |
| | | type-aliases-package: com.ruoyi.**.domain,com.ruoyi.**.vo,com.ruoyi.**.model |
| | | # 指定Mapper文件位置 |
| | | mapper-locations: classpath*:mapper/**/*.xml |
| | |
| | | # 项目相关配置 |
| | | spring: |
| | | profiles: |
| | | active: test |
| | | active: prod |
| | |
| | | <version>1.6.2</version> <!-- 请检查是否有更新的版本 --> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>dyvmsapi20170525</artifactId> |
| | | <version>3.2.2</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | |
| | | * |
| | | * @return App ID |
| | | */ |
| | | @JsonProperty("appId") |
| | | @JsonProperty("memberAppId") |
| | | private String appId; |
| | | |
| | | /** |
| | |
| | | // 模板 |
| | | private static final String TEMPLATE_CODE = "SMS_489660108"; |
| | | |
| | | private static final String TEMPLATE_CODE_SELLER = "SMS_491135055"; |
| | | |
| | | |
| | | public static void sendSuccessMessage(String phone,String code) { |
| | | Map<String, String> param = new HashMap<>(3); |
| | |
| | | sendSms(phone,SIGN_NAME,TEMPLATE_CODE,param); |
| | | } |
| | | |
| | | // 提醒卖家 |
| | | public static void sendSuccessMessageSeller(String phone) { |
| | | Map<String, String> param = new HashMap<>(3); |
| | | sendSms(phone,SIGN_NAME,TEMPLATE_CODE_SELLER,param); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | sendSuccessMessage("17828262728","123456"); |
| | | sendSuccessMessageSeller("17828262728"); |
| | | } |
| | | |
| | | /** |
New file |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import com.aliyun.oss.OSS; |
| | | import com.aliyun.oss.OSSClientBuilder; |
| | | import com.aliyun.oss.model.*; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.net.URL; |
| | | import java.net.URLEncoder; |
| | | import java.security.SecureRandom; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class OSSUtil { |
| | | |
| | | private static final String endpoint = "oss-cn-chengdu.aliyuncs.com"; |
| | | private static final String accessKeyId = "LTAI5tHYSpwifc3rqLYJoETo"; |
| | | private static final String accessKeySecret = "xrDyQ89h8P0alWW7rrLIW2D2rt7Eig"; |
| | | private static final String bucketName = "yizhengcheng"; |
| | | private static final String FOLDER = "https://yizhengcheng.oss-cn-chengdu.aliyuncs.com/"; |
| | | |
| | | /** |
| | | * 获取oss |
| | | * |
| | | * @return |
| | | */ |
| | | public static OSS getOSSClient() { |
| | | return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); |
| | | } |
| | | |
| | | /** |
| | | * 上传图片 |
| | | * |
| | | * @param url |
| | | * @throws |
| | | */ |
| | | public void uploadImg2Oss(String url) throws IOException { |
| | | File fileOnServer = new File(url); |
| | | FileInputStream fin; |
| | | try { |
| | | fin = new FileInputStream(fileOnServer); |
| | | String[] split = url.split("/"); |
| | | this.uploadFile2OSS(fin, split[split.length - 1]); |
| | | } catch (FileNotFoundException e) { |
| | | throw new IOException("图片上传失败"); |
| | | } |
| | | } |
| | | |
| | | public String uploadImg2Oss(MultipartFile file) throws IOException { |
| | | if (file.getSize() > 5 * 1024 * 1024) { |
| | | throw new IOException("上传图片大小不能超过5M!"); |
| | | } |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); |
| | | // 获取文件名 |
| | | String originalFilename = file.getOriginalFilename(); |
| | | // 获取文件后缀名 |
| | | String suffixName = originalFilename.substring(originalFilename.lastIndexOf(".")).toLowerCase(); |
| | | // 最后上传生成的文件名 |
| | | String finalFileName = System.currentTimeMillis() + "" + new SecureRandom().nextInt(0x0400) + suffixName; |
| | | // oss中的文件夹名 |
| | | String objectName = sdf.format(new Date()) + "/" + finalFileName; |
| | | |
| | | // name = DateUtils.dateStr(new Date(), "yyyy/MM/dd") + "/" + System.currentTimeMillis() + substring; |
| | | try { |
| | | InputStream inputStream = file.getInputStream(); |
| | | this.uploadFile2OSS(inputStream, objectName); |
| | | return objectName; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | throw new IOException("图片上传失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获得图片路径 |
| | | * |
| | | * @param fileUrl |
| | | * @return |
| | | */ |
| | | public String getImgUrl(String fileUrl) { |
| | | System.out.println(fileUrl); |
| | | if (!StringUtils.isEmpty(fileUrl)) { |
| | | // String[] split = fileUrl.split("/"); |
| | | return this.getUrl(this.FOLDER + fileUrl); |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 上传到OSS服务器 如果同名文件会覆盖服务器上的 |
| | | * |
| | | * @param instream 文件流 |
| | | * @param fileName 文件名称 包括后缀名 |
| | | * @return 出错返回"" ,唯一MD5数字签名 |
| | | */ |
| | | public String uploadFile2OSS(InputStream instream, String fileName) { |
| | | |
| | | String ret = ""; |
| | | try { |
| | | OSS ossClient = getOSSClient(); |
| | | // 创建上传Object的Metadata |
| | | ObjectMetadata objectMetadata = new ObjectMetadata(); |
| | | objectMetadata.setContentLength(instream.available()); |
| | | objectMetadata.setCacheControl("no-cache"); |
| | | objectMetadata.setContentType(getContentType(fileName.substring(fileName.lastIndexOf(".")))); |
| | | objectMetadata.setHeader("Pragma", "no-cache"); |
| | | // objectMetadata.setContentDisposition("inline;filename=" + fileName); |
| | | // 上传文件 |
| | | PutObjectResult putResult = ossClient.putObject(bucketName, FOLDER + fileName, instream, objectMetadata); |
| | | ret = putResult.getETag(); |
| | | } catch (IOException e) { |
| | | log.error(e.getMessage(), e); |
| | | } finally { |
| | | try { |
| | | if (instream != null) { |
| | | instream.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return ret; |
| | | } |
| | | |
| | | /** |
| | | * 通过文件名判断并获取OSS服务文件上传时文件的contentType |
| | | * |
| | | * @param filenameExtension 文件名 |
| | | * @return 文件的contentType |
| | | */ |
| | | public static final String getContentType(String filenameExtension) { |
| | | |
| | | if (filenameExtension.equalsIgnoreCase(".bmp")) { |
| | | return "application/x-bmp"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".gif")) { |
| | | return "image/gif"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".jpeg") || |
| | | filenameExtension.equalsIgnoreCase(".jpg") || |
| | | filenameExtension.equalsIgnoreCase(".png")) { |
| | | return "image/jpg"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".html")) { |
| | | return "text/html"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".txt")) { |
| | | return "text/plain"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".vsd")) { |
| | | return "application/vnd.visio"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".pptx") || |
| | | filenameExtension.equalsIgnoreCase(".ppt")) { |
| | | return "application/vnd.ms-powerpoint"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".docx") || |
| | | filenameExtension.equalsIgnoreCase(".doc")) { |
| | | return "application/msword"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".xla") || |
| | | filenameExtension.equalsIgnoreCase(".xlc") || |
| | | filenameExtension.equalsIgnoreCase(".xlm") || |
| | | filenameExtension.equalsIgnoreCase(".xls") || |
| | | filenameExtension.equalsIgnoreCase(".xlt") || |
| | | filenameExtension.equalsIgnoreCase(".xlw")) { |
| | | return "application/vnd.ms-excel"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".xlsx")) { |
| | | return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".xml")) { |
| | | return "text/xml"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".pdf")) { |
| | | return "application/pdf"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".zip")) { |
| | | return "application/zip"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".tar")) { |
| | | return "application/x-tar"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".avi")) { |
| | | return "video/avi"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".mp4")) { |
| | | return "video/mpeg4"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".mp3")) { |
| | | return "audio/mp3"; |
| | | } |
| | | if (filenameExtension.equalsIgnoreCase(".mp2")) { |
| | | return "audio/mp2"; |
| | | } |
| | | // 默认下载 |
| | | // return "application/octet-stream"; |
| | | return "image/jpg"; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获得url链接 |
| | | * |
| | | * @param key |
| | | * @return |
| | | */ |
| | | public String getUrl(String key) { |
| | | // 设置URL过期时间为10年 3600l* 1000*24*365*10 |
| | | OSS ossClient = getOSSClient(); |
| | | Date expiration = new Date(System.currentTimeMillis() + 3600L * 1000 * 24 * 365 * 10); |
| | | // 生成URL |
| | | URL url = ossClient.generatePresignedUrl(bucketName, key, expiration); |
| | | System.out.println("url: "+url); |
| | | if (url != null) { |
| | | String host = "https://" + url.getHost() + url.getPath(); |
| | | System.out.println("host: "+host); |
| | | // http://wxcall-xiaobanben.oss-cn-shenzhen.aliyuncs.com/image/20220129/1643469496754508.jpg |
| | | return host; |
| | | } |
| | | return ""; |
| | | } |
| | | |
| | | /** |
| | | * 获取文件夹 |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | */ |
| | | public List<String> fileFolder(String fileName) { |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = getOSSClient(); |
| | | // 构造ListObjectsRequest请求。 |
| | | ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucketName); |
| | | |
| | | // 设置正斜线(/)为文件夹的分隔符。 |
| | | listObjectsRequest.setDelimiter("/"); |
| | | // 设置prefix参数来获取fun目录下的所有文件。 |
| | | if (!StringUtils.isEmpty(fileName)) { |
| | | listObjectsRequest.setPrefix(fileName + "/"); |
| | | } |
| | | // 列出文件 |
| | | ObjectListing listing = ossClient.listObjects(listObjectsRequest); |
| | | // 遍历所有commonPrefix |
| | | List<String> list = new ArrayList<>(); |
| | | for (String commonPrefix : listing.getCommonPrefixes()) { |
| | | String newCommonPrefix = commonPrefix.substring(0, commonPrefix.length() - 1); |
| | | String[] s = newCommonPrefix.split("/"); |
| | | if (!StringUtils.isEmpty(fileName)) { |
| | | list.add(s[s.length - 1]); |
| | | } else { |
| | | list.add(s[0]); |
| | | } |
| | | } |
| | | // 关闭OSSClient |
| | | ossClient.shutdown(); |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 列举文件下所有的文件url信息 |
| | | */ |
| | | public ObjectListing listFile2(String fileHost, String nextMarker) { |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = getOSSClient(); |
| | | |
| | | // 构造ListObjectsRequest请求。 |
| | | ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucketName); |
| | | |
| | | // 设置正斜线(/)为文件夹的分隔符。 |
| | | listObjectsRequest.setDelimiter("/"); |
| | | // 列出fun目录下的所有文件和文件夹。 |
| | | listObjectsRequest.setPrefix(fileHost + "/"); |
| | | |
| | | ObjectListing listing = ossClient.listObjects(listObjectsRequest); |
| | | |
| | | // 遍历所有文件。 |
| | | System.out.println("Objects:"); |
| | | // objectSummaries的列表中给出的是fun目录下的文件。 |
| | | for (OSSObjectSummary objectSummary : listing.getObjectSummaries()) { |
| | | System.out.println(objectSummary.getKey()); |
| | | } |
| | | |
| | | // 遍历所有commonPrefix。 |
| | | System.out.println("\nCommonPrefixes:"); |
| | | // commonPrefixs列表中显示的是fun目录下的所有子文件夹。由于fun/movie/001.avi和fun/movie/007.avi属于fun文件夹下的movie目录,因此这两个文件未在列表中。 |
| | | for (String commonPrefix : listing.getCommonPrefixes()) { |
| | | System.out.println(commonPrefix); |
| | | } |
| | | |
| | | // 关闭OSSClient。 |
| | | ossClient.shutdown(); |
| | | return listing; |
| | | } |
| | | |
| | | /** |
| | | * 列举文件下所有的文件url信息 |
| | | */ |
| | | public List<String> listFile(String fileHost, String nextMarker) { |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = getOSSClient(); |
| | | // 构造ListObjectsRequest请求 |
| | | ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucketName); |
| | | |
| | | // 设置prefix参数来获取fun目录下的所有文件。 |
| | | listObjectsRequest.setPrefix(fileHost + "/"); |
| | | listObjectsRequest.setMarker(nextMarker); |
| | | |
| | | // 列出文件。 |
| | | ObjectListing listing = ossClient.listObjects(listObjectsRequest); |
| | | // 遍历所有文件。 |
| | | List<String> list = new ArrayList<>(); |
| | | for (int i = 0; i < listing.getObjectSummaries().size(); i++) { |
| | | String FILE_URL = "http://" + bucketName + "." + endpoint + "/" + listing.getObjectSummaries().get(i).getKey(); |
| | | list.add(FILE_URL); |
| | | } |
| | | // 关闭OSSClient。 |
| | | ossClient.shutdown(); |
| | | |
| | | |
| | | // ObjectListing objectListing = null; |
| | | // int total = 0; |
| | | // HashMap<Integer, String> markerMap = new HashMap<>(); |
| | | // try { |
| | | // ObjectListing objectListing2 = null; |
| | | // do { |
| | | // String nextMarker2 = objectListing2 != null ? objectListing2.getNextMarker() : null; |
| | | // ListObjectsRequest listObjectsRequest2 = new ListObjectsRequest(bucketName).withMarker(nextMarker2).withMaxKeys(100); |
| | | // listObjectsRequest2.setPrefix(fileHost + "/"); |
| | | // objectListing2 = ossClient.listObjects(listObjectsRequest2); |
| | | // total += (objectListing2 != null && objectListing2.getObjectSummaries() != null ? objectListing2.getObjectSummaries().size() : 0); |
| | | // markerMap.put(markerMap.size() + 1, nextMarker2); |
| | | // } while (objectListing2 != null && !StringUtils.isEmpty(objectListing2.getNextMarker())); |
| | | // |
| | | // ListObjectsRequest listObjectsRequest = new ListObjectsRequest(bucketName).withMarker(nextMarker).withMaxKeys(100); |
| | | // |
| | | // listObjectsRequest.setPrefix(fileHost + "/"); |
| | | // |
| | | // objectListing = ossClient.listObjects(listObjectsRequest); |
| | | // for (int i = 0; i < objectListing.getObjectSummaries().size(); i++) { |
| | | // String FILE_URL = "https://" + bucketName + "." + endpoint + "/" + objectListing.getObjectSummaries().get(i).getKey(); |
| | | // list.add(FILE_URL); |
| | | // } |
| | | // |
| | | // } catch (Exception e) { |
| | | // |
| | | // } finally { |
| | | // // 关闭client |
| | | // ossClient.shutdown(); |
| | | // } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 删除文件 |
| | | * objectName key 地址 |
| | | * |
| | | * @param filePath |
| | | */ |
| | | public Boolean delFile(String filePath) { |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = getOSSClient(); |
| | | // 删除Object. |
| | | boolean exist = ossClient.doesObjectExist(bucketName, filePath); |
| | | if (!exist) { |
| | | return false; |
| | | } |
| | | ossClient.deleteObject(bucketName, filePath); |
| | | ossClient.shutdown(); |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * |
| | | * @param keys |
| | | */ |
| | | public Boolean delFileList(List<String> keys) { |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = getOSSClient(); |
| | | try { |
| | | // 删除文件。 |
| | | DeleteObjectsResult deleteObjectsResult = ossClient.deleteObjects(new DeleteObjectsRequest(bucketName).withKeys(keys)); |
| | | List<String> deletedObjects = deleteObjectsResult.getDeletedObjects(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } finally { |
| | | ossClient.shutdown(); |
| | | } |
| | | return true; |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 创建文件夹 |
| | | * |
| | | * @param folder |
| | | * @return |
| | | */ |
| | | public String createFolder(String folder) { |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = getOSSClient(); |
| | | // 文件夹名 |
| | | final String keySuffixWithSlash = folder; |
| | | // 判断文件夹是否存在,不存在则创建 |
| | | if (!ossClient.doesObjectExist(bucketName, keySuffixWithSlash)) { |
| | | // 创建文件夹 |
| | | ossClient.putObject(bucketName, keySuffixWithSlash, new ByteArrayInputStream(new byte[0])); |
| | | // 得到文件夹名 |
| | | OSSObject object = ossClient.getObject(bucketName, keySuffixWithSlash); |
| | | String fileDir = object.getKey(); |
| | | ossClient.shutdown(); |
| | | return fileDir; |
| | | } |
| | | return keySuffixWithSlash; |
| | | } |
| | | |
| | | /** |
| | | * 通过文件名下载文件 |
| | | * |
| | | * @param objectName 要下载的文件名 |
| | | * @param localFileName 本地要创建的文件名 |
| | | */ |
| | | public void downloadFile(HttpServletResponse response, String objectName, String localFileName) throws Exception { |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = getOSSClient(); |
| | | try { |
| | | // ossObject包含文件所在的存储空间名称、文件名称、文件元信息以及一个输入流。 |
| | | OSSObject ossObject = ossClient.getObject(bucketName, objectName); |
| | | // 读去Object内容 返回 |
| | | BufferedInputStream in = new BufferedInputStream(ossObject.getObjectContent()); |
| | | |
| | | BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream()); |
| | | //通知浏览器以附件形式下载 |
| | | response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(objectName, "utf-8")); |
| | | //BufferedOutputStream out=new BufferedOutputStream(new FileOutputStream(new File("f:\\a.txt"))); |
| | | byte[] car = new byte[1024]; |
| | | int L = 0; |
| | | while ((L = in.read(car)) != -1) { |
| | | out.write(car, 0, L); |
| | | |
| | | } |
| | | if (out != null) { |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | if (in != null) { |
| | | in.close(); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | // 关闭OSSClient。 |
| | | ossClient.shutdown(); |
| | | } |
| | | } |
| | | |
| | | public String onlineSee(String key) { |
| | | // 创建OSSClient实例。 |
| | | OSS ossClient = getOSSClient(); |
| | | // 设置URL过期时间为1小时 |
| | | Date expiration = new Date(new Date().getTime() + 3600 * 1000); |
| | | // 临时地址 |
| | | URL url = ossClient.generatePresignedUrl(bucketName, key, expiration); |
| | | // 关闭OSSClient。 |
| | | ossClient.shutdown(); |
| | | return url.toString(); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.*; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | |
| | | public class OssUploadUtil { |
| | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | |
| | | private static QiChaChaUtil qiChaChaUtil; |
| | | |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | |
| | | HttpResponse execute = get.execute(); |
| | | String body = execute.body(); |
| | | JSONObject jsonObject = JSONObject.parseObject(body); |
| | | jsonObject.put("query_type",0); |
| | | if("200".equals(jsonObject.get("Status"))){ |
| | | String string = jsonObject.toString(); |
| | | getInstance().redisCache.setCacheObject("qichacha_"+companyName,string,24, TimeUnit.HOURS); |
New file |
| | |
| | | // This file is auto-generated, don't edit it. Thanks. |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import com.aliyun.tea.*; |
| | | |
| | | public class VoiceUtil { |
| | | |
| | | /** |
| | | * <b>description</b> : |
| | | * <p>使用凭据初始化账号Client</p> |
| | | * @return Client |
| | | * |
| | | * @throws Exception |
| | | */ |
| | | public static com.aliyun.dyvmsapi20170525.Client createClient() throws Exception { |
| | | // 工程代码建议使用更安全的无AK方式,凭据配置方式请参见:https://help.aliyun.com/document_detail/378657.html。 |
| | | com.aliyun.credentials.Client credential = new com.aliyun.credentials.Client(); |
| | | com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config() |
| | | .setCredential(credential); |
| | | // Endpoint 请参考 https://api.aliyun.com/product/Dyvmsapi |
| | | config.endpoint = "dyvmsapi.aliyuncs.com"; |
| | | return new com.aliyun.dyvmsapi20170525.Client(config); |
| | | } |
| | | |
| | | public static void send(String phone) throws Exception { |
| | | |
| | | com.aliyun.dyvmsapi20170525.Client client = VoiceUtil.createClient(); |
| | | com.aliyun.dyvmsapi20170525.models.SingleCallByVoiceRequest singleCallByVoiceRequest = new com.aliyun.dyvmsapi20170525.models.SingleCallByVoiceRequest() |
| | | .setCalledNumber(phone) |
| | | .setVoiceCode("111111"); |
| | | com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions(); |
| | | try { |
| | | // 复制代码运行请自行打印 API 的返回值 |
| | | client.singleCallByVoiceWithOptions(singleCallByVoiceRequest, runtime); |
| | | } catch (TeaException error) { |
| | | // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。 |
| | | // 错误 message |
| | | System.out.println(error.getMessage()); |
| | | // 诊断地址 |
| | | System.out.println(error.getData().get("Recommend")); |
| | | com.aliyun.teautil.Common.assertAsString(error.message); |
| | | } catch (Exception _error) { |
| | | TeaException error = new TeaException(_error.getMessage(), _error); |
| | | // 此处仅做打印展示,请谨慎对待异常处理,在工程项目中切勿直接忽略异常。 |
| | | // 错误 message |
| | | System.out.println(error.getMessage()); |
| | | // 诊断地址 |
| | | System.out.println(error.getData().get("Recommend")); |
| | | com.aliyun.teautil.Common.assertAsString(error.message); |
| | | } |
| | | } |
| | | } |
| | |
| | | JSONObject jsonObject = JSONObject.parseObject(respBody); |
| | | return jsonObject.getString("access_token"); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | .authorizeRequests() |
| | | // 对于登录login 注册register 验证码captchaImage 允许匿名访问 |
| | | .antMatchers( |
| | | "/wxLogin/**","/order/WX/zxsCallback","/shop/**","/company/companyDetail" |
| | | "/wxLogin/**","/order/WX/zxsCallback","/shop/**","/company/companyDetail","/company/getLicenceList","/company/getIndustryList" |
| | | ,"/company/getCompanyTypeList","/user-address/listRegion" |
| | | |
| | | ).permitAll() |
| | | // 静态资源,可匿名访问 |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.common.core.domain.model.LoginUserApplet; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | |
| | | * 租房合同 |
| | | */ |
| | | @ApiModelProperty("租房合同") |
| | | @NotBlank(message = "租房合同不能为空") |
| | | private String tenancyAgreement; |
| | | /** |
| | | * 房产证 |
| | | */ |
| | | @ApiModelProperty("房产证") |
| | | @NotBlank(message = "房产证不能为空") |
| | | private String propertyOwnershipCertificate; |
| | | /** |
| | | * 实名认证账户 |
| | |
| | | * 收件人 |
| | | */ |
| | | @ApiModelProperty("收件人") |
| | | @NotBlank(message = "收件人不能为空") |
| | | private String recipient; |
| | | /** |
| | | * 收件人地址 |
| | | */ |
| | | @ApiModelProperty("收件人地址") |
| | | @NotBlank(message = "收件人地址不能为空") |
| | | private String recipientAddress; |
| | | /** |
| | | * 所需资料 |
| | |
| | | @NotBlank(message = "联系电话不能为空") |
| | | private String phone; |
| | | /** |
| | | * 收件人 |
| | | */ |
| | | @ApiModelProperty("收件人") |
| | | @NotBlank(message = "收件人不能为空") |
| | | private String recipient; |
| | | /** |
| | | * 收件人地址 |
| | | */ |
| | | @ApiModelProperty("收件人地址") |
| | | @NotBlank(message = "收件人地址不能为空") |
| | | private String recipientAddress; |
| | | /** |
| | | * 收件人 |
| | | */ |
| | | @ApiModelProperty("收件人") |
| | | private String recipient; |
| | | /** |
| | | * 所需资料 |
| | | */ |
| | |
| | | private List<TbOpeningBank> openingBanks; |
| | | |
| | | |
| | | |
| | | @ApiModelProperty("法人") |
| | | private String operName; |
| | | |
| | | @ApiModelProperty("登记机关") |
| | | private String belongOrg; |
| | | |
| | | @ApiModelProperty("登记状态") |
| | | private String registrationStatus; |
| | | |
| | | |
| | | @ApiModelProperty("企查查地址") |
| | | private String address; |
| | | } |
| | |
| | | /** |
| | | * 1提现 2售卖商品 3平台退款 4分佣 |
| | | */ |
| | | @ApiModelProperty("1提现 2售卖商品 3平台退款 4分佣 5购买商品") |
| | | @ApiModelProperty("1提现 2售卖商品 3平台退款 4分佣 5购买商品 6后台修改") |
| | | private Integer category; |
| | | /** |
| | | * 1待审核 2通过(完成) 3拒绝 (取消) |
| | |
| | | |
| | | private Integer isDelete; |
| | | |
| | | private String address; |
| | | |
| | | } |
| | |
| | | @TableField("order_num") |
| | | private Integer orderNum; |
| | | |
| | | @TableField("del_flag") |
| | | private Integer delFlag; |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | |
| | | private Integer isRead; |
| | | @TableField("create_time") |
| | | @ApiModelProperty("时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | @TableField("order_id") |
| | | private String orderId; |
| | | |
| | | |
| | | private Integer type; |
| | | |
| | | |
| | | @TableField(exist = false) |
| | | private String companyId; |
| | | |
| | |
| | | @TableField("seller_finish_time") |
| | | private Date sellerFinishTime; |
| | | |
| | | @TableField("sms_num") |
| | | private Integer smsNum; |
| | | |
| | | @TableField("cancel_type") |
| | | private Integer cancelType; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | * @param text 内容 |
| | | * @param userId 用户id |
| | | */ |
| | | void addMessage(String text, String userId,String orderId); |
| | | void addMessage(String text, String userId,String orderId,int type); |
| | | |
| | | |
| | | } |
| | |
| | | WxPayMpOrderResult payOrder(TbOrder tbOrder, Long userId); |
| | | |
| | | |
| | | void placeOrder(String companyId, TbCompany company,Long userId); |
| | | String placeOrder(String companyId, TbCompany company,Long userId); |
| | | |
| | | |
| | | String weAppletChatNotice(String xmlData) throws WxPayException; |
| | |
| | | queryWrapper.in(TbCompany::getId, tbPermits.stream().map(TbPermit::getCompanyId).collect(Collectors.toList())); |
| | | } |
| | | queryWrapper.eq(TbCompany::getCityCode, query.getCityCode()); |
| | | if(query.getAreaCode()!=null && !"".equals(query.getAreaCode())){ |
| | | queryWrapper.eq(TbCompany::getAreaCode, query.getAreaCode()); |
| | | } |
| | | queryWrapper.like(StringUtils.isNotEmpty(query.getCompanyName()),TbCompany::getCompanyName, query.getCompanyName()); |
| | | |
| | | if (query.getCompanyCategorys() != null && query.getCompanyCategorys().size() > 0) { |
| | |
| | | @Override |
| | | public Page<MyPushCompanyListVo> getMyPushCompanyList(MyPushCompanyListQuery query, Long userId) { |
| | | Page<MyPushCompanyListVo> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | return this.baseMapper.getMyPushCompanyList(page, query, userId); |
| | | Page<MyPushCompanyListVo> myPushCompanyList = this.baseMapper.getMyPushCompanyList(page, query, userId); |
| | | for (MyPushCompanyListVo record : myPushCompanyList.getRecords()) { |
| | | if(record.getStatus()!=1){ |
| | | TbOrder order = orderService.getOne(new LambdaQueryWrapper<TbOrder>().eq(TbOrder::getCompanyId, record.getId()).ne(TbOrder::getStatus, -1).last("limit 1")); |
| | | if(order!=null){ |
| | | record.setOrderId(order.getId()); |
| | | } |
| | | } |
| | | } |
| | | return myPushCompanyList; |
| | | } |
| | | |
| | | @Override |
| | |
| | | map.put("toBeConfirmed", list.stream().filter(e -> e.getStatus() == 2).count()); |
| | | map.put("confirmed", list.stream().filter(e -> e.getStatus() == 3).count()); |
| | | map.put("processing", list.stream().filter(e -> e.getStatus() == 4).count()); |
| | | map.put("completed", list.stream().filter(e -> e.getStatus() == 5).count()); |
| | | map.put("completed", list.stream().filter(e -> e.getStatus() == 5).count() + list.stream().filter(e -> e.getStatus() == 6).count()); |
| | | return map; |
| | | } |
| | | @Override |
| | |
| | | TbCompany tbCompany = this.baseMapper.selectById(companyId); |
| | | BeanUtils.copyProperties(tbCompany, companyDetailVo); |
| | | companyDetailVo.setState(tbCompany.getStatus()); |
| | | |
| | | |
| | | TbIndustry industry = industryService.getById(tbCompany.getCompanyIndustryId()); |
| | | companyDetailVo.setCompanyIndustryName(industry.getName()); |
| | |
| | | companyDetailVo.setStatus(order.getStatus()); |
| | | companyDetailVo.setSellerFinishTime(order.getSellerFinishTime()); |
| | | companyDetailVo.setOrderId(order.getId()); |
| | | } |
| | | companyDetailVo.setOrderMoney(order.getPrice()); |
| | | |
| | | |
| | | List<TbSchedule> list2 = scheduleService.list(new LambdaQueryWrapper<TbSchedule>().eq(TbSchedule::getOrderId, order.getId()).orderByDesc(TbSchedule::getCreateTime)); |
| | | List<TbSchedule> collect = list2.stream().filter(e -> StringUtils.isEmpty(e.getParentId())).collect(Collectors.toList()); |
| | |
| | | |
| | | TbUser user = userService.getById(order.getUserId()); |
| | | companyDetailVo.setCustomerName(user.getUserName()); |
| | | companyDetailVo.setCustomerPhone(user.getPhone()); |
| | | |
| | | companyDetailVo.setSellerName(userService.getById(tbCompany.getUserId()).getUserName()); |
| | | |
| | | // 判断是否要迁区 是否要改名 新增天数 |
| | | if(one!=null){ |
| | | companyDetailVo.setEstimatedDays(one.getAddDay()+companyDetailVo.getEstimatedDays()); |
| | | if(one.getNeedRename()==1){ |
| | | if(one.getNeedRename()==1 && companyDetailVo.getRenameMoney()!=null){ |
| | | companyDetailVo.setSaleMoney( companyDetailVo.getSaleMoney().add(companyDetailVo.getRenameMoney())); |
| | | } |
| | | if(one.getNewDistrict()==1){ |
| | | if(one.getNewDistrict()==1 && companyDetailVo.getRelocationAreaMoney()!=null){ |
| | | companyDetailVo.setSaleMoney( companyDetailVo.getSaleMoney().add(companyDetailVo.getRelocationAreaMoney())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | return companyDetailVo; |
| | | } |
| | |
| | | public class TbMessageServiceImpl extends ServiceImpl<TbMessageMapper, TbMessage> implements TbMessageService { |
| | | |
| | | @Override |
| | | public void addMessage(String text, String userId,String orderId) { |
| | | public void addMessage(String text, String userId,String orderId,int type) { |
| | | TbMessage tbMessage = new TbMessage(); |
| | | tbMessage.setMessage(text); |
| | | tbMessage.setUserId(userId); |
| | | tbMessage.setOrderId(orderId); |
| | | tbMessage.setType(2); |
| | | this.save(tbMessage); |
| | | } |
| | | } |
| | |
| | | @Autowired |
| | | private TbShareholderService shareholderService; |
| | | |
| | | @Autowired |
| | | private TbAccountDetailService accountDetailService; |
| | | |
| | | |
| | | @Override |
| | | public Page<MyPushCompanyListVo> getMyOrderList(MyOrderListQuery query, Long userId) { |
| | |
| | | List<MyPushCompanyListVo> list = this.baseMapper.getMyOrderListNum(userId); |
| | | map.put("toBeConfirmed", list.stream().filter(e -> e.getStatus() == 2).count()); |
| | | map.put("pendingPayment", list.stream().filter(e -> e.getStatus() == 3).count()); |
| | | map.put("processing", list.stream().filter(e -> e.getStatus() == 4).count()); |
| | | map.put("processing", list.stream().filter(e -> e.getStatus() == 4).count()+list.stream().filter(e -> e.getStatus() == 5).count()); |
| | | map.put("completed", list.stream().filter(e -> e.getStatus() == 6).count()); |
| | | return map; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void placeOrder(String companyId, TbCompany company,Long userId) { |
| | | public String placeOrder(String companyId, TbCompany company,Long userId) { |
| | | // 创建订单 |
| | | TbOrder tbOrder = new TbOrder(); |
| | | tbOrder.setCompanyId(companyId); |
| | |
| | | |
| | | company.setStatus(4); |
| | | company.updateById(); |
| | | return tbOrder.getId(); |
| | | } |
| | | |
| | | @Override |
| | |
| | | order.setOutTradeNo(notifyResult.getOutTradeNo()); |
| | | order.setTransactionId(notifyResult.getTransactionId()); |
| | | TbCompany company = companyService.getById(order.getCompanyId()); |
| | | // 生成记录 看是否分佣 金额 |
| | | // 生成记录 看是否分佣 金额 发布人 |
| | | TbUser user = userService.getById(company.getUserId()); |
| | | TbSystemConfig config = configService.getOne(new LambdaQueryWrapper<TbSystemConfig>().eq(TbSystemConfig::getType, 3)); |
| | | if(config!=null){ |
| | |
| | | BigDecimal price = order.getPrice(); |
| | | BigDecimal divide = platformCommission.divide(new BigDecimal("100")); |
| | | BigDecimal platformCommissionMoney = divide.multiply(price).setScale(2, RoundingMode.HALF_UP); |
| | | |
| | | // 购买人是否绑定了用户 且次数足够 |
| | | if(StringUtils.isNotEmpty(user.getInviteId()) && user.getInviteNum()>0){ |
| | | BigDecimal divide1 = userCommission.divide(new BigDecimal("100")); |
| | | BigDecimal userCommissionMoney = divide1.multiply(price).setScale(2, RoundingMode.HALF_UP); |
| | | order.setCommissionPrice(userCommissionMoney); |
| | | if(userCommissionMoney.doubleValue()>0){ |
| | | TbUser shareUser = userService.getById(user.getInviteId()); |
| | | BigDecimal add = shareUser.getBalance().add(order.getCommissionPrice()); |
| | | shareUser.setBalance(add); |
| | | shareUser.updateById(); |
| | | |
| | | TbAccountDetail accountDetail = new TbAccountDetail(); |
| | | accountDetail.setUserId(user.getInviteId()); |
| | | accountDetail.setType(1); |
| | | accountDetail.setCategory(4); |
| | | accountDetail.setStatus(2); |
| | | accountDetail.setMoney(order.getCommissionPrice()); |
| | | accountDetail.setOrderPrice(order.getPrice()); |
| | | accountDetail.setSourceId(order.getUserId()); |
| | | accountDetail.insert(); |
| | | |
| | | user.setInviteNum(user.getInviteNum()-1); |
| | | user.updateById(); |
| | | } |
| | | } |
| | | order.setShareUserId(user.getInviteId()); |
| | | order.setCommissionPlatform(platformCommissionMoney); |
| | |
| | | tbAccountDetail1.insert(); |
| | | |
| | | |
| | | messageService.addMessage("下单成功,请及时发送快递", order.getUserId(),order.getId()); |
| | | messageService.addMessage("您发布的订单买家已支付,请尽快处理!", company.getUserId(),order.getId()); |
| | | messageService.addMessage("下单成功,请及时发送快递", order.getUserId(),order.getId(),2); |
| | | messageService.addMessage("您发布的订单买家已支付,请尽快处理!", company.getUserId(),order.getId(),1); |
| | | |
| | | // 生成办理进度 |
| | | TbSchedule tbSchedule = new TbSchedule(); |
| | | tbSchedule.setOrderId(order.getId()); |
| | | tbSchedule.setText("请及时快递发送所需资料"); |
| | | tbSchedule.setCreateTime(new Date()); |
| | | tbSchedule.setUserId(company.getUserId()); |
| | | tbSchedule.insert(); |
| | | return "<xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>"; |
| | | } |
| | | return null; |
| | |
| | | |
| | | @Override |
| | | public void commission(TbOrder order,String userId) { |
| | | String shareUserId = order.getShareUserId(); |
| | | if(StringUtils.isNotEmpty(shareUserId)){ |
| | | TbUser shareUser = userService.getById(shareUserId); |
| | | BigDecimal add = shareUser.getBalance().add(order.getCommissionPrice()); |
| | | shareUser.setBalance(add); |
| | | shareUser.updateById(); |
| | | |
| | | TbAccountDetail accountDetail = new TbAccountDetail(); |
| | | accountDetail.setUserId(shareUserId); |
| | | accountDetail.setType(1); |
| | | accountDetail.setCategory(4); |
| | | accountDetail.setStatus(2); |
| | | accountDetail.setMoney(order.getCommissionPrice()); |
| | | accountDetail.setOrderPrice(order.getPrice()); |
| | | accountDetail.setSourceId(order.getUserId()); |
| | | accountDetail.insert(); |
| | | |
| | | |
| | | } |
| | | BigDecimal decimal = order.getPrice().subtract(order.getCommissionPrice()).subtract(order.getCommissionPlatform()); |
| | | TbUser user = userService.getById(userId); |
| | | BigDecimal add = user.getBalance().add(decimal); |
| | | user.setBalance(add); |
| | | user.updateById(); |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | int addDay=0; |
| | | // 判断是否需要支付改名费 迁区费 |
| | | if(dto.getNeedRename()==1){ |
| | | if(company.getRenameMoney()!=null){ |
| | | addMoney = company.getRenameMoney(); |
| | | } |
| | | addDay=company.getRenameDay(); |
| | | } |
| | | if(dto.getNewDistrict()==1){ |
| | | if(company.getRelocationAreaMoney()!=null){ |
| | | addMoney = addMoney.add(company.getRelocationAreaMoney()); |
| | | } |
| | | addDay = addDay+company.getRelocationAreaDay(); |
| | | } |
| | | // 更新订单金额 |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.utils.AliSmsUtil; |
| | | import com.ruoyi.system.model.TbAccountDetail; |
| | | import com.ruoyi.system.model.TbCompany; |
| | | import com.ruoyi.system.model.TbOrder; |
| | | import com.ruoyi.system.model.TbUser; |
| | | import com.ruoyi.system.service.TbAccountDetailService; |
| | | import com.ruoyi.system.service.TbCompanyService; |
| | | import com.ruoyi.system.service.TbOrderService; |
| | | import com.ruoyi.system.service.TbUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | private TbCompanyService companyService; |
| | | @Autowired |
| | | private TbAccountDetailService accountDetailService; |
| | | @Autowired |
| | | private TbUserService userService; |
| | | |
| | | |
| | | |
| | | @Scheduled(cron ="0 0 10 * * ?") |
| | | public void sendSellerSms() { |
| | | List<TbOrder> list = orderService.list(new LambdaQueryWrapper<TbOrder>().lt(TbOrder::getStatus, 3).eq(TbOrder::getStatus, 2)); |
| | | if(!list.isEmpty()){ |
| | | for (TbOrder tbOrder : list) { |
| | | tbOrder.setSmsNum(tbOrder.getSmsNum() + 1); |
| | | tbOrder.updateById(); |
| | | TbCompany company = companyService.getById(tbOrder.getCompanyId()); |
| | | if(company!=null){ |
| | | TbUser user = userService.getById(company.getUserId()); |
| | | AliSmsUtil.sendSuccessMessageSeller(user.getPhone()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(fixedRate = 60000) |
| | | public void confirmOrder() { |
| | |
| | | TbCompany company = companyService.getById(order.getCompanyId()); |
| | | // 订单完成 商品已售卖 |
| | | order.setStatus(6); |
| | | order.updateById(); |
| | | order.setFinishTime( new Date()); |
| | | order.updateById(); |
| | | company.setStatus(3); |
| | | |
| | | // 分佣 |
| | |
| | | import com.ruoyi.system.utils.wx.body.resp.AccessTokenRespBody; |
| | | import com.ruoyi.system.utils.wx.body.resp.Code2SessionRespBody; |
| | | import com.ruoyi.system.utils.wx.body.resq.Code2SessionResqBody; |
| | | import com.ruoyi.system.utils.wx.model.WeixinProperties; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.client.RestTemplate; |
| | |
| | | @ApiModelProperty("是否高新技术 0否1是") |
| | | private Integer highTechEnterpriseTechnology; |
| | | |
| | | @ApiModelProperty("预估注册资金") |
| | | @ApiModelProperty("预估注册资金 企查查") |
| | | private String realRegisteredCapital; |
| | | |
| | | @ApiModelProperty("注册资金") |
| | | private String registeredCapital; |
| | | |
| | | |
| | | @ApiModelProperty("经营范围") |
| | | private String scope; |
| | |
| | | @ApiModelProperty("售卖价格") |
| | | private BigDecimal saleMoney; |
| | | |
| | | @ApiModelProperty("订单金额") |
| | | private BigDecimal orderMoney; |
| | | |
| | | @ApiModelProperty("联系电话") |
| | | private String phone; |
| | | |
| | |
| | | @ApiModelProperty("交易客户") |
| | | private String customerName; |
| | | |
| | | @ApiModelProperty("交易客户手机") |
| | | private String customerPhone; |
| | | |
| | | @ApiModelProperty("卖家名称") |
| | | private String sellerName; |
| | | |
| | | @ApiModelProperty("确认时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date confirmTime; |
| | |
| | | @ApiModelProperty("订单id") |
| | | private String orderId; |
| | | |
| | | @ApiModelProperty("发布用户id") |
| | | private String userId; |
| | | |
| | | @ApiModelProperty("地址") |
| | | private String address; |
| | | } |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | private String username; |
| | | |
| | | @ApiModelProperty("创建时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | private Date createTime; |
| | | |
| | | @ApiModelProperty("剩余分佣次数") |
| | |
| | | |
| | | @ApiModelProperty("状态 -1取消 1待交易 2待确认(预定) 3已确认(待支付) 4办理中 5已完成 6已下架") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("2 下架") |
| | | private Integer state; |
| | | |
| | | @ApiModelProperty("取消类型 1卖家 2买家取消") |
| | | private Integer cancelType; |
| | | } |
| | |
| | | |
| | | <select id="getMyPushCompanyList" resultType="com.ruoyi.system.vo.MyPushCompanyListVo"> |
| | | select * from ( |
| | | select t1.id,t1.company_name,t1.create_time,t1.sale_money ,t2.id orderId, |
| | | select DISTINCT t1.id,t1.company_name,t1.create_time,t1.sale_money ,t1.status state, |
| | | case |
| | | when t1.status=2 then 6 |
| | | when (select count(*) from tb_order where company_id = t1.id) = 0 then 1 |
| | | when (select count(*) from tb_order where company_id = t1.id and status = -1) >= 1 and (select count(*) from tb_order where company_id = t1.id and status != -1) = 0 then 1 |
| | | when (select count(*) from tb_order where company_id = t1.id and status != -1) >= 1 then (select status from tb_order where company_id = t1.id and status != -1 order by create_time desc limit 1) |
| | | else |
| | | COALESCE(t2.status, 1) END AS status |
| | | from tb_company t1 |
| | | left join tb_order t2 on t1.id = t2.company_id |
| | | where t1.user_id = #{userId} and t1.is_delete =0 |
| | | ) as t3 where 1= 1 |
| | | <if test="query.status!=null"> |
| | | and t3.status = #{query.status} |
| | | |
| | | <if test="query.status!=null and query.status!=6"> |
| | | and t3.status = #{query.status} and t3.state !=2 |
| | | </if> |
| | | <if test="query.status!=null and query.status==6"> |
| | | and t3.status in (5,6) |
| | | </if> |
| | | order by t3.create_time desc |
| | | |
| | |
| | | <select id="getMyPushCompanyListNum" resultType="com.ruoyi.system.vo.MyPushCompanyListVo" |
| | | parameterType="java.lang.Long"> |
| | | select * from ( |
| | | select t1.id,t1.company_name,t1.create_time,t1.sale_money ,t2.id orderId, |
| | | case when t1.status=2 then 6 |
| | | select DISTINCT t1.id,t1.company_name,t1.create_time,t1.sale_money ,t1.status state, |
| | | case |
| | | when (select count(*) from tb_order where company_id = t1.id) = 0 then 1 |
| | | when (select count(*) from tb_order where company_id = t1.id and status = -1) >= 1 and (select count(*) from tb_order where company_id = t1.id and status != -1) = 0 then 1 |
| | | when (select count(*) from tb_order where company_id = t1.id and status != -1) >= 1 then (select status from tb_order where company_id = t1.id and status != -1 order by create_time desc limit 1) |
| | | else |
| | | COALESCE(t2.status, 1) END AS status |
| | | from tb_company t1 |
| | | left join tb_order t2 on t1.id = t2.company_id |
| | | where t1.user_id = #{userId} and t1.is_delete =0 |
| | | ) as t3 where 1= 1 |
| | | order by t3.create_time desc |
| | | ) as t3 where t3.state !=2 |
| | | |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | </resultMap> |
| | | |
| | | <select id="getMyOrderList" resultType="com.ruoyi.system.vo.MyPushCompanyListVo"> |
| | | select t1.id orderId,t2.id,t2.company_name companyName,t2.create_time createTime,t2.sale_money saleMoney,t1.status |
| | | select t1.id orderId,t2.id,t2.company_name companyName,t2.create_time createTime,t2.sale_money saleMoney,t1.status,t1.cancel_type |
| | | from tb_order t1 left join tb_company t2 on t1.company_id = t2.id |
| | | where t1.user_id =#{userId} and t2.id is not null |
| | | <if test="query.status != null and query.status !=6 "> |
| | | where t1.user_id =#{userId} and t2.id is not null and t2.is_delete = 0 and t2.status != 2 |
| | | <if test="query.status != null and query.status !=4 "> |
| | | and t1.status = #{query.status} |
| | | </if> |
| | | <if test="query.status != null and query.status ==6 "> |
| | | and t1.status in (5,6) |
| | | <if test="query.status != null and query.status ==4 "> |
| | | and t1.status in (4,5) |
| | | </if> |
| | | order by t1.create_time desc |
| | | </select> |