Commit 88493bc8 authored by mengbali153's avatar mengbali153

小程序点单完成

parent 72a11d83
......@@ -38,6 +38,12 @@
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
......
......@@ -34,6 +34,8 @@ public class JdbcConfig {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://127.0.0.1:3306/oxo_main_data?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8");
// dataSource.setUrl("jdbc:mysql://81.68.92.175:3306/oxo_main_data?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8");
// dataSource.setUrl("jdbc:mysql://120.133.238.195:8022/oxo_main_data?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8");
dataSource.setUsername("root");
dataSource.setPassword("admin!@#123");
return dataSource;
......
......@@ -79,9 +79,11 @@ public class UserController {
* @param id ID
* @return 用户信息
*/
@GetMapping("/{id}")
// @GetMapping("/{id}")
@PostMapping("/{id}")
// @PreAuthorize("@pms.hasPermission('sys_user_get')")
public R user(@PathVariable Integer id) {
System.out.println("-------------通过id查询用户信息------------");
return R.ok(userService.getUserVoById(id));
}
......
......@@ -14,6 +14,7 @@ import cn.wise.sc.pay.laas.userbac.domain.entity.SysUser;
import cn.wise.sc.pay.pass.business.cashiers.config.CommonUrlProperties;
import cn.wise.sc.pay.pass.business.cashiers.model.CheckPasswordQuery;
import cn.wise.sc.pay.pass.business.cashiers.model.Employee;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.api.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -25,12 +26,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -66,6 +62,12 @@ public class UserControler extends UserController {
@Autowired
IMerchantService iMerchantService;
@PostMapping("/{id}")
// @PreAuthorize("@pms.hasPermission('sys_user_get')")
public R user(@PathVariable Integer id) {
return R.failed("无权访问");
}
@ApiOperation("收银端注册账号")
@PostMapping("/register")
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = String.class)})
......@@ -128,14 +130,14 @@ public class UserControler extends UserController {
BaseResponse<Merchant> merchantInfo = merchantService.getMerchantInfo(merchId);
if (merchantInfo.getCode() == 200) {
Merchant data = merchantInfo.getData();
System.out.println(JSON.toJSONString(data));
if (data.getManageStatus() == 1) {
// return R.failed("当前商户已关闭");
data.setManageStatus((byte)0);
BaseResponse updatemerchant = merchantService.updatemerchant(data);
return R.ok(updatemerchant);
}else{
return R.ok("当前商户已开启");
}
// else{
// return R.ok("当前商户已开启");
// }
}
if ("ADMIN".equals(user.getSysUser().getLevel())) {
List<LinkedHashMap> results = deviceUserService.getMerchDevices(merchId).getList();
......@@ -165,6 +167,7 @@ public class UserControler extends UserController {
return R.failed("当前设备未绑定商户,无法登录");
}
}
}
@ApiOperation("收银端退出")
......
......@@ -207,6 +207,7 @@ public class OrderController {
BaseResponse baseResponse = iOrderService.orderByNoV2(orderNo);
return baseResponse;
}
/**
* 统计 根据支付类型 统计金额
*/
......
......@@ -27,6 +27,6 @@ public interface IDeviceService {
public BaseResponse devicePage(@RequestParam("merchId") Long merchId, @RequestParam("typeId") Integer typeId,
@SpringQueryMap PageQuery pageQuery);
@GetMapping("/getDeviceBySeller")
public Device getDeviceBySeller(Long merchId);
// @PostMapping("/getDeviceBySeller")
// public String getDeviceBySeller(@RequestParam("merchId") Long merchId);
}
......@@ -27,4 +27,7 @@ public interface IDeviceUserService {
@GetMapping("getMerchDevices")
BaseResponse getMerchDevices(@RequestParam("merchId") Long merchId);
@GetMapping("/getDeviceBySeller")
public String getDeviceBySeller(@RequestParam("merchId") Long merchId);
}
......@@ -34,8 +34,8 @@ public class DeviceServiceImpl implements IDeviceService {
return null;
}
@Override
public Device getDeviceBySeller(Long merchId) {
return null;
}
// @Override
// public String getDeviceBySeller(Long merchId) {
// return null;
// }
}
......@@ -30,6 +30,12 @@ public class DeviceUserImpl implements IDeviceUserService {
return null;
}
@Override
public String getDeviceBySeller(Long merchId) {
error();
return null;
}
/**
* 服务异常
*
......
......@@ -68,13 +68,6 @@ public class DeviceController {
return BaseResponse.ok(result);
}
public List<Device> getMerchDevicesV2(@PathVariable("merchId") Long merchId) {
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("merch_id", merchId);
List<Device> result = deviceService.list(wrapper);
return result;
}
@DeleteMapping("delete/{id}")
public BaseResponse deleteDevice(@PathVariable("id") Long id) {
if (id == null) {
......@@ -105,13 +98,24 @@ public class DeviceController {
}
@GetMapping("/getDeviceBySeller")
public Device getDeviceBySeller(Long merchId) {
public List<Device> getMerchDevicesV2(Long merchId) {
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("merch_id", merchId);
List<Device> result = deviceService.list(wrapper);
return result;
}
@PostMapping("/getDeviceBySeller")
public String getDeviceBySeller(Long merchId) {
System.out.println("/getDeviceBySeller="+merchId);
// QueryWrapper wrapper = new QueryWrapper();
// wrapper.eq("merch_id", merchId);
// Device one = deviceService.getOne(wrapper);
// Device device = deviceService.getOne(wrapper);
List<Device> merchDevicesV2 = getMerchDevicesV2(merchId);
Device device = merchDevicesV2.get(1);
return device;
Device device = merchDevicesV2.get(0);
String deviceCode = device.getDeviceCode();
System.out.println("/getDeviceBySeller.deviceCode=="+deviceCode);
return deviceCode;
}
}
......@@ -80,4 +80,15 @@ public class DeviceUserController {
}
}
@GetMapping("/getDeviceBySeller")
public String getDeviceBySeller(Long merchId) {
System.out.println("/getDeviceBySeller="+merchId);
QueryWrapper wrapper = new QueryWrapper();
wrapper.eq("merch_id", merchId);
List<Device> result = deviceService.list(wrapper);
Device device = result.get(0);
String deviceCode = device.getDeviceCode();
System.out.println("/getDeviceBySeller.deviceCode=="+deviceCode);
return deviceCode;
}
}
......@@ -15,7 +15,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
**/
@SpringBootApplication
@EnableDiscoveryClient
@EnableWiseSwagger2
//@EnableWiseSwagger2
@EnableTransactionManagement
@MapperScan(basePackageClasses = XpenseTrackerMapper.class)
public class OrderApplication {
......
......@@ -6,6 +6,7 @@ import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import cn.wise.sc.pay.api.merchant.service.IDeviceService;
import cn.wise.sc.pay.api.merchant.service.IDeviceUserService;
import cn.wise.sc.pay.api.merchant.service.IMerchantProfitService;
import cn.wise.sc.pay.api.merchant.service.IMerchantService;
import cn.wise.sc.pay.business.goods.service.ISpcDetailService;
......@@ -95,6 +96,7 @@ public class WXController {
// IDeviceService iDeviceService;
final
IDeviceService iDeviceService;
final IDeviceUserService iDeviceUserService;
@Value("${wechat.suqiancredit.appId}")
String WECHAT_APPID;
@Value("${wechat.suqiancredit.secret}")
......@@ -108,7 +110,8 @@ public class WXController {
IMerchantProfitService merchantProfitService,
Producer producer,
ISafeguardService iSafeguardService,
IDeviceService iDeviceService) {
IDeviceService iDeviceService,
IDeviceUserService iDeviceUserService) {
this.wxPayService = wxPayService;
this.iOrdersService = iOrdersService;
this.iSpcDetailService = iSpcDetailService;
......@@ -116,6 +119,7 @@ public class WXController {
this.producer = producer;
this.iSafeguardService = iSafeguardService;
this.iDeviceService = iDeviceService;
this.iDeviceUserService = iDeviceUserService;
}
/**
......@@ -913,12 +917,16 @@ public class WXController {
String msg = strs[strs.length - 2];
String sn = strs[strs.length - 2];
log.info(msg+"-------------------"+sn);
if (msg == "oxo-pay"){
String deviceNo = "T208D94L40388";
if (msg.equals("oxo-pay")){
Long sellerId = orders.getSellerId();
System.out.println("sellerId---------------------"+sellerId);
// String deviceCode = iDeviceService.getDeviceBySeller(sellerId);
String deviceCode = iDeviceUserService.getDeviceBySeller(sellerId);
log.info("--------------------------deviceCode:"+deviceCode+"------------------------------------");
TransactionMessage transactionMessage = new TransactionMessage();
transactionMessage.setMessage(deviceNo + "|" + orders.getOrderNo());
transactionMessage.setQueue(deviceNo);
transactionMessage.setRouteKey(deviceNo);
transactionMessage.setMessage(deviceCode + "|" + orders.getOrderNo());
transactionMessage.setQueue(deviceCode+"_mp");
transactionMessage.setRouteKey(deviceCode+"_mp");
transactionMessage.setStatus(999);
log.info(transactionMessage.toString());
try {
......@@ -954,34 +962,11 @@ public class WXController {
// }
}
}
//收银系统 打印小票
if ("APP".equals(orders.getPaas())) {
String[] strs = msgInfo.split("\\|");
if (strs.length >= 2) {
// String msg = strs[strs.length - 3];
String msg = strs[strs.length - 2];
String sn = strs[strs.length - 2];
TransactionMessage transactionMessage = new TransactionMessage();
transactionMessage.setMessage(msg + "|" + orders.getOrderNo());
transactionMessage.setQueue(sn);
transactionMessage.setRouteKey(sn);
transactionMessage.setStatus(999);
try {
log.info("打印小票 msg :{}", JSON.toJSONString(transactionMessage));
mqpost(transactionMessage);
} catch (IOException e) {
log.error("app端打印小票,mq消息推送失败!");
e.printStackTrace();
}
}
}
}
public static void main(String[] args) {
TransactionMessage transactionMessage = new TransactionMessage();
transactionMessage.setMessage("ashfdkjsgdhf" + "|" + "1341276633818075136");
transactionMessage.setMessage("T208D94L40388" + "|" + "1341276633818075136");
transactionMessage.setQueue("T208D94L40388");
transactionMessage.setRouteKey("T208D94L40388");
transactionMessage.setStatus(999);
......
......@@ -12,18 +12,14 @@ spring:
nacos:
discovery:
server-addr: ${nacos.ip}:8848
# namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
config:
server-addr: ${nacos.ip}:8848
file-extension: yaml
# namespace: 34ec6c41-14f8-4f0f-a565-6039e5c49b22
#共享文件设置
shared-dataids: common.yaml
refreshable-dataids: common.yaml
# 设置swagger用户名密码
swagger:
basic:
enable: false
username: admin
password: admin
#变量名字
nacos:
ip: 81.68.92.175 #nacosd地址
......
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