部门资质bug修改

master
王家东 3 weeks ago
parent 58342270bc
commit 02ff92b78b
  1. 7
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depadminlx/controller/DepadminlxController.java
  2. 16
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depsbncz/controller/DepsbnczController.java
  3. 6
      jeecg-boot/jeecg-module-demo/src/main/java/org/jeecg/modules/demo/depsbncz/entity/Depsbncz.java
  4. 5
      jeecgboot-vue3/src/views/depsbncz/Depsbncz.data.ts

@ -90,12 +90,17 @@ public class DepadminlxController extends JeecgController<Depadminlx, IDepadminl
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<String> add(@RequestBody Depadminlx depadminlx) { public Result<String> add(@RequestBody Depadminlx depadminlx) {
LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal();
depadminlx.setUserid(user.getId());
String depiid = depadminlxService.getdepid(user.getId()); String depiid = depadminlxService.getdepid(user.getId());
List<Depadminlx> depadminlxes = depadminlxService.query().eq("depid",depiid).list();
if (depadminlxes.size()>0){
return Result.error("已经添加过了!");
}else {
depadminlx.setUserid(user.getId());
depadminlx.setDepid(depiid); depadminlx.setDepid(depiid);
depadminlxService.save(depadminlx); depadminlxService.save(depadminlx);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
}
/** /**
* 编辑 * 编辑

@ -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;
/** /**
* 分页列表查询 * 分页列表查询
@ -96,10 +101,21 @@ public class DepsbnczController extends JeecgController<Depsbncz, IDepsbnczServi
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());
// 获取当前日期
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){
return Result.error("本年度已经添加过了");
}else {
depsbncz.setAnnualid(annual.getId());
depsbncz.setDepid(depiid); depsbncz.setDepid(depiid);
depsbnczService.save(depsbncz); depsbnczService.save(depsbncz);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
}
/** /**
* 编辑 * 编辑

@ -107,4 +107,10 @@ public class Depsbncz implements Serializable {
@Excel(name = "用户id", width = 15) @Excel(name = "用户id", width = 15)
@ApiModelProperty(value = "用户id") @ApiModelProperty(value = "用户id")
private java.lang.String userid; private java.lang.String userid;
/**年度*/
@Excel(name = "年度", width = 15, dictTable = "annual", dicText = "annual_name", dicCode = "id")
@Dict(dictTable = "annual", dicText = "annual_name", dicCode = "id")
@ApiModelProperty(value = "年度")
private java.lang.String annualid;
} }

@ -60,6 +60,11 @@ export const columns: BasicColumn[] = [
align: "center", align: "center",
dataIndex: 'nsze' dataIndex: 'nsze'
}, },
{
title: '年度',
align: "center",
dataIndex: 'annualid_dictText'
},
]; ];
// //

Loading…
Cancel
Save