glcc后台页面更新

This commit is contained in:
Gitea 2023-08-28 14:22:07 +08:00
parent 6cfeeb8e1c
commit aeffe4cf9e
3 changed files with 54 additions and 23 deletions

View File

@ -81,7 +81,22 @@ public class ApplyController {
boolean success = applyService.update(updateVo);
return success ? DataPacketUtil.ok("success") : DataPacketUtil.badRequest();
}
@ApiOperation("修改项目信息")
@PostMapping("/updateProject")
public ResponseEntity<ResponseData> updateProject(HttpServletRequest request, @Validated @RequestBody GlccRegistrationInformation updateVo, BindingResult bindingResult) {
String errors = ValidatorUtils.buildValidationdErrorMessage(bindingResult);
if (errors.length() > 1) {
return DataPacketUtil.badRequest(errors);
}
// UserVo user = userService.getCurrentUser(request);
// GlccRegistrationInformation model = applyService.getById(updateVo.getId());
// if (user.getUser_id() != null && model.getUserId() != null && !user.getUser_id().equals(model.getUserId().toString())) {
// return DataPacketUtil.forbidden("没有权限修改该记录");
// }
boolean success = applyService.updateProject(updateVo);
return success ? DataPacketUtil.ok("success") : DataPacketUtil.badRequest();
}
@ApiOperation("更新报名排序")
@PostMapping("/updateSort")
@RequiresRoles(value = {Constants.SUPER_USER_ROLE}, logical = Logical.OR)
@ -148,7 +163,7 @@ public class ApplyController {
@GuestAccess
public ResponseEntity<ResponseData> projectList(int curPage, int pageSize, String keyword,String taskName,
@RequestParam(defaultValue = "1",required = false) Integer round) {
Page<GlccRegistrationInformation> page = applyService.pageList(curPage, pageSize, keyword, round, taskName);
Page<GlccRegistrationInformation> page = applyService.pageProjectList(curPage, pageSize, keyword, round);
List<RegistrationInformationListVo> voList = Optional.ofNullable(page.getRecords()).orElse(Collections.emptyList()).stream().map((item) -> {
RegistrationInformationListVo vo = BeanCopyUtils.beanPropertiesCopy(item, RegistrationInformationListVo.class);
//vo.setRegistrationTaskList(applyTaskService.getRegistrationTaskList(item.getId(), round));

View File

@ -14,6 +14,8 @@ public interface ApplyService extends IService<GlccRegistrationInformation> {
boolean update(RegistrationInformationUpdateVo updateVo);
boolean updateProject(GlccRegistrationInformation updateVo);
boolean updateSort(UpdateSortVo updateVo);
boolean deleteById(Integer id);
@ -22,7 +24,7 @@ public interface ApplyService extends IService<GlccRegistrationInformation> {
Page<GlccRegistrationInformation> pageList(int curPage, int pageSize, String keyword, Integer round, String taskName);
// Page<GlccRegistrationInformation> pageProjectList(int curPage, int pageSize, String keyword, Integer round, String taskName);
Page<GlccRegistrationInformation> pageProjectList(int curPage, int pageSize, String keyword, Integer round);
boolean currentUserOwnGlccProjects(Integer userId, List<Long> ids);

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xjy.ai.common.utils.BeanCopyUtils;
import com.xjy.ai.common.utils.CommonUtils;
import com.xjy.ai.model.dao.glcc.entity.GlccRegistrationInformation;
import com.xjy.ai.model.dao.glcc.entity.GlccRegistrationTask;
import com.xjy.ai.model.dao.glcc.mapper.GlccRegistrationInformationMapper;
@ -67,6 +68,14 @@ public class ApplyServiceImpl extends ServiceImpl<GlccRegistrationInformationMap
return flag > 0;
}
@Override
public boolean updateProject(GlccRegistrationInformation updateVo) {
GlccRegistrationInformation glccRegistrationInformation = BeanCopyUtils.beanPropertiesCopy(updateVo, GlccRegistrationInformation.class);
int flag = baseMapper.updateById(glccRegistrationInformation);
return flag > 0;
}
@Override
public boolean updateSort(UpdateSortVo updateVo) {
UpdateWrapper<GlccRegistrationInformation> updateWrapper = new UpdateWrapper<>();
@ -109,27 +118,32 @@ public class ApplyServiceImpl extends ServiceImpl<GlccRegistrationInformationMap
}
// @Override
// public Page<GlccRegistrationInformation> pageProjectList(int curPage, int pageSize, String keyword, Integer round, String taskName) {
//
// Page<GlccRegistrationInformation> page = new Page<>(curPage,pageSize);
// QueryWrapper<GlccRegistrationInformation> wrapper = new QueryWrapper<>();
// if (keyword != null) {
// wrapper.lambda().eq(GlccRegistrationInformation::getRound, round).like(GlccRegistrationInformation::getProjectName, keyword).orderByDesc(GlccRegistrationInformation::getSortNo, GlccRegistrationInformation::getCreatedOn);
// } else {
// wrapper.lambda().eq(GlccRegistrationInformation::getRound, round).orderByDesc(GlccRegistrationInformation::getSortNo, GlccRegistrationInformation::getCreatedOn);
// }
// if (StringUtils.isNotBlank(taskName)) {
// List<GlccRegistrationTask> taskList = applyTaskService.getTaskListByName(taskName, round);
// if (CollectionUtils.isEmpty(taskList)) {
// return new Page<>();
// }
// List<Integer> regIds = taskList.stream().map(GlccRegistrationTask::getRegId).collect(Collectors.toList());
// wrapper.lambda().in(GlccRegistrationInformation::getId, regIds);
// }
// Page<GlccRegistrationInformation> result = page(page, wrapper);
// return result;
// }
@Override
public Page<GlccRegistrationInformation> pageProjectList(int curPage, int pageSize, String keyword, Integer round) {
Page<GlccRegistrationInformation> page = new Page<>(curPage,pageSize);
QueryWrapper<GlccRegistrationInformation> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(GlccRegistrationInformation::getRound, round);
if (null != keyword && !"".equals(keyword)) {
List<String> keywordList = CommonUtils.splitToList(keyword);
if (!keywordList.isEmpty()) {
wrapper.lambda().and(queryWrapper -> {
for (String item : keywordList) {
queryWrapper.or()
.like(GlccRegistrationInformation::getProjectName, item);
}
});
}
}
wrapper.lambda().orderByDesc(GlccRegistrationInformation::getSortNo, GlccRegistrationInformation::getCreatedOn);
Page<GlccRegistrationInformation> result = page(page, wrapper);
return result;
}
@Override
public boolean currentUserOwnGlccProjects(Integer userId, List<Long> ids) {