Browse Source

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

koul 6 years ago
parent
commit
0e9d459b71
25 changed files with 124 additions and 69 deletions
  1. 46 4
      applications/device/device-client/pom.xml
  2. 2 0
      applications/device/device-client/src/main/java/com/usoftchina/smartschool/device/client/init/IcCardInitializer.java
  3. 24 22
      applications/device/device-client/src/main/java/com/usoftchina/smartschool/device/client/service/IcCardService.java
  4. 15 0
      applications/device/device-client/src/main/resources/banner.txt
  5. BIN
      applications/device/device-client/src/main/resources/icon.ico
  6. BIN
      applications/device/device-client/src/main/winserver/deviceclient.exe
  7. 0 14
      applications/device/device-client/src/main/winserver/deviceclient.xml
  8. BIN
      applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libInfra.so
  9. BIN
      applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libNetFramework.so
  10. BIN
      applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libStream.so
  11. BIN
      applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libStreamSvr.so
  12. BIN
      applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libavnetsdk.so
  13. BIN
      applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libdhconfigsdk.so
  14. BIN
      applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libdhnetsdk.so
  15. 0 1
      applications/device/device-sdk-dahua/src/main/resources/linux-amd64/manifest.txt
  16. 1 1
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/AccessControlController.java
  17. 4 2
      applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/mapper/AccessControlRecordMapper.java
  18. 4 1
      applications/device/device-server/src/main/resources/application.yml
  19. 4 0
      applications/device/device-server/src/main/resources/mapper/AccessControlRecordMapper.xml
  20. 2 2
      applications/device/device-server/src/main/resources/mapper/StudentInfoMapper.xml
  21. 2 0
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/CurriculumServiceImpl.java
  22. 2 2
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/TeacherServiceImpl.java
  23. 1 1
      applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/exception/BizExceptionCode.java
  24. 17 15
      applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/ReceiveService.java
  25. 0 4
      frontend/pc-web/resources/json/navigation.json

+ 46 - 4
applications/device/device-client/pom.xml

@@ -39,13 +39,13 @@
         </dependency>
         <!-- JSON -->
         <dependency>
-          <groupId>com.alibaba</groupId>
-          <artifactId>fastjson</artifactId>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
         </dependency>
         <!-- httpClient -->
         <dependency>
-          <groupId>org.apache.httpcomponents</groupId>
-          <artifactId>httpclient</artifactId>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
         </dependency>
     </dependencies>
     <build>
@@ -54,6 +54,48 @@
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
             </plugin>
+            <plugin>
+                <groupId>com.akathist.maven.plugins.launch4j</groupId>
+                <artifactId>launch4j-maven-plugin</artifactId>
+                <version>1.7.25</version>
+                <executions>
+                    <execution>
+                        <id>l4j</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>launch4j</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <jar>${project.build.directory}/${artifactId}-${version}.jar</jar>
+                    <headerType>console</headerType>
+                    <outfile>${project.build.directory}/device-client.exe</outfile>
+                    <downloadUrl>http://java.com/download</downloadUrl>
+                    <classPath>
+                        <mainClass>org.springframework.boot.loader.JarLauncher</mainClass>
+                    </classPath>
+                    <icon>src/main/resources/icon.ico</icon>
+                    <stayAlive>true</stayAlive>
+                    <restartOnCrash>true</restartOnCrash>
+                    <jre>
+                        <minVersion>1.8.0</minVersion>
+                        <jdkPreference>preferJre</jdkPreference>
+                    </jre>
+                    <versionInfo>
+                        <fileVersion>1.0.0.0</fileVersion>
+                        <txtFileVersion>${project.version}</txtFileVersion>
+                        <fileDescription>${project.name}</fileDescription>
+                        <copyright>2018 usoftchina.com</copyright>
+                        <productVersion>1.0.0.0</productVersion>
+                        <txtProductVersion>1.0.0.0</txtProductVersion>
+                        <productName>${project.name}</productName>
+                        <companyName>usoftchina.com</companyName>
+                        <internalName>device-client</internalName>
+                        <originalFilename>device-client.exe</originalFilename>
+                    </versionInfo>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
 </project>

+ 2 - 0
applications/device/device-client/src/main/java/com/usoftchina/smartschool/device/client/init/IcCardInitializer.java

@@ -5,11 +5,13 @@ import com.usoftchina.smartschool.device.client.po.IcCard;
 import com.usoftchina.smartschool.device.client.service.IcCardService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.CommandLineRunner;
+import org.springframework.stereotype.Component;
 
 /**
  * @author yingp
  * @date 2019/3/11
  */
