Commit e2a8bc75 by huluobin

maven修改

parent f90d4872
...@@ -19,45 +19,45 @@ ...@@ -19,45 +19,45 @@
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<weixin-java-mp.version>3.3.0</weixin-java-mp.version> <weixin-java-miniapp.version>3.3.0</weixin-java-miniapp.version>
<mybatis-plus-generator.version>3.0.7</mybatis-plus-generator.version>
<mybatis-plus-boot-starter.version>3.0.7</mybatis-plus-boot-starter.version>
<weixin-java-pay.version>3.1.0</weixin-java-pay.version>
<qiniu-java-sdk.version>[7.2.0, 7.2.99]</qiniu-java-sdk.version>
<geodesy.version>1.1.3</geodesy.version>
<springfox-swagger-ui.version>2.9.2</springfox-swagger-ui.version>
<springfox-swagger2.version>2.9.2</springfox-swagger2.version>
<bcprov-jdk16.version>1.46</bcprov-jdk16.version>
<commons-io.version>2.4</commons-io.version>
<commons-dbcp.version>1.4</commons-dbcp.version>
<commons-pool2.version>2.6.2</commons-pool2.version>
<qcloudsms.version>1.0.6</qcloudsms.version>
<commons-lang3.verson>3.4</commons-lang3.verson>
<json-lib.version>2.4</json-lib.version>
<fastjson.version>1.2.47</fastjson.version>
<commons-fileupload.version>1.3.1</commons-fileupload.version>
</properties> </properties>
<dependencies> <dependencies>
<!--mp 增加Mybatis-->
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.0.7</version> <version>${mybatis-plus-generator.version}</version>
</dependency> </dependency>
<dependency> <!--日志输出到数据库-->
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.17</version>
</dependency>
<!--数据库日志-->
<dependency> <dependency>
<groupId>commons-dbcp</groupId> <groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId> <artifactId>commons-dbcp</artifactId>
<version>1.4</version> <version>${commons-dbcp.version}</version>
</dependency> </dependency>
<!--邮件服务-->
<dependency> <dependency>
<groupId>com.google.zxing</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>core</artifactId> <artifactId>spring-boot-starter-mail</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>com.google.zxing</groupId>
<artifactId>javase</artifactId>
<version>3.3.0</version>
</dependency> </dependency>
<!--数据库连接组件--> <!--数据库连接组件-->
...@@ -66,11 +66,11 @@ ...@@ -66,11 +66,11 @@
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
</dependency> </dependency>
<!--工具包--> <!--对象池工具包-->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId> <artifactId>commons-pool2</artifactId>
<version>2.6.2</version> <version>${commons-pool2.version}</version>
</dependency> </dependency>
<!--spring aspect 切面--> <!--spring aspect 切面-->
...@@ -91,21 +91,16 @@ ...@@ -91,21 +91,16 @@
<dependency> <dependency>
<groupId>net.sf.json-lib</groupId> <groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId> <artifactId>json-lib</artifactId>
<version>2.4</version> <version>${json-lib.version}</version>
<classifier>jdk15</classifier> <classifier>jdk15</classifier>
</dependency> </dependency>
<!--qcloud短信模块-->
<!--腾讯云qcloud短信模块-->
<dependency> <dependency>
<groupId>com.github.qcloudsms</groupId> <groupId>com.github.qcloudsms</groupId>
<artifactId>qcloudsms</artifactId> <artifactId>qcloudsms</artifactId>
<version>1.0.6</version> <version>${qcloudsms.version}</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.10</version>
</dependency> </dependency>
<!--lombok--> <!--lombok-->
...@@ -121,94 +116,91 @@ ...@@ -121,94 +116,91 @@
<artifactId>spring-boot-starter-websocket</artifactId> <artifactId>spring-boot-starter-websocket</artifactId>
</dependency> </dependency>
<!--fastjson-->
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>1.2.47</version> <version>${fastjson.version}</version>
</dependency> </dependency>
<!--apache 工具包-->
<dependency> <dependency>
<groupId>org.apache.commons</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId> <artifactId>commons-lang3</artifactId>
<version>3.4</version> <version>${commons-lang3.verson}</version>
</dependency> </dependency>
<!--编码工具包-->
<dependency> <dependency>
<groupId>commons-codec</groupId> <groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId> <artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency> </dependency>
<!--文件处理工具包 commons-fileupload 通常和 commons-io 一起使用-->
<dependency> <dependency>
<groupId>commons-fileupload</groupId> <groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId> <artifactId>commons-fileupload</artifactId>
<version>1.3.1</version> <version>${commons-fileupload.version}</version>
</dependency> </dependency>
<!--文件处理工具包 commons-fileupload 通常和 commons-io 一起使用-->
<dependency> <dependency>
<groupId>commons-io</groupId> <groupId>commons-io</groupId>
<artifactId>commons-io</artifactId> <artifactId>commons-io</artifactId>
<version>2.4</version> <version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180813</version>
</dependency> </dependency>
<!-- 微信小程序加密数据解密算法 --> <!-- 微信小程序加密数据解密算法 -->
<dependency> <dependency>
<groupId>org.bouncycastle</groupId> <groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId> <artifactId>bcprov-jdk16</artifactId>
<version>1.46</version> <version>${bcprov-jdk16.version}</version>
</dependency> </dependency>
<!-- 自动生成接口文档 --> <!-- 自动生成接口文档 -->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId> <artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version> <version>${springfox-swagger2.version}</version>
</dependency> </dependency>
<!-- 自动生成接口文档 -->
<dependency> <dependency>
<groupId>io.springfox</groupId> <groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId> <artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version> <version>${springfox-swagger-ui.version}</version>
</dependency> </dependency>
<!--地理位置计算工具包-->
<dependency> <dependency>
<groupId>org.gavaghan</groupId> <groupId>org.gavaghan</groupId>
<artifactId>geodesy</artifactId> <artifactId>geodesy</artifactId>
<version>1.1.3</version> <version>${geodesy.version}</version>
</dependency> </dependency>
<!--七牛云文档-->
<dependency> <dependency>
<groupId>com.qiniu</groupId> <groupId>com.qiniu</groupId>
<artifactId>qiniu-java-sdk</artifactId> <artifactId>qiniu-java-sdk</artifactId>
<version>[7.2.0, 7.2.99]</version> <version>${qiniu-java-sdk.version}</version>
</dependency> </dependency>
<!--微信小程序二次开发sdk-->
<dependency> <dependency>
<groupId>com.github.binarywang</groupId> <groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId> <artifactId>weixin-java-miniapp</artifactId>
<version>${weixin-java-mp.version}</version> <version>${weixin-java-miniapp.version}</version>
</dependency> </dependency>
<!--微信支付二次开发sdk-->
<dependency> <dependency>
<groupId>com.github.binarywang</groupId> <groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-pay</artifactId> <artifactId>weixin-java-pay</artifactId>
<version>3.1.0</version> <version>${weixin-java-pay.version}</version>
</dependency>
<!-- 数据库连接池 -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>1.1.12</version>
</dependency> </dependency>
<!--spring web组件-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
...@@ -226,30 +218,22 @@ ...@@ -226,30 +218,22 @@
<artifactId>spring-boot-starter-undertow</artifactId> <artifactId>spring-boot-starter-undertow</artifactId>
</dependency> </dependency>
<!--springboot自动配置--> <!--springboot redis-->
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId> <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency> </dependency>
<!--mp 代码生成工具-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId> <artifactId>mybatis-plus-generator</artifactId>
<version>3.0.7</version> <version>${mybatis-plus-generator.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.freemarker</groupId> <groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId> <artifactId>freemarker</artifactId>
<!-- <version>2.3.9</version>-->
</dependency> </dependency>
...@@ -387,7 +371,6 @@ ...@@ -387,7 +371,6 @@
<!-- </execution>--> <!-- </execution>-->
<!-- </executions>--> <!-- </executions>-->
</plugin> </plugin>
</plugins> </plugins>
<resources> <resources>
...@@ -403,5 +386,4 @@ ...@@ -403,5 +386,4 @@
</resource> </resource>
</resources> </resources>
</build> </build>
</project> </project>
...@@ -42,7 +42,7 @@ import com.gogirl.infrastructure.mapper.product.serve.ProducePromotionTimeMapper ...@@ -42,7 +42,7 @@ import com.gogirl.infrastructure.mapper.product.serve.ProducePromotionTimeMapper
import com.gogirl.infrastructure.mapper.store.store.StoreTechnicianMapper; import com.gogirl.infrastructure.mapper.store.store.StoreTechnicianMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceMapper; import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerMessageMapper; import com.gogirl.infrastructure.mapper.user.customer.CustomerMessageMapper;
import com.gogirl.infrastructure.service.subscribe.SubscribeService; import com.gogirl.infrastructure.service.subscribe.PushMsgService;
import com.gogirl.infrastructure.util.SessionUtils; import com.gogirl.infrastructure.util.SessionUtils;
import com.gogirl.shared.member.order.command.CreateCommentCommand; import com.gogirl.shared.member.order.command.CreateCommentCommand;
import com.gogirl.shared.member.order.command.OrderCommentCommand; import com.gogirl.shared.member.order.command.OrderCommentCommand;
...@@ -108,7 +108,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order ...@@ -108,7 +108,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
@Resource @Resource
private CustomerService customerService; private CustomerService customerService;
@Resource @Resource
private SubscribeService subscribeService; private PushMsgService pushMsgService;
@Resource @Resource
private GogirlTokenService gogirlTokenService; private GogirlTokenService gogirlTokenService;
@Resource @Resource
...@@ -451,7 +451,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order ...@@ -451,7 +451,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
} }
Customer customer = customerService.selectByCustomerId(orderManage.getOrderUser()); Customer customer = customerService.selectByCustomerId(orderManage.getOrderUser());
subscribeService.sendOrderPayNotifyMsg(orderId, pushMsgService.sendOrderPayNotifyMsg(orderId,
customer.getOpenid1(), customer.getOpenid1(),
name, name,
orderManage.getOrderNo(), orderManage.getOrderNo(),
...@@ -821,7 +821,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order ...@@ -821,7 +821,7 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
//非朋友代付 //非朋友代付
orderManage.setIsFriendPay(2); orderManage.setIsFriendPay(2);
//发送订阅消息 //发送订阅消息
subscribeService.sendPaySuccessMsg(orderId, customer.getOpenid1(), payTypeStr, new Date(), orderManage.getTotalPaymentAmount(), new BigDecimal(customerBalance.getBalance() / 100)); pushMsgService.sendPaySuccessMsg(orderId, customer.getOpenid1(), payTypeStr, new Date(), orderManage.getTotalPaymentAmount(), new BigDecimal(customerBalance.getBalance() / 100));
this.updateById(orderManage); this.updateById(orderManage);
} }
...@@ -925,12 +925,18 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order ...@@ -925,12 +925,18 @@ public class OrderManageServiceImpl extends ServiceImpl<OrderManageMapper, Order
ScheduleManage scheduleManage = scheduleManageMapper.selectById(orderManage.getScheduledId()); ScheduleManage scheduleManage = scheduleManageMapper.selectById(orderManage.getScheduledId());
List<ScheduleServe> scheduleServeList = scheduleServeMapper.selectList(new LambdaQueryWrapper<ScheduleServe>().eq(ScheduleServe::getSchId, scheduleManage.getId())); List<ScheduleServe> scheduleServeList = scheduleServeMapper.selectList(new LambdaQueryWrapper<ScheduleServe>().eq(ScheduleServe::getSchId, scheduleManage.getId()));
List<OrderServe> orderServeList = orderServeMapper.selectList(new LambdaQueryWrapper<OrderServe>().eq(OrderServe::getOrderId, orderManage.getId())); List<OrderServe> orderServeList = orderServeMapper.selectList(new LambdaQueryWrapper<OrderServe>().eq(OrderServe::getOrderId, orderManage.getId()));
//过滤辅助服务
orderServeList = orderServeList.stream() orderServeList = orderServeList.stream()
.filter(orderServe -> scheduleServeList.stream() .filter(orderServe -> scheduleServeList.stream()
.filter(scheduleServe -> scheduleServe.getMainServeId() == null) .filter(scheduleServe -> scheduleServe.getMainServeId() == null)
.map(ScheduleServe::getServeId) .map(ScheduleServe::getServeId)
.collect(Collectors.toList()) .collect(Collectors.toList())
.contains(orderServe.getServeId())) .contains(orderServe.getServeId())
||
!scheduleServeList.stream()
.map(ScheduleServe::getServeId)
.collect(Collectors.toList())
.contains(orderServe.getServeId()))
.collect(Collectors.toList()); .collect(Collectors.toList());
orderServeList.forEach(orderServe -> { orderServeList.forEach(orderServe -> {
......
...@@ -3,26 +3,27 @@ package com.gogirl.application.xcx.impl; ...@@ -3,26 +3,27 @@ package com.gogirl.application.xcx.impl;
import com.github.binarywang.utils.qrcode.MatrixToImageWriter; import com.github.binarywang.utils.qrcode.MatrixToImageWriter;
import com.gogirl.application.xcx.QRCodeService; import com.gogirl.application.xcx.QRCodeService;
import com.gogirl.infrastructure.config.property.GogirlProperties; import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.util.ImageUtils; import com.gogirl.infrastructure.service.file.FileService;
import com.google.zxing.BarcodeFormat; import com.google.zxing.BarcodeFormat;
import com.google.zxing.common.BitMatrix; import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter; import com.google.zxing.qrcode.QRCodeWriter;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.json.JSONObject; import org.json.JSONObject;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.util.UUID; import java.util.UUID;
@Service @Service
@AllArgsConstructor
@Slf4j @Slf4j
public class QRCodeServiceImpl implements QRCodeService { public class QRCodeServiceImpl implements QRCodeService {
@Resource
private final GogirlProperties gogirlProperties; private GogirlProperties gogirlProperties;
@Resource
FileService fileService;
public String myQrCode(String customerId, String phone) throws Exception { public String myQrCode(String customerId, String phone) throws Exception {
...@@ -41,7 +42,7 @@ public class QRCodeServiceImpl implements QRCodeService { ...@@ -41,7 +42,7 @@ public class QRCodeServiceImpl implements QRCodeService {
MatrixToImageWriter.writeToFile(bitMatrix, "PNG", file); MatrixToImageWriter.writeToFile(bitMatrix, "PNG", file);
return ImageUtils.qiniuUpload(file); return fileService.qiniuUpload(file);
} }
} }
......
...@@ -43,7 +43,7 @@ import com.gogirl.infrastructure.mapper.store.store.StoreManageMapper; ...@@ -43,7 +43,7 @@ import com.gogirl.infrastructure.mapper.store.store.StoreManageMapper;
import com.gogirl.infrastructure.mapper.store.store.StoreTechnicianMapper; import com.gogirl.infrastructure.mapper.store.store.StoreTechnicianMapper;
import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMapper; import com.gogirl.infrastructure.mapper.user.customer.CustomerBalanceRecordMapper;
import com.gogirl.infrastructure.mapper.xcx.WeekConfigMapper; import com.gogirl.infrastructure.mapper.xcx.WeekConfigMapper;
import com.gogirl.infrastructure.service.subscribe.SubscribeService; import com.gogirl.infrastructure.service.subscribe.PushMsgService;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -80,7 +80,7 @@ public class Schedule { ...@@ -80,7 +80,7 @@ public class Schedule {
private final StoreTechnicianService storeTechnicianService; private final StoreTechnicianService storeTechnicianService;
private final StoreManageService storeManageService; private final StoreManageService storeManageService;
private final ScheduleManageService scheduleManageService; private final ScheduleManageService scheduleManageService;
private final SubscribeService subscribeService; private final PushMsgService pushMsgService;
private final CustomerService customerService; private final CustomerService customerService;
private final MallOrderService mallOrderService; private final MallOrderService mallOrderService;
private final ProduceSalesService produceSalesService; private final ProduceSalesService produceSalesService;
...@@ -203,7 +203,7 @@ public class Schedule { ...@@ -203,7 +203,7 @@ public class Schedule {
StoreManage storeManage = storeManageService.getById(scheduleManage.getDepartmentId()); StoreManage storeManage = storeManageService.getById(scheduleManage.getDepartmentId());
List<ScheduleServe> scheduleServeList = scheduleManageMapper.selectByScheduleId(scheduleManage.getId()); List<ScheduleServe> scheduleServeList = scheduleManageMapper.selectByScheduleId(scheduleManage.getId());
subscribeService.sendScheduleMsg(customer.getOpenid1(), scheduleServeList.get(0).getServeName(), scheduleManage.getArriveTime(), storeManage.getName(), storeManage.getAddress()); pushMsgService.sendScheduleMsg(customer.getOpenid1(), scheduleServeList.get(0).getServeName(), scheduleManage.getArriveTime(), storeManage.getName(), storeManage.getAddress());
scheduleManage.setIsSend(1); scheduleManage.setIsSend(1);
scheduleManageMapper.updateById(scheduleManage); scheduleManageMapper.updateById(scheduleManage);
...@@ -244,7 +244,7 @@ public class Schedule { ...@@ -244,7 +244,7 @@ public class Schedule {
StoreManage storeManage = storeManageService.getById(scheduleManage.getDepartmentId()); StoreManage storeManage = storeManageService.getById(scheduleManage.getDepartmentId());
if (customer != null) { if (customer != null) {
try { try {
subscribeService.sendOverScheduleMsg(customer.getOpenid1(), scheduleServeList.get(0).getServeName(), scheduleManage.getArriveTime(), storeManage.getName(), storeManage.getAddress()); pushMsgService.sendOverScheduleMsg(customer.getOpenid1(), scheduleServeList.get(0).getServeName(), scheduleManage.getArriveTime(), storeManage.getName(), storeManage.getAddress());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -615,7 +615,7 @@ public class Schedule { ...@@ -615,7 +615,7 @@ public class Schedule {
try { try {
Customer customer = customerService.getById(orderManage.getOrderUser()); Customer customer = customerService.getById(orderManage.getOrderUser());
subscribeService.testPaper(customer.getOpenid1(), orderManage.getId()); pushMsgService.sendCommentMsg(customer.getOpenid1(), orderManage.getId());
orderManage.setIsSendCommentMsg(1); orderManage.setIsSendCommentMsg(1);
orderManageMapper.updateById(orderManage); orderManageMapper.updateById(orderManage);
......
package com.gogirl.infrastructure.service.file;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
public interface FileService {
/**
* 上传mutiPartFile
*
* @param multipartFile
* @return
*/
String saveImage(MultipartFile multipartFile) throws IOException;
/**
* 上传本地文件
*
* @param localFile
* @return
*/
String qiniuUpload(File localFile);
}
package com.gogirl.infrastructure.util; package com.gogirl.infrastructure.service.file.impl;
import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.service.file.FileService;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.qiniu.common.QiniuException; import com.qiniu.common.QiniuException;
import com.qiniu.common.Zone; import com.qiniu.common.Zone;
...@@ -8,28 +10,42 @@ import com.qiniu.storage.Configuration; ...@@ -8,28 +10,42 @@ import com.qiniu.storage.Configuration;
import com.qiniu.storage.UploadManager; import com.qiniu.storage.UploadManager;
import com.qiniu.storage.model.DefaultPutRet; import com.qiniu.storage.model.DefaultPutRet;
import com.qiniu.util.Auth; import com.qiniu.util.Auth;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
public class ImageUtils { /**
* 文件服务 七牛云实现
*/
@Service
public class QiniuFileServiceImpl implements FileService {
public static String saveImage(String picturePath, MultipartFile multipartFile) throws IOException { @Resource
GogirlProperties gogirlProperties;
@Override
public String saveImage(MultipartFile multipartFile) throws IOException {
//临时文件地址
String picturePath = gogirlProperties.getPicturePath();
//文件名
String fileName = multipartFile.getOriginalFilename(); String fileName = multipartFile.getOriginalFilename();
String fileSuffix = fileName.substring(fileName.lastIndexOf("."), fileName.length()); String fileSuffix = fileName.substring(fileName.lastIndexOf("."));
String localFileName = System.currentTimeMillis() + fileSuffix; String localFileName = System.currentTimeMillis() + fileSuffix;
String filePath = picturePath + File.separator + localFileName; String filePath = picturePath + File.separator + localFileName;
File localFile = new File(filePath); File localFile = new File(filePath);
File imagePath = new File(picturePath); File imagePath = new File(picturePath);
if (!imagePath.exists()) { if (!imagePath.exists()) {
imagePath.mkdirs(); boolean ignore = imagePath.mkdirs();
} }
multipartFile.transferTo(localFile); multipartFile.transferTo(localFile);
return qiniuUpload(localFile); return qiniuUpload(localFile);
} }
public static String qiniuUpload(File localFilePath) { @Override
public String qiniuUpload(File localFilePath) {
//1、构造一个带指定Zone对象的配置类 //1、构造一个带指定Zone对象的配置类
Configuration cfg = new Configuration(Zone.zone2()); Configuration cfg = new Configuration(Zone.zone2());
//2、其他参数参考类注释 //2、其他参数参考类注释
...@@ -39,7 +55,6 @@ public class ImageUtils { ...@@ -39,7 +55,6 @@ public class ImageUtils {
String secretKey = "tS2gxsQO26mGoFZJI-x8WSH9X5aPgYMJcyoJdak5"; String secretKey = "tS2gxsQO26mGoFZJI-x8WSH9X5aPgYMJcyoJdak5";
String bucket = "begogirls"; String bucket = "begogirls";
//如果是Windows情况下,格式是 D:\\qiniu\\test.png
//默认不指定key的情况下,以文件内容的hash值作为文件名 //默认不指定key的情况下,以文件内容的hash值作为文件名
String key = null; String key = null;
Auth auth = Auth.create(accessKey, secretKey); Auth auth = Auth.create(accessKey, secretKey);
......
package com.gogirl.infrastructure.service.sms; package com.gogirl.infrastructure.service.sms;
import com.github.qcloudsms.SmsSingleSender;
import com.github.qcloudsms.SmsSingleSenderResult; import com.github.qcloudsms.SmsSingleSenderResult;
import org.json.JSONException;
import org.springframework.stereotype.Service;
import javax.xml.ws.http.HTTPException; public interface SmsService {
import java.io.IOException;
@Service /**
public class SmsService { * 发送短信验证码
int appid = SmsConstant.appid; *
String appkey = SmsConstant.appkey; * @param phoneNumber
* @param code
public static String decodeUnicode(String unicode) { * @return
StringBuffer sb = new StringBuffer(); */
String[] hex = unicode.split("\\\\u"); SmsSingleSenderResult sendBindSmsCode(String phoneNumber, String code);
for (int i = 1; i < hex.length; i++) {
int data = Integer.parseInt(hex[i], 16);
sb.append((char) data);
}
return sb.toString();
}
public SmsSingleSenderResult sendLoginSmsCode(String phoneNumber, String code) {
String smsSign = SmsConstant.smsSign;
int templateId = SmsConstant.loginTemplateId;
String activeTime = SmsConstant.activeTime;
String[] params = {code, activeTime};
return sendSmsCode(phoneNumber, params, templateId, smsSign);
}
public SmsSingleSenderResult sendBindSmsCode(String phoneNumber, String code) {
String smsSign = SmsConstant.smsSign;
int templateId = SmsConstant.bindTemplateId;
String activeTime = SmsConstant.activeTime;
String[] params = {code, activeTime};
return sendSmsCode(phoneNumber, params, templateId, smsSign);
}
private SmsSingleSenderResult sendSmsCode(String phoneNumber, String[] params, int templateId, String smsSign) {
SmsSingleSenderResult result = new SmsSingleSenderResult();
try {
SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
result = ssender.sendWithParam("86", phoneNumber,
templateId, params, smsSign, "", "");
} catch (HTTPException e) {
// HTTP响应码错误
e.printStackTrace();
return result;
} catch (JSONException e) {
// json解析错误
e.printStackTrace();
return result;
} catch (IOException e) {
// 网络IO错误
e.printStackTrace();
return result;
} catch (com.github.qcloudsms.httpclient.HTTPException e) {
e.printStackTrace();
}
return result;
}
} }
package com.gogirl.infrastructure.service.sms.impl;
import com.github.qcloudsms.SmsSingleSender;
import com.github.qcloudsms.SmsSingleSenderResult;
import com.gogirl.infrastructure.service.sms.SmsService;
import lombok.extern.slf4j.Slf4j;
import org.json.JSONException;
import org.springframework.stereotype.Service;
import javax.xml.ws.http.HTTPException;
import java.io.IOException;
/**
* 短信服务 腾讯云短信实现
*/
@Service
@Slf4j
public class QCloudSmsServiceImpl implements SmsService {
@Override
public SmsSingleSenderResult sendBindSmsCode(String phoneNumber, String code) {
//
String smsSign = SmsConstant.smsSign;
int templateId = SmsConstant.bindTemplateId;
String[] params = {code, SmsConstant.activeTime};
SmsSingleSenderResult result = new SmsSingleSenderResult();
try {
SmsSingleSender sender = new SmsSingleSender(SmsConstant.appid, SmsConstant.appkey);
result = sender.sendWithParam("86", phoneNumber, templateId, params, smsSign, "", "");
}
// HTTP响应码错误 json解析错误 网络IO错误
catch (HTTPException | JSONException | IOException | com.github.qcloudsms.httpclient.HTTPException e) {
log.error(e.getMessage(), e);
}
return result;
}
}
package com.gogirl.infrastructure.service.sms; package com.gogirl.infrastructure.service.sms.impl;
public class SmsConstant { public class SmsConstant {
// 短信应用SDK AppID // 短信应用SDK AppID
public static final int appid = 1400159337; // 1400开头1400144640 public static final int appid = 1400159337;
// 短信应用SDK AppKey // 短信应用SDK AppKey
public static final String appkey = "253e42aa6423cfd51ff1eb735cd12d99";//"b839ac7529c10835d38e341ae672bbcb"; public static final String appkey = "253e42aa6423cfd51ff1eb735cd12d99";
// 短信模板ID,需要在短信应用中申请223595
public static final int loginTemplateId = 223595;
// 短信模板ID,需要在短信应用中申请 // 短信模板ID,需要在短信应用中申请
public static final int bindTemplateId = 223595; public static final int bindTemplateId = 223595;
// 签名 // 腾讯云短信签名
public static final String smsSign = "gogirl美甲美睫"; public static final String smsSign = "gogirl美甲美睫";
//验证码有效时间 //验证码有效时间
......
...@@ -3,7 +3,10 @@ package com.gogirl.infrastructure.service.subscribe; ...@@ -3,7 +3,10 @@ package com.gogirl.infrastructure.service.subscribe;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
public interface SubscribeService { /**
* 消息推送服务
*/
public interface PushMsgService {
void sendScheduleMsg(String openId, void sendScheduleMsg(String openId,
String scheduleName, String scheduleName,
...@@ -64,6 +67,5 @@ public interface SubscribeService { ...@@ -64,6 +67,5 @@ public interface SubscribeService {
* @param openid1 * @param openid1
* @param id * @param id
*/ */
void testPaper(String openid1, void sendCommentMsg(String openid1, Integer id);
Integer id);
} }
...@@ -4,7 +4,7 @@ import com.gogirl.application.xcx.impl.AccessTokenService; ...@@ -4,7 +4,7 @@ import com.gogirl.application.xcx.impl.AccessTokenService;
import com.gogirl.infrastructure.common.base.JsonResult; import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.common.util.JsonUtilByFsJson; import com.gogirl.infrastructure.common.util.JsonUtilByFsJson;
import com.gogirl.infrastructure.config.property.WxProperties; import com.gogirl.infrastructure.config.property.WxProperties;
import com.gogirl.infrastructure.service.subscribe.SubscribeService; import com.gogirl.infrastructure.service.subscribe.PushMsgService;
import com.gogirl.shared.wx.*; import com.gogirl.shared.wx.*;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -20,7 +20,7 @@ import java.util.HashMap; ...@@ -20,7 +20,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* 小程序订阅消息基础服务类 * 小程序订阅消息实现消息推送服务
* *
* @Author robbendev * @Author robbendev
* @Description //TODO * @Description //TODO
...@@ -29,7 +29,7 @@ import java.util.Map; ...@@ -29,7 +29,7 @@ import java.util.Map;
@Service @Service
@AllArgsConstructor @AllArgsConstructor
@Slf4j @Slf4j
public class SubscribeServiceImpl implements SubscribeService { public class MiniappPushMsgServiceImpl implements PushMsgService {
private final AccessTokenService accessTokenService; private final AccessTokenService accessTokenService;
private final WxProperties wxProperties; private final WxProperties wxProperties;
...@@ -165,8 +165,8 @@ public class SubscribeServiceImpl implements SubscribeService { ...@@ -165,8 +165,8 @@ public class SubscribeServiceImpl implements SubscribeService {
@Override @Override
public void testPaper(String openId, public void sendCommentMsg(String openId,
Integer orderId) { Integer orderId) {
log.info("推送提醒评价订阅消息,订单id:{}", orderId); log.info("推送提醒评价订阅消息,订单id:{}", orderId);
this.send(WxSubscribeMessageRequest this.send(WxSubscribeMessageRequest
......
...@@ -2,13 +2,13 @@ package com.gogirl.interfaces.product.serve; ...@@ -2,13 +2,13 @@ package com.gogirl.interfaces.product.serve;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.beust.jcommander.internal.Lists;
import com.gogirl.application.product.serve.BaseServeService; import com.gogirl.application.product.serve.BaseServeService;
import com.gogirl.domain.product.serve.BaseServe; import com.gogirl.domain.product.serve.BaseServe;
import com.gogirl.infrastructure.common.base.JsonResult; import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.common.util.DateUtils; import com.gogirl.infrastructure.common.util.DateUtils;
import com.gogirl.infrastructure.common.util.StringUtils; import com.gogirl.infrastructure.common.util.StringUtils;
import com.gogirl.infrastructure.mapper.product.serve.BaseServeMapper; import com.gogirl.infrastructure.mapper.product.serve.BaseServeMapper;
import com.google.common.collect.Lists;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
......
...@@ -9,7 +9,7 @@ import com.gogirl.domain.xcx.GogirlToken; ...@@ -9,7 +9,7 @@ import com.gogirl.domain.xcx.GogirlToken;
import com.gogirl.infrastructure.common.annotation.GogirlShop; import com.gogirl.infrastructure.common.annotation.GogirlShop;
import com.gogirl.infrastructure.common.base.JsonResult; import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.config.property.GogirlProperties; import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.util.ImageUtils; import com.gogirl.infrastructure.service.file.FileService;
import com.gogirl.infrastructure.util.SessionUtils; import com.gogirl.infrastructure.util.SessionUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -33,6 +33,8 @@ public class StoreTechnicianController { ...@@ -33,6 +33,8 @@ public class StoreTechnicianController {
StoreTechnicianService storeTechnicianService; StoreTechnicianService storeTechnicianService;
@Resource @Resource
GogirlProperties gogirlProperties; GogirlProperties gogirlProperties;
@Resource
FileService fileService;
@ApiOperation("/查询美甲师信息") @ApiOperation("/查询美甲师信息")
@GetMapping("/customer/technician/getById") @GetMapping("/customer/technician/getById")
...@@ -88,7 +90,7 @@ public class StoreTechnicianController { ...@@ -88,7 +90,7 @@ public class StoreTechnicianController {
@ApiOperation(value = "图片上传") @ApiOperation(value = "图片上传")
@RequestMapping("/technician/xcx/upload") @RequestMapping("/technician/xcx/upload")
public JsonResult<String> techUpload(MultipartFile file) throws Exception { public JsonResult<String> techUpload(MultipartFile file) throws Exception {
String imgUrl = ImageUtils.saveImage(gogirlProperties.getPicturePath(), file); String imgUrl = fileService.saveImage(file);
return JsonResult.success(imgUrl); return JsonResult.success(imgUrl);
} }
} }
...@@ -5,8 +5,8 @@ import com.gogirl.domain.user.customer.Customer; ...@@ -5,8 +5,8 @@ import com.gogirl.domain.user.customer.Customer;
import com.gogirl.dto.customer.CustomerOrderDetail; import com.gogirl.dto.customer.CustomerOrderDetail;
import com.gogirl.infrastructure.common.base.JsonResult; import com.gogirl.infrastructure.common.base.JsonResult;
import com.gogirl.infrastructure.config.property.GogirlProperties; import com.gogirl.infrastructure.config.property.GogirlProperties;
import com.gogirl.infrastructure.service.file.FileService;
import com.gogirl.infrastructure.util.Base64Utils; import com.gogirl.infrastructure.util.Base64Utils;
import com.gogirl.infrastructure.util.ImageUtils;
import com.gogirl.shared.user.query.qry.CustomerQuery; import com.gogirl.shared.user.query.qry.CustomerQuery;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -27,6 +27,8 @@ public class CustomerController { ...@@ -27,6 +27,8 @@ public class CustomerController {
private CustomerService customerService; private CustomerService customerService;
@Resource @Resource
private GogirlProperties gogirlProperties; private GogirlProperties gogirlProperties;
@Resource
FileService fileService;
@ApiOperation("用户授权接街道地址信息") @ApiOperation("用户授权接街道地址信息")
@GetMapping("/customer/xcx/bindAddressInfo") @GetMapping("/customer/xcx/bindAddressInfo")
...@@ -86,9 +88,9 @@ public class CustomerController { ...@@ -86,9 +88,9 @@ public class CustomerController {
@ApiOperation(value = "图片上传") @ApiOperation(value = "图片上传")
@PostMapping("/customer/xcx/upload") @PostMapping("/customer/xcx/upload")
public JsonResult<String> upload(MultipartFile file) throws Exception { public JsonResult<String> upload(MultipartFile multipartFile) throws Exception {
log.info("图片上传"); log.info("图片上传");
String imgUrl = ImageUtils.saveImage(gogirlProperties.getPicturePath(), file); String imgUrl = fileService.saveImage(multipartFile);
return JsonResult.success(imgUrl); return JsonResult.success(imgUrl);
} }
...@@ -97,7 +99,7 @@ public class CustomerController { ...@@ -97,7 +99,7 @@ public class CustomerController {
public JsonResult<String> base64Upload(@RequestBody String base64) throws Exception { public JsonResult<String> base64Upload(@RequestBody String base64) throws Exception {
log.info("图片上传"); log.info("图片上传");
MultipartFile multipartFile = Base64Utils.base64ToMultipart(base64); MultipartFile multipartFile = Base64Utils.base64ToMultipart(base64);
String imgUrl = ImageUtils.saveImage(gogirlProperties.getPicturePath(), multipartFile); String imgUrl = fileService.saveImage(multipartFile);
return JsonResult.success(imgUrl); return JsonResult.success(imgUrl);
} }
......
...@@ -40,7 +40,6 @@ spring: ...@@ -40,7 +40,6 @@ spring:
username: root username: root
password: "#7kfnymAM$Y9-Ntf" password: "#7kfnymAM$Y9-Ntf"
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
#redis配置 #redis配置
redis: redis:
......
...@@ -40,7 +40,6 @@ spring: ...@@ -40,7 +40,6 @@ spring:
username: root username: root
password: "#7kfnymAM$Y9-Ntf" password: "#7kfnymAM$Y9-Ntf"
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
#redis配置 #redis配置
redis: redis:
......
...@@ -40,7 +40,6 @@ spring: ...@@ -40,7 +40,6 @@ spring:
username: root username: root
password: "#7kfnymAM$Y9-Ntf" password: "#7kfnymAM$Y9-Ntf"
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
#redis配置 #redis配置
redis: redis:
......
...@@ -40,7 +40,6 @@ spring: ...@@ -40,7 +40,6 @@ spring:
username: root username: root
password: "#7kfnymAM$Y9-Ntf" password: "#7kfnymAM$Y9-Ntf"
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
#redis配置 #redis配置
redis: redis:
......
...@@ -19,6 +19,30 @@ ...@@ -19,6 +19,30 @@
<contextName>${contextName}</contextName> <contextName>${contextName}</contextName>
   
<property name="smtpHost" value="smtp.exmail.qq.com"/>
<property name="username" value="name@new4g.cn"/>
<property name="email_to" value="name@new4g.cn"/>
<property name="password" value="ykglyxhfwurjbjbi"/>
<property name="SSL" value="fasle"/>
<property name="email_subject" value="服务器日志报错"/>
<!--邮件-->    
<appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender"> 
        <smtpHost>${smtpHost}</smtpHost>  
        <Username>${username}</Username>  
        <Password>${password}</Password>  
        <SSL>${SSL}</SSL>  
        <to>${email_to}</to>  
        <from>${username}</from>  
        <subject>${email_subject}</subject>  
<asynchronousSending>true</asynchronousSending>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%date %X{ip}  %-5level %logger{35} - %message%n</pattern>
</layout>
   
</appender>
<!-- info日志 appender --> <!-- info日志 appender -->
<appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--日志回滚策略--> <!--日志回滚策略-->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment