| | |
| | | import com.ruoyi.common.core.domain.model.LoginBody; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.utils.AliSmsUtil; |
| | | import com.ruoyi.common.utils.NumberUtil; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | if (user==null){ |
| | | user = new TbUser(); |
| | | user.setPhone(appletUserDecodeData.getPhoneNumber()); |
| | | user.setAvatar(appletUserDecodeData.getAvatarUrl()); |
| | | user.setUserName(appletUserDecodeData.getNickName()); |
| | | user.setAvatar("https://yizhengcheng.oss-cn-chengdu.aliyuncs.com/img/18dfce33c55644d38abdb88b57db906f.png"); |
| | | user.setUserName(appletUserDecodeData.getPhoneNumber()); |
| | | user.setOpenId(appletUserDecodeData.getOpenId()); |
| | | user.setInviteId(data.getInviteUserId()); |
| | | user.setStatus(1); |
| | |
| | | String code = NumberUtil.getRandomInteger(6); |
| | | redisService.setCacheObject("login_"+phone, code, 5L, TimeUnit.MINUTES); |
| | | // 发送验证码 |
| | | |
| | | |
| | | try { |
| | | AliSmsUtil.sendSuccessMessage(phone,code); |
| | | }catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "获取协议 1=用户协议,2=隐私协议",tags = {"登录模块"}) |
| | | @GetMapping("/getAgreement/{type}") |
| | | @GetMapping("/getAgreement") |
| | | public R<List<TbAgreement>> getAgreement() { |
| | | List<TbAgreement> list = agreementService.list(new LambdaQueryWrapper<TbAgreement>().in(TbAgreement::getType, 1, 2)); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | 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; |
| | |
| | | private TbCompanyTypeService companyTypeService; |
| | | |
| | | |
| | | @Autowired |
| | | private QiChaChaUtil qiChaChaUtil; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "获取我发布的公司",tags = {"发布模块"}) |
| | | @GetMapping("/getMyPushCompanyList") |
| | |
| | | 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 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); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.web.controller.system; |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.utils.OssUploadUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/upload") |
| | | @Api(tags = "上传") |
| | | public class UploadController { |
| | | @ApiOperation(value = "文件上传",notes="文件上传") |
| | | @PostMapping("/uploadFile") |
| | | @ResponseBody |
| | | public R<String> upload(HttpServletRequest request, @RequestPart("file") MultipartFile picture) { |
| | | String filePath=""; |
| | | try { |
| | | filePath = OssUploadUtil.ossUpload(request,picture); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return R.ok(filePath); |
| | | } |
| | | } |
| | |
| | | public R<Page<TbAccountDetail>> getUserAccountDetail(UserAccountDetailQuery query) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | LambdaQueryWrapper<TbAccountDetail> wrapper = new LambdaQueryWrapper<>(); |
| | | if(StringUtils.isNotEmpty(query.getStartTime()) && StringUtils.isNotEmpty(query.getEndTime())){ |
| | | wrapper.between(TbAccountDetail::getCreateTime,query.getStartTime(),query.getEndTime()); |
| | | if(StringUtils.isNotEmpty(query.getTime())){ |
| | | wrapper.likeRight(TbAccountDetail::getCreateTime,query.getTime()); |
| | | } |
| | | wrapper.eq(TbAccountDetail::getUserId,loginUser.getUserId()); |
| | | wrapper.orderByDesc(TbAccountDetail::getCreateTime); |
| | |
| | | |
| | | |
| | | |
| | | @ApiOperation(value = "分享有礼列表",tags = {"分享有礼列表"}) |
| | | @GetMapping("/getInviteUserList") |
| | | public R<Page<InviteUserListVo>> getInviteUserList(BasePage page) { |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | 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<>(); |
| | | if(page1.getRecords().isEmpty()){ |
| | | return R.ok(inviteUserListVoPage); |
| | | } |
| | | ArrayList<InviteUserListVo> inviteUserListVos = new ArrayList<>(); |
| | | for (TbUser record : page1.getRecords()) { |
| | | InviteUserListVo inviteUserListVo = new InviteUserListVo(); |
| | | inviteUserListVo.setUsername(record.getUserName()); |
| | | inviteUserListVo.setCreateTime(record.getCreateTime()); |
| | | inviteUserListVo.setInviteNum(record.getInviteNum()); |
| | | inviteUserListVos.add(inviteUserListVo); |
| | | } |
| | | BeanUtils.copyProperties(page1,inviteUserListVoPage); |
| | | inviteUserListVoPage.setRecords(inviteUserListVos); |
| | | return R.ok(inviteUserListVoPage); |
| | | } |
| | | // @ApiOperation(value = "分享有礼列表",tags = {"分享有礼列表"}) |
| | | // @GetMapping("/getInviteUserList") |
| | | // public R<Page<InviteUserListVo>> getInviteUserList(BasePage page) { |
| | | // LoginUser loginUser = tokenService.getLoginUser(); |
| | | // 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<>(); |
| | | // if(page1.getRecords().isEmpty()){ |
| | | // return R.ok(inviteUserListVoPage); |
| | | // } |
| | | // ArrayList<InviteUserListVo> inviteUserListVos = new ArrayList<>(); |
| | | // for (TbUser record : page1.getRecords()) { |
| | | // InviteUserListVo inviteUserListVo = new InviteUserListVo(); |
| | | // inviteUserListVo.setUsername(record.getUserName()); |
| | | // inviteUserListVo.setCreateTime(record.getCreateTime()); |
| | | // inviteUserListVo.setInviteNum(record.getInviteNum()); |
| | | // inviteUserListVos.add(inviteUserListVo); |
| | | // } |
| | | // BeanUtils.copyProperties(page1,inviteUserListVoPage); |
| | | // inviteUserListVoPage.setRecords(inviteUserListVos); |
| | | // return R.ok(inviteUserListVoPage); |
| | | // } |
| | | |
| | | |
| | | } |
| | |
| | | # 开发环境配置 |
| | | server: |
| | | # 服务器的HTTP端口,默认为8080 |
| | | port: 8082 |
| | | port: 9082 |
| | | servlet: |
| | | # 应用的访问路径 |
| | | context-path: / |
| | |
| | | # redis 配置 |
| | | redis: |
| | | # 地址 |
| | | # host: 127.0.0.1 |
| | | host: 127.0.0.1 |
| | | # # 端口,默认为6379 |
| | | # port: 6379 |
| | | # # 数据库索引 |
| | | # database: 0 |
| | | # # 密码 |
| | | # password: 123456 |
| | | host: 127.0.0.1 |
| | | # 端口,默认为6379 |
| | | port: 16379 |
| | | port: 6379 |
| | | # 数据库索引 |
| | | database: 0 |
| | | database: 6 |
| | | # 密码 |
| | | password: 8f5z9g52gx4bg |
| | | password: 123456 |
| | | # 连接超时时间 |
| | | timeout: 10s |
| | | lettuce: |
| | |
| | | druid: |
| | | # 主库数据源 |
| | | master: |
| | | url: jdbc:mysql://172.27.0.13:3306/xizang?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: xzgt |
| | | password: changyun!6f2gshj6h3j |
| | | url: jdbc:mysql://127.0.0.1:3306/zhengshengxin?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | password: Zsx38817!@# |
| | | # 从库数据源 |
| | | slave: |
| | | # 从数据源开关/默认关闭 |
| | |
| | | accessPath: /file/ |
| | | allowExt: .jpg|.png|.gif|.jpeg|.doc|.docx|.apk|.MP4|.mp4|.pdf|.PDF |
| | | url: |
| | | # prefix: http://localhost:${server.port}${server.servlet.context-path} |
| | | prefix: https://xzgt.test.591taxi.cn:${server.port}${server.servlet.context-path} |
| | | wx: |
| | | conf: |
| | | appId: wxe91f1af7638aa5dd |
| | | secretId: a787e1a462715604e0c9528b6d8960d1 |
| | | #OSS及短信配置 |
| | | code: |
| | | config: |
| | | templateCodeTest: "SMS_154950909" |
| | | signNameTest: "阿里云短信测试" |
| | | accessKeyId: LTAI5tAdba8HtT1C6UqtSxBt |
| | | accessKeySecret: 0SRb6XGkciQDPWn2rYqbJtq2qRMDY8 |
| | | signName: "四川金达通信工程" |
| | | templateCode: "SMS_293985284" |
| | | cos: |
| | | client: |
| | | accessKey: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretKey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | bucket: xzgttest-1305134071 |
| | | bucketAddr: ap-chengdu |
| | | rootSrc: https://xzgttest-1305134071.cos.ap-chengdu.myqcloud.com/ |
| | | location: xizang |
| | | sms: |
| | | enable: true |
| | | appId: 1400957506 |
| | | secretid: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretkey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | sign: 畅云出行 |
| | | memberAppId: wx31b64f0d4f09053b |
| | | memberAppSecret: 2f3604b43c3e7128414408d0fc67b048 |
| | | 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 |
| | | |
| | | |
| | |
| | | # 端口,默认为6379 |
| | | port: 6379 |
| | | # 数据库索引 |
| | | database: 0 |
| | | database: 6 |
| | | # 密码 |
| | | password: 123456 |
| | | # 连接超时时间 |
| | |
| | | # 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 |
| | | mchId: 1703389452 #微信支付商户号 |
| | | mchKey: t30dr8AnRWPQenwCpwik34hZGBHppnNi #微信支付商户密钥 |
| | | keyPath: /opt/cert/apiclient_cert.p12 # p12证书的位置 |
| | | 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 |
| | | |
| | | #OSS及短信配置 |
| | | code: |
| | | config: |
| | | templateCodeTest: "SMS_154950909" |
| | | signNameTest: "阿里云短信测试" |
| | | accessKeyId: LTAI5tAdba8HtT1C6UqtSxBt |
| | | accessKeySecret: 0SRb6XGkciQDPWn2rYqbJtq2qRMDY8 |
| | | signName: "四川金达通信工程" |
| | | templateCode: "SMS_293985284" |
| | | |
| | | cos: |
| | | client: |
| | | accessKey: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretKey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | bucket: xzgttest-1305134071 |
| | | bucketAddr: ap-chengdu |
| | | rootSrc: https://xzgttest-1305134071.cos.ap-chengdu.myqcloud.com/ |
| | | location: xizang |
| | | sms: |
| | | enable: true |
| | | appId: 1400957506 |
| | | secretid: AKIDCF5EF2c0DE1e5JK8r4EGJF4mNsMgp26x |
| | | secretkey: lLl184rUyFOOE0d5KNGC3kmfNsCWk4GU |
| | | sign: 畅云出行 |
| | |
| | | <artifactId>javax.mail</artifactId> |
| | | <version>1.6.2</version> <!-- 请检查是否有更新的版本 --> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>com.aliyun</groupId> |
| | | <artifactId>dysmsapi20170525</artifactId> |
| | | <version>3.1.0</version> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>org.apache.httpcomponents</groupId> |
| | | <artifactId>httpclient</artifactId> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.vaadin.external.google</groupId> |
| | | <artifactId>android-json</artifactId> |
| | | <version>0.0.20131108.vaadin1</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.aliyun.oss</groupId> |
| | | <artifactId>aliyun-sdk-oss</artifactId> |
| | | <version>3.15.1</version> |
| | | <scope>compile</scope> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | | </project> |
New file |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import com.aliyun.dysmsapi20170525.Client; |
| | | import com.aliyun.dysmsapi20170525.models.SendBatchSmsRequest; |
| | | import com.aliyun.dysmsapi20170525.models.SendBatchSmsResponse; |
| | | import com.aliyun.dysmsapi20170525.models.SendSmsRequest; |
| | | import com.aliyun.dysmsapi20170525.models.SendSmsResponse; |
| | | import com.aliyun.teaopenapi.models.Config; |
| | | |
| | | import java.util.*; |
| | | |
| | | |
| | | @Slf4j |
| | | public class AliSmsUtil { |
| | | private static final String ACCESS_KEY_ID = "LTAI5tHYSpwifc3rqLYJoETo"; |
| | | private static final String ACCESS_KEY_SECRET = "xrDyQ89h8P0alWW7rrLIW2D2rt7Eig"; |
| | | private static final String SIGN_NAME = "一证成"; |
| | | // 模板 |
| | | private static final String TEMPLATE_CODE = "SMS_489660108"; |
| | | |
| | | |
| | | public static void sendSuccessMessage(String phone,String code) { |
| | | Map<String, String> param = new HashMap<>(3); |
| | | param.put("code",code); |
| | | sendSms(phone,SIGN_NAME,TEMPLATE_CODE,param); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | sendSuccessMessage("17828262728","123456"); |
| | | } |
| | | |
| | | /** |
| | | * 阿里发送短信 |
| | | * |
| | | * @param phone |
| | | * @param signName |
| | | * @param templateCode |
| | | * @param param |
| | | * @return |
| | | */ |
| | | private static boolean sendSms(String phone, String signName, String templateCode, Map<String, String> param) { |
| | | // 可自助调整超时时间 |
| | | System.setProperty("sun.net.client.defaultConnectTimeout", "30000"); |
| | | System.setProperty("sun.net.client.defaultReadTimeout", "30000"); |
| | | try { |
| | | |
| | | // 初始化请求客户端 |
| | | Client client = createClient(); |
| | | |
| | | // 构造请求对象,请填入请求参数值 |
| | | SendSmsRequest sendSmsRequest = new SendSmsRequest() |
| | | .setPhoneNumbers(phone) |
| | | .setSignName(signName) |
| | | .setTemplateCode(templateCode) |
| | | .setTemplateParam(JSON.toJSONString(param)); |
| | | //if (aliSmsConfig.isDebug()) { |
| | | // log.info("短信 DEBUG code= {}", param); |
| | | // return true; |
| | | //} |
| | | // 获取响应对象 |
| | | SendSmsResponse sendSmsResponse = client.sendSms(sendSmsRequest); |
| | | // hint 此处可能会抛出异常,注意catch |
| | | if (StringUtils.equalsIgnoreCase("ok", sendSmsResponse.getBody().getCode())) { |
| | | log.info("{}短信发送成功:{}", phone, sendSmsResponse.getBody().getMessage()); |
| | | return true; |
| | | } else { |
| | | log.error("{}短信发送失败:{}", phone, sendSmsResponse.getBody().getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("{}短信发送失败:{}", phone, e.getMessage(),e); |
| | | throw new ServiceException("短信发送失败:"+e.getMessage()); |
| | | } |
| | | return false; |
| | | } |
| | | private static boolean sendBatchSms(List<String> phones, String signName, String templateCode, Map<String, String> param) { |
| | | // 可自助调整超时时间 |
| | | System.setProperty("sun.net.client.defaultConnectTimeout", "30000"); |
| | | System.setProperty("sun.net.client.defaultReadTimeout", "30000"); |
| | | try { |
| | | |
| | | // 初始化请求客户端 |
| | | Client client = createClient(); |
| | | |
| | | // 构造请求对象,请填入请求参数值 |
| | | SendBatchSmsRequest request = new SendBatchSmsRequest() |
| | | .setPhoneNumberJson(JSON.toJSONString(phones)) // 手机号数组JSON |
| | | .setSignNameJson(JSON.toJSONString(Collections.nCopies(phones.size(), SIGN_NAME))) |
| | | .setTemplateCode(templateCode) |
| | | .setTemplateParamJson(JSON.toJSONString(Collections.nCopies(phones.size(), param))); // 参数数组JSON |
| | | //if (aliSmsConfig.isDebug()) { |
| | | // log.info("短信 DEBUG code= {}", param); |
| | | // return true; |
| | | //} |
| | | // 获取响应对象 |
| | | SendBatchSmsResponse sendBatchSmsResponse = client.sendBatchSms(request); |
| | | // hint 此处可能会抛出异常,注意catch |
| | | if (StringUtils.equalsIgnoreCase("ok", sendBatchSmsResponse.getBody().getCode())) { |
| | | return true; |
| | | } else { |
| | | log.error("{}短信发送失败:{}", JSON.toJSONString(phones), sendBatchSmsResponse.getBody().getMessage()); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("{}短信发送失败:{}", JSON.toJSONString(phones), e.getMessage(),e); |
| | | throw new RuntimeException("短信发送失败", e); |
| | | } |
| | | return false; |
| | | } |
| | | public static Client createClient() throws Exception { |
| | | Config config = new Config() |
| | | // 配置 AccessKey ID |
| | | .setAccessKeyId(ACCESS_KEY_ID) |
| | | // 配置 AccessKey Secret |
| | | .setAccessKeySecret(ACCESS_KEY_SECRET); |
| | | |
| | | // 配置 Endpoint |
| | | config.endpoint = "dysmsapi.aliyuncs.com"; |
| | | |
| | | return new Client(config); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import com.aliyun.oss.OSSClient; |
| | | import com.aliyun.oss.model.ObjectMetadata; |
| | | import com.aliyun.oss.model.PutObjectResult; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.*; |
| | | import java.util.Objects; |
| | | import java.util.UUID; |
| | | |
| | | public class OssUploadUtil { |
| | | public static String oss_domain = "https://yizhengcheng.oss-cn-chengdu.aliyuncs.com/"; |
| | | public static String accessKeyId = "LTAI5tHYSpwifc3rqLYJoETo"; |
| | | public static String accessKeySecret = "xrDyQ89h8P0alWW7rrLIW2D2rt7Eig"; |
| | | public static String bucketName="yizhengcheng"; |
| | | public static String endpoint = "oss-cn-chengdu.aliyuncs.com"; |
| | | |
| | | public static OSSClient ossClient = new OSSClient(endpoint, accessKeyId,accessKeySecret); |
| | | |
| | | public static String ossUpload(HttpServletRequest request, MultipartFile file) throws IOException { |
| | | //CommonsMultipartFile file = (CommonsMultipartFile)multipartFile; |
| | | String fileName = ""; |
| | | if (file != null && !"".equals(file.getOriginalFilename()) && file.getOriginalFilename() != null) { |
| | | InputStream content = file.getInputStream();//获得指定文件的输入流 |
| | | ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata |
| | | meta.setContentLength(file.getSize()); // 必须设置ContentLength |
| | | String originalFilename = file.getOriginalFilename(); |
| | | fileName = UUID.randomUUID().toString().replaceAll("-", "") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | ossClient.putObject(bucketName, "img/" + fileName, content, meta);// 上传Object. |
| | | if (fileName != null && !"".equals(fileName)) { |
| | | fileName = oss_domain + "img/" + fileName; |
| | | } |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | public static String obsUploadPdf(String fileType, ByteArrayOutputStream file) throws IOException { |
| | | String fileName = UUID.randomUUID() + ".pdf"; |
| | | //获得指定文件的输入流 |
| | | InputStream content = new ByteArrayInputStream(file.toByteArray()); |
| | | ObjectMetadata meta = new ObjectMetadata();// 创建上传Object的Metadata |
| | | meta.setContentLength(Long.valueOf(file.size())); // 必须设置ContentLength |
| | | ossClient.putObject(bucketName, fileType + fileName, content, meta);// 上传Object. |
| | | if (fileName != null && !"".equals(fileName)) { |
| | | System.out.println(fileName); |
| | | fileName = oss_domain + fileType + fileName; |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | |
| | | //上传图片 |
| | | public static String uploadByteOSS(byte[] b) { |
| | | |
| | | // byte[] content = "Hello OSS".getBytes(); |
| | | |
| | | // 以输入流的形式上传文件 |
| | | String folder = ""; |
| | | // 文件名 |
| | | String timefile = UUID.randomUUID().toString().replaceAll("-","");// 文件名 |
| | | String fileName = ".jpg";// 后缀扩展名 |
| | | fileName = timefile + fileName; |
| | | |
| | | Long fileSize = (long) b.length; |
| | | // String timefile = FORMATS; |
| | | //// String fileName = file.getName(); |
| | | // file = timefile + file.substring(file.lastIndexOf(".")); |
| | | // 创建上传Object的Metadata |
| | | ObjectMetadata metadata = new ObjectMetadata(); |
| | | metadata.setContentLength(fileSize); |
| | | // 指定该Object被下载时的网页的缓存行为 |
| | | metadata.setCacheControl("no-cache"); |
| | | // 指定该Object下设置Header |
| | | metadata.setHeader("Pragma", "no-cache"); |
| | | // 指定该Object被下载时的内容编码格式 |
| | | metadata.setContentEncoding("utf-8"); |
| | | // 文件的MIME,定义文件的类型及网页编码,决定浏览器将以什么形式、什么编码读取文件。如果用户没有指定则根据Key或文件名的扩展名生成, |
| | | // 如果没有扩展名则填默认值application/octet-stream |
| | | metadata.setContentType(getContentType(fileName)); |
| | | // 指定该Object被下载时的名称(指示MINME用户代理如何显示附加的文件,打开或下载,及文件名称) |
| | | metadata.setContentDisposition("filename/filesize=" + fileName + "/" + fileSize + "Byte."); |
| | | |
| | | PutObjectResult putResult = ossClient.putObject(bucketName, folder + fileName, new ByteArrayInputStream(b), |
| | | metadata); |
| | | //ossClient.shutdown(); |
| | | String filepath = folder + fileName; |
| | | return oss_domain+filepath; |
| | | } |
| | | |
| | | /** |
| | | * 通过文件名判断并获取OSS服务文件上传时文件的contentType |
| | | * |
| | | * @param fileName |
| | | * 文件名 |
| | | * @return 文件的contentType |
| | | */ |
| | | public static String getContentType(String fileName) { |
| | | // 文件的后缀名 |
| | | String fileExtension = fileName.substring(fileName.lastIndexOf(".")); |
| | | if (".bmp".equalsIgnoreCase(fileExtension)) { |
| | | return "image/bmp"; |
| | | } |
| | | if (".gif".equalsIgnoreCase(fileExtension)) { |
| | | return "image/gif"; |
| | | } |
| | | if (".jpeg".equalsIgnoreCase(fileExtension) || ".jpg".equalsIgnoreCase(fileExtension) |
| | | || ".png".equalsIgnoreCase(fileExtension)) { |
| | | return "image/jpeg"; |
| | | } |
| | | if (".html".equalsIgnoreCase(fileExtension)) { |
| | | return "text/html"; |
| | | } |
| | | if (".txt".equalsIgnoreCase(fileExtension)) { |
| | | return "text/plain"; |
| | | } |
| | | if (".vsd".equalsIgnoreCase(fileExtension)) { |
| | | return "application/vnd.visio"; |
| | | } |
| | | if (".ppt".equalsIgnoreCase(fileExtension) || "pptx".equalsIgnoreCase(fileExtension)) { |
| | | return "application/vnd.ms-powerpoint"; |
| | | } |
| | | if (".doc".equalsIgnoreCase(fileExtension) || "docx".equalsIgnoreCase(fileExtension)) { |
| | | return "application/msword"; |
| | | } |
| | | if (".xml".equalsIgnoreCase(fileExtension)) { |
| | | return "text/xml"; |
| | | } |
| | | if (".mp4".equalsIgnoreCase(fileExtension)) { |
| | | return "video/mp4"; |
| | | } |
| | | // 默认返回类型 |
| | | return "image/jpeg"; |
| | | } |
| | | } |
New file |
| | |
| | | package com.ruoyi.common.utils; |
| | | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Component |
| | | public class QiChaChaUtil { |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | private static QiChaChaUtil qiChaChaUtil; |
| | | |
| | | @PostConstruct |
| | | public void init() { |
| | | qiChaChaUtil = this; |
| | | } |
| | | |
| | | public static QiChaChaUtil getInstance() { |
| | | return qiChaChaUtil; |
| | | } |
| | | |
| | | public static Object getQiChaChaCompanyInfo(String companyName){ |
| | | String url = "https://api.qichacha.com/ECIV4/GetBasicDetailsByName?key=642987ca3faf4a7daeac70463ae22695&keyword="+companyName; |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | String timeStr = String.valueOf(System.currentTimeMillis() / 1000); |
| | | get.header("Token", SecureUtil.md5("642987ca3faf4a7daeac70463ae22695"+timeStr+"AC776F2957291EAE3B4161702E89A9F3").toUpperCase()); |
| | | get.header("Timespan", timeStr); |
| | | HttpResponse execute = get.execute(); |
| | | String body = execute.body(); |
| | | JSONObject jsonObject = JSONObject.parseObject(body); |
| | | if("200".equals(jsonObject.get("Status"))){ |
| | | return jsonObject; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | public static Object getQiChaChaCompanyExceptionCheck(String companyName){ |
| | | Object cacheObject = getInstance().redisCache.getCacheObject("qichacha_" + companyName); |
| | | if(cacheObject != null){ |
| | | JSONObject jsonObject = JSONObject.parseObject(cacheObject.toString()); |
| | | return jsonObject; |
| | | } |
| | | String url = "https://api.qichacha.com/ExceptionCheck/GetList?key=642987ca3faf4a7daeac70463ae22695&searchKey="+companyName; |
| | | HttpRequest get = HttpUtil.createGet(url); |
| | | String timeStr = String.valueOf(System.currentTimeMillis() / 1000); |
| | | get.header("Token", SecureUtil.md5("642987ca3faf4a7daeac70463ae22695"+timeStr+"AC776F2957291EAE3B4161702E89A9F3").toUpperCase()); |
| | | get.header("Timespan", timeStr); |
| | | HttpResponse execute = get.execute(); |
| | | String body = execute.body(); |
| | | JSONObject jsonObject = JSONObject.parseObject(body); |
| | | if("200".equals(jsonObject.get("Status"))){ |
| | | String string = jsonObject.toString(); |
| | | getInstance().redisCache.setCacheObject("qichacha_"+companyName,string,24, TimeUnit.HOURS); |
| | | return jsonObject; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import java.nio.charset.StandardCharsets; |
| | | import javax.servlet.ServletRequest; |
| | | import org.apache.commons.lang3.exception.ExceptionUtils; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.client.methods.CloseableHttpResponse; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.impl.client.CloseableHttpClient; |
| | | import org.apache.http.impl.client.HttpClients; |
| | | import org.apache.http.util.EntityUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | |
| | |
| | | } |
| | | return sb.toString(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 执行HTTP GET请求并返回响应内容 |
| | | * @param url 请求的URL |
| | | * @param headers 请求头数组 |
| | | * @return 响应内容字符串 |
| | | */ |
| | | public static String httpGet(String url, org.apache.http.Header[] headers) { |
| | | CloseableHttpClient httpClient = HttpClients.createDefault(); |
| | | HttpGet httpGet = new HttpGet(url); |
| | | |
| | | // 设置请求头 |
| | | if (headers != null) { |
| | | for (org.apache.http.Header header : headers) { |
| | | httpGet.setHeader(header); |
| | | } |
| | | } |
| | | |
| | | try { |
| | | CloseableHttpResponse response = httpClient.execute(httpGet); |
| | | return EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8); |
| | | } catch (IOException e) { |
| | | LOGGER.error("执行HTTP GET请求时发生错误:{}", e.getMessage()); |
| | | return null; |
| | | } finally { |
| | | try { |
| | | httpClient.close(); |
| | | } catch (IOException e) { |
| | | LOGGER.error("关闭HTTP客户端时发生错误:{}", e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <dependencies> |
| | | |
| | | |
| | | |
| | | |
| | | <!-- wx 支付 --> |
| | | <dependency> |
| | | <groupId>com.github.binarywang</groupId> |
| | |
| | | @TableField("out_trade_no") |
| | | private String outTradeNo; |
| | | |
| | | @TableField("transaction_id") |
| | | private String transactionId; |
| | | |
| | | |
| | | @TableField("finish_time") |
| | | private Date finishTime; |
| | |
| | | |
| | | @Data |
| | | public class UserAccountDetailQuery extends BasePage { |
| | | @ApiModelProperty(value = "开始时间") |
| | | private String startTime; |
| | | @ApiModelProperty(value = "结束时间") |
| | | private String endTime; |
| | | @ApiModelProperty(value = "时间 2025-07") |
| | | private String time; |
| | | } |
| | |
| | | if (order!=null) { |
| | | order.setStatus(4); |
| | | order.setPayTime(new Date()); |
| | | order.setOutTradeNo(notifyResult.getTransactionId()); |
| | | order.setOutTradeNo(notifyResult.getOutTradeNo()); |
| | | order.setTransactionId(notifyResult.getTransactionId()); |
| | | TbCompany company = companyService.getById(order.getCompanyId()); |
| | | // 生成记录 看是否分佣 金额 |
| | | TbUser user = userService.getById(company.getUserId()); |
| | |
| | | |
| | | messageService.addMessage("下单成功,请及时发送快递", order.getUserId(),order.getId()); |
| | | messageService.addMessage("您发布的订单买家已支付,请尽快处理!", company.getUserId(),order.getId()); |
| | | return "<xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>"; |
| | | } |
| | | return null; |
| | | |
| | | |
| | | return "<xml> <return_code><![CDATA[SUCCESS]]></return_code> <return_msg><![CDATA[OK]]></return_msg> </xml>"; |
| | | } |
| | | |
| | | @Override |
| | |
| | | private Date confirmTime; |
| | | |
| | | |
| | | @ApiModelProperty("企业经营异常信息 企查查参数说明") |
| | | private Object companyExceptionInfo; |
| | | |
| | | |
| | | } |