+@Component
 public class IcCardInitializer implements CommandLineRunner {
 
     @Autowired

+ 24 - 22
applications/device/device-client/src/main/java/com/usoftchina/smartschool/device/client/service/IcCardService.java

@@ -57,7 +57,7 @@ public class IcCardService {
             + "from XF_AccTransDetail_push left join XF_AccHead on XF_AccTransDetail_push.AccNo=XF_AccHead.AccNo left join Tx_EmpCard on Tx_EmpCard.CardID=XF_AccHead.CardID "
             + "left join RS_EMP ON RS_EMP.EmpSysID=XF_AccHead.EmpSysID where XF_AccTransDetail_push.SendStatus=? order by AccTransDay desc";
 
-    private static final String updateSql = "update XF_AccTransDetail_push set SendStatus = ? where GUID in (?)";
+    private static final String updateSql = "update XF_AccTransDetail_push set SendStatus = ? where GUID in (";
 
     public IcCard find() {
         return icCardRepository.find();
@@ -82,39 +82,41 @@ public class IcCardService {
         if (null != card && dynamicDataSourceRegister.contains(card) && null != school) {
             DynamicDataSourceContextHolder.set(card);
             try {
-                doTask();
+                doTask(school.getName());
             } finally {
                 DynamicDataSourceContextHolder.clear();
             }
         }
     }
 
-    private void doTask(){
+    private void doTask(String schoolName){
         //1.准备本次需要传输的数据->转移至中间表
         jdbcTemplate.execute(insertSql);
         //2.获取本次传输的数据
         List<AccTransDetail> resultList = jdbcTemplate.query(getDataSql, new BeanPropertyRowMapper<>(AccTransDetail.class), "待上传");
-        //3.传输
-        HttpHeaders headers = new HttpHeaders();
-        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
-        MultiValueMap<String, String> requestEntity = new LinkedMultiValueMap<>();
-        requestEntity.add("data", JSON.toJSONString(resultList));
-        requestEntity.add("school", schoolService.find().getName());
-        HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(requestEntity, headers);
-        ResponseEntity<Result> response = restTemplate.postForEntity(targetURL, resultList, Result.class);
-        if (response.getStatusCode() == HttpStatus.OK) {
-            Result<String> result = response.getBody();
-            if (!result.isSuccess()) {
-                ExceptionCode.ERROR_UNKNOWN.occur(result.getMessage());
-            }else {
-                //更新发送的数据
-                String ids = result.getData();
-                if (!StringUtils.isEmpty(ids)){
-                    jdbcTemplate.update(updateSql, "已上传", ids);
+        if (resultList.size() > 0) {
+            //3.传输
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
+            MultiValueMap<String, String> requestEntity = new LinkedMultiValueMap<>();
+            requestEntity.add("data", JSON.toJSONString(resultList));
+            requestEntity.add("school", schoolName);
+            HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(requestEntity, headers);
+            ResponseEntity<Result> response = restTemplate.postForEntity(targetURL, httpEntity, Result.class);
+            if (response.getStatusCode() == HttpStatus.OK) {
+                Result<String> result = response.getBody();
+                if (!result.isSuccess()) {
+                    ExceptionCode.ERROR_UNKNOWN.occur(result.getMessage());
+                } else {
+                    //更新发送的数据
+                    String ids = result.getData();
+                    if (!StringUtils.isEmpty(ids)) {
+                        jdbcTemplate.update(updateSql + ids + ")", "已上传");
+                    }
                 }
+            } else {
+                ExceptionCode.ERROR_UNKNOWN.occur("IC卡消费记录发送失败");
             }
-        } else {
-            ExceptionCode.ERROR_UNKNOWN.occur("IC卡消费记录发送失败");
         }
     }
 }

+ 15 - 0
applications/device/device-client/src/main/resources/banner.txt

@@ -0,0 +1,15 @@
+${AnsiColor.BRIGHT_YELLOW}
+
+88        88   ad88888ba     ,ad8888ba,    88888888888  888888888888  ,ad8888ba,   88        88  88  888b      88         db
+88        88  d8"     "8b   d8"'    `"8b   88                88      d8"'    `"8b  88        88  88  8888b     88        d88b
+88        88  Y8,          d8'        `8b  88                88     d8'            88        88  88  88 `8b    88       d8'`8b
+88        88  `Y8aaaaa,    88          88  88aaaaa           88     88             88aaaaaaaa88  88  88  `8b   88      d8'  `8b
+88        88    `"""""8b,  88          88  88"""""           88     88             88""""""""88  88  88   `8b  88     d8YaaaaY8b
+88        88          `8b  Y8,        ,8P  88                88     Y8,            88        88  88  88    `8b 88    d8""""""""8b
+Y8a.    .a8P  Y8a     a8P   Y8a.    .a8P   88                88      Y8a.    .a8P  88        88  88  88     `8888   d8'        `8b
+ `"Y8888Y"'    "Y88888P"     `"Y8888Y"'    88                88       `"Y8888Y"'   88        88  88  88      `888  d8'          `8b
+
+
+Application Version: ${application.version}${application.formatted-version}
+Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version}
+${AnsiColor.DEFAULT}

BIN
applications/device/device-client/src/main/resources/icon.ico


BIN
applications/device/device-client/src/main/winserver/deviceclient.exe


+ 0 - 14
applications/device/device-client/src/main/winserver/deviceclient.xml

@@ -1,14 +0,0 @@
-<service>
-    <id>deviceclient</id>
-    <name>device client</name>
-    <description>client server for smart school platform</description>
-    <!-- java环境变量 -->
-    <env name="JAVA_HOME" value="%JAVA_HOME%"/>
-    <executable>java</executable>
-    <arguments>-jar "E:\springboot\ test.jar"</arguments>
-    <!-- 开机启动 -->
-    <startmode>Automatic</startmode>
-    <!-- 日志配置 -->
-    <logpath>%BASE%\log</logpath>
-    <logmode>rotate</logmode>
-</service>

BIN
applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libInfra.so


BIN
applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libNetFramework.so


BIN
applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libStream.so


BIN
applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libStreamSvr.so


BIN
applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libavnetsdk.so


BIN
applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libdhconfigsdk.so


BIN
applications/device/device-sdk-dahua/src/main/resources/linux-amd64/libdhnetsdk.so


+ 0 - 1
applications/device/device-sdk-dahua/src/main/resources/linux-amd64/manifest.txt

@@ -1 +0,0 @@
-libavnetsdk.so,libdhconfigsdk.so,libdhnetsdk.so,libInfra.so,libNetFramework.so,libStream.so,libStreamSvr.so

+ 1 - 1
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/controller/AccessControlController.java

@@ -58,7 +58,7 @@ public class AccessControlController {
      * @return
      */
     @PostMapping("/event")
-    public Result onAccessControlEvent(AccessControlInfo info) {
+    public Result onAccessControlEvent(@RequestBody AccessControlInfo info) {
         accessControlService.onAccessControlEvent(info);
         return Result.success();
     }

+ 4 - 2
applications/device/device-server/src/main/java/com/usoftchina/smartschool/device/mapper/AccessControlRecordMapper.java

@@ -1,7 +1,9 @@
 package com.usoftchina.smartschool.device.mapper;
 
+import com.netflix.ribbon.proxy.annotation.ClientProperties;
 import com.usoftchina.smartschool.device.po.AccessControlRecord;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.Date;
 import java.util.List;
@@ -22,6 +24,6 @@ public interface AccessControlRecordMapper {
      * @param endDate
      * @return
      */
-    List<AccessControlRecord> selectByStuNumberAndDate(String stuNumber, Date beginDate,
-                                                     Date endDate);
+    List<AccessControlRecord> selectByStuNumberAndDate(@Param("name") String stuNumber,@Param("begin") Date beginDate,
+                                                       @Param("end") Date endDate);
 }

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

@@ -73,4 +73,7 @@ hystrix:
                         timeoutInMilliseconds: 4000
 mybatis:
   type-aliases-package: com.usoftchina.smartschool.device.po
-  mapper-locations: classpath:mapper/*.xml
+  mapper-locations: classpath:mapper/*.xml
+smartschool:
+  wechat:
+    pushUrl: https://school-api.ubtob.com/api/wechat/send/Messages

+ 4 - 0
applications/device/device-server/src/main/resources/mapper/AccessControlRecordMapper.xml

@@ -106,4 +106,8 @@
         </trim>
     </insert>
 
+    <select id="selectByStuNumberAndDate" resultType="com.usoftchina.smartschool.device.po.AccessControlRecord">
+        select * from  out_in_record where  stu_name=#{name}
+    </select>
+
 </mapper>

+ 2 - 2
applications/device/device-server/src/main/resources/mapper/StudentInfoMapper.xml

@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.usoftchina.smartschool.device.mapper.AccessControlRecordMapper" >
+<mapper namespace="com.usoftchina.smartschool.device.mapper.StudentInfoMapper" >
     <select id="selectInfoByCardNo" parameterType="string" resultMap="studentInfo">
         select school_appid,school_secret,sys_parents.openid,sys_student.stu_name,sys_student.stu_id,sys_school.school_id,
          stu_number,sys_student.clazz_id,stu_class,stu_grade,stu_classnickname,stu_sex from sys_student left join sys_school on sys_student.school_id=sys_school.school_id
         left join sys_parents_stu on sys_student.stu_id=sys_parents_stu.stu_id left join sys_parents on sys_parents.parent_id =
-        sys_parents_stu.parent_id where stu_cardNo = #{cardNo}
+        sys_parents_stu.parent_id where stu_cardNo = #{cardNo} and  ifnull(openid,'') != ''
     </select>
 
     <resultMap id="studentInfo" type="com.usoftchina.smartschool.device.po.StudentInfo" >

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

@@ -175,6 +175,8 @@ public class CurriculumServiceImpl implements CurriculumService {
                     if (curriculumDetailDTO.getId() != null && 0 != curriculumDetailDTO.getId()) {
                         updateList.add(curriculumDetailDTO);
                     } else {
+                        curriculumDetailDTO.setmId(main.getId());
+                        curriculumDetailDTO.setStatus(0);
                         insertList.add(curriculumDetailDTO);
                     }
                 }

+ 2 - 2
applications/school/school-server/src/main/java/com/usoftchina/smartschool/school/basic/service/impl/TeacherServiceImpl.java

@@ -146,9 +146,9 @@ public class TeacherServiceImpl implements TeacherService{
 
                         if ("已婚".equals(json.get("teacher_marriage"))) {
                             json.put("teacher_marriage", 0);
-                        }else if ("".equals(json.get("teacher_marriage"))) {
+                        }else if ("未婚".equals(json.get("teacher_marriage"))) {
                             json.put("teacher_marriage", 1);
-                        }else if (!"已婚".equals(json.get("teacher_marriage")) && !"".equals(json.get("teacher_marriage"))) {
+                        }else if (!"已婚".equals(json.get("teacher_marriage")) && !"未婚".equals(json.get("teacher_marriage"))) {
                             throw new BizException(BizExceptionCode.ILLEGAL_MARRIAGE);
                         }
                     }

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

@@ -33,7 +33,7 @@ public enum BizExceptionCode implements BaseExceptionCode {
     COURSE_RELEASE_STATUS(600006, "课程表已生效,无法删除"),
     NOTICE_RELEASE_STATUS(600007, "学校通知已生效,无法删除"),
     ILLEGAL_Gender(600007, "无效性别"),
-    ILLEGAL_MARRIAGE(600008, "婚姻状态无效"),
+    ILLEGAL_MARRIAGE(600008, "婚姻状态无效,应为:已婚或未婚"),
     NOT_EXISTS_SUBJECT(60005, "科目<u>%s</u>不存在");
 
 

+ 17 - 15
applications/wechat/wechat-server/src/main/java/com/usoftchina/smartschool/wechat/service/ReceiveService.java

@@ -60,23 +60,25 @@ public class ReceiveService {
         Result result = null;
         //记录发送失败次数
         int count = 0;
-        for (MessageInfo msg : data) {
-            if (!msg.getSend()) {
-                //处理openid,如果不存在openid,则直接忽略
-                //getOpenId(msg);
-                result = wxPushService.wechatPush(msg);
-                if (result.isSuccess()) {
-                    msg.setSend(true);
-                } else {
-                    msg.setReason(result.getMessage());
-                    count ++;
+        if (null != data) {
+            for (MessageInfo msg : data) {
+                if (!msg.getSend()) {
+                    //处理openid,如果不存在openid,则直接忽略
+                    //getOpenId(msg);
+                    result = wxPushService.wechatPush(msg);
+                    if (result.isSuccess()) {
+                        msg.setSend(true);
+                    } else {
+                        msg.setReason(result.getMessage());
+                        count++;
+                    }
                 }
             }
-        }
-        //存在发送失败的消息
-        if (count > 0) {
-            msgPackage.addRetry();
-            sendService.sendDelayMessage(msgPackage);
+            //存在发送失败的消息
+            if (count > 0) {
+                msgPackage.addRetry();
+                sendService.sendDelayMessage(msgPackage);
+            }
         }
         /**
          * Delivery Tag 用来标识信道中投递的消息。RabbitMQ 推送消息给 Consumer 时,会附带一个 Delivery Tag,

+ 0 - 4
frontend/pc-web/resources/json/navigation.json

@@ -54,10 +54,6 @@
     "text": "系统设置",
     "iconCls": "x-ss ss-nav-setting",
     "items": [{
-        "id": "setting-access-roleaccess",
-        "text": "角色授权",
-        "view": "setting-access-roleaccess"
-    }, {
         "id": "setting-device-list",
         "text": "设备参数",
         "view": "setting-device-list"