修改试卷数据处理逻辑;修改组织-项目关系数据处理逻辑;重新生成OrgProjectDAO

This commit is contained in:
joylink_zhangsai 2022-12-26 11:23:32 +08:00
parent 3569212e57
commit 57f6dae0b3
16 changed files with 446 additions and 322 deletions

View File

@ -62,6 +62,9 @@ public class WebConfig implements WebMvcConfigurer {
whiteList.add("/api/test/**"); whiteList.add("/api/test/**");
whiteList.add("/api/project/viewSetting/simple/all"); whiteList.add("/api/project/viewSetting/simple/all");
whiteList.add("/api/project/viewSetting/project/{project}"); whiteList.add("/api/project/viewSetting/project/{project}");
//旧数据处理
whiteList.add("/api/org/oldData/handle");
whiteList.add("/api/mapFunction/oldDataHandle");
registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList); registry.addInterceptor(authenticateInterceptor).excludePathPatterns(whiteList);
} }

View File

@ -1,15 +1,16 @@
package club.joylink.rtss.controller.org; package club.joylink.rtss.controller.org;
import club.joylink.rtss.dao.org.OrgProjectDao; import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.entity.org.OrgProject; import club.joylink.rtss.dao.OrgProjectDAO;
import club.joylink.rtss.entity.Org;
import club.joylink.rtss.entity.OrgExample;
import club.joylink.rtss.entity.OrgProject;
import club.joylink.rtss.services.org.IOrgProjectService; import club.joylink.rtss.services.org.IOrgProjectService;
import club.joylink.rtss.services.org.OrgService;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.org.OrgProjectVO; import club.joylink.rtss.vo.client.org.OrgProjectVO;
import club.joylink.rtss.vo.client.org.OrgVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -42,9 +43,9 @@ public class OrgProjectController {
} }
@Autowired @Autowired
private OrgProjectDao orgProjectDao; private OrgProjectDAO orgProjectDAO;
@Autowired @Autowired
private OrgService orgService; private OrgDAO orgDAO;
/** /**
* 旧数据处理用完删除 * 旧数据处理用完删除
@ -52,20 +53,22 @@ public class OrgProjectController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@PostMapping("/oldData/handle") @PostMapping("/oldData/handle")
public void oldDataHandle() { public void oldDataHandle() {
orgProjectDao.deleteByExample(null); orgProjectDAO.deleteByExample(null);
OrgProject orgProject = new OrgProject(); OrgProject orgProject = new OrgProject();
orgProject.setCreateTime(LocalDateTime.now()); orgProject.setCreateTime(LocalDateTime.now());
orgProject.setCreatorId(1L); orgProject.setCreatorId(1L);
List<OrgVO> orgs = orgService.queryAllTopOrg(); OrgExample orgExample = new OrgExample();
for (OrgVO org : orgs) { orgExample.createCriteria().andStatusEqualTo("1").andParentIdIsNull();
List<String> projectCodes = org.getProjectCodes(); List<Org> orgs = orgDAO.selectByExample(orgExample);
if (!CollectionUtils.isEmpty(projectCodes)) { for (Org org : orgs) {
for (String projectCode : projectCodes) { String projectCodeStr = org.getProjectCode();
if (StringUtils.hasText(projectCodeStr)) {
for (String projectCode : projectCodeStr.split(",")) {
orgProject.setId(null); orgProject.setId(null);
orgProject.setOrgId(org.getId()); orgProject.setOrgId(org.getId());
orgProject.setProjectCode(projectCode); orgProject.setProjectCode(projectCode);
orgProjectDao.insert(orgProject); orgProjectDAO.insert(orgProject);
} }
} }
} }

View File

@ -2,16 +2,10 @@ package club.joylink.rtss.controller.paper;
import club.joylink.rtss.constants.RoleEnum; import club.joylink.rtss.constants.RoleEnum;
import club.joylink.rtss.controller.advice.Role; import club.joylink.rtss.controller.advice.Role;
import club.joylink.rtss.dao.ExamDefinitionDAO; import club.joylink.rtss.dao.*;
import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.dao.UserExamMapper;
import club.joylink.rtss.dao.org.OrgProjectDao;
import club.joylink.rtss.dao.paper.PaperCompositionDAO; import club.joylink.rtss.dao.paper.PaperCompositionDAO;
import club.joylink.rtss.dao.paper.PaperUserDAO; import club.joylink.rtss.dao.paper.PaperUserDAO;
import club.joylink.rtss.entity.ExamDefinitionExample; import club.joylink.rtss.entity.*;
import club.joylink.rtss.entity.UserExam;
import club.joylink.rtss.entity.UserExamExample;
import club.joylink.rtss.entity.org.OrgProject;
import club.joylink.rtss.entity.paper.PaperUser; import club.joylink.rtss.entity.paper.PaperUser;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IMapService; import club.joylink.rtss.services.IMapService;
@ -160,13 +154,15 @@ public class PaperCompositionController {
@Autowired @Autowired
OrgDAO orgDAO; OrgDAO orgDAO;
@Autowired @Autowired
OrgProjectDao orgProjectDao; OrgProjectDAO orgProjectDAO;
@Autowired @Autowired
UserExamMapper userExamMapper; UserExamMapper userExamMapper;
@Autowired @Autowired
private PaperUserDAO paperUserDAO; private PaperUserDAO paperUserDAO;
@Autowired @Autowired
PaperCompositionDAO paperCompositionDAO; PaperCompositionDAO paperCompositionDAO;
@Autowired
LsLessonDAO lsLessonDAO;
/** /**
* 旧数据处理接口用完删除 * 旧数据处理接口用完删除
@ -180,11 +176,16 @@ public class PaperCompositionController {
List<String> msg = new ArrayList<>(); List<String> msg = new ArrayList<>();
//所有在线地图 //所有在线地图
Map<Long, MapVO> onlineMaps = iMapService.listOnline().stream().collect(Collectors.toMap(MapVO::getId, Function.identity())); Map<Long, MapVO> onlineMaps = iMapService.listOnline().stream().collect(Collectors.toMap(MapVO::getId, Function.identity()));
//在线地图的有效试卷
LsLessonExample lsLessonExample = new LsLessonExample();
lsLessonExample.createCriteria().andMapIdIn(new ArrayList<>(onlineMaps.keySet())).andStatusEqualTo("1");
List<Long> validLessonIds = lsLessonDAO.selectByExample(lsLessonExample)
.stream().map(LsLesson::getId).collect(Collectors.toList());
//所有项目-组织对应关系 //所有项目-组织对应关系
Map<String, Long> projectCode_orgId_map = orgProjectDao.selectByExample(null).stream().collect(Collectors.toMap(OrgProject::getProjectCode, OrgProject::getOrgId)); Map<String, Long> projectCode_orgId_map = orgProjectDAO.selectByExample(null).stream().collect(Collectors.toMap(OrgProject::getProjectCode, OrgProject::getOrgId));
//转化试卷并记录试卷id变化 //转化试卷并记录试卷id变化
ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample(); ExamDefinitionExample examDefinitionExample = new ExamDefinitionExample();
examDefinitionExample.createCriteria().andStatusEqualTo("1").andMapIdIn(new ArrayList<>(onlineMaps.keySet())); examDefinitionExample.createCriteria().andStatusEqualTo("1").andLessonIdIn(validLessonIds);
Map<Long, Long> old_newExamIdMap = new HashMap<>(); Map<Long, Long> old_newExamIdMap = new HashMap<>();
examDefinitionDAO.selectByExample(examDefinitionExample).stream() examDefinitionDAO.selectByExample(examDefinitionExample).stream()
.peek(exam -> { .peek(exam -> {

View File

@ -0,0 +1,12 @@
package club.joylink.rtss.dao;
import club.joylink.rtss.entity.OrgProject;
import club.joylink.rtss.entity.OrgProjectExample;
import org.springframework.stereotype.Repository;
/**
* OrgProjectDAO继承基类
*/
@Repository
public interface OrgProjectDAO extends MyBatisBaseDao<OrgProject, Long, OrgProjectExample> {
}

