Commit 091d0933 authored by 李博今's avatar 李博今

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

# Conflicts:
#	sql/edu_update.sql
parents 3f96a75b 775e3eb2
......@@ -94,4 +94,8 @@ ALTER TABLE `s_user`
ALTER TABLE `b_schedule_dto`
ADD COLUMN `sunday` varchar(64) NULL AFTER `sub_agency_id`;
/*意见表新增sub_agency_id,与开课id进行区分*/
ALTER TABLE `b_opinion`
ADD COLUMN `sub_agency_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '子任务下教学单位id' AFTER `flag`;
......@@ -40,10 +40,10 @@ public interface BArrangeRepository extends BaseMapper<BArrange> {
//维护人员查看全部的排课信息----------------------------------------------------------------------------------------
@Select("<script>select b_arrange.*,b_term.name from b_arrange left join b_term on b_term.code = b_arrange.term_code where 1=1 "
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "<if test=\"delFlag !=null and delFlag != '' \">and b_arrange.del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and b_arrange.flag = #{flag} </if> "
+ "<if test=\"termCode !=null and termCode != '' \">and term_code = #{termCode} </if> "
+ "<if test=\"status !=null and status != '' \">and status = #{status} </if> "
+ "<if test=\"status !=null and status != '' \">and b_arrange.status = #{status} </if> "
+ "order by b_arrange.status,b_arrange.create_date desc"
+ "</script>")
@ResultMap(value = "BaseResultMap2")
......@@ -53,7 +53,7 @@ public interface BArrangeRepository extends BaseMapper<BArrange> {
@Select("<script>select name,business_id,status from b_subtask where 1=1 "
+ "and del_flag = 0 "
+ "and flag = 1 "
+ "and arrange_id = #{businessId} GROUP BY name"
+ "and arrange_id = #{businessId} GROUP BY name order by create_date desc"
+ "</script>")
@ResultMap(value = "bSubtaskResultMap")
List<BSubtask> queryBSubtask(String businessId);
......
......@@ -30,11 +30,12 @@ public class BArrange extends IdEntity<BArrange> {
private String termCode;
/*描述*/
@Length(min = 1,max = 255,message = "长度最小为1,最大为250")
private String description;
/*状态*/
@Length(min = 1,max = 64,message = "长度为1")
@NotBlank
// @Length(min = 1,max = 2,message = "长度最小为1,最大为2")
// @NotBlank
private String status;
@Transient
......
......@@ -2,6 +2,8 @@ package org.rcisoft.business.barrange.entity;
import lombok.*;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
import java.math.BigDecimal;
......@@ -24,6 +26,8 @@ public class BSubtask extends IdEntity<BSubtask> {
private String arrangeId;
@Length(min = 1 , max = 256 ,message = "长度最小为1,最大为250")
@NotBlank
private String name;
/**
......
......@@ -109,7 +109,7 @@ public class BArrangeServiceImpl implements BArrangeService {
* @param json
* @return
*/
// @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel save(String json){
BArrange bArrange = new BArrange();
......@@ -119,7 +119,13 @@ public class BArrangeServiceImpl implements BArrangeService {
// if (arrange.isEmpty()){
// throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
// }
if(arrange.getString("desc").length()>255){
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
}
bArrange.setDescription(arrange.getString("desc"));
if (arrange.getString("termCode").equals("")){
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
}
bArrange.setTermCode(arrange.getString("termCode"));
bArrange.setStatus("0");
UserUtil.setCurrentPersistOperation(bArrange);
......@@ -132,6 +138,9 @@ public class BArrangeServiceImpl implements BArrangeService {
JSONObject subtask = childList.getJSONObject(i);
BSubtask bSubtask = new BSubtask();
List<BSubAgency> bSubAgencyList = new ArrayList<>();
if (subtask.getString("name").equals("") ||subtask.getString("name").length()>256){
throw new ServiceException(ResultServiceEnums.PARAMETER_ERROR);
}
bSubtask.setName(subtask.getString("name"));
bSubtask.setArrangeId(bArrange.getBusinessId());
bSubtask.setStatus("0");
......@@ -142,13 +151,19 @@ public class BArrangeServiceImpl implements BArrangeService {
for(int j = 0; j < childList2.size() ; j++){
JSONObject agency = childList2.getJSONObject(j);
BSubAgency bSubAgency = new BSubAgency();
bSubAgency.setAgencyCode(agency.getString("agencyCode"));
bSubAgency.setStatus("0");
bSubAgency.setSubtaskId(bSubtask.getBusinessId());
UserUtil.setCurrentPersistOperation(bSubAgency);
bSubAgencyList.add(bSubAgency);
if (agency.get("agencyCode") != null && !agency.get("agencyCode").equals("")){
bSubAgency.setAgencyCode(agency.getString("agencyCode"));
bSubAgency.setStatus("0");
bSubAgency.setSubtaskId(bSubtask.getBusinessId());
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);
return new PersistModel(line);
......@@ -215,6 +230,8 @@ public class BArrangeServiceImpl implements BArrangeService {
*/
@Override
public List<BArrange> findAllByPagination(PageUtil paginationUtility, BArrange bArrange){
bArrange.setNotDeleted();
bArrange.setStart();
List<BArrange> list = bArrangeRepository.queryAll(bArrange);
return list;
}
......@@ -228,6 +245,8 @@ public class BArrangeServiceImpl implements BArrangeService {
else {
bArrange.setStatus("1,2,3,4");
}
bArrange.setStart();
bArrange.setNotDeleted();
return bArrangeRepository.queryByAgencyCode(bArrange);
}
......
......@@ -77,7 +77,7 @@ public class BClassServiceImpl implements BClassService {
@Override
public PersistModel removeBClass(String id) {
if(brClassStudentRepository.selectStuentNumByClassId(id)>0) {
throw new ServiceException(ResultServiceEnums.CLASS_HAS_STUDENTS);
throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
}
int line = bClassRepository.deleteByPrimaryKey(id);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
......@@ -143,7 +143,7 @@ public class BClassServiceImpl implements BClassService {
ArrayList<BClass> bClasses = new ArrayList<BClass>();
ArrayList<String> repeatCode = new ArrayList<String>();
String[] headers = {"班级编号","班级名称","所属年级"};
String[] headers = {"班级编号","学号","所属年级"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据
//判断年级是否存在
List<String> valuesGrade = new ArrayList<>();
......
......@@ -40,7 +40,7 @@ public interface BOpinionRepository extends BaseMapper<BOpinion> {
@Select("select b_opinion.*,s_user.name as create_person from b_opinion left join s_user on b_opinion.create_by = s_user.business_id " +
"where sub_agency_id = #{subAgencyId} order by create_date DESC")
"where b_opinion.sub_agency_id = #{subAgencyId} order by create_date DESC")
@ResultMap(value = "BaseResultMap")
List<BOpinion> queryOpinionBySubAgencyId(String subAgencyId);
......
......@@ -55,12 +55,25 @@ public class BRClassStudentController extends PaginationController<BRClassStuden
stuCode);
}
@ApiOperation(value="excel导入", notes="excel导入")
@ApiOperation(value="行政班excel导入", notes="行政班excel导入")
@ApiImplicitParam(name = "importFile", value = "excel文件", required = true, dataType = "MultipartFile")
@PreAuthorize("hasRole('ROLE_1001')")
@PostMapping(value = "excelImport")
public Result excelImport(MultipartFile importFile) throws Exception {
PersistModel data = bRClassStudentService.importExcel(MultipartFile2HSSFWorkbookConverter.convert(importFile));
@PostMapping(value = "administrationExcelImport")
public Result administrationExcelImport(MultipartFile importFile) throws Exception {
PersistModel data = bRClassStudentService.administrationExcelImport(MultipartFile2HSSFWorkbookConverter.convert(importFile));
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
data.getInfluenceReason());
}
@ApiOperation(value="企业班excel导入", notes="企业班excel导入")
@ApiImplicitParam(name = "importFile", value = "excel文件", required = true, dataType = "MultipartFile")
@PreAuthorize("hasRole('ROLE_1001')")
@PostMapping(value = "enterpriseExcelImport")
public Result enterpriseExcelImport(MultipartFile importFile) throws Exception {
PersistModel data = bRClassStudentService.enterpriseExcelImport(MultipartFile2HSSFWorkbookConverter.convert(importFile));
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
......
......@@ -47,11 +47,13 @@ public interface BRClassStudentService{
* @param hwb
* @return
*/
PersistModel importExcel(HSSFWorkbook hwb) throws IOException;
PersistModel administrationExcelImport(HSSFWorkbook hwb) throws IOException;
/**
* 物理删除
* @return
*/
PersistModel removeBRClassStudents(String stuCode, String classCode);
PersistModel enterpriseExcelImport(HSSFWorkbook convert);
}
......@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.rcisoft.business.bagency.dao.BAgencyRepository;
import org.rcisoft.business.bagency.entity.BAgency;
import org.rcisoft.business.bclass.dao.BClassRepository;
import org.rcisoft.business.bclass.entity.BClass;
import org.rcisoft.business.brclassstudent.dao.BRClassStudentRepository;
......@@ -40,6 +42,8 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
private BClassRepository bClassRepository;
@Autowired
private BStudentRepository bStudentRepository;
@Autowired
private BAgencyRepository bAgencyRepository;
@Override
public BRClassStudent selectOne(String businessId){
......@@ -76,13 +80,14 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel importExcel(HSSFWorkbook hwb) throws IOException {
public PersistModel administrationExcelImport(HSSFWorkbook hwb) throws IOException {
ArrayList<BRClassStudent> brClassStudents = new ArrayList<BRClassStudent>();
ArrayList<String> studentCode = new ArrayList<String>();
ArrayList<String> classCode = new ArrayList<String>();
ArrayList<String> repeatCode = new ArrayList<String>();
List<String> valuesGrade = new ArrayList<>();
String[] headers = {"班级编号","学号"};
String[] headers = {"班级编号","学号","年级编号"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据
if (values.size()<=0){
......@@ -120,6 +125,14 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
continue;
}
//判断:学年是否存在,存在才能录入
BClass b1 = new BClass();
b1.setGradeCode(value[2]);
if (bClassRepository.checkGrade(b1).size() == 0){
valuesGrade.add(value[2]);
continue;
}
//1.4 构造学生班级信息
brClassStudent= new BRClassStudent(value[0],value[1]);
......@@ -156,6 +169,9 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
nullResult.append("以下学生学号不存在:").append(JSON.toJSONString(studentCode)).append("。");
// nullResult.append("部分学生不存在,请检查后重新上传");
}
if(valuesGrade.size()>0){
result+="以下年级不存在:"+ JSON.toJSONString(valuesGrade)+"。";
}
result+=nullResult;
......@@ -190,5 +206,127 @@ public class BRClassStudentServiceImpl implements BRClassStudentService {
return new PersistModel(line);
}
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel enterpriseExcelImport(HSSFWorkbook hwb){
ArrayList<BRClassStudent> brClassStudents = new ArrayList<BRClassStudent>();
ArrayList<String> studentCode = new ArrayList<String>();
ArrayList<String> classCode = new ArrayList<String>();
ArrayList<String> repeatCode = new ArrayList<String>();
List<String> valuesGrade = new ArrayList<>();
ArrayList<String> AgencyCode = new ArrayList<String>();
String[] headers = {"班级编号","学号","年级编号","教学单位编号"};
ArrayList<String[]> values = ExcelUtil.importExcel(hwb,headers,false,1); //获取excel数据
if (values.size()<=0){
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST);
}
for(String[] value:values){ //将数据封装到entity
//1.0 检查信息是否为空
BRClassStudent brClassStudent = null;
if(value[0]==null||value[0].equals("")||value[1]==null||value[1].equals("")){
continue;
}
//1.1 检查班级是否存在
if((bClassRepository.selectOne(new BClass(value[0])))==null) {
if(!classCode.contains(value[0]))
classCode.add(value[0]);
continue;
}
//1.2 检查学生是否存在
if((bStudentRepository.selectOne(new BStudent(value[1])))==null) {
if(!studentCode.contains(value[1]))
studentCode.add(value[1]);
continue;
}
//1.3 检查班级学生是否存在
BRClassStudent classStudent = new BRClassStudent();
//classStudent.setClassCode(value[0]);
classStudent.setStudentCode(value[1]);
if((bRClassStudentRepository.selectOne(classStudent))!=null) {
repeatCode.add(value[1]);
continue;
}
//判断:学年是否存在,存在才能录入
BClass b1 = new BClass();
b1.setGradeCode(value[2]);
if (bClassRepository.checkGrade(b1).size() == 0){
valuesGrade.add(value[2]);
continue;
}
//判断教学单位是否存在
List<BAgency> bAgencies = bAgencyRepository.queryBAgencysByCode(value[3]);
if(bAgencies.size()<1){
AgencyCode.add(value[3]);
continue;
}
//1.4 构造学生班级信息
brClassStudent= new BRClassStudent(value[0],value[1]);
brClassStudent.setCommonBusinessId();
//UserUtils.setCurrentPersistOperation(brClassStudent);
if(!brClassStudents.contains(brClassStudent)){
brClassStudents.add(brClassStudent);
}
}
String result ="";
if (brClassStudents.size()>0){
int line = bRClassStudentRepository.insertList(brClassStudents);
if (line>0){
result = "成功导入"+brClassStudents.size()+"条数据。";
}else{
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DB_INSERT_ERROR);
}
}
StringBuilder nullResult = new StringBuilder();
if(repeatCode.size()>0){
//nullResult.append("以下学生班级关系已存在:").append(JSON.toJSONString(repeatCode)).append("。");
nullResult.append("以下学生已存在于其他班级:").append(JSON.toJSONString(repeatCode)).append("。");
// nullResult.append("部分学生不存在,请检查后重新上传");
}
//2. 检查重复
if(classCode.size()>0){
nullResult.append("以下班级编号不存在:").append(JSON.toJSONString(classCode)).append("。");
// nullResult.append("部分班级不存在,请检查后重新上传");
}
if(studentCode.size()>0){
nullResult.append("以下学生学号不存在:").append(JSON.toJSONString(studentCode)).append("。");
// nullResult.append("部分学生不存在,请检查后重新上传");
}
if(valuesGrade.size()>0){
result+="以下年级不存在:"+ JSON.toJSONString(valuesGrade)+"。";
}
if(AgencyCode.size()>0){
result+="以下教学单位不存在:"+ JSON.toJSONString(AgencyCode)+"。";
}
result+=nullResult;
if(brClassStudents.size()<1){
throw new ServiceException(ResultServiceEnums.EXCEL_IMPORT_DATA_NOT_EXIST.getCode(),result);
}
//4.调用存储过程
Map<String,Object> map = new HashedMap();
map.put("result",null);
bClassRepository.updateStudentNum(map);
int l1 = MapUtils.getInteger(map,"result",-2);
if(l1<=0)
throw new ServiceException(ResultServiceEnums.UPDATE_STUDENT_NUM_ERROR);
return new PersistModel(1,result.toString());
}
}
......@@ -52,14 +52,14 @@ public class BRoomsController extends FileController<BRooms> {
@ApiImplicitParams({@ApiImplicitParam(name = "campus", value = "校区(1)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "building", value = "教学楼(1-50)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "category", value = "教室类型(1)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "classroomNo", value = "教室号(1-50)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "classroomNo", value = "教室号(1-5)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "classroomName", value = "教室名(1-50)", required = true, dataType = "varchar"),
@ApiImplicitParam(name = "classSeat", value = "座位数(1-5)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "examSeat", value = "考试座位数(1-5)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "plan", value = "计划(1-50)", required = false, dataType = "varchar"),
@ApiImplicitParam(name = "code", value = "教室编号(1-50)", required = true, dataType = "varchar")})
@PostMapping(value = "/add")
public Result add( @ApiIgnore BRooms bRooms, BindingResult bindingResult) {
public Result add( @ApiIgnore @Valid BRooms bRooms, BindingResult bindingResult) {
bRooms.setToken(getToken());
PersistModel data = bRoomsServiceImpl.save(bRooms);
return Result.builder(data,
......@@ -68,7 +68,7 @@ public class BRoomsController extends FileController<BRooms> {
bRooms);
}
@ApiOperation(value="逻辑删除", notes="逻辑删除")
@ApiOperation(value="物理删除", notes="物理删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "varchar")})
@DeleteMapping("/delete/{id:\\w+}")
public Result delete(@PathVariable String id) {
......
......@@ -22,6 +22,8 @@ import java.util.List;
@Table(name = "b_rooms")
public class BRooms extends IdEntity<BRooms> {
private static final long serialVersionUID = -1981767442522112001L;
/*教室类型*/
@Length(min= 1 , max = 1, message = "长度为1")
@NotBlank
......@@ -38,7 +40,7 @@ public class BRooms extends IdEntity<BRooms> {
private String building;
/*教室号*/
@Length(min= 1 , max = 64, message = "长度最短为1,最长为50")
@Length(min= 1 , max = 5, message = "长度最短为1,最长为5")
@NotBlank
private String classroomNo;
......
package org.rcisoft.business.brooms.service.impl;
import lombok.extern.slf4j.Slf4j;
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.dao.BRoomsRepository;
import org.rcisoft.business.brooms.entity.BRooms;
import org.rcisoft.business.brooms.service.BRoomsService;
import org.rcisoft.business.bslschedule.dao.BSlScheduleRepository;
import org.rcisoft.business.bslschedule.entity.BSlSchedule;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.Result;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums;
import org.rcisoft.core.util.ExcelUtil;
import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel;
import org.rcisoft.business.brooms.dao.BRoomsRepository;
import org.rcisoft.business.brooms.entity.BRooms;
import org.rcisoft.business.brooms.service.BRoomsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* Created by on 2018-4-23 9:26:21.
......@@ -71,7 +62,7 @@ public class BRoomsServiceImpl implements BRoomsService {
}
/**
* 逻辑删除
* 物理删除
* @param bRooms
* @return
*/
......@@ -80,12 +71,10 @@ public class BRoomsServiceImpl implements BRoomsService {
public PersistModel remove(BRooms bRooms){
if(bArrangeRepository.countThisRoomNum(bRooms.getBusinessId()) != 0
|| bSlScheduleRepository.countThisRoomNum(bRooms.getBusinessId()) != 0){
throw new ServiceException(ResultServiceEnums.ROOM_HAS_USED);
throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
}else{
UserUtil.setCurrentMergeOperation(bRooms);
bRooms.setDeleted();
int line = bRoomsRepository.logicalDelete(bRooms);
log.info(UserUtil.getUserInfoProp(bRooms.getToken(),UserUtil.USER_USERNAME)+"逻辑删除了ID为"+
int line = bRoomsRepository.deleteByPrimaryKey(bRooms.getBusinessId());
log.info(UserUtil.getUserInfoProp(bRooms.getToken(),UserUtil.USER_USERNAME)+"物理删除了ID为"+
bRooms.getBusinessId()+"的信息");
return new PersistModel(line);
}
......
......@@ -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")
@PreAuthorize("hasRole('ROLE_1001')")
@PostMapping(value = "/remove")
......
......@@ -259,7 +259,7 @@ public class BStudentServiceImpl implements BStudentService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel removeBBStudent(String id) {
if(brSlStudentRepository.selectSlNumByStuId(id)>0) {
throw new ServiceException(ResultServiceEnums.STUDENT_HAS_SL);
throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
}
BStudent bStudent = new BStudent();
bStudent.setBusinessId(id);
......@@ -268,7 +268,7 @@ public class BStudentServiceImpl implements BStudentService {
bStudent.setDeleted();
UserUtil.setCurrentMergeOperation(bStudent);
int line = bStudentRepository.logicalDelete(bStudent);
int line = bStudentRepository.deleteByPrimaryKey(bStudent);
brClassStudentRepository.deleteCSByStuId(student.getCode());
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
......
......@@ -63,7 +63,7 @@ public class BTeacherController extends PaginationController<BTeacher> {
bTeacher);
}
@ApiOperation(value="逻辑删除", notes="根据ID删除一条记录")
@ApiOperation(value="物理删除", notes="根据ID删除一条记录")
@ApiImplicitParam(name = "id", value = "businessId", required = true, dataType = "varchar")
@PreAuthorize("hasRole('ROLE_1001')")
@PostMapping(value = "/remove")
......
......@@ -91,9 +91,9 @@ public class BTeacherServiceImpl implements BTeacherService {
List<String[]> valuesOK = new ArrayList<>();
List<String> valuesRepeat = new ArrayList<>();
List<String> valuesShort = new ArrayList<>();
List<String> valuesEmailExist = new ArrayList<>();
List<String> valuesIncomplete = new ArrayList<>();
List<String> valuesAgencyExist = new ArrayList<>();
int i = 1;
for (String[] value : values) {
String teaCode = value[0];
......@@ -132,7 +132,10 @@ public class BTeacherServiceImpl implements BTeacherService {
continue;
}
}
if(value[0].equals("")||value[1].equals("")||value[2].equals("")){
valuesIncomplete.add(String.valueOf(i));
continue;
}
//合法:通过了三次判断,证明可建立该用户
valuesOK.add(value);
......@@ -172,7 +175,7 @@ public class BTeacherServiceImpl implements BTeacherService {
users.add(user);
userRoles.add(userRole);
}
i++;
}
String result = "";
if (teachers.size()>0){
......@@ -192,9 +195,9 @@ public class BTeacherServiceImpl implements BTeacherService {
if(valuesShort.size()>0){
result+="以下教师的工号位数不在8~15位之间:"+ JSON.toJSONString(valuesShort)+"。";
}
// if(valuesEmailExist.size()>0){
// result+="以下教师邮箱已注册或格式不正确:"+ JSON.toJSONString(valuesEmailExist)+"。";
// }
if(valuesIncomplete.size()>0){
result+="第"+ JSON.toJSONString(valuesIncomplete)+"行数据不完整";
}
if (valuesAgencyExist.size()>0){
result+="以下教师的所属教学单位不存在:"+JSON.toJSONString(valuesAgencyExist)+"。";
}
......@@ -212,15 +215,15 @@ public class BTeacherServiceImpl implements BTeacherService {
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public PersistModel removeBTeacher(String id) {
if(bSlRepository.selectSlNumByStuent(id)>0) {
throw new ServiceException(ResultServiceEnums.TEACHER_HAS_SL);
throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
}
BTeacher bTeacher = new BTeacher();
bTeacher.setBusinessId(id);
BTeacher teacher = bTeacherRepository.selectOne(bTeacher);
UserUtil.setCurrentMergeOperation(bTeacher);
sysUserMapper.deleteByCode(teacher.getCode());
bTeacher.setDeleted();
int line = bTeacherRepository.logicalDelete(bTeacher);
// bTeacher.setDeleted();
int line = bTeacherRepository.deleteByPrimaryKey(bTeacher);
return new PersistModel(line, MessageConstant.MESSAGE_ALERT_SUCCESS);
}
......
......@@ -183,6 +183,8 @@ public enum ResultServiceEnums {
CURRENT_TERM(97,"当前学期不可删除"),
ROOM_HAS_USED(98,"当前教室正在被使用,不可删除"),
DATA_HAS_USED(100,"当前数据被使用,不可删除"),
;
private Integer code;
......
......@@ -68,7 +68,7 @@ public class SysRoleServiceImpl implements SysRoleService {
int userCount = sysUserMapper.countUserByRole(id);
//如果仍然有用户(如果用户被逻辑删除,则忽略此角色,但如果用于被停用,则依然被计算)是此角色,则该角色不可删除
if(userCount > 0){
throw new ServiceException(ResultServiceEnums.ROLE_HAS_USER);
throw new ServiceException(ResultServiceEnums.DATA_HAS_USED);
}else{
//删除该角色所有的关联信息
sysRoleRepository.deleteRoleMenuByRoleId(id);
......
......@@ -81,7 +81,7 @@ public class SysUserServiceImpl implements SysUserService {
user.setDeleted();
user.setStop();
user.setBusinessId(id);
return sysUserMapper.logicalDelete(user);
return sysUserMapper.deleteByPrimaryKey(user);
}
@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