|
@@ -6,9 +6,12 @@ import com.ruoyi.common.exception.ServiceException;
|
|
import com.ruoyi.web.work.api.util.AppUtil;
|
|
import com.ruoyi.web.work.api.util.AppUtil;
|
|
import com.ruoyi.web.work.domain.Column;
|
|
import com.ruoyi.web.work.domain.Column;
|
|
import com.ruoyi.web.work.domain.Position;
|
|
import com.ruoyi.web.work.domain.Position;
|
|
|
|
+import com.ruoyi.web.work.domain.dto.PositionDto;
|
|
|
|
+import com.ruoyi.web.work.domain.dto.PositionStateDto;
|
|
import com.ruoyi.web.work.mapper.PositionMapper;
|
|
import com.ruoyi.web.work.mapper.PositionMapper;
|
|
import com.ruoyi.web.work.service.IColumnService;
|
|
import com.ruoyi.web.work.service.IColumnService;
|
|
import com.ruoyi.web.work.service.IPositionService;
|
|
import com.ruoyi.web.work.service.IPositionService;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -37,8 +40,9 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public AjaxResult edit(Position position) {
|
|
|
|
- position.setUserId(AppUtil.getUser().getId());
|
|
|
|
|
|
+ public AjaxResult manageAdd(PositionDto dto) {
|
|
|
|
+ Position position = new Position();
|
|
|
|
+ BeanUtils.copyProperties(dto, position);
|
|
Column region = columnService.selectRegion(new Column().setTitle(position.getRegionName()).setLevel(3));
|
|
Column region = columnService.selectRegion(new Column().setTitle(position.getRegionName()).setLevel(3));
|
|
if (region != null) {
|
|
if (region != null) {
|
|
position.setAncestors(region.getAncestors() + "," + region.getId());
|
|
position.setAncestors(region.getAncestors() + "," + region.getId());
|
|
@@ -49,6 +53,9 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
|
|
position.setMin(Integer.parseInt(salary[0]));
|
|
position.setMin(Integer.parseInt(salary[0]));
|
|
position.setMax(Integer.parseInt(salary[1]));
|
|
position.setMax(Integer.parseInt(salary[1]));
|
|
}
|
|
}
|
|
|
|
+ position.setUserId(AppUtil.getUser().getId());
|
|
|
|
+ position.setState(0);
|
|
|
|
+ position.setAudit(1);
|
|
if (!save(position)) {
|
|
if (!save(position)) {
|
|
throw new ServiceException("发布职位失败");
|
|
throw new ServiceException("发布职位失败");
|
|
}
|
|
}
|
|
@@ -56,6 +63,23 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ public AjaxResult manageEdit(PositionDto dto) {
|
|
|
|
+ Position position = getById(dto.getId());
|
|
|
|
+ if (position == null || !position.getUserId().equals(AppUtil.getUser().getId())) {
|
|
|
|
+ return AjaxResult.error("职位不存在或非法操作");
|
|
|
|
+ }
|
|
|
|
+ if (position.getAudit() == 1) {
|
|
|
|
+ return AjaxResult.error("该职位已审核通过不允许编辑");
|
|
|
|
+ }
|
|
|
|
+ BeanUtils.copyProperties(dto, position);
|
|
|
|
+ position.setUserId(AppUtil.getUser().getId());
|
|
|
|
+ if (!updateById(position)) {
|
|
|
|
+ throw new ServiceException("编辑职位失败");
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
public AjaxResult manageDetail(Long id) {
|
|
public AjaxResult manageDetail(Long id) {
|
|
Position position = getById(id);
|
|
Position position = getById(id);
|
|
if (position == null || !position.getUserId().equals(AppUtil.getUser().getId())) {
|
|
if (position == null || !position.getUserId().equals(AppUtil.getUser().getId())) {
|
|
@@ -63,4 +87,29 @@ public class PositionServiceImpl extends ServiceImpl<PositionMapper, Position> i
|
|
}
|
|
}
|
|
return AjaxResult.success(position);
|
|
return AjaxResult.success(position);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public AjaxResult manageRemove(Long id) {
|
|
|
|
+ Position position = getById(id);
|
|
|
|
+ if (position == null || !position.getUserId().equals(AppUtil.getUser().getId())) {
|
|
|
|
+ return AjaxResult.error("职位不存在或非法操作");
|
|
|
|
+ }
|
|
|
|
+ if (!removeById(id)) {
|
|
|
|
+ throw new ServiceException("删除职位失败,请联系平台");
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public AjaxResult manageState(PositionStateDto dto) {
|
|
|
|
+ Position position = getById(dto.getId());
|
|
|
|
+ if (position == null || !position.getUserId().equals(AppUtil.getUser().getId())) {
|
|
|
|
+ return AjaxResult.error("职位不存在或非法操作");
|
|
|
|
+ }
|
|
|
|
+ position.setState(dto.getState());
|
|
|
|
+ if (!updateById(position)) {
|
|
|
|
+ throw new ServiceException("启用或关闭职位失败,请联系平台");
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
}
|
|
}
|