| | |
| | | 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); |
| | | } |
| | | |