|
@@ -72,31 +72,6 @@ public class RecruitPlanMainController extends BaseController
|
|
startPage();
|
|
startPage();
|
|
recruitPlanMain.setDeptId(getDeptId());
|
|
recruitPlanMain.setDeptId(getDeptId());
|
|
List<RecruitPlanMain> list = recruitPlanMainService.selectRecruitPlanMainList(recruitPlanMain);
|
|
List<RecruitPlanMain> list = recruitPlanMainService.selectRecruitPlanMainList(recruitPlanMain);
|
|
- for (RecruitPlanMain recruitPlanMain1 : list){
|
|
|
|
- long mId = recruitPlanMain1.getRecruitPlanMainId();
|
|
|
|
- RecruitPlanChild recruitPlanChild = new RecruitPlanChild();
|
|
|
|
- recruitPlanChild.setRecruitPlanMainId(mId);
|
|
|
|
- List<RecruitPlanChild> recruitPlanChildList = recruitPlanChildService.selectRecruitPlanChildList(recruitPlanChild);
|
|
|
|
- String nprs ;
|
|
|
|
- int count = 0;
|
|
|
|
- int countPersonnel = 0;
|
|
|
|
- for (RecruitPlanChild recruitPlanChild2 :recruitPlanChildList){
|
|
|
|
- if (recruitPlanChild2.getNprs()!= null){
|
|
|
|
- nprs = recruitPlanChild2.getNprs();
|
|
|
|
- int number = Integer.parseInt(nprs);
|
|
|
|
- count = count+number;
|
|
|
|
- //赋值nprs
|
|
|
|
- if (count!=0){
|
|
|
|
- recruitPlanMain1.setNprs(String.valueOf(count));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- String personnelCount = recruitPersonnelService.selectRecruitPersonnelNumByPostCode(recruitPlanChild2.getPostNumId());
|
|
|
|
- int yprs = Integer.parseInt(personnelCount);
|
|
|
|
- countPersonnel = countPersonnel+yprs;
|
|
|
|
- }
|
|
|
|
- //赋值yprs
|
|
|
|
- recruitPlanMain1.setYprs(String.valueOf(countPersonnel));
|
|
|
|
- }
|
|
|
|
return getDataTable(list);
|
|
return getDataTable(list);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -135,9 +110,6 @@ public class RecruitPlanMainController extends BaseController
|
|
{
|
|
{
|
|
Long deptId = getDeptId();
|
|
Long deptId = getDeptId();
|
|
SysDept sysDept = sysDeptService.selectDeptById(deptId);
|
|
SysDept sysDept = sysDeptService.selectDeptById(deptId);
|
|
- String deptName = sysDept.getDeptName();
|
|
|
|
- List<Integer> yearsList = getRecruitYear();
|
|
|
|
-
|
|
|
|
//默认生成一个岗位代码
|
|
//默认生成一个岗位代码
|
|
String deptId1 =String.valueOf(getDeptId().intValue()) ;
|
|
String deptId1 =String.valueOf(getDeptId().intValue()) ;
|
|
double number = Math.random()*1000000;
|
|
double number = Math.random()*1000000;
|
|
@@ -160,38 +132,21 @@ public class RecruitPlanMainController extends BaseController
|
|
public AjaxResult selectRecruitplanmainidBydeptId(){
|
|
public AjaxResult selectRecruitplanmainidBydeptId(){
|
|
StringBuilder msg = new StringBuilder();
|
|
StringBuilder msg = new StringBuilder();
|
|
Long deptId = getDeptId();
|
|
Long deptId = getDeptId();
|
|
- SysDept sysDept = sysDeptService.selectDeptById(deptId);
|
|
|
|
- String deptName = sysDept.getDeptName();
|
|
|
|
List<Integer> yearsList = getRecruitYear();
|
|
List<Integer> yearsList = getRecruitYear();
|
|
- //校验同单位今年和明年是否已有招聘计划
|
|
|
|
- Long a = Long.valueOf(yearsList.get(0));
|
|
|
|
- Long b = Long.valueOf(yearsList.get(1));
|
|
|
|
- RecruitPlanMain recruitPlanMain1 = new RecruitPlanMain();
|
|
|
|
- recruitPlanMain1.setDeptId(getDeptId());
|
|
|
|
- List<RecruitPlanMain> recruitPlanMainList = recruitPlanMainService.selectRecruitPlanMainList(recruitPlanMain1);
|
|
|
|
- for (RecruitPlanMain recruitPlanMain :recruitPlanMainList){
|
|
|
|
- for (int i=0;i<yearsList.size();i++){
|
|
|
|
- if (recruitPlanMain!=null){
|
|
|
|
- Long num = yearsList.get(i).longValue();
|
|
|
|
- if (recruitPlanMain.getRecruitPlanYear().equals(num)){
|
|
|
|
- yearsList.remove(i);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ List<Integer> yearsListThen = recruitPlanMainService.selectRecruitPlanMainIdByDeptidForMain(deptId,yearsList);
|
|
if (yearsList.size()==0){
|
|
if (yearsList.size()==0){
|
|
msg.append(0);
|
|
msg.append(0);
|
|
- mapNeed.put("yearForAdd",yearsList);
|
|
|
|
|
|
+ mapNeed.put("yearForAdd",yearsListThen);
|
|
return AjaxResult.success(msg.toString());
|
|
return AjaxResult.success(msg.toString());
|
|
}
|
|
}
|
|
List<Integer> yearsListNew = getRecruitYear();
|
|
List<Integer> yearsListNew = getRecruitYear();
|
|
if (yearsList.size()==1 &&yearsList.get(0).equals(yearsListNew.get(0))){
|
|
if (yearsList.size()==1 &&yearsList.get(0).equals(yearsListNew.get(0))){
|
|
msg.append(1);
|
|
msg.append(1);
|
|
- mapNeed.put("yearForAdd",yearsList);
|
|
|
|
|
|
+ mapNeed.put("yearForAdd",yearsListThen);
|
|
return AjaxResult.success(msg.toString());
|
|
return AjaxResult.success(msg.toString());
|
|
}
|
|
}
|
|
-
|
|
|
|
- mapNeed.put("yearForAdd",yearsList);
|
|
|
|
|
|
+ mapNeed.put("yearForAdd",yearsListThen);
|
|
return AjaxResult.success(msg.toString());
|
|
return AjaxResult.success(msg.toString());
|
|
}
|
|
}
|
|
|
|
|
|
@@ -205,48 +160,7 @@ public class RecruitPlanMainController extends BaseController
|
|
{
|
|
{
|
|
try {
|
|
try {
|
|
recruitPM.setDeptId(getDeptId());
|
|
recruitPM.setDeptId(getDeptId());
|
|
- //给新增计划中的子计划delFlag赋值为"0''
|
|
|
|
- List<RecruitPlanChild> recruitPlanChildList = recruitPM.getColumns();
|
|
|
|
- List<String> postNumIdList = recruitPlanMainService.selectRecruitPlanMainListForCheckPostNumId(recruitPM);
|
|
|
|
- //再次校验子计划中的岗位代码是否与已有重复,概率为零
|
|
|
|
- for (RecruitPlanChild recruitPlanChild : recruitPlanChildList){
|
|
|
|
- if (postNumIdList.contains(recruitPlanChild.getPostNumId())){
|
|
|
|
- return AjaxResult.error("招聘计划中生成的岗位代码重复,请修改");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- recruitPlanChildList.forEach(recruitPlanChild -> recruitPlanChild.setDelFlag("0"));
|
|
|
|
- recruitPM.setAhrsRecruitPlanChildList(recruitPlanChildList);
|
|
|
|
- recruitPM.setCreateBy(ShiroUtils.getSysUser().getUserName());
|
|
|
|
- recruitPM.setCreateTime(DateUtils.getNowDate());
|
|
|
|
- recruitPM.setDelFlag("0");
|
|
|
|
- //查看本单位本年是否有申报历史
|
|
|
|
- RecruitPlanMain recruitPlanMainMemory = recruitPlanMainService.selectRecruitPlanMainByDeptIdAndYear(recruitPM.getRecruitPlanYear(),recruitPM.getDeptId());
|
|
|
|
- if (recruitPlanMainMemory!=null){
|
|
|
|
- recruitPM.setVersion(recruitPlanMainMemory.getVersion()+1);
|
|
|
|
- }
|
|
|
|
- //给所有子计划版本赋值
|
|
|
|
- for (int i=0;i<recruitPlanChildList.size();i++){
|
|
|
|
- recruitPlanChildList.get(0).setVersion(1L);
|
|
|
|
- }
|
|
|
|
- //转换age
|
|
|
|
- recruitPlanChildList.forEach(recruitPlanChild -> {
|
|
|
|
- if (recruitPlanChild.getStartAge()!= null && recruitPlanChild.getStartAge().length()!= 0 && recruitPlanChild.getEndAge()!=null&& recruitPlanChild.getEndAge().length()!= 0 ){
|
|
|
|
- recruitPlanChild.setAge(recruitPlanChild.getStartAge() + "-" + recruitPlanChild.getEndAge());
|
|
|
|
- }
|
|
|
|
- if (recruitPlanChild.getStartAge()!="" && recruitPlanChild.getEndAge() == ""){
|
|
|
|
- recruitPlanChild.setAge(recruitPlanChild.getStartAge() + "-" + "65");
|
|
|
|
- }
|
|
|
|
- if (recruitPlanChild.getStartAge()== "" && recruitPlanChild.getEndAge()!= ""){
|
|
|
|
- recruitPlanChild.setAge("0" + "-" + recruitPlanChild.getEndAge());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- );
|
|
|
|
- //转换major
|
|
|
|
- recruitPlanChildList.forEach(recruitPlanChild -> {
|
|
|
|
- if (StringUtils.isNotEmpty(recruitPlanChild.getMajor()) || StringUtils.isNotEmpty(recruitPlanChild.getMajorValue())){
|
|
|
|
- splicingMajor(recruitPlanChild);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
int result = recruitPlanMainService.insertRecruitPlanMain(recruitPM);
|
|
int result = recruitPlanMainService.insertRecruitPlanMain(recruitPM);
|
|
if (result == 11){
|
|
if (result == 11){
|
|
return AjaxResult.error("招聘计划中的岗位代码重复");
|
|
return AjaxResult.error("招聘计划中的岗位代码重复");
|
|
@@ -258,15 +172,9 @@ public class RecruitPlanMainController extends BaseController
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- private void splicingMajor(RecruitPlanChild recruitPlanChildToMajor){
|
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
|
- jsonObject.put(UserEnums.majorType.tree.getStatus(),recruitPlanChildToMajor.getMajor());
|
|
|
|
- jsonObject.put(UserEnums.majorType.dz.getStatus(),recruitPlanChildToMajor.getSpecialtyMajor());
|
|
|
|
- jsonObject.put(UserEnums.majorType.bk.getStatus(),recruitPlanChildToMajor.getUndergraduateMajor());
|
|
|
|
- jsonObject.put(UserEnums.majorType.yjs.getStatus(),recruitPlanChildToMajor.getGraduateMajor());
|
|
|
|
- jsonObject.put(UserEnums.majorType.qt.getStatus(),recruitPlanChildToMajor.getOtherMajor());
|
|
|
|
- recruitPlanChildToMajor.setMajor(jsonObject.toJSONString());
|
|
|
|
|
|
+ private RecruitPlanChild splicingMajor(RecruitPlanChild recruitPlanChildToMajor){
|
|
|
|
+ recruitPlanChildToMajor = recruitPlanMainService.splicingMajor(recruitPlanChildToMajor);
|
|
|
|
+ return recruitPlanChildToMajor;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -275,47 +183,11 @@ public class RecruitPlanMainController extends BaseController
|
|
@GetMapping("/edit/{recruitPlanMainId}")
|
|
@GetMapping("/edit/{recruitPlanMainId}")
|
|
public String edit(@PathVariable("recruitPlanMainId") Long recruitPlanMainId, ModelMap mmap)
|
|
public String edit(@PathVariable("recruitPlanMainId") Long recruitPlanMainId, ModelMap mmap)
|
|
{
|
|
{
|
|
-
|
|
|
|
- RecruitPlanMain recruitPlanMain = recruitPlanMainService.selectRecruitPlanMainById(recruitPlanMainId);
|
|
|
|
//默认生成一个岗位代码
|
|
//默认生成一个岗位代码
|
|
- String deptIdStr =String.valueOf(getDeptId().intValue()) ;
|
|
|
|
|
|
+ RecruitPlanMain recruitPM = recruitPlanMainService.selectRecruitPlanMainById(recruitPlanMainId);
|
|
double number = Math.random()*1000000;
|
|
double number = Math.random()*1000000;
|
|
String mathCode = String.valueOf(new Double(number).intValue());
|
|
String mathCode = String.valueOf(new Double(number).intValue());
|
|
- String postNumIdStr = deptIdStr+mathCode;
|
|
|
|
- int countNum = 0;
|
|
|
|
-
|
|
|
|
- RecruitPlanMain recruitPM = new RecruitPlanMain();
|
|
|
|
-
|
|
|
|
- List<RecruitPlanChild> recruitPlanMainList = recruitPlanMain.getAhrsRecruitPlanChildList();
|
|
|
|
- for (RecruitPlanChild recruitPlanChild : recruitPlanMainList){
|
|
|
|
- countNum = (int)(Math.random()*10);
|
|
|
|
- postNumIdStr = postNumIdStr+ countNum;
|
|
|
|
- String personnelCount = recruitPersonnelService.selectRecruitPersonnelNumByPostCode(recruitPlanChild.getPostNumId());
|
|
|
|
- recruitPlanChild.setYprs(personnelCount);
|
|
|
|
- countNum++;
|
|
|
|
- //给majorValue赋值
|
|
|
|
- recruitPlanChild.setMajorValue(recruitPlanMainService.setMajorValue(recruitPlanChild.getMajor()));
|
|
|
|
- //转换age
|
|
|
|
- if (recruitPlanChild.getAge()!=null&& recruitPlanChild.getAge().length()!=0 &&recruitPlanChild.getAge()!="" ){
|
|
|
|
- String[] strArray = recruitPlanChild.getAge().split("-");
|
|
|
|
- if (strArray.length!=0){
|
|
|
|
- for (int i=0;i<strArray.length;i++){
|
|
|
|
- if (i==0){
|
|
|
|
- recruitPlanChild.setStartAge(strArray[0]);
|
|
|
|
- }
|
|
|
|
- if (i==1){
|
|
|
|
- recruitPlanChild.setEndAge(strArray[1]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- recruitPM.setRecruitPlanYear(recruitPlanMain.getRecruitPlanYear());
|
|
|
|
- recruitPM.setRecruitPlanMainId(recruitPlanMainId);
|
|
|
|
- recruitPM.setDeptName(recruitPlanMain.getDeptName());
|
|
|
|
- recruitPM.setColumns(recruitPlanMain.getAhrsRecruitPlanChildList());
|
|
|
|
- recruitPM.setAttachment(recruitPlanMain.getAttachment());
|
|
|
|
- recruitPM.setRemark(recruitPlanMain.getRemark());
|
|
|
|
|
|
+ String postNumIdStr = mathCode;
|
|
|
|
|
|
mmap.put("RecruitPlanMain",recruitPM);
|
|
mmap.put("RecruitPlanMain",recruitPM);
|
|
mmap.put("recruitPlanYears",recruitPM.getRecruitPlanYear());
|
|
mmap.put("recruitPlanYears",recruitPM.getRecruitPlanYear());
|
|
@@ -334,86 +206,10 @@ public class RecruitPlanMainController extends BaseController
|
|
public AjaxResult editSave(RecruitPlanMain recruitPM)
|
|
public AjaxResult editSave(RecruitPlanMain recruitPM)
|
|
{
|
|
{
|
|
try {
|
|
try {
|
|
- boolean isChange = true;
|
|
|
|
- //修改界面传过来的对象
|
|
|
|
- List<RecruitPlanChild> recruitPlanChildList = recruitPM.getColumns();
|
|
|
|
- int beanLongNum = recruitPlanChildList.size();
|
|
|
|
-
|
|
|
|
- //给修改招聘计划中的子计划delFlag赋值为"0''--并且进行转换age
|
|
|
|
- recruitPlanChildList.forEach(recruitPlanChild -> {
|
|
|
|
- recruitPlanChild.setDelFlag("0");
|
|
|
|
- if (recruitPlanChild.getStartAge()!= null && recruitPlanChild.getStartAge().length()!= 0 && recruitPlanChild.getEndAge()!=null&& recruitPlanChild.getEndAge().length()!= 0 ){
|
|
|
|
- recruitPlanChild.setAge(recruitPlanChild.getStartAge() + "-" + recruitPlanChild.getEndAge());
|
|
|
|
- }
|
|
|
|
- if (recruitPlanChild.getStartAge()!="" && recruitPlanChild.getEndAge() == ""){
|
|
|
|
- recruitPlanChild.setAge(recruitPlanChild.getStartAge() + "-" + "65");
|
|
|
|
- }
|
|
|
|
- if (recruitPlanChild.getStartAge()== "" && recruitPlanChild.getEndAge()!= ""){
|
|
|
|
- recruitPlanChild.setAge("0" + "-" + recruitPlanChild.getEndAge());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- });
|
|
|
|
- //转换major
|
|
|
|
- recruitPlanChildList.forEach(recruitPlanChild -> {
|
|
|
|
- if (StringUtils.isNotEmpty(recruitPlanChild.getMajor()) || StringUtils.isNotEmpty(recruitPlanChild.getMajorValue())){
|
|
|
|
- splicingMajor(recruitPlanChild);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- recruitPM.setAhrsRecruitPlanChildList(recruitPlanChildList);
|
|
|
|
- recruitPM.setUpdateBy(ShiroUtils.getSysUser().getUserName());
|
|
|
|
- recruitPM.setUpdateTime(DateUtils.getNowDate());
|
|
|
|
- //数据库中的对象
|
|
|
|
- RecruitPlanMain recruitPMT = recruitPlanMainService.selectRecruitPlanMainById(recruitPM.getRecruitPlanMainId());
|
|
|
|
- List<RecruitPlanChild> recruitPlanChildListTwo = recruitPMT.getAhrsRecruitPlanChildList();
|
|
|
|
- //2. 获取list集合中的某个元素
|
|
|
|
- List<Long> idsOld = recruitPlanChildListTwo.stream().map(recruitPlanChild -> recruitPlanChild.getRecruitPlanChildId()).collect(Collectors.toList());
|
|
|
|
- List<Long> idsNew = recruitPM.getRecruitPlanChildIds();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //第一步,将传过来的的子计划全部赋值vesion为1
|
|
|
|
- for (int i=0; i<recruitPlanChildList.size();i++){
|
|
|
|
- recruitPlanChildList.get(i).setVersion(1L);
|
|
|
|
- recruitPlanChildList.get(i).setRecruitPlanMainId(recruitPM.getRecruitPlanMainId());
|
|
|
|
- recruitPlanChildList.get(i).setCreateBy(ShiroUtils.getSysUser().getCreateBy());
|
|
|
|
- recruitPlanChildList.get(i).setCreateTime(DateUtils.getNowDate());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //第二步将已存在的子计划version+1
|
|
|
|
- for (int i=0;i<idsNew.size();i++){
|
|
|
|
- System.out.println("--------|-----"+idsNew.get(i));
|
|
|
|
- RecruitPlanChild recruitPlanChild = recruitPlanChildService.selectRecruitPlanChildById(idsNew.get(i));
|
|
|
|
- //将穿过来的子计划集合中的子计划修改
|
|
|
|
- recruitPlanChildList.get(i).setVersion(recruitPlanChild.getVersion()+1);
|
|
|
|
- recruitPlanChildList.get(i).setRecruitPlanMainId(recruitPM.getRecruitPlanMainId());
|
|
|
|
- recruitPlanChildList.get(i).setCreateBy(recruitPlanChild.getCreateBy());
|
|
|
|
- recruitPlanChildList.get(i).setCreateTime(recruitPlanChild.getCreateTime());
|
|
|
|
- recruitPlanChildList.get(i).setUpdateBy(ShiroUtils.getSysUser().getUserName());
|
|
|
|
- recruitPlanChildList.get(i).setUpdateTime(DateUtils.getNowDate());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //第三步,将删除的子计划版本加一且逻辑删除
|
|
|
|
- for (int i=0;i<idsOld.size();i++){
|
|
|
|
- Long indexNum = idsOld.get(i);
|
|
|
|
- if (!idsNew.contains(indexNum)){
|
|
|
|
- //删除,
|
|
|
|
- RecruitPlanChild recruitPlanChild = recruitPlanChildService.selectRecruitPlanChildById(indexNum);
|
|
|
|
- recruitPlanChild.setVersion(recruitPlanChild.getVersion()+1);
|
|
|
|
- recruitPlanChild.setRecruitPlanChildId(null);
|
|
|
|
- recruitPlanChildService.insertRecruitPlanChild(recruitPlanChild);
|
|
|
|
- isChange = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //第五步 更新recruitPlanMain,
|
|
|
|
- if (isChange){
|
|
|
|
- recruitPM.setVersion(recruitPMT.getVersion()+1);
|
|
|
|
- recruitPM.setDeptId(recruitPMT.getDeptId());
|
|
|
|
- recruitPM.setCreateBy(recruitPMT.getCreateBy());
|
|
|
|
- recruitPM.setDelFlag("0");
|
|
|
|
- recruitPM.setAhrsRecruitPlanChildList(recruitPlanChildList);
|
|
|
|
- recruitPlanMainService.insertRecruitPlanMain(recruitPM);
|
|
|
|
- }
|
|
|
|
|
|
+ int result = recruitPlanMainService.insertRecruitPlanMainToEdit(recruitPM);
|
|
|
|
+ if (result==0){
|
|
|
|
+ return toAjax(false);
|
|
|
|
+ }
|
|
return toAjax(true);
|
|
return toAjax(true);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
System.out.println(e);
|
|
System.out.println(e);
|