소스 검색

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

chenw 6 년 전
부모
커밋
b4f4929b8f
15개의 변경된 파일131개의 추가작업 그리고 49개의 파일을 삭제
  1. 5 3
      applications/device/device-client/src/main/java/com/usoftchina/smartschool/device/client/listener/AccessControlListener.java
  2. 7 17
      applications/device/device-sdk-dahua/src/main/java/com/usoftchina/smartschool/device/dahua/lib/DahuaLibrary.java
  3. 10 10
      applications/device/device-sdk-dahua/src/main/java/com/usoftchina/smartschool/device/dahua/service/DahuaDataAnalyzeService.java
  4. 1 1
      applications/device/device-sdk-dahua/src/main/java/com/usoftchina/smartschool/device/dahua/service/DahuaDeviceService.java
  5. 7 6
      applications/device/device-sdk/src/main/java/com/usoftchina/smartschool/device/event/AccessControlEvent.java
  6. 6 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/GradeServiceImpl.java
  7. 1 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/exception/BizExceptionCode.java
  8. 1 4
      applications/school/school-server/src/main/resources/application.yml
  9. 4 1
      applications/school/school-server/src/main/resources/config/application-dev.yml
  10. 11 1
      frontend/pc-web/app/view/Interaction/timetable/List.js
  11. 68 0
      frontend/pc-web/app/view/Interaction/timetable/ListController.js
  12. 5 3
      frontend/pc-web/app/view/core/form/field/FileField.js
  13. 1 0
      frontend/pc-web/app/view/core/form/field/RemoteImgField.js
  14. 1 1
      frontend/wechat-web/src/modules/hiPages/scorenotification/ScoreNotification.js
  15. 3 2
      frontend/wechat-web/src/modules/homework/ReleaseAssignmentPage.js

+ 5 - 3
applications/device/device-client/src/main/java/com/usoftchina/smartschool/device/client/listener/AccessControlListener.java

@@ -3,6 +3,7 @@ package com.usoftchina.smartschool.device.client.listener;
 import com.usoftchina.smartschool.device.client.po.AccessControl;
 import com.usoftchina.smartschool.device.client.service.AccessControlService;
 import com.usoftchina.smartschool.device.dto.AccessControlInfo;
