Compare commits
8 Commits
160033f107
...
cae2822a5d
Author | SHA1 | Date |
---|---|---|
|
cae2822a5d | |
|
0ea23e7309 | |
|
a6c12859e3 | |
|
1be43a1251 | |
|
12fa1dce42 | |
|
66d1fcd026 | |
|
4f4c3f39cc | |
|
d808f8b1eb |
|
@ -18,6 +18,7 @@ import com.agileboot.domain.qywx.user.command.AddQyUserCommand;
|
|||
import com.agileboot.domain.qywx.user.command.UpdateQyUserCommand;
|
||||
import com.agileboot.domain.qywx.user.db.QyUserEntity;
|
||||
import com.agileboot.domain.qywx.user.dto.QyUserDTO;
|
||||
import com.agileboot.domain.qywx.user.dto.QyUserStatsDTO;
|
||||
import com.agileboot.domain.qywx.user.query.SearchQyUserQuery;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
|
@ -105,8 +106,8 @@ public class QyUserController extends BaseController {
|
|||
}
|
||||
|
||||
@GetMapping("/getTotalBalance")
|
||||
public ResponseDTO<BigDecimal> getTotalBalance(@RequestParam(required = false) String corpid) {
|
||||
BigDecimal totalBalance = qyUserApplicationService.selectTotalBalance(corpid);
|
||||
return ResponseDTO.ok(totalBalance);
|
||||
public ResponseDTO<QyUserStatsDTO> getTotalBalance(@RequestParam(required = false) String corpid) {
|
||||
QyUserStatsDTO statsDTO = qyUserApplicationService.selectTotalBalance(corpid);
|
||||
return ResponseDTO.ok(statsDTO);
|
||||
}
|
||||
}
|
|
@ -26,6 +26,7 @@ import java.math.BigDecimal;
|
|||
import java.util.List;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
@ -50,6 +51,7 @@ public class ShopController extends BaseController {
|
|||
private final MqttService mqttService;
|
||||
|
||||
@Operation(summary = "首页数据")
|
||||
@PreAuthorize("@permission.has('welcome:info')")
|
||||
@GetMapping("/Stats")
|
||||
public ResponseDTO<StatsDTO> stats() {
|
||||
// 创建统计数据DTO对象
|
||||
|
|
|
@ -48,7 +48,6 @@ public class SysMenuController extends BaseController {
|
|||
* 获取菜单列表
|
||||
*/
|
||||
@Operation(summary = "菜单列表")
|
||||
@PreAuthorize("@permission.has('system:menu:list')")
|
||||
@GetMapping
|
||||
public ResponseDTO<List<MenuDTO>> menuList(MenuQuery menuQuery) {
|
||||
List<MenuDTO> menuList = menuApplicationService.getMenuList(menuQuery);
|
||||
|
|
|
@ -55,6 +55,14 @@ public class SysRoleController extends BaseController {
|
|||
return ResponseDTO.ok(pageDTO);
|
||||
}
|
||||
|
||||
@Operation(summary = "全部角色")
|
||||
@PreAuthorize("@permission.has('system:role:list')")
|
||||
@GetMapping("/all")
|
||||
public ResponseDTO<List<RoleDTO>> all(RoleQuery query) {
|
||||
List<RoleDTO> pageDTO = roleApplicationService.getRoleAll(query);
|
||||
return ResponseDTO.ok(pageDTO);
|
||||
}
|
||||
|
||||
@Operation(summary = "角色列表导出")
|
||||
@AccessLog(title = "角色管理", businessType = BusinessTypeEnum.EXPORT)
|
||||
@PreAuthorize("@permission.has('system:role:export')")
|
||||
|
|
|
@ -2,6 +2,7 @@ package com.agileboot.admin.customize.service;
|
|||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.agileboot.common.constant.WeixinConstants;
|
||||
import com.agileboot.domain.common.command.BulkOperationCommand;
|
||||
import com.agileboot.domain.qywx.accessToken.AccessTokenApplicationService;
|
||||
import com.agileboot.domain.qywx.accessToken.db.QyAccessTokenEntity;
|
||||
|
@ -23,6 +24,8 @@ import com.agileboot.domain.qywx.department.db.QyDepartmentEntity;
|
|||
import com.agileboot.domain.qywx.template.TemplateApplicationService;
|
||||
import com.agileboot.domain.qywx.template.command.UpdateTemplateCommand;
|
||||
import com.agileboot.domain.qywx.template.db.QyTemplateEntity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -30,6 +33,7 @@ import java.util.Map;
|
|||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.agileboot.domain.qywx.user.QyUserApplicationService;
|
||||
import com.agileboot.domain.qywx.user.command.AddQyUserCommand;
|
||||
|
@ -38,6 +42,8 @@ import com.agileboot.domain.qywx.user.db.QyUserEntity;
|
|||
import com.agileboot.domain.qywx.userQySys.SysUserQyUserApplicationService;
|
||||
import com.agileboot.domain.qywx.userQySys.command.AddSysUserQyUserCommand;
|
||||
import com.agileboot.domain.qywx.userQySys.db.SysUserQyUserEntity;
|
||||
import com.agileboot.domain.system.role.db.SysRoleEntity;
|
||||
import com.agileboot.domain.system.role.db.SysRoleService;
|
||||
import com.agileboot.domain.system.user.UserApplicationService;
|
||||
|
||||
import com.agileboot.domain.system.user.command.AddUserCommand;
|
||||
|
@ -70,6 +76,7 @@ public class QywxScheduleJob {
|
|||
private final QyUserApplicationService qyUserApplicationService;
|
||||
private final SysUserQyUserApplicationService sysUserQyUserApplicationService;
|
||||
private final UserModelFactory userModelFactory;
|
||||
private final SysRoleService sysRoleService;
|
||||
|
||||
// private static final String appid = "QYTONG_YS_WXSHOP";
|
||||
/**
|
||||
|
@ -412,6 +419,7 @@ public class QywxScheduleJob {
|
|||
.collect(Collectors.toList());
|
||||
|
||||
|
||||
List<UserListResponse.UserInfo> wxUsers = new ArrayList<>();
|
||||
for (QyDepartmentEntity department : departmentList) {
|
||||
// 获取部门用户列表
|
||||
UserListResponse userList = QywxApiUtil.getUserList(accessToken.getAccessToken(), department.getDepartmentId());
|
||||
|
@ -425,9 +433,10 @@ public class QywxScheduleJob {
|
|||
}
|
||||
log.info("获取部门用户列表成功: {}", JSONUtil.toJsonStr(userList));
|
||||
|
||||
List<UserListResponse.UserInfo> wxUsers = userList.getUserlist();
|
||||
if (wxUsers == null || wxUsers.isEmpty()) {
|
||||
continue;
|
||||
List<UserListResponse.UserInfo> wxUsersList = userList.getUserlist();
|
||||
if (wxUsersList != null) {
|
||||
wxUsers.addAll(wxUsersList);
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, UserListResponse.UserInfo> wxUserMap = wxUsers.stream()
|
||||
|
@ -449,10 +458,10 @@ public class QywxScheduleJob {
|
|||
log.info("syncUserInfo toAdd: {}", JSONUtil.toJsonStr(toAdd));
|
||||
|
||||
// 识别需要删除的用户
|
||||
/* List<QyUserEntity> toRemove = qyUserList.stream()
|
||||
List<QyUserEntity> toRemove = qyUserList.stream()
|
||||
.filter(localUser -> !wxUserMap.containsKey(localUser.getUserid()))
|
||||
.collect(Collectors.toList());
|
||||
log.info("syncUserInfo toRemove: {}", JSONUtil.toJsonStr(toRemove));*/
|
||||
log.info("syncUserInfo toRemove: {}", JSONUtil.toJsonStr(toRemove));
|
||||
|
||||
// 识别需要更新的用户
|
||||
List<UpdateQyUserCommand> toUpdate = qyUserList.stream()
|
||||
|
@ -543,6 +552,11 @@ public class QywxScheduleJob {
|
|||
newUser.setCreateTime(new Date());
|
||||
newUser.setUpdaterId(0L);
|
||||
newUser.setUpdateTime(new Date());
|
||||
// 北流铜州医院默认余额1000
|
||||
if (WeixinConstants.corpid.equals(newUser.getCorpid())) {
|
||||
newUser.setBalanceLimit(BigDecimal.valueOf(1000L));
|
||||
newUser.setBalance(BigDecimal.valueOf(1000L));
|
||||
}
|
||||
qyUserApplicationService.addUser(newUser);
|
||||
});
|
||||
}
|
||||
|
@ -553,12 +567,19 @@ public class QywxScheduleJob {
|
|||
}
|
||||
|
||||
// 删除用户
|
||||
/*if (!toRemove.isEmpty()) {
|
||||
BulkOperationCommand<Integer> command = new BulkOperationCommand<>(
|
||||
if (!toRemove.isEmpty()) {
|
||||
/*BulkOperationCommand<Integer> command = new BulkOperationCommand<>(
|
||||
toRemove.stream().map(QyUserEntity::getId).collect(Collectors.toList())
|
||||
);
|
||||
qyUserApplicationService.deleteUser(command);
|
||||
}*/
|
||||
qyUserApplicationService.deleteUser(command);*/
|
||||
toRemove.stream()
|
||||
.map(removeUser -> {
|
||||
UpdateQyUserCommand deleteCommand = new UpdateQyUserCommand();
|
||||
deleteCommand.setId(removeUser.getId());
|
||||
deleteCommand.setEnable("0");
|
||||
return deleteCommand;
|
||||
})
|
||||
.forEach(qyUserApplicationService::updateUser);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("syncUserInfo error", e);
|
||||
|
@ -693,6 +714,7 @@ public class QywxScheduleJob {
|
|||
}
|
||||
});
|
||||
|
||||
SysRoleEntity role = sysRoleService.getByRoleKey("base");
|
||||
for (AddSysUserQyUserCommand binding : toAdd) {
|
||||
AddUserCommand command = new AddUserCommand();
|
||||
command.setUsername("qywx" + binding.getQyUserId());
|
||||
|
@ -707,7 +729,7 @@ public class QywxScheduleJob {
|
|||
command.setEmail(phoneNumber + "@qywx.com");
|
||||
command.setPassword("123456");
|
||||
command.setStatus(1);
|
||||
UserModel userModel = addUser(command);
|
||||
UserModel userModel = addUser(command, role != null ? role.getRoleId() : 0L);
|
||||
|
||||
binding.setSysUserId(userModel.getUserId());
|
||||
sysUserQyUserApplicationService.addSysUserQyUser(binding);
|
||||
|
@ -717,8 +739,9 @@ public class QywxScheduleJob {
|
|||
}
|
||||
}
|
||||
|
||||
private UserModel addUser(AddUserCommand command) {
|
||||
private UserModel addUser(AddUserCommand command, Long roleId) {
|
||||
UserModel model = userModelFactory.create();
|
||||
model.setRoleId(roleId);
|
||||
model.loadAddUserCommand(command);
|
||||
model.checkUsernameIsUnique();
|
||||
model.checkPhoneNumberIsUnique();
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
package com.agileboot.api.controller;
|
||||
|
||||
|
||||
import com.agileboot.common.constant.OpenApiConstants;
|
||||
import com.agileboot.common.core.dto.ResponseDTO;
|
||||
import com.agileboot.common.exception.ApiException;
|
||||
import com.agileboot.common.exception.error.ErrorCode;
|
||||
import com.agileboot.domain.cabinet.cell.CabinetCellApplicationService;
|
||||
import com.agileboot.domain.cabinet.cell.db.CabinetCellDO;
|
||||
import com.agileboot.domain.cabinet.smartCabinet.SmartCabinetApplicationService;
|
||||
import com.agileboot.domain.cabinet.smartCabinet.db.SmartCabinetDO;
|
||||
import com.agileboot.domain.cabinet.smartCabinet.dto.CabinetDetailDTO;
|
||||
import com.agileboot.domain.cabinet.smartCabinet.dto.SmartCabinetDTO;
|
||||
import com.agileboot.domain.cabinet.smartCabinet.vo.CabinetVO;
|
||||
import com.agileboot.domain.shop.payment.SignUtils;
|
||||
import com.agileboot.domain.shop.payment.dto.CommonRequest;
|
||||
import com.agileboot.domain.shop.payment.dto.RefundVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@CrossOrigin(origins = "*", allowedHeaders = "*")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/cabinets")
|
||||
public class CabinetController {
|
||||
private final SmartCabinetApplicationService smartCabinetApplicationService;
|
||||
private final CabinetCellApplicationService cabinetCellApplicationService;
|
||||
|
||||
@PostMapping("/list")
|
||||
public ResponseDTO<List<SmartCabinetDO>> getConsumablesCabinetList(@RequestBody String body) {
|
||||
CommonRequest<CabinetVO> notifyRequest = CommonRequest.build(body, CabinetVO.class);
|
||||
if (notifyRequest == null) {
|
||||
return ResponseDTO.fail(new ApiException(ErrorCode.Client.COMMON_REQUEST_PARAMETERS_INVALID, "请求参数无效"));
|
||||
}
|
||||
log.info("getConsumablesCabinetList sign:{}, body:{}", notifyRequest.getSign(), body);
|
||||
if (!SignUtils.checkOpenSign(OpenApiConstants.appKey, notifyRequest.getSign(), body)) {
|
||||
return ResponseDTO.fail(new ApiException(ErrorCode.Client.COMMON_REQUEST_PARAMETERS_INVALID, "sign校验失败"));
|
||||
}
|
||||
return ResponseDTO.ok(smartCabinetApplicationService.getConsumablesCabinetList());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/cells")
|
||||
public ResponseDTO<List<CabinetCellDO>> getConsumablesCabinetCellsList(@RequestBody String body) {
|
||||
CommonRequest<CabinetVO> notifyRequest = CommonRequest.build(body, CabinetVO.class);
|
||||
if (notifyRequest == null) {
|
||||
return ResponseDTO.fail(new ApiException(ErrorCode.Client.COMMON_REQUEST_PARAMETERS_INVALID, "请求参数无效"));
|
||||
}
|
||||
log.info("getConsumablesCabinetCellsList sign:{}, body:{}", notifyRequest.getSign(), body);
|
||||
if (!SignUtils.checkOpenSign(OpenApiConstants.appKey, notifyRequest.getSign(), body)) {
|
||||
return ResponseDTO.fail(new ApiException(ErrorCode.Client.COMMON_REQUEST_PARAMETERS_INVALID, "sign校验失败"));
|
||||
}
|
||||
return ResponseDTO.ok(cabinetCellApplicationService.selectCabinetCellDOList(notifyRequest.getBizContent().getCabinetId()));
|
||||
}
|
||||
}
|
|
@ -24,6 +24,8 @@ import com.agileboot.domain.qywx.userQySys.SysUserQyUserApplicationService;
|
|||
import com.agileboot.domain.shop.order.OrderApplicationService;
|
||||
import com.agileboot.domain.shop.payment.PaymentApplicationService;
|
||||
import com.agileboot.domain.shop.payment.dto.PaymentCallbackRequest;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -264,7 +266,12 @@ public class PaymentController {
|
|||
}
|
||||
|
||||
// 创建响应对象(假设GetBalanceResponse包含balance字段)
|
||||
GetBalanceResponse response = new GetBalanceResponse(maxBalanceUser.getUserid(), maxBalanceUser.getCorpid(), maxBalanceUser.getBalance());
|
||||
GetBalanceResponse response = new GetBalanceResponse(
|
||||
maxBalanceUser.getUserid(),
|
||||
maxBalanceUser.getCorpid(),
|
||||
BigDecimal.ZERO,
|
||||
BigDecimal.ZERO,
|
||||
BigDecimal.ZERO);
|
||||
return ResponseDTO.ok(response);
|
||||
}
|
||||
|
||||
|
@ -279,7 +286,12 @@ public class PaymentController {
|
|||
QyUserEntity qyUser = qyUserApplicationService.getUserByUserId(userid, corpid);
|
||||
|
||||
// 创建响应对象(假设GetBalanceResponse包含balance字段)
|
||||
GetBalanceResponse response = new GetBalanceResponse(qyUser.getUserid(), qyUser.getCorpid(), qyUser.getBalance());
|
||||
GetBalanceResponse response = new GetBalanceResponse(
|
||||
qyUser.getUserid(),
|
||||
qyUser.getCorpid(),
|
||||
qyUser.getBalance(),
|
||||
qyUser.getUseBalance(),
|
||||
qyUser.getBalanceLimit());
|
||||
return ResponseDTO.ok(response);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
package com.agileboot.api.controller.manage;
|
||||
|
||||
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.goods.GoodsApplicationService;
|
||||
import com.agileboot.domain.shop.goods.command.AddGoodsCommand;
|
||||
import com.agileboot.domain.shop.goods.command.UpdateGoodsCommand;
|
||||
import com.agileboot.domain.shop.goods.db.SearchGoodsDO;
|
||||
import com.agileboot.domain.shop.goods.dto.ShopGoodsDTO;
|
||||
import com.agileboot.domain.shop.goods.query.SearchShopGoodsQuery;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@CrossOrigin(origins = "*", allowedHeaders = "*")
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/api/manage/goods")
|
||||
public class ManageGoodsController {
|
||||
private final GoodsApplicationService goodsApplicationService;
|
||||
/**
|
||||
* 获取商品列表
|
||||
*/
|
||||
@Operation(summary = "商品列表")
|
||||
@GetMapping("/list")
|
||||
public ResponseDTO<PageDTO<ShopGoodsDTO>> goodsList(SearchShopGoodsQuery<SearchGoodsDO> query) {
|
||||
PageDTO<ShopGoodsDTO> page = goodsApplicationService.getGoodsList(query);
|
||||
return ResponseDTO.ok(page);
|
||||
}
|
||||
|
||||
@Operation(summary = "新增商品")
|
||||
@PostMapping
|
||||
public ResponseDTO<Void> add(@Validated @RequestBody AddGoodsCommand command) {
|
||||
goodsApplicationService.addGoods(command);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "删除商品")
|
||||
@DeleteMapping("/{goodsIds}")
|
||||
public ResponseDTO<Void> remove(@PathVariable @NotNull List<Long> goodsIds) {
|
||||
BulkOperationCommand<Long> bulkDeleteCommand = new BulkOperationCommand<>(goodsIds);
|
||||
goodsApplicationService.deleteGoods(bulkDeleteCommand);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "修改商品")
|
||||
@PutMapping("/{goodsId}")
|
||||
public ResponseDTO<Void> edit(@PathVariable Long goodsId, @Validated @RequestBody UpdateGoodsCommand command) {
|
||||
command.setGoodsId(goodsId);
|
||||
goodsApplicationService.updateGoods(command);
|
||||
return ResponseDTO.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个商品信息
|
||||
*/
|
||||
@Operation(summary = "商品列表")
|
||||
@GetMapping("/getGoodsInfo")
|
||||
public ResponseDTO<ShopGoodsDTO> getGoodsInfo(@RequestParam Long goodsId) {
|
||||
ShopGoodsDTO goodsInfo = goodsApplicationService.getGoodsInfo(goodsId);
|
||||
return ResponseDTO.ok(goodsInfo);
|
||||
}
|
||||
}
|
|
@ -11,4 +11,6 @@ public class GetBalanceResponse {
|
|||
private String userid;
|
||||
private String corpid;
|
||||
private BigDecimal balance;
|
||||
private BigDecimal useBalance;
|
||||
private BigDecimal balanceLimit;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package com.agileboot.api.controller;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.agileboot.common.constant.OpenApiConstants;
|
||||
import com.agileboot.common.core.dto.ResponseDTO;
|
||||
import com.agileboot.domain.shop.payment.SignUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class CabinetControllerTest {
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetConsumablesCabinetList() {
|
||||
// 1. 准备请求参数
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("timestamp", String.valueOf(new Date().getTime()));
|
||||
|
||||
// 2. 生成签名
|
||||
String appKey = OpenApiConstants.appKey;
|
||||
String sign = SignUtils.openSign(appKey, params);
|
||||
params.put("sign", sign);
|
||||
|
||||
// 3. 构建请求体
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String key : params.keySet()) {
|
||||
if (sb.length() > 0) {
|
||||
sb.append("&");
|
||||
}
|
||||
sb.append(key).append("=").append(params.get(key));
|
||||
}
|
||||
|
||||
// 4. 发送请求
|
||||
System.out.println("Request: " + sb.toString());
|
||||
System.out.println("sign: " + sign);
|
||||
String res = HttpUtil.post("http://localhost:8090/api/cabinets/list", sb.toString());
|
||||
|
||||
// 5. 验证响应
|
||||
System.out.println("Response: " + res);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
package com.agileboot.common.constant;
|
||||
|
||||
public class OpenApiConstants {
|
||||
public static final String appKey = "wxshop202505270821";
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.agileboot.domain.cabinet.cell;
|
||||
|
||||
import com.agileboot.common.core.page.PageDTO;
|
||||
import com.agileboot.domain.cabinet.cell.db.CabinetCellDO;
|
||||
import com.agileboot.domain.cabinet.cell.dto.CabinetCellWithOrderCountDTO;
|
||||
import com.agileboot.domain.cabinet.cell.query.SearchCabinetCellWithOrdersQuery;
|
||||
import com.agileboot.domain.common.command.BulkOperationCommand;
|
||||
|
@ -95,4 +96,8 @@ public class CabinetCellApplicationService {
|
|||
public Long countLinkedRecord() {
|
||||
return cabinetCellService.countLinkedRecord();
|
||||
}
|
||||
|
||||
public List<CabinetCellDO> selectCabinetCellDOList(Long cabinetId) {
|
||||
return cabinetCellService.selectCabinetCellDOList(cabinetId);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
package com.agileboot.domain.cabinet.cell.db;
|
||||
|
||||
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("cabinet_cell")
|
||||
@ApiModel(value = "CabinetCellDO对象", description = "柜机格口信息表")
|
||||
public class CabinetCellDO {
|
||||
@ApiModelProperty("格口唯一ID")
|
||||
@TableId(value = "cell_id", type = IdType.AUTO)
|
||||
private Long cellId;
|
||||
|
||||
@ApiModelProperty("关联柜机ID")
|
||||
@TableField("cabinet_id")
|
||||
private Long cabinetId;
|
||||
|
||||
@ApiModelProperty("格口号")
|
||||
@TableField("cell_no")
|
||||
private Integer cellNo;
|
||||
|
||||
@ApiModelProperty("格口类型(1小格 2中格 3大格 4超大格)")
|
||||
@TableField("cell_type")
|
||||
private Integer cellType;
|
||||
|
||||
@ApiModelProperty("使用状态(1空闲 2已占用)")
|
||||
@TableField("usage_status")
|
||||
private Integer usageStatus;
|
||||
|
||||
@ApiModelProperty("可用状态(1正常 2故障)")
|
||||
@TableField("available_status")
|
||||
private Integer availableStatus;
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package com.agileboot.domain.cabinet.cell.db;
|
||||
|
||||
import com.agileboot.domain.cabinet.cell.dto.CabinetCellWithOrderCountDTO;
|
||||
import com.agileboot.domain.cabinet.smartCabinet.db.SmartCabinetDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
|
@ -67,4 +68,10 @@ public interface CabinetCellMapper extends BaseMapper<CabinetCellEntity> {
|
|||
|
||||
@Select("SELECT COUNT(1) FROM cabinet_cell WHERE deleted = 0 AND goods_id IS NOT NULL")
|
||||
Long countLinkedRecord();
|
||||
|
||||
@Select("SELECT * " +
|
||||
"FROM cabinet_cell " +
|
||||
"WHERE cabinet_id = #{cabinet_id} AND deleted = 0 " +
|
||||
"ORDER BY cell_id ASC")
|
||||
List<CabinetCellDO> selectCabinetCellDOList(@Param("cabinetId") Long cabinetId);
|
||||
}
|
||||
|
|
|
@ -35,4 +35,6 @@ public interface CabinetCellService extends IService<CabinetCellEntity> {
|
|||
Long countAllRecord();
|
||||
|
||||
Long countLinkedRecord();
|
||||
|
||||
List<CabinetCellDO> selectCabinetCellDOList(Long cabinetId);
|
||||
}
|
||||
|
|
|
@ -56,4 +56,9 @@ public class CabinetCellServiceImpl extends ServiceImpl<CabinetCellMapper, Cabin
|
|||
public Long countLinkedRecord() {
|
||||
return baseMapper.countLinkedRecord();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CabinetCellDO> selectCabinetCellDOList(Long cabinetId) {
|
||||
return baseMapper.selectCabinetCellDOList(cabinetId);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.agileboot.domain.cabinet.cell.model.CabinetCellModelFactory;
|
|||
import com.agileboot.domain.cabinet.mainboard.command.AddCabinetMainboardCommand;
|
||||
import com.agileboot.domain.cabinet.mainboard.model.CabinetMainboardModel;
|
||||
import com.agileboot.domain.cabinet.mainboard.model.CabinetMainboardModelFactory;
|
||||
import com.agileboot.domain.cabinet.smartCabinet.db.SmartCabinetDO;
|
||||
import com.agileboot.domain.cabinet.smartCabinet.dto.CabinetDetailDTO;
|
||||
import com.agileboot.domain.common.command.BulkOperationCommand;
|
||||
import com.agileboot.domain.cabinet.smartCabinet.command.AddSmartCabinetCommand;
|
||||
|
@ -23,6 +24,7 @@ import com.agileboot.domain.shop.goods.db.ShopGoodsEntity;
|
|||
import com.agileboot.domain.shop.goods.db.ShopGoodsService;
|
||||
import com.agileboot.domain.shop.shop.db.ShopEntity;
|
||||
import com.agileboot.domain.shop.shop.db.ShopService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -222,4 +224,8 @@ public class SmartCabinetApplicationService {
|
|||
public Long countAllRecord() {
|
||||
return smartCabinetService.countAllRecord();
|
||||
}
|
||||
|
||||
public List<SmartCabinetDO> getConsumablesCabinetList() {
|
||||
return smartCabinetService.selectSmartCabinetDOList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
package com.agileboot.domain.cabinet.smartCabinet.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 io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("smart_cabinet")
|
||||
@ApiModel(value = "SmartCabinetDO对象", description = "智能柜信息表")
|
||||
public class SmartCabinetDO {
|
||||
|
||||
@ApiModelProperty("柜机唯一ID")
|
||||
@TableId(value = "cabinet_id", type = IdType.AUTO)
|
||||
private Long cabinetId;
|
||||
|
||||
@ApiModelProperty("柜机名称")
|
||||
@TableField("cabinet_name")
|
||||
private String cabinetName;
|
||||
|
||||
@ApiModelProperty("柜机模版编号")
|
||||
@TableField("template_no")
|
||||
private String templateNo;
|
||||
|
||||
@ApiModelProperty("格口数量")
|
||||
@TableField(exist = false)
|
||||
private Integer cellCount;
|
||||
}
|
|
@ -71,6 +71,11 @@ public class SmartCabinetEntity extends BaseEntity<SmartCabinetEntity> {
|
|||
@TableField("location")
|
||||
private Integer location;
|
||||
|
||||
@ApiModelProperty("已用格口数")
|
||||
private Integer usedCells;
|
||||
|
||||
@ApiModelProperty("未用格口数")
|
||||
private Integer availableCells;
|
||||
|
||||
@Override
|
||||
public Serializable pkVal() {
|
||||
|
|
|
@ -17,9 +17,12 @@ import java.util.List;
|
|||
* @since 2025-03-17
|
||||
*/
|
||||
public interface SmartCabinetMapper extends BaseMapper<SmartCabinetEntity> {
|
||||
@Select("SELECT sc.*, scl.cabinet_name AS mainCabinetName " +
|
||||
@Select("SELECT sc.*, scl.cabinet_name AS mainCabinetName, " +
|
||||
"SUM(CASE WHEN cc.usage_status = 2 AND cc.deleted = 0 THEN 1 ELSE 0 END) AS usedCells, " +
|
||||
"SUM(CASE WHEN cc.usage_status = 1 AND cc.deleted = 0 THEN 1 ELSE 0 END) AS availableCells " +
|
||||
"FROM smart_cabinet sc " +
|
||||
"LEFT JOIN smart_cabinet scl ON scl.cabinet_id = sc.main_cabinet " +
|
||||
"LEFT JOIN cabinet_cell cc ON cc.cabinet_id = sc.cabinet_id " +
|
||||
"${ew.customSqlSegment}")
|
||||
Page<SmartCabinetEntity> getCabinetList(
|
||||
Page<SmartCabinetEntity> page,
|
||||
|
@ -51,4 +54,12 @@ public interface SmartCabinetMapper extends BaseMapper<SmartCabinetEntity> {
|
|||
|
||||
@Select("SELECT COUNT(1) FROM smart_cabinet WHERE deleted = 0")
|
||||
Long countAllRecord();
|
||||
|
||||
@Select("SELECT sc.*, COUNT(cc.cell_id) AS cell_count " +
|
||||
"FROM smart_cabinet sc " +
|
||||
"LEFT JOIN cabinet_cell cc ON cc.cabinet_id = sc.cabinet_id AND cc.deleted = 0 " +
|
||||
"WHERE sc.belong_type = 1 AND sc.deleted = 0 " +
|
||||
"GROUP BY sc.cabinet_id " +
|
||||
"ORDER BY sc.create_time DESC")
|
||||
List<SmartCabinetDO> selectSmartCabinetDOList();
|
||||
}
|
||||
|
|
|
@ -24,4 +24,6 @@ public interface SmartCabinetService extends IService<SmartCabinetEntity> {
|
|||
SmartCabinetEntity getByCabinetId(Long cabinetId);
|
||||
|
||||
Long countAllRecord();
|
||||
|
||||
List<SmartCabinetDO> selectSmartCabinetDOList();
|
||||
}
|
||||
|
|
|
@ -45,4 +45,9 @@ public class SmartCabinetServiceImpl extends ServiceImpl<SmartCabinetMapper, Sma
|
|||
return baseMapper.countAllRecord();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SmartCabinetDO> selectSmartCabinetDOList() {
|
||||
return baseMapper.selectSmartCabinetDOList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,11 +17,6 @@ public class SmartCabinetDTO {
|
|||
public SmartCabinetDTO(SmartCabinetEntity entity) {
|
||||
if (entity != null) {
|
||||
BeanUtil.copyProperties(entity, this);
|
||||
|
||||
/* SysUserEntity creator = CacheCenter.userCache.getObjectById(entity.getOperId());
|
||||
if (creator != null) {
|
||||
this.operator = creator.getUsername();
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,6 +56,9 @@ public class SmartCabinetDTO {
|
|||
@ExcelColumn(name = "柜机位置")
|
||||
private Integer location;
|
||||
|
||||
@ExcelColumn(name = "操作人")
|
||||
private String operator;
|
||||
@ExcelColumn(name = "已用格口数")
|
||||
private Integer usedCells;
|
||||
|
||||
@ExcelColumn(name = "未用格口数")
|
||||
private Integer availableCells;
|
||||
}
|
|
@ -33,7 +33,8 @@ public class SearchSmartCabinetQuery<T> extends AbstractPageQuery<T> {
|
|||
.eq(belongType!= null, "sc.belong_type", belongType)
|
||||
.eq(StrUtil.isNotEmpty(templateNo), "sc.template_no", templateNo)
|
||||
.eq("sc.deleted", false)
|
||||
.between(startTime != null && endTime != null, "sc.create_time", startTime, endTime);
|
||||
.between(startTime != null && endTime != null, "sc.create_time", startTime, endTime)
|
||||
.groupBy("sc.cabinet_id");
|
||||
|
||||
this.timeRangeColumn = "create_time";
|
||||
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package com.agileboot.domain.cabinet.smartCabinet.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class CabinetVO {
|
||||
|
||||
private Long cabinetId;
|
||||
}
|
|
@ -10,6 +10,7 @@ import com.agileboot.domain.qywx.user.command.UpdateQyUserCommand;
|
|||
import com.agileboot.domain.qywx.user.db.QyUserEntity;
|
||||
import com.agileboot.domain.qywx.user.db.QyUserService;
|
||||
import com.agileboot.domain.qywx.user.dto.QyUserDTO;
|
||||
import com.agileboot.domain.qywx.user.dto.QyUserStatsDTO;
|
||||
import com.agileboot.domain.qywx.user.model.UserModel;
|
||||
import com.agileboot.domain.qywx.user.model.QyUserModelFactory;
|
||||
import com.agileboot.domain.qywx.user.query.SearchQyUserQuery;
|
||||
|
@ -74,6 +75,9 @@ public class QyUserApplicationService {
|
|||
|
||||
public void updateUser(UpdateQyUserCommand command) {
|
||||
UserModel model = qyUserModelFactory.loadById(command.getId());
|
||||
if (command.getBalanceLimit() != null && command.getBalance() == null) {
|
||||
command.setBalance(command.getBalanceLimit().subtract(model.getUseBalance()));
|
||||
}
|
||||
model.loadUpdateCommand(command);
|
||||
model.updateById();
|
||||
|
||||
|
@ -136,7 +140,7 @@ public class QyUserApplicationService {
|
|||
}
|
||||
}
|
||||
|
||||
public BigDecimal selectTotalBalance(String corpid) {
|
||||
public QyUserStatsDTO selectTotalBalance(String corpid) {
|
||||
return userService.selectTotalBalance(corpid);
|
||||
}
|
||||
}
|
|
@ -148,6 +148,14 @@ public class QyUserEntity extends BaseEntity<QyUserEntity> {
|
|||
@TableField("balance")
|
||||
private BigDecimal balance;
|
||||
|
||||
@ApiModelProperty("已使用用户余额")
|
||||
@TableField("use_balance")
|
||||
private BigDecimal useBalance;
|
||||
|
||||
@ApiModelProperty("用户余额额度")
|
||||
@TableField("balance_limit")
|
||||
private BigDecimal balanceLimit;
|
||||
|
||||
@ApiModelProperty("系统角色id")
|
||||
@TableField("sys_role_id")
|
||||
private Long sysRoleId;
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package com.agileboot.domain.qywx.user.db;
|
||||
|
||||
import com.agileboot.domain.qywx.user.dto.QyUserStatsDTO;
|
||||
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 java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
@ -45,14 +45,14 @@ public interface QyUserMapper extends BaseMapper<QyUserEntity> {
|
|||
"AND sr.role_key = 'admin'")
|
||||
List<String> selectAdminUserIds();
|
||||
|
||||
@Select("SELECT SUM(balance) " +
|
||||
@Select("SELECT SUM(balance) AS balance, SUM(use_balance) AS useBalance, SUM(balance_limit) AS balanceLimit " +
|
||||
"FROM qy_user " +
|
||||
"WHERE deleted = 0")
|
||||
BigDecimal selectTotalBalance();
|
||||
QyUserStatsDTO selectTotalBalance();
|
||||
|
||||
@Select("SELECT SUM(balance) " +
|
||||
@Select("SELECT SUM(balance) AS balance, SUM(use_balance) AS useBalance, SUM(balance_limit) AS balanceLimit " +
|
||||
"FROM qy_user " +
|
||||
"WHERE deleted = 0 AND corpid = #{corpid}")
|
||||
BigDecimal selectTotalBalanceByCorpid(@Param("corpid") String corpid);
|
||||
QyUserStatsDTO selectTotalBalanceByCorpid(@Param("corpid") String corpid);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.agileboot.domain.qywx.user.db;
|
||||
|
||||
import com.agileboot.common.core.page.AbstractPageQuery;
|
||||
import com.agileboot.domain.qywx.user.dto.QyUserStatsDTO;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
|
@ -25,5 +26,5 @@ public interface QyUserService extends IService<QyUserEntity> {
|
|||
|
||||
List<String> selectAdminUserIds();
|
||||
|
||||
BigDecimal selectTotalBalance(String corpid);
|
||||
QyUserStatsDTO selectTotalBalance(String corpid);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.agileboot.domain.qywx.user.db;
|
||||
|
||||
import com.agileboot.domain.qywx.user.dto.QyUserStatsDTO;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -16,7 +17,6 @@ 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.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
@ -48,7 +48,7 @@ public class QyUserServiceImpl extends ServiceImpl<QyUserMapper, QyUserEntity> i
|
|||
}
|
||||
|
||||
@Override
|
||||
public BigDecimal selectTotalBalance(String corpid) {
|
||||
public QyUserStatsDTO selectTotalBalance(String corpid) {
|
||||
if (StringUtils.isBlank(corpid)) {
|
||||
return baseMapper.selectTotalBalance();
|
||||
} else {
|
||||
|
|
|
@ -106,6 +106,12 @@ public class QyUserDTO {
|
|||
@ExcelColumn(name = "用户余额")
|
||||
private BigDecimal balance;
|
||||
|
||||
@ExcelColumn(name = "已使用用户余额")
|
||||
private BigDecimal useBalance;
|
||||
|
||||
@ExcelColumn(name = "用户余额额度")
|
||||
private BigDecimal balanceLimit;
|
||||
|
||||
@ExcelColumn(name = "系统角色ID")
|
||||
private Long sysRoleId;
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package com.agileboot.domain.qywx.user.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class QyUserStatsDTO {
|
||||
|
||||
// 用户剩余余额
|
||||
private BigDecimal balance;
|
||||
|
||||
// 已使用余额
|
||||
private BigDecimal useBalance;
|
||||
|
||||
// 余额额度
|
||||
private BigDecimal balanceLimit;
|
||||
}
|
|
@ -192,6 +192,7 @@ public class ReturnApprovalApplicationService {
|
|||
QyUserEntity qyUser = userService.getUserByUserId(userid, WeixinConstants.corpid);
|
||||
if (null != qyUser) {
|
||||
qyUser.setBalance(qyUser.getBalance().add(command.getReturnAmount()));
|
||||
qyUser.setUseBalance(qyUser.getUseBalance().subtract(command.getReturnAmount()));
|
||||
}
|
||||
userService.updateById(qyUser);
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -10,8 +10,6 @@ import com.agileboot.domain.cabinet.cell.db.CabinetCellEntity;
|
|||
import com.agileboot.domain.cabinet.cell.db.CabinetCellService;
|
||||
import com.agileboot.domain.cabinet.mainboard.db.CabinetMainboardEntity;
|
||||
import com.agileboot.domain.cabinet.mainboard.db.CabinetMainboardService;
|
||||
import com.agileboot.domain.cabinet.mainboard.model.CabinetMainboardModel;
|
||||
import com.agileboot.domain.cabinet.mainboard.model.CabinetMainboardModelFactory;
|
||||
import com.agileboot.domain.cabinet.operation.command.AddCabinetCellOperationCommand;
|
||||
import com.agileboot.domain.cabinet.operation.model.CabinetCellOperationModel;
|
||||
import com.agileboot.domain.cabinet.operation.model.CabinetCellOperationModelFactory;
|
||||
|
@ -21,7 +19,6 @@ import com.agileboot.domain.common.command.BulkOperationCommand;
|
|||
import com.agileboot.domain.mqtt.MqttService;
|
||||
import com.agileboot.domain.qywx.user.db.QyUserEntity;
|
||||
import com.agileboot.domain.qywx.user.db.QyUserService;
|
||||
import com.agileboot.domain.qywx.user.model.QyUserModelFactory;
|
||||
import com.agileboot.domain.shop.goods.db.ShopGoodsEntity;
|
||||
import com.agileboot.domain.shop.goods.db.ShopGoodsService;
|
||||
import com.agileboot.domain.shop.order.command.SubmitOrderCommand;
|
||||
|
@ -29,7 +26,6 @@ import com.agileboot.domain.shop.order.db.*;
|
|||
import com.agileboot.domain.shop.order.db.dto.OrderWithGoodsDTO;
|
||||
import com.agileboot.domain.shop.order.dto.CreateOrderResult;
|
||||
import com.agileboot.domain.shop.order.dto.GetOrdersByOpenIdDTO;
|
||||
import com.agileboot.domain.shop.order.dto.ShopOrderDTO;
|
||||
import com.agileboot.domain.shop.order.dto.TopGoodsDTO;
|
||||
import com.agileboot.domain.shop.order.model.OrderModel;
|
||||
import com.agileboot.domain.shop.order.model.OrderModelFactory;
|
||||
|
@ -54,8 +50,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
||||
import org.checkerframework.checker.units.qual.s;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -74,7 +68,6 @@ public class OrderApplicationService {
|
|||
private final SmartCabinetService smartCabinetService;
|
||||
private final MqttService mqttService;
|
||||
private final QyUserService userService;
|
||||
private final QyUserModelFactory qyUserModelFactory;
|
||||
private final CabinetCellOperationModelFactory cabinetCellOperationModelFactory;
|
||||
private final PaymentOperationLogApplicationService paymentOperationLogApplicationService;
|
||||
private final CabinetMainboardService cabinetMainboardService;
|
||||
|
@ -192,6 +185,7 @@ public class OrderApplicationService {
|
|||
throw new ApiException(ErrorCode.Client.COMMON_REQUEST_PARAMETERS_INVALID, "余额不足");
|
||||
} else {
|
||||
qyUser.setBalance(qyUser.getBalance().subtract(orderModel.getTotalAmount()));
|
||||
qyUser.setUseBalance(qyUser.getUseBalance().add(orderModel.getTotalAmount()));
|
||||
userService.updateById(qyUser);
|
||||
}
|
||||
// 金额转换(元转分)并四舍五入
|
||||
|
|
|
@ -53,6 +53,11 @@ public class RoleApplicationService {
|
|||
return new PageDTO<>(records, page.getTotal());
|
||||
}
|
||||
|
||||
public List<RoleDTO> getRoleAll(RoleQuery query) {
|
||||
return roleService.list(query.toQueryWrapper())
|
||||
.stream().map(RoleDTO::new).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public RoleDTO getRoleInfo(Long roleId) {
|
||||
SysRoleEntity byId = roleService.getById(roleId);
|
||||
RoleDTO roleDTO = new RoleDTO(byId);
|
||||
|
|
|
@ -48,5 +48,5 @@ public interface SysRoleService extends IService<SysRoleEntity> {
|
|||
*/
|
||||
List<SysMenuEntity> getMenuListByRoleId(Long roleId);
|
||||
|
||||
|
||||
SysRoleEntity getByRoleKey(String roleKey);
|
||||
}
|
||||
|
|
|
@ -51,5 +51,13 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRoleEntity
|
|||
return baseMapper.getMenuListByRoleId(roleId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysRoleEntity getByRoleKey(String roleKey) {
|
||||
QueryWrapper<SysRoleEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("role_key", roleKey)
|
||||
.eq("deleted", 0);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,3 +5,11 @@ AFTER `goods_detail`;
|
|||
ALTER TABLE `qy_user`
|
||||
ADD COLUMN `sys_role_id` BIGINT DEFAULT NULL COMMENT '系统角色id'
|
||||
AFTER `balance`;
|
||||
|
||||
ALTER TABLE `qy_user`
|
||||
ADD COLUMN `use_balance` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '已使用用户余额'
|
||||
AFTER `balance`;
|
||||
|
||||
ALTER TABLE `qy_user`
|
||||
ADD COLUMN `balance_limit` DECIMAL(15,2) NOT NULL DEFAULT '0.00' COMMENT '余额额度'
|
||||
AFTER `use_balance`;
|
Loading…
Reference in New Issue