View File

@ -1,16 +0,0 @@
package club.joylink.rtss.dao.org;
import club.joylink.rtss.dao.MyBatisBaseDao;
import club.joylink.rtss.entity.org.OrgProject;
import club.joylink.rtss.entity.org.OrgProjectExample;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
/**
* 组织与项目关系
*/
@Repository
public interface OrgProjectDao extends MyBatisBaseDao<OrgProject, Long, OrgProjectExample> {
int deleteByExampleSelective(@Param("example") OrgProjectExample example);
}

View File

@ -0,0 +1,124 @@
package club.joylink.rtss.entity;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* @author
*
*/
public class OrgProject implements Serializable {
/**
* 主键
*/
private Long id;
/**
* 组织ID
*/
private Long orgId;
/**
* 项目编码
*/
private String projectCode;
/**
* 创建者
*/
private Long creatorId;
/**
* 创建时间
*/
private LocalDateTime createTime;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getOrgId() {
return orgId;
}
public void setOrgId(Long orgId) {
this.orgId = orgId;
}
public String getProjectCode() {
return projectCode;
}
public void setProjectCode(String projectCode) {
this.projectCode = projectCode;
}
public Long getCreatorId() {
return creatorId;
}
public void setCreatorId(Long creatorId) {
this.creatorId = creatorId;
}
public LocalDateTime getCreateTime() {
return createTime;
}
public void setCreateTime(LocalDateTime createTime) {
this.createTime = createTime;
}
@Override
public boolean equals(Object that) {
if (this == that) {
return true;
}
if (that == null) {
return false;
}
if (getClass() != that.getClass()) {
return false;
}
OrgProject other = (OrgProject) that;
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
&& (this.getOrgId() == null ? other.getOrgId() == null : this.getOrgId().equals(other.getOrgId()))
&& (this.getProjectCode() == null ? other.getProjectCode() == null : this.getProjectCode().equals(other.getProjectCode()))
&& (this.getCreatorId() == null ? other.getCreatorId() == null : this.getCreatorId().equals(other.getCreatorId()))
&& (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()));
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
result = prime * result + ((getOrgId() == null) ? 0 : getOrgId().hashCode());
result = prime * result + ((getProjectCode() == null) ? 0 : getProjectCode().hashCode());
result = prime * result + ((getCreatorId() == null) ? 0 : getCreatorId().hashCode());
result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", orgId=").append(orgId);
sb.append(", projectCode=").append(projectCode);
sb.append(", creatorId=").append(creatorId);
sb.append(", createTime=").append(createTime);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}

View File

@ -1,7 +1,7 @@
package club.joylink.rtss.entity.org; package club.joylink.rtss.entity;
import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
public class OrgProjectExample { public class OrgProjectExample {
@ -11,6 +11,10 @@ public class OrgProjectExample {
protected List<Criteria> oredCriteria; protected List<Criteria> oredCriteria;
private Integer limit;
private Long offset;
public OrgProjectExample() { public OrgProjectExample() {
oredCriteria = new ArrayList<Criteria>(); oredCriteria = new ArrayList<Criteria>();
} }
@ -64,6 +68,22 @@ public class OrgProjectExample {
distinct = false; distinct = false;
} }
public void setLimit(Integer limit) {
this.limit = limit;
}
public Integer getLimit() {
return limit;
}
public void setOffset(Long offset) {
this.offset = offset;
}
public Long getOffset() {
return offset;
}
protected abstract static class GeneratedCriteria { protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria; protected List<Criterion> criteria;
@ -115,52 +135,52 @@ public class OrgProjectExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdEqualTo(Integer value) { public Criteria andIdEqualTo(Long value) {
addCriterion("id =", value, "id"); addCriterion("id =", value, "id");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdNotEqualTo(Integer value) { public Criteria andIdNotEqualTo(Long value) {
addCriterion("id <>", value, "id"); addCriterion("id <>", value, "id");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdGreaterThan(Integer value) { public Criteria andIdGreaterThan(Long value) {
addCriterion("id >", value, "id"); addCriterion("id >", value, "id");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdGreaterThanOrEqualTo(Integer value) { public Criteria andIdGreaterThanOrEqualTo(Long value) {
addCriterion("id >=", value, "id"); addCriterion("id >=", value, "id");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdLessThan(Integer value) { public Criteria andIdLessThan(Long value) {
addCriterion("id <", value, "id"); addCriterion("id <", value, "id");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdLessThanOrEqualTo(Integer value) { public Criteria andIdLessThanOrEqualTo(Long value) {
addCriterion("id <=", value, "id"); addCriterion("id <=", value, "id");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdIn(List<Integer> values) { public Criteria andIdIn(List<Long> values) {
addCriterion("id in", values, "id"); addCriterion("id in", values, "id");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdNotIn(List<Integer> values) { public Criteria andIdNotIn(List<Long> values) {
addCriterion("id not in", values, "id"); addCriterion("id not in", values, "id");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdBetween(Integer value1, Integer value2) { public Criteria andIdBetween(Long value1, Long value2) {
addCriterion("id between", value1, value2, "id"); addCriterion("id between", value1, value2, "id");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andIdNotBetween(Integer value1, Integer value2) { public Criteria andIdNotBetween(Long value1, Long value2) {
addCriterion("id not between", value1, value2, "id"); addCriterion("id not between", value1, value2, "id");
return (Criteria) this; return (Criteria) this;
} }
@ -305,52 +325,52 @@ public class OrgProjectExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreatorIdEqualTo(Integer value) { public Criteria andCreatorIdEqualTo(Long value) {
addCriterion("creator_id =", value, "creatorId"); addCriterion("creator_id =", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreatorIdNotEqualTo(Integer value) { public Criteria andCreatorIdNotEqualTo(Long value) {
addCriterion("creator_id <>", value, "creatorId"); addCriterion("creator_id <>", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreatorIdGreaterThan(Integer value) { public Criteria andCreatorIdGreaterThan(Long value) {
addCriterion("creator_id >", value, "creatorId"); addCriterion("creator_id >", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreatorIdGreaterThanOrEqualTo(Integer value) { public Criteria andCreatorIdGreaterThanOrEqualTo(Long value) {
addCriterion("creator_id >=", value, "creatorId"); addCriterion("creator_id >=", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreatorIdLessThan(Integer value) { public Criteria andCreatorIdLessThan(Long value) {
addCriterion("creator_id <", value, "creatorId"); addCriterion("creator_id <", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreatorIdLessThanOrEqualTo(Integer value) { public Criteria andCreatorIdLessThanOrEqualTo(Long value) {
addCriterion("creator_id <=", value, "creatorId"); addCriterion("creator_id <=", value, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreatorIdIn(List<Integer> values) { public Criteria andCreatorIdIn(List<Long> values) {
addCriterion("creator_id in", values, "creatorId"); addCriterion("creator_id in", values, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreatorIdNotIn(List<Integer> values) { public Criteria andCreatorIdNotIn(List<Long> values) {
addCriterion("creator_id not in", values, "creatorId"); addCriterion("creator_id not in", values, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreatorIdBetween(Integer value1, Integer value2) { public Criteria andCreatorIdBetween(Long value1, Long value2) {
addCriterion("creator_id between", value1, value2, "creatorId"); addCriterion("creator_id between", value1, value2, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreatorIdNotBetween(Integer value1, Integer value2) { public Criteria andCreatorIdNotBetween(Long value1, Long value2) {
addCriterion("creator_id not between", value1, value2, "creatorId"); addCriterion("creator_id not between", value1, value2, "creatorId");
return (Criteria) this; return (Criteria) this;
} }
@ -365,57 +385,59 @@ public class OrgProjectExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeEqualTo(Date value) { public Criteria andCreateTimeEqualTo(LocalDateTime value) {
addCriterion("create_time =", value, "createTime"); addCriterion("create_time =", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeNotEqualTo(Date value) { public Criteria andCreateTimeNotEqualTo(LocalDateTime value) {
addCriterion("create_time <>", value, "createTime"); addCriterion("create_time <>", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeGreaterThan(Date value) { public Criteria andCreateTimeGreaterThan(LocalDateTime value) {
addCriterion("create_time >", value, "createTime"); addCriterion("create_time >", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { public Criteria andCreateTimeGreaterThanOrEqualTo(LocalDateTime value) {
addCriterion("create_time >=", value, "createTime"); addCriterion("create_time >=", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeLessThan(Date value) { public Criteria andCreateTimeLessThan(LocalDateTime value) {
addCriterion("create_time <", value, "createTime"); addCriterion("create_time <", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeLessThanOrEqualTo(Date value) { public Criteria andCreateTimeLessThanOrEqualTo(LocalDateTime value) {
addCriterion("create_time <=", value, "createTime"); addCriterion("create_time <=", value, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeIn(List<Date> values) { public Criteria andCreateTimeIn(List<LocalDateTime> values) {
addCriterion("create_time in", values, "createTime"); addCriterion("create_time in", values, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeNotIn(List<Date> values) { public Criteria andCreateTimeNotIn(List<LocalDateTime> values) {
addCriterion("create_time not in", values, "createTime"); addCriterion("create_time not in", values, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeBetween(Date value1, Date value2) { public Criteria andCreateTimeBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("create_time between", value1, value2, "createTime"); addCriterion("create_time between", value1, value2, "createTime");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andCreateTimeNotBetween(Date value1, Date value2) { public Criteria andCreateTimeNotBetween(LocalDateTime value1, LocalDateTime value2) {
addCriterion("create_time not between", value1, value2, "createTime"); addCriterion("create_time not between", value1, value2, "createTime");
return (Criteria) this; return (Criteria) this;
} }
} }
/**
*/
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {
protected Criteria() { protected Criteria() {

View File

@ -1,18 +0,0 @@
package club.joylink.rtss.entity.org;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class OrgProject {
private Long id;
private Long orgId;
private String projectCode;
private Long creatorId;
private LocalDateTime createTime;
}

View File

@ -1,6 +1,6 @@
package club.joylink.rtss.services.org; package club.joylink.rtss.services.org;
import club.joylink.rtss.entity.org.OrgProject; import club.joylink.rtss.entity.OrgProject;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
import club.joylink.rtss.vo.LoginUserInfoVO; import club.joylink.rtss.vo.LoginUserInfoVO;
import club.joylink.rtss.vo.client.org.OrgProjectVO; import club.joylink.rtss.vo.client.org.OrgProjectVO;

View File

@ -2,14 +2,9 @@ package club.joylink.rtss.services.org;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.OrgDAO; import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.dao.OrgProjectDAO;
import club.joylink.rtss.dao.OrgUserDAO; import club.joylink.rtss.dao.OrgUserDAO;
import club.joylink.rtss.dao.org.OrgProjectDao; import club.joylink.rtss.entity.*;
import club.joylink.rtss.entity.Org;
import club.joylink.rtss.entity.OrgExample;
import club.joylink.rtss.entity.OrgUser;
import club.joylink.rtss.entity.OrgUserExample;
import club.joylink.rtss.entity.org.OrgProject;
import club.joylink.rtss.entity.org.OrgProjectExample;
import club.joylink.rtss.simulation.cbtc.exception.SimulationException; import club.joylink.rtss.simulation.cbtc.exception.SimulationException;
import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType; import club.joylink.rtss.simulation.cbtc.exception.SimulationExceptionType;
import club.joylink.rtss.vo.AccountVO; import club.joylink.rtss.vo.AccountVO;
@ -33,7 +28,7 @@ import java.util.stream.Collectors;
@Service @Service
public class OrgProjectService implements IOrgProjectService { public class OrgProjectService implements IOrgProjectService {
@Autowired @Autowired
private OrgProjectDao orgProjectDao; private OrgProjectDAO orgProjectDAO;
@Autowired @Autowired
private OrgUserDAO orgUserDAO; private OrgUserDAO orgUserDAO;
@ -49,7 +44,7 @@ public class OrgProjectService implements IOrgProjectService {
public List<OrgProject> queryOrgProjectListByOrgId(Long orgId) { public List<OrgProject> queryOrgProjectListByOrgId(Long orgId) {
OrgProjectExample orgProjectExample = new OrgProjectExample(); OrgProjectExample orgProjectExample = new OrgProjectExample();
orgProjectExample.createCriteria().andOrgIdEqualTo(orgId); orgProjectExample.createCriteria().andOrgIdEqualTo(orgId);
return orgProjectDao.selectByExample(orgProjectExample); return orgProjectDAO.selectByExample(orgProjectExample);
} }
@Override @Override
@ -100,7 +95,7 @@ public class OrgProjectService implements IOrgProjectService {
orgProject.setProjectCode(code); orgProject.setProjectCode(code);
orgProject.setCreateTime(LocalDateTime.now()); orgProject.setCreateTime(LocalDateTime.now());
orgProject.setCreatorId(user.getId()); orgProject.setCreatorId(user.getId());
orgProjectDao.insert(orgProject); orgProjectDAO.insert(orgProject);
}); });
} }
@ -110,16 +105,16 @@ public class OrgProjectService implements IOrgProjectService {
OrgProjectExample orgProjectExample = new OrgProjectExample(); OrgProjectExample orgProjectExample = new OrgProjectExample();
orgProjectExample.createCriteria().andOrgIdEqualTo(orgId); orgProjectExample.createCriteria().andOrgIdEqualTo(orgId);
if (CollectionUtils.isEmpty(projectList)) { // 为空直接删除项目列表 if (CollectionUtils.isEmpty(projectList)) { // 为空直接删除项目列表
orgProjectDao.deleteByExampleSelective(orgProjectExample); orgProjectDAO.deleteByExample(orgProjectExample);
} else { } else {
List<OrgProject> orgProjects = orgProjectDao.selectByExample(orgProjectExample); List<OrgProject> orgProjects = orgProjectDAO.selectByExample(orgProjectExample);
if (checkChange(orgProjects, projectList)) { if (checkChange(orgProjects, projectList)) {
List<String> oldProjectList = orgProjects.stream().map(OrgProject::getProjectCode).collect(Collectors.toList()); List<String> oldProjectList = orgProjects.stream().map(OrgProject::getProjectCode).collect(Collectors.toList());
// 删除不存在的 // 删除不存在的
List<String> delCodeList = oldProjectList.stream().filter(code -> !projectList.contains(code)).collect(Collectors.toList()); List<String> delCodeList = oldProjectList.stream().filter(code -> !projectList.contains(code)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(delCodeList)) { if (!CollectionUtils.isEmpty(delCodeList)) {
orgProjectExample.createCriteria().andOrgIdEqualTo(orgId).andProjectCodeIn(delCodeList); orgProjectExample.createCriteria().andOrgIdEqualTo(orgId).andProjectCodeIn(delCodeList);
orgProjectDao.deleteByExampleSelective(orgProjectExample); orgProjectDAO.deleteByExample(orgProjectExample);
} }
// 插入信息的 // 插入信息的
List<String> newCodeList = projectList.stream().filter(code -> !oldProjectList.contains(code)).collect(Collectors.toList()); List<String> newCodeList = projectList.stream().filter(code -> !oldProjectList.contains(code)).collect(Collectors.toList());
@ -137,7 +132,7 @@ public class OrgProjectService implements IOrgProjectService {
} else { } else {
OrgProjectExample example = new OrgProjectExample(); OrgProjectExample example = new OrgProjectExample();
example.createCriteria().andOrgIdIn(orgIds); example.createCriteria().andOrgIdIn(orgIds);
return orgProjectDao.selectByExample(example); return orgProjectDAO.selectByExample(example);
} }
} }
@ -163,7 +158,7 @@ public class OrgProjectService implements IOrgProjectService {
private List<OrgProject> queryOrgProjectList(String projectCode) { private List<OrgProject> queryOrgProjectList(String projectCode) {
OrgProjectExample orgProjectExample = new OrgProjectExample(); OrgProjectExample orgProjectExample = new OrgProjectExample();
orgProjectExample.createCriteria().andProjectCodeEqualTo(projectCode); orgProjectExample.createCriteria().andProjectCodeEqualTo(projectCode);
return orgProjectDao.selectByExample(orgProjectExample); return orgProjectDAO.selectByExample(orgProjectExample);
} }
/** /**

View File

@ -4,7 +4,6 @@ import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.OrgScoringRuleDAO; import club.joylink.rtss.dao.OrgScoringRuleDAO;
import club.joylink.rtss.dao.OrgScoringRuleRelDAO; import club.joylink.rtss.dao.OrgScoringRuleRelDAO;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.entity.org.OrgProject;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.IExamService; import club.joylink.rtss.services.IExamService;
import club.joylink.rtss.services.ISysUserService; import club.joylink.rtss.services.ISysUserService;

View File

@ -2,11 +2,7 @@ package club.joylink.rtss.services.org;
import club.joylink.rtss.constants.BusinessConsts; import club.joylink.rtss.constants.BusinessConsts;
import club.joylink.rtss.dao.OrgDAO; import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.entity.Org; import club.joylink.rtss.entity.*;
import club.joylink.rtss.entity.OrgExample;
import club.joylink.rtss.entity.OrgUser;
import club.joylink.rtss.entity.SysAccount;
import club.joylink.rtss.entity.org.OrgProject;
import club.joylink.rtss.exception.BusinessExceptionAssertEnum; import club.joylink.rtss.exception.BusinessExceptionAssertEnum;
import club.joylink.rtss.services.ISysUserService; import club.joylink.rtss.services.ISysUserService;
import club.joylink.rtss.services.QRCodeManager; import club.joylink.rtss.services.QRCodeManager;

View File

@ -101,7 +101,7 @@ public class OldPermissionDataSyncService {
for (MapInfo mapInfo : mapInfoList) { for (MapInfo mapInfo : mapInfoList) {
this.generate(mapInfo); this.generate(mapInfo);
}*/ }*/
this.abilityService.autoSynchMapSystemData(0L); this.abilityService.autoSynchMapSystemData(1L);
}catch (Exception e){ }catch (Exception e){
log.error("用户权限初始化失败 msg:" + e.getMessage(),e); log.error("用户权限初始化失败 msg:" + e.getMessage(),e);
ISRUN.compareAndSet(true,false); ISRUN.compareAndSet(true,false);

View File

@ -2,13 +2,11 @@ package club.joylink.rtss.services.project;
import club.joylink.rtss.dao.MapInfoDAO; import club.joylink.rtss.dao.MapInfoDAO;
import club.joylink.rtss.dao.OrgDAO; import club.joylink.rtss.dao.OrgDAO;
import club.joylink.rtss.dao.OrgProjectDAO;
import club.joylink.rtss.dao.RtsMapFunctionDAO; import club.joylink.rtss.dao.RtsMapFunctionDAO;
import club.joylink.rtss.dao.org.OrgProjectDao;
import club.joylink.rtss.dao.project.ProjectDAO; import club.joylink.rtss.dao.project.ProjectDAO;
import club.joylink.rtss.dao.project.ProjectViewDAO; import club.joylink.rtss.dao.project.ProjectViewDAO;
import club.joylink.rtss.entity.*; import club.joylink.rtss.entity.*;
import club.joylink.rtss.entity.org.OrgProject;
import club.joylink.rtss.entity.org.OrgProjectExample;
import club.joylink.rtss.entity.project.Project; import club.joylink.rtss.entity.project.Project;
import club.joylink.rtss.entity.project.ProjectExample; import club.joylink.rtss.entity.project.ProjectExample;
import club.joylink.rtss.entity.project.ProjectView; import club.joylink.rtss.entity.project.ProjectView;
@ -48,7 +46,7 @@ public class ProjectServiceImpl implements ProjectService {
private ProjectViewDAO projectViewDAO; private ProjectViewDAO projectViewDAO;
@Autowired @Autowired
private OrgProjectDao orgProjectDao; private OrgProjectDAO orgProjectDAO;
@Autowired @Autowired
private OrgDAO orgDAO; private OrgDAO orgDAO;
@ -322,7 +320,7 @@ public class ProjectServiceImpl implements ProjectService {
private List<OrgProject> getOrgProjectList(List<String> projectCodeList) { private List<OrgProject> getOrgProjectList(List<String> projectCodeList) {
OrgProjectExample orgProjectExample = new OrgProjectExample(); OrgProjectExample orgProjectExample = new OrgProjectExample();
orgProjectExample.createCriteria().andProjectCodeIn(projectCodeList); orgProjectExample.createCriteria().andProjectCodeIn(projectCodeList);
return orgProjectDao.selectByExample(orgProjectExample); return orgProjectDAO.selectByExample(orgProjectExample);
} }
private List<Org> getOrgList(List<Long> orgIdList) { private List<Org> getOrgList(List<Long> orgIdList) {

View File

@ -1,8 +1,8 @@
package club.joylink.rtss.vo.client.org; package club.joylink.rtss.vo.client.org;
import club.joylink.rtss.entity.Org; import club.joylink.rtss.entity.Org;
import club.joylink.rtss.entity.OrgProject;
import club.joylink.rtss.entity.SysAccount; import club.joylink.rtss.entity.SysAccount;
import club.joylink.rtss.entity.org.OrgProject;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;

View File

@ -1,208 +1,213 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="club.joylink.rtss.dao.org.OrgProjectDao"> <mapper namespace="club.joylink.rtss.dao.OrgProjectDAO">
<resultMap id="BaseResultMap" type="club.joylink.rtss.entity.org.OrgProject"> <resultMap id="BaseResultMap" type="club.joylink.rtss.entity.OrgProject">
<id column="id" property="id" jdbcType="BIGINT"/> <id column="id" jdbcType="BIGINT" property="id" />
<result column="org_id" property="orgId" jdbcType="BIGINT"/> <result column="org_id" jdbcType="BIGINT" property="orgId" />
<result column="project_code" property="projectCode" jdbcType="VARCHAR"/> <result column="project_code" jdbcType="VARCHAR" property="projectCode" />
<result column="creator_id" property="creatorId" jdbcType="BIGINT"/> <result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
<foreach collection="oredCriteria" item="criteria" separator="or"> <foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid"> <if test="criteria.valid">
<trim prefix="(" suffix=")" prefixOverrides="and"> <trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion"> <foreach collection="criteria.criteria" item="criterion">
<choose> <choose>
<when test="criterion.noValue"> <when test="criterion.noValue">
and ${criterion.condition} and ${criterion.condition}
</when> </when>
<when test="criterion.singleValue"> <when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when> </when>
<when test="criterion.listValue"> <when test="criterion.listValue">
and ${criterion.condition} and ${criterion.condition}
<foreach collection="criterion.value" item="listItem" open="(" close=")" <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
separator=","> #{listItem}
#{listItem} </foreach>
</foreach> </when>
</when> </choose>
</choose>
</foreach>
</trim>
</if>
</foreach> </foreach>
</where> </trim>
</sql> </if>
<sql id="Update_By_Example_Where_Clause"> </foreach>
<where> </where>
<foreach collection="example.oredCriteria" item="criteria" separator="or"> </sql>
<if test="criteria.valid"> <sql id="Update_By_Example_Where_Clause">
<trim prefix="(" suffix=")" prefixOverrides="and"> <where>
<foreach collection="criteria.criteria" item="criterion"> <foreach collection="example.oredCriteria" item="criteria" separator="or">
<choose> <if test="criteria.valid">
<when test="criterion.noValue"> <trim prefix="(" prefixOverrides="and" suffix=")">
and ${criterion.condition} <foreach collection="criteria.criteria" item="criterion">
</when> <choose>
<when test="criterion.singleValue"> <when test="criterion.noValue">
and ${criterion.condition} #{criterion.value} and ${criterion.condition}
</when> </when>
<when test="criterion.betweenValue"> <when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition} #{criterion.value}
</when> </when>
<when test="criterion.listValue"> <when test="criterion.betweenValue">
and ${criterion.condition} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
<foreach collection="criterion.value" item="listItem" open="(" close=")" </when>
separator=","> <when test="criterion.listValue">
#{listItem} and ${criterion.condition}
</foreach> <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
</when> #{listItem}
</choose> </foreach>
</foreach> </when>
</trim> </choose>
</if>
</foreach> </foreach>
</where> </trim>
</sql>
<sql id="Base_Column_List">
id, org_id, project_code, creator_id, create_time
</sql>
<select id="selectByExample" resultMap="BaseResultMap"
parameterType="club.joylink.rtss.entity.org.OrgProjectExample">
select
<if test="distinct">
distinct
</if> </if>
'true' as QUERYID, </foreach>
<include refid="Base_Column_List"/> </where>
from rts_org_project </sql>
<if test="_parameter != null"> <sql id="Base_Column_List">
<include refid="Example_Where_Clause"/> id, org_id, project_code, creator_id, create_time
</if> </sql>
<if test="orderByClause != null"> <select id="selectByExample" parameterType="club.joylink.rtss.entity.OrgProjectExample" resultMap="BaseResultMap">
order by ${orderByClause} select
</if> <if test="distinct">
</select> distinct
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> </if>
select <include refid="Base_Column_List" />
<include refid="Base_Column_List"/> from rts_org_project
from rts_org_project <if test="_parameter != null">
where id = #{id,jdbcType=BIGINT} <include refid="Example_Where_Clause" />
</select> </if>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <if test="orderByClause != null">
delete from rts_org_project where id = #{id,jdbcType=BIGINT} order by ${orderByClause}
</delete> </if>
<update id="deleteByExampleSelective" parameterType="map"> <if test="limit != null">
delete from rts_org_project <if test="offset != null">
<if test="_parameter != null"> limit ${offset}, ${limit}
<include refid="Update_By_Example_Where_Clause"/> </if>
</if> <if test="offset == null">
</update> limit ${limit}
<insert id="insert" parameterType="club.joylink.rtss.entity.org.OrgProject" keyProperty="id" </if>
useGeneratedKeys="true" keyColumn="id"> </if>
insert into rts_org_project (org_id, project_code, creator_id, create_time) </select>
values (#{orgId,jdbcType=BIGINT}, #{projectCode,jdbcType=VARCHAR}, <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
#{creatorId,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP}) select
</insert> <include refid="Base_Column_List" />
<insert id="insertSelective" parameterType="club.joylink.rtss.entity.org.OrgProject"> from rts_org_project
insert into rts_org_project where id = #{id,jdbcType=BIGINT}
<trim prefix="(" suffix=")" suffixOverrides=","> </select>
<if test="id != null"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
id, delete from rts_org_project
</if> where id = #{id,jdbcType=BIGINT}
<if test="orgId != null"> </delete>
org_id, <delete id="deleteByExample" parameterType="club.joylink.rtss.entity.OrgProjectExample">
</if> delete from rts_org_project
<if test="projectCode != null"> <if test="_parameter != null">
project_code, <include refid="Example_Where_Clause" />
</if> </if>
<if test="creatorId != null"> </delete>
creator_id, <insert id="insert" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.OrgProject" useGeneratedKeys="true">
</if> insert into rts_org_project (org_id, project_code, creator_id,
<if test="createTime != null"> create_time)
create_time, values (#{orgId,jdbcType=BIGINT}, #{projectCode,jdbcType=VARCHAR}, #{creatorId,jdbcType=BIGINT},
</if> #{createTime,jdbcType=TIMESTAMP})
</trim> </insert>
<trim prefix="values (" suffix=")" suffixOverrides=","> <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="club.joylink.rtss.entity.OrgProject" useGeneratedKeys="true">
<if test="id != null"> insert into rts_org_project
#{id,jdbcType=BIGINT}, <trim prefix="(" suffix=")" suffixOverrides=",">
</if> <if test="orgId != null">
<if test="orgId != null"> org_id,
#{orgId,jdbcType=BIGINT}, </if>
</if> <if test="projectCode != null">
<if test="projectCode != null"> project_code,
#{projectCode,jdbcType=VARCHAR}, </if>
</if> <if test="creatorId != null">
<if test="creatorId != null"> creator_id,
#{creatorId,jdbcType=BIGINT}, </if>
</if> <if test="createTime != null">
<if test="createTime != null"> create_time,
#{createTime,jdbcType=TIMESTAMP}, </if>
</if> </trim>
</trim> <trim prefix="values (" suffix=")" suffixOverrides=",">
</insert> <if test="orgId != null">
<update id="updateByExampleSelective" parameterType="map"> #{orgId,jdbcType=BIGINT},
update rts_org_project </if>
<set> <if test="projectCode != null">
<if test="record.id != null"> #{projectCode,jdbcType=VARCHAR},
id = #{record.id,jdbcType=BIGINT}, </if>
</if> <if test="creatorId != null">
<if test="record.orgId != null"> #{creatorId,jdbcType=BIGINT},
org_id = #{record.orgId,jdbcType=BIGINT}, </if>
</if> <if test="createTime != null">
<if test="record.projectCode != null"> #{createTime,jdbcType=TIMESTAMP},
project_code = #{record.projectCode,jdbcType=VARCHAR}, </if>
</if> </trim>
<if test="record.creatorId != null"> </insert>
creator_id = #{record.creatorId,jdbcType=BIGINT}, <select id="countByExample" parameterType="club.joylink.rtss.entity.OrgProjectExample" resultType="java.lang.Long">
</if> select count(*) from rts_org_project
<if test="record.createTime != null"> <if test="_parameter != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP}, <include refid="Example_Where_Clause" />
</if> </if>
</set> </select>
<if test="_parameter != null"> <update id="updateByExampleSelective" parameterType="map">
<include refid="Update_By_Example_Where_Clause"/> update rts_org_project
</if> <set>
</update> <if test="record.id != null">
<update id="updateByExample" parameterType="map"> id = #{record.id,jdbcType=BIGINT},
update rts_org_project </if>
set id = #{record.id,jdbcType=BIGINT}, <if test="record.orgId != null">
org_id = #{record.orgId,jdbcType=BIGINT}, org_id = #{record.orgId,jdbcType=BIGINT},
</if>
<if test="record.projectCode != null">
project_code = #{record.projectCode,jdbcType=VARCHAR}, project_code = #{record.projectCode,jdbcType=VARCHAR},
</if>
<if test="record.creatorId != null">
creator_id = #{record.creatorId,jdbcType=BIGINT}, creator_id = #{record.creatorId,jdbcType=BIGINT},
create_time = #{record.createTime,jdbcType=TIMESTAMP} </if>
<if test="_parameter != null"> <if test="record.createTime != null">
<include refid="Update_By_Example_Where_Clause"/> create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if> </if>
</update> </set>
<update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.org.OrgProject"> <if test="_parameter != null">
update rts_org_project <include refid="Update_By_Example_Where_Clause" />
<set> </if>
<if test="orgId != null"> </update>
org_id = #{orgId,jdbcType=BIGINT}, <update id="updateByExample" parameterType="map">
</if> update rts_org_project
<if test="projectCode != null"> set id = #{record.id,jdbcType=BIGINT},
project_code = #{projectCode,jdbcType=VARCHAR}, org_id = #{record.orgId,jdbcType=BIGINT},
</if> project_code = #{record.projectCode,jdbcType=VARCHAR},
<if test="creatorId != null"> creator_id = #{record.creatorId,jdbcType=BIGINT},
creator_id = #{creatorId,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=TIMESTAMP}
</if> <if test="_parameter != null">
<if test="createTime != null"> <include refid="Update_By_Example_Where_Clause" />
create_time = #{createTime,jdbcType=TIMESTAMP}, </if>
</if> </update>
</set> <update id="updateByPrimaryKeySelective" parameterType="club.joylink.rtss.entity.OrgProject">
where id = #{id,jdbcType=BIGINT} update rts_org_project
</update> <set>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.org.OrgProject"> <if test="orgId != null">
update rts_org_project org_id = #{orgId,jdbcType=BIGINT},
set org_id = #{orgId,jdbcType=BIGINT}, </if>
<if test="projectCode != null">
project_code = #{projectCode,jdbcType=VARCHAR}, project_code = #{projectCode,jdbcType=VARCHAR},
</if>
<if test="creatorId != null">
creator_id = #{creatorId,jdbcType=BIGINT}, creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP} </if>
where id = #{id,jdbcType=BIGINT} <if test="createTime != null">
</update> create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="club.joylink.rtss.entity.OrgProject">
update rts_org_project
set org_id = #{orgId,jdbcType=BIGINT},
project_code = #{projectCode,jdbcType=VARCHAR},
creator_id = #{creatorId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper> </mapper>