Commit daa195a0 authored by YangZhaoJun1's avatar YangZhaoJun1

Merge branch 'V2.0.3' of http://103.249.252.28:90/lcy/education into V2.0.3

parents 6db006ee 9a97ed2e
...@@ -149,5 +149,7 @@ public interface BArrangeRepository extends BaseMapper<BArrange> { ...@@ -149,5 +149,7 @@ public interface BArrangeRepository extends BaseMapper<BArrange> {
@Update("update b_arrange set del_flag = 1 where business_id = #{0}") @Update("update b_arrange set del_flag = 1 where business_id = #{0}")
int deleteArrange(String businessId); int deleteArrange(String businessId);
@Select("select count(*) from b_schedule_dto where room_code = ( select `code` from b_rooms where business_id = #{businessId})")
int countThisRoomNum(String businessId);
} }
package org.rcisoft.business.brooms.service.impl; package org.rcisoft.business.brooms.service.impl;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.rcisoft.business.barrange.dao.BArrangeRepository;
import org.rcisoft.business.brooms.utils.Upload2DataBase; import org.rcisoft.business.brooms.utils.Upload2DataBase;
import org.rcisoft.business.bslschedule.dao.BSlScheduleRepository;
import org.rcisoft.business.bslschedule.entity.BSlSchedule;
import org.rcisoft.core.constant.MessageConstant; import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.Result; import org.rcisoft.core.result.Result;
...@@ -39,6 +42,11 @@ public class BRoomsServiceImpl implements BRoomsService { ...@@ -39,6 +42,11 @@ public class BRoomsServiceImpl implements BRoomsService {
@Autowired @Autowired
private BRoomsRepository bRoomsRepository; private BRoomsRepository bRoomsRepository;
@Autowired
private BSlScheduleRepository bSlScheduleRepository;
@Autowired
private BArrangeRepository bArrangeRepository;
/** /**
* 保存 bRooms * 保存 bRooms
...@@ -70,12 +78,17 @@ public class BRoomsServiceImpl implements BRoomsService { ...@@ -70,12 +78,17 @@ public class BRoomsServiceImpl implements BRoomsService {
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override @Override
public PersistModel remove(BRooms bRooms){ public PersistModel remove(BRooms bRooms){
UserUtil.setCurrentMergeOperation(bRooms); if(bArrangeRepository.countThisRoomNum(bRooms.getBusinessId()) != 0
bRooms.setDeleted(); || bSlScheduleRepository.countThisRoomNum(bRooms.getBusinessId()) != 0){
int line = bRoomsRepository.logicalDelete(bRooms); throw new ServiceException(ResultServiceEnums.ROOM_HAS_USED);
log.info(UserUtil.getUserInfoProp(bRooms.getToken(),UserUtil.USER_USERNAME)+"逻辑删除了ID为"+ }else{
bRooms.getBusinessId()+"的信息"); UserUtil.setCurrentMergeOperation(bRooms);
return new PersistModel(line); bRooms.setDeleted();
int line = bRoomsRepository.logicalDelete(bRooms);
log.info(UserUtil.getUserInfoProp(bRooms.getToken(),UserUtil.USER_USERNAME)+"逻辑删除了ID为"+
bRooms.getBusinessId()+"的信息");
return new PersistModel(line);
}
} }
/** /**
...@@ -135,6 +148,17 @@ public class BRoomsServiceImpl implements BRoomsService { ...@@ -135,6 +148,17 @@ public class BRoomsServiceImpl implements BRoomsService {
result += "编号 " + value[1] + " 在表中重复 "; result += "编号 " + value[1] + " 在表中重复 ";
continue; continue;
} }
//Int最大值为2147483648,所以不能超过9位数
if(value[5].length() >= 9){
result += "编号 " + value[1] + " 的数据座位数不合法 ";
continue;
}
try{
int seat = Integer.valueOf(value[5]);
}catch (Exception e){
result += "编号 " + value[1] + " 的数据座位数不合法 ";
continue;
}
BRooms bRooms = new BRooms(); BRooms bRooms = new BRooms();
String classroomName = ""; String classroomName = "";
if(value[0].equals("校本部")){ if(value[0].equals("校本部")){
...@@ -179,13 +203,18 @@ public class BRoomsServiceImpl implements BRoomsService { ...@@ -179,13 +203,18 @@ public class BRoomsServiceImpl implements BRoomsService {
currentlyCode.add(value[1]); currentlyCode.add(value[1]);
list.add(bRooms); list.add(bRooms);
} }
int flag = 1;
if(!result.equals("")){
flag = 0;
}
if(list.size() != 0){ if(list.size() != 0){
int i = bRoomsRepository.addExcel(list); int i = bRoomsRepository.addExcel(list);
result += "成功插入了 " + i + "条数据"; result += "成功插入了 " + i + "条数据";
}else { }else {
result += "没有输入被插入"; result += "没有输入被插入";
} }
return new PersistModel(1, result);
return new PersistModel(flag, result);
} }
} }
...@@ -51,5 +51,8 @@ public interface BSlScheduleRepository extends BaseMapper<BSlSchedule> { ...@@ -51,5 +51,8 @@ public interface BSlScheduleRepository extends BaseMapper<BSlSchedule> {
int updateStatusBySubAgencyId(@Param("subAgencyId") String subAgencyId, @Param("status") String status); int updateStatusBySubAgencyId(@Param("subAgencyId") String subAgencyId, @Param("status") String status);
int countStudentNum(String classesId); int countStudentNum(String classesId);
@Select("select count(*) from b_sl_schedule where room_code = ( select `code` from b_rooms where business_id = #{businessId})")
int countThisRoomNum(String businessId);
} }
...@@ -181,6 +181,8 @@ public enum ResultServiceEnums { ...@@ -181,6 +181,8 @@ public enum ResultServiceEnums {
EXISE_ROOM_CODE(96,"此教室编号已存在,添加失败"), EXISE_ROOM_CODE(96,"此教室编号已存在,添加失败"),
CURRENT_TERM(97,"当前学期不可删除"), CURRENT_TERM(97,"当前学期不可删除"),
ROOM_HAS_USED(98,"当前教室正在被使用,不可删除"),
; ;
private Integer code; private Integer code;
......
...@@ -3,7 +3,6 @@ package org.rcisoft.sys.role.service.impl; ...@@ -3,7 +3,6 @@ package org.rcisoft.sys.role.service.impl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.DelStatus;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
...@@ -74,12 +73,8 @@ public class SysRoleServiceImpl implements SysRoleService { ...@@ -74,12 +73,8 @@ public class SysRoleServiceImpl implements SysRoleService {
//删除该角色所有的关联信息 //删除该角色所有的关联信息
sysRoleRepository.deleteRoleMenuByRoleId(id); sysRoleRepository.deleteRoleMenuByRoleId(id);
sysRoleRepository.deleteUserRoleByRoleId(id); sysRoleRepository.deleteUserRoleByRoleId(id);
int line = sysRoleRepository.deleteByPrimaryKey(id);
SysRole sysRole = sysRoleRepository.selectByPrimaryKey(id); log.info(UserUtil.getUserInfoProp(token,UserUtil.USER_USERNAME)+"删除了ID为"+ id+"的角色信息");
sysRole.setDelFlag(DelStatus.DELETED.getStatus());
UserUtil.setCurrentMergeOperation(sysRole);
int line = sysRoleRepository.updateByPrimaryKeySelective(sysRole);
log.info(UserUtil.getUserInfoProp(token,UserUtil.USER_USERNAME)+"删除了ID为"+ sysRole.getBusinessId()+"的角色信息");
return line; return line;
} }
} }
......
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