|
|
|
@ -120,16 +120,19 @@ public class DepsbnczController extends JeecgController<Depsbncz, IDepsbnczServi |
|
|
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
|
depsbncz.setUserid(user.getId()); |
|
|
|
|
String depiid = depadminlxService.getdepid(user.getId()); |
|
|
|
|
// 获取当前日期
|
|
|
|
|
LocalDate currentDate = LocalDate.now(); |
|
|
|
|
// 获取当前年份并直接转换为字符串
|
|
|
|
|
String currentYearString = String.valueOf(currentDate.getYear()); |
|
|
|
|
Annual annual = annualService.query().eq("annual_name",currentYearString).one(); |
|
|
|
|
List<Depsbncz> depsbnczs=depsbnczService.query().eq("annualid",annual.getId()).eq("depid",depiid).list(); |
|
|
|
|
if (depsbnczs.size()>0){ |
|
|
|
|
if (depiid == null || depiid.isEmpty()){ |
|
|
|
|
return Result.error("请确定自己的单位信息是否完整"); |
|
|
|
|
} |
|
|
|
|
List<Depsbncz> depsbnczList =depsbnczService.query().eq("annualid",depsbncz.getAnnualid()).eq("depid",depiid).list(); |
|
|
|
|
int a=0; |
|
|
|
|
if (depsbnczList == null || depsbnczList.isEmpty()) { |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
a=depsbnczList.size(); |
|
|
|
|
} |
|
|
|
|
if (a>0){ |
|
|
|
|
return Result.error("本年度已经添加过了"); |
|
|
|
|
}else { |
|
|
|
|
depsbncz.setAnnualid(annual.getId()); |
|
|
|
|
depsbncz.setDepid(depiid); |
|
|
|
|
depsbnczService.save(depsbncz); |
|
|
|
|
return Result.OK("添加成功!"); |
|
|
|
@ -146,6 +149,18 @@ public class DepsbnczController extends JeecgController<Depsbncz, IDepsbnczServi |
|
|
|
|
@ApiOperation(value="上年度(末)主要财务数据-编辑", notes="上年度(末)主要财务数据-编辑") |
|
|
|
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
|
|
|
|
public Result<String> edit(@RequestBody Depsbncz depsbncz) { |
|
|
|
|
|
|
|
|
|
List<Depsbncz> depsbnczList =depsbnczService.query().eq("annualid",depsbncz.getAnnualid()).eq("depid",depsbncz.getDepid()).list(); |
|
|
|
|
int a=0; |
|
|
|
|
if (depsbnczList == null || depsbnczList.isEmpty()) { |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
a=depsbnczList.size(); |
|
|
|
|
} |
|
|
|
|
if (a>0){ |
|
|
|
|
return Result.error("每年度仅可添加一次"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
depsbnczService.updateById(depsbncz); |
|
|
|
|
return Result.OK("编辑成功!"); |
|
|
|
|
} |
|
|
|
|