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> {
@Update("update b_arrange set del_flag = 1 where business_id = #{0}")
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;
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.bslschedule.dao.BSlScheduleRepository;
import org.rcisoft.business.bslschedule.entity.BSlSchedule;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.Result;
......@@ -39,6 +42,11 @@ public class BRoomsServiceImpl implements BRoomsService {
@Autowired
private BRoomsRepository bRoomsRepository;
@Autowired
private BSlScheduleRepository bSlScheduleRepository;
@Autowired
private BArrangeRepository bArrangeRepository;
/**
* 保存 bRooms
......@@ -70,6 +78,10 @@ public class BRoomsServiceImpl implements BRoomsService {
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel remove(BRooms bRooms){
if(bArrangeRepository.countThisRoomNum(bRooms.getBusinessId()) != 0
|| bSlScheduleRepository.countThisRoomNum(bRooms.getBusinessId()) != 0){
throw new ServiceException(ResultServiceEnums.ROOM_HAS_USED);
}else{
UserUtil.setCurrentMergeOperation(bRooms);
bRooms.setDeleted();
int line = bRoomsRepository.logicalDelete(bRooms);
......@@ -77,6 +89,7 @@ public class BRoomsServiceImpl implements BRoomsService {
bRooms.getBusinessId()+"的信息");
return new PersistModel(line);
}
}
/**
* 修改 bRooms
......@@ -135,6 +148,17 @@ public class BRoomsServiceImpl implements BRoomsService {
result += "编号 " + value[1] + " 在表中重复 ";
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();
String classroomName = "";
if(value[0].equals("校本部")){
......@@ -179,13 +203,18 @@ public class BRoomsServiceImpl implements BRoomsService {
currentlyCode.add(value[1]);
list.add(bRooms);
}
int flag = 1;
if(!result.equals("")){
flag = 0;
}
if(list.size() != 0){
int i = bRoomsRepository.addExcel(list);
result += "成功插入了 " + i + "条数据";
}else {
result += "没有输入被插入";
}
return new PersistModel(1, result);
return new PersistModel(flag, result);
}
}
......@@ -51,5 +51,8 @@ public interface BSlScheduleRepository extends BaseMapper<BSlSchedule> {
int updateStatusBySubAgencyId(@Param("subAgencyId") String subAgencyId, @Param("status") String status);
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 {
EXISE_ROOM_CODE(96,"此教室编号已存在,添加失败"),
CURRENT_TERM(97,"当前学期不可删除"),
ROOM_HAS_USED(98,"当前教室正在被使用,不可删除"),
;
private Integer code;
......
......@@ -3,7 +3,6 @@ package org.rcisoft.sys.role.service.impl;
import lombok.extern.slf4j.Slf4j;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.DelStatus;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
......@@ -74,12 +73,8 @@ public class SysRoleServiceImpl implements SysRoleService {
//删除该角色所有的关联信息
sysRoleRepository.deleteRoleMenuByRoleId(id);
sysRoleRepository.deleteUserRoleByRoleId(id);
SysRole sysRole = sysRoleRepository.selectByPrimaryKey(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()+"的角色信息");
int line = sysRoleRepository.deleteByPrimaryKey(id);
log.info(UserUtil.getUserInfoProp(token,UserUtil.USER_USERNAME)+"删除了ID为"+ id+"的角色信息");
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