|
|
@ -28,6 +28,7 @@ package com.yxt.supervise.crm.biz.projectcreditbalance; |
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.supervise.crm.api.projectcreditbalance.*; |
|
|
|
import com.yxt.supervise.crm.api.projectcreditfile.ProjectCreditFile; |
|
|
|
import com.yxt.supervise.crm.api.projectcreditfile.ProjectCreditFileDto; |
|
|
@ -119,23 +120,24 @@ public class ProjectCreditBalanceService extends MybatisBaseService<ProjectCredi |
|
|
|
//this.updateByDto(dto);
|
|
|
|
} |
|
|
|
@Transactional |
|
|
|
public void insertByDto(ProjectCreditBalanceDto dto){ |
|
|
|
public ResultBean insertByDto(ProjectCreditBalanceDto dto){ |
|
|
|
ResultBean rb =new ResultBean().fail(); |
|
|
|
ProjectCreditBalance entity = new ProjectCreditBalance(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
List<String> pzfiles = dto.getPzfiles(); |
|
|
|
if(StringUtils.isBlank(dto.getUsersid())){ |
|
|
|
throw new RuntimeException("当前用户sid不能为空"); |
|
|
|
return rb.setMsg("当前用户sid不能为空"); |
|
|
|
} |
|
|
|
if(StringUtils.isBlank(dto.getProjectsid())){ |
|
|
|
throw new RuntimeException("项目sid不能为空"); |
|
|
|
return rb.setMsg("项目sid不能为空"); |
|
|
|
} |
|
|
|
ProjectInfoVo projectBySid = projectInformationService.getProjectBySid(dto.getProjectsid()); |
|
|
|
if(projectBySid==null||projectBySid.getBaseInfo()==null){ |
|
|
|
throw new RuntimeException("项目信息不存在"); |
|
|
|
return rb.setMsg("项目信息不存在"); |
|
|
|
} |
|
|
|
entity.setProjectname(projectBySid.getBaseInfo().getEntryName()); |
|
|
|
if(StringUtils.isBlank(dto.getType())){ |
|
|
|
throw new RuntimeException("用还信类型不能为空"); |
|
|
|
return rb.setMsg("用还信类型不能为空"); |
|
|
|
} |
|
|
|
//用还信类型:1借方用信,2贷方还信
|
|
|
|
String typename="借方/用信"; |
|
|
@ -144,11 +146,11 @@ public class ProjectCreditBalanceService extends MybatisBaseService<ProjectCredi |
|
|
|
}else if("1".equals(dto.getType())){ |
|
|
|
typename="借方/用信";//加法
|
|
|
|
}else{ |
|
|
|
throw new RuntimeException("用还信类型不正确"); |
|
|
|
return rb.setMsg("用还信类型不正确"); |
|
|
|
} |
|
|
|
entity.setTypename(typename); |
|
|
|
if(StringUtils.isBlank(dto.getMoney())){ |
|
|
|
throw new RuntimeException("金额不能为空"); |
|
|
|
return rb.setMsg("金额不能为空"); |
|
|
|
} |
|
|
|
// String money = dto.getMoney();
|
|
|
|
// String yeMoney = getYeMoney(dto.getProjectsid());
|
|
|
@ -172,9 +174,9 @@ public class ProjectCreditBalanceService extends MybatisBaseService<ProjectCredi |
|
|
|
// }
|
|
|
|
entity.setCreateBySid(dto.getUsersid()); |
|
|
|
baseMapper.insert(entity); |
|
|
|
if(pzfiles==null||pzfiles.size()==0){ |
|
|
|
throw new RuntimeException("凭证不能为空"); |
|
|
|
} |
|
|
|
// if(pzfiles==null||pzfiles.size()==0){
|
|
|
|
// throw new RuntimeException("凭证不能为空");
|
|
|
|
// }
|
|
|
|
|
|
|
|
String sid = entity.getSid(); |
|
|
|
for (String pzfile : pzfiles) { |
|
|
@ -196,6 +198,7 @@ public class ProjectCreditBalanceService extends MybatisBaseService<ProjectCredi |
|
|
|
projectInformation.setUseLimit(bigDecimal.toString()); |
|
|
|
} |
|
|
|
projectInformationService.updateById(projectInformation); |
|
|
|
return rb.success().setData("成功"); |
|
|
|
} |
|
|
|
/* |
|
|
|
public static void main(String[] args) { |
|
|
|