|
@@ -49,6 +49,11 @@ public class StatementServiceImpl extends ServiceImpl<StatementMapper, Statement
|
|
return statementMapper.selectList(statement);
|
|
return statementMapper.selectList(statement);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<Statement> selectAuditList(Statement statement) {
|
|
|
|
+ return statementMapper.selectAuditList(statement);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public AjaxResult add(List<StatementDetail> list, Statement statement) {
|
|
public AjaxResult add(List<StatementDetail> list, Statement statement) {
|
|
@@ -61,6 +66,7 @@ public class StatementServiceImpl extends ServiceImpl<StatementMapper, Statement
|
|
statement.setOpBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
statement.setOpBy(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
statement.setState(0);
|
|
statement.setState(0);
|
|
statement.setGive(0);
|
|
statement.setGive(0);
|
|
|
|
+ statement.setAudit(0);
|
|
statement.setMoney(BigDecimal.ZERO);
|
|
statement.setMoney(BigDecimal.ZERO);
|
|
statement.setServiceCompany(platform.getServiceCompany());
|
|
statement.setServiceCompany(platform.getServiceCompany());
|
|
statement.setFileName(statement.getFile().getOriginalFilename());
|
|
statement.setFileName(statement.getFile().getOriginalFilename());
|
|
@@ -72,6 +78,10 @@ public class StatementServiceImpl extends ServiceImpl<StatementMapper, Statement
|
|
BeanValidators.validateWithException(validator, detail);
|
|
BeanValidators.validateWithException(validator, detail);
|
|
detail.setStatementId(statement.getId());
|
|
detail.setStatementId(statement.getId());
|
|
detail.setProjectId(statement.getProjectId());
|
|
detail.setProjectId(statement.getProjectId());
|
|
|
|
+ detail.setState(0);
|
|
|
|
+ detail.setNum(StringUtils.generateNumber());
|
|
|
|
+ detail.setServiceMoney(platform.getRate().divide(new BigDecimal("100")).multiply(detail.getMoney()));
|
|
|
|
+ detail.setRealMoney(detail.getMoney().subtract(detail.getServiceMoney()));
|
|
StatementDetail check = statementDetailMapper.check(detail);
|
|
StatementDetail check = statementDetailMapper.check(detail);
|
|
if (check != null) {
|
|
if (check != null) {
|
|
throw new ServiceException("导入失败,身份证为:" + detail.getIdCard() + " 的数据已存在");
|
|
throw new ServiceException("导入失败,身份证为:" + detail.getIdCard() + " 的数据已存在");
|
|
@@ -79,9 +89,73 @@ public class StatementServiceImpl extends ServiceImpl<StatementMapper, Statement
|
|
if (!detailService.save(detail)) {
|
|
if (!detailService.save(detail)) {
|
|
throw new ServiceException("导入失败,请联系平台");
|
|
throw new ServiceException("导入失败,请联系平台");
|
|
}
|
|
}
|
|
-
|
|
|
|
successNum++;
|
|
successNum++;
|
|
}
|
|
}
|
|
return AjaxResult.success("创建成功!本次导入" + successNum + " 条数据");
|
|
return AjaxResult.success("创建成功!本次导入" + successNum + " 条数据");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public AjaxResult generate(Long id) {
|
|
|
|
+ Statement statement = getById(id);
|
|
|
|
+ if (statement == null || !statement.getCompanyId().equals(SecurityUtils.getLoginUser().getUser().getCompanyId())) {
|
|
|
|
+ return AjaxResult.error("结算单不存在或非法操作");
|
|
|
|
+ }
|
|
|
|
+ if (statement.getState() != 0) {
|
|
|
|
+ return AjaxResult.error("不可操作");
|
|
|
|
+ }
|
|
|
|
+ statement.setState(1);
|
|
|
|
+ statement.setNum(StringUtils.generateNumber());
|
|
|
|
+ if (!updateById(statement)) {
|
|
|
|
+ throw new ServiceException("生成结算单失败,请联系平台");
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public AjaxResult manageSubmit(Long id) {
|
|
|
|
+ Statement statement = getById(id);
|
|
|
|
+ if (statement == null || !statement.getCompanyId().equals(SecurityUtils.getLoginUser().getUser().getCompanyId())) {
|
|
|
|
+ return AjaxResult.error("结算单不存在或非法操作");
|
|
|
|
+ }
|
|
|
|
+ if (statement.getAudit() != 0) {
|
|
|
|
+ return AjaxResult.error("不可操作");
|
|
|
|
+ }
|
|
|
|
+ statement.setAudit(1);
|
|
|
|
+ if (!updateById(statement)) {
|
|
|
|
+ throw new ServiceException("提交结算单审核失败,请联系平台");
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public AjaxResult manageCancel(Long id) {
|
|
|
|
+ Statement statement = getById(id);
|
|
|
|
+ if (statement == null || !statement.getCompanyId().equals(SecurityUtils.getLoginUser().getUser().getCompanyId())) {
|
|
|
|
+ return AjaxResult.error("结算单不存在或非法操作");
|
|
|
|
+ }
|
|
|
|
+ if (statement.getAudit() != 1) {
|
|
|
|
+ return AjaxResult.error("不可操作");
|
|
|
|
+ }
|
|
|
|
+ statement.setAudit(0);
|
|
|
|
+ if (!updateById(statement)) {
|
|
|
|
+ throw new ServiceException("撤回结算单审核失败,请联系平台");
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public AjaxResult auditSuccess(Long id) {
|
|
|
|
+ Statement statement = getById(id);
|
|
|
|
+ if (statement == null || !statement.getCompanyId().equals(SecurityUtils.getLoginUser().getUser().getCompanyId())) {
|
|
|
|
+ return AjaxResult.error("结算单不存在或非法操作");
|
|
|
|
+ }
|
|
|
|
+ if (statement.getAudit() != 1) {
|
|
|
|
+ return AjaxResult.error("数据不可操作");
|
|
|
|
+ }
|
|
|
|
+ statement.setAudit(2);
|
|
|
|
+ if (!updateById(statement)) {
|
|
|
|
+ throw new ServiceException("结算单审核失败,请联系平台");
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
}
|
|
}
|