Merge remote-tracking branch 'origin/master'

This commit is contained in:
zjf committed 2025-01-07 15:16:43 +08:00
commit 9f79cd5389
17 files changed
+188 -90

No files matched your search

@@ -81,6 +81,7 @@ public class PjcloudAuthenticationFailureEventHandler implements AuthenticationF
public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response,
AuthenticationException exception) {
String grantType = request.getParameter(OAuth2ParameterNames.GRANT_TYPE);
exception.printStackTrace();
log.info("登录失败,异常:{}", exception.getLocalizedMessage());
// 密码模式记录错误信息
@@ -60,7 +60,6 @@ public class SysFileController {
private final SysFileService sysFileService;
/* ************************************* start 远程调用 start ************************************* */
@Inner
@PostMapping(value = "/inner-upload")
public R innerUpload(@RequestPart("file") MultipartFile file, @RequestParam(value = "dir", required = false) String dir,
@@ -68,8 +67,7 @@ public class SysFileController {
@RequestParam(value = "type", required = false) String type) {
return sysFileService.innerUpload(file, dir, groupId, type);
}
/* ************************************* start 远程调用 start ************************************* */
/* ************************************* end 远程调用 end ************************************* */
/**
* 分页查询
@@ -7,9 +7,12 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.admin.api.dto.SysUserFaceDto;
import com.bsd.pjcloud.admin.api.entity.SysUserFaceEntity;
import com.bsd.pjcloud.admin.api.vo.SysUserFaceVo;
import com.bsd.pjcloud.admin.service.SysUserFaceService;
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 org.springframework.security.access.prepost.PreAuthorize;
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
@@ -41,14 +44,41 @@ public class SysUserFaceController {
/* ************************************* start app start ************************************* */
@Operation(summary = "app查询人脸列表", description = "app查询人脸列表")
@GetMapping("/app/page-join")
public R appPageJoin(@ParameterObject Page page, @ParameterObject SysUserFaceDto dto) {
public R<Page<SysUserFaceVo>> appPageJoin(@ParameterObject Page page, @ParameterObject SysUserFaceDto dto) {
PjcloudUser user = SecurityUtils.getUser();
dto.setUserId(user.getId());
return R.ok(sysUserFaceService.pageJoin(page, dto));
}
@Operation(summary = "app查询人脸列表", description = "app查询人脸列表")
@Operation(summary = "app查询人脸详情", description = "app查询人脸详情")
@GetMapping("/app/detail")
public R appDetail(@ParameterObject Page page, @ParameterObject SysUserFaceDto dto) {
return R.ok(sysUserFaceService.pageJoin(page, dto));
public R<SysUserFaceVo> appDetail(@ParameterObject Long id) {
return R.ok(sysUserFaceService.join(id));
}
@Operation(summary = "新增人脸样本表", description = "新增人脸样本表")
@SysLog("app新增人脸样本表")
@PostMapping("/app")
public R appSave(@RequestBody SysUserFaceEntity dto) {
PjcloudUser user = SecurityUtils.getUser();
dto.setUserId(user.getId());
return R.ok(sysUserFaceService.create(dto));
}
@Operation(summary = "app修改人脸样本表", description = "修改人脸样本表")
@SysLog("修改人脸样本表")
@PutMapping("/app")
public R appUpdateById(@RequestBody SysUserFaceEntity sysUserFace) {
sysUserFaceService.edit(sysUserFace);
return R.ok(true);
}
@Operation(summary = "app删除人脸", description = "通过id删除人脸样本表")
@SysLog("app通过id删除人脸样本表")
@DeleteMapping("/app")
public R appRemoveById(@RequestParam Long id) {
sysUserFaceService.delByIds(CollUtil.toList(id));
return R.ok(true);
}
/* ************************************* end app end ************************************* */
@@ -13,7 +13,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface SysUserFaceMapper extends PjcloudBaseMapper<SysUserFaceEntity> {
default IPage<SysUserFaceVo> pageJoin(Page page, SysUserFaceDto dto) {
default Page<SysUserFaceVo> pageJoin(Page page, SysUserFaceDto dto) {
MPJLambdaWrapper<SysUserFaceEntity> wrapper = new MPJLambdaWrapper<SysUserFaceEntity>()
.selectAll(SysUserFaceEntity.class)
.selectAs(SysUser::getName, SysUserFaceVo::getUsername)
@@ -22,4 +22,12 @@ public interface SysUserFaceMapper extends PjcloudBaseMapper<SysUserFaceEntity>
return selectJoinPage(page, SysUserFaceVo.class, wrapper);
}
default SysUserFaceVo join(Long id) {
MPJLambdaWrapper<SysUserFaceEntity> wrapper = new MPJLambdaWrapper<SysUserFaceEntity>()
.selectAll(SysUserFaceEntity.class)
.selectAs(SysUser::getName, SysUserFaceVo::getUsername)
.leftJoin(SysUser.class, SysUser::getUserId, SysUserFaceEntity::getUserId)
.eq(SysUserFaceEntity::getId, id);
return selectJoinOne(SysUserFaceVo.class, wrapper);
}
}
@@ -18,5 +18,7 @@ public interface SysUserFaceService extends IService<SysUserFaceEntity> {
void delByIds(ArrayList<Long> list);
IPage<SysUserFaceVo> pageJoin(Page page, SysUserFaceDto dto);
Page<SysUserFaceVo> pageJoin(Page page, SysUserFaceDto dto);
SysUserFaceVo join(Long id);
}
@@ -108,6 +108,8 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
resultMap.put("url", String.format("/admin/sys-file/oss/file?fileName=%s", fileName));
try (InputStream inputStream = file.getInputStream()) {
fileTemplate.putObject(properties.getBucketName(), dir, fileName, inputStream, file.getContentType());
// 文件管理数据记录,收集管理追踪文件
innerFileLog(file, dir, fileName, groupId, type);
} catch (Exception e) {
return R.failed(e.getLocalizedMessage());
}
@@ -258,4 +260,28 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
this.save(sysFile);
}
@SneakyThrows
private void innerFileLog(MultipartFile file, String dir, String fileName, Long groupId, String type) {
// 创建SysFile对象并设置相关属性
SysFile sysFile = new SysFile();
sysFile.setFileName(fileName);
// 对原始文件名进行编码转换
String originalFilename = new String(
Objects.requireNonNull(file.getOriginalFilename()).getBytes(StandardCharsets.ISO_8859_1),
StandardCharsets.UTF_8);
sysFile.setDir(dir);
sysFile.setOriginal(originalFilename);
sysFile.setFileSize(file.getSize());
sysFile.setBucketName(properties.getBucketName());
sysFile.setType(type);
sysFile.setGroupId(groupId);
sysFile.setHash(SecureUtil.md5(file.getInputStream()));
sysFile.setCreateBy("SYSTEM");
sysFile.setUpdateBy("SYSTEM");
// 调用save方法保存SysFile对象
this.save(sysFile);
}
}
@@ -51,7 +51,12 @@ public class SysUserFaceServiceImpl extends ServiceImpl<SysUserFaceMapper, SysUs
}
@Override
public IPage<SysUserFaceVo> pageJoin(Page page, SysUserFaceDto dto) {
public Page<SysUserFaceVo> pageJoin(Page page, SysUserFaceDto dto) {
return baseMapper.pageJoin(page, dto);
}
@Override
public SysUserFaceVo join(Long id) {
return baseMapper.join(id);
}
}
@@ -1,11 +1,16 @@
package com.bsd.pjcloud.wallet.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bsd.pjcloud.common.core.util.R;
import com.bsd.pjcloud.common.security.annotation.Inner;
import com.bsd.pjcloud.wallet.api.constant.WalletCodeBizEnum;
import com.bsd.pjcloud.wallet.api.dto.WalletCodeUseDto;
import com.bsd.pjcloud.wallet.service.WalletCodeUseService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -36,4 +41,18 @@ public class WalletCodeUseController {
}
/* ************************************* end 远程调用 end ************************************* */
/* ************************************* start app start ************************************* */
@Operation(summary = "app二维码列表", description = "app二维码列表")
@GetMapping("/app/code-list")
public R appCodeList(@ParameterObject Page page, @ParameterObject WalletCodeUseDto dto) {
return R.ok(walletCodeUseService.pageJoin(page, dto));
}
/* ************************************* end app end ************************************* */
@Operation(summary = "二维码列表", description = "二维码列表")
@GetMapping("/code-list")
public R codeList(@ParameterObject Page page, @ParameterObject WalletCodeUseDto dto) {
return R.ok(walletCodeUseService.pageJoin(page, dto));
}
}
@@ -16,6 +16,7 @@ import com.bsd.pjcloud.wallet.api.dto.WalletCodeUseDto;
import com.bsd.pjcloud.wallet.api.dto.WalletForeignDto;
import com.bsd.pjcloud.wallet.api.entity.WalletCodeUseEntity;
import com.bsd.pjcloud.wallet.api.entity.WalletForeignEntity;
import com.bsd.pjcloud.wallet.api.vo.WalletForeignVo;
import com.bsd.pjcloud.wallet.service.WalletCodeUseService;
import com.bsd.pjcloud.wallet.service.WalletForeignService;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -47,14 +48,37 @@ public class WalletForeignController {
private final WalletCodeUseService walletCodeUseService;
/* ************************************* start flow callback start ************************************* */
@Inner(value = false)
@PostMapping("/apply-callback")
public void applyCallback(@RequestBody ProcessNodeRecordAssignUserParamDto dto) {
walletForeignService.applyCallback(dto);
}
/* ************************************* end flow callback end ************************************* */
/* ************************************* start flow callback start ************************************* */
/* ************************************* start app start ************************************* */
@Operation(summary = "app分页", description = "app分页")
@GetMapping("/app/page-join")
public R<Page<WalletForeignVo>> appPageJoin(@ParameterObject Page page, @ParameterObject WalletForeignDto dto) {
PjcloudUser user = SecurityUtils.getUser();
dto.setUserId(user.getId());
return R.ok(walletForeignService.pageJoin(page, dto));
}
@Operation(summary = "app查询详情", description = "app分页")
@GetMapping("/app/detail")
public R<WalletForeignVo> appPageJoin(@RequestParam Long id) {
return R.ok(walletForeignService.join(id));
}
@Operation(summary = "App新增外来人员电子餐券表", description = "App新增外来人员电子餐券表")
@SysLog("App新增外来人员电子餐券表")
@PostMapping("/app/apply")
public R appSave(@RequestBody WalletForeignDto dto) {
PjcloudUser loginUser = SecurityUtils.getUser();
dto.setUserId(loginUser.getId());
return R.ok(walletForeignService.create(dto));
}
/* ************************************* end app end ************************************* */
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@@ -71,22 +95,6 @@ public class WalletForeignController {
return R.ok(walletForeignService.pageJoin(page, dto));
}
@Operation(summary = "二维码列表", description = "二维码列表")
@GetMapping("/code-list")
public R codeList(@ParameterObject Page page, @ParameterObject WalletCodeUseDto dto) {
dto.setBizType(WalletCodeBizEnum.FOREIGN.getCode());
return R.ok(walletCodeUseService.pageJoin(page, dto));
}
@Operation(summary = "app二维码列表", description = "app二维码列表")
@GetMapping("/app/code-list")
public R appCodeList(@ParameterObject Page page, @ParameterObject WalletCodeUseDto dto) {
PjcloudUser loginUser = SecurityUtils.getUser();
dto.setUserId(loginUser.getId());
dto.setBizType(WalletCodeBizEnum.FOREIGN.getCode());
return R.ok(walletCodeUseService.pageJoin(page, dto));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('wallet_walletForeign_view')")
@@ -102,15 +110,6 @@ public class WalletForeignController {
return R.ok(walletForeignService.create(dto));
}
@Operation(summary = "App新增外来人员电子餐券表", description = "App新增外来人员电子餐券表")
@SysLog("App新增外来人员电子餐券表")
@PostMapping("/app")
public R appSave(@RequestBody WalletForeignDto dto) {
PjcloudUser loginUser = SecurityUtils.getUser();
dto.setUserId(loginUser.getId());
return R.ok(walletForeignService.create(dto));
}
@Operation(summary = "修改外来人员电子餐券表", description = "修改外来人员电子餐券表")
@SysLog("修改外来人员电子餐券表")
@PutMapping
@@ -119,12 +118,6 @@ public class WalletForeignController {
return R.ok(walletForeignService.updateById(walletForeign));
}
/**
* 通过id删除外来人员电子餐券表
*
* @param ids id列表
* @return R
*/
@Operation(summary = "通过id删除外来人员电子餐券表", description = "通过id删除外来人员电子餐券表")
@SysLog("通过id删除外来人员电子餐券表")
@DeleteMapping
@@ -6,15 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.feign.annotation.NoToken;
import com.bsd.pjcloud.common.log.annotation.SysLog;
import com.bsd.pjcloud.common.security.annotation.Inner;
import com.bsd.pjcloud.common.security.service.PjcloudUser;
import com.bsd.pjcloud.common.security.util.SecurityUtils;
import com.bsd.pjcloud.flow.task.dto.ProcessNodeRecordAssignUserParamDto;
import com.bsd.pjcloud.wallet.api.constant.WalletCodeBizEnum;
import com.bsd.pjcloud.wallet.api.dto.WalletCodeUseDto;
import com.bsd.pjcloud.wallet.api.dto.WalletForeignDto;
import com.bsd.pjcloud.wallet.api.dto.WalletStrideDto;
import com.bsd.pjcloud.wallet.api.entity.WalletStrideEntity;
import com.bsd.pjcloud.wallet.service.WalletCodeUseService;
@@ -53,7 +49,32 @@ public class WalletStrideController {
public void applyCallback(@RequestBody ProcessNodeRecordAssignUserParamDto dto) {
walletStrideService.applyCallback(dto);
}
/* ************************************* start flow callback start ************************************* */
/* ************************************* end flow callback end ************************************* */
/* ************************************* start app start ************************************* */
@Operation(summary = "app分页", description = "app分页")
@GetMapping("/app/page-join")
public R appPageJoin(@ParameterObject Page page, @ParameterObject WalletStrideDto dto) {
PjcloudUser user = SecurityUtils.getUser();
dto.setUserId(user.getId());
return R.ok(walletStrideService.pageJoin(page, dto));
}
@Operation(summary = "app详情", description = "app详情")
@GetMapping("/app/detail")
public R appPageJoin(@RequestParam Long id) {
return R.ok(walletStrideService.join(id));
}
@Operation(summary = "app申请", description = "app申请")
@SysLog("app申请")
@PostMapping("/app/apply")
public R appSave(@RequestBody WalletStrideDto dto) {
PjcloudUser loginUser = SecurityUtils.getUser();
dto.setUserId(loginUser.getId());
return R.ok(walletStrideService.create(dto));
}
/* ************************************* end app end ************************************* */
@Operation(summary = "分页查询", description = "分页查询")
@GetMapping("/page")
@@ -70,22 +91,6 @@ public class WalletStrideController {
return R.ok(walletStrideService.pageJoin(page, dto));
}
@Operation(summary = "二维码列表", description = "二维码列表")
@GetMapping("/code-list")
public R codeList(@ParameterObject Page page, @ParameterObject WalletCodeUseDto dto) {
dto.setBizType(WalletCodeBizEnum.STRIDE.getCode());
return R.ok(walletCodeUseService.pageJoin(page, dto));
}
@Operation(summary = "app二维码列表", description = "app二维码列表")
@GetMapping("/app/code-list")
public R appCodeList(@ParameterObject Page page, @ParameterObject WalletCodeUseDto dto) {
PjcloudUser loginUser = SecurityUtils.getUser();
dto.setUserId(loginUser.getId());
dto.setBizType(WalletCodeBizEnum.STRIDE.getCode());
return R.ok(walletCodeUseService.pageJoin(page, dto));
}
@Operation(summary = "通过id查询", description = "通过id查询")
@GetMapping("/{id}")
@PreAuthorize("@pms.hasPermission('admin_walletStride_view')")
@@ -101,23 +106,6 @@ public class WalletStrideController {
return R.ok(walletStrideService.create(dto));
}
@Operation(summary = "新增跨单位就餐", description = "新增跨单位就餐")
@SysLog("新增跨单位就餐")
@PostMapping("/app")
public R appSave(@RequestBody WalletStrideDto dto) {
PjcloudUser loginUser = SecurityUtils.getUser();
dto.setUserId(loginUser.getId());
return R.ok(walletStrideService.create(dto));
}
@Operation(summary = "新增跨单位就餐", description = "新增跨单位就餐")
@SysLog("admin申请")
@PostMapping("/apply")
@PreAuthorize("@pms.hasPermission('admin_walletStride_apply')")
public R apply(@RequestBody WalletStrideDto dto) {
return R.ok(walletStrideService.apply(dto));
}
@Operation(summary = "新增跨单位就餐", description = "新增跨单位就餐")
@SysLog("app申请")
@PostMapping("/app-apply")
@@ -15,8 +15,16 @@ public interface WalletForeignMapper extends PjcloudBaseMapper<WalletForeignEnti
default Page<WalletForeignVo> pageJoin(Page page, WalletForeignDto dto) {
MPJLambdaWrapper<WalletForeignEntity> wrapper = new MPJLambdaWrapper<WalletForeignEntity>()
.selectAll(WalletForeignEntity.class)
.eqIfExists(WalletForeignEntity::getProcessStatus, dto.getProcessStatus())
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletForeignEntity::getDeptId, dto.getDeptIds())
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletForeignEntity::getUserId, dto.getUserIds());
return selectJoinPage(page, WalletForeignVo.class, wrapper);
}
default WalletForeignVo join(Long id) {
MPJLambdaWrapper<WalletForeignEntity> wrapper = new MPJLambdaWrapper<WalletForeignEntity>()
.selectAll(WalletForeignEntity.class)
.eq(WalletForeignEntity::getId, id);
return selectJoinOne(WalletForeignVo.class, wrapper);
}
}
@@ -15,9 +15,16 @@ public interface WalletStrideMapper extends PjcloudBaseMapper<WalletStrideEntity
default Page<WalletStrideVo> pageJoin(Page page, WalletStrideDto dto) {
MPJLambdaWrapper<WalletStrideEntity> wrapper = new MPJLambdaWrapper<WalletStrideEntity>()
.selectAll(WalletStrideEntity.class)
.eqIfExists(WalletStrideEntity::getProcessStatus, dto.getProcessStatus())
.in(ObjectUtil.isNotEmpty(dto.getDeptIds()), WalletStrideEntity::getDeptId, dto.getDeptIds())
.in(ObjectUtil.isNotEmpty(dto.getUserIds()), WalletStrideEntity::getUserId, dto.getUserIds());
return selectJoinPage(page, WalletStrideVo.class, wrapper);
}
default WalletStrideVo join(Long id) {
MPJLambdaWrapper<WalletStrideEntity> wrapper = new MPJLambdaWrapper<WalletStrideEntity>()
.selectAll(WalletStrideEntity.class)
.eq(WalletStrideEntity::getId, id);
return selectJoinOne(WalletStrideVo.class, wrapper);
}
}
@@ -13,5 +13,7 @@ public interface WalletForeignService extends IService<WalletForeignEntity> {
Page<WalletForeignVo> pageJoin(Page page, WalletForeignDto dto);
WalletForeignVo join(Long id);
void applyCallback(ProcessNodeRecordAssignUserParamDto dto);
}
@@ -10,13 +10,13 @@ import jakarta.validation.constraints.NotNull;
public interface WalletStrideService extends IService<WalletStrideEntity> {
Page<WalletStrideVo> pageJoin(Page page, WalletStrideDto dto);
WalletStrideVo join(Long id);
Boolean apply(WalletStrideDto dto);
Long create(WalletStrideDto dto);
Page<WalletStrideVo> pageJoin(Page page, WalletStrideDto dto);
WalletStrideVo detail(@NotNull Long id);
void applyCallback(ProcessNodeRecordAssignUserParamDto dto);
}
@@ -1,6 +1,5 @@
package com.bsd.pjcloud.wallet.service.impl;
import cn.hutool.core.lang.Pair;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -78,7 +77,7 @@ public class WalletCodeUseServiceImpl extends ServiceImpl<WalletCodeUseMapper, W
Map data = (Map) upload.getData();
String url = (String) data.get("url");
// 更新
WalletCodeUseEntity updateObj = WalletCodeUseEntity.builder().code(url).codeContent(code.getRight()).build();
WalletCodeUseEntity updateObj = WalletCodeUseEntity.builder().id(item.getId()).code(url).codeContent(code.getRight()).build();
baseMapper.updateById(updateObj);
} catch (Exception e) {
e.printStackTrace();
@@ -94,6 +94,15 @@ public class WalletForeignServiceImpl extends ServiceImpl<WalletForeignMapper, W
return list;
}
@Override
public WalletForeignVo join(Long id) {
WalletForeignVo detail = baseMapper.join(id);
if (ObjectUtil.isNotEmpty(detail)) {
}
return detail;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void applyCallback(ProcessNodeRecordAssignUserParamDto dto) {
@@ -111,7 +120,7 @@ public class WalletForeignServiceImpl extends ServiceImpl<WalletForeignMapper, W
if (isConsent) {
walletCodeUseService.generate(detail.getId(), detail.getUserId(), WalletCodeBizEnum.FOREIGN, detail.getCount());
}
}catch (Exception e) {
} catch (Exception e) {
e.printStackTrace();
log.error("|{}|审批回调意外的错误,dto:|{}|error:|{}|", TAG, JSON.toJSONString(dto), e.getMessage());
}
@@ -104,9 +104,12 @@ public class WalletStrideServiceImpl extends ServiceImpl<WalletStrideMapper, Wal
}
@Override
public WalletStrideVo detail(Long id) {
public WalletStrideVo join(Long id) {
WalletStrideVo detail = baseMapper.join(id);
if (ObjectUtil.isNotEmpty(detail)) {
return null;
}
return detail;
}
@Override