Commit c46adda4 authored by hanshuai's avatar hanshuai

Merge branch 'V2.0.3' of ssh://103.249.252.28:10022/lcy/education

# Conflicts:
#	src/main/java/org/rcisoft/business/barrange/service/impl/BArrangeServiceImpl.java
parents b8e1b9d1 3856c8c6
...@@ -109,7 +109,7 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -109,7 +109,7 @@ public class BArrangeServiceImpl implements BArrangeService {
* @param json * @param json
* @return * @return
*/ */
// @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override @Override
public PersistModel save(String json){ public PersistModel save(String json){
BArrange bArrange = new BArrange(); BArrange bArrange = new BArrange();
...@@ -123,6 +123,9 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -123,6 +123,9 @@ public class BArrangeServiceImpl implements BArrangeService {
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR); throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
} }
bArrange.setDescription(arrange.getString("desc")); bArrange.setDescription(arrange.getString("desc"));
if (arrange.getString("termCode").equals("")){
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
}
bArrange.setTermCode(arrange.getString("termCode")); bArrange.setTermCode(arrange.getString("termCode"));
bArrange.setStatus("0"); bArrange.setStatus("0");
UserUtil.setCurrentPersistOperation(bArrange); UserUtil.setCurrentPersistOperation(bArrange);
...@@ -135,6 +138,9 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -135,6 +138,9 @@ public class BArrangeServiceImpl implements BArrangeService {
JSONObject subtask = childList.getJSONObject(i); JSONObject subtask = childList.getJSONObject(i);
BSubtask bSubtask = new BSubtask(); BSubtask bSubtask = new BSubtask();
List<BSubAgency> bSubAgencyList = new ArrayList<>(); List<BSubAgency> bSubAgencyList = new ArrayList<>();
if (subtask.getString("name").equals("")){
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
}
if(subtask.getString("name").length()>256){ if(subtask.getString("name").length()>256){
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR); throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
} }
...@@ -148,13 +154,19 @@ public class BArrangeServiceImpl implements BArrangeService { ...@@ -148,13 +154,19 @@ public class BArrangeServiceImpl implements BArrangeService {
for(int j = 0; j < childList2.size() ; j++){ for(int j = 0; j < childList2.size() ; j++){
JSONObject agency = childList2.getJSONObject(j); JSONObject agency = childList2.getJSONObject(j);
BSubAgency bSubAgency = new BSubAgency(); BSubAgency bSubAgency = new BSubAgency();
bSubAgency.setAgencyCode(agency.getString("agencyCode")); if (agency.get("agencyCode") != null && !agency.get("agencyCode").equals("")){
bSubAgency.setStatus("0"); bSubAgency.setAgencyCode(agency.getString("agencyCode"));
bSubAgency.setSubtaskId(bSubtask.getBusinessId()); bSubAgency.setStatus("0");
UserUtil.setCurrentPersistOperation(bSubAgency); bSubAgency.setSubtaskId(bSubtask.getBusinessId());
bSubAgencyList.add(bSubAgency); UserUtil.setCurrentPersistOperation(bSubAgency);
bSubAgencyRepository.insertSelective(bSubAgency);
// bSubAgencyList.add(bSubAgency);
}
else {
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
}
} }
bArrangeRepository.insertBSubAgency(bSubAgencyList); // bArrangeRepository.insertBSubAgency(bSubAgencyList);
} }
bArrangeRepository.insertBSubtask(subtaskList); bArrangeRepository.insertBSubtask(subtaskList);
return new PersistModel(line); return new PersistModel(line);
......
...@@ -77,7 +77,7 @@ public class BClassServiceImpl implements BClassService { ...@@ -77,7 +77,7 @@ public class BClassServiceImpl implements BClassService {
@Override @Override
public PersistModel removeBClass(String id) { public PersistModel removeBClass(String id) {
if(brClassStudentRepository.selectStuentNumByClassId(id)>0) { if(brClassStudentRepository.selectStuentNumByClassId(id)>0) {
throw new ServiceException(ResultServiceEnums.CLASS_HAS_STUDENTS); throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
} }
int line = bClassRepository.deleteByPrimaryKey(id); int line = bClassRepository.deleteByPrimaryKey(id);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
......
...@@ -68,7 +68,7 @@ public class BRoomsController extends FileController<BRooms> { ...@@ -68,7 +68,7 @@ public class BRoomsController extends FileController<BRooms> {
bRooms); bRooms);
} }
@ApiOperation(value="逻辑删除", notes="逻辑删除") @ApiOperation(value="物理删除", notes="物理删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "varchar")}) @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{id:\\w+}") @DeleteMapping("/delete/{id:\\w+}")
public Result delete(@PathVariable String id) { public Result delete(@PathVariable String id) {
......
...@@ -62,7 +62,7 @@ public class BRoomsServiceImpl implements BRoomsService { ...@@ -62,7 +62,7 @@ public class BRoomsServiceImpl implements BRoomsService {
} }
/** /**
* 逻辑删除 * 物理删除
* @param bRooms * @param bRooms
* @return * @return
*/ */
...@@ -71,10 +71,10 @@ public class BRoomsServiceImpl implements BRoomsService { ...@@ -71,10 +71,10 @@ public class BRoomsServiceImpl implements BRoomsService {
public PersistModel remove(BRooms bRooms){ public PersistModel remove(BRooms bRooms){
if(bArrangeRepository.countThisRoomNum(bRooms.getBusinessId()) != 0 if(bArrangeRepository.countThisRoomNum(bRooms.getBusinessId()) != 0
|| bSlScheduleRepository.countThisRoomNum(bRooms.getBusinessId()) != 0){ || bSlScheduleRepository.countThisRoomNum(bRooms.getBusinessId()) != 0){
throw new ServiceException(ResultServiceEnums.ROOM_HAS_USED); throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
}else{ }else{
int line = bRoomsRepository.deleteByPrimaryKey(bRooms.getBusinessId()); int line = bRoomsRepository.deleteByPrimaryKey(bRooms.getBusinessId());
log.info(UserUtil.getUserInfoProp(bRooms.getToken(),UserUtil.USER_USERNAME)+"逻辑删除了ID为"+ log.info(UserUtil.getUserInfoProp(bRooms.getToken(),UserUtil.USER_USERNAME)+"物理删除了ID为"+
bRooms.getBusinessId()+"的信息"); bRooms.getBusinessId()+"的信息");
return new PersistModel(line); return new PersistModel(line);
} }
......
...@@ -122,7 +122,7 @@ public class BStudentController extends PaginationController<BStudent> { ...@@ -122,7 +122,7 @@ public class BStudentController extends PaginationController<BStudent> {
} }
@ApiOperation(value="逻辑删除", notes="根据ID删除一条记录") @ApiOperation(value="物理删除", notes="根据ID删除一条记录")
@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar") @ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
@PostMapping(value = "/remove") @PostMapping(value = "/remove")
......
...@@ -259,7 +259,7 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -259,7 +259,7 @@ public class BStudentServiceImpl implements BStudentService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel removeBBStudent(String id) { public PersistModel removeBBStudent(String id) {
if(brSlStudentRepository.selectSlNumByStuId(id)>0) { if(brSlStudentRepository.selectSlNumByStuId(id)>0) {
throw new ServiceException(ResultServiceEnums.STUDENT_HAS_SL); throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
} }
BStudent bStudent = new BStudent(); BStudent bStudent = new BStudent();
bStudent.setBusinessId(id); bStudent.setBusinessId(id);
...@@ -268,7 +268,7 @@ public class BStudentServiceImpl implements BStudentService { ...@@ -268,7 +268,7 @@ public class BStudentServiceImpl implements BStudentService {
bStudent.setDeleted(); bStudent.setDeleted();
UserUtil.setCurrentMergeOperation(bStudent); UserUtil.setCurrentMergeOperation(bStudent);
int line = bStudentRepository.logicalDelete(bStudent); int line = bStudentRepository.deleteByPrimaryKey(bStudent);
brClassStudentRepository.deleteCSByStuId(student.getCode()); brClassStudentRepository.deleteCSByStuId(student.getCode());
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
......
...@@ -63,7 +63,7 @@ public class BTeacherController extends PaginationController<BTeacher> { ...@@ -63,7 +63,7 @@ public class BTeacherController extends PaginationController<BTeacher> {
bTeacher); bTeacher);
} }
@ApiOperation(value="逻辑删除", notes="根据ID删除一条记录") @ApiOperation(value="物理删除", notes="根据ID删除一条记录")
@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar") @ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar")
@PreAuthorize("hasRole('ROLE_1001')") @PreAuthorize("hasRole('ROLE_1001')")
@PostMapping(value = "/remove") @PostMapping(value = "/remove")
......
...@@ -215,15 +215,15 @@ public class BTeacherServiceImpl implements BTeacherService { ...@@ -215,15 +215,15 @@ public class BTeacherServiceImpl implements BTeacherService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false) @Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel removeBTeacher(String id) { public PersistModel removeBTeacher(String id) {
if(bSlRepository.selectSlNumByStuent(id)>0) { if(bSlRepository.selectSlNumByStuent(id)>0) {
throw new ServiceException(ResultServiceEnums.TEACHER_HAS_SL); throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
} }
BTeacher bTeacher = new BTeacher(); BTeacher bTeacher = new BTeacher();
bTeacher.setBusinessId(id); bTeacher.setBusinessId(id);
BTeacher teacher = bTeacherRepository.selectOne(bTeacher); BTeacher teacher = bTeacherRepository.selectOne(bTeacher);
UserUtil.setCurrentMergeOperation(bTeacher); UserUtil.setCurrentMergeOperation(bTeacher);
sysUserMapper.deleteByCode(teacher.getCode()); sysUserMapper.deleteByCode(teacher.getCode());
bTeacher.setDeleted(); // bTeacher.setDeleted();
int line = bTeacherRepository.logicalDelete(bTeacher); int line = bTeacherRepository.deleteByPrimaryKey(bTeacher);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS); return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
} }
......
...@@ -183,6 +183,8 @@ public enum ResultServiceEnums { ...@@ -183,6 +183,8 @@ public enum ResultServiceEnums {
CURRENT_TERM(97,"当前学期不可删除"), CURRENT_TERM(97,"当前学期不可删除"),
ROOM_HAS_USED(98,"当前教室正在被使用,不可删除"), ROOM_HAS_USED(98,"当前教室正在被使用,不可删除"),
DATA_HAS_USED(100,"当前数据被使用,不可删除"),
; ;
private Integer code; private Integer code;
......
...@@ -68,7 +68,7 @@ public class SysRoleServiceImpl implements SysRoleService { ...@@ -68,7 +68,7 @@ public class SysRoleServiceImpl implements SysRoleService {
int userCount = sysUserMapper.countUserByRole(id); int userCount = sysUserMapper.countUserByRole(id);
//如果仍然有用户(如果用户被逻辑删除,则忽略此角色,但如果用于被停用,则依然被计算)是此角色,则该角色不可删除 //如果仍然有用户(如果用户被逻辑删除,则忽略此角色,但如果用于被停用,则依然被计算)是此角色,则该角色不可删除
if(userCount > 0){ if(userCount > 0){
throw new ServiceException(ResultServiceEnums.ROLE_HAS_USER); throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
}else{ }else{
//删除该角色所有的关联信息 //删除该角色所有的关联信息
sysRoleRepository.deleteRoleMenuByRoleId(id); sysRoleRepository.deleteRoleMenuByRoleId(id);
......
...@@ -81,7 +81,7 @@ public class SysUserServiceImpl implements SysUserService { ...@@ -81,7 +81,7 @@ public class SysUserServiceImpl implements SysUserService {
user.setDeleted(); user.setDeleted();
user.setStop(); user.setStop();
user.setBusinessId(id); user.setBusinessId(id);
return sysUserMapper.logicalDelete(user); return sysUserMapper.deleteByPrimaryKey(user);
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment