Merge remote-tracking branch 'origin/master'
# Conflicts: # pjcloud-supermarket/pjcloud-supermarket-biz/src/main/java/com/bsd/pjcloud/supermarket/controller/SupermarketSpuController.java
This commit is contained in:
commit
aeae1fb48f
100 files changed
+1950
-320
No files matched your search
@@ -122,6 +122,12 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-mqtt-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
||||
+36
-31
@@ -32,50 +32,53 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/canteenCategory" )
|
||||
@Tag(description = "canteenCategory" , name = "菜品分类管理" )
|
||||
@RequestMapping("/canteenCategory")
|
||||
@Tag(description = "canteenCategory", name = "菜品分类管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class CanteenCategoryController {
|
||||
|
||||
private final CanteenCategoryService canteenCategoryService;
|
||||
private final CanteenCategoryService canteenCategoryService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param canteenCategory 菜品分类
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')" )
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')")
|
||||
public R getCanteenCategoryPage(@ParameterObject Page page, @ParameterObject CanteenCategoryEntity canteenCategory) {
|
||||
LambdaQueryWrapper<CanteenCategoryEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotBlank(canteenCategory.getName()),CanteenCategoryEntity::getName,canteenCategory.getName());
|
||||
wrapper.like(StrUtil.isNotBlank(canteenCategory.getName()), CanteenCategoryEntity::getName, canteenCategory.getName());
|
||||
return R.ok(canteenCategoryService.selectPageByScope(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询菜品分类
|
||||
*
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(canteenCategoryService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜品分类
|
||||
*
|
||||
* @param canteenCategory 菜品分类
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增菜品分类" , description = "新增菜品分类" )
|
||||
@SysLog("新增菜品分类" )
|
||||
@Operation(summary = "新增菜品分类", description = "新增菜品分类")
|
||||
@SysLog("新增菜品分类")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_add')" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_add')")
|
||||
public R save(@RequestBody CanteenCategoryEntity canteenCategory) {
|
||||
canteenCategory.setDeptId(SecurityUtils.getUser().getDeptId());
|
||||
return R.ok(canteenCategoryService.save(canteenCategory));
|
||||
@@ -83,26 +86,28 @@ public class CanteenCategoryController {
|
||||
|
||||
/**
|
||||
* 修改菜品分类
|
||||
*
|
||||
* @param canteenCategory 菜品分类
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改菜品分类" , description = "修改菜品分类" )
|
||||
@SysLog("修改菜品分类" )
|
||||
@Operation(summary = "修改菜品分类", description = "修改菜品分类")
|
||||
@SysLog("修改菜品分类")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_edit')" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_edit')")
|
||||
public R updateById(@RequestBody CanteenCategoryEntity canteenCategory) {
|
||||
return R.ok(canteenCategoryService.updateById(canteenCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除菜品分类
|
||||
*
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除菜品分类" , description = "通过id删除菜品分类" )
|
||||
@SysLog("通过id删除菜品分类" )
|
||||
@Operation(summary = "通过id删除菜品分类", description = "通过id删除菜品分类")
|
||||
@SysLog("通过id删除菜品分类")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_del')" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(canteenCategoryService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
@@ -110,14 +115,15 @@ public class CanteenCategoryController {
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
*
|
||||
* @param canteenCategory 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_export')" )
|
||||
public List<CanteenCategoryEntity> export(CanteenCategoryEntity canteenCategory,Long[] ids) {
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_export')")
|
||||
public List<CanteenCategoryEntity> export(CanteenCategoryEntity canteenCategory, Long[] ids) {
|
||||
return canteenCategoryService.list(Wrappers.lambdaQuery(canteenCategory).in(ArrayUtil.isNotEmpty(ids), CanteenCategoryEntity::getId, ids));
|
||||
}
|
||||
|
||||
@@ -126,21 +132,20 @@ public class CanteenCategoryController {
|
||||
|
||||
/**
|
||||
* 查询所有的菜品分类
|
||||
*
|
||||
* @param categoryType 餐段类型,1早餐 2中 3晚餐 不传默认所有
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/getAllSimple" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')" )
|
||||
public R getAllSimple(@RequestParam(value = "categoryType",required = false)String categoryType) {
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/getAllSimple")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenCategory_view')")
|
||||
public R getAllSimple(@RequestParam(value = "categoryType", required = false) String categoryType) {
|
||||
LambdaQueryWrapper<CanteenCategoryEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.orderByAsc(CanteenCategoryEntity::getSort);
|
||||
wrapper.apply(StringUtils.isNotEmpty(categoryType),"FIND_IN_SET({0}, your_column_name)",categoryType);
|
||||
wrapper.apply(StringUtils.isNotEmpty(categoryType), "FIND_IN_SET({0}, your_column_name)", categoryType);
|
||||
List<CanteenCategoryEntity> list = canteenCategoryService.listScope(wrapper);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+43
-38
@@ -38,24 +38,25 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/canteenDailyMenu" )
|
||||
@Tag(description = "canteenDailyMenu" , name = "每日菜谱管理" )
|
||||
@RequestMapping("/canteenDailyMenu")
|
||||
@Tag(description = "canteenDailyMenu", name = "每日菜谱管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class CanteenDailyMenuController {
|
||||
|
||||
private final CanteenDailyMenuService canteenDailyMenuService;
|
||||
private final CanteenDailyMenuService canteenDailyMenuService;
|
||||
|
||||
private final CanteenSpuService canteenSpuService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param canteenDailyMenu 每日菜谱
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_view')" )
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_view')")
|
||||
public R getCanteenDailyMenuPage(@ParameterObject Page page, @ParameterObject CanteenDailyMenuEntity canteenDailyMenu) {
|
||||
LambdaQueryWrapper<CanteenDailyMenuEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(canteenDailyMenuService.page(page, wrapper));
|
||||
@@ -64,25 +65,27 @@ public class CanteenDailyMenuController {
|
||||
|
||||
/**
|
||||
* 通过id查询每日菜谱
|
||||
*
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(canteenDailyMenuService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增每日菜谱
|
||||
*
|
||||
* @param canteenDailyMenu 每日菜谱
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增每日菜谱" , description = "新增每日菜谱" )
|
||||
@SysLog("新增每日菜谱" )
|
||||
@Operation(summary = "新增每日菜谱", description = "新增每日菜谱")
|
||||
@SysLog("新增每日菜谱")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_add')" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_add')")
|
||||
public R save(@RequestBody CanteenDailyMenuEntity canteenDailyMenu) {
|
||||
canteenDailyMenu.setDeptId(SecurityUtils.getUser().getDeptId());
|
||||
canteenDailyMenuService.saveToday(canteenDailyMenu);
|
||||
@@ -91,46 +94,48 @@ public class CanteenDailyMenuController {
|
||||
|
||||
/**
|
||||
* 修改每日菜谱
|
||||
*
|
||||
* @param canteenDailyMenu 每日菜谱
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改每日菜谱" , description = "修改每日菜谱" )
|
||||
@SysLog("修改每日菜谱" )
|
||||
@Operation(summary = "修改每日菜谱", description = "修改每日菜谱")
|
||||
@SysLog("修改每日菜谱")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_edit')" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_edit')")
|
||||
public R updateById(@RequestBody CanteenDailyMenuEntity canteenDailyMenu) {
|
||||
return R.ok(canteenDailyMenuService.updateById(canteenDailyMenu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除每日菜谱
|
||||
*
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除每日菜谱" , description = "通过id删除每日菜谱" )
|
||||
@SysLog("通过id删除每日菜谱" )
|
||||
@Operation(summary = "通过id删除每日菜谱", description = "通过id删除每日菜谱")
|
||||
@SysLog("通过id删除每日菜谱")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_del')" )
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(canteenDailyMenuService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_del')")
|
||||
public R removeById(@RequestBody Long[] ids, @RequestParam Long merchantId) {
|
||||
return R.ok(canteenDailyMenuService.delByIds(CollUtil.toList(ids), merchantId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
*
|
||||
* @param canteenDailyMenu 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_export')" )
|
||||
public List<CanteenDailyMenuEntity> export(CanteenDailyMenuEntity canteenDailyMenu,Long[] ids) {
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenDailyMenu_export')")
|
||||
public List<CanteenDailyMenuEntity> export(CanteenDailyMenuEntity canteenDailyMenu, Long[] ids) {
|
||||
return canteenDailyMenuService.list(Wrappers.lambdaQuery(canteenDailyMenu).in(ArrayUtil.isNotEmpty(ids), CanteenDailyMenuEntity::getId, ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取指定周时间
|
||||
*
|
||||
@@ -143,25 +148,25 @@ public class CanteenDailyMenuController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询每日菜谱
|
||||
*
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "菜品下拉列表" )
|
||||
@GetMapping("/selectFoodList" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')" )
|
||||
public R selectFoodList(@RequestParam(value = "spuName",required = false) String skuName) {
|
||||
@Operation(summary = "菜品下拉列表")
|
||||
@GetMapping("/selectFoodList")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')")
|
||||
public R selectFoodList(@RequestParam(value = "spuName", required = false) String skuName) {
|
||||
LambdaQueryWrapper<CanteenSpuEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotBlank(skuName),CanteenSpuEntity::getName,skuName);
|
||||
wrapper.like(StrUtil.isNotBlank(skuName), CanteenSpuEntity::getName, skuName);
|
||||
return R.ok(canteenSpuService.selectFoodList(wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当天指定菜品
|
||||
*/
|
||||
@Operation(summary = "获取当天指定菜品" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')" )
|
||||
@Operation(summary = "获取当天指定菜品")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')")
|
||||
@GetMapping("/selectTimeFood")
|
||||
public R<List<DailyMenuAll>> selectTimeFood(String time, Long merchantId, Long categoryId) {
|
||||
if (ObjectUtil.isEmpty(time)) {
|
||||
@@ -171,14 +176,14 @@ public class CanteenDailyMenuController {
|
||||
}
|
||||
|
||||
|
||||
// ---------AD------------
|
||||
// ---------AD------------
|
||||
@GetMapping("/ad/getCanteenList")
|
||||
@SysLog("查询每日菜品列表")
|
||||
public R getCanteenList(@RequestParam("day") String day,
|
||||
@RequestParam(value = "hourType", required = false) Integer hourType,
|
||||
@RequestParam(value = "categoryId", required = false) Long categoryId) {
|
||||
|
||||
return R.ok(canteenDailyMenuService.getCanteenMenuListScope(day,hourType,categoryId));
|
||||
return R.ok(canteenDailyMenuService.getCanteenMenuListScope(day, hourType, categoryId));
|
||||
}
|
||||
|
||||
// --------------APP---------------
|
||||
@@ -187,10 +192,10 @@ public class CanteenDailyMenuController {
|
||||
/**
|
||||
* 获取分页菜品
|
||||
*/
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@PostMapping("/app/page")
|
||||
public R<Page> selectTimeFoodPage(@ParameterObject Page page, @RequestBody @Validated DailyMenuDTO dailyMenuDTO) {
|
||||
return R.ok(canteenDailyMenuService.selectTimeFoodPage(page,dailyMenuDTO));
|
||||
return R.ok(canteenDailyMenuService.selectTimeFoodPage(page, dailyMenuDTO));
|
||||
}
|
||||
|
||||
|
||||
|
||||
+43
-36
@@ -37,51 +37,54 @@ import java.util.Objects;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/canteenOnlineSpu" )
|
||||
@Tag(description = "canteenOnlineSpu" , name = "在线点餐spu管理" )
|
||||
@RequestMapping("/canteenOnlineSpu")
|
||||
@Tag(description = "canteenOnlineSpu", name = "在线点餐spu管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class CanteenOnlineSpuController {
|
||||
|
||||
private final CanteenOnlineSpuService canteenOnlineSpuService;
|
||||
private final CanteenOnlineSpuService canteenOnlineSpuService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param page 分页对象
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param canteenOnlineSpu 在线点餐spu
|
||||
* @return
|
||||
*/
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_view')" )
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_view')")
|
||||
public R getCanteenOnlineSpuPage(@ParameterObject Page page, @ParameterObject CanteenOnlineSpuEntity canteenOnlineSpu) {
|
||||
LambdaQueryWrapper<CanteenOnlineSpuEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StrUtil.isNotBlank(canteenOnlineSpu.getName()),CanteenOnlineSpuEntity::getName,canteenOnlineSpu.getName());
|
||||
wrapper.eq(Objects.nonNull(canteenOnlineSpu.getCategoryId()),CanteenOnlineSpuEntity::getCategoryId,canteenOnlineSpu.getCategoryId());
|
||||
wrapper.like(StrUtil.isNotBlank(canteenOnlineSpu.getName()), CanteenOnlineSpuEntity::getName, canteenOnlineSpu.getName());
|
||||
wrapper.eq(Objects.nonNull(canteenOnlineSpu.getCategoryId()), CanteenOnlineSpuEntity::getCategoryId, canteenOnlineSpu.getCategoryId());
|
||||
return R.ok(canteenOnlineSpuService.page(page, wrapper));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id查询在线点餐spu
|
||||
*
|
||||
* @param id id
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(canteenOnlineSpuService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增在线点餐spu
|
||||
*
|
||||
* @param canteenOnlineSpu 在线点餐spu
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "新增在线点餐spu" , description = "新增在线点餐spu" )
|
||||
@SysLog("新增在线点餐spu" )
|
||||
@Operation(summary = "新增在线点餐spu", description = "新增在线点餐spu")
|
||||
@SysLog("新增在线点餐spu")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_add')" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_add')")
|
||||
public R save(@RequestBody CanteenOnlineSpuEntity canteenOnlineSpu) {
|
||||
canteenOnlineSpu.setDeptId(SecurityUtils.getUser().getDeptId());
|
||||
return R.ok(canteenOnlineSpuService.save(canteenOnlineSpu));
|
||||
@@ -89,26 +92,28 @@ public class CanteenOnlineSpuController {
|
||||
|
||||
/**
|
||||
* 修改在线点餐spu
|
||||
*
|
||||
* @param canteenOnlineSpu 在线点餐spu
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "修改在线点餐spu" , description = "修改在线点餐spu" )
|
||||
@SysLog("修改在线点餐spu" )
|
||||
@Operation(summary = "修改在线点餐spu", description = "修改在线点餐spu")
|
||||
@SysLog("修改在线点餐spu")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_edit')" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_edit')")
|
||||
public R updateById(@RequestBody CanteenOnlineSpuEntity canteenOnlineSpu) {
|
||||
return R.ok(canteenOnlineSpuService.updateById(canteenOnlineSpu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除在线点餐spu
|
||||
*
|
||||
* @param ids id列表
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过id删除在线点餐spu" , description = "通过id删除在线点餐spu" )
|
||||
@SysLog("通过id删除在线点餐spu" )
|
||||
@Operation(summary = "通过id删除在线点餐spu", description = "通过id删除在线点餐spu")
|
||||
@SysLog("通过id删除在线点餐spu")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_del')" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(canteenOnlineSpuService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
@@ -116,14 +121,15 @@ public class CanteenOnlineSpuController {
|
||||
|
||||
/**
|
||||
* 导出excel 表格
|
||||
*
|
||||
* @param canteenOnlineSpu 查询条件
|
||||
* @param ids 导出指定ID
|
||||
* @param ids 导出指定ID
|
||||
* @return excel 文件流
|
||||
*/
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_export')" )
|
||||
public List<CanteenOnlineSpuEntity> export(CanteenOnlineSpuEntity canteenOnlineSpu,Long[] ids) {
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenOnlineSpu_export')")
|
||||
public List<CanteenOnlineSpuEntity> export(CanteenOnlineSpuEntity canteenOnlineSpu, Long[] ids) {
|
||||
return canteenOnlineSpuService.list(Wrappers.lambdaQuery(canteenOnlineSpu).in(ArrayUtil.isNotEmpty(ids), CanteenOnlineSpuEntity::getId, ids));
|
||||
}
|
||||
|
||||
@@ -138,16 +144,16 @@ public class CanteenOnlineSpuController {
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/app/getCanteenSpuList")
|
||||
@Operation(summary = "获取在线点餐的菜品列表" , description = "1.通过分类id,可以不填,默认查全部,2.商户id,必传" )
|
||||
@Operation(summary = "获取在线点餐的菜品列表", description = "1.通过分类id,可以不填,默认查全部,2.商户id,必传")
|
||||
public R<List<APPOnlineSpuVO>> getCanteenSpuList(@RequestParam(value = "categoryId", required = false) String categoryId,
|
||||
@RequestParam(value = "merchantId") String merchantId ) {
|
||||
return canteenOnlineSpuService.getCanteenOnlineSpuList(categoryId,merchantId);
|
||||
@RequestParam(value = "merchantId") String merchantId) {
|
||||
return canteenOnlineSpuService.getCanteenOnlineSpuList(categoryId, merchantId);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/app/getCanteenSpuDetails")
|
||||
@Operation(summary = "获取详情接口" , description = "通过spu的id" )
|
||||
public R<APPOnlineSpuVO> getCanteenSpuDetails(@RequestParam(value = "id") Long id ) {
|
||||
@Operation(summary = "获取详情接口", description = "通过spu的id")
|
||||
public R<APPOnlineSpuVO> getCanteenSpuDetails(@RequestParam(value = "id") Long id) {
|
||||
CanteenOnlineSpuEntity canteenOnlineSpuEntity = canteenOnlineSpuService.getById(id);
|
||||
APPOnlineSpuVO bean = BeanUtils.toBean(canteenOnlineSpuEntity, APPOnlineSpuVO.class);
|
||||
return R.ok(bean);
|
||||
@@ -157,12 +163,12 @@ public class CanteenOnlineSpuController {
|
||||
@GetMapping("/app/checkSpuStock")
|
||||
@SysLog("购物车效验库存")
|
||||
@Transactional
|
||||
public R checkSpuStock(@RequestParam(value ="spuId")Long spuId,@RequestParam("incrCount")Integer incrCount) {
|
||||
public R checkSpuStock(@RequestParam(value = "spuId") Long spuId, @RequestParam("incrCount") Integer incrCount) {
|
||||
CanteenOnlineSpuEntity canteenOnlineSpuEntity = canteenOnlineSpuService.getById(spuId);
|
||||
if (canteenOnlineSpuEntity == null) {
|
||||
R.failed("商品不存在");
|
||||
return R.failed("商品不存在");
|
||||
}
|
||||
if (canteenOnlineSpuEntity.getStock()<Math.abs(incrCount)){
|
||||
if (canteenOnlineSpuEntity.getStock() < Math.abs(incrCount)) {
|
||||
return R.failed("库存不足");
|
||||
}
|
||||
return R.ok();
|
||||
@@ -179,12 +185,13 @@ public class CanteenOnlineSpuController {
|
||||
|
||||
/**
|
||||
* 通过ids查询菜品spu
|
||||
*
|
||||
* @param ids ids
|
||||
* @return R
|
||||
*/
|
||||
@Operation(summary = "通过ids查询" , description = "通过ids查询" )
|
||||
@PostMapping("/app/getSpuListByIds" )
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')" )
|
||||
@Operation(summary = "通过ids查询", description = "通过ids查询")
|
||||
@PostMapping("/app/getSpuListByIds")
|
||||
@PreAuthorize("@pms.hasPermission('canteen_canteenSpu_view')")
|
||||
public R<List<CanteenOnlineSpuAppVO>> getByIds(@RequestBody List<Long> ids) {
|
||||
List<CanteenOnlineSpuEntity> list = canteenOnlineSpuService.list(new LambdaQueryWrapper<CanteenOnlineSpuEntity>().in(CanteenOnlineSpuEntity::getId, ids));
|
||||
List<CanteenOnlineSpuAppVO> canteenOnlineSpuAppVOS = BeanUtils.toBean(list, CanteenOnlineSpuAppVO.class);
|
||||
|
||||
+6
@@ -6,6 +6,7 @@ import com.bsd.pjcloud.canteen.dto.DailyMenuAll;
|
||||
import com.bsd.pjcloud.canteen.dto.app.DailyMenuDTO;
|
||||
import com.bsd.pjcloud.canteen.entity.CanteenDailyMenuEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public interface CanteenDailyMenuService extends IService<CanteenDailyMenuEntity> {
|
||||
@@ -13,6 +14,7 @@ public interface CanteenDailyMenuService extends IService<CanteenDailyMenuEntity
|
||||
|
||||
/**
|
||||
* 获取当天指定菜品
|
||||
*
|
||||
* @param time
|
||||
* @param merchantId
|
||||
* @param categoryId
|
||||
@@ -23,6 +25,7 @@ public interface CanteenDailyMenuService extends IService<CanteenDailyMenuEntity
|
||||
|
||||
/**
|
||||
* 获取指定周时间
|
||||
*
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
@@ -31,9 +34,12 @@ public interface CanteenDailyMenuService extends IService<CanteenDailyMenuEntity
|
||||
|
||||
void saveToday(CanteenDailyMenuEntity canteenDailyMenu);
|
||||
|
||||
Boolean delByIds(ArrayList<Long> list, Long merchantId);
|
||||
|
||||
|
||||
/**
|
||||
* ad机获取每次菜品
|
||||
*
|
||||
* @param day
|
||||
* @param hourType
|
||||
* @param categoryId
|
||||
|
||||
+19
-12
@@ -1,5 +1,6 @@
|
||||
package com.bsd.pjcloud.canteen.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.nacos.common.utils.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -14,6 +15,9 @@ import com.bsd.pjcloud.canteen.mapper.CanteenDailyMenuMapper;
|
||||
import com.bsd.pjcloud.canteen.service.CanteenDailyMenuService;
|
||||
import com.bsd.pjcloud.canteen.vo.app.DailyMenuAppVO;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.mqtt.api.feign.RemoteMqttEventService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -35,8 +39,11 @@ import java.util.stream.Collectors;
|
||||
@AllArgsConstructor
|
||||
public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMapper, CanteenDailyMenuEntity> implements CanteenDailyMenuService {
|
||||
|
||||
|
||||
private final CanteenSpuService canteenSpuService;
|
||||
|
||||
private final RemoteMqttEventService remoteMqttEventService;
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
@Override
|
||||
public List<DailyMenuAll> selectTimeFood(String time, Long merchantId, Long categoryId) {
|
||||
List<DailyMenuAll> dailyMenuAllES = new ArrayList<>();
|
||||
@@ -84,7 +91,6 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
|
||||
@Override
|
||||
public void saveToday(CanteenDailyMenuEntity canteenDailyMenu) {
|
||||
|
||||
canteenDailyMenu.getSpuIds().forEach(x -> {
|
||||
CanteenDailyMenuEntity todayDO = new CanteenDailyMenuEntity();
|
||||
BeanUtils.copyProperties(canteenDailyMenu, todayDO);
|
||||
@@ -92,19 +98,20 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
baseMapper.insert(todayDO);
|
||||
});
|
||||
// 发送mq消息
|
||||
//todo 邓的mq
|
||||
// EventDto eventDto = new EventDto()
|
||||
// .setHardwareType(HardwareTypeEnum.CANTEEN)
|
||||
// .setHardwareId(null);
|
||||
// CookbookProductEvent productEvent = new CookbookProductEvent(this, eventDto);
|
||||
// eventPublisher.publishEvent(productEvent);
|
||||
remoteMqttEventService.sendCanteenProductChangeMsg(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean delByIds(ArrayList<Long> list, Long merchantId) {
|
||||
baseMapper.deleteByIds(list);
|
||||
// 发送mq消息
|
||||
remoteMqttEventService.sendCanteenProductChangeMsg(null);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCanteenMenuListScope(String day, Integer hourType, Long categoryId) {
|
||||
return baseMapper.getCanteenMenuList(day, hourType, categoryId,DataScope.of());
|
||||
return baseMapper.getCanteenMenuList(day, hourType, categoryId, DataScope.of());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,9 +126,9 @@ public class CanteenDailyMenuServiceImpl extends ServiceImpl<CanteenDailyMenuMap
|
||||
if (CollectionUtils.isNotEmpty(canteenDailyMenuEntities)) {
|
||||
List<Long> spuIds = canteenDailyMenuEntities.stream().map(CanteenDailyMenuEntity::getSpuId).distinct().collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CanteenSpuEntity> onlineFoodSpuDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
onlineFoodSpuDOLambdaQueryWrapper.eq(null!=dailyMenuDTO.getCategoryId(),CanteenSpuEntity::getCategoryId, dailyMenuDTO.getCategoryId());
|
||||
onlineFoodSpuDOLambdaQueryWrapper.eq(null != dailyMenuDTO.getCategoryId(), CanteenSpuEntity::getCategoryId, dailyMenuDTO.getCategoryId());
|
||||
onlineFoodSpuDOLambdaQueryWrapper.in(CanteenSpuEntity::getId, spuIds);
|
||||
List<CanteenSpuEntity> canteenSpuEntities = canteenSpuService.list(onlineFoodSpuDOLambdaQueryWrapper);
|
||||
List<CanteenSpuEntity> canteenSpuEntities = canteenSpuService.list(onlineFoodSpuDOLambdaQueryWrapper);
|
||||
// 按 id 分组成 Map
|
||||
Map<Long, CanteenSpuEntity> spuEntityMap = canteenSpuEntities.stream()
|
||||
.collect(Collectors.toMap(CanteenSpuEntity::getId, spu -> spu));
|
||||
|
||||
+7
-13
@@ -36,24 +36,18 @@ public class CanteenOnlineSpuServiceImpl extends ServiceImpl<CanteenOnlineSpuMap
|
||||
@Override
|
||||
public R updateOnlineSpuSkuStock(CanteenOnlineSpuUpdateStockReqDTO canteenOnlineSpuUpdateStockReqDTO) {
|
||||
// 更新 SKU 库存
|
||||
canteenOnlineSpuUpdateStockReqDTO.getItems().forEach(item -> {
|
||||
for (CanteenOnlineSpuUpdateStockReqDTO.Item v : canteenOnlineSpuUpdateStockReqDTO.getItems()) {
|
||||
// 查询当前库存
|
||||
CanteenOnlineSpuEntity spu = baseMapper.selectById(item.getId());
|
||||
CanteenOnlineSpuEntity spu = baseMapper.selectById(v.getId());
|
||||
if (spu == null) {
|
||||
R.failed(spu.getName()+"商品不存在");
|
||||
return R.failed(spu.getName() + "商品不存在");
|
||||
}
|
||||
// 检查库存是否足够
|
||||
if (item.getIncrCount() < 0 && Math.abs(item.getIncrCount()) > spu.getStock()) {
|
||||
R.failed(spu.getName()+"库存不足,无法完成操作");
|
||||
if (v.getIncrCount() < 0 && Math.abs(v.getIncrCount()) > spu.getStock()) {
|
||||
return R.failed(spu.getName() + "库存不足,无法完成操作");
|
||||
}
|
||||
int i = baseMapper.updateStock(item.getId(), item.getIncrCount());
|
||||
// if (item.getIncrCount() <= 0) {
|
||||
// if (i == 0) {
|
||||
// R.failed("商品库存不足");
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
baseMapper.updateStock(v.getId(), v.getIncrCount());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
+5
@@ -86,4 +86,9 @@ public interface ServiceNameConstants {
|
||||
* 硬件模块
|
||||
*/
|
||||
String HARDWARE_SERVICE = "pjcloud-hardware-biz";
|
||||
|
||||
/**
|
||||
* mqtt模块
|
||||
*/
|
||||
String MQTT_SERVICE = "pjcloud-mqtt-biz";
|
||||
}
|
||||
+1
-1
@@ -38,7 +38,7 @@ public class HardManagerEntity extends Model<HardManagerEntity> {
|
||||
private Long merchantId;
|
||||
|
||||
/**
|
||||
* 商家部门id
|
||||
* 部门id
|
||||
*/
|
||||
@Schema(description="商家部门id")
|
||||
private Long deptId;
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
<artifactId>pjcloud-hardware-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>lock4j-redis-template-spring-boot-starter</artifactId>
|
||||
<version>2.2.7</version>
|
||||
</dependency>
|
||||
<!--引入分布式事务-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
@@ -127,6 +132,12 @@
|
||||
<version>2.1.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-mqtt-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
@@ -139,7 +150,7 @@
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
@@ -149,7 +160,7 @@
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class HardInvoiceController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardInvoice_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardInvoiceDto dto) {
|
||||
return R.ok(hardInvoiceService.pageJoin(page, dto));
|
||||
return R.ok(hardInvoiceService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+25
-22
@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.common.security.util.SecurityUtils;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardInvoiceDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardManagerEntity;
|
||||
@@ -31,16 +33,16 @@ import java.util.List;
|
||||
*/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/hard-manager" )
|
||||
@Tag(description = "hard-manager" , name = "设备管理管理" )
|
||||
@RequestMapping("/hard-manager")
|
||||
@Tag(description = "hard-manager", name = "设备管理管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class HardManagerController {
|
||||
|
||||
private final HardManagerService hardManagerService;
|
||||
|
||||
@Operation(summary = "分页查询" , description = "分页查询" )
|
||||
@GetMapping("/page" )
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_view')" )
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@GetMapping("/page")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_view')")
|
||||
public R getHardManagerPage(@ParameterObject Page page, @ParameterObject HardManagerEntity hardManager) {
|
||||
LambdaQueryWrapper<HardManagerEntity> wrapper = Wrappers.lambdaQuery();
|
||||
return R.ok(hardManagerService.page(page, wrapper));
|
||||
@@ -50,45 +52,46 @@ public class HardManagerController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardInvoice_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardManagerDto dto) {
|
||||
return R.ok(hardManagerService.pageJoin(page, dto));
|
||||
return R.ok(hardManagerService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询" , description = "通过id查询" )
|
||||
@GetMapping("/{id}" )
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_view')" )
|
||||
public R getById(@PathVariable("id" ) Long id) {
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@GetMapping("/{id}")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_view')")
|
||||
public R getById(@PathVariable("id") Long id) {
|
||||
return R.ok(hardManagerService.getById(id));
|
||||
}
|
||||
|
||||
@Operation(summary = "新增设备管理" , description = "新增设备管理" )
|
||||
@SysLog("新增设备管理" )
|
||||
@Operation(summary = "新增设备管理", description = "新增设备管理")
|
||||
@SysLog("新增设备管理")
|
||||
@PostMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_add')" )
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_add')")
|
||||
public R save(@RequestBody HardManagerDto dto) {
|
||||
return R.ok(hardManagerService.create(dto));
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
return R.ok(hardManagerService.create(dto, user));
|
||||
}
|
||||
|
||||
@Operation(summary = "修改设备管理" , description = "修改设备管理" )
|
||||
@SysLog("修改设备管理" )
|
||||
@Operation(summary = "修改设备管理", description = "修改设备管理")
|
||||
@SysLog("修改设备管理")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_edit')" )
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_edit')")
|
||||
public R updateById(@RequestBody HardManagerDto dto) {
|
||||
hardManagerService.edit(dto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除设备管理" , description = "通过id删除设备管理" )
|
||||
@SysLog("通过id删除设备管理" )
|
||||
@Operation(summary = "通过id删除设备管理", description = "通过id删除设备管理")
|
||||
@SysLog("通过id删除设备管理")
|
||||
@DeleteMapping
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_del')" )
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_del')")
|
||||
public R removeById(@RequestBody Long[] ids) {
|
||||
return R.ok(hardManagerService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@GetMapping("/export")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_export')" )
|
||||
public List<HardManagerEntity> export(HardManagerEntity hardManager,Long[] ids) {
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardManager_export')")
|
||||
public List<HardManagerEntity> export(HardManagerEntity hardManager, Long[] ids) {
|
||||
return hardManagerService.list(Wrappers.lambdaQuery(hardManager).in(ArrayUtil.isNotEmpty(ids), HardManagerEntity::getId, ids));
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -119,7 +119,7 @@ public class HardAfterSaleController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardAfterSale_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardAfterSaleDto dto) {
|
||||
return R.ok(hardAfterSaleService.pageJoin(page, dto));
|
||||
return R.ok(hardAfterSaleService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ public class HardOrderController {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
dto.setIsFindCarList(true);
|
||||
return R.ok(hardwareOrderService.pageJoin(page, dto));
|
||||
return R.ok(hardwareOrderService.pagejoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "app查询订单详情", description = "app查询订单详情")
|
||||
@@ -103,7 +103,7 @@ public class HardOrderController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardwareOrder_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject HardOrderDto dto) {
|
||||
return R.ok(hardwareOrderService.pageJoin(page, dto));
|
||||
return R.ok(hardwareOrderService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+15
@@ -1,6 +1,10 @@
|
||||
package com.bsd.pjcloud.hard.mapper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardInvoiceDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardInvoiceEntity;
|
||||
@@ -10,6 +14,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface HardInvoiceMapper extends PjcloudBaseMapper<HardInvoiceEntity> {
|
||||
|
||||
default Page<HardInvoiceVo> pageJoin(Page page, HardInvoiceDto dto) {
|
||||
MPJLambdaWrapper<HardInvoiceEntity> wrapper = new MPJLambdaWrapper<HardInvoiceEntity>()
|
||||
.selectAll(HardInvoiceEntity.class)
|
||||
@@ -17,4 +22,14 @@ public interface HardInvoiceMapper extends PjcloudBaseMapper<HardInvoiceEntity>
|
||||
.eqIfExists(HardInvoiceEntity::getHardOrderId, dto.getHardOrderId());
|
||||
return selectJoinPage(page, HardInvoiceVo.class, wrapper);
|
||||
}
|
||||
|
||||
default Page<HardInvoiceVo> scopePageList(Page page, HardInvoiceDto dto) {
|
||||
LambdaQueryWrapper<HardInvoiceEntity> wrapper = new LambdaQueryWrapper<HardInvoiceEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getHardId()), HardInvoiceEntity::getHardId, dto.getHardId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getHardOrderId()), HardInvoiceEntity::getHardOrderId, dto.getHardOrderId());
|
||||
Page list = selectPageByScope(page, wrapper, DataScope.of());
|
||||
list.setRecords(BeanUtils.toBean(list.getRecords(), HardInvoiceVo.class));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
+15
@@ -3,6 +3,8 @@ package com.bsd.pjcloud.hard.mapper;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardManagerEntity;
|
||||
@@ -33,4 +35,17 @@ public interface HardManagerMapper extends PjcloudBaseMapper<HardManagerEntity>
|
||||
.in(ObjectUtil.isNotEmpty(dto.getIds()), HardManagerEntity::getId, dto.getIds());
|
||||
return selectList(wrapper);
|
||||
}
|
||||
|
||||
default Page<HardManagerVo> scopePageList(Page page, HardManagerDto dto) {
|
||||
LambdaQueryWrapper<HardManagerEntity> wrapper = new LambdaQueryWrapper<HardManagerEntity>()
|
||||
.like(ObjectUtil.isNotEmpty(dto.getName()), HardManagerEntity::getName, dto.getName())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getDeptId()), HardManagerEntity::getDeptId, dto.getDeptId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getType()), HardManagerEntity::getType, dto.getType())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getType()), HardManagerEntity::getMerchantId, dto.getMerchantId())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), HardManagerEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getMerchantIds()), HardManagerEntity::getMerchantId, dto.getMerchantIds());
|
||||
Page list = selectPageByScope(page, wrapper, DataScope.of());
|
||||
list.setRecords(BeanUtils.toBean(list.getRecords(), HardManagerVo.class));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+2
-17
@@ -1,9 +1,6 @@
|
||||
package com.bsd.pjcloud.hard.mapper.order;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardAfterSaleDto;
|
||||
@@ -11,6 +8,7 @@ import com.bsd.pjcloud.hard.api.entity.order.HardAfterSaleEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardAfterSaleVo;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface HardAfterSaleMapper extends PjcloudBaseMapper<HardAfterSaleEntity> {
|
||||
@@ -21,20 +19,7 @@ public interface HardAfterSaleMapper extends PjcloudBaseMapper<HardAfterSaleEnti
|
||||
return selectJoinPage(page, HardAfterSaleVo.class, wrapper);
|
||||
}
|
||||
|
||||
default Page<HardAfterSaleVo> scopePageList(Page page, HardAfterSaleDto dto) {
|
||||
LambdaQueryWrapper<HardAfterSaleEntity> wrapper = new LambdaQueryWrapper<HardAfterSaleEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getStatus()), HardAfterSaleEntity::getStatus, dto.getStatus())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), HardAfterSaleEntity::getUserId, dto.getUserIds())
|
||||
.between(
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()),
|
||||
HardAfterSaleEntity::getCreateTime,
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[0] : null,
|
||||
ObjectUtil.isNotEmpty(dto.getCreateTimeList()) ? dto.getCreateTimeList()[1] : null
|
||||
);
|
||||
Page list = selectPageByScope(page, wrapper, DataScope.of());
|
||||
list.setRecords(BeanUtils.toBean(list.getRecords(), HardAfterSaleVo.class));
|
||||
return list;
|
||||
}
|
||||
Page<HardAfterSaleVo> scopePageJoinList(Page page, @Param("dto") HardAfterSaleDto dto, DataScope dataScope);
|
||||
|
||||
default HardAfterSaleVo join(HardAfterSaleDto dto) {
|
||||
MPJLambdaWrapper<HardAfterSaleEntity> wrapper = new MPJLambdaWrapper<HardAfterSaleEntity>()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.bsd.pjcloud.hard.common.config;
|
||||
package com.bsd.pjcloud.hard.mqtt.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
+2
@@ -14,6 +14,8 @@ public interface HardAfterSaleService extends IService<HardAfterSaleEntity> {
|
||||
|
||||
Page<HardAfterSaleVo> pageJoin(Page page, HardAfterSaleDto dto);
|
||||
|
||||
Page<HardAfterSaleVo> scopePageList(Page page, HardAfterSaleDto dto);
|
||||
|
||||
HardAfterSaleVo join(HardAfterSaleDto dto);
|
||||
|
||||
/**
|
||||
|
||||
+2
@@ -15,6 +15,8 @@ public interface HardInvoiceService extends IService<HardInvoiceEntity> {
|
||||
|
||||
Page<HardInvoiceVo> pageJoin(Page page, HardInvoiceDto dto);
|
||||
|
||||
Page<HardInvoiceVo> scopePageList(Page page, HardInvoiceDto dto);
|
||||
|
||||
/**
|
||||
* 生成发票
|
||||
* @param order
|
||||
|
||||
+4
-1
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HardBindDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardManagerEntity;
|
||||
@@ -11,7 +12,9 @@ public interface HardManagerService extends IService<HardManagerEntity> {
|
||||
|
||||
Page<HardManagerVo> pageJoin(Page page, HardManagerDto dto);
|
||||
|
||||
Long create(HardManagerDto dto);
|
||||
Page<HardManagerVo> scopePageList(Page page, HardManagerDto dto);
|
||||
|
||||
Long create(HardManagerDto dto, PjcloudUser user);
|
||||
|
||||
void edit(HardManagerDto dto);
|
||||
|
||||
|
||||
+7
-3
@@ -2,7 +2,7 @@ package com.bsd.pjcloud.hard.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HandCancelCodeDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HardCreateOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
@@ -13,7 +13,9 @@ import jakarta.validation.Valid;
|
||||
|
||||
public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
|
||||
Page<HardOrderVo> pageJoin(Page page, HardOrderDto dto);
|
||||
Page<HardOrderVo> pagejoin(Page page, HardOrderDto dto);
|
||||
|
||||
Page<HardOrderVo> scopePageList(Page page, HardOrderDto dto);
|
||||
|
||||
HardOrderVo join(Long id);
|
||||
|
||||
@@ -54,8 +56,10 @@ public interface HardOrderService extends IService<HardOrderEntity> {
|
||||
|
||||
/**
|
||||
* 扣减库存
|
||||
*
|
||||
* @param isReduce true 扣件库存 false增加库存
|
||||
*/
|
||||
void fastenerInventory(HardOrderEntity order);
|
||||
void fastenerInventory(HardOrderEntity order, YesNoEnum isReduce);
|
||||
|
||||
/**
|
||||
* 核销硬件二维码
|
||||
|
||||
+6
@@ -72,6 +72,12 @@ public class HardInvoiceServiceImpl extends ServiceImpl<HardInvoiceMapper, HardI
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<HardInvoiceVo> scopePageList(Page page, HardInvoiceDto dto) {
|
||||
Page<HardInvoiceVo> list = baseMapper.scopePageList(page, dto);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String generateInvoice(HardOrderEntity order) {
|
||||
return generateInvoice(order, null);
|
||||
|
||||
+63
-14
@@ -10,14 +10,16 @@ import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.security.service.PjcloudUser;
|
||||
import com.bsd.pjcloud.hard.api.dto.HardManagerDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.hard.HardBindDto;
|
||||
import com.bsd.pjcloud.hard.api.entity.HardManagerEntity;
|
||||
import com.bsd.pjcloud.hard.api.vo.HardManagerVo;
|
||||
import com.bsd.pjcloud.hard.mapper.HardManagerMapper;
|
||||
import com.bsd.pjcloud.hard.service.HardManagerService;
|
||||
import com.bsd.pjcloud.hard.common.config.MqttConfig;
|
||||
import com.bsd.pjcloud.hard.mqtt.config.MqttConfig;
|
||||
import com.bsd.pjcloud.hard.utils.MqTopicUtil;
|
||||
import com.bsd.pjcloud.mqtt.api.feign.RemoteMqttEventService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
@@ -46,6 +48,7 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
|
||||
private final RemoteMchService mchService;
|
||||
private final RemoteDeptService deptService;
|
||||
private final RemoteMqttEventService remoteMqttEventService;
|
||||
|
||||
@Override
|
||||
public Page<HardManagerVo> pageJoin(Page page, HardManagerDto dto) {
|
||||
@@ -53,25 +56,53 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(HardManagerVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
// 商户
|
||||
List<Long> mchIds = list.getRecords().stream().map(HardManagerVo::getMerchantId).distinct().toList();
|
||||
R<List<MchManageVo>> mchList = mchService.getByIds(mchIds);
|
||||
if (ObjectUtil.isNotEmpty(mchList.getData())) {
|
||||
WalletDataUtil.convertMchList(list.getRecords(), CollectionUtils.convertMap(mchList.getData(), MchManageVo::getId));
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
R<List<MchManageVo>> mchList = mchService.getByIds(mchIds);
|
||||
if (ObjectUtil.isNotEmpty(mchList.getData())) {
|
||||
WalletDataUtil.convertMchList(list.getRecords(), CollectionUtils.convertMap(mchList.getData(), MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long create(HardManagerDto dto) {
|
||||
public Page<HardManagerVo> scopePageList(Page page, HardManagerDto dto) {
|
||||
Page<HardManagerVo> list = baseMapper.scopePageList(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(HardManagerVo::getDeptId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
// 商户
|
||||
List<Long> mchIds = list.getRecords().stream().map(HardManagerVo::getMerchantId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
R<List<MchManageVo>> mchList = mchService.getByIds(mchIds);
|
||||
if (ObjectUtil.isNotEmpty(mchList.getData())) {
|
||||
WalletDataUtil.convertMchList(list.getRecords(), CollectionUtils.convertMap(mchList.getData(), MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long create(HardManagerDto dto, PjcloudUser user) {
|
||||
R<MchManageVo> mch = mchService.getById(dto.getMerchantId());
|
||||
Long deptId = Optional.of(mch).map(R::getData).map(MchManageVo::getDeptId).orElseThrow(() -> new RuntimeException("商户不存在"));
|
||||
dto.setDeptId(deptId);
|
||||
Long mchDeptId = Optional.of(mch).map(R::getData).map(MchManageVo::getDeptId).orElseThrow(() -> new RuntimeException("商户不存在"));
|
||||
dto.setDeptId(user.getDeptId());
|
||||
// mq地址和端口
|
||||
dto.setMqSocketAddress(mqttConfig.getAndroidAddress());
|
||||
dto.setMqSocketPort(mqttConfig.getAndroidPort());
|
||||
@@ -79,13 +110,13 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
baseMapper.insert(dto);
|
||||
// topic
|
||||
HardManagerEntity updateObj = HardManagerEntity.builder().id(dto.getId()).build();
|
||||
String topic = createMqConfigByAction(dto.getDeptId(), null, 1) + "/#";
|
||||
String topic = createMqConfigByAction(mchDeptId, null, 1) + "/#";
|
||||
updateObj.setMainTopic(topic);
|
||||
// client id
|
||||
String clientId = createMqConfigByAction(dto.getDeptId(), dto.getId(), 2);
|
||||
String clientId = createMqConfigByAction(mchDeptId, dto.getId(), 2);
|
||||
updateObj.setMqClientId(clientId);
|
||||
// username TODO 密码9位随机数字加字母
|
||||
String mqUsername = createMqConfigByAction(dto.getDeptId(), dto.getId(), 3);
|
||||
String mqUsername = createMqConfigByAction(mchDeptId, dto.getId(), 3);
|
||||
updateObj.setMqUsername(mqUsername);
|
||||
updateObj.setMqPassword(RandomUtil.randomString(9));
|
||||
baseMapper.updateById(updateObj);
|
||||
@@ -98,7 +129,22 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
if (ObjectUtil.isEmpty(detail)) {
|
||||
throw new RuntimeException("设备不存在");
|
||||
}
|
||||
R<MchManageVo> mch = mchService.getById(dto.getMerchantId());
|
||||
Long mchDeptId = Optional.of(mch).map(R::getData).map(MchManageVo::getDeptId).orElseThrow(() -> new RuntimeException("商户不存在"));
|
||||
if (!ObjectUtil.equals(dto.getMerchantId(), detail.getMerchantId())) {
|
||||
// topic
|
||||
String topic = createMqConfigByAction(mchDeptId, null, 1) + "/#";
|
||||
dto.setMainTopic(topic);
|
||||
// client id
|
||||
String clientId = createMqConfigByAction(mchDeptId, dto.getId(), 2);
|
||||
dto.setMqClientId(clientId);
|
||||
// username TODO 密码9位随机数字加字母
|
||||
String mqUsername = createMqConfigByAction(mchDeptId, dto.getId(), 3);
|
||||
dto.setMqUsername(mqUsername);
|
||||
}
|
||||
baseMapper.updateById(dto);
|
||||
// 更新mq
|
||||
remoteMqttEventService.sendConfigChangeMsg(detail.getDeptId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -116,7 +162,10 @@ public class HardManagerServiceImpl extends ServiceImpl<HardManagerMapper, HardM
|
||||
public HardManagerVo getById(Long hardId) {
|
||||
HardManagerEntity hard = baseMapper.selectById(hardId);
|
||||
HardManagerVo vo = BeanUtils.toBean(hard, HardManagerVo.class);
|
||||
vo.setMerchantDeptId(hard.getDeptId());
|
||||
MchManageVo mch = mchService.getById(hard.getMerchantId()).getData();
|
||||
if (ObjectUtil.isNotEmpty(mch)) {
|
||||
vo.setMerchantDeptId(mch.getDeptId());
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
|
||||
+29
-2
@@ -12,9 +12,11 @@ import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.refund.HardAfterSaleOperateTypeEnum;
|
||||
@@ -75,7 +77,7 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
|
||||
@Override
|
||||
public Page<HardAfterSaleVo> pageJoin(Page page, HardAfterSaleDto dto) {
|
||||
Page<HardAfterSaleVo> list = baseMapper.scopePageList(page, dto);
|
||||
Page<HardAfterSaleVo> list = baseMapper.pageJoin(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(HardAfterSaleVo::getUserId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
@@ -105,6 +107,30 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<HardAfterSaleVo> scopePageList(Page page, HardAfterSaleDto dto) {
|
||||
Page<HardAfterSaleVo> list = baseMapper.scopePageJoinList(page, dto, new DataScope());
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(HardAfterSaleVo::getUserId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(HardAfterSaleVo::getDeptId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long create(HardAfterSaleDto dto) {
|
||||
HardOrderVo order = validateOrderCanRefund(dto.getOrderId());
|
||||
@@ -179,7 +205,6 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
}
|
||||
|
||||
@Override
|
||||
@GlobalTransactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void refund(Long afterSaleId) {
|
||||
HardAfterSaleEntity afterSale = baseMapper.selectById(afterSaleId);
|
||||
@@ -230,6 +255,8 @@ public class HardAfterSaleServiceImpl extends ServiceImpl<HardAfterSaleMapper, H
|
||||
hardAfterSaleLogMapper.insert(saveLogObj);
|
||||
// 执行退款
|
||||
getSelf().refund(updateRefundObj.getId());
|
||||
// 退库存
|
||||
hardOrderService.fastenerInventory(order, YesNoEnum.NO);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.hard.service.impl.order;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.lock.annotation.Lock4j;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -111,6 +112,7 @@ public class HardCarServiceImpl extends ServiceImpl<HardCarMapper, HardCarEntity
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Lock4j(keys = {"#dto.userId"})
|
||||
public void saveOrUpload(HardCarSaveOrUpdateDto dto) {
|
||||
List<HardCreateCarDto> carList = dto.getList().stream().filter(v -> v.getProductCount() > 0).toList();
|
||||
HardParentCarEntity parentCar = getParentCar(dto.getMerchantId(), dto.getUserId(), dto.getHardType());
|
||||
|
||||
+70
-13
@@ -2,6 +2,7 @@ package com.bsd.pjcloud.hard.service.impl.order;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.dto.UserInfo;
|
||||
@@ -10,7 +11,6 @@ import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteDeptService;
|
||||
import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.canteen.api.feign.RemoteCanteenSpuService;
|
||||
import com.bsd.pjcloud.canteen.api.feign.RemoteOnlineCanteenSpuService;
|
||||
import com.bsd.pjcloud.canteen.dto.CanteenSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
@@ -40,7 +40,6 @@ import com.bsd.pjcloud.hard.service.HardCarService;
|
||||
import com.bsd.pjcloud.hard.service.HardManagerService;
|
||||
import com.bsd.pjcloud.hard.service.HardOrderService;
|
||||
import com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketSpuService;
|
||||
import com.bsd.pjcloud.supermarket.api.feign.RemoteSupermarketUnitSkuService;
|
||||
import com.bsd.pjcloud.supermarket.dto.SupermarketSpuUpdateStockReqDTO;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletCodeBizEnum;
|
||||
@@ -79,7 +78,7 @@ import java.util.Optional;
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HardwareOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrderEntity> implements HardOrderService {
|
||||
public class HardOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardOrderEntity> implements HardOrderService {
|
||||
|
||||
static private final String TAG = "订单";
|
||||
|
||||
@@ -101,7 +100,57 @@ public class HardwareOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardO
|
||||
private final HardManagerMapper hardManagerMapper;
|
||||
|
||||
@Override
|
||||
public Page<HardOrderVo> pageJoin(Page page, HardOrderDto dto) {
|
||||
public Page<HardOrderVo> pagejoin(Page page, HardOrderDto dto) {
|
||||
Page<HardOrderVo> list = baseMapper.pageJoin(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(HardOrderVo::getUserId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(HardOrderVo::getDeptId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
// 商户
|
||||
List<Long> mchIds = list.getRecords().stream().map(HardOrderVo::getMerchantId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
R<List<MchManageVo>> mchList = remoteMchService.getByIds(mchIds);
|
||||
if (ObjectUtil.isNotEmpty(mchList.getData())) {
|
||||
WalletDataUtil.convertMchList(list.getRecords(), CollectionUtils.convertMap(mchList.getData(), MchManageVo::getId));
|
||||
}
|
||||
}
|
||||
// 设备
|
||||
List<Long> hardIds = list.getRecords().stream().map(HardOrderVo::getHardId).filter(ObjectUtil::isNotEmpty).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(mchIds)) {
|
||||
HardManagerDto hardManagerDto = new HardManagerDto();
|
||||
hardManagerDto.setIds(hardIds);
|
||||
List<HardManagerEntity> hardList = hardManagerMapper.list(hardManagerDto);
|
||||
if (ObjectUtil.isNotEmpty(hardList)) {
|
||||
HardUtil.convertHardList(list.getRecords(), CollectionUtils.convertMap(hardList, HardManagerEntity::getId));
|
||||
}
|
||||
}
|
||||
// 购物车
|
||||
if (dto.getIsFindCarList()) {
|
||||
for (HardOrderVo v : list.getRecords()) {
|
||||
List<HardCarEntity> carList = hardCarService.getByParentCarId(v.getParentCarId());
|
||||
List<HardCarVo> carVoList = BeanUtils.toBean(carList, HardCarVo.class);
|
||||
v.setCarList(carVoList);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<HardOrderVo> scopePageList(Page page, HardOrderDto dto) {
|
||||
Page<HardOrderVo> list = baseMapper.scopePageList(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
@@ -239,6 +288,8 @@ public class HardwareOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardO
|
||||
baseMapper.insert(orderObj);
|
||||
// 钱包扣款
|
||||
if (isPay) getSelf().fastReduceBalance(orderObj);
|
||||
// 扣减库存
|
||||
getSelf().fastenerInventory(orderObj, YesNoEnum.YES);
|
||||
return orderObj.getId();
|
||||
}
|
||||
|
||||
@@ -296,7 +347,7 @@ public class HardwareOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardO
|
||||
// 是否需要创建二维码
|
||||
getSelf().generateCode(orderObj);
|
||||
// 扣减库存
|
||||
getSelf().fastenerInventory(orderObj);
|
||||
getSelf().fastenerInventory(orderObj, YesNoEnum.YES);
|
||||
return orderObj.getId();
|
||||
}
|
||||
|
||||
@@ -401,31 +452,35 @@ public class HardwareOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardO
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void fastenerInventory(HardOrderEntity order) {
|
||||
public void fastenerInventory(HardOrderEntity order, YesNoEnum isReduce) {
|
||||
HardTypeEnum hardTypeEnum = HardTypeEnum.valueOfByType(order.getSysType());
|
||||
HardOrderTypeEnum orderTypeEnum = HardOrderTypeEnum.valueOfByType(order.getOrderType());
|
||||
if (!ObjectUtil.isAllNotEmpty(hardTypeEnum, orderTypeEnum)) return;
|
||||
String CarErrorMsg = ObjectUtil.equals(isReduce, YesNoEnum.YES) ? "扣减库存" : "恢复库存";
|
||||
int base = ObjectUtil.equals(isReduce, YesNoEnum.YES) ? -1 : 1;
|
||||
// 食堂扣件库存
|
||||
if (ObjectUtil.equals(hardTypeEnum, HardTypeEnum.CANTEEN) && ObjectUtil.equals(orderTypeEnum, HardOrderTypeEnum.RESERVE)) {
|
||||
// 查询购物车
|
||||
List<HardCarEntity> carList = hardCarService.getByParentCarId(order.getParentCarId());
|
||||
if (ObjectUtil.isEmpty(carList)) throw new RuntimeException("扣减库存错误,购物车不存在");
|
||||
if (ObjectUtil.isEmpty(carList)) throw new RuntimeException(CarErrorMsg + "错误,购物车不存在");
|
||||
CanteenSpuUpdateStockReqDTO dto = new CanteenSpuUpdateStockReqDTO();
|
||||
List<CanteenSpuUpdateStockReqDTO.Item> list = carList.stream().map(v -> {
|
||||
CanteenSpuUpdateStockReqDTO.Item item = new CanteenSpuUpdateStockReqDTO.Item();
|
||||
item.setId(v.getProductId());
|
||||
item.setIncrCount(v.getProductCount());
|
||||
item.setIncrCount(v.getProductCount() * base);
|
||||
return item;
|
||||
}).toList();
|
||||
dto.setItems(list);
|
||||
R updateSkuStockRes = onlineCanteenSpuService.updateSkuStock(dto);
|
||||
if (updateSkuStockRes.getCode() != 0) {
|
||||
throw new RuntimeException("库存不足");
|
||||
log.info("|{}|{},失败,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto));
|
||||
throw new RuntimeException(CarErrorMsg + "错误");
|
||||
}
|
||||
log.info("|{}|{},成功,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto));
|
||||
return;
|
||||
}
|
||||
// 超市扣家库存
|
||||
if (ObjectUtil.equals(hardTypeEnum, HardTypeEnum.SUPERMARKET) && ObjectUtil.equals(orderTypeEnum, HardOrderTypeEnum.RESERVE)) {
|
||||
if (ObjectUtil.equals(hardTypeEnum, HardTypeEnum.SUPERMARKET)) {
|
||||
// 查询购物车
|
||||
List<HardCarEntity> carList = hardCarService.getByParentCarId(order.getParentCarId());
|
||||
if (ObjectUtil.isEmpty(carList)) throw new RuntimeException("扣减库存错误,购物车不存在");
|
||||
@@ -433,14 +488,16 @@ public class HardwareOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardO
|
||||
List<SupermarketSpuUpdateStockReqDTO.Item> list = carList.stream().map(v -> {
|
||||
SupermarketSpuUpdateStockReqDTO.Item item = new SupermarketSpuUpdateStockReqDTO.Item();
|
||||
item.setId(v.getProductId());
|
||||
item.setIncrCount(v.getProductCount());
|
||||
item.setIncrCount(v.getProductCount() * base);
|
||||
return item;
|
||||
}).toList();
|
||||
dto.setItems(list);
|
||||
R updateSkuStockRes = supermarketSpuService.updateSpuStock(dto);
|
||||
if (updateSkuStockRes.getCode() != 0) {
|
||||
throw new RuntimeException("扣件库存错误");
|
||||
log.info("|{}|{},失败,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto));
|
||||
throw new RuntimeException(CarErrorMsg + "错误");
|
||||
}
|
||||
log.info("|{}|{},成功,order:|{}|,isReduce:|{}|,params:|{}|", TAG, CarErrorMsg, JSON.toJSON(order), isReduce, JSON.toJSON(dto));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -503,7 +560,7 @@ public class HardwareOrderServiceImpl extends ServiceImpl<HardOrderMapper, HardO
|
||||
|
||||
/* ************************************* end 支付相关 end ************************************* */
|
||||
|
||||
private HardwareOrderServiceImpl getSelf() {
|
||||
private HardOrderServiceImpl getSelf() {
|
||||
return SpringUtil.getBean(getClass());
|
||||
}
|
||||
}
|
||||
+68
-3
@@ -2,8 +2,7 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.hard.mapper.order.HardAfterSaleMapper">
|
||||
|
||||
<resultMap id="hardAfterSaleMap" type="com.bsd.pjcloud.hard.api.entity.order.HardAfterSaleEntity">
|
||||
<resultMap id="hardAfterSaleMap" type="com.bsd.pjcloud.hard.api.entity.order.HardAfterSaleEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="no" column="no"/>
|
||||
<result property="type" column="type"/>
|
||||
@@ -28,5 +27,71 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectA">
|
||||
select a.id,
|
||||
a.no,
|
||||
a.type,
|
||||
a.status,
|
||||
a.way,
|
||||
a.user_id,
|
||||
a.apply_reason,
|
||||
a.apply_description,
|
||||
a.apply_pic_urls,
|
||||
a.order_id,
|
||||
a.order_no,
|
||||
a.audit_time,
|
||||
a.audit_user_id,
|
||||
a.audit_reason,
|
||||
a.refund_price,
|
||||
a.pay_refund_id,
|
||||
a.refund_time,
|
||||
a.delivery_time,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.tenant_id,
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = '0'
|
||||
<if test="dto.id != null">
|
||||
and a.id = #{dto.id}
|
||||
</if>
|
||||
<if test="dto.orderId != null">
|
||||
and a.order_id = #{dto.orderId}
|
||||
</if>
|
||||
<if test="dto.status != null and dto.status != '' ">
|
||||
and a.status = #{dto.status}
|
||||
</if>
|
||||
<if test="dto.userIds != null and dto.userIds.size() != 0">
|
||||
and a.user_id IN
|
||||
<foreach collection="dto.userIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.createTimeList != null and dto.createTimeList.length == 2">
|
||||
and a.create_time between #{dto.createTimeList[0]} and #{dto.createTimeList[1]}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="scopePageJoinList" resultType="com.bsd.pjcloud.hard.api.vo.order.HardAfterSaleVo">
|
||||
<include refid="selectA"/>
|
||||
o.dept_id,
|
||||
o.dept_id as orderDeptId,
|
||||
o.hard_id as orderHardId,
|
||||
o.parent_car_id as orderParentCarId,
|
||||
o.total_price as orderTotalPrice,
|
||||
o.extra_price as orderExtraPrice,
|
||||
o.pay_price as orderPayPrice,
|
||||
o.pay_time as orderPayTime
|
||||
from hard_after_sale a
|
||||
left join hard_order o on o.id = a.order_id
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,18 @@
|
||||
# 开发组IDE 编辑器标准 V2.1.0
|
||||
root = true
|
||||
|
||||
[*.{adoc, bat, groovy, html, java, js, jsp, kt, kts, md, properties, py, rb, sh, sql, svg, txt, xml, xsd}]
|
||||
charset = utf-8
|
||||
|
||||
[*.{groovy, java, kt, kts, xml, xsd}]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
continuation_indent_size = 8
|
||||
end_of_line = lf
|
||||
|
||||
[*.{js, html}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-mqtt</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pjcloud-mqtt-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- 连表查询注解 -->
|
||||
<dependency>
|
||||
<groupId>com.github.yulichang</groupId>
|
||||
<artifactId>mybatis-plus-join-annotation</artifactId>
|
||||
</dependency>
|
||||
<!--core 工具类-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-core</artifactId>
|
||||
</dependency>
|
||||
<!--mybatis plus spring,包含了mybatis plus core-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring</artifactId>
|
||||
</dependency>
|
||||
<!--feign 工具类-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-feign</artifactId>
|
||||
</dependency>
|
||||
<!-- excel 导入导出 -->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-excel</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.bsd.pjcloud.mqtt.api.feign;
|
||||
|
||||
import com.bsd.pjcloud.common.core.constant.ServiceNameConstants;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.feign.annotation.NoToken;
|
||||
import com.bsd.pjcloud.mqtt.dto.MqttBaseDto;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(contextId = "remoteMqttEventService", value = ServiceNameConstants.MQTT_SERVICE)
|
||||
public interface RemoteMqttEventService {
|
||||
|
||||
@NoToken
|
||||
@GetMapping("/mqtt/send-default-msg")
|
||||
R<Boolean> sendDefaultMsg(@RequestBody MqttBaseDto dto);
|
||||
|
||||
/**
|
||||
* 设置变化
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/mqtt/send-config-change-msg")
|
||||
R<Boolean> sendConfigChangeMsg(@RequestParam Long mchDeptId);
|
||||
|
||||
/**
|
||||
* 食堂商品变化
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/mqtt/send-canteen-product-change-msg")
|
||||
R<Boolean> sendCanteenProductChangeMsg(@RequestParam(required = false) Long mchDeptId);
|
||||
|
||||
/**
|
||||
* 食堂分类变化
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/mqtt/send-canteen-classify-change-msg")
|
||||
R<Boolean> sendCanteenClassifyChangeMsg(@RequestParam(required = false) Long mchDeptId);
|
||||
|
||||
/**
|
||||
* 超市商品变化
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/mqtt/send-supermarket-product-change-msg")
|
||||
R<Boolean> sendSupermarketProductChangeMsg(@RequestParam(required = false) Long mchDeptId);
|
||||
|
||||
/**
|
||||
* 超市分类变化
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/mqtt/send-supermarket-classify-change-msg")
|
||||
R<Boolean> sendSupermarketClassifyChangeMsg(@RequestParam(required = false) Long mchDeptId);
|
||||
|
||||
/**
|
||||
* 人脸变化
|
||||
*/
|
||||
@NoToken
|
||||
@GetMapping("/mqtt/send-face-change-msg")
|
||||
R<Boolean> sendFaceChangeMsg(@RequestParam List<Long> parentDeptList, @RequestParam Long userId);
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.bsd.pjcloud.mqtt.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* mq action
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum MqttActionEnum {
|
||||
CONFIG("设置变化"),
|
||||
CANTEEN_PRODUCT("食堂商品变化"),
|
||||
CANTEEN_CLASSIFY("食堂分类变化"),
|
||||
SUPERMARKET_PRODUCT("超市商品变化"),
|
||||
SUPERMARKET_CLASSIFY("超市分类变化"),
|
||||
PRINT("打印变化"),
|
||||
FACE("人脸变化"),
|
||||
;
|
||||
private final String description;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.bsd.pjcloud.mqtt.dto;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bsd.pjcloud.mqtt.constant.MqttActionEnum;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MqttBaseDto<T extends MqttHardBaseMsg> {
|
||||
// 商户id
|
||||
private Long merchantDeptId;
|
||||
|
||||
// 硬件id
|
||||
private Long hardwareId;
|
||||
|
||||
private MqttActionEnum action;
|
||||
|
||||
private Integer qos = 1;
|
||||
|
||||
private T data;
|
||||
|
||||
public Boolean isExistMchDeptId() {
|
||||
return ObjectUtil.isNotEmpty(merchantDeptId);
|
||||
}
|
||||
|
||||
public String getTopic() {
|
||||
if (ObjectUtil.isAllNotEmpty(merchantDeptId, hardwareId)) {
|
||||
return String.format("topic/android/%s/%s", merchantDeptId, hardwareId);
|
||||
}
|
||||
if (ObjectUtil.isAllNotEmpty(merchantDeptId)) {
|
||||
return String.format("topic/android/%s", merchantDeptId);
|
||||
}
|
||||
return "topic/android";
|
||||
}
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.bsd.pjcloud.mqtt.dto;
|
||||
|
||||
import com.bsd.pjcloud.mqtt.constant.MqttActionEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 向硬件发送消息
|
||||
*/
|
||||
@Data
|
||||
public class MqttHardBaseMsg {
|
||||
|
||||
private MqttActionEnum action;
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.bsd.pjcloud.mqtt.dto.hard;
|
||||
|
||||
import com.bsd.pjcloud.mqtt.dto.MqttHardBaseMsg;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class HardCustomerMsg extends MqttHardBaseMsg {
|
||||
|
||||
private String userId;
|
||||
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
com.bsd.pjcloud.mqtt.api.feign.RemoteMqttEventService
|
||||
@@ -0,0 +1,125 @@
|
||||
<?xml version="1.0"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
|
||||
http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-mqtt</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pjcloud-mqtt-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!--mqtt-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.integration</groupId>
|
||||
<artifactId>spring-integration-mqtt</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 注册中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 配置中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 操作数据源相关-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-data</artifactId>
|
||||
</dependency>
|
||||
<!--必备:pigx安全模块-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-security</artifactId>
|
||||
</dependency>
|
||||
<!--必备:xss 过滤模块-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-xss</artifactId>
|
||||
</dependency>
|
||||
<!--必备: sentinel 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-sentinel</artifactId>
|
||||
</dependency>
|
||||
<!--必备: feign 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-feign</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 依赖api模块-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-mqtt-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</dependency>
|
||||
<!--必备: log 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-log</artifactId>
|
||||
</dependency>
|
||||
<!--必备: undertow容器-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
<!--必备: spring boot web-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!--测试: spring boot test-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-wallet-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>cloud</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<loaderImplementation>CLASSIC</loaderImplementation>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>io.fabric8</groupId>
|
||||
<artifactId>docker-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>boot</id>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.bsd.pjcloud.mqtt;
|
||||
|
||||
import com.bsd.pjcloud.common.feign.annotation.EnablePjcloudFeignClients;
|
||||
import com.bsd.pjcloud.common.security.annotation.EnablePjcloudResourceServer;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
@EnablePjcloudFeignClients
|
||||
@EnableDiscoveryClient
|
||||
@EnablePjcloudResourceServer
|
||||
@SpringBootApplication
|
||||
public class MqttApp {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MqttApp.class, args);
|
||||
}
|
||||
}
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.bsd.pjcloud.mqtt.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Data
|
||||
@ConfigurationProperties(prefix = "mqtt")
|
||||
@Component
|
||||
public class MqttConfig {
|
||||
/**
|
||||
* 是否使用本地配置文件
|
||||
*/
|
||||
private Boolean isLocal = false;
|
||||
/**
|
||||
* 证书地址
|
||||
*/
|
||||
private String crtPath;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* 连接地址
|
||||
*/
|
||||
private String hostUrl;
|
||||
/**
|
||||
* clientId
|
||||
*/
|
||||
private String clientId;
|
||||
/**
|
||||
* 安卓连接地址
|
||||
*/
|
||||
private String androidAddress;
|
||||
/**
|
||||
* 安卓连接端口
|
||||
*/
|
||||
private String androidPort;
|
||||
}
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
package com.bsd.pjcloud.mqtt.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.security.annotation.Inner;
|
||||
import com.bsd.pjcloud.mqtt.constant.MqttActionEnum;
|
||||
import com.bsd.pjcloud.mqtt.dto.MqttBaseDto;
|
||||
import com.bsd.pjcloud.mqtt.dto.hard.HardCustomerMsg;
|
||||
import com.bsd.pjcloud.mqtt.service.MqttEventService;
|
||||
import com.bsd.pjcloud.wallet.api.feign.RemoteMchService;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@RequestMapping("/mqtt")
|
||||
@Tag(description = "hard-invoice", name = "发票记录管理")
|
||||
@SecurityRequirement(name = HttpHeaders.AUTHORIZATION)
|
||||
public class MqttEventController {
|
||||
|
||||
private final MqttEventService mqttEventService;
|
||||
|
||||
private final RemoteMchService remoteMchService;
|
||||
|
||||
@Inner
|
||||
@PostMapping("/send-default-msg")
|
||||
public R<Boolean> sendDefaultMsg(@RequestBody MqttBaseDto dto) {
|
||||
return R.ok(mqttEventService.defaultAction(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置变化
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping("/send-config-change-msg")
|
||||
public R<Boolean> sendConfigChangeMsg(@RequestParam Long mchDeptId) {
|
||||
MqttBaseDto dto = new MqttBaseDto<>();
|
||||
dto.setAction(MqttActionEnum.CONFIG);
|
||||
dto.setMerchantDeptId(mchDeptId);
|
||||
return R.ok(mqttEventService.defaultAction(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 食堂商品变化
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping("/send-canteen-product-change-msg")
|
||||
public R<Boolean> sendCanteenProductChangeMsg(@RequestParam Long mchDeptId) {
|
||||
MqttBaseDto dto = new MqttBaseDto<>();
|
||||
if (ObjectUtil.isNotEmpty(mchDeptId)) {
|
||||
dto.setMerchantDeptId(mchDeptId);
|
||||
}
|
||||
dto.setAction(MqttActionEnum.CANTEEN_PRODUCT);
|
||||
return R.ok(mqttEventService.defaultAction(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 食堂分类变化
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping("/send-canteen-classify-change-msg")
|
||||
public R<Boolean> sendCanteenClassifyChangeMsg(@RequestParam Long mchDeptId) {
|
||||
MqttBaseDto dto = new MqttBaseDto<>();
|
||||
if (ObjectUtil.isNotEmpty(mchDeptId)) {
|
||||
dto.setMerchantDeptId(mchDeptId);
|
||||
}
|
||||
dto.setAction(MqttActionEnum.CANTEEN_CLASSIFY);
|
||||
return R.ok(mqttEventService.defaultAction(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 超市商品变化
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping("/send-supermarket-product-change-msg")
|
||||
public R<Boolean> sendSupermarketProductChangeMsg(@RequestParam Long mchDeptId) {
|
||||
MqttBaseDto dto = new MqttBaseDto<>();
|
||||
if (ObjectUtil.isNotEmpty(mchDeptId)) {
|
||||
dto.setMerchantDeptId(mchDeptId);
|
||||
}
|
||||
dto.setAction(MqttActionEnum.SUPERMARKET_PRODUCT);
|
||||
return R.ok(mqttEventService.defaultAction(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 超市分类变化
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping("/send-supermarket-classify-change-msg")
|
||||
public R<Boolean> sendSupermarketClassifyChangeMsg(@RequestParam Long mchDeptId) {
|
||||
MqttBaseDto dto = new MqttBaseDto<>();
|
||||
if (ObjectUtil.isNotEmpty(mchDeptId)) {
|
||||
dto.setMerchantDeptId(mchDeptId);
|
||||
}
|
||||
dto.setAction(MqttActionEnum.SUPERMARKET_CLASSIFY);
|
||||
return R.ok(mqttEventService.defaultAction(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 人脸变化
|
||||
*/
|
||||
@Inner
|
||||
@GetMapping("/send-face-change-msg")
|
||||
public R<Boolean> sendFaceChangeMsg(@RequestParam List<Long> parentDeptList, @RequestParam Long userId) {
|
||||
MqttBaseDto dto = new MqttBaseDto();
|
||||
MchManageVo mchDept = remoteMchService.getFirstMch(parentDeptList).getData();
|
||||
if (ObjectUtil.isNotEmpty(mchDept)) {
|
||||
dto.setMerchantDeptId(mchDept.getDeptId());
|
||||
}
|
||||
dto.setAction(MqttActionEnum.FACE);
|
||||
HardCustomerMsg msg = new HardCustomerMsg();
|
||||
msg.setUserId(String.valueOf(userId));
|
||||
dto.setData(msg);
|
||||
return R.ok(mqttEventService.defaultAction(dto));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.bsd.pjcloud.mqtt.inner;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import jakarta.annotation.Resource;
|
||||
import com.bsd.pjcloud.mqtt.service.MqttService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class MqttInner {
|
||||
|
||||
private final MqttService mqttService;
|
||||
|
||||
@PostConstruct
|
||||
public void initMqtt() {
|
||||
mqttService.connect();
|
||||
mqttService.subscribeAll();
|
||||
}
|
||||
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.bsd.pjcloud.mqtt.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
|
||||
import org.eclipse.paho.client.mqttv3.MqttCallback;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MqttCallBackService implements MqttCallback {
|
||||
|
||||
static final String TAG = "mqtt回调";
|
||||
|
||||
@Lazy
|
||||
private final MqttService mqttService;
|
||||
|
||||
|
||||
// 断开连接的回调
|
||||
@Override
|
||||
public void connectionLost(Throwable e) {
|
||||
log.debug("mqtt断开连接:{}", JSON.toJSON(e));
|
||||
// 重新连接
|
||||
mqttService.connect();
|
||||
}
|
||||
|
||||
// 监听消息的回调
|
||||
@Override
|
||||
public void messageArrived(String topic, MqttMessage msg) throws Exception {
|
||||
log.debug("mqtt收到消息topic:{};msg:{};", topic, JSON.toJSON(msg));
|
||||
if (ObjectUtil.isEmpty(topic)) return;
|
||||
if (!topic.contains("service")) return;
|
||||
byte[] payload = msg.getPayload();
|
||||
String json = new String(payload, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deliveryComplete(IMqttDeliveryToken token) {
|
||||
try {
|
||||
log.info("|{}|mqtt证书校验成功:|{}|", TAG, token.getTopics());
|
||||
} catch (Exception e) {
|
||||
log.error("|{}|mqtt证书校验失败:|{}|", TAG, JSON.toJSON(e));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.bsd.pjcloud.mqtt.service;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.bsd.pjcloud.mqtt.dto.MqttBaseDto;
|
||||
import com.bsd.pjcloud.mqtt.dto.MqttHardBaseMsg;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Component
|
||||
public class MqttEventService {
|
||||
|
||||
private final MqttService mqttService;
|
||||
|
||||
|
||||
public <T extends MqttBaseDto> Boolean defaultAction(T dto) {
|
||||
MqttHardBaseMsg msg = dto.getData();
|
||||
msg.setAction(dto.getAction());
|
||||
mqttService.publish(dto.getQos(), false, dto.getTopic(), JSON.toJSONString(msg));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
package com.bsd.pjcloud.mqtt.service;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bsd.pjcloud.mqtt.config.MqttConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.bsd.pjcloud.mqtt.utils.SSLUtils;
|
||||
import org.eclipse.paho.client.mqttv3.*;
|
||||
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Component
|
||||
public class MqttService {
|
||||
|
||||
static final String TAG = "mqtt服务";
|
||||
|
||||
private final MqttConfig mqttConfig;
|
||||
|
||||
private final MqttCallBackService mqttCallBack;
|
||||
|
||||
static private MqttClient client;
|
||||
|
||||
private static MqttClient getClient() {
|
||||
return client;
|
||||
}
|
||||
|
||||
private static void setClient(MqttClient client) {
|
||||
MqttService.client = client;
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
MqttClient client;
|
||||
if (ObjectUtil.isNotEmpty(MqttService.getClient()) && MqttService.getClient().isConnected()) return;
|
||||
try {
|
||||
client = new MqttClient(mqttConfig.getHostUrl(), mqttConfig.getClientId(), new MemoryPersistence());
|
||||
MqttConnectOptions options = new MqttConnectOptions();
|
||||
options.setCleanSession(true);
|
||||
options.setUserName(mqttConfig.getUsername());
|
||||
options.setPassword(mqttConfig.getPassword().toCharArray());
|
||||
crtAuth(options);
|
||||
client.setCallback(mqttCallBack);
|
||||
client.connect(options);
|
||||
if (!client.isConnected()) {
|
||||
log.error("|{}|mqtt连接失败;", TAG);
|
||||
} else {
|
||||
log.info("|{}|mqtt连接成功;", TAG);
|
||||
}
|
||||
setClient(client);
|
||||
} catch (Exception e) {
|
||||
log.error("mqtt连接错误:{};", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void crtAuth(MqttConnectOptions options) {
|
||||
try {
|
||||
String path;
|
||||
if (!mqttConfig.getIsLocal() && ObjectUtil.isNotEmpty(mqttConfig.getCrtPath())) {
|
||||
path = mqttConfig.getCrtPath();
|
||||
} else {
|
||||
path = getClass().getClassLoader().getResource("crt/emqxsl-ca.crt").getPath();
|
||||
}
|
||||
options.setSocketFactory(SSLUtils.getSocketFactory(path));
|
||||
} catch (Exception e) {
|
||||
log.error("mqtt 证书错误 {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkMqttConnect() {
|
||||
if (Objects.isNull(MqttService.getClient()) || !client.isConnected()) {
|
||||
log.error("|{}|mqtt连接错误", TAG);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// 订阅所有主题
|
||||
public void subscribeAll() {
|
||||
if (!checkMqttConnect()) return;
|
||||
String topic = "topic/#";
|
||||
subscribe(topic, 1);
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
public void publish(int qos, boolean retained, String topic, String pushMessage) {
|
||||
if (!checkMqttConnect()) return;
|
||||
MqttMessage message = new MqttMessage();
|
||||
message.setQos(qos);
|
||||
message.setRetained(retained);
|
||||
message.setPayload(pushMessage.getBytes());
|
||||
MqttTopic mTopic = MqttService.getClient().getTopic(topic);
|
||||
MqttDeliveryToken token;
|
||||
try {
|
||||
token = mTopic.publish(message);
|
||||
token.waitForCompletion();
|
||||
publishLog(qos, retained, topic, pushMessage);
|
||||
} catch (MqttException e) {
|
||||
log.error("|{}|mqtt发送消息错误:|{}|", TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void subscribe(String topic, int qos) {
|
||||
try {
|
||||
MqttService.getClient().subscribe(topic, qos);
|
||||
subscribeLog(topic, qos);
|
||||
} catch (MqttException e) {
|
||||
log.error("|{}|mqtt订阅主题错误:|{}|", TAG, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void publishLog(int qos, boolean retained, String topic, String pushMessage) {
|
||||
log.info("|{}|发布消息成功topic:|{}|qos:|{}|是否保留:|{}|消息:|{}|", TAG, topic, qos, retained, pushMessage);
|
||||
}
|
||||
|
||||
private void subscribeLog(String topic, int qos) {
|
||||
log.debug("|{}|订阅主题成功topic:{};qos:{};", TAG, topic, qos);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.bsd.pjcloud.mqtt.utils;
|
||||
|
||||
import javax.net.ssl.SSLContext;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
import java.io.FileInputStream;
|
||||
import java.security.KeyStore;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CertificateFactory;
|
||||
import java.security.cert.X509Certificate;
|
||||
|
||||
public class SSLUtils {
|
||||
|
||||
public static SSLSocketFactory getSocketFactory(String caCertPath) throws Exception {
|
||||
CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
|
||||
|
||||
// load CA certificate into keystore to authenticate server
|
||||
Certificate caCert = certFactory.generateCertificate(new FileInputStream(caCertPath));
|
||||
X509Certificate x509CaCert = (X509Certificate) caCert;
|
||||
|
||||
KeyStore caKeyStore = KeyStore.getInstance(KeyStore.getDefaultType());
|
||||
caKeyStore.load(null, null);
|
||||
caKeyStore.setCertificateEntry("cacert", x509CaCert);
|
||||
|
||||
TrustManagerFactory tmFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
||||
tmFactory.init(caKeyStore);
|
||||
|
||||
SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
|
||||
sslContext.init(null, tmFactory.getTrustManagers(), null);
|
||||
|
||||
return sslContext.getSocketFactory();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
server:
|
||||
port: 8010
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
username: @nacos.username@
|
||||
password: @nacos.password@
|
||||
discovery:
|
||||
server-addr: ${NACOS_HOST:pjcloud-register}:${NACOS_PORT:8848}
|
||||
config:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
config:
|
||||
import:
|
||||
- optional:nacos:application-@profiles.active@.yml
|
||||
- optional:nacos:${spring.application.name}-@profiles.active@.yml
|
||||
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC/dA1s6RUO8ZMy
|
||||
0exwGp34jgcUY5//dbeXusXmkwqLPO24jtBjfglVoOQF9PpUWFsk8UY2pOP26sq5
|
||||
pXrCpLYA7nuROVk4ulmU/JDfsi8YK0DpDMT8neAO/uy+kXoIGogW7scVz9ZNkKFI
|
||||
9g4YBjh8plNb0KaT3piYgxmSccVV9vwWDvFoVFZkHqCCY6PScKm2v2WnINNgXbuO
|
||||
X3PBjSJKJ/AnaONiwp7F67+LE1meBu+m1vCg+pDry8s2H2vxf3TlzXygG32owsru
|
||||
bqj/aN5+wr3YcheX1L2TQcTeGOMNoylD/0lzMi+az6IMNM2sV/BOdKbVq2/g238Z
|
||||
SyFM0xQTAgMBAAECggEAKbgXSNlNrnDz24olFJSoQcZpQocnEVrMg/K+Ny1picfg
|
||||
IWx1eoi3bgJeTfIBLqoGSnmNDFFIH8EwJd4qbwnHY1KUeKPfjl4FMVMMGsLQQlsC
|
||||
jQYsUsPwVDQ20JwQ1H07lIu5tEYS89oFW0nK7m9Eld0EoyhHdEd4RxuiUega0U1d
|
||||
R2TdILJsA2WT/StRuthmbpR/0PJ8GwLF294ARP+ibmk4H1ZuMShf5kHnFrLG1+0Z
|
||||
g/kfQQfXMNIbLK/i4KxGh3IdaTxFl0ITQq86tX+pZp1d36f1Evnsb3PxdCymBHM8
|
||||
/TFlZ6llpjN/JLWTr6t93CpYm7DGwcvg99Pada1QKQKBgQDhRGd6+x9pwWrowoC+
|
||||
wnerxXYe1/MecMXzsVptX7/cj9dieqQnwgsbEGt8Heb3Zbh/IheFEB3LHB4tC80n
|
||||
1WgVi78OY3fbaEBSnwrkdbYxoiSn8FBoi6NkzitbcAQhzEMu/1GM3XQ9RAD9bNpg
|
||||
E2Pb/USvO4dd66uGD4UbnQFUzQKBgQDZkq2Htw05QREfcAVVD4EUnoFub3wPXP83
|
||||
MJMoNU+6v1J/boURiUJ1DVwHZlP9f+K2++hlDleURSQypj37UgupyQGZJS4K+847
|
||||
x1K/vRW8U6+Ey8syMd+B8F8xVnPwJdYMOOmQCbnoYSXYsY2U4vv5pkcq2gWfuTtS
|
||||
+k6BRscMXwKBgGhqtrSwtozk1NNzZQ4HQkVi0C/X1Z+kkn01Fj9ghKSOID5Lrs+n
|
||||
CFLRN6FekvLWOcDkYpaRM94z+GDU+ZGfQBHMpxDaVnJjTn19ryTa00sKZ4dYw0zS
|
||||
fTh6wGov8BpifjnIq1pqRDkpznOqA0dJdZ5BNZcsNsD4PpdzljWIf1d5AoGAPgBi
|
||||
my47AnncW00c9+R3MF0LHWF/xREHWb7p8KdglSM4a0Afg6PN4HVyKFmszazH+sVG
|
||||
sKWpp4MckaJ2P0xeLoAtiGrj+BVR7A8dMa68pvJiLkG1IhS8UNcjCXhNib3+hXUi
|
||||
ef2LkQE+O8Y9RpR4oegUl82RlLbAhSD3hjeZOZkCgYEAsPHXxe4r3KpXBoWhkZIs
|
||||
Xd00tYeTzzN1WulIIM6RUx3pNfy+bAne9fEieTZ3frw+b2Hbo+bUgS40hn8gdaxX
|
||||
HJfwXTsnJ9yw5PnJ8VAk+Te07G2RczbJwl6G4vEifBAZaYqbuK37n7EwQdl6P2Db
|
||||
5Tg5eEAXoE4XnOWPj5ivIMc=
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -0,0 +1,22 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
|
||||
MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
|
||||
d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
|
||||
QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
|
||||
MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
|
||||
b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG
|
||||
9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB
|
||||
CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97
|
||||
nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt
|
||||
43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
|
||||
T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
|
||||
gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
|
||||
BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR
|
||||
TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw
|
||||
DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr
|
||||
hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg
|
||||
06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF
|
||||
PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls
|
||||
YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
|
||||
CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
小技巧: 在根pom里面设置统一存放路径,统一管理方便维护
|
||||
<properties>
|
||||
<log-path>/Users/lengleng</log-path>
|
||||
</properties>
|
||||
1. 其他模块加日志输出,直接copy本文件放在resources 目录即可
|
||||
2. 注意修改 <property name="${log-path}/log.path" value=""/> 的value模块
|
||||
-->
|
||||
<configuration debug="false" scan="false">
|
||||
<property name="log.path" value="logs/${project.artifactId}"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- Console log output -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file debug output -->
|
||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/debug.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file error output -->
|
||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<logger name="org.activiti.engine.impl.db" level="DEBUG">
|
||||
<appender-ref ref="debug"/>
|
||||
</logger>
|
||||
|
||||
<!--nacos 心跳 INFO 屏蔽-->
|
||||
<logger name="com.alibaba.nacos" level="OFF">
|
||||
<appender-ref ref="error"/>
|
||||
</logger>
|
||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="console"/>
|
||||
<appender-ref ref="debug"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud</artifactId>
|
||||
<version>5.7.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pjcloud-mqtt</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<!--项目子模块-->
|
||||
<modules>
|
||||
<module>pjcloud-mqtt-api</module>
|
||||
<module>pjcloud-mqtt-biz</module>
|
||||
</modules>
|
||||
</project>
|
||||
+7
-14
@@ -122,25 +122,18 @@ public class SupermarketSpuServiceImpl extends ServiceImpl<SupermarketSpuMapper,
|
||||
@Override
|
||||
@Transactional
|
||||
public R updateSpuStock(SupermarketSpuUpdateStockReqDTO updateStockReqDTO) {
|
||||
// 更新 SKU 库存
|
||||
updateStockReqDTO.getItems().forEach(item -> {
|
||||
for (SupermarketSpuUpdateStockReqDTO.Item v : updateStockReqDTO.getItems()) {
|
||||
// 查询当前库存
|
||||
SupermarketSpuEntity spu = baseMapper.selectById(item.getId());
|
||||
SupermarketSpuEntity spu = baseMapper.selectById(v.getId());
|
||||
if (spu == null) {
|
||||
R.failed(spu.getProductName()+"商品不存在");
|
||||
return R.failed(spu.getProductName() + "商品不存在");
|
||||
}
|
||||
// 检查库存是否足够
|
||||
if (item.getIncrCount() < 0 && Math.abs(item.getIncrCount()) > spu.getStock()) {
|
||||
R.failed(spu.getProductName()+"库存不足,无法完成操作");
|
||||
if (v.getIncrCount() < 0 && Math.abs(v.getIncrCount()) > spu.getStock()) {
|
||||
return R.failed(spu.getProductName() + "库存不足,无法完成操作");
|
||||
}
|
||||
int i = baseMapper.updateStock(item.getId(), item.getIncrCount());
|
||||
// if (item.getIncrCount() <= 0) {
|
||||
// if (i == 0) {
|
||||
// R.failed("商品库存不足");
|
||||
// }
|
||||
// }
|
||||
});
|
||||
|
||||
int i = baseMapper.updateStock(v.getId(), v.getIncrCount());
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -12,4 +12,6 @@ public class SysUserFaceDto extends SysUserFaceEntity {
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
private List<Long> deptIds;
|
||||
|
||||
}
|
||||
@@ -204,6 +204,12 @@
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-common-idempotent</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.bsd</groupId>
|
||||
<artifactId>pjcloud-mqtt-api</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
+2
-1
@@ -85,9 +85,10 @@ public class SysUserFaceController {
|
||||
/* ************************************* start android start ************************************* */
|
||||
@Operation(summary = "android查询人脸数据库", description = "android查询人脸数据库")
|
||||
@GetMapping("/ad/find-face")
|
||||
public R adFinFace(@ParameterObject Page page, @RequestParam(required = false) Long userId) {
|
||||
public R adFinFace(@ParameterObject Page page, @RequestParam(required = false) Long userId, @RequestParam(required = false) Long merchantDeptId) {
|
||||
SysUserFaceDto dto = new SysUserFaceDto();
|
||||
dto.setUserId(userId);
|
||||
dto.setMerchantDeptId(merchantDeptId);
|
||||
return R.ok(sysUserFaceService.pageJoin(page, dto).getRecords());
|
||||
}
|
||||
/* ************************************* start android start ************************************* */
|
||||
|
||||
+4
-3
@@ -41,10 +41,11 @@ public interface SysUserFaceMapper extends PjcloudBaseMapper<SysUserFaceEntity>
|
||||
.selectAs(SysUser::getPhone, SysUserFaceVo::getUserMobile)
|
||||
.selectAs(SysDept::getName, SysUserFaceVo::getDeptName)
|
||||
.selectAs(SysDept::getDeptId, SysUserFaceVo::getDeptId)
|
||||
.leftJoin(SysUser.class, SysUser::getUserId, SysUserFaceEntity::getUserId)
|
||||
.leftJoin(SysDept.class, SysDept::getDeptId, SysUser::getDeptId)
|
||||
.innerJoin(SysUser.class, SysUser::getUserId, SysUserFaceEntity::getUserId)
|
||||
.innerJoin(SysDept.class, SysDept::getDeptId, SysUser::getDeptId)
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getUserId()), SysUserFaceEntity::getUserId, dto.getUserId())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), SysUserFaceEntity::getUserId, dto.getUserIds());
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), SysUserFaceEntity::getUserId, dto.getUserIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), SysUser::getDeptId, dto.getDeptIds());
|
||||
return selectJoinPage(page, SysUserFaceVo.class, wrapper);
|
||||
}
|
||||
}
|
||||
+9
@@ -68,6 +68,14 @@ public interface SysDeptService extends IService<SysDept> {
|
||||
*/
|
||||
List<SysDept> listDescendant(Long deptId);
|
||||
|
||||
/**
|
||||
* 获得指定部门的所有父部门
|
||||
*
|
||||
* @param deptId 部门编号
|
||||
* @return 父部门列表
|
||||
*/
|
||||
List<SysDept> getParentDeptList(Long deptId);
|
||||
|
||||
/**
|
||||
* 获取部门负责人
|
||||
*
|
||||
@@ -103,6 +111,7 @@ public interface SysDeptService extends IService<SysDept> {
|
||||
|
||||
/**
|
||||
* 根据部门名查询部门
|
||||
*
|
||||
* @param names 部门名
|
||||
* @return
|
||||
*/
|
||||
|
||||
+18
@@ -220,6 +220,24 @@ public class SysDeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impl
|
||||
return resDeptList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysDept> getParentDeptList(Long deptId) {
|
||||
LinkedList<SysDept> parentList = new LinkedList<>();
|
||||
findParentDeptList(deptId, parentList);
|
||||
return parentList;
|
||||
}
|
||||
|
||||
private void findParentDeptList(Long id, LinkedList<SysDept> parentList) {
|
||||
SysDept currentDept = baseMapper.selectById(id);
|
||||
if (currentDept != null) {
|
||||
parentList.add(currentDept);
|
||||
Long parentId = currentDept.getParentId();
|
||||
if (parentId != null) {
|
||||
findParentDeptList(parentId, parentList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门负责人
|
||||
* <p>
|
||||
|
||||
+37
-6
@@ -5,17 +5,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.dto.SysUserFaceDto;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUser;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysUserFaceEntity;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.admin.api.vo.SysUserFaceVo;
|
||||
import com.bsd.pjcloud.admin.mapper.SysUserFaceMapper;
|
||||
import com.bsd.pjcloud.admin.service.SysDeptService;
|
||||
import com.bsd.pjcloud.admin.service.SysUserFaceService;
|
||||
import com.bsd.pjcloud.admin.service.SysUserService;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.exception.CheckedException;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.mqtt.api.feign.RemoteMqttEventService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -37,6 +37,9 @@ import java.util.List;
|
||||
public class SysUserFaceServiceImpl extends ServiceImpl<SysUserFaceMapper, SysUserFaceEntity> implements SysUserFaceService {
|
||||
|
||||
private final SysUserService sysUserService;
|
||||
private final SysDeptService sysDeptService;
|
||||
|
||||
private final RemoteMqttEventService remoteMqttEventService;
|
||||
|
||||
@Override
|
||||
public Long create(SysUserFaceEntity sysUserFace) {
|
||||
@@ -48,6 +51,8 @@ public class SysUserFaceServiceImpl extends ServiceImpl<SysUserFaceMapper, SysUs
|
||||
updateObj.setId(sysUserFace.getId());
|
||||
updateObj.setAutoCode(String.valueOf(count));
|
||||
baseMapper.updateById(updateObj);
|
||||
// 发送mq
|
||||
sendFaceMq(List.of(sysUserFace.getUserId()));
|
||||
return sysUserFace.getId();
|
||||
}
|
||||
|
||||
@@ -58,15 +63,21 @@ public class SysUserFaceServiceImpl extends ServiceImpl<SysUserFaceMapper, SysUs
|
||||
throw new CheckedException("人脸样本表不存在");
|
||||
}
|
||||
baseMapper.selectById(userFace.getUserId());
|
||||
// 发送mq
|
||||
sendFaceMq(List.of(sysUserFace.getUserId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delByIds(ArrayList<Long> list) {
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
// 发送mq
|
||||
List<SysUserFaceEntity> faceList = baseMapper.selectList(new LambdaQueryWrapper<SysUserFaceEntity>()
|
||||
.in(SysUserFaceEntity::getId, list)
|
||||
);
|
||||
if (ObjectUtil.isNotEmpty(faceList)) {
|
||||
sendFaceMq(faceList.stream().map(SysUserFaceEntity::getUserId).toList());
|
||||
}
|
||||
baseMapper.deleteBatchIds(list);
|
||||
list.forEach(v -> {
|
||||
// 发送mq给硬件设备
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,6 +87,13 @@ public class SysUserFaceServiceImpl extends ServiceImpl<SysUserFaceMapper, SysUs
|
||||
|
||||
@Override
|
||||
public Page<SysUserFaceVo> pageJoin(Page page, SysUserFaceDto dto) {
|
||||
if (ObjectUtil.isNotEmpty(dto.getMerchantDeptId())) {
|
||||
List<SysDept> deptList = sysDeptService.listDescendant(dto.getMerchantDeptId());
|
||||
if (ObjectUtil.isNotEmpty(deptList)) {
|
||||
List<Long> deptIds = deptList.stream().map(SysDept::getDeptId).toList();
|
||||
dto.setDeptIds(deptIds);
|
||||
}
|
||||
}
|
||||
return baseMapper.pageJoin(page, dto);
|
||||
}
|
||||
|
||||
@@ -83,4 +101,17 @@ public class SysUserFaceServiceImpl extends ServiceImpl<SysUserFaceMapper, SysUs
|
||||
public SysUserFaceVo join(Long id) {
|
||||
return baseMapper.join(id);
|
||||
}
|
||||
|
||||
// 发送mq
|
||||
private void sendFaceMq(List<Long> userIds) {
|
||||
if (ObjectUtil.isEmpty(userIds)) return;
|
||||
List<SysUser> list = sysUserService.list(new LambdaQueryWrapper<SysUser>().in(SysUser::getUserId, userIds));
|
||||
if (ObjectUtil.isEmpty(list)) return;
|
||||
for (SysUser v : list) {
|
||||
List<SysDept> parentDeptList = sysDeptService.getParentDeptList(v.getDeptId());
|
||||
if (ObjectUtil.isEmpty(parentDeptList)) continue;
|
||||
List<Long> deptIds = parentDeptList.stream().map(SysDept::getDeptId).toList();
|
||||
remoteMqttEventService.sendFaceChangeMsg(deptIds, v.getUserId());
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -27,7 +27,7 @@ public class WalletDataUtil {
|
||||
return v;
|
||||
}
|
||||
|
||||
public <T extends BaseWalletTypeInterface> List<T> convertWalletTYpeList(List<T> list, Map<Long, WalletTypeEntity> map) {
|
||||
public <T extends BaseWalletTypeInterface> List<T> convertWalletTypeList(List<T> list, Map<Long, WalletTypeEntity> map) {
|
||||
return CollectionUtils.convertList(list, v -> convertWalletType(v, map.get(v.getWalletTypeId())));
|
||||
}
|
||||
|
||||
|
||||
+5
@@ -23,5 +23,10 @@ public class WalletFreezeVo extends WalletFreezeEntity implements BaseUserInterf
|
||||
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 钱包相关
|
||||
*/
|
||||
private Long walletTypeId;
|
||||
|
||||
private String cardNumber;
|
||||
}
|
||||
+6
-3
@@ -3,20 +3,23 @@ package com.bsd.pjcloud.wallet.api.vo;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.base.BaseWalletTypeInterface;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class WalletManageVo extends WalletManageEntity implements BaseUserInterface, BaseDeptInterface {
|
||||
public class WalletManageVo extends WalletManageEntity implements BaseUserInterface, BaseDeptInterface, BaseWalletTypeInterface {
|
||||
|
||||
/**
|
||||
* 钱包类型名
|
||||
* 钱包类型
|
||||
*/
|
||||
private Long walletTypeId;
|
||||
|
||||
private String walletTypeName;
|
||||
|
||||
private String walletTypeUniqueCode;
|
||||
|
||||
private String walletIcon;
|
||||
private String walletTypeIcon;
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
|
||||
+9
-2
@@ -3,14 +3,21 @@ package com.bsd.pjcloud.wallet.api.vo.recharge;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseDeptInterface;
|
||||
import com.bsd.pjcloud.admin.api.vo.base.BaseUserInterface;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeApplyEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.base.BaseWalletTypeInterface;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class WalletRechargeApplyVo extends WalletRechargeApplyEntity implements BaseUserInterface, BaseDeptInterface {
|
||||
public class WalletRechargeApplyVo extends WalletRechargeApplyEntity implements BaseUserInterface, BaseDeptInterface, BaseWalletTypeInterface {
|
||||
/**
|
||||
* 钱包类型相关
|
||||
*/
|
||||
private Long walletTypeId;
|
||||
|
||||
private String walletTypeName;
|
||||
|
||||
private String uniqueCode;
|
||||
private String walletTypeUniqueCode;
|
||||
|
||||
private String walletTypeIcon;
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ public class MchManageController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_mchManage_view')")
|
||||
public R getMchManagePageJoin(@ParameterObject Page page, @ParameterObject MchManageDto dto) {
|
||||
return R.ok(mchManageService.pageJoin(page, dto));
|
||||
return R.ok(mchManageService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页不要权限下拉", description = "分页不要权限下拉")
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ public class WalletActiveController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletActive_view')")
|
||||
public R getWalletActivePageJoin(@ParameterObject Page page, @ParameterObject WalletActiveDto dto) {
|
||||
return R.ok(walletActiveService.scopePage(page, dto));
|
||||
return R.ok(walletActiveService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ public class WalletForeignController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletForeign_view')")
|
||||
public R getWalletForeignPageJoin(@ParameterObject Page page, @ParameterObject WalletForeignDto dto) {
|
||||
return R.ok(walletForeignService.pageJoin(page, dto));
|
||||
return R.ok(walletForeignService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ public class WalletFreezeController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletFreeze_view')")
|
||||
public R getWalletFreezePage(@ParameterObject Page page, @ParameterObject WalletFreezeDto dto) {
|
||||
return R.ok(walletFreezeService.pageJoin(page, dto));
|
||||
return R.ok(walletFreezeService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+2
-2
@@ -95,7 +95,7 @@ public class WalletManageController {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
WalletManageDto dto = new WalletManageDto();
|
||||
dto.setUserId(user.getId());
|
||||
return walletManageService.pageJoin(page, dto);
|
||||
return R.ok(walletManageService.pageJoin(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询", description = "分页查询")
|
||||
@@ -126,7 +126,7 @@ public class WalletManageController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletManage_view')")
|
||||
public R getWalletManagePageJoin(@ParameterObject Page page, @ParameterObject WalletManageDto dto) {
|
||||
return walletManageService.pageJoin(page, dto);
|
||||
return R.ok(walletManageService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ public class WalletStrideController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('admin_walletStride_view')")
|
||||
public R getWalletStrideJoin(@ParameterObject Page page, @ParameterObject WalletStrideDto dto) {
|
||||
return R.ok(walletStrideService.pageJoin(page, dto));
|
||||
return R.ok(walletStrideService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+5
-5
@@ -67,7 +67,7 @@ public class WalletTransactionController {
|
||||
public R appGetAll(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
PjcloudUser user = SecurityUtils.getUser();
|
||||
dto.setUserId(user.getId());
|
||||
return R.ok(walletTransactionService.pageJoin(page, dto));
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto));
|
||||
}
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@@ -81,7 +81,7 @@ public class WalletTransactionController {
|
||||
@GetMapping("/page-cz")
|
||||
public R pageCz(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.RECHARGE.getCode()));
|
||||
return R.ok(walletTransactionService.pageJoin(page, dto));
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "后台消费分页", description = "后台消费分页")
|
||||
@@ -89,7 +89,7 @@ public class WalletTransactionController {
|
||||
public R pageXf(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.PAYMENT.getCode()));
|
||||
dto.setIsFindOrder(true);
|
||||
return R.ok(walletTransactionService.pageJoin(page, dto));
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "后台退款分页", description = "后台退款分页")
|
||||
@@ -97,14 +97,14 @@ public class WalletTransactionController {
|
||||
public R pageTk(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.REFUND.getCode()));
|
||||
dto.setIsFindOrder(true);
|
||||
return R.ok(walletTransactionService.pageJoin(page, dto));
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询复杂查询", description = "分页查询复杂查询")
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_view')")
|
||||
public R getWalletTransactionPageJoin(@ParameterObject Page page, @ParameterObject WalletTransactionDto dto) {
|
||||
return R.ok(walletTransactionService.pageJoin(page, dto));
|
||||
return R.ok(walletTransactionService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+3
-3
@@ -82,7 +82,7 @@ public class WalletRechargeApplyController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeApply_view')")
|
||||
public R getWalletRechargeApplyPage(@ParameterObject Page page, @ParameterObject WalletRechargeApplyDto dto) {
|
||||
return R.ok(walletRechargeApplyService.pageJoin(page, dto));
|
||||
return R.ok(walletRechargeApplyService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
@@ -105,8 +105,8 @@ public class WalletRechargeApplyController {
|
||||
@SysLog("修改充值/扣款申请")
|
||||
@PutMapping
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRechargeApply_edit')")
|
||||
public R updateById(@RequestBody WalletRechargeApplyEntity walletRechargeApply) {
|
||||
return R.ok(walletRechargeApplyService.updateById(walletRechargeApply));
|
||||
public R updateById(@RequestBody WalletRechargeApplyDto dto) {
|
||||
return R.ok(walletRechargeApplyService.edit(dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id删除充值/扣款申请", description = "通过id删除充值/扣款申请")
|
||||
|
||||
+1
-1
@@ -71,7 +71,7 @@ public class WalletRechargeController {
|
||||
@GetMapping("/page-join")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletRecharge_view')")
|
||||
public R pageJoin(@ParameterObject Page page, @ParameterObject WalletRechargeDto dto) {
|
||||
return R.ok(walletRechargeService.pageJoin(page, dto));
|
||||
return R.ok(walletRechargeService.scopePageList(page, dto));
|
||||
}
|
||||
|
||||
@Operation(summary = "通过id查询", description = "通过id查询")
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ public interface WalletActiveMapper extends PjcloudBaseMapper<WalletActiveEntity
|
||||
return selectJoinPage(page, WalletActiveVo.class, wrapper);
|
||||
}
|
||||
|
||||
default Page<WalletActiveVo> scopePage(Page page, WalletActiveDto dto) {
|
||||
default Page<WalletActiveVo> scopePageList(Page page, WalletActiveDto dto) {
|
||||
LambdaQueryWrapper<WalletActiveEntity> wrapper = new LambdaQueryWrapper<WalletActiveEntity>()
|
||||
.like(ObjectUtil.isNotEmpty(dto.getCardNumber()), WalletActiveEntity::getCardNumber, dto.getCardNumber())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getIsActiveHardware()), WalletActiveEntity::getIsActiveHardware, dto.getIsActiveHardware())
|
||||
|
||||
+13
@@ -1,7 +1,10 @@
|
||||
package com.bsd.pjcloud.wallet.mapper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletForeignDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
|
||||
@@ -27,4 +30,14 @@ public interface WalletForeignMapper extends PjcloudBaseMapper<WalletForeignEnti
|
||||
.eq(WalletForeignEntity::getId, id);
|
||||
return selectJoinOne(WalletForeignVo.class, wrapper);
|
||||
}
|
||||
|
||||
default Page<WalletForeignVo> scopePageList(Page page, WalletForeignDto dto) {
|
||||
LambdaQueryWrapper<WalletForeignEntity> wrapper = new LambdaQueryWrapper<WalletForeignEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getProcessStatus()), WalletForeignEntity::getProcessStatus, dto.getProcessStatus())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletForeignEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletForeignEntity::getUserId, dto.getUserIds());
|
||||
Page list = selectPageByScope(page, wrapper, DataScope.of());
|
||||
list.setRecords(BeanUtils.toBean(list.getRecords(), WalletForeignVo.class));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+7
@@ -1,7 +1,10 @@
|
||||
package com.bsd.pjcloud.wallet.mapper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletFreezeDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletActiveEntity;
|
||||
@@ -9,9 +12,11 @@ import com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletActiveVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletFreezeVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.github.yulichang.query.MPJLambdaQueryWrapper;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface WalletFreezeMapper extends PjcloudBaseMapper<WalletFreezeEntity> {
|
||||
@@ -25,4 +30,6 @@ public interface WalletFreezeMapper extends PjcloudBaseMapper<WalletFreezeEntity
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletFreezeEntity::getId, dto.getUserIds());
|
||||
return selectJoinPage(page, WalletFreezeVo.class, wrapper);
|
||||
}
|
||||
|
||||
Page<WalletFreezeVo> scopePageList(Page page, @Param("dto") WalletFreezeDto dto, DataScope dataScope);
|
||||
}
|
||||
+18
-2
@@ -1,8 +1,11 @@
|
||||
package com.bsd.pjcloud.wallet.mapper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
@@ -61,7 +64,7 @@ public interface WalletManageMapper extends PjcloudBaseMapper<WalletManageEntity
|
||||
.selectAll(WalletManageEntity.class)
|
||||
.selectAs(WalletTypeEntity::getName, WalletManageVo::getWalletTypeName)
|
||||
.selectAs(WalletTypeEntity::getUniqueCode, WalletManageVo::getWalletTypeUniqueCode)
|
||||
.selectAs(WalletTypeEntity::getIcon, WalletManageVo::getWalletIcon)
|
||||
.selectAs(WalletTypeEntity::getIcon, WalletManageVo::getWalletTypeIcon)
|
||||
.leftJoin(WalletTypeEntity.class, WalletTypeEntity::getId, WalletManageEntity::getWalletTypeId)
|
||||
.eqIfExists(WalletManageEntity::getUserId, dto.getUserId())
|
||||
.eqIfExists(WalletManageEntity::getWalletTypeId, dto.getWalletTypeId())
|
||||
@@ -86,9 +89,22 @@ public interface WalletManageMapper extends PjcloudBaseMapper<WalletManageEntity
|
||||
.selectAll(WalletManageEntity.class)
|
||||
.selectAs(WalletTypeEntity::getName, WalletManageVo::getWalletTypeName)
|
||||
.selectAs(WalletTypeEntity::getUniqueCode, WalletManageVo::getWalletTypeUniqueCode)
|
||||
.selectAs(WalletTypeEntity::getIcon, WalletManageVo::getWalletIcon)
|
||||
.selectAs(WalletTypeEntity::getIcon, WalletManageVo::getWalletTypeIcon)
|
||||
.leftJoin(WalletTypeEntity.class, WalletTypeEntity::getId, WalletManageEntity::getWalletTypeId)
|
||||
.eqIfExists(WalletManageEntity::getId, id);
|
||||
return selectJoinOne(WalletManageVo.class, wrapper);
|
||||
}
|
||||
|
||||
default Page<WalletManageVo> scopePageList(Page page, WalletManageDto dto) {
|
||||
LambdaQueryWrapper<WalletManageEntity> wrapper = new LambdaQueryWrapper<WalletManageEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getUserId()), WalletManageEntity::getUserId, dto.getUserId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getWalletTypeId()), WalletManageEntity::getWalletTypeId, dto.getWalletTypeId())
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getIsFreeze()), WalletManageEntity::getIsFreeze, dto.getIsFreeze())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getWalletIds()), WalletManageEntity::getId, dto.getWalletIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletManageEntity::getUserId, dto.getUserIds());
|
||||
Page list = selectPageByScope(page, wrapper, DataScope.of());
|
||||
list.setRecords(BeanUtils.toBean(list.getRecords(), WalletManageVo.class));
|
||||
return list;
|
||||
}
|
||||
|
||||
}
|
||||
+13
@@ -1,7 +1,10 @@
|
||||
package com.bsd.pjcloud.wallet.mapper;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletStrideDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
|
||||
@@ -27,4 +30,14 @@ public interface WalletStrideMapper extends PjcloudBaseMapper<WalletStrideEntity
|
||||
.eq(WalletStrideEntity::getId, id);
|
||||
return selectJoinOne(WalletStrideVo.class, wrapper);
|
||||
}
|
||||
|
||||
default Page<WalletStrideVo> scopePageList(Page page, WalletStrideDto dto) {
|
||||
LambdaQueryWrapper<WalletStrideEntity> wrapper = new LambdaQueryWrapper<WalletStrideEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getProcessStatus()), WalletStrideEntity::getProcessStatus, dto.getProcessStatus())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletStrideEntity::getDeptId, dto.getDeptIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletStrideEntity::getUserId, dto.getUserIds());
|
||||
Page list = selectPageByScope(page, wrapper, DataScope.of());
|
||||
list.setRecords(BeanUtils.toBean(list.getRecords(), WalletStrideVo.class));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+13
-1
@@ -1,7 +1,10 @@
|
||||
package com.bsd.pjcloud.wallet.mapper.recharge;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeApplyDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
@@ -18,7 +21,7 @@ public interface WalletRechargeApplyMapper extends PjcloudBaseMapper<WalletRecha
|
||||
MPJLambdaWrapper<WalletRechargeApplyEntity> wrapper = new MPJLambdaWrapper<WalletRechargeApplyEntity>()
|
||||
.selectAll(WalletRechargeApplyEntity.class)
|
||||
.selectAs(WalletTypeEntity::getName, WalletRechargeApplyVo::getWalletTypeName)
|
||||
.selectAs(WalletTypeEntity::getUniqueCode, WalletRechargeApplyVo::getUniqueCode)
|
||||
.selectAs(WalletTypeEntity::getUniqueCode, WalletRechargeApplyVo::getWalletTypeUniqueCode)
|
||||
.leftJoin(WalletTypeEntity.class, WalletTypeEntity::getId, WalletRechargeApplyEntity::getWalletTypeId)
|
||||
.eqIfExists(WalletRechargeApplyEntity::getWalletTypeId, dto.getWalletTypeId())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletManageEntity::getUserId, dto.getUserIds())
|
||||
@@ -26,4 +29,13 @@ public interface WalletRechargeApplyMapper extends PjcloudBaseMapper<WalletRecha
|
||||
return selectJoinPage(page, WalletRechargeApplyVo.class, wrapper);
|
||||
}
|
||||
|
||||
default Page<WalletRechargeApplyVo> scopePageList(Page page, WalletRechargeApplyDto dto) {
|
||||
LambdaQueryWrapper<WalletRechargeApplyEntity> wrapper = new LambdaQueryWrapper<WalletRechargeApplyEntity>()
|
||||
.eq(ObjectUtil.isNotEmpty(dto.getWalletTypeId()), WalletRechargeApplyEntity::getWalletTypeId, dto.getWalletTypeId())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletRechargeApplyEntity::getUserId, dto.getUserIds())
|
||||
.in(ObjectUtil.isNotEmpty(dto.getWalletTypeIds()), WalletRechargeApplyEntity::getWalletTypeId, dto.getWalletTypeIds());
|
||||
Page list = selectPageByScope(page, wrapper, DataScope.of());
|
||||
list.setRecords(BeanUtils.toBean(list.getRecords(), WalletRechargeApplyVo.class));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+3
-1
@@ -12,7 +12,9 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface WalletRechargeImportMapper extends PjcloudBaseMapper<WalletRechargeImportEntity> {
|
||||
|
||||
default Page<WalletRechargeImportVo> pageJoin(Page page, WalletRechargeImportDto dto) {
|
||||
MPJLambdaWrapper<WalletRechargeImportEntity> wrapper = new MPJLambdaWrapper<WalletRechargeImportEntity>();
|
||||
MPJLambdaWrapper<WalletRechargeImportEntity> wrapper = new MPJLambdaWrapper<WalletRechargeImportEntity>()
|
||||
.eqIfExists(WalletRechargeImportEntity::getId, dto.getId())
|
||||
.eqIfExists(WalletRechargeImportEntity::getApplyId, dto.getApplyId());
|
||||
return selectJoinPage(page, WalletRechargeImportVo.class, wrapper);
|
||||
}
|
||||
}
|
||||
+10
-1
@@ -1,10 +1,12 @@
|
||||
package com.bsd.pjcloud.wallet.mapper.recharge;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.PjcloudBaseMapper;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargePackageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeVo;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -16,4 +18,11 @@ public interface WalletRechargeMapper extends PjcloudBaseMapper<WalletRechargeEn
|
||||
MPJLambdaWrapper<WalletRechargeEntity> wrapper = new MPJLambdaWrapper<WalletRechargeEntity>();
|
||||
return selectJoinPage(page, WalletRechargeVo.class, wrapper);
|
||||
}
|
||||
|
||||
default Page<WalletRechargeVo> scopePageList(Page page, WalletRechargeDto dto) {
|
||||
LambdaQueryWrapper<WalletRechargeEntity> wrapper = new LambdaQueryWrapper<WalletRechargeEntity>();
|
||||
Page list = selectPageByScope(page, wrapper, DataScope.of());
|
||||
list.setRecords(BeanUtils.toBean(list.getRecords(), WalletRechargeVo.class));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+2
@@ -19,6 +19,8 @@ public interface MchManageService extends IService<MchManageEntity> {
|
||||
|
||||
Page<MchManageVo> pageJoin(Page page, MchManageDto dto);
|
||||
|
||||
Page<MchManageVo> scopePageList(Page page, MchManageDto dto);
|
||||
|
||||
MchManageVo join(Long id);
|
||||
|
||||
List<MchManageVo> list(MchManageDto dto);
|
||||
|
||||
+1
-1
@@ -29,5 +29,5 @@ public interface WalletActiveService extends IService<WalletActiveEntity> {
|
||||
|
||||
Page<WalletActiveVo> pageJoin(Page page, WalletActiveDto dto);
|
||||
|
||||
Page<WalletActiveVo> scopePage(Page page, WalletActiveDto dto);
|
||||
Page<WalletActiveVo> scopePageList(Page page, WalletActiveDto dto);
|
||||
}
|
||||
+2
@@ -13,6 +13,8 @@ public interface WalletForeignService extends IService<WalletForeignEntity> {
|
||||
|
||||
Page<WalletForeignVo> pageJoin(Page page, WalletForeignDto dto);
|
||||
|
||||
Page<WalletForeignVo> scopePageList(Page page, WalletForeignDto dto);
|
||||
|
||||
WalletForeignVo join(Long id);
|
||||
|
||||
void applyCallback(ProcessNodeRecordAssignUserParamDto dto);
|
||||
|
||||
+2
@@ -11,6 +11,8 @@ public interface WalletFreezeService extends IService<WalletFreezeEntity> {
|
||||
|
||||
Page<WalletFreezeVo> pageJoin(Page page, WalletFreezeDto dto);
|
||||
|
||||
Page<WalletFreezeVo> scopePageList(Page page, WalletFreezeDto dto);
|
||||
|
||||
Long create(WalletFreezeDto dto);
|
||||
|
||||
void applyCallback(ProcessNodeRecordAssignUserParamDto dto);
|
||||
|
||||
+4
-1
@@ -78,12 +78,15 @@ public interface WalletManageService extends IService<WalletManageEntity> {
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
R pageJoin(Page page, WalletManageDto dto);
|
||||
Page<WalletManageVo> pageJoin(Page page, WalletManageDto dto);
|
||||
|
||||
Page<WalletManageVo> scopePageList(Page page, WalletManageDto dto);
|
||||
|
||||
WalletManageVo join(Long id, Long walletId);
|
||||
|
||||
/**
|
||||
* 生成钱包二维码参数
|
||||
*
|
||||
* @param walletId 钱包id
|
||||
*/
|
||||
String getQrCode(Long walletId);
|
||||
|
||||
+4
@@ -16,8 +16,12 @@ public interface WalletRechargeApplyService extends IService<WalletRechargeApply
|
||||
|
||||
void create(WalletRechargeApplyEntity dto);
|
||||
|
||||
Boolean edit(WalletRechargeApplyDto dto);
|
||||
|
||||
Page<WalletRechargeApplyVo> pageJoin(Page page, WalletRechargeApplyDto dto);
|
||||
|
||||
Page<WalletRechargeApplyVo> scopePageList(Page page, WalletRechargeApplyDto dto);
|
||||
|
||||
/**
|
||||
* 提交申请
|
||||
*
|
||||
|
||||
+2
@@ -13,6 +13,8 @@ public interface WalletRechargeService extends IService<WalletRechargeEntity> {
|
||||
|
||||
Page<WalletRechargeVo> pageJoin(Page page, WalletRechargeDto dto);
|
||||
|
||||
Page<WalletRechargeVo> scopePageList(Page page, WalletRechargeDto dto);
|
||||
|
||||
/**
|
||||
* app充值
|
||||
*
|
||||
|
||||
+2
@@ -12,6 +12,8 @@ public interface WalletStrideService extends IService<WalletStrideEntity> {
|
||||
|
||||
Page<WalletStrideVo> pageJoin(Page page, WalletStrideDto dto);
|
||||
|
||||
Page<WalletStrideVo> scopePageList(Page page, WalletStrideDto dto);
|
||||
|
||||
WalletStrideVo join(Long id);
|
||||
|
||||
Boolean apply(WalletStrideDto dto);
|
||||
|
||||
+1
-1
@@ -45,5 +45,5 @@ public interface WalletTransactionService extends IService<WalletTransactionEnti
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
Page<WalletTransactionVo> pageJoin(Page page, WalletTransactionDto dto);
|
||||
Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto);
|
||||
}
|
||||
+31
-7
@@ -1,6 +1,7 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -22,6 +23,7 @@ import com.bsd.pjcloud.wallet.mapper.MchManageMapper;
|
||||
import com.bsd.pjcloud.wallet.service.MchManageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
@@ -92,15 +94,15 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
}
|
||||
|
||||
@Override
|
||||
@CachePut(value = CacheConstants.WALLET_MCH, key = "dto.getId()", condition = "dto.getId() != null", unless = "#result == null ")
|
||||
@CacheEvict(value = CacheConstants.WALLET_MCH, key = "#dto.getId()", condition = "#dto.getId() != null")
|
||||
public void edit(MchManageEntity dto) {
|
||||
if (existName(dto.getName(), null)) {
|
||||
if (existName(dto.getName(), dto.getId())) {
|
||||
throw new CheckedException("商户名不能重复");
|
||||
}
|
||||
if (existDeptId(dto.getDeptId(), null)) {
|
||||
if (existDeptId(dto.getDeptId(), dto.getId())) {
|
||||
throw new CheckedException("改部门已经绑定过商户");
|
||||
}
|
||||
MchManageEntity mchManage = getById(dto.getId());
|
||||
MchManageEntity mchManage = getSelf().getById(dto.getId());
|
||||
if (ObjectUtil.isEmpty(mchManage)) {
|
||||
throw new CheckedException("商户不存在");
|
||||
}
|
||||
@@ -117,13 +119,31 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
|
||||
@Override
|
||||
public Page<MchManageVo> pageJoin(Page page, MchManageDto dto) {
|
||||
Page<MchManageVo> list = baseMapper.pageJoin(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(MchManageVo::getDeptId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = remoteDeptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<MchManageVo> scopePageList(Page page, MchManageDto dto) {
|
||||
Page<MchManageVo> list = baseMapper.scopePageList(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(MchManageVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = remoteDeptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = remoteDeptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@@ -190,4 +210,8 @@ public class MchManageServiceImpl extends ServiceImpl<MchManageMapper, MchManage
|
||||
}
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
private MchManageServiceImpl getSelf() {
|
||||
return SpringUtil.getBean(getClass());
|
||||
}
|
||||
}
|
||||
+5
-6
@@ -2,7 +2,6 @@ package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.bsd.pjcloud.admin.api.entity.SysDept;
|
||||
@@ -51,11 +50,11 @@ import java.util.Map;
|
||||
@Service
|
||||
public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, WalletActiveEntity> implements WalletActiveService {
|
||||
|
||||
private final WalletTypeMapper walletTypeMapper;
|
||||
|
||||
private final WalletTypeService walletTypeService;
|
||||
private final MchManageService mchManageService;
|
||||
|
||||
private final WalletTypeMapper walletTypeMapper;
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteDeptService deptService;
|
||||
|
||||
@@ -141,7 +140,7 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
walletTypeDto.setWalletTypeIds(walletTypeIds);
|
||||
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
|
||||
if (ObjectUtil.isNotEmpty(walletTypeList)) {
|
||||
WalletDataUtil.convertWalletTYpeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
|
||||
WalletDataUtil.convertWalletTypeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,8 +148,8 @@ public class WalletActiveServiceImpl extends ServiceImpl<WalletActiveMapper, Wal
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletActiveVo> scopePage(Page page, WalletActiveDto dto) {
|
||||
Page<WalletActiveVo> list = baseMapper.scopePage(page, dto);
|
||||
public Page<WalletActiveVo> scopePageList(Page page, WalletActiveDto dto) {
|
||||
Page<WalletActiveVo> list = baseMapper.scopePageList(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletActiveVo::getUserId).distinct().toList();
|
||||
|
||||
+34
-6
@@ -92,15 +92,43 @@ public class WalletForeignServiceImpl extends ServiceImpl<WalletForeignMapper, W
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletForeignVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletForeignVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletForeignVo> scopePageList(Page page, WalletForeignDto dto) {
|
||||
Page<WalletForeignVo> list = baseMapper.scopePageList(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletForeignVo::getUserId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletForeignVo::getDeptId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
||||
+38
-7
@@ -16,6 +16,7 @@ import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.common.core.constant.enums.YesNoEnum;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.flow.task.constant.NodeStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
@@ -67,15 +68,45 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletFreezeVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(page.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(page.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletFreezeVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletFreezeVo> scopePageList(Page page, WalletFreezeDto dto) {
|
||||
DataScope dataScope = new DataScope();
|
||||
dataScope.put("scopeDeptName", "a.dept_id");
|
||||
Page<WalletFreezeVo> list = baseMapper.scopePageList(page, dto, dataScope);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletFreezeVo::getUserId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(page.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletFreezeVo::getDeptId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(page.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
@@ -144,5 +175,5 @@ public class WalletFreezeServiceImpl extends ServiceImpl<WalletFreezeMapper, Wal
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+33
-2
@@ -25,8 +25,10 @@ import com.bsd.pjcloud.hard.api.dto.code.QRCodeDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.code.QRCodeExtraDto;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletTypeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletManageDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletSettingVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletManageMapper;
|
||||
@@ -198,7 +200,7 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
}
|
||||
|
||||
@Override
|
||||
public R pageJoin(Page page, WalletManageDto dto) {
|
||||
public Page<WalletManageVo> pageJoin(Page page, WalletManageDto dto) {
|
||||
Page<WalletManageVo> list = baseMapper.pageJoin(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
@@ -214,7 +216,36 @@ public class WalletManageServiceImpl extends ServiceImpl<WalletManageMapper, Wal
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
return R.ok(list);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletManageVo> scopePageList(Page page, WalletManageDto dto) {
|
||||
Page<WalletManageVo> list = baseMapper.scopePageList(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletManageVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletManageVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
// 饭卡类型
|
||||
List<Long> walletTypeId = list.getRecords().stream().map(WalletManageVo::getWalletTypeId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(walletTypeId)) {
|
||||
WalletTypeDto walletTypeDto = new WalletTypeDto();
|
||||
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
|
||||
if (ObjectUtil.isNotEmpty(walletTypeList)) {
|
||||
WalletDataUtil.convertWalletTypeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+34
-6
@@ -103,15 +103,43 @@ public class WalletStrideServiceImpl extends ServiceImpl<WalletStrideMapper, Wal
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletStrideVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletStrideVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletStrideVo> scopePageList(Page page, WalletStrideDto dto) {
|
||||
Page<WalletStrideVo> list = baseMapper.scopePageList(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletStrideVo::getUserId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletStrideVo::getDeptId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
|
||||
+2
-2
@@ -153,7 +153,7 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletTransactionVo> pageJoin(Page page, WalletTransactionDto dto) {
|
||||
public Page<WalletTransactionVo> scopePageList(Page page, WalletTransactionDto dto) {
|
||||
Page<WalletTransactionVo> list = baseMapper.scopePageList(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
@@ -185,7 +185,7 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
walletTypeDto.setWalletTypeIds(walletTypeIds);
|
||||
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
|
||||
if (ObjectUtil.isNotEmpty(walletTypeList)) {
|
||||
WalletDataUtil.convertWalletTYpeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
|
||||
WalletDataUtil.convertWalletTypeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
|
||||
}
|
||||
}
|
||||
// 订单
|
||||
|
||||
+1
-1
@@ -53,7 +53,6 @@ public class WalletRechargeApplyComposeServiceImpl implements WalletRechargeAppl
|
||||
|
||||
if (ObjectUtil.isEmpty(topUpApplyDetail)) return result;
|
||||
if (ObjectUtil.isEmpty(topUpApplyDetail.getImportTime())) return result;
|
||||
rechargeApplyService.updateBeforePrice(topUpApplyDetail);
|
||||
|
||||
Page<WalletRechargeApplyCompareVo> resultVo = new Page<>();
|
||||
List<WalletRechargeApplyCompareVo> resultList = new ArrayList<>();
|
||||
@@ -61,6 +60,7 @@ public class WalletRechargeApplyComposeServiceImpl implements WalletRechargeAppl
|
||||
// 刚刚倒入的数据
|
||||
String monthTimeStr = LocalDateTimeUtil.format(topUpApplyDetail.getImportTime(), DatePattern.NORM_MONTH_PATTERN);
|
||||
WalletRechargeImportDto importDto = new WalletRechargeImportDto();
|
||||
importDto.setApplyId(dto.getId());
|
||||
IPage<WalletRechargeImportVo> userPage = rechargeImportService.pageJoin(page, importDto);
|
||||
List<WalletRechargeImportVo> userList = userPage.getRecords();
|
||||
resultVo.setTotal(userPage.getTotal());
|
||||
|
||||
+75
-8
@@ -4,6 +4,7 @@ import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.lang.Validator;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -16,6 +17,7 @@ import com.bsd.pjcloud.admin.api.feign.RemoteUserService;
|
||||
import com.bsd.pjcloud.admin.api.utils.DataUtil;
|
||||
import com.bsd.pjcloud.common.core.exception.CheckedException;
|
||||
import com.bsd.pjcloud.common.core.exception.ErrorCodes;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.CollectionUtils;
|
||||
import com.bsd.pjcloud.common.core.util.MsgUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
@@ -27,14 +29,17 @@ import com.bsd.pjcloud.flow.task.constant.TaskCheckStatusEnum;
|
||||
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.constant.WalletBizRechargeEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTypeDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.recharge.WalletRechargeApplyDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.excel.WalletRechargeExcelDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeApplyEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.recharge.WalletRechargeImportEntity;
|
||||
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.WalletRechargeApplyVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTransactionMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.recharge.WalletRechargeApplyMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletRechargeApplyService;
|
||||
@@ -72,6 +77,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
private final WalletTypeService walletTypeService;
|
||||
|
||||
private final WalletTransactionMapper walletTransactionMapper;
|
||||
private final WalletTypeMapper walletTypeMapper;
|
||||
|
||||
private final RemoteUserService userService;
|
||||
private final RemoteDeptService deptService;
|
||||
@@ -86,31 +92,84 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
baseMapper.insert(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean edit(WalletRechargeApplyDto dto) {
|
||||
WalletRechargeApplyEntity detail = baseMapper.selectById(dto.getId());
|
||||
if (ObjectUtil.isEmpty(detail)) throw new RuntimeException("申请不存在");
|
||||
WalletRechargeApplyEntity updateObj = BeanUtils.toBean(dto, WalletRechargeApplyEntity.class);
|
||||
baseMapper.updateById(updateObj);
|
||||
getSelf().updateBeforePrice(baseMapper.selectById(dto.getId()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletRechargeApplyVo> pageJoin(Page page, WalletRechargeApplyDto dto) {
|
||||
Page<WalletRechargeApplyVo> list = baseMapper.pageJoin(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletRechargeApplyVo::getUserId).distinct().toList();
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletRechargeApplyVo::getDeptId).distinct().toList();
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletRechargeApplyVo> scopePageList(Page page, WalletRechargeApplyDto dto) {
|
||||
Page<WalletRechargeApplyVo> list = baseMapper.scopePageList(page, dto);
|
||||
if (ObjectUtil.isNotEmpty(list.getRecords())) {
|
||||
// 用户
|
||||
List<Long> userIds = list.getRecords().stream().map(WalletRechargeApplyVo::getUserId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(userIds)) {
|
||||
R<List<SysUser>> userList = userService.getUserById(new ArrayList<>(userIds));
|
||||
if (ObjectUtil.isNotEmpty(userList.getData())) {
|
||||
DataUtil.convertUserList(list.getRecords(), CollectionUtils.convertMap(userList.getData(), SysUser::getUserId));
|
||||
}
|
||||
}
|
||||
// 部门
|
||||
List<Long> deptIds = list.getRecords().stream().map(WalletRechargeApplyVo::getDeptId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(deptIds)) {
|
||||
R<Map<Long, SysDept>> deptList = deptService.getDeptByDeptIds(deptIds);
|
||||
if (ObjectUtil.isNotEmpty(deptList.getData())) {
|
||||
DataUtil.convertDeptList(list.getRecords(), deptList.getData());
|
||||
}
|
||||
}
|
||||
// 饭卡类型
|
||||
List<Long> walletTypeIds = list.getRecords().stream().map(WalletRechargeApplyVo::getWalletTypeId).distinct().toList();
|
||||
if (ObjectUtil.isNotEmpty(walletTypeIds)) {
|
||||
WalletTypeDto walletTypeDto = new WalletTypeDto();
|
||||
walletTypeDto.setWalletTypeIds(walletTypeIds);
|
||||
List<WalletTypeEntity> walletTypeList = walletTypeMapper.list(walletTypeDto);
|
||||
if (ObjectUtil.isNotEmpty(walletTypeList)) {
|
||||
WalletDataUtil.convertWalletTypeList(list.getRecords(), CollectionUtils.convertMap(walletTypeList, WalletTypeEntity::getId));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void apply(Long id) {
|
||||
// 查询详情
|
||||
WalletRechargeApplyEntity detail = baseMapper.selectById(id);
|
||||
if (ObjectUtil.isEmpty(detail)) throw new CheckedException("充值申请不存在");
|
||||
if (!ObjectUtil.isAllNotEmpty(detail.getImportTime(), detail.getWalletTypeId())) {
|
||||
throw new CheckedException("请先编辑导入时间等信息");
|
||||
}
|
||||
// 判断之前有没有在审核的
|
||||
if (isCheckData(detail.getUserId())) throw new RuntimeException("已提交申请,请勿重复提交");
|
||||
// 查询用户
|
||||
@@ -138,6 +197,8 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
updateObj.setProcessId(processId);
|
||||
updateObj.setProcessStatus(TaskCheckStatusEnum.PADDING.getCode());
|
||||
baseMapper.updateById(updateObj);
|
||||
// 更新之间的总金额
|
||||
getSelf().updateBeforePrice(detail);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -229,6 +290,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
.eq(WalletRechargeImportEntity::getApplyId, detail.getId())
|
||||
);
|
||||
if (ObjectUtil.isEmpty(importList)) return;
|
||||
getSelf().updateBeforePrice(detail);
|
||||
if (ObjectUtil.equals(detail.getBizType(), WalletBizRechargeEnum.REDUCTION.getCode())) {
|
||||
importList.forEach(v -> v.setPrice(-1 * Math.abs(v.getPrice())));
|
||||
}
|
||||
@@ -247,8 +309,9 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateBeforePrice(WalletRechargeApplyEntity detail) {
|
||||
if (!ObjectUtil.equals(detail.getProcessStatus(), TaskCheckStatusEnum.PADDING.getCode())) {
|
||||
if (ObjectUtil.isNotEmpty(detail.getProcessStatus()) || ObjectUtil.equals(detail.getProcessStatus(), TaskCheckStatusEnum.PADDING.getCode())) {
|
||||
return;
|
||||
}
|
||||
String importTimeStr = LocalDateTimeUtil.format(detail.getImportTime(), DatePattern.NORM_MONTH_PATTERN);
|
||||
@@ -268,7 +331,7 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
}
|
||||
saveList.add(item);
|
||||
}
|
||||
rechargeImportService.saveBatch(saveList);
|
||||
rechargeImportService.updateBatchById(saveList);
|
||||
}
|
||||
|
||||
private boolean isCheckData(Long walletId) {
|
||||
@@ -278,4 +341,8 @@ public class WalletRechargeApplyServiceImpl extends ServiceImpl<WalletRechargeAp
|
||||
);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
private WalletRechargeApplyServiceImpl getSelf() {
|
||||
return SpringUtil.getBean(getClass());
|
||||
}
|
||||
}
|
||||
+6
@@ -52,6 +52,12 @@ public class WalletRechargeServiceImpl extends ServiceImpl<WalletRechargeMapper,
|
||||
return baseMapper.pageJoin(page, dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<WalletRechargeVo> scopePageList(Page page, WalletRechargeDto dto) {
|
||||
Page<WalletRechargeVo> list = baseMapper.scopePageList(page, dto);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public WalletRechargeEntity createWalletRecharge(WalletAppRechargeDto dto) {
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.bsd.pjcloud.wallet.mapper.WalletFreezeMapper">
|
||||
|
||||
<resultMap id="walletFreezeMap" type="com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity">
|
||||
<resultMap id="walletFreezeMap" type="com.bsd.pjcloud.wallet.api.entity.WalletFreezeEntity">
|
||||
<id property="id" column="id"/>
|
||||
<result property="processId" column="process_id"/>
|
||||
<result property="processStatus" column="process_status"/>
|
||||
<result property="walletId" column="wallet_id"/>
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="deptId" column="dept_id"/>
|
||||
<result property="freeStatus" column="free_status"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
@@ -15,5 +17,46 @@
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectA">
|
||||
select a.id,
|
||||
a.process_id,
|
||||
a.process_status,
|
||||
a.wallet_id,
|
||||
a.user_id,
|
||||
a.dept_id,
|
||||
a.free_status,
|
||||
a.remark,
|
||||
a.create_by,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.update_time,
|
||||
a.del_flag,
|
||||
a.tenant_id,
|
||||
</sql>
|
||||
|
||||
<sql id="whereA">
|
||||
a.del_flag = 0
|
||||
<if test="dto.userIds != null and dto.userIds.size() != 0">
|
||||
and a.user_id in
|
||||
<foreach collection="dto.userIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="scopePageList" resultType="com.bsd.pjcloud.wallet.api.vo.WalletFreezeVo">
|
||||
<include refid="selectA"/>
|
||||
w.wallet_type_id,
|
||||
w.card_number
|
||||
from wallet_freeze a
|
||||
left join wallet_manage w on w.id = a.wallet_id
|
||||
<where>
|
||||
<include refid="whereA"/>
|
||||
<if test="dto.userIds">
|
||||
and w.card_number like concat('%', #{dto.cardNumber}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -16,9 +16,7 @@
|
||||
~ this software without specific prior written permission.
|
||||
~ Author: pjcloud
|
||||
~
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.bsd</groupId>
|
||||
@@ -125,7 +123,8 @@
|
||||
<module>pjcloud-wallet</module>
|
||||
<module>pjcloud-supermarket</module>
|
||||
<module>pjcloud-hardware</module>
|
||||
</modules>
|
||||
<module>pjcloud-mqtt</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
||||
Reference in new issue
Block a user