| | |
| | | package com.supersavedriving.user.modular.api; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.sun.xml.internal.bind.v2.TODO; |
| | | import com.supersavedriving.user.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.user.core.util.ToolUtil; |
| | | import com.supersavedriving.user.modular.system.model.*; |
| | | import com.supersavedriving.user.modular.system.service.*; |
| | | import com.supersavedriving.user.modular.system.util.*; |
| | | import com.supersavedriving.user.modular.system.util.GaoDe.MapUtil; |
| | | import com.supersavedriving.user.modular.system.util.GaoDe.model.District; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.supersavedriving.user.modular.system.util.MallBook.util.RSASignature; |
| | | import com.supersavedriving.user.modular.system.util.huawei.OBSUtil; |
| | | import com.supersavedriving.user.modular.system.util.huawei.SMSUtil; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.QianYunTongConfig; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.SMSUtil; |
| | | import com.supersavedriving.user.modular.system.util.qianyuntong.model.SendSmsRequest; |
| | | import com.supersavedriving.user.modular.system.util.weChat.WeChatUtil; |
| | | import com.supersavedriving.user.modular.system.warpper.*; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.annotation.Resource; |
| | | import java.io.File; |
| | | import java.io.InputStream; |
| | | import java.io.PrintWriter; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | private TCheckCarActivityService checkCarActivityService; |
| | | @Autowired |
| | | private ITBranchOfficeAreaService branchOfficeAreaService; |
| | | |
| | | @Value("${qyt.admin_url}") |
| | | private String adminUrl; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | |
| | | |
| | |
| | | BeanUtils.copyProperties(appUser, userInfoWarpper); |
| | | |
| | | District geocode = MapUtil.geocode(lon, lat); |
| | | TBranchOfficeArea branchOfficeArea = branchOfficeAreaService.selectOne(new EntityWrapper<TBranchOfficeArea>().eq("areaCode", geocode.getDistrictCode()) |
| | | .last("LIMIT 1")); |
| | | if(null == branchOfficeArea){ |
| | | if(null != geocode){ |
| | | TBranchOfficeArea branchOfficeArea = branchOfficeAreaService.selectOne(new EntityWrapper<TBranchOfficeArea>().eq("areaCode", geocode.getDistrictCode()) |
| | | .last("LIMIT 1")); |
| | | if(null == branchOfficeArea){ |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 7)); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | userInfoWarpper.setServiceCell(jsonObject.getString("num1")); |
| | | } |
| | | }else{ |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8).eq("companyId", branchOfficeArea.getBranchOfficeId())); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | userInfoWarpper.setServiceCell(jsonObject.getString("num2")); |
| | | } |
| | | } |
| | | }else{ |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 7)); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | userInfoWarpper.setServiceCell(jsonObject.getString("num1")); |
| | | } |
| | | }else{ |
| | | SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8).eq("companyId", branchOfficeArea.getBranchOfficeId())); |
| | | if(null != systemConfig){ |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | userInfoWarpper.setServiceCell(jsonObject.getString("num2")); |
| | | } |
| | | } |
| | | |
| | | return ResponseWarpper.success(userInfoWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | InputStream inputStream = file.getInputStream(); |
| | | String name = file.getOriginalFilename(); |
| | | name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf(".")); |
| | | // String s = OBSUtil.putObjectToBucket(inputStream, name); |
| | | String s = OssUploadUtil.ossUpload(file); |
| | | return ResponseWarpper.success(s); |
| | | File file1 = FileUtil.writeFromStream(inputStream, new File(filePath + name)); |
| | | HttpRequest post = HttpUtil.createPost(adminUrl + "/upload/image"); |
| | | HttpRequest form = post.form("file", file1); |
| | | HttpResponse execute = form.execute(); |
| | | int status = execute.getStatus(); |
| | | if(200 != status){ |
| | | throw new RuntimeException("上传图片异常"); |
| | | } |
| | | return ResponseWarpper.success(execute.body()); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/queryUsedCouponNum") |
| | | @PostMapping("/api/appUser/queryCheckUsedCouponNum") |
| | | @ApiOperation(value = "获取已使用车检优惠券数量", tags = {"用户端-个人中心(车检)"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | |
| | | return ResponseWarpper.success(ResultUtil.paranErr("phone")); |
| | | } |
| | | try { |
| | | String numberRandom = UUIDUtil.getNumberRandom(5); |
| | | // SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]"); |
| | | String sData = aLiSendSms.sendSms(phone,"SMS_154775435", "{\"code\":\"" + numberRandom + "\"}"); |
| | | String numberRandom = UUIDUtil.getNumberRandom(4); |
| | | SendSmsRequest request = new SendSmsRequest(); |
| | | request.setDestAddress(phone); |
| | | request.setTemplateId("TPL202410290001"); |
| | | Map<String, String> templateParams = new HashMap<>(); |
| | | templateParams.put("code", numberRandom); |
| | | request.setTemplateParams(templateParams); |
| | | request.setCode("code"); |
| | | request.setSpId("T8d5hdfg"); |
| | | SMSUtil.sendSms(request); |
| | | redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期 |
| | | return ResponseWarpper.success(ResultUtil.success()); |
| | | }catch (Exception e){ |