|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.migao.config.constant.FinancesStatus;
|
|
|
import com.migao.config.response.PageBean;
|
|
|
import com.migao.config.response.ResponseBean;
|
|
|
import com.migao.config.response.ResponseBuilder;
|
|
@@ -50,7 +51,11 @@ public class FinancesServiceImpl implements FinancesService {
|
|
|
*/
|
|
|
@Override
|
|
|
public ResponseBean<?> insert(FinancesInsertReq financesInsertReq) {
|
|
|
- return ResponseBuilder.ok(financesRepository.save(EntityUtils.copyProperties(financesInsertReq, Finances.class)));
|
|
|
+ Finances finances = EntityUtils.copyProperties(financesInsertReq, Finances.class);
|
|
|
+ finances.setStatus(FinancesStatus.TO_AUDIT);
|
|
|
+ finances.setDeleted(0);
|
|
|
+ financesRepository.save(finances);
|
|
|
+ return ResponseBuilder.ok();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -59,6 +64,28 @@ public class FinancesServiceImpl implements FinancesService {
|
|
|
return ResponseBuilder.ok(finances);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ResponseBean<?> approve(Integer id) {
|
|
|
+ Finances finances = financesMapper.selectById(id);
|
|
|
+ if (finances == null) {
|
|
|
+ return ResponseBuilder.fail("记录不存在");
|
|
|
+ }
|
|
|
+ finances.setStatus(FinancesStatus.PASS);
|
|
|
+ financesMapper.updateById(finances);
|
|
|
+ return ResponseBuilder.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResponseBean<?> reject(Integer id) {
|
|
|
+ Finances finances = financesMapper.selectById(id);
|
|
|
+ if (finances == null) {
|
|
|
+ return ResponseBuilder.fail("记录不存在");
|
|
|
+ }
|
|
|
+ finances.setStatus(FinancesStatus.TURN);
|
|
|
+ financesMapper.updateById(finances);
|
|
|
+ return ResponseBuilder.ok();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 分页查
|
|
|
*
|
|
@@ -76,7 +103,7 @@ public class FinancesServiceImpl implements FinancesService {
|
|
|
queryWrapper.like(Finances::getName, "%" + financesPageQueryReq.getName() + "%");
|
|
|
}
|
|
|
if (StringUtils.isNotBlank(financesPageQueryReq.getStatus())) {
|
|
|
- queryWrapper.eq(Finances::getStatus,financesPageQueryReq.getStatus());
|
|
|
+ queryWrapper.eq(Finances::getStatus, financesPageQueryReq.getStatus());
|
|
|
}
|
|
|
Page<Finances> all = financesMapper.selectPage(new Page<>(page, size), queryWrapper);
|
|
|
return ResponseBuilder.ok(
|