| | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | 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.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.QiChaChaUtil; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/user") |
| | | @RequestMapping("/company") |
| | | @Api(tags = "发布模块") |
| | | public class CompanyController { |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private TbCompanyTypeService companyTypeService; |
| | | |
| | | |
| | | @Autowired |
| | | private QiChaChaUtil qiChaChaUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | 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(); |
| | | } |
| | | |
| | | @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)); |
| | | if (count > 0) { |
| | | return R.fail("该公司已发布"); |
| | | } |
| | | Object qiChaChaToken = QiChaChaUtil.getQiChaChaCompanyInfo(companyName); |
| | | if(qiChaChaToken==null){ |
| | | return R.fail("查询公司信息失败请联系客服"); |
| | | } |
| | | return R.ok(qiChaChaToken); |
| | | } |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "编辑公司",tags = {"发布模块"}) |
| | | @PostMapping("/editCompany") |
| | | 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) { |
| | | |
| | | private static Object getReport(String sign){ |
| | | 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"+"\"}"); |
| | | post.body("{\"sn\":\""+sign+"\"}"); |
| | | HttpResponse execute = post.execute(); |
| | | System.out.println(execute.body()); |
| | | String body = execute.body(); |
| | | JSONObject jsonObject = JSONObject.parseObject(body); |
| | | return jsonObject; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "已完成",tags = {"发布模块"}) |
| | | @PostMapping("/saleSuccessOrder") |
| | |
| | | |
| | | @ApiOperation(value = "公司详情",tags = {"发布模块"}) |
| | | @GetMapping("/companyDetail") |
| | | public R<CompanyDetailVo> companyDetail(@RequestParam String companyId) { |
| | | public R<CompanyDetailVo> companyDetail(@RequestParam String companyId) throws Exception { |
| | | if(StringUtils.isEmpty(companyId)){ |
| | | return R.fail("参数错误"); |
| | | } |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | Long userId = loginUser.getUserId(); |
| | | CompanyDetailVo companyDetailVo = tbCompanyService.companyDetail(companyId,userId); |
| | | Object qiChaChaCompanyExceptionCheck = QiChaChaUtil.getQiChaChaCompanyExceptionCheck(companyDetailVo.getCompanyName()); |
| | | companyDetailVo.setCompanyExceptionInfo(qiChaChaCompanyExceptionCheck); |
| | | |
| | | return R.ok(companyDetailVo); |
| | | } |
| | | |
| | | @ApiOperation(value = "公司详情--财务征信信息",tags = {"发布模块"}) |
| | | @GetMapping("/companyDetailDataInfo") |
| | | public R<Object> companyDetailDataInfo(@RequestParam String companyId) { |
| | | if(StringUtils.isEmpty(companyId)){ |
| | | return R.fail("参数错误"); |
| | | } |
| | | TbCompany company = tbCompanyService.getById(companyId); |
| | | String link = company.getLink(); |
| | | String sign = link.split("=")[1]; |
| | | Object report = getReport(sign); |
| | | return R.ok(report); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |