Browse Source

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

chenw 6 years ago
parent
commit
9704e10cea

+ 7 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/business/service/impl/HomeWorkServiceImpl.java

@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 import org.springframework.util.StringUtils;
 
+import java.util.Calendar;
 import java.util.List;
 
 /**
@@ -53,10 +54,16 @@ public class HomeWorkServiceImpl implements HomeWorkService{
             //增加推送人(学生)信息
             String studentIds = getNotifer(formdata.getGrade_name(), formdata.getClassz_name(), school_id);
             formdata.setTask_notifier(studentIds);
+            //获取时间
+            Calendar calendar= Calendar.getInstance();
+            formdata.setCreate_date(calendar.getTime());
             homeWorkMapper.insertSelective(formdata);
         } else {
             //更新
             homeWorkMapper.updateByPrimaryKeySelective(formdata);
+            if(formdata.getTask_status()==1){
+                publish(formdata.getTask_id());
+            }
         }
         return new DocBaseDTO(formdata.getTask_id());
     }

+ 10 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/business/service/impl/NoticeServiceImpl.java

@@ -16,6 +16,7 @@ import com.usoftchina.smartschool.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Calendar;
 import java.util.List;
 
 /**
@@ -38,11 +39,17 @@ public class NoticeServiceImpl implements NoticeService{
         //新增
         if (StringUtils.isEmpty(formdata.getNotify_id()) || "0".equals(formdata.getNotify_id().toString())) {
             formdata.setNotify_status(2);
+            //获取时间
+            Calendar calendar= Calendar.getInstance();
+            formdata.setCreate_date(calendar.getTime());
             noticeMapper.insertSelective(formdata);
 
         } else {
             //更新
             noticeMapper.updateByPrimaryKeySelective(formdata);
+            if(formdata.getNotify_status()==1){
+                publish(formdata.getNotify_id());
+            }
         }
         return new DocBaseDTO(formdata.getNotify_id());
     }
@@ -75,6 +82,9 @@ public class NoticeServiceImpl implements NoticeService{
         if (StringUtils.isEmpty(id) || "0".equals(id)) {
             return;
         }
+        if(noticeMapper.noticeStatus(id)>0){
+            throw new BizException(BizExceptionCode.NOTICE_RELEASE_STATUS);
+        }
         noticeMapper.deleteByPrimaryKey(id);
     }
 

+ 2 - 1
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/exception/BizExceptionCode.java

@@ -28,8 +28,9 @@ public enum BizExceptionCode implements BaseExceptionCode {
     REPEAT_CLASS_NAME(600002, "班级名称重复"),
     REPEAT_STUDENT_NUMBER(600003, "学生学号不可重复"),
     EFFECTIVE_CLASS_DATA(600004, "无法删除有学生的班级"),
-    TASK_RELEASE_STATUS(600005, "作业已发布无法更改,您可取消发布"),
+    TASK_RELEASE_STATUS(600005, "作业已发布无法更改"),
     COURSE_RELEASE_STATUS(600006, "课程表已生效,无法删除"),
+    NOTICE_RELEASE_STATUS(600007, "学校发布已生效,无法删除"),
     ILLEGAL_Gender(600007, "性别非法"),
     ILLEGAL_MARRIAGE(600008, "婚姻状态非法"),
     NOT_EXISTS_SUBJECT(60005, "科目<u>%s</u>不存在");

+ 2 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/mapper/NoticeMapper.java

@@ -26,4 +26,6 @@ public interface NoticeMapper {
     List<Notify> selectByConditon(@Param("con") String con, @Param("school_id") Long schoolId);
 
     int updateByPublish(Long notify_id);
+
+    int noticeStatus(Long id);
 }

+ 4 - 0
applications/school/school-server/src/main/resources/mapper/NotifyMapper.xml

@@ -221,4 +221,8 @@
       publish_date = now()
     where notify_id = #{notify_id,jdbcType=BIGINT}
   </update>
+
+    <select id="noticeStatus" parameterType="long" resultType="int">
+    select count(1) from notify where notify_status=1 and notify_id=#{id}
+  </select>
 </mapper>