fix: 优化逻辑
This commit is contained in:
parent
593003bf33
commit
5f04dae69c
@ -204,7 +204,7 @@ public class FishDraftDataController {
|
||||
@PostMapping("/submitDraftsAll")
|
||||
@Operation(summary = "批量提交当前用户全部草稿")
|
||||
public ResponseResult submitDraftsAll() {
|
||||
List<FishDraftData> draft = fishDraftDataService.list(new LambdaQueryWrapper<FishDraftData>().eq(FishDraftData::getCreatedBy, SecurityUtils.getUserId()).in(FishDraftData::getStatus,"REJECTED", "DRAFT").select(FishDraftData::getId));
|
||||
List<FishDraftData> draft = fishDraftDataService.list(new LambdaQueryWrapper<FishDraftData>().eq(FishDraftData::getDeletedFlag, 0).eq(FishDraftData::getCreatedBy, SecurityUtils.getUserId()).in(FishDraftData::getStatus,"REJECTED", "DRAFT").select(FishDraftData::getId));
|
||||
List<String> ids = draft.stream().map(FishDraftData::getId).toList();
|
||||
boolean result = fishDraftDataService.submitDrafts(ids);
|
||||
return result ? ResponseResult.success("提交成功") : ResponseResult.error("提交失败");
|
||||
@ -232,7 +232,7 @@ public class FishDraftDataController {
|
||||
if (request.getApprovalIds().isEmpty()) {
|
||||
return ResponseResult.error("请选择审批批次");
|
||||
}
|
||||
List<FishDraftData> draft = fishDraftDataService.list(new LambdaQueryWrapper<FishDraftData>().in(FishDraftData::getApprovalId, request.getApprovalIds()).eq(FishDraftData::getStatus, "PENDING").select(FishDraftData::getId));
|
||||
List<FishDraftData> draft = fishDraftDataService.list(new LambdaQueryWrapper<FishDraftData>().eq(FishDraftData::getDeletedFlag, 0).in(FishDraftData::getApprovalId, request.getApprovalIds()).eq(FishDraftData::getStatus, "PENDING").select(FishDraftData::getId));
|
||||
List<String> ids = draft.stream().map(FishDraftData::getId).toList();
|
||||
boolean result = fishDraftDataService.batchApprove(ids, request.getApproveComment());
|
||||
return result ? ResponseResult.success("审批通过") : ResponseResult.error("审批失败");
|
||||
@ -249,7 +249,7 @@ public class FishDraftDataController {
|
||||
@Operation(summary = "批量驳回")
|
||||
public ResponseResult batchRejectFull(@RequestBody BatchRejectRequest request) {
|
||||
if (request.getApprovalIds() != null && !request.getApprovalIds().isEmpty()) {
|
||||
List<FishDraftData> draft = fishDraftDataService.list(new LambdaQueryWrapper<FishDraftData>().in(FishDraftData::getApprovalId, request.getApprovalIds()).eq(FishDraftData::getStatus, "PENDING").select(FishDraftData::getId));
|
||||
List<FishDraftData> draft = fishDraftDataService.list(new LambdaQueryWrapper<FishDraftData>().eq(FishDraftData::getDeletedFlag, 0).in(FishDraftData::getApprovalId, request.getApprovalIds()).eq(FishDraftData::getStatus, "PENDING").select(FishDraftData::getId));
|
||||
List<String> ids = draft.stream().map(FishDraftData::getId).toList();
|
||||
boolean result = fishDraftDataService.rejectBatch(ids, request.getRejectReason());
|
||||
return result ? ResponseResult.success("驳回成功") : ResponseResult.error("驳回失败");
|
||||
|
||||
80
backend/src/main/java/com/yfd/platform/env/controller/FpssRController.java
vendored
Normal file
80
backend/src/main/java/com/yfd/platform/env/controller/FpssRController.java
vendored
Normal file
@ -0,0 +1,80 @@
|
||||
package com.yfd.platform.env.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.env.domain.SdFpssR;
|
||||
import com.yfd.platform.env.service.ISdFpssRService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 过鱼设施人工数据表 前端控制器
|
||||
* </p>
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/data/fpssR")
|
||||
@Tag(name = "过鱼数据管理")
|
||||
public class FpssRController {
|
||||
|
||||
@Resource
|
||||
private ISdFpssRService fpssRService;
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "分页查询过鱼数据列表")
|
||||
public ResponseResult queryPageList(
|
||||
@RequestParam(defaultValue = "1") Integer current,
|
||||
@RequestParam(defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) String stcd,
|
||||
@RequestParam(required = false) Integer yr,
|
||||
@RequestParam(required = false) String ftp) {
|
||||
Page<SdFpssR> page = new Page<>(current, size);
|
||||
Page<SdFpssR> result = fpssRService.queryPageList(page, stcd, yr, ftp);
|
||||
return ResponseResult.successData(result);
|
||||
}
|
||||
|
||||
@GetMapping("/getById")
|
||||
@Operation(summary = "根据ID查询过鱼数据")
|
||||
public ResponseResult getById(@RequestParam String id) {
|
||||
SdFpssR fpssR = fpssRService.getById(id);
|
||||
return ResponseResult.successData(fpssR);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "新增过鱼数据")
|
||||
public ResponseResult add(@RequestBody SdFpssR fpssR) {
|
||||
boolean result = fpssRService.save(fpssR);
|
||||
return result ? ResponseResult.success("新增成功") : ResponseResult.error("新增失败");
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@Operation(summary = "修改过鱼数据")
|
||||
public ResponseResult update(@RequestBody SdFpssR fpssR) {
|
||||
boolean result = fpssRService.updateById(fpssR);
|
||||
return result ? ResponseResult.success("修改成功") : ResponseResult.error("修改失败");
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@Operation(summary = "删除过鱼数据")
|
||||
public ResponseResult delete(@RequestParam String id) {
|
||||
boolean result = fpssRService.removeById(id);
|
||||
return result ? ResponseResult.success("删除成功") : ResponseResult.error("删除失败");
|
||||
}
|
||||
|
||||
@PostMapping("/batchDelete")
|
||||
@Operation(summary = "批量删除过鱼数据")
|
||||
public ResponseResult batchDelete(@RequestBody java.util.List<String> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return ResponseResult.error("请选择要删除的数据");
|
||||
}
|
||||
boolean result = true;
|
||||
for (String id : ids) {
|
||||
if (!fpssRService.removeById(id)) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
return result ? ResponseResult.success("删除成功") : ResponseResult.error("部分删除失败");
|
||||
}
|
||||
}
|
||||
138
backend/src/main/java/com/yfd/platform/env/domain/SdFpssR.java
vendored
Normal file
138
backend/src/main/java/com/yfd/platform/env/domain/SdFpssR.java
vendored
Normal file
@ -0,0 +1,138 @@
|
||||
package com.yfd.platform.env.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 过鱼设施人工数据表
|
||||
* </p>
|
||||
*/
|
||||
@Data
|
||||
@TableName("SD_FPSS_R")
|
||||
public class SdFpssR implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 过鱼设施编码
|
||||
*/
|
||||
private String stcd;
|
||||
|
||||
/**
|
||||
* 填报时间
|
||||
*/
|
||||
private Date tm;
|
||||
|
||||
/**
|
||||
* 鱼种类
|
||||
*/
|
||||
private String ftp;
|
||||
|
||||
/**
|
||||
* 鱼类规格,单位:cm
|
||||
*/
|
||||
private String fsz;
|
||||
|
||||
/**
|
||||
* 过鱼数量,单位:尾
|
||||
*/
|
||||
private Integer fcnt;
|
||||
|
||||
/**
|
||||
* 平均体重,单位:g
|
||||
*/
|
||||
private String fwet;
|
||||
|
||||
/**
|
||||
* 开始日期
|
||||
*/
|
||||
private Date strdt;
|
||||
|
||||
/**
|
||||
* 结束日期
|
||||
*/
|
||||
private Date enddt;
|
||||
|
||||
/**
|
||||
* 游向:0=上行,1=下行,2=上行折返,3=下行折返
|
||||
*/
|
||||
private Integer direction;
|
||||
|
||||
/**
|
||||
* 当日运行次数
|
||||
*/
|
||||
private Integer rcnt;
|
||||
|
||||
/**
|
||||
* 过鱼设施引用流量
|
||||
*/
|
||||
private BigDecimal fq;
|
||||
|
||||
/**
|
||||
* 过鱼图片文件路径
|
||||
*/
|
||||
private String imgpath;
|
||||
|
||||
/**
|
||||
* 过鱼视频文件路径
|
||||
*/
|
||||
private String vdpath;
|
||||
|
||||
/**
|
||||
* 年份:数据时间,精确到年
|
||||
*/
|
||||
private Integer yr;
|
||||
|
||||
/**
|
||||
* 主要月份
|
||||
*/
|
||||
private String mouth;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String recordUser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date recordTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
private String modifyUser;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 是否已删除:0=未删除 1=已删除
|
||||
*/
|
||||
private Integer isDeleted;
|
||||
|
||||
/**
|
||||
* 删除人
|
||||
*/
|
||||
private String deleteUser;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
private Date deleteTime;
|
||||
}
|
||||
14
backend/src/main/java/com/yfd/platform/env/mapper/SdFpssRMapper.java
vendored
Normal file
14
backend/src/main/java/com/yfd/platform/env/mapper/SdFpssRMapper.java
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
package com.yfd.platform.env.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.platform.env.domain.SdFpssR;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 过鱼设施人工数据表 Mapper 接口
|
||||
* </p>
|
||||
*/
|
||||
@Mapper
|
||||
public interface SdFpssRMapper extends BaseMapper<SdFpssR> {
|
||||
}
|
||||
18
backend/src/main/java/com/yfd/platform/env/service/ISdFpssRService.java
vendored
Normal file
18
backend/src/main/java/com/yfd/platform/env/service/ISdFpssRService.java
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
package com.yfd.platform.env.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.platform.env.domain.SdFpssR;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 过鱼设施人工数据表 服务类
|
||||
* </p>
|
||||
*/
|
||||
public interface ISdFpssRService extends IService<SdFpssR> {
|
||||
|
||||
/**
|
||||
* 分页查询过鱼数据
|
||||
*/
|
||||
Page<SdFpssR> queryPageList(Page<SdFpssR> page, String stcd, Integer yr, String ftp);
|
||||
}
|
||||
64
backend/src/main/java/com/yfd/platform/env/service/impl/SdFpssRServiceImpl.java
vendored
Normal file
64
backend/src/main/java/com/yfd/platform/env/service/impl/SdFpssRServiceImpl.java
vendored
Normal file
@ -0,0 +1,64 @@
|
||||
package com.yfd.platform.env.service.impl;
|
||||
|
||||
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.yfd.platform.env.domain.SdFpssR;
|
||||
import com.yfd.platform.env.mapper.SdFpssRMapper;
|
||||
import com.yfd.platform.env.service.ISdFpssRService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 过鱼设施人工数据表 服务实现类
|
||||
* </p>
|
||||
*/
|
||||
@Service
|
||||
public class SdFpssRServiceImpl extends ServiceImpl<SdFpssRMapper, SdFpssR> implements ISdFpssRService {
|
||||
|
||||
@Override
|
||||
public Page<SdFpssR> queryPageList(Page<SdFpssR> page, String stcd, Integer yr, String ftp) {
|
||||
LambdaQueryWrapper<SdFpssR> wrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
if (StringUtils.hasText(stcd)) {
|
||||
wrapper.eq(SdFpssR::getStcd, stcd);
|
||||
}
|
||||
if (yr != null) {
|
||||
wrapper.eq(SdFpssR::getYr, yr);
|
||||
}
|
||||
if (StringUtils.hasText(ftp)) {
|
||||
wrapper.like(SdFpssR::getFtp, ftp);
|
||||
}
|
||||
|
||||
wrapper.eq(SdFpssR::getIsDeleted, 0);
|
||||
wrapper.orderByDesc(SdFpssR::getRecordTime);
|
||||
return page(page, wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean save(SdFpssR entity) {
|
||||
entity.setRecordTime(new Date());
|
||||
entity.setIsDeleted(0);
|
||||
return super.save(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(SdFpssR entity) {
|
||||
entity.setModifyTime(new Date());
|
||||
return super.updateById(entity);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public boolean removeById(Object id) {
|
||||
// SdFpssR entity = getById(id);
|
||||
// if (entity != null) {
|
||||
// entity.setIsDeleted(1);
|
||||
// entity.setDeleteTime(new Date());
|
||||
// return updateById(entity);
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
@ -98,9 +98,18 @@ public class LoginController {
|
||||
}
|
||||
LoginUser loginUser = (LoginUser) authenticate.getPrincipal();
|
||||
Integer status = loginUser.getUser().getStatus();
|
||||
String regStatus = loginUser.getUser().getRegStatus();
|
||||
if ("0".equals(status.toString())) {
|
||||
return ResponseResult.error("账号已停用");
|
||||
}
|
||||
|
||||
if ("PENDING".equals(regStatus)) {
|
||||
return ResponseResult.error("账号待审核,请联系管理员");
|
||||
}
|
||||
|
||||
if ("REJECTED".equals(regStatus)) {
|
||||
return ResponseResult.error("账号审核未通过");
|
||||
}
|
||||
HttpServletRequest request = RequestHolder.getHttpServletRequest();
|
||||
SysLog sysLog = new SysLog();
|
||||
sysLog.setUsercode(user.getUsername());
|
||||
|
||||
@ -167,7 +167,7 @@ public class SmsVerifyCodeController {
|
||||
user.setBelongingUnit(smsVerifyCodeRequest.getBelongingUnit());
|
||||
user.setRegTime(new Date());
|
||||
user.setNickname(smsVerifyCodeRequest.getRealName());
|
||||
user.setStatus(1);
|
||||
user.setStatus(0);
|
||||
user.setOrgid("e90063ced25e3d469860e88d920c082f");
|
||||
user.setUsertype(1);
|
||||
user.setUsername(smsVerifyCodeRequest.getUsername());
|
||||
|
||||
@ -214,7 +214,7 @@ public class UserController {
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(auditStatus) || ( !"APPROVED".equals(auditStatus)&&!"REJECTED".equals(auditStatus))) {
|
||||
return ResponseResult.error("审核状态错误:1-通过 2-驳回");
|
||||
return ResponseResult.error("审核状态错误");
|
||||
}
|
||||
SysUser user = userService.getById(userId);
|
||||
if (user == null) {
|
||||
|
||||
@ -35,9 +35,9 @@ public class UserDetailsServiceImpl implements UserDetailsService {
|
||||
@Override
|
||||
@DataSource(name = "master")
|
||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||
//根据用户名称查询用户信息
|
||||
//根据用户名称或手机号查询用户信息
|
||||
QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("username", username);
|
||||
queryWrapper.and(wrapper -> wrapper.eq("username", username).or().eq("phone", username));
|
||||
SysUser user = userService.getOne(queryWrapper);
|
||||
if (ObjectUtil.isEmpty(user)) {
|
||||
throw new RuntimeException("用户账号不存在!");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user