瀏覽代碼

Merge branch 'feature-cloud' of ssh://10.10.100.21/source/smartschool-platform into feature-cloud

RaoMeng 7 年之前
父節點
當前提交
f79e490db7

+ 18 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/po/OutInRecordDO.java

@@ -33,6 +33,24 @@ public class OutInRecordDO implements Serializable {
 	private Long stuId;
 	//学校
 	private Long schoolId;
+	//设备号
+	private String deviceId;
+	//学号
+	private String stuNumber;
+	//学生姓名
+	private String stuName;
+	//年级id
+	private Long gradeId;
+	//年级名
+	private String gradeName;
+	//班级id
+	private Long clazzId;
+	//班级名
+	private String clazzName;
+	//年级-班级
+	private String gradeClazz;
+	//学生性别 1男  2女
+	private Integer stuSex;
 
 
 }

+ 20 - 1
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxPrincipalMailboxServiceImpl.java

@@ -3,8 +3,8 @@ package com.usoftchina.smartschool.school.wxschool.basic.service.impl;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.usoftchina.smartschool.school.po.*;
-import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.wxschool.basic.service.WxPrincipalMailboxService;
+import com.usoftchina.smartschool.school.wxschool.mapper.*;
 import com.usoftchina.smartschool.school.wxschool.utils.JavaBeanUtil;
 import com.usoftchina.smartschool.school.wxschool.utils.ObjectUtils;
 import com.usoftchina.smartschool.wechat.api.WxPushApi;
@@ -42,6 +42,15 @@ public class WxPrincipalMailboxServiceImpl implements WxPrincipalMailboxService
 	@Autowired
 	private WxTemplateMapper wxTemplateMapper;
 
