Commit 88493bc8 authored by mengbali153's avatar mengbali153

小程序点单完成

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