Commit 11970a73 authored by 李博今's avatar 李博今

修改bug

parent 429c010d
......@@ -27,7 +27,7 @@ public interface BArrangeRepository extends BaseMapper<BArrange> {
+ "<if test=\"delFlag !=null and delFlag != '' \">and del_flag = #{delFlag} </if> "
+ "<if test=\"flag !=null and flag != '' \">and flag = #{flag} </if> "
+ "<if test=\"status !=null and status != '' \">and FIND_IN_SET(b_arrange.`status`,#{status}) </if> "
+ "order by b_arrange.status,b_arrange.create_date desc"
+ "GROUP BY b_arrange.business_id order by b_arrange.status,b_arrange.create_date desc "
+ "</script>")
@ResultMap(value = "BaseResultMapByAgencyCode")
List<BArrange> queryByAgencyCode(BArrange bArrange);
......
......@@ -16,7 +16,7 @@ public interface BCompanyRepository extends BaseMapper<BCompany>{
@Select("<script>SELECT bc.*,ba.name as agencyName,su.`name` as name," +
"sr.role_name as roleName,sr.`code` as roleCode " +
"sr.role_name as roleName,sr.`code` as roleCode,sr.business_id as roleId " +
"FROM b_company bc \n" +
"LEFT JOIN s_user su on su.login_name = bc.`code`\n" +
"LEFT JOIN b_agency ba on ba.`code` = bc.agency_code \n" +
......
......@@ -38,6 +38,9 @@ public class BCompany extends IdEntity<BCompany>{
@Transient
private String roleName;
@Transient
private String roleId;
public BCompany(String businessId, String delFlag, String flag) {
this.businessId = businessId;
this.delFlag = delFlag;
......
......@@ -44,5 +44,8 @@ public interface BEduClassRepository extends BaseMapper<BEduClass> {
"left JOIN b_edu_class on b_schedule_dto.class_code = b_edu_class.code where sub_agency_id = #{subAgencyId} GROUP BY `code` ")
@ResultMap(value = "SmallBaseResultMap" )
List<BEduClass> selectClassBySubAgencyId(String subAgencyId);
}
......@@ -59,5 +59,7 @@ public class BEduClass extends IdEntity<BEduClass> {
@Transient
private String gradeName;
@Transient
private int studentNum;
}
......@@ -24,11 +24,15 @@ public interface BSlScheduleRepository extends BaseMapper<BSlSchedule> {
@ResultMap(value = "BaseResultMap" )
List<BSlSchedule> queryBSlSchedules(BSlSchedule bSlSchedule);
@Select("<script>select * from b_sl_schedule "
@Select("<script>select *, "
+ "b_agency.name as agencyName,b_agency.code as agencyCode,b_agency.business_id as agencyId, \n"
+ "(select sum(student_num) from b_class where FIND_IN_SET(b_class.business_id,b_edu_class.classes_id)) AS studentNum from b_sl_schedule "
+ "left join b_edu_class on b_edu_class.code = b_sl_schedule.edu_class_code \n"
+ "left join b_lesson on b_lesson.code = b_sl_schedule.lesson_code \n"
+ "left join b_rooms on b_rooms.code = b_sl_schedule.room_code \n"
+ "left join s_user on s_user.login_name = b_sl_schedule.tea_code \n"
+ "left join b_teacher on b_teacher.code = b_sl_schedule.tea_code \n"
+ "left join b_agency on b_agency.code = b_teacher.agency_code \n"
+ "where start_day between #{0} and #{1} and sub_agency_id = #{2} order by edu_class_code,start_day,seq"
+ "</script>"
)
......@@ -46,5 +50,6 @@ public interface BSlScheduleRepository extends BaseMapper<BSlSchedule> {
@Update("update b_sl_schedule set status = #{status} where sub_agency_id = #{subAgencyId} and del_flag = 0 and flag = 1")
int updateStatusBySubAgencyId(@Param("subAgencyId") String subAgencyId, @Param("status") String status);
int countStudentNum(String classesId);
}
......@@ -2,6 +2,7 @@ package org.rcisoft.business.bslschedule.entity;
import lombok.*;
import org.rcisoft.business.bagency.entity.BAgency;
import org.rcisoft.business.beduclass.entity.BEduClass;
import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.brooms.entity.BRooms;
......@@ -73,5 +74,8 @@ public class BSlSchedule extends IdEntity<BSlSchedule> {
@Transient
private BEduClass bEduClass;
@Transient
private BAgency bAgency;
}
......@@ -154,4 +154,13 @@ public class BTermController extends PaginationController<BTerm> {
MessageConstant.MESSAGE_ALERT_ERROR,
id);
}
@ApiOperation(value="获取校历", notes="获取校历")
@GetMapping(value = "/getSchoolWeek")
public Result getSchoolWeek(){
return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
bTermService.getSchoolWeek());
}
}
......@@ -65,5 +65,9 @@ public interface BTermRepository extends BaseMapper<BTerm> {
"</foreach></script>")
int insertList(List<BTeacher> bTeachers);
*/
@Select("select * from b_term where current = 1")
@ResultMap(value = "BaseResultMap" )
BTerm queryCurrentTerm();
}
......@@ -58,4 +58,6 @@ public interface BTermService{
List<SelectModel> queryBTermList();
PersistModel changeCurrent(String id);
List<String> getSchoolWeek();
}
......@@ -18,6 +18,7 @@ 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.*;
......@@ -134,4 +135,12 @@ public class BTermServiceImpl implements BTermService {
return new PersistModel(result);
}
@Override
public List<String> getSchoolWeek(){
BTerm bTerm = bTermRepository.queryCurrentTerm();
List<String> list = new ArrayList<>();
list = Week.buildList(bTerm.getStartDate(),bTerm.getEndDate());
return list;
}
}
package org.rcisoft.business.bterm.utils;
import java.text.SimpleDateFormat;
import java.util.*;
public class Week {
......@@ -129,4 +130,65 @@ public class Week {
return map;
}
//通过开始时间与计算时间计算周数与具体信息
public static List<String> buildList(Date startDate1,Date endDate1){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
List<String> list = new ArrayList<>();
//转化起始时间
Calendar startCalendar = Calendar.getInstance();
startCalendar.setTime(startDate1);
//转化结束时间
Calendar endCalendar = Calendar.getInstance();
endCalendar.setTime(endDate1);
//遍历用时间
Calendar calendar = Calendar.getInstance();
calendar.setTime(startDate1);
int flag = 1;
String s = "";
while(!calendar.after(endCalendar)){
int weekOfDay = calendar.get(Calendar.DAY_OF_WEEK);
//第一周判断是否为完整的一周
if(flag == 1 && calendar.get(Calendar.DAY_OF_WEEK) != 2){
//如果不是时间往前推移,直到星期一,此间字符串添加','
Calendar calendar2 = Calendar.getInstance();
calendar2.setTime(startDate1);
while(calendar2.get(Calendar.DAY_OF_WEEK) != 2){
s += "0,";
calendar2.add(Calendar.DATE,-1);
}
flag = 0;
continue;
}
//平常周,判断是否为周日
if(weekOfDay != 1){
String formatTime = sdf.format(calendar.getTime());
s += formatTime+",";
calendar.add(Calendar.DATE,1);
}else{
String formatTime = sdf.format(calendar.getTime());
s += formatTime+",";
s = s.substring(0,s.length() - 1);
//因为是周日,所以List添加一条数据,开始下一周的遍历
list.add(s);
s = "";
calendar.add(Calendar.DATE,1);
}
}
int flag2 = 0;
//因为最后一周如果没有周日的话会跳出循环,字符串s依然有值,将最后的值插入List中
while(calendar.get(Calendar.DAY_OF_WEEK) != 1 || flag2 == 1){
if(calendar.get(Calendar.DAY_OF_WEEK) == 1){
s += "0,";
s = s.substring(0,s.length() - 1);
list.add(s);
break;
}else {
s += "0,";
calendar.add(Calendar.DATE,1);
flag2 = 1;
}
}
return list;
}
}
......@@ -11,7 +11,7 @@ server:
# org.springframework.web: DEBUG
druid:
url: jdbc:mysql://192.168.1.125:13318/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
username: root
password: 123456
initial-size: 1
......
......@@ -50,17 +50,21 @@
<result column="lesson_name" jdbcType="VARCHAR" property="bLesson.lessonName"/>
<result column="class_hour" jdbcType="VARCHAR" property="bLesson.classHour"/>
<result column="credits" jdbcType="VARCHAR" property="bLesson.credits"/>
<result column="campus" jdbcType="VARCHAR" property="bRooms.campus"/>
<result column="campus" jdbcType="VARCHAR" property="bRooms.transitCampus"/>
<result column="building" jdbcType="VARCHAR" property="bRooms.building"/>
<result column="classroom_no" jdbcType="VARCHAR" property="bRooms.classroomNo"/>
<result column="classroom_name" jdbcType="VARCHAR" property="bRooms.classroomName"/>
<result column="category" jdbcType="VARCHAR" property="bRooms.category"/>
<result column="category" jdbcType="VARCHAR" property="bRooms.transitCategory"/>
<result column="class_seat" jdbcType="VARCHAR" property="bRooms.classSeat"/>
<result column="exam_seat" jdbcType="VARCHAR" property="bRooms.examSeat"/>
<result column="name" jdbcType="VARCHAR" property="sysUser.name"/>
<result column="email" jdbcType="VARCHAR" property="sysUser.email"/>
<result column="phone" jdbcType="VARCHAR" property="sysUser.phone"/>
<result column="sex" jdbcType="VARCHAR" property="sysUser.sex"/>
<result column="agencyCode" jdbcType="VARCHAR" property="bAgency.code"/>
<result column="agencyName" jdbcType="VARCHAR" property="bAgency.name"/>
<result column="agencyId" jdbcType="VARCHAR" property="bAgency.businessId"/>
<result column="studentNum" jdbcType="VARCHAR" property="bEduClass.studentNum"/>
</resultMap>
<insert id="insertList">
insert into b_sl_schedule(business_id,flag,del_flag,update_by,create_by,create_date,update_date,remarks,
......
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