Commit a670eace authored by YangZhaoJun1's avatar YangZhaoJun1

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

# Conflicts:
#	src/main/java/org/rcisoft/core/result/ResultServiceEnums.java
parents 59ae488b 30b3e9b2
......@@ -98,3 +98,4 @@ ADD COLUMN `sunday` varchar(64) NULL AFTER `sub_agency_id`;
ALTER TABLE `b_opinion`
ADD COLUMN `sub_agency_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '子任务下教学单位id' AFTER `flag`;
......@@ -57,6 +57,7 @@ public class BAgencyController extends PaginationController<BAgency> {
}
@ApiOperation(value="查询教学单位下是否有用户", notes="查询教学单位下是否有用户")
@ApiImplicitParams({@ApiImplicitParam(name = "businessId", value = "businessId", required = true, dataType = "varchar")})
@GetMapping(value = "/selectBAgencyHaveUser")
public String HaveUserOrNot(@ApiIgnore BAgency bAgency) {
bAgency.setCreateBy(UserUtil.getUserInfoProp(getToken(), UserUtil.USER_ID));
......
......@@ -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);
......@@ -84,7 +84,8 @@ public interface BArrangeRepository extends BaseMapper<BArrange> {
"LEFT JOIN b_teacher on b_teacher.`code` = b_schedule_dto.teacher_code " +
"LEFT JOIN s_user on s_user.login_name = b_teacher.`code` " +
"where sub_agency_id = #{subAgencyId} " +
"GROUP BY lesson_code,teacher_code,class_code " +
"ORDER BY class_code,week " +
//"GROUP BY lesson_code,teacher_code,class_code " +
"</script>")
@ResultMap(value = "scheduleDtoResultMap")
List<ScheduleDto> queryDtoBySubAgencyId(String subAgencyId);
......
......@@ -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;
/**
......
......@@ -79,7 +79,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);
......
......@@ -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);
}
......
......@@ -123,7 +123,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")
......
......@@ -271,7 +271,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);
......@@ -280,7 +280,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")
......
......@@ -216,15 +216,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);
}
......
......@@ -156,11 +156,12 @@ public class BTermController extends PaginationController<BTerm> {
}
@ApiOperation(value="获取校历", notes="获取校历")
@ApiImplicitParam(name = "termCode", value = "termCode", required = true, dataType = "varchar")
@GetMapping(value = "/getSchoolWeek")
public Result getSchoolWeek(){
public Result getSchoolWeek(String termCode){
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bTermService.getSchoolWeek());
bTermService.getSchoolWeek(termCode));
}
}
......@@ -66,8 +66,8 @@ public interface BTermRepository extends BaseMapper<BTerm> {
int insertList(List<BTeacher> bTeachers);
*/
@Select("select * from b_term where current = 1")
@Select("select * from b_term where code = #{termCode}")
@ResultMap(value = "BaseResultMap" )
BTerm queryCurrentTerm();
BTerm queryCurrentTerm(String termCode);
}
......@@ -7,6 +7,7 @@ import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.model.SelectModel;
import java.util.List;
import java.util.Map;
/**
* Created by CodeGenerator on 2017/07/12.
......@@ -59,5 +60,5 @@ public interface BTermService{
PersistModel changeCurrent(String id);
List<String> getSchoolWeek();
Map<String,Object> getSchoolWeek(String termCode);
}
......@@ -18,7 +18,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -141,11 +140,14 @@ public class BTermServiceImpl implements BTermService {
}
@Override
public List<String> getSchoolWeek(){
BTerm bTerm = bTermRepository.queryCurrentTerm();
public Map<String, Object> getSchoolWeek(String termCode){
Map<String,Object> map = new HashMap<>();
BTerm bTerm = bTermRepository.queryCurrentTerm(termCode);
List<String> list = new ArrayList<>();
list = Week.buildList(bTerm.getStartDate(),bTerm.getEndDate());
return list;
map.put("weekList",list);
map.put("termName",bTerm.getName());
return map;
}
}
......@@ -185,6 +185,8 @@ public enum ResultServiceEnums {
ROOM_HAS_USED(98,"当前教室正在被使用,不可删除"),
NAME_IS_EXISTS(99,"名称重复"),
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
......
......@@ -11,8 +11,8 @@ server:
# org.springframework.web: DEBUG
druid:
# url: jdbc:mysql://192.168.1.125:13318/new_edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://127.0.0.1:3306/new_edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://192.168.1.125:13318/new_edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
# url: jdbc:mysql://127.0.0.1:3306/new_edu_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&allowMultiQueries=true&useSSL=false
username: root
password: 123456
......
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