新增:生成订单核销小程序码
This commit is contained in:
@@ -55,7 +55,6 @@ public class RequestUtil {
|
|||||||
.execute().body();
|
.execute().body();
|
||||||
|
|
||||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||||
System.out.println("jsonObject = " + jsonObject);
|
|
||||||
final String data = jsonObject.getString("data");
|
final String data = jsonObject.getString("data");
|
||||||
return JSONObject.parseObject(data, User.class);
|
return JSONObject.parseObject(data, User.class);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ public class TenantController extends BaseController {
|
|||||||
@ApiOperation("添加租户")
|
@ApiOperation("添加租户")
|
||||||
@PostMapping()
|
@PostMapping()
|
||||||
public ApiResult<?> save(@RequestBody Tenant tenant) {
|
public ApiResult<?> save(@RequestBody Tenant tenant) {
|
||||||
System.out.println("tenant = " + tenant);
|
|
||||||
if (tenantService.save(tenant)) {
|
if (tenantService.save(tenant)) {
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,10 +16,7 @@ import com.gxwebsoft.common.core.security.JwtUtil;
|
|||||||
import com.gxwebsoft.common.core.utils.CommonUtil;
|
import com.gxwebsoft.common.core.utils.CommonUtil;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.common.system.entity.LoginRecord;
|
import com.gxwebsoft.common.system.entity.*;
|
||||||
import com.gxwebsoft.common.system.entity.Role;
|
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
|
||||||
import com.gxwebsoft.common.system.entity.UserRole;
|
|
||||||
import com.gxwebsoft.common.system.param.UserParam;
|
import com.gxwebsoft.common.system.param.UserParam;
|
||||||
import com.gxwebsoft.common.system.result.LoginResult;
|
import com.gxwebsoft.common.system.result.LoginResult;
|
||||||
import com.gxwebsoft.common.system.service.*;
|
import com.gxwebsoft.common.system.service.*;
|
||||||
@@ -229,7 +226,6 @@ public class WxLoginController extends BaseController {
|
|||||||
if (value != null) {
|
if (value != null) {
|
||||||
// 解析access_token
|
// 解析access_token
|
||||||
JSONObject response = JSON.parseObject(value);
|
JSONObject response = JSON.parseObject(value);
|
||||||
System.out.println("response = " + response);
|
|
||||||
// return response.getString("access_token");
|
// return response.getString("access_token");
|
||||||
}
|
}
|
||||||
// 微信获取凭证接口
|
// 微信获取凭证接口
|
||||||
@@ -307,6 +303,30 @@ public class WxLoginController extends BaseController {
|
|||||||
return fail("获取失败",null);
|
return fail("获取失败",null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("获取微信小程序码-订单核销码")
|
||||||
|
@GetMapping("/getOrderQRCode/{orderNo}")
|
||||||
|
public ApiResult<?> getOrderQRCode(@PathVariable("orderNo") String orderNo) {
|
||||||
|
String apiUrl = "https://api.weixin.qq.com/wxa/getwxacode?access_token=" + getAccessToken();
|
||||||
|
final HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("path","/package/admin/order-scan?orderNo=".concat(orderNo));
|
||||||
|
map.put("env_version","trial");
|
||||||
|
// 获取图片 Buffer
|
||||||
|
byte[] qrCode = HttpRequest.post(apiUrl)
|
||||||
|
.body(JSON.toJSONString(map))
|
||||||
|
.execute().bodyBytes();
|
||||||
|
|
||||||
|
// 保存的文件名称
|
||||||
|
final String fileName = CommonUtil.randomUUID8().concat(".png");
|
||||||
|
// 保存路径
|
||||||
|
String filePath = getUploadDir().concat("qrcode/") + fileName;
|
||||||
|
File file = FileUtil.writeBytes(qrCode, filePath);
|
||||||
|
if(file != null){
|
||||||
|
config.setFileServer("https://file.gxwebsoft.com");
|
||||||
|
return success(config.getFileServer().concat("/qrcode/").concat(fileName));
|
||||||
|
}
|
||||||
|
return fail("获取失败",null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传位置(服务器)
|
* 文件上传位置(服务器)
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user