|
|
@ -1,5 +1,6 @@ |
|
|
|
package org.jeecg.modules.demo.depsbncz.controller; |
|
|
|
package org.jeecg.modules.demo.depsbncz.controller; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
@ -17,6 +18,8 @@ import org.jeecg.common.system.query.QueryGenerator; |
|
|
|
import org.jeecg.common.system.query.QueryRuleEnum; |
|
|
|
import org.jeecg.common.system.query.QueryRuleEnum; |
|
|
|
import org.jeecg.common.system.vo.LoginUser; |
|
|
|
import org.jeecg.common.system.vo.LoginUser; |
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
import org.jeecg.common.util.oConvertUtils; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.annual.entity.Annual; |
|
|
|
|
|
|
|
import org.jeecg.modules.demo.annual.service.IAnnualService; |
|
|
|
import org.jeecg.modules.demo.depadminlx.service.IDepadminlxService; |
|
|
|
import org.jeecg.modules.demo.depadminlx.service.IDepadminlxService; |
|
|
|
import org.jeecg.modules.demo.depsbncz.entity.Depsbncz; |
|
|
|
import org.jeecg.modules.demo.depsbncz.entity.Depsbncz; |
|
|
|
import org.jeecg.modules.demo.depsbncz.service.IDepsbnczService; |
|
|
|
import org.jeecg.modules.demo.depsbncz.service.IDepsbnczService; |
|
|
@ -58,6 +61,8 @@ public class DepsbnczController extends JeecgController<Depsbncz, IDepsbnczServi |
|
|
|
private IDepsbnczService depsbnczService; |
|
|
|
private IDepsbnczService depsbnczService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IDepadminlxService depadminlxService; |
|
|
|
private IDepadminlxService depadminlxService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IAnnualService annualService; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 分页列表查询 |
|
|
|
* 分页列表查询 |
|
|
@ -93,12 +98,23 @@ public class DepsbnczController extends JeecgController<Depsbncz, IDepsbnczServi |
|
|
|
@ApiOperation(value="上年度(末)主要财务数据-添加", notes="上年度(末)主要财务数据-添加") |
|
|
|
@ApiOperation(value="上年度(末)主要财务数据-添加", notes="上年度(末)主要财务数据-添加") |
|
|
|
@PostMapping(value = "/add") |
|
|
|
@PostMapping(value = "/add") |
|
|
|
public Result<String> add(@RequestBody Depsbncz depsbncz) { |
|
|
|
public Result<String> add(@RequestBody Depsbncz depsbncz) { |
|
|
|
LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
|
|
|
depsbncz.setUserid(user.getId()); |
|
|
|
depsbncz.setUserid(user.getId()); |
|
|
|
String depiid = depadminlxService.getdepid(user.getId()); |
|
|
|
String depiid = depadminlxService.getdepid(user.getId()); |
|
|
|
depsbncz.setDepid(depiid); |
|
|
|
// 获取当前日期
|
|
|
|
depsbnczService.save(depsbncz); |
|
|
|
LocalDate currentDate = LocalDate.now(); |
|
|
|
return Result.OK("添加成功!"); |
|
|
|
// 获取当前年份并直接转换为字符串
|
|
|
|
|
|
|
|
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){ |
|
|
|
|
|
|
|
return Result.error("本年度已经添加过了"); |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
depsbncz.setAnnualid(annual.getId()); |
|
|
|
|
|
|
|
depsbncz.setDepid(depiid); |
|
|
|
|
|
|
|
depsbnczService.save(depsbncz); |
|
|
|
|
|
|
|
return Result.OK("添加成功!"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|