yshop1.9,新增城市接口,修复小程序登陆与支付问题,发布mpvue1.0小程序

This commit is contained in:
hupeng
2020-01-19 09:59:40 +08:00
parent 1d0fef87b2
commit 90b29e6b86
18 changed files with 113 additions and 31 deletions

View File

@ -7,7 +7,7 @@
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop</artifactId> <artifactId>yshop</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.8</version> <version>1.9</version>
<modules> <modules>
<module>yshop-common</module> <module>yshop-common</module>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>yshop</artifactId> <artifactId>yshop</artifactId>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<version>1.8</version> <version>1.9</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -21,12 +21,12 @@
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-tools</artifactId> <artifactId>yshop-tools</artifactId>
<version>1.8</version> <version>1.9</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-mp</artifactId> <artifactId>yshop-mp</artifactId>
<version>1.8</version> <version>1.9</version>
</dependency> </dependency>
<!--jwt--> <!--jwt-->

View File

@ -1425,8 +1425,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
//使用MQ延时消息 //使用MQ延时消息
//mqProducer.sendMsg("yshop-topic",storeOrder.getId().toString()); mqProducer.sendMsg("yshop-topic",storeOrder.getId().toString());
//log.info("投递延时订单id [{}]", storeOrder.getId()); log.info("投递延时订单id [{}]", storeOrder.getId());
return storeOrder; return storeOrder;
} }

View File