+	@Autowired
+	private WxStudentMapper wxStudentMapper;
+
+	@Autowired
+	private WxClazzMapper wxClazzMapper;
+
+	@Autowired
+	private WxGradeMapper wxGradeMapper;
+
 	/**
 	 * 校长信箱创建
 	 * @return
@@ -51,8 +60,18 @@ public class WxPrincipalMailboxServiceImpl implements WxPrincipalMailboxService
 		PrincipalMailboxDO principalMailboxDO = JSONObject.parseObject(mailboxString, PrincipalMailboxDO.class);
 		Long schoolId = parentsMapper.get(principalMailboxDO.getMailboxCreator()).getSchoolId();
 		principalMailboxDO.setNotifier(schoolMapper.get(schoolId).getTeacherId());
+		principalMailboxDO.setMbCreatorname(parentsMapper.get(principalMailboxDO.getMailboxCreator()).getParentsName());
 		principalMailboxDO.setSchoolId(schoolId);
 		principalMailboxDO.setCreateDate(new Date());
+		StudentDO studentDO = wxStudentMapper.get(principalMailboxDO.getMbStuid());
+		if (ObjectUtils.isNotEmpty(studentDO)){
+			principalMailboxDO.setMbStudent(studentDO.getStuName());
+			ClazzDO clazzDO = wxClazzMapper.get(studentDO.getClazzId());
+			principalMailboxDO.setMbClass(clazzDO.getClazzName());
+			principalMailboxDO.setMbGrade(wxGradeMapper.get(clazzDO.getGradeId()).getGradeName());
+		}
+
+
 		int save = principalMailboxMapper.save(principalMailboxDO);
 		if (save>0){
 			SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");

+ 44 - 34
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/basic/service/impl/WxUserServiceImpl.java

@@ -220,21 +220,26 @@ public class WxUserServiceImpl implements WxUserService {
 		if (ObjectUtils.isNotEmpty(teacherClazzDOS)){
 			for (TeacherClazzDO tc:teacherClazzDOS) {
 				ClazzDO clazzDO = clazzMapper.get(tc.getClazzId());
-				Map<String, Object> clazzMap = JavaBeanUtil.object2Map(clazzDO);
-				clazzMap.put("gradeName",gradeMapper.get(clazzDO.getGradeId()).getGradeName());
-				Map<String, Object> map = new HashMap<>();
-				map.put("clazzId",clazzDO.getClazzId());
-				List<StudentDO> studentDOS = studentMapper.list(map);
-				List<TeacherClazzDO> list = teacherClazzMapper.list(map);
-				List<TeacherDO> teacherDOS = new ArrayList<>();
-				for (TeacherClazzDO teacherClazzDO:list) {
-					TeacherDO teacherDO = teacherMapper.get(teacherClazzDO.getTeacherId());
-					teacherDO.setUserPhone(userMapper.get(teacherDO.getUserId()).getUserPhone());
-					teacherDOS.add(teacherDO);
+				if (ObjectUtils.isNotEmpty(clazzDO)){
+					Map<String, Object> clazzMap = JavaBeanUtil.object2Map(clazzDO);
+					clazzMap.put("gradeName",gradeMapper.get(clazzDO.getGradeId()).getGradeName());
+					Map<String, Object> map = new HashMap<>();
+					map.put("clazzId",clazzDO.getClazzId());
+					List<StudentDO> studentDOS = studentMapper.list(map);
+					List<TeacherClazzDO> list = teacherClazzMapper.list(map);
+					if (ObjectUtils.isNotEmpty(studentDOS)){
+						List<TeacherDO> teacherDOS = new ArrayList<>();
+						for (TeacherClazzDO teacherClazzDO:list) {
+							TeacherDO teacherDO = teacherMapper.get(teacherClazzDO.getTeacherId());
+							teacherDO.setUserPhone(userMapper.get(teacherDO.getUserId()).getUserPhone());
+							teacherDOS.add(teacherDO);
+						}
+						clazzMap.put("studentDOS",removeDuplicate(studentDOS));
+						clazzMap.put("teacherDOS",removeDuplicate(teacherDOS));
+						maps.add(clazzMap);
+					}
 				}
-				clazzMap.put("studentDOS",removeDuplicate(studentDOS));
-				clazzMap.put("teacherDOS",removeDuplicate(teacherDOS));
-				maps.add(clazzMap);
+
 			}
 			return maps;
 		}else {
@@ -410,25 +415,14 @@ public class WxUserServiceImpl implements WxUserService {
 	 * @throws Exception
 	 */
 	public int updatePhone(String userPhone, String openid, String code) throws Exception {
-		Map<String, Object> map = new HashMap<>();
-		map.put("openid",openid);
-		List<ParentsDO> parentsDOS = parentsMapper.list(map);
-		List<TeacherDO> teacherDOS = teacherMapper.list(map);
-		if (ObjectUtils.isNotEmpty(parentsDOS)){
-			UserDO userDO = userMapper.get(parentsDOS.get(0).getUserId());
-			if (ObjectUtils.isNotEmpty(userDO)) {
-				if (code.equals(userDO.getUserCode())) {
-					userDO.setUserPhone(userPhone);
-					return userMapper.update(userDO);
-				}else {
-					throw new Exception("验证码错误,请核实");
-				}
-			}else {
-				throw new Exception("用户不存在,请联系管理员");
-			}
-		}else {
-			if (ObjectUtils.isNotEmpty(teacherDOS)){
-				UserDO userDO = userMapper.get(teacherDOS.get(0).getUserId());
+		UserDO user = userMapper.selectUserByPhone(userPhone);
+		if (ObjectUtils.isEmpty(user)){
+			Map<String, Object> map = new HashMap<>();
+			map.put("openid",openid);
+			List<ParentsDO> parentsDOS = parentsMapper.list(map);
+			List<TeacherDO> teacherDOS = teacherMapper.list(map);
+			if (ObjectUtils.isNotEmpty(parentsDOS)){
+				UserDO userDO = userMapper.get(parentsDOS.get(0).getUserId());
 				if (ObjectUtils.isNotEmpty(userDO)) {
 					if (code.equals(userDO.getUserCode())) {
 						userDO.setUserPhone(userPhone);
@@ -440,8 +434,24 @@ public class WxUserServiceImpl implements WxUserService {
 					throw new Exception("用户不存在,请联系管理员");
 				}
 			}else {
-				throw new Exception("用户不存在,请联系管理员");
+				if (ObjectUtils.isNotEmpty(teacherDOS)){
+					UserDO userDO = userMapper.get(teacherDOS.get(0).getUserId());
+					if (ObjectUtils.isNotEmpty(userDO)) {
+						if (code.equals(userDO.getUserCode())) {
+							userDO.setUserPhone(userPhone);
+							return userMapper.update(userDO);
+						}else {
+							throw new Exception("验证码错误,请核实");
+						}
+					}else {
+						throw new Exception("用户不存在,请联系管理员");
+					}
+				}else {
+					throw new Exception("用户不存在,请联系管理员");
+				}
 			}
+		}else {
+			throw new Exception("该手机号已绑定用户,请联系管理员");
 		}
 	}
 

+ 1 - 14
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/wxschool/mapper/WxOutInRecordMapper.java

@@ -5,7 +5,6 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * 出入校通知表; InnoDB free: 5120 kB
@@ -17,18 +16,6 @@ import java.util.Map;
 public interface WxOutInRecordMapper {
 
 	OutInRecordDO get(Long recordId);
-	
-	List<OutInRecordDO> list(Map<String, Object> map);
-	
-	int count(Map<String, Object> map);
-	
-	int save(OutInRecordDO outInRecord);
-	
-	int update(OutInRecordDO outInRecord);
-	
-	int remove(Long record_id);
-	
-	int batchRemove(Long[] recordIds);
 
-	public List<OutInRecordDO> selectOutInRecordDOListByStuId(@Param("stuId") Long stuId, @Param("pageStart") Integer pageStart, @Param("pageSize") Integer pageSize);
+	List<OutInRecordDO> selectOutInRecordDOListByStuId(@Param("stuId") Long stuId, @Param("pageStart") Integer pageStart, @Param("pageSize") Integer pageSize);
 }

+ 1 - 88
applications/school/school-server/src/main/resources/mapper/WxOutInRecordMapper.xml

@@ -4,100 +4,13 @@
 <mapper namespace="com.usoftchina.smartschool.school.wxschool.mapper.WxOutInRecordMapper">
 
     <sql id="OutInRecordVo">
-    select `record_id`,`record_name`,`out_date`,`in_date`,`record_details`,`record_remarks`,`stu_id`,`school_id` from out_in_record
+    select `record_id`,`record_name`,`out_date`,`in_date`,`record_details`,`record_remarks`,`stu_id`,`school_id`,`device_id`,`stu_number`,`stu_name`,`grade_id`,`grade_name`,`clazz_id`,`clazz_name`,`grade_clazz`,`stu_sex` from out_in_record
     </sql>
 
 	<select id="get" resultType="com.usoftchina.smartschool.school.po.OutInRecordDO">
 		<include refid="OutInRecordVo"/> where record_id = #{value}
 	</select>
 
-	<select id="list" resultType="com.usoftchina.smartschool.school.po.OutInRecordDO">
-        <include refid="OutInRecordVo"/>
-        <where>  
-		  		  <if test="recordId != null and recordId != ''"> and record_id = #{recordId} </if>
-		  		  <if test="recordName != null and recordName != ''"> and record_name = #{recordName} </if>
-		  		  <if test="outDate != null and outDate != ''"> and out_date = #{outDate} </if>
-		  		  <if test="inDate != null and inDate != ''"> and in_date = #{inDate} </if>
-		  		  <if test="recordDetails != null and recordDetails != ''"> and record_details = #{recordDetails} </if>
-		  		  <if test="recordRemarks != null and recordRemarks != ''"> and record_remarks = #{recordRemarks} </if>
-		  		  <if test="stuId != null and stuId != ''"> and stu_id = #{stuId} </if>
-		  		  <if test="schoolId != null and schoolId != ''"> and school_id = #{schoolId} </if>
-		  		</where>
-        <choose>
-            <when test="sort != null and sort.trim() != ''">
-                order by ${sort} ${order}
-            </when>
-			<otherwise>
-                order by record_id desc
-			</otherwise>
-        </choose>
-		<if test="offset != null and limit != null">
-			limit #{offset}, #{limit}
-		</if>
-	</select>
-	
- 	<select id="count" resultType="int">
-		select count(*) from out_in_record
-		 <where>  
-		  		  <if test="recordId != null and recordId != ''"> and record_id = #{recordId} </if>
-		  		  <if test="recordName != null and recordName != ''"> and record_name = #{recordName} </if>
-		  		  <if test="outDate != null and outDate != ''"> and out_date = #{outDate} </if>
-		  		  <if test="inDate != null and inDate != ''"> and in_date = #{inDate} </if>
-		  		  <if test="recordDetails != null and recordDetails != ''"> and record_details = #{recordDetails} </if>
-		  		  <if test="recordRemarks != null and recordRemarks != ''"> and record_remarks = #{recordRemarks} </if>
-		  		  <if test="stuId != null and stuId != ''"> and stu_id = #{stuId} </if>
-		  		  <if test="schoolId != null and schoolId != ''"> and school_id = #{schoolId} </if>
-		  		</where>
-	</select>
-	 
-	<insert id="save" parameterType="com.usoftchina.smartschool.school.po.OutInRecordDO" useGeneratedKeys="true" keyProperty="recordId">
-		insert into out_in_record
-		(
-			`record_name`, 
-			`out_date`, 
-			`in_date`, 
-			`record_details`, 
-			`record_remarks`, 
-			`stu_id`, 
-			`school_id`
-		)
-		values
-		(
-			#{recordName}, 
-			#{outDate}, 
-			#{inDate}, 
-			#{recordDetails}, 
-			#{recordRemarks}, 
-			#{stuId}, 
-			#{schoolId}
-		)
-	</insert>
-	 
-	<update id="update" parameterType="com.usoftchina.smartschool.school.po.OutInRecordDO">
-		update out_in_record 
-		<set>
-			<if test="recordName != null">`record_name` = #{recordName}, </if>
-			<if test="outDate != null">`out_date` = #{outDate}, </if>
-			<if test="inDate != null">`in_date` = #{inDate}, </if>
-			<if test="recordDetails != null">`record_details` = #{recordDetails}, </if>
-			<if test="recordRemarks != null">`record_remarks` = #{recordRemarks}, </if>
-			<if test="stuId != null">`stu_id` = #{stuId}, </if>
-			<if test="schoolId != null">`school_id` = #{schoolId}</if>
-		</set>
-		where record_id = #{recordId}
-	</update>
-	
-	<delete id="remove">
-		delete from out_in_record where record_id = #{value}
-	</delete>
-	
-	<delete id="batchRemove">
-		delete from out_in_record where record_id in 
-		<foreach item="recordId" collection="array" open="(" separator="," close=")">
-			#{recordId}
-		</foreach>
-	</delete>
-
 	<select id="selectOutInRecordDOListByStuId" resultType="com.usoftchina.smartschool.school.po.OutInRecordDO">
 		<include refid="OutInRecordVo"/> where stu_id = #{stuId}
 		order by record_id desc

+ 0 - 70
applications/school/school-server/src/test/java/com/usoftchina/smartschool/school/controller/MessageLogControllerTest.java

@@ -1,70 +0,0 @@
-package com.usoftchina.smartschool.school.controller;
-
-import com.github.pagehelper.PageInfo;
-import com.usoftchina.smartschool.base.Result;
-import com.usoftchina.smartschool.context.BaseContextHolder;
-import com.usoftchina.smartschool.school.dto.DocBaseDTO;
-import com.usoftchina.smartschool.test.BaseControllerTest;
-import com.usoftchina.smartschool.utils.JsonUtils;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-import org.springframework.test.web.servlet.MvcResult;
-
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-@EnableAutoConfiguration
-public class MessageLogControllerTest extends BaseControllerTest {
-
-    private static final String CODE = "Curriculum";
-    private static final String NAME = "课程表";
-
-    @Test
-    public void testA_getListData() throws Exception {
-        BaseContextHolder.setSchoolId(1L);
-        MvcResult mvcResult = mockMvc.perform(get("/messagelog/list"))
-                .andExpect(isSuccess())
-                .andReturn();
-        Result<PageInfo> result = result(mvcResult, PageInfo.class);
-        System.out.println(JsonUtils.toJsonString(result.getData()));
-    }
-
-    @Test
-    public void testB_save() throws Exception {
-        BaseContextHolder.setSchoolId(1L);
-        DocBaseDTO docBaseDTO = new DocBaseDTO(1L, CODE, NAME);
-        mockMvc.perform(requestBody("/messagelog/save", docBaseDTO));
-    }
-
-    @Test
-    public void testC_update() throws Exception {
-        BaseContextHolder.setSchoolId(1L);
-        DocBaseDTO docBaseDTO = new DocBaseDTO(1L, CODE, NAME);
-        mockMvc.perform(requestBody("/messagelog/update", docBaseDTO));
-    }
-
-    @Test
-    public void testD_delete() throws Exception {
-        DocBaseDTO docBaseDTO = new DocBaseDTO(1L, CODE, NAME);
-        BaseContextHolder.setSchoolId(1L);
-        mockMvc.perform(requestBody("/messagelog/delete", docBaseDTO));
-    }
-
-    @Test
-    public void testE_deleteDetail() throws Exception {
-        BaseContextHolder.setSchoolId(1L);
-        DocBaseDTO docBaseDTO = new DocBaseDTO(1L, CODE, NAME);
-        mockMvc.perform(requestBody("/messagelog/deleteDetail", docBaseDTO));
-    }
-
-    @Test
-    public void testF_customizeLog() throws Exception {
-        BaseContextHolder.setSchoolId(1L);
-        DocBaseDTO docBaseDTO = new DocBaseDTO(1L, CODE, NAME);
-        mockMvc.perform(requestBody("/messagelog/customizeLog", docBaseDTO));
-    }
-
-}

+ 0 - 71
applications/school/school-server/src/test/java/com/usoftchina/smartschool/school/service/CurriculumServiceTest.java

@@ -1,71 +0,0 @@
-package com.usoftchina.smartschool.school.service;
-
-import com.github.pagehelper.PageInfo;
-import com.usoftchina.smartschool.context.BaseContextHolder;
-import com.usoftchina.smartschool.page.PageRequest;
-import com.usoftchina.smartschool.school.basic.service.CurriculumService;
-import com.usoftchina.smartschool.school.dto.CurriculumFormDTO;
-import com.usoftchina.smartschool.school.dto.CurriculumListDTO;
-import com.usoftchina.smartschool.school.dto.ListReqDTO;
-import com.usoftchina.smartschool.utils.JsonUtils;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-
-/**
- * @Description
- * @Author chenwei
- * @Date 2019/02/19
- */
-@RunWith(SpringJUnit4ClassRunner.class)
-@SpringBootTest
-@EnableAutoConfiguration
-public class CurriculumServiceTest {
-
-    @Autowired
-    private CurriculumService curriculumService;
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(CurriculumServiceTest.class);
-
-    @Test
-    public void testA_selectAll(){
-        LOGGER.info("===============test selectAll start==============");
-        PageRequest pageRequest = new PageRequest(1, 8);
-        BaseContextHolder.setSchoolId(1);
-        PageInfo<CurriculumListDTO> pageInfo = curriculumService.selectAll(pageRequest, new ListReqDTO());
-        LOGGER.info("pageInfo={}", JsonUtils.toJsonString(pageInfo));
-        LOGGER.info("===============test selectAll end================");
-
-    }
-
-    @Test
-    public void testB_read(){
-        LOGGER.info("===============test read start==============");
-        CurriculumFormDTO curriculumFormDTO = curriculumService.read(1L);
-        LOGGER.info("curriculumFormDTO={}", JsonUtils.toJsonString(curriculumFormDTO));
-        LOGGER.info("===============test read end================");
-    }
-
-    @Test
-    public void testC_save(){
-        LOGGER.info("===============test save start==============");
-        LOGGER.info("===============test save end================");
-    }
-
-    @Test
-    public void testE_delete(){
-        LOGGER.info("===============test delete start==============");
-        LOGGER.info("===============test delete end================");
-    }
-
-    @Test
-    public void testF_deleteDetail(){
-        LOGGER.info("===============test deleteDetail start==============");
-        LOGGER.info("===============test deleteDetail end================");
-    }
-}