diff --git a/pom.xml b/pom.xml
index 8d068b0..c2498f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,12 +3,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
- com.eleadmin
- ele-admin-api
- 1.5.0
+ com.gxwebsoft
+ com-gxwebsoft-server
+ 1.5.2
- ele-admin-api
- EleAdminApi project for Spring Boot
+ com-gxwebsoft-api
+ WebSoftApi project for Spring Boot
org.springframework.boot
@@ -86,6 +86,13 @@
3.4.3.3
+
+
+ com.github.yulichang
+ mybatis-plus-join-boot-starter
+ 1.4.5
+
+
com.baomidou
@@ -97,22 +104,22 @@
cn.hutool
hutool-core
- 5.7.11
+ 5.8.11
cn.hutool
hutool-extra
- 5.7.11
+ 5.8.11
cn.hutool
hutool-http
- 5.7.11
+ 5.8.11
cn.hutool
hutool-crypto
- 5.7.11
+ 5.8.11
@@ -181,13 +188,89 @@
1.6.2
-
+
- org.apache.httpcomponents
- httpclient
- 4.5.2
+ org.springframework.boot
+ spring-boot-starter-data-redis
+
+
+ com.aliyun
+ aliyun-java-sdk-core
+ 4.4.3
+
+
+
+ com.alipay.sdk
+ alipay-sdk-java
+ 4.35.0.ALL
+
+
+
+ org.bouncycastle
+ bcprov-jdk15on
+ 1.70
+
+
+
+ commons-logging
+ commons-logging
+ 1.2
+
+
+
+ com.alibaba
+ fastjson
+ 2.0.20
+
+
+
+
+ com.google.zxing
+ core
+ 3.3.3
+
+
+
+ com.google.code.gson
+ gson
+ 2.8.0
+
+
+
+ com.vaadin.external.google
+ android-json
+ 0.0.20131108.vaadin1
+ compile
+
+
+
+
+ com.corundumstudio.socketio
+ netty-socketio
+ 2.0.3
+
+
+
+
+ com.github.wechatpay-apiv3
+ wechatpay-java
+ 0.2.9
+
+
+
+ com.github.binarywang
+ weixin-java-miniapp
+ 4.5.0
+
+
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ 3.17.0
+
@@ -210,6 +293,7 @@
org.springframework.boot
spring-boot-maven-plugin
+ 2.5.4
diff --git a/src/main/java/com/gxwebsoft/WebSoftApplication.java b/src/main/java/com/gxwebsoft/WebSoftApplication.java
new file mode 100644
index 0000000..80c9a42
--- /dev/null
+++ b/src/main/java/com/gxwebsoft/WebSoftApplication.java
@@ -0,0 +1,28 @@
+package com.gxwebsoft;
+
+import com.gxwebsoft.common.core.config.ConfigProperties;
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+/**
+ * 启动类
+ * Created by WebSoft on 2018-02-22 11:29:03
+ */
+@EnableAsync
+@EnableTransactionManagement
+@MapperScan("com.gxwebsoft.**.mapper")
+@EnableConfigurationProperties(ConfigProperties.class)
+@SpringBootApplication
+@EnableScheduling
+public class WebSoftApplication {
+
+ public static void main(String[] args) {
+ SpringApplication.run(WebSoftApplication.class, args);
+ }
+
+}
diff --git a/src/main/java/com/gxwebsoft/apps/constants/EquipmentConstants.java b/src/main/java/com/gxwebsoft/apps/constants/EquipmentConstants.java
new file mode 100644
index 0000000..82a407c
--- /dev/null
+++ b/src/main/java/com/gxwebsoft/apps/constants/EquipmentConstants.java
@@ -0,0 +1,10 @@
+package com.gxwebsoft.apps.constants;
+
+public class EquipmentConstants {
+ // 事件类型
+ public static final String EVENT_TYPE_BIND = "电池绑定";
+ public static final String EVENT_TYPE_CHANGE = "电池更换";
+ public static final String EVENT_TYPE_UNBIND = "电池解绑";
+
+
+}
diff --git a/src/main/java/com/gxwebsoft/apps/constants/HualalaConstants.java b/src/main/java/com/gxwebsoft/apps/constants/HualalaConstants.java
new file mode 100644
index 0000000..c00e1da
--- /dev/null
+++ b/src/main/java/com/gxwebsoft/apps/constants/HualalaConstants.java
@@ -0,0 +1,18 @@
+package com.gxwebsoft.apps.constants;
+
+public class HualalaConstants {
+ // 集团ID
+ public static final String GROUP_ID = "1528";
+ // 服务器接口
+ public static final String API_URL = "https://www-openapi.hualala.com";
+ // appKey
+ public static final String APP_KEY = "2487";
+ // appSecret
+ public static final String APP_SECRET = "Hgr520dQpEiFe0FV";
+ // version
+ public static final Integer VERSION = 3;
+ // 店铺ID
+ public static final Long shopId = 0L;
+
+
+}
diff --git a/src/main/java/com/gxwebsoft/apps/constants/SfExpressConstants.java b/src/main/java/com/gxwebsoft/apps/constants/SfExpressConstants.java
new file mode 100644
index 0000000..c68ddfe
--- /dev/null
+++ b/src/main/java/com/gxwebsoft/apps/constants/SfExpressConstants.java
@@ -0,0 +1,13 @@
+package com.gxwebsoft.apps.constants;
+
+public class SfExpressConstants {
+ // 开发者id
+ public static final Long DEV_ID = 1651421896L;
+ // 开发者密钥
+ public static final String DEV_KEY = "2f10570c5057570fe0e488a425a6d813";
+ // 正式环境
+ public static final String SERVER_HOST = "https://openic.sf-express.com";
+ // 店铺ID
+ public static final String SHOP_ID = "3243279847393";
+
+}
diff --git a/src/main/java/com/gxwebsoft/apps/controller/BcAgentController.java b/src/main/java/com/gxwebsoft/apps/controller/BcAgentController.java
new file mode 100644
index 0000000..84c1ee9
--- /dev/null
+++ b/src/main/java/com/gxwebsoft/apps/controller/BcAgentController.java
@@ -0,0 +1,127 @@
+package com.gxwebsoft.apps.controller;
+
+import com.gxwebsoft.common.core.web.BaseController;
+import com.gxwebsoft.apps.service.BcAgentService;
+import com.gxwebsoft.apps.entity.BcAgent;
+import com.gxwebsoft.apps.param.BcAgentParam;
+import com.gxwebsoft.common.core.web.ApiResult;
+import com.gxwebsoft.common.core.web.PageResult;
+import com.gxwebsoft.common.core.web.PageParam;
+import com.gxwebsoft.common.core.web.BatchParam;
+import com.gxwebsoft.common.core.annotation.OperationLog;
+import com.gxwebsoft.common.system.entity.User;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 代报餐管理控制器
+ *
+ * @author 科技小王子
+ * @since 2023-04-24 19:25:59
+ */
+@Api(tags = "代报餐管理管理")
+@RestController
+@RequestMapping("/api/apps/bc-agent")
+public class BcAgentController extends BaseController {
+ @Resource
+ private BcAgentService bcAgentService;
+
+ @PreAuthorize("hasAuthority('apps:bcAgent:list')")
+ @OperationLog
+ @ApiOperation("分页查询代报餐管理")
+ @GetMapping("/page")
+ public ApiResult> page(BcAgentParam param) {
+ // 使用关联查询
+ return success(bcAgentService.pageRel(param));
+ }
+
+ @PreAuthorize("hasAuthority('apps:bcAgent:list')")
+ @OperationLog
+ @ApiOperation("查询全部代报餐管理")
+ @GetMapping()
+ public ApiResult> list(BcAgentParam param) {
+ // 使用关联查询
+ return success(bcAgentService.listRel(param));
+ }
+
+ @PreAuthorize("hasAuthority('apps:bcAgent:list')")
+ @OperationLog
+ @ApiOperation("根据id查询代报餐管理")
+ @GetMapping("/{id}")
+ public ApiResult get(@PathVariable("id") Integer id) {
+ // 使用关联查询
+ return success(bcAgentService.getByIdRel(id));
+ }
+
+ @PreAuthorize("hasAuthority('apps:bcAgent:save')")
+ @OperationLog
+ @ApiOperation("添加代报餐管理")
+ @PostMapping()
+ public ApiResult> save(@RequestBody BcAgent bcAgent) {
+ if (bcAgentService.save(bcAgent)) {
+ return success("添加成功");
+ }
+ return fail("添加失败");
+ }
+
+ @PreAuthorize("hasAuthority('apps:bcAgent:update')")
+ @OperationLog
+ @ApiOperation("修改代报餐管理")
+ @PutMapping()
+ public ApiResult> update(@RequestBody BcAgent bcAgent) {
+ if (bcAgentService.updateById(bcAgent)) {
+ return success("修改成功");
+ }
+ return fail("修改失败");
+ }
+
+ @PreAuthorize("hasAuthority('apps:bcAgent:remove')")
+ @OperationLog
+ @ApiOperation("删除代报餐管理")
+ @DeleteMapping("/{id}")
+ public ApiResult> remove(@PathVariable("id") Integer id) {
+ if (bcAgentService.removeById(id)) {
+ return success("删除成功");
+ }
+ return fail("删除失败");
+ }
+
+ @PreAuthorize("hasAuthority('apps:bcAgent:save')")
+ @OperationLog
+ @ApiOperation("批量添加代报餐管理")
+ @PostMapping("/batch")
+ public ApiResult> saveBatch(@RequestBody List list) {
+ if (bcAgentService.saveBatch(list)) {
+ return success("添加成功");
+ }
+ return fail("添加失败");
+ }
+
+ @PreAuthorize("hasAuthority('apps:bcAgent:update')")
+ @OperationLog
+ @ApiOperation("批量修改代报餐管理")
+ @PutMapping("/batch")
+ public ApiResult> removeBatch(@RequestBody BatchParam batchParam) {
+ if (batchParam.update(bcAgentService, "agent_id")) {
+ return success("修改成功");
+ }
+ return fail("修改失败");
+ }
+
+ @PreAuthorize("hasAuthority('apps:bcAgent:remove')")
+ @OperationLog
+ @ApiOperation("批量删除代报餐管理")
+ @DeleteMapping("/batch")
+ public ApiResult> removeBatch(@RequestBody List ids) {
+ if (bcAgentService.removeByIds(ids)) {
+ return success("删除成功");
+ }
+ return fail("删除失败");
+ }
+
+}
diff --git a/src/main/java/com/gxwebsoft/apps/controller/BcCartController.java b/src/main/java/com/gxwebsoft/apps/controller/BcCartController.java
new file mode 100644
index 0000000..bd4e29a
--- /dev/null
+++ b/src/main/java/com/gxwebsoft/apps/controller/BcCartController.java
@@ -0,0 +1,233 @@
+package com.gxwebsoft.apps.controller;
+
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.IdUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.gxwebsoft.apps.entity.BcCart;
+import com.gxwebsoft.apps.result.CartResult;
+import com.gxwebsoft.common.core.exception.BusinessException;
+import com.gxwebsoft.common.core.utils.JSONUtil;
+import com.gxwebsoft.common.core.web.ApiResult;
+import com.gxwebsoft.common.core.web.BaseController;
+import com.gxwebsoft.shop.entity.Goods;
+import com.gxwebsoft.shop.entity.Order;
+import com.gxwebsoft.shop.entity.OrderGoods;
+import com.gxwebsoft.shop.param.CartParam;
+import com.gxwebsoft.shop.service.GoodsService;
+import com.gxwebsoft.shop.service.OrderGoodsService;
+import com.gxwebsoft.shop.service.OrderService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+import static com.gxwebsoft.common.core.constants.OrderConstants.PAY_STATUS_SUCCESS;
+
+/**
+ * 批量报餐
+ *
+ * @author 科技小王子
+ * @since 2022-11-25 19:04:43
+ */
+@Api(tags = "购物车记录表管理")
+@RestController
+@RequestMapping("/api/apps/bc-cart")
+public class BcCartController extends BaseController {
+ @Resource
+ private GoodsService goodsService;
+ @Resource
+ private StringRedisTemplate stringRedisTemplate;
+ @Resource
+ private OrderService orderService;
+ @Resource
+ private OrderGoodsService orderGoodsService;
+
+ @ApiOperation("添加购物车")
+ @PostMapping("/addCart")
+ public ApiResult> addCart(@RequestBody BcCart vo) {
+ // 1. key = cache10048:cart651:2023-05-04
+ String key = "cache" + getTenantId() + ":cart" + getLoginUserId() + ":" + vo.getDeliveryTime();
+ // 2. 准备数据
+ final Goods goods = goodsService.getById(vo.getGoodsId());
+ vo.setImage(goods.getImage());
+ vo.setGoodsName(goods.getGoodsName());
+ vo.setComments(goods.getComments());
+ vo.setCategoryId(goods.getCategoryId());
+ vo.setGear(goods.getGear());
+ vo.setUserId(getLoginUserId());
+ // 2. 保存到购物车
+ stringRedisTemplate.opsForHash().put(key, vo.getGoodsId().toString(), JSONObject.toJSONString(vo));
+ //设置过期时间600秒
+ System.out.println("设置过期时间600秒 = " + key);
+ stringRedisTemplate.opsForHash().getOperations().expire(key,60*60*3, TimeUnit.SECONDS);
+ // 3. 查询购物车并返回
+ final List list = getCart(key);
+ final ArrayList cartAll = getCartAll();
+ return success("添加成功", cartAll);
+ }
+
+ @ApiOperation("查看购物车")
+ @PostMapping("/showCart")
+ public ApiResult> showCart() {
+// System.out.println("vo = " + vo);
+
+ // 按预定日期查询
+// if (vo.getDeliveryTime() != null) {
+// // key = cache10048:cart651:2023-05-04
+// String key = "cache" + getTenantId() + ":cart" + getLoginUserId() + ":" + vo.getDeliveryTime();
+// final List list = getCart(key);
+// return success("获取成功", list);
+// }
+ // 查询全部购物车数据
+ return success("获取成功", getCartAll());
+ }
+
+ @ApiOperation("从购物车创建订单")
+ @PostMapping("/createOrder")
+ @Transactional(rollbackFor = {Exception.class})
+ public ApiResult> createOrder(@RequestBody CartParam param) {
+ // 1.判断是否代报餐
+ Integer userId = 0;
+ if (param.getAgentUserId() != null) {
+ userId = param.getAgentUserId();
+ } else {
+ userId = getLoginUserId();
+ }
+ // 2.从缓存读取用户的购物车数据
+ final ArrayList cartAll = getCartAll();
+ if (cartAll.size() == 0) {
+ throw new BusinessException("订单不存在");
+ }
+ // 3.批量创建订单
+ Integer finalUserId = userId;
+ final ArrayList