Compare commits
No commits in common. "931bbd1a4b8df37105b12a348704add94e91f91e" and "fe5a19157ad154de5e95770bc137d58a1d8fbec0" have entirely different histories.
931bbd1a4b
...
fe5a19157a
|
@ -1,68 +0,0 @@
|
||||||
package com.agileboot.admin.controller.cabinet;
|
|
||||||
|
|
||||||
import com.agileboot.admin.customize.aop.accessLog.AccessLog;
|
|
||||||
import com.agileboot.common.core.base.BaseController;
|
|
||||||
import com.agileboot.common.core.dto.ResponseDTO;
|
|
||||||
import com.agileboot.common.core.page.PageDTO;
|
|
||||||
import com.agileboot.common.enums.common.BusinessTypeEnum;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.MqttServerApplicationService;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.command.AddMqttServerCommand;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.command.UpdateMqttServerCommand;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.db.MqttServerEntity;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.dto.MqttServerDTO;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.query.SearchMqttServerQuery;
|
|
||||||
import com.agileboot.domain.common.command.BulkOperationCommand;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/cabinet/mqttServer")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Validated
|
|
||||||
public class MqttServerController extends BaseController {
|
|
||||||
|
|
||||||
private final MqttServerApplicationService mqttServerApplicationService;
|
|
||||||
|
|
||||||
@Operation(summary = "MQTT服务列表")
|
|
||||||
@GetMapping
|
|
||||||
public ResponseDTO<PageDTO<MqttServerDTO>> list(SearchMqttServerQuery<MqttServerEntity> query) {
|
|
||||||
PageDTO<MqttServerDTO> page = mqttServerApplicationService.getMqttServerList(query);
|
|
||||||
return ResponseDTO.ok(page);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "新增MQTT服务")
|
|
||||||
@AccessLog(title = "MQTT服务管理", businessType = BusinessTypeEnum.ADD)
|
|
||||||
@PostMapping
|
|
||||||
public ResponseDTO<Void> add(@Validated @RequestBody AddMqttServerCommand command) {
|
|
||||||
mqttServerApplicationService.addMqttServer(command);
|
|
||||||
return ResponseDTO.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "修改MQTT服务")
|
|
||||||
@AccessLog(title = "MQTT服务管理", businessType = BusinessTypeEnum.MODIFY)
|
|
||||||
@PutMapping("/{serverId}")
|
|
||||||
public ResponseDTO<Void> edit(@PathVariable Long serverId, @Validated @RequestBody UpdateMqttServerCommand command) {
|
|
||||||
command.setMqttServerId(serverId);
|
|
||||||
mqttServerApplicationService.updateMqttServer(command);
|
|
||||||
return ResponseDTO.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "删除MQTT服务")
|
|
||||||
@AccessLog(title = "MQTT服务管理", businessType = BusinessTypeEnum.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public ResponseDTO<Void> remove(@PathVariable @NotNull List<Long> ids) {
|
|
||||||
mqttServerApplicationService.deleteMqttServer(new BulkOperationCommand<>(ids));
|
|
||||||
return ResponseDTO.ok();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,68 +0,0 @@
|
||||||
package com.agileboot.admin.controller.shop;
|
|
||||||
|
|
||||||
import com.agileboot.admin.customize.aop.accessLog.AccessLog;
|
|
||||||
import com.agileboot.common.core.base.BaseController;
|
|
||||||
import com.agileboot.common.core.dto.ResponseDTO;
|
|
||||||
import com.agileboot.common.core.page.PageDTO;
|
|
||||||
import com.agileboot.common.enums.common.BusinessTypeEnum;
|
|
||||||
import com.agileboot.domain.common.command.BulkOperationCommand;
|
|
||||||
import com.agileboot.domain.shop.shop.ShopApplicationService;
|
|
||||||
import com.agileboot.domain.shop.shop.command.AddShopCommand;
|
|
||||||
import com.agileboot.domain.shop.shop.command.UpdateShopCommand;
|
|
||||||
import com.agileboot.domain.shop.shop.db.ShopEntity;
|
|
||||||
import com.agileboot.domain.shop.shop.dto.ShopDTO;
|
|
||||||
import com.agileboot.domain.shop.shop.query.SearchShopQuery;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import java.util.List;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/shop/shops")
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Validated
|
|
||||||
public class ShopController extends BaseController {
|
|
||||||
|
|
||||||
private final ShopApplicationService shopApplicationService;
|
|
||||||
|
|
||||||
@Operation(summary = "商店列表")
|
|
||||||
@GetMapping
|
|
||||||
public ResponseDTO<PageDTO<ShopDTO>> list(SearchShopQuery<ShopEntity> query) {
|
|
||||||
PageDTO<ShopDTO> page = shopApplicationService.getShopList(query);
|
|
||||||
return ResponseDTO.ok(page);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "新增商店")
|
|
||||||
@AccessLog(title = "商店管理", businessType = BusinessTypeEnum.ADD)
|
|
||||||
@PostMapping
|
|
||||||
public ResponseDTO<Void> add(@Validated @RequestBody AddShopCommand command) {
|
|
||||||
shopApplicationService.addShop(command);
|
|
||||||
return ResponseDTO.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "修改商店")
|
|
||||||
@AccessLog(title = "商店管理", businessType = BusinessTypeEnum.MODIFY)
|
|
||||||
@PutMapping("/{id}")
|
|
||||||
public ResponseDTO<Void> edit(@PathVariable Long id, @Validated @RequestBody UpdateShopCommand command) {
|
|
||||||
command.setShopId(id);
|
|
||||||
shopApplicationService.updateShop(command);
|
|
||||||
return ResponseDTO.ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Operation(summary = "删除商店")
|
|
||||||
@AccessLog(title = "商店管理", businessType = BusinessTypeEnum.DELETE)
|
|
||||||
@DeleteMapping("/{ids}")
|
|
||||||
public ResponseDTO<Void> remove(@PathVariable @NotNull List<Long> ids) {
|
|
||||||
shopApplicationService.deleteShop(new BulkOperationCommand<>(ids));
|
|
||||||
return ResponseDTO.ok();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -12,8 +12,6 @@ import com.agileboot.domain.cabinet.operation.model.CabinetCellOperationModel;
|
||||||
import com.agileboot.domain.cabinet.operation.model.CabinetCellOperationModelFactory;
|
import com.agileboot.domain.cabinet.operation.model.CabinetCellOperationModelFactory;
|
||||||
import com.agileboot.domain.cabinet.smartCabinet.SmartCabinetApplicationService;
|
import com.agileboot.domain.cabinet.smartCabinet.SmartCabinetApplicationService;
|
||||||
import com.agileboot.domain.cabinet.smartCabinet.dto.CabinetDetailDTO;
|
import com.agileboot.domain.cabinet.smartCabinet.dto.CabinetDetailDTO;
|
||||||
import com.agileboot.domain.cabinet.smartCabinet.model.SmartCabinetModel;
|
|
||||||
import com.agileboot.domain.cabinet.smartCabinet.model.SmartCabinetModelFactory;
|
|
||||||
import com.agileboot.domain.mqtt.MqttService;
|
import com.agileboot.domain.mqtt.MqttService;
|
||||||
import com.agileboot.domain.shop.goods.model.GoodsModel;
|
import com.agileboot.domain.shop.goods.model.GoodsModel;
|
||||||
import com.agileboot.domain.shop.goods.model.GoodsModelFactory;
|
import com.agileboot.domain.shop.goods.model.GoodsModelFactory;
|
||||||
|
@ -35,15 +33,14 @@ public class CabinetCellController {
|
||||||
private final CabinetCellOperationModelFactory cabinetCellOperationModelFactory;
|
private final CabinetCellOperationModelFactory cabinetCellOperationModelFactory;
|
||||||
private final CabinetCellModelFactory cabinetCellModelFactory;
|
private final CabinetCellModelFactory cabinetCellModelFactory;
|
||||||
private final GoodsModelFactory goodsModelFactory;
|
private final GoodsModelFactory goodsModelFactory;
|
||||||
private final SmartCabinetModelFactory smartCabinetModelFactory;
|
|
||||||
|
|
||||||
@GetMapping("/detail")
|
@GetMapping("/detail")
|
||||||
public ResponseDTO<List<CabinetDetailDTO>> getCabinetDetail() {
|
public ResponseDTO<List<CabinetDetailDTO>> getCabinetDetail() {
|
||||||
return ResponseDTO.ok(smartCabinetApplicationService.getCabinetDetail());
|
return ResponseDTO.ok(smartCabinetApplicationService.getCabinetDetail());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/openCabinet/{cabinetId}/{pinNo}")
|
@PostMapping("/openCabinet/{lockControlNo}/{pinNo}")
|
||||||
public ResponseDTO<?> openCabinet(@PathVariable Long cabinetId, @PathVariable Integer pinNo,
|
public ResponseDTO<?> openCabinet(@PathVariable Integer lockControlNo, @PathVariable Integer pinNo,
|
||||||
@RequestBody AddCabinetCellOperationCommand operationCommand) {
|
@RequestBody AddCabinetCellOperationCommand operationCommand) {
|
||||||
if (null == operationCommand){
|
if (null == operationCommand){
|
||||||
operationCommand = new AddCabinetCellOperationCommand();
|
operationCommand = new AddCabinetCellOperationCommand();
|
||||||
|
@ -52,16 +49,13 @@ public class CabinetCellController {
|
||||||
operationCommand.setStatus(1);
|
operationCommand.setStatus(1);
|
||||||
|
|
||||||
CabinetCellOperationModel cellOperationModel = cabinetCellOperationModelFactory.create();
|
CabinetCellOperationModel cellOperationModel = cabinetCellOperationModelFactory.create();
|
||||||
|
|
||||||
SmartCabinetModel smartCabinetModel = smartCabinetModelFactory.loadById(cabinetId);
|
|
||||||
Integer lockControlNo = smartCabinetModel.getLockControlNo();
|
|
||||||
// 发送指令
|
// 发送指令
|
||||||
String mqttDate = "8A";
|
String mqttDate = "8A";
|
||||||
mqttDate += String.format("%02X", lockControlNo);
|
mqttDate += String.format("%02X", lockControlNo);
|
||||||
mqttDate += String.format("%02X", pinNo);
|
mqttDate += String.format("%02X", pinNo);
|
||||||
mqttDate += "11";
|
mqttDate += "11";
|
||||||
try {
|
try {
|
||||||
mqttService.publish(mqttDate, smartCabinetModel.getMqttServerId());
|
mqttService.publish(mqttDate);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("mqtt publish error", e);
|
log.error("mqtt publish error", e);
|
||||||
operationCommand.setStatus(2);
|
operationCommand.setStatus(2);
|
||||||
|
|
|
@ -20,9 +20,9 @@ public class MqttController {
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/opencell")
|
@GetMapping("/opencell")
|
||||||
public String opencell(@RequestParam String data, @RequestParam Long cabinetId) {
|
public String opencell(@RequestParam String data) {
|
||||||
try {
|
try {
|
||||||
mqttService.publish(data, cabinetId);
|
mqttService.publish(data);
|
||||||
return "success";
|
return "success";
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("getPermanentCode error", e);
|
log.error("getPermanentCode error", e);
|
||||||
|
|
|
@ -39,8 +39,7 @@ public class ShopController {
|
||||||
private final CategoryApplicationService categoryApplicationService;
|
private final CategoryApplicationService categoryApplicationService;
|
||||||
|
|
||||||
@GetMapping("/goods")
|
@GetMapping("/goods")
|
||||||
public ResponseDTO<ShopGoodsResponse> getShopGoodsInfo(@RequestParam(required = false) Long shopId) {
|
public ResponseDTO<ShopGoodsResponse> getShopGoodsInfo() {
|
||||||
log.info("getShopGoodsInfo shopId: {}", shopId);
|
|
||||||
/*// 获取商品列表
|
/*// 获取商品列表
|
||||||
List<ShopGoodsEntity> goodsList = goodsApplicationService.getGoodsAll();
|
List<ShopGoodsEntity> goodsList = goodsApplicationService.getGoodsAll();
|
||||||
goodsList.forEach(goods -> {
|
goodsList.forEach(goods -> {
|
||||||
|
@ -53,7 +52,7 @@ public class ShopController {
|
||||||
List<ShopCategoryDTO> categoryList = categoryApplicationService.getCategoryAll();*/
|
List<ShopCategoryDTO> categoryList = categoryApplicationService.getCategoryAll();*/
|
||||||
|
|
||||||
// 客户端显示商品列表按柜机格口
|
// 客户端显示商品列表按柜机格口
|
||||||
List<SearchGoodsWithCabinetDO> goodsWithCabinetList = goodsApplicationService.getGoodsWithCabinetList(shopId);
|
List<SearchGoodsWithCabinetDO> goodsWithCabinetList = goodsApplicationService.getGoodsWithCabinetList();
|
||||||
goodsWithCabinetList.forEach(goodsWithCabinet -> {
|
goodsWithCabinetList.forEach(goodsWithCabinet -> {
|
||||||
goodsWithCabinet.setCategoryId(goodsWithCabinet.getCabinetId());
|
goodsWithCabinet.setCategoryId(goodsWithCabinet.getCabinetId());
|
||||||
});
|
});
|
||||||
|
@ -76,10 +75,12 @@ public class ShopController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/wechatAuth")
|
@GetMapping("/wechatAuth")
|
||||||
public RedirectView wechatAuthRedirect(HttpServletRequest request) {
|
public RedirectView wechatAuthRedirect(HttpServletRequest request) {
|
||||||
String shopId = request.getParameter("shopId");
|
/*java.util.StringJoiner joiner = new java.util.StringJoiner("&");
|
||||||
request.getParameterMap().forEach((key, values) -> {
|
request.getParameterMap().forEach((key, values) -> {
|
||||||
|
joiner.add(key + "=" + String.join(",", values));
|
||||||
log.info("wechatAuth key: {} value: {}", key, values[0]);
|
log.info("wechatAuth key: {} value: {}", key, values[0]);
|
||||||
});
|
});
|
||||||
|
log.info("wechatAuth 参数:{}", joiner.toString());*/
|
||||||
|
|
||||||
// 从请求参数中提取包含token的参数名(参数名本身可能包含"token=")
|
// 从请求参数中提取包含token的参数名(参数名本身可能包含"token=")
|
||||||
String token = request.getParameterMap().keySet().stream()
|
String token = request.getParameterMap().keySet().stream()
|
||||||
|
@ -98,14 +99,10 @@ public class ShopController {
|
||||||
state = "state";
|
state = "state";
|
||||||
}
|
}
|
||||||
|
|
||||||
String redirect_uri = "http%3A%2F%2Fwxshop.ab98.cn%2Fshop";
|
|
||||||
if (StringUtils.isNotBlank(shopId)) {
|
|
||||||
redirect_uri += "%3FshopId%3D" + shopId;
|
|
||||||
}
|
|
||||||
// 构造微信网页授权URL
|
// 构造微信网页授权URL
|
||||||
String authUrl = "https://open.weixin.qq.com/connect/oauth2/authorize"
|
String authUrl = "https://open.weixin.qq.com/connect/oauth2/authorize"
|
||||||
+ "?appid=" + WeixinConstants.appid
|
+ "?appid=" + WeixinConstants.appid
|
||||||
+ "&redirect_uri=" + redirect_uri
|
+ "&redirect_uri=http%3A%2F%2Fwxshop.ab98.cn%2Fshop"
|
||||||
+ "&response_type=code"
|
+ "&response_type=code"
|
||||||
+ "&scope=snsapi_base"
|
+ "&scope=snsapi_base"
|
||||||
+ "&state=" + state
|
+ "&state=" + state
|
||||||
|
|
|
@ -1,58 +0,0 @@
|
||||||
package com.agileboot.domain.cabinet.mqtt;
|
|
||||||
|
|
||||||
import com.agileboot.common.core.page.PageDTO;
|
|
||||||
import com.agileboot.domain.common.command.BulkOperationCommand;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.command.AddMqttServerCommand;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.command.UpdateMqttServerCommand;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.db.MqttServerEntity;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.db.MqttServerService;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.dto.MqttServerDTO;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.model.MqttServerModel;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.model.MqttServerModelFactory;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.query.SearchMqttServerQuery;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class MqttServerApplicationService {
|
|
||||||
private final MqttServerService mqttServerService;
|
|
||||||
private final MqttServerModelFactory mqttServerModelFactory;
|
|
||||||
|
|
||||||
public PageDTO<MqttServerDTO> getMqttServerList(SearchMqttServerQuery<MqttServerEntity> query) {
|
|
||||||
Page<MqttServerEntity> page = mqttServerService.getServerList(query);
|
|
||||||
List<MqttServerDTO> dtoList = page.getRecords().stream()
|
|
||||||
.map(MqttServerDTO::new)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
return new PageDTO<>(dtoList, page.getTotal());
|
|
||||||
}
|
|
||||||
|
|
||||||
public MqttServerEntity getByServerId(Long serverId) {
|
|
||||||
return mqttServerService.getById(serverId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addMqttServer(AddMqttServerCommand command) {
|
|
||||||
MqttServerModel model = mqttServerModelFactory.create();
|
|
||||||
model.loadAddCommand(command);
|
|
||||||
model.insert();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateMqttServer(UpdateMqttServerCommand command) {
|
|
||||||
MqttServerModel model = mqttServerModelFactory.loadById(command.getMqttServerId());
|
|
||||||
model.loadUpdateCommand(command);
|
|
||||||
model.updateById();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteMqttServer(BulkOperationCommand<Long> command) {
|
|
||||||
for (Long id : command.getIds()) {
|
|
||||||
MqttServerModel model = mqttServerModelFactory.loadById(id);
|
|
||||||
model.deleteById();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.agileboot.domain.cabinet.mqtt.command;
|
|
||||||
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.db.MqttServerEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class AddMqttServerCommand extends MqttServerEntity {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.agileboot.domain.cabinet.mqtt.command;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import javax.validation.constraints.PositiveOrZero;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class UpdateMqttServerCommand extends AddMqttServerCommand {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@PositiveOrZero
|
|
||||||
private Long mqttServerId;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
package com.agileboot.domain.cabinet.mqtt.db;
|
|
||||||
|
|
||||||
import com.agileboot.common.core.base.BaseEntity;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* MQTT服务配置表
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author valarchie
|
|
||||||
* @since 2025-05-08
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@TableName("mqtt_server")
|
|
||||||
@ApiModel(value = "MqttServerEntity对象", description = "MQTT服务配置表")
|
|
||||||
public class MqttServerEntity extends BaseEntity<MqttServerEntity> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@ApiModelProperty("主键ID")
|
|
||||||
@TableId(value = "mqtt_server_id", type = IdType.AUTO)
|
|
||||||
private Long mqttServerId;
|
|
||||||
|
|
||||||
@ApiModelProperty("MQTT服务器地址")
|
|
||||||
@TableField("server_url")
|
|
||||||
private String serverUrl;
|
|
||||||
|
|
||||||
@ApiModelProperty("连接账号")
|
|
||||||
@TableField("username")
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
@ApiModelProperty("连接密码")
|
|
||||||
@TableField("`password`")
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
@ApiModelProperty("订阅主题过滤器")
|
|
||||||
@TableField("topic_filter")
|
|
||||||
private String topicFilter;
|
|
||||||
|
|
||||||
@ApiModelProperty("发布主题")
|
|
||||||
@TableField("publish_topic")
|
|
||||||
private String publishTopic;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Serializable pkVal() {
|
|
||||||
return this.mqttServerId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,35 +0,0 @@
|
||||||
package com.agileboot.domain.cabinet.mqtt.db;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import java.util.List;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* MQTT服务配置表 Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author valarchie
|
|
||||||
* @since 2025-05-08
|
|
||||||
*/
|
|
||||||
public interface MqttServerMapper extends BaseMapper<MqttServerEntity> {
|
|
||||||
|
|
||||||
@Select("SELECT mqtt_server_id, server_url, username, password, topic_filter, publish_topic " +
|
|
||||||
"FROM mqtt_server " +
|
|
||||||
"${ew.customSqlSegment}")
|
|
||||||
Page<MqttServerEntity> getMqttServerList(
|
|
||||||
Page<MqttServerEntity> page,
|
|
||||||
@Param(Constants.WRAPPER) Wrapper<MqttServerEntity> queryWrapper
|
|
||||||
);
|
|
||||||
|
|
||||||
@Select("SELECT * FROM mqtt_server WHERE server_url = #{serverUrl} LIMIT 1")
|
|
||||||
MqttServerEntity selectByServerUrl(String serverUrl);
|
|
||||||
|
|
||||||
@Select("SELECT * FROM mqtt_server WHERE mqtt_server_id = #{id} LIMIT 1")
|
|
||||||
MqttServerEntity selectById(Long id);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
package com.agileboot.domain.cabinet.mqtt.db;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* MQTT服务配置表 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author valarchie
|
|
||||||
* @since 2025-05-08
|
|
||||||
*/
|
|
||||||
import com.agileboot.common.core.page.AbstractPageQuery;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface MqttServerService extends IService<MqttServerEntity> {
|
|
||||||
Page<MqttServerEntity> getServerList(AbstractPageQuery<MqttServerEntity> query);
|
|
||||||
|
|
||||||
List<MqttServerEntity> selectAll();
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
package com.agileboot.domain.cabinet.mqtt.db;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* MQTT服务配置表 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author valarchie
|
|
||||||
* @since 2025-05-08
|
|
||||||
*/
|
|
||||||
import com.agileboot.common.core.page.AbstractPageQuery;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class MqttServerServiceImpl extends ServiceImpl<MqttServerMapper, MqttServerEntity> implements MqttServerService {
|
|
||||||
@Override
|
|
||||||
public Page<MqttServerEntity> getServerList(AbstractPageQuery<MqttServerEntity> query) {
|
|
||||||
return this.page(query.toPage(), query.toQueryWrapper());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MqttServerEntity> selectAll() {
|
|
||||||
LambdaQueryWrapper<MqttServerEntity> wrapper = new LambdaQueryWrapper<>();
|
|
||||||
wrapper.eq(MqttServerEntity::getDeleted, false)
|
|
||||||
.orderByDesc(MqttServerEntity::getCreateTime);
|
|
||||||
return this.list(wrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
package com.agileboot.domain.cabinet.mqtt.dto;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.agileboot.common.annotation.ExcelColumn;
|
|
||||||
import com.agileboot.common.annotation.ExcelSheet;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.db.MqttServerEntity;
|
|
||||||
import com.agileboot.domain.common.cache.CacheCenter;
|
|
||||||
import com.agileboot.domain.system.user.db.SysUserEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@ExcelSheet(name = "MQTT服务配置列表")
|
|
||||||
@Data
|
|
||||||
public class MqttServerDTO {
|
|
||||||
|
|
||||||
public MqttServerDTO(MqttServerEntity entity) {
|
|
||||||
if (entity != null) {
|
|
||||||
BeanUtil.copyProperties(entity, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExcelColumn(name = "服务ID")
|
|
||||||
private Long mqttServerId;
|
|
||||||
|
|
||||||
@ExcelColumn(name = "服务器地址")
|
|
||||||
private String serverUrl;
|
|
||||||
|
|
||||||
@ExcelColumn(name = "用户名")
|
|
||||||
private String username;
|
|
||||||
|
|
||||||
@ExcelColumn(name = "密码")
|
|
||||||
private String password;
|
|
||||||
|
|
||||||
@ExcelColumn(name = "订阅主题")
|
|
||||||
private String topicFilter;
|
|
||||||
|
|
||||||
@ExcelColumn(name = "发布主题")
|
|
||||||
private String publishTopic;
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package com.agileboot.domain.cabinet.mqtt.model;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.db.MqttServerEntity;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.command.AddMqttServerCommand;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.command.UpdateMqttServerCommand;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.db.MqttServerService;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class MqttServerModel extends MqttServerEntity {
|
|
||||||
|
|
||||||
private MqttServerService mqttServerService;
|
|
||||||
|
|
||||||
public MqttServerModel(MqttServerEntity entity, MqttServerService mqttServerService) {
|
|
||||||
this(mqttServerService);
|
|
||||||
if (entity != null) {
|
|
||||||
BeanUtil.copyProperties(entity, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public MqttServerModel(MqttServerService mqttServerService) {
|
|
||||||
this.mqttServerService = mqttServerService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadAddCommand(AddMqttServerCommand command) {
|
|
||||||
if (command != null) {
|
|
||||||
BeanUtil.copyProperties(command, this, "mqttServerId");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadUpdateCommand(UpdateMqttServerCommand command) {
|
|
||||||
if (command != null) {
|
|
||||||
loadAddCommand(command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.agileboot.domain.cabinet.mqtt.model;
|
|
||||||
|
|
||||||
import com.agileboot.common.exception.ApiException;
|
|
||||||
import com.agileboot.common.exception.error.ErrorCode;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.db.MqttServerEntity;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.db.MqttServerService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class MqttServerModelFactory {
|
|
||||||
|
|
||||||
private final MqttServerService mqttServerService;
|
|
||||||
|
|
||||||
public MqttServerModel loadById(Long mqttServerId) {
|
|
||||||
MqttServerEntity entity = mqttServerService.getById(mqttServerId);
|
|
||||||
if (entity == null) {
|
|
||||||
throw new ApiException(ErrorCode.Business.COMMON_OBJECT_NOT_FOUND, mqttServerId, "MQTT服务器配置");
|
|
||||||
}
|
|
||||||
return new MqttServerModel(entity, mqttServerService);
|
|
||||||
}
|
|
||||||
|
|
||||||
public MqttServerModel create() {
|
|
||||||
return new MqttServerModel(mqttServerService);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
package com.agileboot.domain.cabinet.mqtt.query;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.agileboot.common.core.page.AbstractPageQuery;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import java.util.Date;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class SearchMqttServerQuery<T> extends AbstractPageQuery<T> {
|
|
||||||
|
|
||||||
private Long mqttServerId;
|
|
||||||
private String serverUrl;
|
|
||||||
private String username;
|
|
||||||
private String password;
|
|
||||||
private String topicFilter;
|
|
||||||
private String publishTopic;
|
|
||||||
private Date startTime;
|
|
||||||
private Date endTime;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public QueryWrapper<T> addQueryCondition() {
|
|
||||||
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
|
||||||
|
|
||||||
queryWrapper
|
|
||||||
.eq(mqttServerId != null, "mqtt_server_id", mqttServerId)
|
|
||||||
.like(StrUtil.isNotEmpty(serverUrl), "server_url", serverUrl)
|
|
||||||
.eq(StrUtil.isNotEmpty(username), "username", username)
|
|
||||||
.eq(StrUtil.isNotEmpty(password), "password", password)
|
|
||||||
.like(StrUtil.isNotEmpty(topicFilter), "topic_filter", topicFilter)
|
|
||||||
.like(StrUtil.isNotEmpty(publishTopic), "publish_topic", publishTopic)
|
|
||||||
.between(startTime != null && endTime != null, "create_time", startTime, endTime);
|
|
||||||
|
|
||||||
this.timeRangeColumn = "create_time";
|
|
||||||
|
|
||||||
return queryWrapper;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -39,14 +39,6 @@ public class SmartCabinetEntity extends BaseEntity<SmartCabinetEntity> {
|
||||||
@TableField("cabinet_type")
|
@TableField("cabinet_type")
|
||||||
private Integer cabinetType;
|
private Integer cabinetType;
|
||||||
|
|
||||||
@ApiModelProperty("MQTT服务ID")
|
|
||||||
@TableField("mqtt_server_id")
|
|
||||||
private Long mqttServerId;
|
|
||||||
|
|
||||||
@ApiModelProperty("商店ID")
|
|
||||||
@TableField("shop_id")
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
@ApiModelProperty("柜机模版编号")
|
@ApiModelProperty("柜机模版编号")
|
||||||
@TableField("template_no")
|
@TableField("template_no")
|
||||||
private String templateNo;
|
private String templateNo;
|
||||||
|
|
|
@ -6,8 +6,6 @@ import com.agileboot.common.annotation.ExcelSheet;
|
||||||
import com.agileboot.domain.common.cache.CacheCenter;
|
import com.agileboot.domain.common.cache.CacheCenter;
|
||||||
import com.agileboot.domain.cabinet.smartCabinet.db.SmartCabinetEntity;
|
import com.agileboot.domain.cabinet.smartCabinet.db.SmartCabinetEntity;
|
||||||
import com.agileboot.domain.system.user.db.SysUserEntity;
|
import com.agileboot.domain.system.user.db.SysUserEntity;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ExcelSheet(name = "智能柜信息表")
|
@ExcelSheet(name = "智能柜信息表")
|
||||||
|
@ -34,12 +32,6 @@ public class SmartCabinetDTO {
|
||||||
@ExcelColumn(name = "柜机类型(0主柜 1副柜)")
|
@ExcelColumn(name = "柜机类型(0主柜 1副柜)")
|
||||||
private Integer cabinetType;
|
private Integer cabinetType;
|
||||||
|
|
||||||
@ExcelColumn(name = "MQTT服务ID")
|
|
||||||
private Long mqttServerId;
|
|
||||||
|
|
||||||
@ExcelColumn(name = "商店ID")
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
@ExcelColumn(name = "柜机模版编号")
|
@ExcelColumn(name = "柜机模版编号")
|
||||||
private String templateNo;
|
private String templateNo;
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@ public class SearchSmartCabinetQuery<T> extends AbstractPageQuery<T> {
|
||||||
private String templateNo;
|
private String templateNo;
|
||||||
private Date startTime;
|
private Date startTime;
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
private Long mqttServerId;
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public QueryWrapper<T> addQueryCondition() {
|
public QueryWrapper<T> addQueryCondition() {
|
||||||
|
@ -26,8 +24,6 @@ public class SearchSmartCabinetQuery<T> extends AbstractPageQuery<T> {
|
||||||
queryWrapper
|
queryWrapper
|
||||||
.like(StrUtil.isNotEmpty(cabinetName), "cabinet_name", cabinetName)
|
.like(StrUtil.isNotEmpty(cabinetName), "cabinet_name", cabinetName)
|
||||||
.eq(cabinetType != null, "cabinet_type", cabinetType)
|
.eq(cabinetType != null, "cabinet_type", cabinetType)
|
||||||
.eq(mqttServerId!= null, "mqtt_server_id", mqttServerId)
|
|
||||||
.eq(shopId!= null, "shop_id", shopId)
|
|
||||||
.eq(StrUtil.isNotEmpty(templateNo), "template_no", templateNo)
|
.eq(StrUtil.isNotEmpty(templateNo), "template_no", templateNo)
|
||||||
.eq("deleted", false)
|
.eq("deleted", false)
|
||||||
.between(startTime != null && endTime != null, "create_time", startTime, endTime);
|
.between(startTime != null && endTime != null, "create_time", startTime, endTime);
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package com.agileboot.domain.mqtt;
|
package com.agileboot.domain.mqtt;
|
||||||
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.db.MqttServerEntity;
|
|
||||||
import com.agileboot.domain.cabinet.mqtt.db.MqttServerService;
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -18,15 +18,35 @@ import java.util.List;
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class MqttService implements MqttCallback {
|
public class MqttService implements MqttCallback {
|
||||||
private final MqttServerService mqttServerService;
|
|
||||||
private final List<ClientConfig> clientConfigs = new ArrayList<>();
|
private final List<ClientConfig> clientConfigs = new ArrayList<>();
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
private static class ClientConfig {
|
private static class ClientConfig {
|
||||||
private final MqttClient client;
|
private final MqttClient client;
|
||||||
private final MqttServerEntity config;
|
private final MqttConfig config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
private enum MqttConfig {
|
||||||
|
LOCK("lock", "lock@ys#6785$", "lock/up/S4202414S", "lock/down/S4202414S"),
|
||||||
|
SELL("sell", "sell@ys#6785$", "lock/up/S5200184S", "lock/down/S5200184S");
|
||||||
|
|
||||||
|
private final String username;
|
||||||
|
private final String password;
|
||||||
|
private final String topicFilter;
|
||||||
|
private final String publishTopic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String SERVER_URL = "tcp://221.7.159.46:1883";
|
||||||
|
// private static final String USERNAME = "sell";
|
||||||
|
// private static final String PASSWORD = "sell@ys#6785$";
|
||||||
|
// private static final String TOPIC_FILTER = "lock/up/S5200184S";
|
||||||
|
// private static final String TOPIC = "lock/down/S5200184S";
|
||||||
|
// private static final String USERNAME = "iot";
|
||||||
|
// private static final String PASSWORD = "iot@ys#9963$";
|
||||||
|
// private static final String TOPIC_FILTER = "hongfa/2401310026C50D24FE/upload/";
|
||||||
|
// private static final String TOPIC = "hongfa/2401310026C50D24FE/download/";
|
||||||
|
|
||||||
// private MqttClient client;
|
// private MqttClient client;
|
||||||
@Setter
|
@Setter
|
||||||
|
@ -50,8 +70,8 @@ public class MqttService implements MqttCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void connect() throws MqttException {
|
public void connect() throws MqttException {
|
||||||
for (MqttServerEntity config : mqttServerService.selectAll()) {
|
for (MqttConfig config : MqttConfig.values()) {
|
||||||
MqttClient client = new MqttClient(config.getServerUrl(), MqttClient.generateClientId(), new MemoryPersistence());
|
MqttClient client = new MqttClient(SERVER_URL, MqttClient.generateClientId(), new MemoryPersistence());
|
||||||
MqttConnectOptions options = new MqttConnectOptions();
|
MqttConnectOptions options = new MqttConnectOptions();
|
||||||
options.setUserName(config.getUsername());
|
options.setUserName(config.getUsername());
|
||||||
options.setPassword(config.getPassword().toCharArray());
|
options.setPassword(config.getPassword().toCharArray());
|
||||||
|
@ -69,21 +89,21 @@ public class MqttService implements MqttCallback {
|
||||||
client.connect(options);
|
client.connect(options);
|
||||||
client.subscribe(config.getTopicFilter());
|
client.subscribe(config.getTopicFilter());
|
||||||
clientConfigs.add(new ClientConfig(client, config));
|
clientConfigs.add(new ClientConfig(client, config));
|
||||||
log.info("成功连接MQTT服务器:{} 账号:{}", config.getServerUrl(), config.getUsername());
|
log.info("成功连接MQTT账号:{}", config.getUsername());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("连接 MQTT 服务器 {}", SERVER_URL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void subscribe(String topic) throws MqttException {
|
/*public void subscribe(String topic) throws MqttException {
|
||||||
client.subscribe(topic);
|
client.subscribe(topic);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
public void publish(String data, Long mqttServerId) throws MqttException {
|
public void publish(String data) throws MqttException {
|
||||||
// lockCmd((byte) 0x8A, (byte) 0x01, (byte) 0x01, (byte) 0x33, null);
|
// lockCmd((byte) 0x8A, (byte) 0x01, (byte) 0x01, (byte) 0x33, null);
|
||||||
String bcc = BCCCalculator.calculateBCC(data);
|
String bcc = BCCCalculator.calculateBCC(data);
|
||||||
MqttMessage message = new MqttMessage(BCCCalculator.hexStringToByteArray(data + bcc));
|
MqttMessage message = new MqttMessage(BCCCalculator.hexStringToByteArray(data + bcc));
|
||||||
clientConfigs.stream()
|
clientConfigs.forEach(cc -> {
|
||||||
.filter(cc -> cc.config.getMqttServerId().equals(mqttServerId))
|
|
||||||
.forEach(cc -> {
|
|
||||||
try {
|
try {
|
||||||
cc.client.publish(cc.config.getPublishTopic(), message);
|
cc.client.publish(cc.config.getPublishTopic(), message);
|
||||||
} catch (MqttException e) {
|
} catch (MqttException e) {
|
||||||
|
|
|
@ -62,8 +62,8 @@ public class GoodsApplicationService {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList(Long shopId) {
|
public List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList() {
|
||||||
return shopGoodsService.getGoodsWithCabinetList(shopId);
|
return shopGoodsService.getGoodsWithCabinetList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ShopGoodsDTO getGoodsInfo(Long goodsId) {
|
public ShopGoodsDTO getGoodsInfo(Long goodsId) {
|
||||||
|
|
|
@ -28,9 +28,6 @@ public class SearchGoodsWithCabinetDO extends BaseEntity<SearchGoodsWithCabinetD
|
||||||
@TableField("sc.cabinet_name")
|
@TableField("sc.cabinet_name")
|
||||||
private String cabinetName;
|
private String cabinetName;
|
||||||
|
|
||||||
@TableField("sc.shop_id")
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
@TableField("cc.cell_id")
|
@TableField("cc.cell_id")
|
||||||
private Long cellId;
|
private Long cellId;
|
||||||
}
|
}
|
|
@ -72,16 +72,6 @@ public interface ShopGoodsMapper extends BaseMapper<ShopGoodsEntity> {
|
||||||
"WHERE g.deleted = 0 AND sc.deleted = 0 AND cc.deleted = 0 AND cc.goods_id IS NOT NULL ")
|
"WHERE g.deleted = 0 AND sc.deleted = 0 AND cc.deleted = 0 AND cc.goods_id IS NOT NULL ")
|
||||||
List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList();
|
List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList();
|
||||||
|
|
||||||
@Select("SELECT g.goods_id, g.goods_name, g.category_id, g.price, " +
|
|
||||||
"g.status, g.cover_img, g.goods_detail, " +
|
|
||||||
"g.creator_id, g.create_time, g.updater_id, g.update_time, g.remark, g.deleted, " +
|
|
||||||
"sc.cabinet_id, sc.cabinet_name, sc.shop_id, cc.stock, cc.cell_id " +
|
|
||||||
"FROM shop_goods g " +
|
|
||||||
"LEFT JOIN cabinet_cell cc ON g.goods_id = cc.goods_id " +
|
|
||||||
"LEFT JOIN smart_cabinet sc ON cc.cabinet_id = sc.cabinet_id " +
|
|
||||||
"WHERE g.deleted = 0 AND sc.deleted = 0 AND sc.shop_id = #{shopId} AND cc.deleted = 0 AND cc.goods_id IS NOT NULL ")
|
|
||||||
List<SearchGoodsWithCabinetDO> getGoodsWithCabinetListByShopId(@Param("shopId")Long shopId);
|
|
||||||
|
|
||||||
@Select("SELECT g.goods_id, g.goods_name, g.category_id, g.price, " +
|
@Select("SELECT g.goods_id, g.goods_name, g.category_id, g.price, " +
|
||||||
"g.stock, g.status, g.auto_approval, g.cover_img, SUM(cc.stock) AS total_stock, " +
|
"g.stock, g.status, g.auto_approval, g.cover_img, SUM(cc.stock) AS total_stock, " +
|
||||||
"GROUP_CONCAT(DISTINCT cc.cell_no) AS cell_no_str, " +
|
"GROUP_CONCAT(DISTINCT cc.cell_no) AS cell_no_str, " +
|
||||||
|
|
|
@ -19,7 +19,7 @@ public interface ShopGoodsService extends IService<ShopGoodsEntity> {
|
||||||
|
|
||||||
List<ShopGoodsEntity> selectAll();
|
List<ShopGoodsEntity> selectAll();
|
||||||
|
|
||||||
List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList(Long shopId);
|
List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList();
|
||||||
|
|
||||||
SearchGoodsDO getGoodsInfo(Long goodsId);
|
SearchGoodsDO getGoodsInfo(Long goodsId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import com.agileboot.common.core.page.AbstractPageQuery;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -16,7 +15,6 @@ import java.util.List;
|
||||||
* @author valarchie
|
* @author valarchie
|
||||||
* @since 2025-03-03
|
* @since 2025-03-03
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
|
||||||
@Service
|
@Service
|
||||||
public class ShopGoodsServiceImpl extends ServiceImpl<ShopGoodsMapper, ShopGoodsEntity> implements ShopGoodsService {
|
public class ShopGoodsServiceImpl extends ServiceImpl<ShopGoodsMapper, ShopGoodsEntity> implements ShopGoodsService {
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,13 +31,8 @@ public class ShopGoodsServiceImpl extends ServiceImpl<ShopGoodsMapper, ShopGoods
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList(Long shopId) {
|
public List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList() {
|
||||||
if (shopId == null) {
|
|
||||||
return baseMapper.getGoodsWithCabinetList();
|
return baseMapper.getGoodsWithCabinetList();
|
||||||
} else {
|
|
||||||
log.info("getGoodsWithCabinetList shopId: {}", shopId);
|
|
||||||
return baseMapper.getGoodsWithCabinetListByShopId(shopId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -124,7 +124,7 @@ public class OrderApplicationService {
|
||||||
mqttDate += String.format("%02X", cabinetCellEntity.getPinNo());
|
mqttDate += String.format("%02X", cabinetCellEntity.getPinNo());
|
||||||
mqttDate += "11";
|
mqttDate += "11";
|
||||||
try {
|
try {
|
||||||
mqttService.publish(mqttDate, smartCabinet.getMqttServerId());
|
mqttService.publish(mqttDate);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("mqtt publish error", e);
|
log.error("mqtt publish error", e);
|
||||||
operationCommand.setStatus(2);
|
operationCommand.setStatus(2);
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
package com.agileboot.domain.shop.shop;
|
|
||||||
|
|
||||||
import com.agileboot.common.core.page.PageDTO;
|
|
||||||
import com.agileboot.domain.common.command.BulkOperationCommand;
|
|
||||||
import com.agileboot.domain.shop.shop.command.AddShopCommand;
|
|
||||||
import com.agileboot.domain.shop.shop.command.UpdateShopCommand;
|
|
||||||
import com.agileboot.domain.shop.shop.db.ShopEntity;
|
|
||||||
import com.agileboot.domain.shop.shop.db.ShopService;
|
|
||||||
import com.agileboot.domain.shop.shop.dto.ShopDTO;
|
|
||||||
import com.agileboot.domain.shop.shop.model.ShopModel;
|
|
||||||
import com.agileboot.domain.shop.shop.model.ShopModelFactory;
|
|
||||||
import com.agileboot.domain.shop.shop.query.SearchShopQuery;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class ShopApplicationService {
|
|
||||||
private final ShopService shopService;
|
|
||||||
private final ShopModelFactory shopModelFactory;
|
|
||||||
|
|
||||||
public PageDTO<ShopDTO> getShopList(SearchShopQuery<ShopEntity> query) {
|
|
||||||
Page<ShopEntity> page = shopService.page(query.toPage(), query.toQueryWrapper());
|
|
||||||
List<ShopDTO> dtoList = page.getRecords().stream()
|
|
||||||
.map(ShopDTO::new)
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
return new PageDTO<>(dtoList, page.getTotal());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addShop(AddShopCommand command) {
|
|
||||||
ShopModel model = shopModelFactory.create();
|
|
||||||
model.loadAddCommand(command);
|
|
||||||
model.insert();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateShop(UpdateShopCommand command) {
|
|
||||||
ShopModel model = shopModelFactory.loadById(command.getShopId());
|
|
||||||
model.loadUpdateCommand(command);
|
|
||||||
model.updateById();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void deleteShop(BulkOperationCommand<Long> command) {
|
|
||||||
for (Long shopId : command.getIds()) {
|
|
||||||
ShopModel model = shopModelFactory.loadById(shopId);
|
|
||||||
model.deleteById();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
package com.agileboot.domain.shop.shop.command;
|
|
||||||
|
|
||||||
import com.agileboot.domain.shop.shop.db.ShopEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class AddShopCommand extends ShopEntity {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.agileboot.domain.shop.shop.command;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import javax.validation.constraints.PositiveOrZero;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class UpdateShopCommand extends AddShopCommand {
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@PositiveOrZero
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
package com.agileboot.domain.shop.shop.db;
|
|
||||||
|
|
||||||
import com.agileboot.common.core.base.BaseEntity;
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 商店表,每个柜子属于一个商店
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author valarchie
|
|
||||||
* @since 2025-05-09
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@TableName("shop")
|
|
||||||
@ApiModel(value = "ShopEntity对象", description = "商店表,每个柜子属于一个商店")
|
|
||||||
public class ShopEntity extends BaseEntity<ShopEntity> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@ApiModelProperty("主键ID")
|
|
||||||
@TableId(value = "shop_id", type = IdType.AUTO)
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
@ApiModelProperty("商店名称")
|
|
||||||
@TableField("shop_name")
|
|
||||||
private String shopName;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Serializable pkVal() {
|
|
||||||
return this.shopId;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,43 +0,0 @@
|
||||||
package com.agileboot.domain.shop.shop.db;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 商店表,每个柜子属于一个商店 Mapper 接口
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author valarchie
|
|
||||||
* @since 2025-05-09
|
|
||||||
*/
|
|
||||||
public interface ShopMapper extends BaseMapper<ShopEntity> {
|
|
||||||
@Select("SELECT shop_id, shop_name " +
|
|
||||||
"FROM shop " +
|
|
||||||
"${ew.customSqlSegment}")
|
|
||||||
Page<ShopEntity> getShopList(
|
|
||||||
Page<ShopEntity> page,
|
|
||||||
@Param(Constants.WRAPPER) Wrapper<ShopEntity> queryWrapper
|
|
||||||
);
|
|
||||||
|
|
||||||
@Select("SELECT * " +
|
|
||||||
"FROM shop " +
|
|
||||||
"ORDER BY shop_id DESC " +
|
|
||||||
"LIMIT 1")
|
|
||||||
ShopEntity selectFirstShop();
|
|
||||||
|
|
||||||
@Select("SELECT * FROM shop ORDER BY shop_id DESC")
|
|
||||||
List<ShopEntity> selectAll();
|
|
||||||
|
|
||||||
@Select("SELECT * FROM shop WHERE shop_id = #{shopId} LIMIT 1")
|
|
||||||
ShopEntity selectByShopId(Long shopId);
|
|
||||||
|
|
||||||
@Select("SELECT * FROM shop WHERE shop_name = #{shopName} LIMIT 1")
|
|
||||||
ShopEntity selectByShopName(String shopName);
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
package com.agileboot.domain.shop.shop.db;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 商店表,每个柜子属于一个商店 服务类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author valarchie
|
|
||||||
* @since 2025-05-09
|
|
||||||
*/
|
|
||||||
public interface ShopService extends IService<ShopEntity> {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package com.agileboot.domain.shop.shop.db;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <p>
|
|
||||||
* 商店表,每个柜子属于一个商店 服务实现类
|
|
||||||
* </p>
|
|
||||||
*
|
|
||||||
* @author valarchie
|
|
||||||
* @since 2025-05-09
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopEntity> implements ShopService {
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.agileboot.domain.shop.shop.dto;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.agileboot.common.annotation.ExcelColumn;
|
|
||||||
import com.agileboot.common.annotation.ExcelSheet;
|
|
||||||
import com.agileboot.domain.common.cache.CacheCenter;
|
|
||||||
import com.agileboot.domain.shop.shop.db.ShopEntity;
|
|
||||||
import com.agileboot.domain.system.user.db.SysUserEntity;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@ExcelSheet(name = "商店列表")
|
|
||||||
@Data
|
|
||||||
public class ShopDTO {
|
|
||||||
|
|
||||||
public ShopDTO(ShopEntity entity) {
|
|
||||||
if (entity != null) {
|
|
||||||
BeanUtil.copyProperties(entity, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@ExcelColumn(name = "商店ID")
|
|
||||||
private Long shopId;
|
|
||||||
|
|
||||||
@ExcelColumn(name = "商店名称")
|
|
||||||
private String shopName;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package com.agileboot.domain.shop.shop.model;
|
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
|
||||||
import com.agileboot.domain.shop.shop.command.AddShopCommand;
|
|
||||||
import com.agileboot.domain.shop.shop.command.UpdateShopCommand;
|
|
||||||
import com.agileboot.domain.shop.shop.db.ShopEntity;
|
|
||||||
import com.agileboot.domain.shop.shop.db.ShopService;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class ShopModel extends ShopEntity {
|
|
||||||
|
|
||||||
private ShopService shopService;
|
|
||||||
|
|
||||||
public ShopModel(ShopEntity entity, ShopService shopService) {
|
|
||||||
this(shopService);
|
|
||||||
if (entity != null) {
|
|
||||||
BeanUtil.copyProperties(entity, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShopModel(ShopService shopService) {
|
|
||||||
this.shopService = shopService;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadAddCommand(AddShopCommand command) {
|
|
||||||
if (command != null) {
|
|
||||||
BeanUtil.copyProperties(command, this, "id");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void loadUpdateCommand(UpdateShopCommand command) {
|
|
||||||
if (command != null) {
|
|
||||||
loadAddCommand(command);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package com.agileboot.domain.shop.shop.model;
|
|
||||||
|
|
||||||
import com.agileboot.common.exception.ApiException;
|
|
||||||
import com.agileboot.common.exception.error.ErrorCode;
|
|
||||||
import com.agileboot.domain.shop.shop.db.ShopEntity;
|
|
||||||
import com.agileboot.domain.shop.shop.db.ShopService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
public class ShopModelFactory {
|
|
||||||
|
|
||||||
private final ShopService shopService;
|
|
||||||
|
|
||||||
public ShopModel loadById(Long shopId) {
|
|
||||||
ShopEntity entity = shopService.getById(shopId);
|
|
||||||
if (entity == null) {
|
|
||||||
throw new ApiException(ErrorCode.Business.COMMON_OBJECT_NOT_FOUND, shopId, "店铺");
|
|
||||||
}
|
|
||||||
return new ShopModel(entity, shopService);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ShopModel create() {
|
|
||||||
return new ShopModel(shopService);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package com.agileboot.domain.shop.shop.query;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.agileboot.common.core.page.AbstractPageQuery;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import java.util.Date;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = true)
|
|
||||||
@Data
|
|
||||||
public class SearchShopQuery<T> extends AbstractPageQuery<T> {
|
|
||||||
|
|
||||||
private String shopName;
|
|
||||||
private String enable;
|
|
||||||
private Date startTime;
|
|
||||||
private Date endTime;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public QueryWrapper<T> addQueryCondition() {
|
|
||||||
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
|
|
||||||
|
|
||||||
queryWrapper
|
|
||||||
.like(StrUtil.isNotEmpty(shopName), "shop_name", shopName)
|
|
||||||
.eq(StrUtil.isNotEmpty(enable), "enable", enable)
|
|
||||||
.between(startTime != null && endTime != null, "create_time", startTime, endTime);
|
|
||||||
|
|
||||||
this.timeRangeColumn = "create_time";
|
|
||||||
|
|
||||||
return queryWrapper;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.agileboot.domain.cabinet.mqtt.db.MqttServerMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,5 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
||||||
<mapper namespace="com.agileboot.domain.shop.shop.db.ShopMapper">
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -61,7 +61,7 @@ public class CodeGenerator {
|
||||||
//生成的类 放在orm子模块下的/target/generated-code目录底下
|
//生成的类 放在orm子模块下的/target/generated-code目录底下
|
||||||
.module("/agileboot-orm/target/generated-code")
|
.module("/agileboot-orm/target/generated-code")
|
||||||
.parentPackage("com.agileboot")
|
.parentPackage("com.agileboot")
|
||||||
.tableName("shop")
|
.tableName("payment_operation_log")
|
||||||
// 决定是否继承基类
|
// 决定是否继承基类
|
||||||
.isExtendsFromBaseEntity(true)
|
.isExtendsFromBaseEntity(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
DROP TABLE IF EXISTS `mqtt_server`;
|
|
||||||
|
|
||||||
CREATE TABLE `mqtt_server` (
|
|
||||||
`mqtt_server_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
||||||
`server_url` VARCHAR(200) NOT NULL COMMENT 'MQTT服务器地址',
|
|
||||||
`username` VARCHAR(100) NOT NULL COMMENT '连接账号',
|
|
||||||
`password` VARCHAR(200) NOT NULL COMMENT '连接密码',
|
|
||||||
`topic_filter` VARCHAR(200) NOT NULL COMMENT '订阅主题过滤器',
|
|
||||||
`publish_topic` VARCHAR(200) NOT NULL COMMENT '发布主题',
|
|
||||||
`creator_id` BIGINT NULL DEFAULT 0 COMMENT '创建者ID',
|
|
||||||
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater_id` BIGINT NULL DEFAULT 0 COMMENT '更新者ID',
|
|
||||||
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '删除标志(0存在 1删除)',
|
|
||||||
PRIMARY KEY (`mqtt_server_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='MQTT服务配置表';
|
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE `smart_cabinet`
|
|
||||||
ADD COLUMN `mqtt_server_id` BIGINT NULL COMMENT 'MQTT服务ID'
|
|
||||||
AFTER `cabinet_type`;
|
|
||||||
|
|
||||||
DROP TABLE IF EXISTS `shop`;
|
|
||||||
|
|
||||||
CREATE TABLE `shop` (
|
|
||||||
`shop_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
|
||||||
`shop_name` VARCHAR(100) NOT NULL COMMENT '商店名称',
|
|
||||||
`creator_id` BIGINT NULL DEFAULT 0 COMMENT '创建者ID',
|
|
||||||
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
|
||||||
`updater_id` BIGINT NULL DEFAULT 0 COMMENT '更新者ID',
|
|
||||||
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
|
||||||
`deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '删除标志(0存在 1删除)',
|
|
||||||
PRIMARY KEY (`shop_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商店表,每个柜子属于一个商店';
|
|
||||||
|
|
||||||
ALTER TABLE `smart_cabinet`
|
|
||||||
ADD COLUMN `shop_id` BIGINT NULL COMMENT '归属商店ID'
|
|
||||||
AFTER `cabinet_type`;
|
|
Loading…
Reference in New Issue