+import com.usoftchina.smartschool.device.dto.DeviceInfo;
 import com.usoftchina.smartschool.device.event.AccessControlEvent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -31,15 +32,16 @@ public class AccessControlListener {
     @EventListener(AccessControlEvent.class)
     public void onAccessControlEvent(AccessControlEvent event) {
         AccessControlInfo info = event.getAccessControlInfo();
-        AccessControl accessControl = accessControlService.findById(event.getDeviceId());
+        DeviceInfo device = event.getDevice();
+        AccessControl accessControl = accessControlService.findById(device.getId());
         // 通过门禁设备绑定的访问类型,来设置本次事件的访问类型
         if (accessControl.isEntryType()) {
             info.setEventType(AccessControlInfo.EventType.ENTRY);
         } else {
             info.setEventType(AccessControlInfo.EventType.EXIT);
         }
-        if(logger.isDebugEnabled()) {
-            logger.debug(info.toString());
+        if (logger.isDebugEnabled()) {
+            logger.debug("Device[{}] Port[{}] AccessControlEvent[{}]", device.getIp(), device.getPort(), info.toString());
         }
         try {
             accessControlService.saveRecord(info);

+ 7 - 17
applications/device/device-sdk-dahua/src/main/java/com/usoftchina/smartschool/device/dahua/lib/DahuaLibrary.java

@@ -1467,30 +1467,20 @@ public interface DahuaLibrary extends Library {
         public String toString() {
             return "DEV_EVENT_ACCESS_CTL_INFO{" +
                     "nChannelID=" + nChannelID +
-                    ", szName=" + new String(szName) +
+                    ", szName=" + new String(szName).trim() +
                     ", PTS=" + PTS +
                     ", UTC=" + UTC +
                     ", nEventID=" + nEventID +
-                    ", stuObject=" + stuObject +
-                    ", stuFileInfo=" + stuFileInfo +
                     ", emEventType=" + emEventType +
                     ", bStatus=" + bStatus +
                     ", emCardType=" + emCardType +
                     ", emOpenMethod=" + emOpenMethod +
-                    ", szCardNo=" + new String(szCardNo) +
-                    ", szPwd=" + new String(szPwd) +
-                    ", szReaderID=" + new String(szReaderID) +
-                    ", szUserID=" + new String(szUserID) +
-                    ", szSnapURL=" + new String(szSnapURL) +
-                    ", nErrorCode=" + nErrorCode +
-                    ", nPunchingRecNo=" + nPunchingRecNo +
-                    ", nNumbers=" + nNumbers +
-                    ", byImageIndex=" + byImageIndex +
-                    ", dwSnapFlagMask=" + dwSnapFlagMask +
-                    ", emAttendanceState=" + emAttendanceState +
-                    ", szClassNumber=" + new String(szClassNumber) +
-                    ", szPhoneNumber=" + new String(szPhoneNumber) +
-                    ", szCardName=" + new String(szCardName, DEFAULT_CHARSET) +
+                    ", szCardNo=" + new String(szCardNo).trim() +
+                    ", szUserID=" + new String(szUserID).trim() +
+                    ", szSnapURL=" + new String(szSnapURL).trim() +
+                    ", szClassNumber=" + new String(szClassNumber).trim() +
+                    ", szPhoneNumber=" + new String(szPhoneNumber).trim() +
+                    ", szCardName=" + new String(szCardName, DEFAULT_CHARSET).trim() +
                     ", uSimilarity=" + (uSimilarity & 0x0ffffffff) +
                     '}';
         }

+ 10 - 10
applications/device/device-sdk-dahua/src/main/java/com/usoftchina/smartschool/device/dahua/service/DahuaDataAnalyzeService.java

@@ -9,6 +9,7 @@ import com.usoftchina.smartschool.device.dahua.lib.DahuaLibrary.*;
 import com.usoftchina.smartschool.device.dahua.lib.DahuaSdk;
 import com.usoftchina.smartschool.device.dahua.lib.DahuaSdkException;
 import com.usoftchina.smartschool.device.dto.AccessControlInfo;
+import com.usoftchina.smartschool.device.dto.DeviceInfo;
 import com.usoftchina.smartschool.device.event.AccessControlEvent;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -39,14 +40,14 @@ public class DahuaDataAnalyzeService {
     /**
      * 启动智能数据监听
      *
-     * @param deviceId 门禁设备ID
+     * @param device 门禁设备
      * @param loginHandle 登录句柄
      */
-    public void startListen(String deviceId, NativeLong loginHandle) {
+    public void startListen(DeviceInfo device, NativeLong loginHandle) {
         long key = loginHandle.longValue();
         if (key != 0 && !analyzerHandles.containsKey(key)) {
             NativeLong lAnalyzerHandle = sdk.getInstance().CLIENT_RealLoadPictureEx(loginHandle, 0,
-                    DahuaEvents.EVENT_IVS_ALL, true, new AnalyzerDataCallBack(deviceId),
+                    DahuaEvents.EVENT_IVS_ALL, true, new AnalyzerDataCallBack(device),
                     new NativeLong(), null);
             analyzerHandles.put(key, lAnalyzerHandle);
         }
@@ -56,11 +57,11 @@ public class DahuaDataAnalyzeService {
      * 智能分析数据回调
      */
     class AnalyzerDataCallBack implements fAnalyzerDataCallBack {
-        private final String deviceId;
+        private final DeviceInfo device;
 
-        public AnalyzerDataCallBack(String deviceId) {
+        public AnalyzerDataCallBack(DeviceInfo device) {
             super();
-            this.deviceId = deviceId;
+            this.device = device;
         }
 
         @Override
@@ -73,18 +74,17 @@ public class DahuaDataAnalyzeService {
                 case DahuaEvents.EVENT_IVS_ACCESS_CTL:
                     DEV_EVENT_ACCESS_CTL_INFO info = new DEV_EVENT_ACCESS_CTL_INFO(pAlarmInfo);
                     if (logger.isDebugEnabled()) {
-                        logger.debug(info.toString());
+                        logger.debug("Device[{}] Port[{}] CallBack[{}]", device.getIp(), device.getPort(), info.toString());
                     }
                     AccessControlInfo accessControlInfo = new AccessControlInfo();
                     if (dwBufSize > 0) {
                         accessControlInfo.setImageData(pBuffer.getByteArray(0, dwBufSize));
                     }
-                    accessControlInfo.setCardNo(new String(info.szCardNo));
+                    accessControlInfo.setCardNo(new String(info.szCardNo).trim());
                     accessControlInfo.setEventType(convertEventType(info.emEventType));
                     accessControlInfo.setOpenMethod(convertOpenMethod(info.emOpenMethod));
                     accessControlInfo.setEventTime(info.UTC.toDate());
-                    SpringContextHolder.getContext().publishEvent(new AccessControlEvent(this,
-                            deviceId, accessControlInfo));
+                    SpringContextHolder.getContext().publishEvent(new AccessControlEvent(this, device, accessControlInfo));
                     // 其他地方可通过监听 AccessControlEvent 来扩展
                     break;
                 /**

+ 1 - 1
applications/device/device-sdk-dahua/src/main/java/com/usoftchina/smartschool/device/dahua/service/DahuaDeviceService.java

@@ -44,7 +44,7 @@ public class DahuaDeviceService implements DeviceApi {
             NativeLong loginHandle = login(info.getIp(), info.getPort(), info.getUsername(), info.getPassword());
             loginHandles.put(id, loginHandle);
             // 开启智能事件监听
-            dataAnalyzeService.startListen(info.getId(), loginHandle);
+            dataAnalyzeService.startListen(info, loginHandle);
         }
     }
 

+ 7 - 6
applications/device/device-sdk/src/main/java/com/usoftchina/smartschool/device/event/AccessControlEvent.java

@@ -1,6 +1,7 @@
 package com.usoftchina.smartschool.device.event;
 
 import com.usoftchina.smartschool.device.dto.AccessControlInfo;
+import com.usoftchina.smartschool.device.dto.DeviceInfo;
 import org.springframework.context.ApplicationEvent;
 
 /**
@@ -11,22 +12,22 @@ import org.springframework.context.ApplicationEvent;
  */
 public class AccessControlEvent extends ApplicationEvent {
 
-    private final String deviceId;
+    private final DeviceInfo device;
     private final AccessControlInfo accessControlInfo;
 
-    public AccessControlEvent(Object source, String deviceId, AccessControlInfo accessControlInfo) {
+    public AccessControlEvent(Object source, DeviceInfo device, AccessControlInfo accessControlInfo) {
         super(source);
-        this.deviceId = deviceId;
+        this.device = device;
         this.accessControlInfo = accessControlInfo;
     }
 
     /**
-     * 产生事件的门禁设备ID
+     * 产生事件的门禁设备
      *
      * @return
      */
-    public String getDeviceId() {
-        return deviceId;
+    public DeviceInfo getDevice() {
+        return device;
     }
 
     public AccessControlInfo getAccessControlInfo() {

+ 6 - 0
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/GradeServiceImpl.java

@@ -159,6 +159,12 @@ public class GradeServiceImpl implements GradeService{
                 throw new BizException(12345, err.toString());
             }
             for (SysClazz  cla : clazzes) {
+                Integer check = 0;
+                //检测班级
+                check = sysClazzMapper.countClazz(cla.getClazz_name(), cla.getClazz_grade() ,schoolId);
+                if (check > 0) {
+                    throw new BizException(BizExceptionCode.EXISTS_CLAZZ);
+                }
                 sysClazzMapper.insertSelective(cla);
             }
             dataImportMapper.updateDataImport(id);

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

@@ -23,6 +23,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     EXISTS_TEACHER_CLASS(500006,"存在任课班级,无法删除"),
     TEACHERS_EXISTS_CLASS(500006,"%s存在任课班级,无法删除"),
     EXISTS_SUBJECT(500007,"科目已存在"),
+    EXISTS_CLAZZ(500008,"班级可能存在重复"),
     EXISTS_SUBJECT_TEACHER(5000012, "该课程存在班级与任课教师,禁止删除"),
     EXISTS_SCORE_PUBLISH(5000013, "存在已发布成绩,禁止删除"),
     EXISTS_CLASS(500011, "存在班级,无法删除"),

+ 1 - 4
applications/school/school-server/src/main/resources/application.yml

@@ -90,7 +90,4 @@ hystrix:
                         timeoutInMilliseconds: 4000
 smartschool:
   domain:
-    wechat: https://school-wechat.ubtob.com
-logging:
-  level:
-    com.usoftchina.smartschool.school: debug
+    wechat: https://school-wechat.ubtob.com

+ 4 - 1
applications/school/school-server/src/main/resources/config/application-dev.yml

@@ -12,4 +12,7 @@ eureka:
       defaultZone: http://${spring.security.user.name}:${spring.security.user.password}@127.0.0.1:9500/eureka/
 smartschool:
   domain:
-    wechat: https://school-wechat.ubtob.com
+    wechat: https://school-wechat.ubtob.com
+logging:
+  level:
+    com.usoftchina.smartschool.school: debug

+ 11 - 1
frontend/pc-web/app/view/Interaction/timetable/List.js

@@ -168,6 +168,13 @@ Ext.define('school.view.interaction.timetable.List', {
                         var g = me.down('grid');
                         g.store.loadPage(g.store.currentPage);
                     }
+                }, {
+                    xtype: 'button',
+                    text: '发布',
+                    type: 'publish',
+                    path: 'batchPublish',
+                    reference: 'publish',
+                    handler: 'onPublishClick'
                 }, {
                     xtype: 'button',
                     text: '删除',
@@ -246,7 +253,10 @@ Ext.define('school.view.interaction.timetable.List', {
                     renderer: function(v) {
                         return v == '1' ? '已生效' : '未生效'
                     }
-                }]
+                }],
+                listeners: {
+                    selectionchange: 'selectionchange'
+                }
             },
         });
         this.callParent(arguments);

+ 68 - 0
frontend/pc-web/app/view/Interaction/timetable/ListController.js

@@ -4,5 +4,73 @@ Ext.define('school.view.interaction.timetable.ListController', {
 
     onAddClick: function() {
         school.util.BaseUtil.openTab('interaction-timetable-detail', '新增课程表', 'interaction-timetable-detail-add'); 
+    },
+
+    selectionchange: function(table, selected, eOpts) {
+        let me = this,
+        refs = me.getReferences(),
+        btn = refs.publish,
+        type = btn.type;
+
+        btn.setDisabled(false);
+        if(selected.length == 1) {
+            btn.setText(selected[0].get('status') == '1' ? '取消发布' : '发布');
+            btn.type = (selected[0].get('status') == '1' ? 'republish' : 'publish');
+            btn.path = (selected[0].get('status') == '1' ? 'batchRepublish' : 'batchPublish');
+            return;
+        }else if(selected.length == 0) {
+            btn.setText('发布');
+            btn.type = 'publish';
+            btn.path = 'batchPublish';
+            return;
+        }else {
+            for(let i = 0; i < selected.length; i++) {
+                let s = selected[i];
+                if((s.get('status') == '1' && type == 'publish') || (s.get('status') == '0' && type == 'republish')) {
+                    btn.setDisabled(true);
+                    return;
+                }
+            }
+        }
+    },
+
+    onPublishClick: function() {
+        let me = this,
+        view = me.getView(),
+        grid = view.down('grid'),
+        selectedRecords = grid.getSelection(),
+        refs = me.getReferences(),
+        btn = refs.publish,
+        path = btn.path,
+        data;
+
+        data = selectedRecords.map(function (r) {
+            return {
+                id: r.get('id')
+            };
+        });
+
+        if (data.length == 0) {
+            school.util.BaseUtil.showErrorToast('请先勾选需要发布的记录');
+            return;
+        }
+
+        grid.setLoading(true);
+        school.util.BaseUtil.request({
+            // url: 'http://10.1.80.36:9520/api/school/curriculum/batchDelete',
+            url: '/api/school/curriculum/' + path,
+            method: 'POST',
+            params: JSON.stringify({
+                baseDTOs: data
+            })
+        }).then(function (res) {
+            grid.setLoading(false);
+            school.util.BaseUtil.showSuccessToast('操作成功');
+            grid.store.loadPage(grid.store.currentPage);
+            grid.getSelectionModel().deselectAll();
+        }).catch(function (e) {
+            grid.setLoading(false);
+            school.util.BaseUtil.showErrorToast('操作失败: ' + e.message);
+        });
     }
 });

+ 5 - 3
frontend/pc-web/app/view/core/form/field/FileField.js

@@ -121,13 +121,15 @@ Ext.define('school.view.core.form.field.FileField', {
 						});
 						me.add(field);
 						var oldValue = me.value;
-						var arr = oldValue ? oldValue.replace(/[ \[ | \] ]/g, '').split(',') : [];
+						var arr = oldValue ? oldValue.replace(/[ \[ | \" | \" | \] ]/g, '').split(',') : [];
 						arr.push(data.accessPath);
-						var val = '[' + arr.join(',') + ']';
+						var val = '["' + arr.join(',') + '"]';
 						me.setValue(val);
 					}
+					field.reset();
 				}else{
 					school.util.BaseUtil.showErrorToast('上传失败: ' + res.message);
+					field.reset();
 				}
 			},
 			failure: function (response, opts) {
@@ -150,7 +152,7 @@ Ext.define('school.view.core.form.field.FileField', {
 			url : '/api/file/info',
 			async: false,
 			params: {
-				accessPath:  paths.replace(/[ \[ | \] ]/g, '')
+				accessPath:  paths.replace(/[ \[ | \" | \" | \] ]/g, '')
 			},
 			method : 'GET',
 			callback : function(options,success,response){

+ 1 - 0
frontend/pc-web/app/view/core/form/field/RemoteImgField.js

@@ -192,6 +192,7 @@ Ext.define('school.view.core.form.field.RemoteImgField', {
             if(yes == 'yes') {
                 imgPath.setValue(null);
                 img.setSrc(null);
+                fileField.reset();
                 fileField.setHidden(false);
                 img.setHidden(true);
         

+ 1 - 1
frontend/wechat-web/src/modules/hiPages/scorenotification/ScoreNotification.js

@@ -92,7 +92,7 @@ class ScoreNotification extends Component {
         console.log('params', params)
         fetchPost(API.getScoreByStu, params, {})
             .then((response) => {
-                if (response.success && response.data && response.data[0].schoolAverage != "NaN") {
+                if (response.success && !isObjEmpty(response.data) && response.data[0].schoolAverage != "NaN") {
                     if (pageIndex == 1) {
                         this.setState({
                             ScoreDataList: response.data

+ 3 - 2
frontend/wechat-web/src/modules/homework/ReleaseAssignmentPage.js

@@ -150,7 +150,7 @@ class ReleaseAssignmentPage extends React.Component {
 
         Toast.loading('正在发布...', 0)
         const params = {
-            subjectId: 1,
+            subjectId: courseValue[0],
             taskTitle: taskTitle,
             taskContext: taskContent,
             taskFiles: JSON.stringify(fileUrls),
@@ -281,6 +281,7 @@ class ReleaseAssignmentPage extends React.Component {
     }
 
     handleCourseChange = (v) => {
+        console.log(v)
         this.setState({courseValue: v})
     }
 
@@ -364,7 +365,7 @@ class ReleaseAssignmentPage extends React.Component {
                         subjectBean.subjectName = getStrValue(dataObject, 'subjectName')
                         subjectBean.subjectStatus = getStrValue(dataObject, 'subjectStatus')
                         subjectBean.schoolId = getStrValue(dataObject, 'schoolId')
-                        subjectBean.value = i
+                        subjectBean.value = getStrValue(dataObject, 'subjectId')
 
                         courseList.push(subjectBean)
                     }