|
@@ -9,7 +9,7 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.bean.BeanValidators;
|
|
|
import com.ruoyi.web.work.domain.*;
|
|
|
-import com.ruoyi.web.work.domain.dto.MoneyDto;
|
|
|
+import com.ruoyi.web.work.domain.dto.GenerateDto;
|
|
|
import com.ruoyi.web.work.domain.dto.RejectDto;
|
|
|
import com.ruoyi.web.work.domain.dto.StatementDto;
|
|
|
import com.ruoyi.web.work.domain.dto.StatementExportDto;
|
|
@@ -80,7 +80,7 @@ public class StatementServiceImpl extends ServiceImpl<StatementMapper, Statement
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
StatementExportListVo e = list.get(i);
|
|
|
e.setIndex(i + 1);
|
|
|
- e.setFlag(e.getBankName().contains("建行")||e.getBankName().contains("建设银行") ? 0 : 1);
|
|
|
+ e.setFlag(e.getBankName().contains("建行") || e.getBankName().contains("建设银行") ? 0 : 1);
|
|
|
e.setRemarks(dto.getRemarks());
|
|
|
}
|
|
|
return list;
|
|
@@ -108,6 +108,7 @@ public class StatementServiceImpl extends ServiceImpl<StatementMapper, Statement
|
|
|
int successNum = 0;
|
|
|
for (StatementDetail detail : list) {
|
|
|
BeanValidators.validateWithException(validator, detail);
|
|
|
+ detail.setBankAccount(detail.getBankAccount().trim());
|
|
|
detail.setStatementId(statement.getId());
|
|
|
detail.setProjectId(statement.getProjectId());
|
|
|
detail.setState(0);
|
|
@@ -132,6 +133,11 @@ public class StatementServiceImpl extends ServiceImpl<StatementMapper, Statement
|
|
|
if (statement.getState() != 0) {
|
|
|
return AjaxResult.error("不可操作");
|
|
|
}
|
|
|
+ List<StatementDetail> detailList = detailService.selectList(new StatementDetail().setStatementId(statement.getId()));
|
|
|
+ if (detailList.isEmpty() || detailList.size() == 0) {
|
|
|
+ return AjaxResult.error("结算单发放人数为空");
|
|
|
+ }
|
|
|
+ detailList.forEach(e -> BeanValidators.makeGenerateValidation(validator, e));
|
|
|
statement.setState(1);
|
|
|
statement.setNum(StringUtils.generateNumber());
|
|
|
statement.setGenerateTime(new Date());
|
|
@@ -143,8 +149,8 @@ public class StatementServiceImpl extends ServiceImpl<StatementMapper, Statement
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public AjaxResult makeGenerateByProject(Long id) {
|
|
|
- Project project = projectService.getById(id);
|
|
|
+ public AjaxResult makeGenerateByProject(GenerateDto dto) {
|
|
|
+ Project project = projectService.getById(dto.getId());
|
|
|
if (project == null || !project.getCompanyId().equals(SecurityUtils.getLoginUser().getUser().getCompanyId())) {
|
|
|
return AjaxResult.error("项目不存在或非法操作");
|
|
|
}
|
|
@@ -161,6 +167,7 @@ public class StatementServiceImpl extends ServiceImpl<StatementMapper, Statement
|
|
|
Platform platform = redisCache.getCacheObject(CacheConstants.APP_PLATFORM);
|
|
|
Statement statement = new Statement();
|
|
|
statement.setFileName("自动生成");
|
|
|
+ statement.setBatchName(dto.getBatchName());
|
|
|
statement.setProjectId(project.getId());
|
|
|
statement.setChannel("银行卡转账");
|
|
|
statement.setInvoice("增值税全额发票");
|
|
@@ -198,17 +205,15 @@ public class StatementServiceImpl extends ServiceImpl<StatementMapper, Statement
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AjaxResult makeMoneyEdit(MoneyDto dto) {
|
|
|
- StatementDetail detail = detailService.getById(dto.getId());
|
|
|
+ public AjaxResult makeStatementDetailEdit(StatementDetail detail) {
|
|
|
if (detail == null || !detail.getCompanyId().equals(SecurityUtils.getLoginUser().getUser().getCompanyId())) {
|
|
|
- return AjaxResult.error("关联结算单不存在或非法操作");
|
|
|
+ return AjaxResult.error("关联结算单明细不存在或非法操作");
|
|
|
}
|
|
|
Platform platform = redisCache.getCacheObject(CacheConstants.APP_PLATFORM);
|
|
|
- detail.setMoney(dto.getMoney());
|
|
|
detail.setServiceMoney(platform.getRate().divide(new BigDecimal("100")).multiply(detail.getMoney()));
|
|
|
detail.setRealMoney(detail.getMoney().subtract(detail.getServiceMoney()));
|
|
|
if (!detailService.updateById(detail)) {
|
|
|
- throw new ServiceException("编辑金额失败");
|
|
|
+ throw new ServiceException("编辑结算单明细失败");
|
|
|
}
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
@@ -360,10 +365,22 @@ public class StatementServiceImpl extends ServiceImpl<StatementMapper, Statement
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public AjaxResult payDelete(Long id) throws ServerException {
|
|
|
+ public AjaxResult payDelete(Long id) {
|
|
|
if (!removeById(id)) {
|
|
|
throw new ServiceException("平台删除发放业务费失败,请联系平台");
|
|
|
}
|
|
|
return AjaxResult.success();
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public AjaxResult makeStatementDetailRemove(Long id) {
|
|
|
+ StatementDetail detail = detailService.getById(id);
|
|
|
+ if (detail == null || !detail.getCompanyId().equals(SecurityUtils.getLoginUser().getUser().getCompanyId())) {
|
|
|
+ return AjaxResult.error("结算单明细不存在或非法操作");
|
|
|
+ }
|
|
|
+ if (!detailService.removeById(id)) {
|
|
|
+ throw new ServiceException("删除结算单明细失败,请联系平台");
|
|
|
+ }
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
}
|