@ -330,6 +330,19 @@ public class StoreOrderController extends BaseController {
map.put("result",orderDTO); map.put("result",orderDTO);
map.put("status","WECHAT_H5_PAY"); map.put("status","WECHAT_H5_PAY");
return ApiResult.ok(map); return ApiResult.ok(map);
}else if(param.getFrom().equals("routine")){
map.put("status","WECHAT_PAY");
WxPayMpOrderResult wxPayMpOrderResult = storeOrderService
.wxAppPay(orderId);
jsConfig.put("appId",wxPayMpOrderResult.getAppId());
jsConfig.put("timeStamp",wxPayMpOrderResult.getTimeStamp());
jsConfig.put("nonceStr",wxPayMpOrderResult.getNonceStr());
jsConfig.put("package",wxPayMpOrderResult.getPackageValue());
jsConfig.put("signType",wxPayMpOrderResult.getSignType());
jsConfig.put("paySign",wxPayMpOrderResult.getPaySign());
orderDTO.setJsConfig(jsConfig);
map.put("result",orderDTO);
return ApiResult.ok(map,"订单创建成功");
}else{ }else{
map.put("status","WECHAT_PAY"); map.put("status","WECHAT_PAY");
WxPayMpOrderResult wxPayMpOrderResult = storeOrderService WxPayMpOrderResult wxPayMpOrderResult = storeOrderService

View File

@ -298,13 +298,13 @@ public class AuthController {
wxMaService.setWxMaConfig(wxMaConfig); wxMaService.setWxMaConfig(wxMaConfig);
WxMaJscode2SessionResult session = wxMaService.getUserService().getSessionInfo(code); WxMaJscode2SessionResult session = wxMaService.getUserService().getSessionInfo(code);
YxWechatUser wechatUser = wechatUserService.getUserInfo(session.getOpenid()); YxWechatUser wechatUser = wechatUserService.getUserAppInfo(session.getOpenid());
; ;
JwtUser jwtUser = null; JwtUser jwtUser = null;
if (ObjectUtil.isNotNull(wechatUser)) { if (ObjectUtil.isNotNull(wechatUser)) {
YxUserQueryVo yxUserQueryVo = userService.getYxUserById(wechatUser.getUid()); YxUserQueryVo yxUserQueryVo = userService.getYxUserById(wechatUser.getUid());
if (ObjectUtil.isNotNull(yxUserQueryVo)) { if (ObjectUtil.isNotNull(yxUserQueryVo)) {
jwtUser = (JwtUser) userDetailsService.loadUserByUsername(wechatUser.getOpenid()); jwtUser = (JwtUser) userDetailsService.loadUserByUsername(wechatUser.getRoutineOpenid());
} else { } else {
if (ObjectUtil.isNotNull(wechatUser)) { if (ObjectUtil.isNotNull(wechatUser)) {
wechatUserService.removeById(wechatUser.getUid()); wechatUserService.removeById(wechatUser.getUid());

View File

@ -1,10 +1,15 @@
package co.yixiang.modules.shop.web.controller; package co.yixiang.modules.shop.web.controller;
import cn.hutool.core.io.file.FileReader;
import cn.hutool.core.io.resource.ClassPathResource;
import co.yixiang.annotation.AnonymousAccess; import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.common.api.ApiResult; import co.yixiang.common.api.ApiResult;
import co.yixiang.modules.shop.service.YxStoreProductService; import co.yixiang.modules.shop.service.YxStoreProductService;
import co.yixiang.modules.shop.service.YxSystemConfigService; import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.shop.service.YxSystemGroupDataService; import co.yixiang.modules.shop.service.YxSystemGroupDataService;
import co.yixiang.utils.FileUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -13,6 +18,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
@ -90,6 +96,29 @@ public class IndexController {
return ApiResult.ok(null); return ApiResult.ok(null);
} }
@AnonymousAccess
@GetMapping("/citys")
@ApiOperation(value = "获取城市json",notes = "获取城市json")
public ApiResult<String> cityJson(){
String path = "city.json";
String name = "city.json";
try {
File file = FileUtil.inputStreamToFile(new ClassPathResource(path).getStream(), name);
FileReader fileReader = new FileReader(file,"UTF-8");
String string = fileReader.readString();
System.out.println(string);
JSONObject jsonObject = JSON.parseObject(string);
return ApiResult.ok(jsonObject);
} catch (Exception e) {
e.printStackTrace();
return ApiResult.fail("无数据");
}
}
} }

View File

@ -18,6 +18,8 @@ import java.io.Serializable;
*/ */
public interface YxWechatUserService extends BaseService<YxWechatUser> { public interface YxWechatUserService extends BaseService<YxWechatUser> {
YxWechatUser getUserAppInfo(String openid);
YxWechatUser getUserInfo(String openid); YxWechatUser getUserInfo(String openid);
/** /**

View File

@ -35,6 +35,13 @@ public class YxWechatUserServiceImpl extends BaseServiceImpl<YxWechatUserMapper,
@Autowired @Autowired
private YxWechatUserMapper yxWechatUserMapper; private YxWechatUserMapper yxWechatUserMapper;
@Override
public YxWechatUser getUserAppInfo(String openid) {
QueryWrapper<YxWechatUser> wrapper = new QueryWrapper<>();
wrapper.eq("routine_openid",openid);
return yxWechatUserMapper.selectOne(wrapper);
}
@Override @Override
public YxWechatUser getUserInfo(String openid) { public YxWechatUser getUserInfo(String openid) {
QueryWrapper<YxWechatUser> wrapper = new QueryWrapper<>(); QueryWrapper<YxWechatUser> wrapper = new QueryWrapper<>();

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>yshop</artifactId> <artifactId>yshop</artifactId>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<version>1.8</version> <version>1.9</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -114,7 +114,7 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
/** /**
* inputStream 转 File * inputStream 转 File
*/ */
static File inputStreamToFile(InputStream ins, String name) throws Exception{ public static File inputStreamToFile(InputStream ins, String name) throws Exception{
File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name); File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name);
if (file.exists()) { if (file.exists()) {
return file; return file;
@ -310,4 +310,31 @@ public class FileUtil extends cn.hutool.core.io.FileUtil {
return getMd5(getByte(file)); return getMd5(getByte(file));
} }
/**
* 读取json文件返回json串
* @param fileName
* @return
*/
public static String readJsonFile(String fileName) {
String jsonStr = "";
try {
File jsonFile = new File(fileName);
FileReader fileReader = new FileReader(jsonFile);
Reader reader = new InputStreamReader(new FileInputStream(jsonFile),"utf-8");
int ch = 0;
StringBuffer sb = new StringBuffer();
while ((ch = reader.read()) != -1) {
sb.append((char) ch);
}
fileReader.close();
reader.close();
jsonStr = sb.toString();
return jsonStr;
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>yshop</artifactId> <artifactId>yshop</artifactId>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<version>1.8</version> <version>1.9</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -20,7 +20,7 @@
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-common</artifactId> <artifactId>yshop-common</artifactId>
<version>1.8</version> <version>1.9</version>
</dependency> </dependency>
<!--模板引擎--> <!--模板引擎-->

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>yshop</artifactId> <artifactId>yshop</artifactId>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<version>1.8</version> <version>1.9</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -16,7 +16,7 @@
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-common</artifactId> <artifactId>yshop-common</artifactId>
<version>1.8</version> <version>1.9</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -13,7 +13,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>yshop-monitor</artifactId> <artifactId>yshop-monitor</artifactId>
<version>1.8</version> <version>1.9</version>
<name>客户端监控模块</name> <name>客户端监控模块</name>

View File

@ -5,21 +5,18 @@
<parent> <parent>
<artifactId>yshop</artifactId> <artifactId>yshop</artifactId>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<version>1.8</version> <version>1.9</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>yshop-mp</artifactId> <artifactId>yshop-mp</artifactId>
<name>微信模块</name> <name>微信模块</name>
<properties>
<weixin-java.version>3.6.0</weixin-java.version>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.github.binarywang</groupId> <groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId> <artifactId>weixin-java-mp</artifactId>
<version>${weixin-java.version}</version> <version>3.5.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.binarywang</groupId> <groupId>com.github.binarywang</groupId>
@ -34,7 +31,7 @@
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-common</artifactId> <artifactId>yshop-common</artifactId>
<version>1.8</version> <version>1.9</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>yshop</artifactId> <artifactId>yshop</artifactId>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<version>1.8</version> <version>1.9</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -20,12 +20,12 @@
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-logging</artifactId> <artifactId>yshop-logging</artifactId>
<version>1.8</version> <version>1.9</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-mp</artifactId> <artifactId>yshop-mp</artifactId>
<version>1.8</version> <version>1.9</version>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>yshop</artifactId> <artifactId>yshop</artifactId>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<version>1.8</version> <version>1.9</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -21,7 +21,7 @@
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-generator</artifactId> <artifactId>yshop-generator</artifactId>
<version>1.8</version> <version>1.9</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
@ -34,19 +34,25 @@
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-tools</artifactId> <artifactId>yshop-tools</artifactId>
<version>1.8</version> <version>1.9</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-shop</artifactId> <artifactId>yshop-shop</artifactId>
<version>1.8</version> <version>1.9</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-mp</artifactId> <artifactId>yshop-mp</artifactId>
<version>1.8</version> <version>1.9</version>
<exclusions>
<exclusion>
<groupId>co.yixiang</groupId>
<artifactId>yshop-common</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>yshop</artifactId> <artifactId>yshop</artifactId>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<version>1.8</version> <version>1.9</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -23,7 +23,7 @@
<dependency> <dependency>
<groupId>co.yixiang</groupId> <groupId>co.yixiang</groupId>
<artifactId>yshop-logging</artifactId> <artifactId>yshop-logging</artifactId>
<version>1.8</version> <version>1.9</version>
</dependency> </dependency>
<!--邮件依赖--> <!--邮件依赖-->