| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | |
| | | import cn.hutool.core.map.MapUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | 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.StringUtils; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.*; |
| | | import com.ruoyi.system.model.*; |
| | |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/user") |
| | | @RequestMapping("/company") |
| | | @Api(tags = "发布模块") |
| | | public class CompanyController { |
| | | |
| | |
| | | @Autowired |
| | | private TbMessageService messageService; |
| | | |
| | | @Autowired |
| | | private TbLicenceService licenceService; |
| | | |
| | | @Autowired |
| | | private TbCompanyTypeService companyTypeService; |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取我发布的公司",tags = {"发布模块"}) |
| | |
| | | return R.ok(page1); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取公司类型信息",tags = {"发布模块"}) |
| | | @GetMapping("/getCompanyTypeList") |
| | | public R<Page<TbCompanyType>> getCompanyTypeList(BasePage page) { |
| | | Page<TbCompanyType> page1 = companyTypeService.page(new Page<>(page.getPageNum(),page.getPageSize()),new LambdaQueryWrapper<TbCompanyType>().eq(TbCompanyType::getDelFlag,0).orderByDesc(TbCompanyType::getOrderNum)); |
| | | return R.ok(page1); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取许可证信息",tags = {"发布模块"}) |
| | | @GetMapping("/getLicenceList") |
| | | public R<Page<TbLicence>> getLicenceList(BasePage page) { |
| | | Page<TbLicence> page1 = licenceService.page(new Page<>(page.getPageNum(),page.getPageSize()),new LambdaQueryWrapper<TbLicence>().eq(TbLicence::getDelFlag,0).orderByDesc(TbLicence::getOrderNum)); |
| | | return R.ok(page1); |
| | | } |
| | | |
| | | @ApiOperation(value = "立即发布",tags = {"发布模块"}) |
| | | @PostMapping("/pushCompany") |
| | | public R<?> pushCompany(@Valid @RequestBody PushCompanyDto dto) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Long userId = loginUser.getUserId(); |
| | | long count = tbCompanyService.count(new LambdaQueryWrapper<TbCompany>().eq(TbCompany::getCompanyName, dto.getCompanyName()).ne(TbCompany::getStatus, 3)); |
| | | if (count > 0) { |
| | | return R.fail("该公司已发布"); |
| | | } |
| | | tbCompanyService.pushCompany(dto,userId); |
| | | return R.ok(); |
| | | } |
| | |
| | | public R<?> editCompany(@Valid @RequestBody EditCompanyDto dto) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Long userId = loginUser.getUserId(); |
| | | |
| | | TbCompany company = tbCompanyService.getById(dto.getId()); |
| | | if (company == null || !company.getUserId().equals(userId.toString())) { |
| | | return R.fail("非法操作"); |
| | | } |
| | | |
| | | long count1 = tbCompanyService.count(new LambdaQueryWrapper<TbCompany>().eq(TbCompany::getCompanyName, dto.getCompanyName()).ne(TbCompany::getId,dto.getId()).ne(TbCompany::getStatus, 3)); |
| | | if (count1 > 0) { |
| | | return R.fail("该公司已发布"); |
| | | } |
| | | |
| | | long count = orderService.count(new LambdaQueryWrapper<TbOrder>().eq(TbOrder::getCompanyId, dto.getId()).in(TbOrder::getStatus, 3, 4, 5)); |
| | | if (count > 0) { |
| | | return R.fail("订单状态不能修改"); |
| | | } |
| | | |
| | | tbCompanyService.editCompany(dto,company,userId); |
| | | return R.ok(); |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | HttpRequest post = HttpUtil.createPost("https://shuimui.szsmjr.com/index/index/result"); |
| | | HashMap<String, String> stringStringHashMap = new HashMap<>(); |
| | | stringStringHashMap.put("Origin","https://shuimui.szsmjr.com"); |
| | | post.addHeaders(stringStringHashMap); |
| | | post.body("{\"sn\":\""+"ZZD20250321019744801521301"+"\"}"); |
| | | HttpResponse execute = post.execute(); |
| | | System.out.println(execute.body()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | return R.fail("该订单状态不能完成"); |
| | | } |
| | | order.setStatus(5); |
| | | order.setSellerFinishTime(new Date()); |
| | | order.updateById(); |
| | | |
| | | messageService.addMessage("您有订单卖家已完成,等待确认", order.getUserId(),orderId); |