| New file |
| | |
| | | package com.stylefeng.guns.config; |
| | | |
| | | import com.qcloud.cos.COSClient; |
| | | import com.qcloud.cos.ClientConfig; |
| | | import com.qcloud.cos.auth.BasicCOSCredentials; |
| | | import com.qcloud.cos.auth.COSCredentials; |
| | | import com.qcloud.cos.region.Region; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class CosClientConfig { |
| | | |
| | | // 从配置文件读取密钥信息 |
| | | @Value("${cos.secretId}") |
| | | private String secretId; |
| | | |
| | | @Value("${cos.secretKey}") |
| | | private String secretKey; |
| | | |
| | | @Value("${cos.region}") |
| | | private String region; |
| | | |
| | | @Bean |
| | | public COSClient cosClient() { |
| | | // 1. 初始化用户身份信息 |
| | | COSCredentials cred = new BasicCOSCredentials(secretId, secretKey); |
| | | |
| | | // 2. 设置 bucket 的地域 |
| | | // 客户端配置,包含 region、超时、代理等设置 |
| | | ClientConfig clientConfig = new ClientConfig(new Region(region)); |
| | | |
| | | // 3. 生成 cos 客户端 |
| | | return new COSClient(cred, clientConfig); |
| | | } |
| | | } |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import com.obs.services.ObsClient; |
| | | import com.obs.services.model.ObjectMetadata; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.UUID; |
| | | |
| | | public class ObsUploadUtil { |
| | | //OBS图片访问域名 |
| | | public static String endPoint = "obs.cn-east-3.myhuaweicloud.com"; |
| | | public static String accessKeyId = "HB7DOVELEVWYYUS7QHYX"; |
| | | public static String accessKeySecret = "nEwDoSdLRkA1BRfW17pMZL9RlnrVywuTeHSkMn7y"; |
| | | public static String bucketName = "mian-ju-mi-liao"; |
| | | public static String oss_domain = "https://mian-ju-mi-liao.obs.cn-east-3.myhuaweicloud.com/"; |
| | | |
| | | |
| | | // 创建ObsClient实例 |
| | | public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | |
| | | public static String obsUpload(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()); |
| | | obsClient.putObject(bucketName,"admin/"+fileName,content,meta);// 上传Object. |
| | | if(fileName != null && !"".equals(fileName)){ |
| | | System.out.println(fileName); |
| | | fileName = oss_domain+"admin/"+fileName; |
| | | } |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | /** |
| | | * 删除某个Object |
| | | * |
| | | * @param bucketUrl |
| | | * @return |
| | | */ |
| | | public static boolean deleteObject(String bucketUrl) { |
| | | try { |
| | | bucketUrl=bucketUrl.replace(oss_domain+"web",""); |
| | | // 删除Object. |
| | | obsClient.deleteObject(bucketName, bucketUrl); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } finally { |
| | | //ossClient.shutdown(); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | // public static void createBucket(String bucketName) |
| | | // { |
| | | // //初始化 OSSClient |
| | | //// ossClient = new OssClient(endPoint, accessKeyId, accessKeySecret); |
| | | //package com.stylefeng.guns.core.util; |
| | | // |
| | | // // 新建一个Bucket |
| | | // Bucket bucket = ossClient.createBucket(bucketName); |
| | | // System.out.println(bucket.getName()); |
| | | // System.out.println(bucket.getCreationDate()); |
| | | // } |
| | | // |
| | | // public static void main(String[] args) { |
| | | // OssUploadUtil.createBucket("ssfdfsd"); |
| | | //import com.obs.services.ObsClient; |
| | | //import com.obs.services.model.ObjectMetadata; |
| | | //import org.springframework.web.multipart.MultipartFile; |
| | | // |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import java.io.IOException; |
| | | //import java.io.InputStream; |
| | | //import java.util.UUID; |
| | | // |
| | | //public class ObsUploadUtil { |
| | | // //OBS图片访问域名 |
| | | // public static String endPoint = "obs.cn-east-3.myhuaweicloud.com"; |
| | | // public static String accessKeyId = "HB7DOVELEVWYYUS7QHYX"; |
| | | // public static String accessKeySecret = "nEwDoSdLRkA1BRfW17pMZL9RlnrVywuTeHSkMn7y"; |
| | | // public static String bucketName = "mian-ju-mi-liao"; |
| | | // public static String oss_domain = "https://mian-ju-mi-liao.obs.cn-east-3.myhuaweicloud.com/"; |
| | | // |
| | | // |
| | | // // 创建ObsClient实例 |
| | | // public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | // |
| | | // public static String obsUpload(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()); |
| | | // obsClient.putObject(bucketName,"admin/"+fileName,content,meta);// 上传Object. |
| | | // if(fileName != null && !"".equals(fileName)){ |
| | | // System.out.println(fileName); |
| | | // fileName = oss_domain+"admin/"+fileName; |
| | | // } |
| | | // } |
| | | // return fileName; |
| | | // } |
| | | } |
| | | // |
| | | // /** |
| | | // * 删除某个Object |
| | | // * |
| | | // * @param bucketUrl |
| | | // * @return |
| | | // */ |
| | | // public static boolean deleteObject(String bucketUrl) { |
| | | // try { |
| | | // bucketUrl=bucketUrl.replace(oss_domain+"web",""); |
| | | // // 删除Object. |
| | | // obsClient.deleteObject(bucketName, bucketUrl); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // return false; |
| | | // } finally { |
| | | // //ossClient.shutdown(); |
| | | // } |
| | | // return true; |
| | | // } |
| | | // |
| | | //// public static void createBucket(String bucketName) |
| | | //// { |
| | | //// //初始化 OSSClient |
| | | ////// ossClient = new OssClient(endPoint, accessKeyId, accessKeySecret); |
| | | //// |
| | | //// // 新建一个Bucket |
| | | //// Bucket bucket = ossClient.createBucket(bucketName); |
| | | //// System.out.println(bucket.getName()); |
| | | //// System.out.println(bucket.getCreationDate()); |
| | | //// } |
| | | //// |
| | | //// public static void main(String[] args) { |
| | | //// OssUploadUtil.createBucket("ssfdfsd"); |
| | | //// } |
| | | //} |
| | |
| | | package com.stylefeng.guns.core.util; |
| | | |
| | | import com.obs.services.ObsClient; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.UUID; |
| | | |
| | | public class OssUploadUtil { |
| | | public static String endPoint = "obs.cn-south-1.myhuaweicloud.com"; |
| | | public static String accessKeyId = "MLJEFPYY0LJKAVA5C4YI"; |
| | | public static String accessKeySecret = "C8PmdLHAW7OOKR1fbEGYrqIiTh4yaLrRzA0uVZ89"; |
| | | public static String bucketName = "qinqinzhuanche"; |
| | | public static String oss_domain = "https://qinqinzhuanche.obs.cn-south-1.myhuaweicloud.com/"; |
| | | // 创建ObsClient实例 |
| | | public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | |
| | | 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();//获得指定文件的输入流 |
| | | com.obs.services.model.ObjectMetadata meta = new com.obs.services.model.ObjectMetadata();// 创建上传Object的Metadata |
| | | meta.setContentLength(file.getSize()); // 必须设置ContentLength |
| | | String originalFilename = file.getOriginalFilename(); |
| | | fileName = UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | obsClient.putObject(bucketName,fileName,content,meta);// 上传Object. |
| | | if(fileName != null && !"".equals(fileName)){ |
| | | System.out.println(fileName); |
| | | fileName = oss_domain+fileName; |
| | | } |
| | | } |
| | | return fileName; |
| | | } |
| | | |
| | | /** |
| | | * 删除某个Object |
| | | * |
| | | * @param bucketUrl |
| | | * @return |
| | | */ |
| | | public static boolean deleteObject(String bucketUrl) { |
| | | try { |
| | | bucketUrl=bucketUrl.replace(oss_domain+"web",""); |
| | | // 删除Object. |
| | | obsClient.deleteObject(bucketName, bucketUrl); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } finally { |
| | | //ossClient.shutdown(); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | |
| | | } |
| | | //package com.stylefeng.guns.core.util; |
| | | // |
| | | //import com.obs.services.ObsClient; |
| | | //import org.springframework.web.multipart.MultipartFile; |
| | | // |
| | | //import javax.servlet.http.HttpServletRequest; |
| | | //import java.io.IOException; |
| | | //import java.io.InputStream; |
| | | //import java.util.UUID; |
| | | // |
| | | //public class OssUploadUtil { |
| | | // public static String endPoint = "obs.cn-south-1.myhuaweicloud.com"; |
| | | // public static String accessKeyId = "MLJEFPYY0LJKAVA5C4YI"; |
| | | // public static String accessKeySecret = "C8PmdLHAW7OOKR1fbEGYrqIiTh4yaLrRzA0uVZ89"; |
| | | // public static String bucketName = "qinqinzhuanche"; |
| | | // public static String oss_domain = "https://qinqinzhuanche.obs.cn-south-1.myhuaweicloud.com/"; |
| | | // // 创建ObsClient实例 |
| | | // public static ObsClient obsClient = new ObsClient(accessKeyId, accessKeySecret, endPoint); |
| | | // |
| | | // 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();//获得指定文件的输入流 |
| | | // com.obs.services.model.ObjectMetadata meta = new com.obs.services.model.ObjectMetadata();// 创建上传Object的Metadata |
| | | // meta.setContentLength(file.getSize()); // 必须设置ContentLength |
| | | // String originalFilename = file.getOriginalFilename(); |
| | | // fileName = UUID.randomUUID().toString().replaceAll("-","") + originalFilename.subSequence(originalFilename.lastIndexOf("."), originalFilename.length()); |
| | | // obsClient.putObject(bucketName,fileName,content,meta);// 上传Object. |
| | | // if(fileName != null && !"".equals(fileName)){ |
| | | // System.out.println(fileName); |
| | | // fileName = oss_domain+fileName; |
| | | // } |
| | | // } |
| | | // return fileName; |
| | | // } |
| | | // |
| | | // /** |
| | | // * 删除某个Object |
| | | // * |
| | | // * @param bucketUrl |
| | | // * @return |
| | | // */ |
| | | // public static boolean deleteObject(String bucketUrl) { |
| | | // try { |
| | | // bucketUrl=bucketUrl.replace(oss_domain+"web",""); |
| | | // // 删除Object. |
| | | // obsClient.deleteObject(bucketName, bucketUrl); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // return false; |
| | | // } finally { |
| | | // //ossClient.shutdown(); |
| | | // } |
| | | // return true; |
| | | // } |
| | | // |
| | | // |
| | | //} |
| | |
| | | @Autowired |
| | | private ITDriverPayDaysService driverPayDaysService; |
| | | |
| | | @Autowired |
| | | private ITSysPushTypeService tSysPushTypeService; |
| | | |
| | | |
| | | /** |
| | | * 删除系统设置 |
| | |
| | | Double percentage, Integer timeOut, Double deductMoney, |
| | | Integer sjzp1, Integer sjzp2, Integer zuc1, Integer zuc2, Integer mc1, Integer mc2, |
| | | Integer czgrcl1, Integer czgrcl2, Integer mac1, Integer mac2, Integer sjzx1, Integer sjzx2, |
| | | Integer dck1, Integer dck2,Integer driverDays) { |
| | | Integer dck1, Integer dck2,Integer driverDays,Integer pushType) { |
| | | //改派设置 |
| | | if("reassigningSet".equals(type)){ |
| | | TSysReformist reformist = tSysReformistService.selectOne(new EntityWrapper<TSysReformist>().eq("openCityId", openCityId)); |
| | |
| | | |
| | | //推单设置 |
| | | if("pushOrderSettings".equals(type)){ |
| | | |
| | | TSysPushType sysPushType = tSysPushTypeService.selectOne(new EntityWrapper<TSysPushType>().eq("openCityId", openCityId)); |
| | | if(sysPushType==null){ |
| | | sysPushType = new TSysPushType(); |
| | | sysPushType.setOpenCityId(openCityId); |
| | | sysPushType.setPushType(pushType); |
| | | tSysPushTypeService.insert(sysPushType); |
| | | |
| | | }else{ |
| | | sysPushType.setOpenCityId(openCityId); |
| | | sysPushType.setPushType(pushType); |
| | | tSysPushTypeService.updateById(sysPushType); |
| | | } |
| | | |
| | | |
| | | //快车推单(第一轮) |
| | | TSysPushOrder zcOne = tSysPushOrderService.selectOne(new EntityWrapper<TSysPushOrder>().eq("openCityId", openCityId).eq("pushType", 1).eq("type", 1)); |
| | | if (SinataUtil.isNotEmpty(zcOne)){ |
| | |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.modular.system.model.TVersionManagement; |
| | | import com.stylefeng.guns.modular.system.service.ITVersionManagementService; |
| | | import com.stylefeng.guns.modular.system.util.COSUploadService; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Autowired |
| | | private COSUploadService cosUploadService; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | |
| | | Map<String, Object> m = new HashMap<>(); |
| | | //TODO 更换存储方式 |
| | | // QianYunTongConfig qianYunTongConfig1 = qianYunTongConfig.getQianYunTongConfig(); |
| | | try { |
| | | // String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(myfile.getOriginalFilename()); |
| | | // String bucketName = qianYunTongConfig1.getBucketName(); |
| | | // Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName); |
| | | // if (null == grjyTest) { |
| | | // //创建桶 |
| | | // Boolean bucket = NCOSSUtil.createBucket(bucketName); |
| | | // if (!bucket) { |
| | | // throw new RuntimeException("创建存储桶失败"); |
| | | // } |
| | | // //设置桶策略 |
| | | // String policyText = "{\"Version\":\"2025-06-23\",\"Statement\":[{\"Sid\":\"Stmt20250623\",\"Action\":[\"GetObject\"],\"Effect\":\"Allow\",\"Resource\":\"" + bucketName + "/*\",\"Principal\":\"*\"}]}"; |
| | | // Boolean bucketPolicy = NCOSSUtil.setBucketPolicy(bucketName, policyText); |
| | | // if (!bucketPolicy) { |
| | | // throw new RuntimeException("设置桶策略失败"); |
| | | // } |
| | | // } |
| | | // //上传对象 |
| | | // String key = "apk/" + pictureName; |
| | | // String object = NCOSSUtil.putObject(bucketName, key, myfile.getInputStream()); |
| | | // if (null == object) { |
| | | // throw new RuntimeException("上传图片失败"); |
| | | // } |
| | | // if("prod".equals(qianYunTongConfig.getActiveProfile())){ |
| | | // m.put("imgUrl", "https://traffic.qytzt.cn/v1/AUTH_" + qianYunTongConfig1.getAccount() + "/" + bucketName + "/" + key); |
| | | // }else{ |
| | | // m.put("imgUrl", "https://test-qncx.sitechcloud.com/v1/AUTH_" + qianYunTongConfig1.getAccount() + "/" + bucketName + "/" + key); |
| | | // } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // try { |
| | | // String pictureName = OssUploadUtil.ossUpload(request, myfile); |
| | | // m.put("imgUrl", pictureName); |
| | | // }catch (Exception e){ |
| | | // // String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(myfile.getOriginalFilename()); |
| | | // // String bucketName = qianYunTongConfig1.getBucketName(); |
| | | // // Bucket grjyTest = NCOSSUtil.getBucketInfo(bucketName); |
| | | // // if (null == grjyTest) { |
| | | // // //创建桶 |
| | | // // Boolean bucket = NCOSSUtil.createBucket(bucketName); |
| | | // // if (!bucket) { |
| | | // // throw new RuntimeException("创建存储桶失败"); |
| | | // // } |
| | | // // //设置桶策略 |
| | | // // String policyText = "{\"Version\":\"2025-06-23\",\"Statement\":[{\"Sid\":\"Stmt20250623\",\"Action\":[\"GetObject\"],\"Effect\":\"Allow\",\"Resource\":\"" + bucketName + "/*\",\"Principal\":\"*\"}]}"; |
| | | // // Boolean bucketPolicy = NCOSSUtil.setBucketPolicy(bucketName, policyText); |
| | | // // if (!bucketPolicy) { |
| | | // // throw new RuntimeException("设置桶策略失败"); |
| | | // // } |
| | | // // } |
| | | // // //上传对象 |
| | | // // String key = "apk/" + pictureName; |
| | | // // String object = NCOSSUtil.putObject(bucketName, key, myfile.getInputStream()); |
| | | // // if (null == object) { |
| | | // // throw new RuntimeException("上传图片失败"); |
| | | // // } |
| | | // // if("prod".equals(qianYunTongConfig.getActiveProfile())){ |
| | | // // m.put("imgUrl", "https://traffic.qytzt.cn/v1/AUTH_" + qianYunTongConfig1.getAccount() + "/" + bucketName + "/" + key); |
| | | // // }else{ |
| | | // // m.put("imgUrl", "https://test-qncx.sitechcloud.com/v1/AUTH_" + qianYunTongConfig1.getAccount() + "/" + bucketName + "/" + key); |
| | | // // } |
| | | // |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | try { |
| | | String pictureName = cosUploadService.uploadFile(myfile); |
| | | m.put("imgUrl", pictureName); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | return m; |
| | | } |
| | | |
| New file |
| | |
| | | package com.stylefeng.guns.modular.system.dao; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.stylefeng.guns.modular.system.model.TSysPushOrder; |
| | | import com.stylefeng.guns.modular.system.model.TSysPushType; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置-推单 Mapper 接口 |
| | | * </p> |
| | | * |
| | | * @author 吕雪 |
| | | * @since 2020-06-09 |
| | | */ |
| | | public interface TSysPushTypeMapper extends BaseMapper<TSysPushType> { |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.stylefeng.guns.modular.system.dao.TSysPushTypeMapper"> |
| | | |
| | | |
| | | </mapper> |
| New file |
| | |
| | | package com.stylefeng.guns.modular.system.model; |
| | | |
| | | import com.baomidou.mybatisplus.activerecord.Model; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置-推单模式 |
| | | * </p> |
| | | * |
| | | * @author 吕雪 |
| | | * @since 2020-06-09 |
| | | */ |
| | | @TableName("t_sys_push_type") |
| | | @Data |
| | | public class TSysPushType extends Model<TSysPushType> { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * 主键id |
| | | */ |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Integer id; |
| | | /** |
| | | * 企业id |
| | | */ |
| | | private Integer companyId; |
| | | /** |
| | | * 开通城市id |
| | | */ |
| | | @TableField("openCityId") |
| | | private Integer openCityId; |
| | | /** |
| | | * 1推单 2派单 |
| | | */ |
| | | private Integer pushType; |
| | | |
| | | @Override |
| | | protected Serializable pkVal() { |
| | | return null; |
| | | } |
| | | } |
| New file |
| | |
| | | package com.stylefeng.guns.modular.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.stylefeng.guns.modular.system.model.TSysPushOrder; |
| | | import com.stylefeng.guns.modular.system.model.TSysPushType; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置-推单 服务类 |
| | | * </p> |
| | | * |
| | | * @author 吕雪 |
| | | * @since 2020-06-09 |
| | | */ |
| | | public interface ITSysPushTypeService extends IService<TSysPushType> { |
| | | |
| | | } |
| New file |
| | |
| | | package com.stylefeng.guns.modular.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.TSysPushOrderMapper; |
| | | import com.stylefeng.guns.modular.system.dao.TSysPushTypeMapper; |
| | | import com.stylefeng.guns.modular.system.model.TSysPushOrder; |
| | | import com.stylefeng.guns.modular.system.model.TSysPushType; |
| | | import com.stylefeng.guns.modular.system.service.ITSysPushOrderService; |
| | | import com.stylefeng.guns.modular.system.service.ITSysPushTypeService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * <p> |
| | | * 系统设置-推单 服务实现类 |
| | | * </p> |
| | | * |
| | | * @author 吕雪 |
| | | * @since 2020-06-09 |
| | | */ |
| | | @Service |
| | | public class TSysPushTypeServiceImpl extends ServiceImpl<TSysPushTypeMapper, TSysPushType> implements ITSysPushTypeService { |
| | | |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.util.ArrayList; |
| | |
| | | @Service |
| | | public class COSUploadService { |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private COSClient cosClient; |
| | | |
| | | @Value("${cos.bucketName}") |
| | | private String bucketName; |
| | | |
| | | @Value("${cos.base-url}") |
| | | private String baseUrl; |
| | | @Value("${cos.baseUrl}") |
| | | private String baseUrl="https://cb-1358396420.cos.ap-shanghai.mvacloud.com"; |
| | | |
| | | /** |
| | | * 上传MultipartFile到COS |
| | | * @param file MultipartFile文件 |
| | | * @return 文件访问URL |
| | | */ |
| | | public String uploadFile(MultipartFile file) { |
| | | public String uploadFile(MultipartFile file) { |
| | | // 参数校验 |
| | | if (file == null || file.isEmpty()) { |
| | | throw new IllegalArgumentException("文件不能为空"); |
| | |
| | | /** |
| | | * 生成唯一文件名 |
| | | */ |
| | | private String generateFileName(String fileExtension) { |
| | | private String generateFileName(String fileExtension) { |
| | | return UUID.randomUUID().toString().replace("-", "") + fileExtension; |
| | | } |
| | | |
| | | /** |
| | | * 获取文件扩展名 |
| | | */ |
| | | private String getFileExtension(String filename) { |
| | | private String getFileExtension(String filename) { |
| | | if (filename == null || filename.lastIndexOf(".") == -1) { |
| | | return ""; |
| | | } |
| | |
| | | // 生产环境建议使用更安全的密钥管理方案,如密钥管理系统(KMS)、容器密钥注入等 |
| | | // 请参见:https://cloud.tencent.com/document/product/1278/85305 |
| | | // 密钥可前往官网控制台 https://console.cloud.tencent.com/cam/capi 进行获取 |
| | | Credential cred = new Credential("AKIDRlDTWVIrDOMAl8LMCoF6nGXdXEh19EHC", "tsjPtFQPwX6kGdpgSSI0UmyFQRZeboqe"); |
| | | Credential cred = new Credential("AKIDZBew0rJbghYnt20oRr44qQpDViu6HMGx", "pRvd9ez71iBSXO1PYrwnPyMVRAew53mH"); |
| | | // 使用临时密钥示例 |
| | | // Credential cred = new Credential("SecretId", "SecretKey", "Token"); |
| | | // 实例化一个http选项,可选的,没有特殊需求可以跳过 |
| | |
| | | #交通部推送数据功能开关 |
| | | pushMinistryOfTransport: false |
| | | |
| | | |
| | | cos: |
| | | secretId: AKIDofP7ezSmvtiNtDMLExUpALJCya0EHG3e |
| | | secretKey: Sp481pRrRpBQzOekfPzPgmhR0GV9oKem |
| | | region: ap-shanghai |
| | | bucketName: cb-1358396420 |
| | | baseUrl: https://cb-1358396420.cos.ap-shanghai.mvacloud.com |
| | | |
| | | |
| | |
| | | <div style="float: left;width: 1200px;margin-left: 50px;"> |
| | | <div class="pushOrderSettings"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-2 control-label">推单设置:</label> |
| | | <div class="col-sm-10"> |
| | | <div class="radio radio-danger"> |
| | | <input type="radio" name="pushOrderMode" id="pushOrderMode1" value="1" checked> |
| | | <label for="pushOrderMode1"> |
| | | 启用推单模式 |
| | | </label> |
| | | </div> |
| | | <div class="radio radio-danger"> |
| | | <input type="radio" name="pushOrderMode" id="pushOrderMode2" value="2"> |
| | | <label for="pushOrderMode2"> |
| | | 启动指派模式 |
| | | </label> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | |
| | | |
| | | <label class="col-sm-2 control-label">快车推单:</label> |
| | | <div class="col-sm-10"> |
| | | 第一轮推单:推单距离为 <input type="text" oninput="checkIsDouble(this)" |
| | |
| | | var zc8 = null == $("#zc8").val() ? "0" : $("#zc8").val().trim(); |
| | | var zc9 = null == $("#zc9").val() ? "0" : $("#zc9").val().trim(); |
| | | |
| | | var pushType = $("input[name='pushOrderMode']:checked").val(); |
| | | |
| | | var czc1 = null == $("#czc1").val() ? "0" : $("#czc1").val().trim(); |
| | | var czc2 = null == $("#czc2").val() ? "0" : $("#czc2").val().trim(); |
| | | var czc3 = null == $("#czc3").val() ? "0" : $("#czc3").val().trim(); |
| | |
| | | ajax.set("czc7", czc7); |
| | | ajax.set("czc8", czc8); |
| | | ajax.set("czc9", czc9); |
| | | |
| | | ajax.set("pushType", pushType); |
| | | } |
| | | |
| | | if(type == 'cancelOrderSettings'){ |