瀏覽代碼

Merge branch 'master' of http://47.100.37.243:10080/ZHOU/yunsu

# Conflicts:
#	target/classes/main/resources/application-prod.properties
#	target/classes/main/resources/application-prod.yml
#	target/classes/main/resources/application.properties
#	target/classes/main/resources/application.yml
#	target/classes/main/resources/mapper/AppVersionMapper.xml
#	target/classes/main/resources/mapper/AssetCustomCompanyMapper.xml
#	target/classes/main/resources/mapper/CompanyMapper.xml
#	target/classes/main/resources/mapper/CustomCompanyMapper.xml
#	target/classes/main/resources/mapper/DictionaryDataMapper.xml
#	target/classes/main/resources/mapper/FactoryMapper.xml
#	target/classes/main/resources/mapper/InvitationRecordMapper.xml
#	target/classes/main/resources/mapper/LngLatCompanyMapper.xml
#	target/classes/main/resources/mapper/MouldEquipmentMapper.xml
#	target/classes/main/resources/mapper/MouldFileMapper.xml
#	target/classes/main/resources/mapper/MouldMaintainMapper.xml
#	target/classes/main/resources/mapper/MouldMapper.xml
#	target/classes/main/resources/mapper/MouldOperationDynamicsMapper.xml
#	target/classes/main/resources/mapper/NewsNoticeMapper.xml
#	target/classes/main/resources/mapper/NewsNoticeUserMapper.xml
#	target/classes/main/resources/mapper/PartMapper.xml
#	target/classes/main/resources/mapper/PdfFileMapper.xml
#	target/classes/main/resources/mapper/PowerMapper.xml
#	target/classes/main/resources/mapper/ProjectApproveMapper.xml
#	target/classes/main/resources/mapper/ProjectFileMapper.xml
#	target/classes/main/resources/mapper/ProjectMapper.xml
#	target/classes/main/resources/mapper/ProjectOperationDynamicsMapper.xml
#	target/classes/main/resources/mapper/ProjectUserMapper.xml
#	target/classes/main/resources/mapper/UserCompanyMapper.xml
#	target/classes/main/resources/mapper/UserMapper.xml
#	target/classes/main/resources/mapper/VnoticeUserMapper.xml
#	target/classes/main/resources/static/logout.html
sunyadv 5 年之前
父節點
當前提交
efbd3e27b8
共有 31 個文件被更改,包括 4982 次插入1934 次删除
  1. 11 11
      .idea/yunsu.iml
  2. 4 0
      cloud-model/pom.xml
  3. 1 0
      cloud-model/src/main/java/com/hssx/cloudmodel/constant/Constant.java
  4. 455 450
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/CompanyServiceImpl.java
  5. 9 11
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java
  6. 1 2
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/ProjectFileServiceImpl.java
  7. 774 783
      cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/ProjectServiceImpl.java
  8. 1 2
      cloud-model/src/main/java/com/hssx/cloudmodel/util/OpenOfficeService.java
  9. 4 1
      cloud-model/src/main/resources/application-prod.properties
  10. 二進制
      cloud-model/src/main/resources/lib/jodconverter-2.2.2.jar
  11. 二進制
      cloud-model/src/main/resources/lib/jodconverter-cli-2.2.2.jar
  12. 301 295
      cloud-model/src/main/resources/mapper/ProjectMapper.xml
  13. 53 43
      cloud-model/src/test/java/com/hssx/cloudmodel/CloudModelApplicationTests.java
  14. 2 2
      cloud-socket/src/com/js/kbt/UserTempGenConfig.xml
  15. 82 2
      cloud-socket/src/com/js/kbt/controller/WeiXinUserInfoController.java
  16. 96 0
      cloud-socket/src/com/js/kbt/mapper/MouldDownPacketMapper.java
  17. 286 0
      cloud-socket/src/com/js/kbt/mapper/MouldDownPacketMapper.xml
  18. 7 7
      cloud-socket/src/com/js/kbt/mapper/MouldHistoryTimeMapper.java
  19. 28 15
      cloud-socket/src/com/js/kbt/mapper/MouldHistoryTimeMapper.xml
  20. 96 0
      cloud-socket/src/com/js/kbt/mapper/MouldHodingMapper.java
  21. 349 0
      cloud-socket/src/com/js/kbt/mapper/MouldHodingMapper.xml
  22. 170 0
      cloud-socket/src/com/js/kbt/model/MouldDownPacket.java
  23. 623 0
      cloud-socket/src/com/js/kbt/model/MouldDownPacketExample.java
  24. 38 15
      cloud-socket/src/com/js/kbt/model/MouldHistoryTime.java
  25. 86 16
      cloud-socket/src/com/js/kbt/model/MouldHistoryTimeExample.java
  26. 302 0
      cloud-socket/src/com/js/kbt/model/MouldHoding.java
  27. 853 0
      cloud-socket/src/com/js/kbt/model/MouldHodingExample.java
  28. 327 266
      cloud-socket/src/com/js/kbt/socket/UserHandler.java
  29. 8 7
      cloud-socket/src/jdbc.properties
  30. 4 1
      target/classes/main/resources/application-prod.properties
  31. 11 5
      target/classes/main/resources/mapper/ProjectMapper.xml

+ 11 - 11
.idea/yunsu.iml

@@ -32,9 +32,18 @@
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:2.1.6.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.1.6.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.6.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.8.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.6.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.1.6.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
     <orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
+    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
     <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.11.2" level="project" />
     <orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.11.2" level="project" />
     <orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.26" level="project" />
@@ -44,10 +53,10 @@
     <orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:3.0.11.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.attoparser:attoparser:2.0.5.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.6.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.26" level="project" />
     <orderEntry type="library" name="Maven: org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.4.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.1.6.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.1.6.RELEASE" level="project" />
+    <orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.8.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.9" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.9" level="project" />
@@ -62,16 +71,9 @@
     <orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
     <orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
     <orderEntry type="library" name="Maven: com.fasterxml:classmate:1.4.0" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-web:5.1.8.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-beans:5.1.8.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.1.8.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-aop:5.1.8.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-context:5.1.8.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-expression:5.1.8.RELEASE" level="project" />
     <orderEntry type="library" name="Maven: net.lingala.zip4j:zip4j:1.3.2" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: org.springframework.boot:spring-boot-devtools:2.1.6.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.1.6.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.1.6.RELEASE" level="project" />
     <orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:8.0.16" level="project" />
     <orderEntry type="library" name="Maven: org.projectlombok:lombok:1.18.8" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.1.6.RELEASE" level="project" />
@@ -82,17 +84,15 @@
     <orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.11.1" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.23.4" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.9.13" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.9.13" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
-    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-core:5.1.8.RELEASE" level="project" />
-    <orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.1.8.RELEASE" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.1.8.RELEASE" level="project" />
     <orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.6.2" level="project" />
     <orderEntry type="library" name="Maven: io.swagger:swagger-annotations:1.5.15" level="project" />

+ 4 - 0
cloud-model/pom.xml

@@ -127,6 +127,10 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <fork>true</fork>
+                    <includeSystemScope>true</includeSystemScope>
+                </configuration>
             </plugin>
         </plugins>
     </build>

+ 1 - 0
cloud-model/src/main/java/com/hssx/cloudmodel/constant/Constant.java

@@ -2,6 +2,7 @@ package com.hssx.cloudmodel.constant;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.hssx.cloudmodel.util.HttpKit;
 import com.hssx.cloudmodel.util.HttpRespMsg;
 import com.hssx.cloudmodel.util.WechatTemplateMessage;

+ 455 - 450
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/CompanyServiceImpl.java

@@ -1,450 +1,455 @@
-package com.hssx.cloudmodel.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.github.pagehelper.PageHelper;
-import com.github.pagehelper.PageInfo;
-import com.hssx.cloudmodel.constant.Constant;
-import com.hssx.cloudmodel.entity.*;
-import com.hssx.cloudmodel.entity.vo.CompanyVO;
-import com.hssx.cloudmodel.entity.vo.ProjectVO;
-import com.hssx.cloudmodel.entity.vo.UserVO;
-import com.hssx.cloudmodel.mapper.*;
-import com.hssx.cloudmodel.service.CompanyService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.hssx.cloudmodel.util.HttpRespMsg;
-import com.hssx.cloudmodel.util.ListUtil;
-import com.hssx.cloudmodel.util.PageUtil;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-/**
- * <p>
- * 服务实现类
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-07-26
- */
-@Service
-public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements CompanyService {
-    @Resource
-    CompanyMapper companyMapper;
-    @Resource
-    UserMapper userMapper;
-    @Resource
-    LngLatCompanyMapper lngLatCompanyMapper;
-    @Resource
-    ProjectMapper projectMapper;
-    @Resource
-    MouldMapper mouldMapper;
-    @Resource
-    ProjectUserMapper projectUserMapper;
-    @Resource
-    ProjectApproveMapper projectApproveMapper;
-    @Resource
-    AssetCustomCompanyMapper assetCustomCompanyMapper;
-    @Resource
-    CustomCompanyMapper customCompanyMapper;
-
-
-    @Override
-    public HttpRespMsg addAndUpdateRole(CompanyVO companyVO, Integer flag, String companyIds) {
-        HttpRespMsg msg = new HttpRespMsg();
-        Company company = new Company();
-        if (flag == 0) {
-            //添加公司
-            QueryWrapper<Company> qw = new QueryWrapper<>();
-            qw.eq("company_name", companyVO.getCompanyName());
-            int count = companyMapper.selectCount(qw);
-            if (count > 0) {
-                msg.setError("公司已存在,请勿重复添加");
-                return msg;
-            } else {
-                if (companyVO.getCompanyType() == 0) {
-                    //资产方直接添加
-                    BeanUtils.copyProperties(companyVO, company);
-                    companyMapper.insert(company);
-                    if (companyIds != null && !"".equals(companyIds)) {
-                        List<Integer> ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
-                        for (Integer ide : ides) {
-                            if (assetCustomCompanyMapper.selectCount(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()).eq("custom_id", ide)) == 0) {
-                                AssetCustomCompany assetCustomCompany = new AssetCustomCompany();
-                                assetCustomCompany.setAssertId(company.getId());
-                                assetCustomCompany.setCustomId(ide);
-                                assetCustomCompanyMapper.insert(assetCustomCompany);
-                            }
-                        }
-                    }
-                } else if (companyVO.getCompanyType() == 1) {
-                    //生产方
-                    BeanUtils.copyProperties(companyVO, company);
-                    companyMapper.insert(company);
-                    if (companyIds != null && !"".equals(companyIds)) {
-                        List<Integer> ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
-                        for (Integer ide : ides) {
-                            if (assetCustomCompanyMapper.selectCount(new QueryWrapper<AssetCustomCompany>().eq("assert_id", ide).eq("custom_id", company.getId())) == 0) {
-                                AssetCustomCompany assetCustomCompany = new AssetCustomCompany();
-                                assetCustomCompany.setAssertId(ide);
-                                assetCustomCompany.setCustomId(company.getId());
-                                assetCustomCompanyMapper.insert(assetCustomCompany);
-                            }
-                        }
-                    }
-                    LngLatCompany factory = new LngLatCompany();
-                    factory.setxLat(companyVO.getXLat());
-                    factory.setyLng(companyVO.getYLng());
-                    factory.setCompanyId(company.getId());
-                    lngLatCompanyMapper.insert(factory);
-                }
-                msg.data = company;
-            }
-        } else if (flag == 1) {
-            //更新公司信息
-            BeanUtils.copyProperties(companyVO, company);
-            if (companyVO.getCompanyType() == 0) {
-                //修改资产方
-                BeanUtils.copyProperties(companyVO, company);
-                List<AssetCustomCompany> list = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()));
-                //判断所关联的生产方是否已被应用到项目
-                List<Integer> cousIds = list.stream().map(AssetCustomCompany::getCustomId).collect(Collectors.toList());
-                cousIds.add(-1);
-                List<Integer> noMouldCompanyIds = new ArrayList<>();
-                noMouldCompanyIds = mouldMapper.selectList(new QueryWrapper<Mould>().in("produce_company_id", cousIds).eq("company_id", company.getId())).stream().map(Mould::getProduceCompanyId).collect(Collectors.toList());
-                noMouldCompanyIds.add(-1);
-                List<Integer> ides = new ArrayList<>();
-                if (companyIds != null && !"".equals(companyIds)) {
-                    ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
-                }
-                ides.add(-1);
-                if (!ides.containsAll(noMouldCompanyIds)) {
-                    msg.setError("当前公司所关联的生产方公司中已被用用到项目,不可执行修改操作。");
-                    return msg;
-                }
-                //删除之前的关联公司
-                assetCustomCompanyMapper.delete(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()));
-                if (companyIds != null && !"".equals(companyIds)) {
-                    ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
-                    for (Integer ide : ides) {
-                        if (assetCustomCompanyMapper.selectCount(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()).eq("custom_id", ide)) == 0) {
-                            AssetCustomCompany assetCustomCompany = new AssetCustomCompany();
-                            assetCustomCompany.setAssertId(company.getId());
-                            assetCustomCompany.setCustomId(ide);
-                            assetCustomCompanyMapper.insert(assetCustomCompany);
-                        }
-                    }
-                }
-                companyMapper.updateById(company);
-            } else if (companyVO.getCompanyType() == 1) {
-                //生产方
-                BeanUtils.copyProperties(companyVO, company);
-                QueryWrapper<LngLatCompany> qw = new QueryWrapper<>();
-                qw.eq("company_id", companyVO.getId());
-                LngLatCompany lngLatCompany = lngLatCompanyMapper.selectOne(qw);
-                LngLatCompany factory = new LngLatCompany();
-                factory.setxLat(companyVO.getXLat());
-                factory.setyLng(companyVO.getYLng());
-                factory.setCompanyId(company.getId());
-                factory.setId(lngLatCompany.getId());
-                lngLatCompanyMapper.updateById(factory);
-                List<AssetCustomCompany> list = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("custom_id", company.getId()));
-                //判断所关联的生产方是否已被应用到项目
-                List<Integer> cousIds = list.stream().map(AssetCustomCompany::getAssertId).collect(Collectors.toList());
-                cousIds.add(-1);
-                List<Integer> noMouldCompanyIds = new ArrayList<>();
-                noMouldCompanyIds = mouldMapper.selectList(new QueryWrapper<Mould>().eq("produce_company_id", company.getId()).in("company_id", cousIds)).stream().map(Mould::getCompanyId).collect(Collectors.toList());
-                noMouldCompanyIds.add(-1);
-                List<Integer> ides = new ArrayList<>();
-                if (companyIds != null && !"".equals(companyIds)) {
-                    ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
-                }
-                ides.add(-1);
-                if (!ides.containsAll(noMouldCompanyIds)) {
-                    msg.setError("当前公司所关联的资产方公司已被用用到项目,不可执行修改操作。");
-                    return msg;
-                }
-                //删除之前的关联公司
-                assetCustomCompanyMapper.delete(new QueryWrapper<AssetCustomCompany>().eq("custom_id", companyVO.getId()));
-                if (companyIds != null && !"".equals(companyIds)) {
-                    ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
-                    for (Integer ide : ides) {
-                        if (assetCustomCompanyMapper.selectCount(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()).eq("custom_id", ide)) == 0) {
-                            AssetCustomCompany assetCustomCompany = new AssetCustomCompany();
-                            assetCustomCompany.setAssertId(ide);
-                            assetCustomCompany.setCustomId(company.getId());
-                            assetCustomCompanyMapper.insert(assetCustomCompany);
-                        }
-                    }
-                }
-                companyMapper.updateById(company);
-            }
-            msg.data = company;
-        }
-        return msg;
-    }
-
-    @Override
-    public HttpRespMsg pageList(PageUtil page, String keyName, Integer companyType) {
-        HttpRespMsg msg = new HttpRespMsg();
-        List<CompanyVO> list = new ArrayList<>();
-        PageHelper.startPage(page.getPageNum(), page.getPageSize());
-        list = companyMapper.getCustomerListByKeyName(keyName, companyType);
-        PageInfo<CompanyVO> pageInfos = new PageInfo<>(list);
-        msg.data = pageInfos;
-        return msg;
-    }
-
-    @Override
-    public List<Company> getIdAndNamelist(User user) {
-        QueryWrapper<Company> qw = new QueryWrapper<>();
-        qw.select("id", "company_name", "company_type");
-        List<Integer> ides = new ArrayList<>();
-        if (Constant.SYS_ID.equals(user.getParentId())) {
-            //此时是admin创建用户,返回可选的生产方公司,查询出当前admin的信息并获取他的公司id
-            User admin = userMapper.selectOne(new QueryWrapper<User>().eq("id", user.getId()));
-            ides = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>()
-                    .eq("assert_id", admin.getCompanyId()))
-                    .stream()
-                    .map(AssetCustomCompany::getCustomId)
-                    .collect(Collectors.toList());
-            ides.add(admin.getCompanyId());
-            ides.add(-1);
-            qw.in("id", ides);
-        } else if (Constant.SYS_PARENT_ID.equals(user.getParentId())) {
-            //系统管理员创建admin,返回资产方公司
-            qw.eq("company_type", Constant.ASSETS_COMPANY);
-        } else {
-            //此时是项目经理创建其他用户
-            User admin = userMapper.selectOne(new QueryWrapper<User>().eq("id", user.getParentId()));
-            //获取创建他的资产方管理员公司所关联的生产方
-            ides = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>()
-                    .eq("assert_id", admin.getCompanyId()))
-                    .stream()
-                    .map(AssetCustomCompany::getCustomId)
-                    .collect(Collectors.toList());
-            ides.add(admin.getCompanyId());
-            ides.add(-1);
-            qw.in("id", ides);
-        }
-        return companyMapper.selectList(qw);
-    }
-
-    @Override
-    public List<Company> addCompanyListToProject(User user) {
-        QueryWrapper<Company> qw = new QueryWrapper<>();
-        qw.eq("company_type", Constant.PRODUCER_COMPANY);
-        return companyMapper.selectList(qw);
-    }
-
-    @Override
-    public HttpRespMsg getCoutomCompanyAndMouldsByUser(UserVO userVO) {
-        HttpRespMsg msg = new HttpRespMsg();
-        List<CompanyVO> companyVOS = new ArrayList<>();
-        List<Integer> mouldIds = new ArrayList<>();
-        mouldIds.add(-1);
-        User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
-        if (Constant.SYS_ID.equals(currentUser.getParentId())) {
-            //此时是admin,可看到自己公司下的模具和交于生产的公司
-            QueryWrapper<Mould> qw = new QueryWrapper<>();
-            List<Mould> moulds = mouldMapper.selectList(qw.eq("company_id", currentUser.getCompanyId()));
-            for (Mould mould : moulds) {
-                mouldIds.add(mould.getId());
-            }
-            companyVOS = companyMapper.getListMould(mouldIds);
-        } else if (Constant.SYS_PARENT_ID.equals(currentUser.getParentId())) {
-            //系统管理员创建admin,返回资产方公司
-            List<Mould> moulds = mouldMapper.selectList(new QueryWrapper<Mould>());
-            for (Mould mould : moulds) {
-                mouldIds.add(mould.getId());
-            }
-            companyVOS = companyMapper.getListMould(mouldIds);
-        } else {
-            //此时是项目经理
-            QueryWrapper<Project> qw = new QueryWrapper<>();
-            qw.eq("manager_id", currentUser.getId());
-            List<Integer> set = new ArrayList<>();
-            set.add(-1);
-            List<Project> projects = projectMapper.selectList(qw);
-            if (projects.size() > 0) {
-                for (Project project : projects) {
-                    set.add(project.getId());
-                }
-            }
-//                //充当普通人员参与的项目
-            List<ProjectUser> projectUsers = projectUserMapper.selectList(new QueryWrapper<ProjectUser>().eq("user_id", currentUser.getId()));
-            if (projectUsers.size() > 0) {
-                for (ProjectUser projectUser : projectUsers) {
-                    set.add(projectUser.getProjectId());
-                }
-            }
-            //充当审批人员参与的项目
-            List<ProjectApprove> projectss = projectApproveMapper.selectList(new QueryWrapper<ProjectApprove>().eq("approver_id", currentUser.getId()));
-            if (projectss.size() > 0) {
-                for (ProjectApprove projectUser : projectss) {
-                    set.add(projectUser.getProjectId());
-                }
-            }
-            List<Mould> moulds = mouldMapper.selectList(new QueryWrapper<Mould>().in("project_id", set));
-            for (Mould mould : moulds) {
-                mouldIds.add(mould.getId());
-            }
-            companyVOS = companyMapper.getListMould(mouldIds);
-        }
-        msg.data = companyVOS;
-        return msg;
-    }
-
-    @Override
-    public HttpRespMsg relationList(Integer companyType) {
-        HttpRespMsg msg = new HttpRespMsg();
-        msg.data = companyMapper.selectList(new QueryWrapper<Company>().eq("company_type", companyType));
-        return msg;
-    }
-
-    @Override
-    public HttpRespMsg detail(UserVO userVO) {
-        HttpRespMsg msg = new HttpRespMsg();
-//        Company company = companyMapper.selectById(userVO.getCompanyId());
-//        if (company != null) {
-//            if (0 == company.getCompanyType()) {
-//                //资产方
-//                CompanyVO
-//
-//            }
-//        } else {
-//            msg.setError("公司不存在");
-//        }
-        return msg;
-    }
-
-    @Override
-    public HttpRespMsg getOwnerRelateCompany(CompanyVO companyVO) {
-        HttpRespMsg msg = new HttpRespMsg();
-        User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", companyVO.getToken()));
-        List<Integer> ides = new ArrayList<>();
-        ides.add(-1);
-        if (null == currentUser) {
-            msg.setError("用户不存在或者未登录");
-            return msg;
-        } else {
-            Company company = companyMapper.selectById(companyVO.getId());
-            if (Constant.PRODUCER_COMPANY .equals(company.getCompanyType())) {
-                //生产方公司,返回关联的资产方公司列表
-                ides = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>()
-                        .eq("custom_id", company.getId()))
-                        .stream()
-                        .map(AssetCustomCompany::getAssertId)
-                        .collect(Collectors.toList());
-                msg.data = companyMapper.selectList(new QueryWrapper<Company>().in("id", ides));
-            } else if (Constant.ASSETS_COMPANY .equals(company.getCompanyType())) {
-                //资产方公司,返回关联的生产方公司列表
-                ides = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>()
-                        .eq("assert_id", company.getId()))
-                        .stream()
-                        .map(AssetCustomCompany::getCustomId)
-                        .collect(Collectors.toList());
-                msg.data = companyMapper.selectList(new QueryWrapper<Company>().in("id", ides));
-            }
-        }
-        return msg;
-    }
-
-    @Override
-    public HttpRespMsg getProduceCompany(UserVO userVO) {
-        HttpRespMsg msg = new HttpRespMsg();
-        User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
-        if (null == currentUser) {
-            msg.setError("用户不存在或者未登录");
-            return msg;
-        } else {
-            Integer ownerCompany = projectMapper.selectById(userVO.getProjectId()).getOwnerCompany();
-            List<Integer> companyIds = customCompanyMapper.selectList(new QueryWrapper<CustomCompany>()
-                    .eq("project_id", userVO.getProjectId()))
-                    .stream()
-                    .map(CustomCompany::getCompanyId)
-                    .collect(Collectors.toList());
-            companyIds.add(ownerCompany);
-            List<Company> list = companyMapper.selectList(new QueryWrapper<Company>().in("id", companyIds));
-            msg.data = list;
-        }
-        return msg;
-    }
-
-    @Override
-    public HttpRespMsg getProduceCompanyByCurrentUser(UserVO userVO) {
-        HttpRespMsg msg = new HttpRespMsg();
-        User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
-        List<Company> companies = new ArrayList<>();
-        if (null == currentUser) {
-            msg.setError("用户不存在或者未登录");
-            return msg;
-        } else {
-            if (Constant.SYS_PARENT_ID .equals(currentUser.getParentId())) {
-                companies = companyMapper.selectList(new QueryWrapper<Company>());
-            } else if (Constant.SYS_ID .equals(currentUser.getParentId())) {
-                if (currentUser.getSubordinateType() == 0) {
-                    List<Integer> customCompanyIds = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("assert_id", currentUser.getCompanyId())).stream().map(AssetCustomCompany::getCustomId).collect(Collectors.toList());
-                    customCompanyIds.add(currentUser.getCompanyId());
-                    companies = companyMapper.selectList(new QueryWrapper<Company>().in("id", customCompanyIds));
-                } else if (currentUser.getSubordinateType() == 1) {
-                    List<Integer> assetCompanyIds = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("custom_id", currentUser.getCompanyId())).stream().map(AssetCustomCompany::getAssertId).collect(Collectors.toList());
-                    assetCompanyIds.add(currentUser.getCompanyId());
-                    companies = companyMapper.selectList(new QueryWrapper<Company>().in("id", assetCompanyIds));
-                }
-            } else {
-                List<Integer> projectIds = new ArrayList<>();
-                QueryWrapper<Project> qwPro = new QueryWrapper<>();
-                qwPro.eq("manager_id", currentUser.getId());
-                projectIds = projectMapper.selectList(qwPro).stream().map(Project::getId).collect(Collectors.toList());
-                projectIds.add(-1);
-                //项目经理或者普通用户
-                projectIds.addAll(projectUserMapper.selectList(new QueryWrapper<ProjectUser>()
-                        .eq("user_id", currentUser.getId()))
-                        .stream()
-                        .map(ProjectUser::getProjectId)
-                        .collect(Collectors.toList()));
-                //作为审批人
-                projectIds.addAll(projectApproveMapper.selectList(new QueryWrapper<ProjectApprove>()
-                        .eq("approver_id", currentUser.getId()))
-                        .stream()
-                        .map(ProjectApprove::getProjectId)
-                        .collect(Collectors.toList()));
-                String keyName = null;
-                List<ProjectVO> projects = projectMapper.getProjectListByUidInProjectIds(keyName, projectIds);
-                List<Integer> ids = projects.stream().map(Project::getOwnerCompany).collect(Collectors.toList());
-                ids.add(-1);
-                companies = companyMapper.selectList(new QueryWrapper<Company>().in("id", ids));
-            }
-            msg.data = companies;
-        }
-        return msg;
-    }
-
-    @Override
-    public HttpRespMsg deleteById(Integer id) {
-        HttpRespMsg msg = new HttpRespMsg();
-        Integer count = userMapper.selectCount(new QueryWrapper<User>().eq("company_id", id));
-        if (count > 0) {
-            msg.setError("该公司已被应用到用户中,暂不提供删除操作");
-            return msg;
-        } else {
-            Company company = companyMapper.selectById(id);
-            companyMapper.deleteById(id);
-            if (company.getCompanyType() == 0) {
-                //删除资产方关联的生产方公司
-                assetCustomCompanyMapper.delete(new QueryWrapper<AssetCustomCompany>().eq("assert_id", id));
-            } else if (company.getCompanyType() == 1) {
-                assetCustomCompanyMapper.delete(new QueryWrapper<AssetCustomCompany>().eq("custom_id", id));
-            }
-        }
-        return msg;
-    }
-
-
-}
+package com.hssx.cloudmodel.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hssx.cloudmodel.constant.Constant;
+import com.hssx.cloudmodel.entity.*;
+import com.hssx.cloudmodel.entity.vo.CompanyVO;
+import com.hssx.cloudmodel.entity.vo.ProjectVO;
+import com.hssx.cloudmodel.entity.vo.UserVO;
+import com.hssx.cloudmodel.mapper.*;
+import com.hssx.cloudmodel.service.CompanyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import com.hssx.cloudmodel.util.ListUtil;
+import com.hssx.cloudmodel.util.PageUtil;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * <p>
+ * 服务实现类
+ * </p>
+ *
+ * @author 吴涛涛
+ * @since 2019-07-26
+ */
+@Service
+public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> implements CompanyService {
+    @Resource
+    CompanyMapper companyMapper;
+    @Resource
+    UserMapper userMapper;
+    @Resource
+    LngLatCompanyMapper lngLatCompanyMapper;
+    @Resource
+    ProjectMapper projectMapper;
+    @Resource
+    MouldMapper mouldMapper;
+    @Resource
+    ProjectUserMapper projectUserMapper;
+    @Resource
+    ProjectApproveMapper projectApproveMapper;
+    @Resource
+    AssetCustomCompanyMapper assetCustomCompanyMapper;
+    @Resource
+    CustomCompanyMapper customCompanyMapper;
+
+
+    @Override
+    public HttpRespMsg addAndUpdateRole(CompanyVO companyVO, Integer flag, String companyIds) {
+        HttpRespMsg msg = new HttpRespMsg();
+        Company company = new Company();
+        if (flag == 0) {
+            //添加公司
+            QueryWrapper<Company> qw = new QueryWrapper<>();
+            qw.eq("company_name", companyVO.getCompanyName());
+            int count = companyMapper.selectCount(qw);
+            if (count > 0) {
+                msg.setError("公司已存在,请勿重复添加");
+                return msg;
+            } else {
+                if (companyVO.getCompanyType() == 0) {
+                    //资产方直接添加
+                    BeanUtils.copyProperties(companyVO, company);
+                    companyMapper.insert(company);
+                    if (companyIds != null && !"".equals(companyIds)) {
+                        List<Integer> ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
+                        for (Integer ide : ides) {
+                            if (assetCustomCompanyMapper.selectCount(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()).eq("custom_id", ide)) == 0) {
+                                AssetCustomCompany assetCustomCompany = new AssetCustomCompany();
+                                assetCustomCompany.setAssertId(company.getId());
+                                assetCustomCompany.setCustomId(ide);
+                                assetCustomCompanyMapper.insert(assetCustomCompany);
+                            }
+                        }
+                    }
+                } else if (companyVO.getCompanyType() == 1) {
+                    //生产方
+                    BeanUtils.copyProperties(companyVO, company);
+                    companyMapper.insert(company);
+                    if (companyIds != null && !"".equals(companyIds)) {
+                        List<Integer> ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
+                        for (Integer ide : ides) {
+                            if (assetCustomCompanyMapper.selectCount(new QueryWrapper<AssetCustomCompany>().eq("assert_id", ide).eq("custom_id", company.getId())) == 0) {
+                                AssetCustomCompany assetCustomCompany = new AssetCustomCompany();
+                                assetCustomCompany.setAssertId(ide);
+                                assetCustomCompany.setCustomId(company.getId());
+                                assetCustomCompanyMapper.insert(assetCustomCompany);
+                            }
+                        }
+                    }
+                    LngLatCompany factory = new LngLatCompany();
+                    factory.setxLat(companyVO.getXLat());
+                    factory.setyLng(companyVO.getYLng());
+                    factory.setCompanyId(company.getId());
+                    lngLatCompanyMapper.insert(factory);
+                }
+                msg.data = company;
+            }
+        } else if (flag == 1) {
+            //更新公司信息
+            BeanUtils.copyProperties(companyVO, company);
+            if (companyVO.getCompanyType() == 0) {
+                //修改资产方
+                BeanUtils.copyProperties(companyVO, company);
+                List<AssetCustomCompany> list = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()));
+                //判断所关联的生产方是否已被应用到项目
+                List<Integer> cousIds = list.stream().map(AssetCustomCompany::getCustomId).collect(Collectors.toList());
+                cousIds.add(-1);
+                List<Integer> noMouldCompanyIds = new ArrayList<>();
+                noMouldCompanyIds = mouldMapper.selectList(new QueryWrapper<Mould>().in("produce_company_id", cousIds).eq("company_id", company.getId())).stream().map(Mould::getProduceCompanyId).collect(Collectors.toList());
+                noMouldCompanyIds.add(-1);
+                List<Integer> ides = new ArrayList<>();
+                if (companyIds != null && !"".equals(companyIds)) {
+                    ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
+                }
+                ides.add(-1);
+                if (!ides.containsAll(noMouldCompanyIds)) {
+                    msg.setError("当前公司所关联的生产方公司中已被用用到项目,不可执行修改操作。");
+                    return msg;
+                }
+                //删除之前的关联公司
+                assetCustomCompanyMapper.delete(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()));
+                if (companyIds != null && !"".equals(companyIds)) {
+                    ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
+                    for (Integer ide : ides) {
+                        if (assetCustomCompanyMapper.selectCount(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()).eq("custom_id", ide)) == 0) {
+                            AssetCustomCompany assetCustomCompany = new AssetCustomCompany();
+                            assetCustomCompany.setAssertId(company.getId());
+                            assetCustomCompany.setCustomId(ide);
+                            assetCustomCompanyMapper.insert(assetCustomCompany);
+                        }
+                    }
+                }
+                companyMapper.updateById(company);
+            } else if (companyVO.getCompanyType() == 1) {
+                //生产方
+                BeanUtils.copyProperties(companyVO, company);
+                QueryWrapper<LngLatCompany> qw = new QueryWrapper<>();
+                qw.eq("company_id", companyVO.getId());
+                LngLatCompany lngLatCompany = lngLatCompanyMapper.selectOne(qw);
+                LngLatCompany factory = new LngLatCompany();
+                factory.setxLat(companyVO.getXLat());
+                factory.setyLng(companyVO.getYLng());
+                factory.setCompanyId(company.getId());
+                factory.setId(lngLatCompany.getId());
+                lngLatCompanyMapper.updateById(factory);
+                List<AssetCustomCompany> list = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("custom_id", company.getId()));
+                //判断所关联的生产方是否已被应用到项目
+                List<Integer> cousIds = list.stream().map(AssetCustomCompany::getAssertId).collect(Collectors.toList());
+                cousIds.add(-1);
+                List<Integer> noMouldCompanyIds = new ArrayList<>();
+                noMouldCompanyIds = mouldMapper.selectList(new QueryWrapper<Mould>().eq("produce_company_id", company.getId()).in("company_id", cousIds)).stream().map(Mould::getCompanyId).collect(Collectors.toList());
+                noMouldCompanyIds.add(-1);
+                List<Integer> ides = new ArrayList<>();
+                if (companyIds != null && !"".equals(companyIds)) {
+                    ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
+                }
+                ides.add(-1);
+                if (!ides.containsAll(noMouldCompanyIds)) {
+                    msg.setError("当前公司所关联的资产方公司已被用用到项目,不可执行修改操作。");
+                    return msg;
+                }
+                //删除之前的关联公司
+                assetCustomCompanyMapper.delete(new QueryWrapper<AssetCustomCompany>().eq("custom_id", companyVO.getId()));
+                if (companyIds != null && !"".equals(companyIds)) {
+                    ides = ListUtil.convertIntegerIdsArrayToList(companyIds);
+                    for (Integer ide : ides) {
+                        if (assetCustomCompanyMapper.selectCount(new QueryWrapper<AssetCustomCompany>().eq("assert_id", company.getId()).eq("custom_id", ide)) == 0) {
+                            AssetCustomCompany assetCustomCompany = new AssetCustomCompany();
+                            assetCustomCompany.setAssertId(ide);
+                            assetCustomCompany.setCustomId(company.getId());
+                            assetCustomCompanyMapper.insert(assetCustomCompany);
+                        }
+                    }
+                }
+                companyMapper.updateById(company);
+                //修改项目关联的生产方公司表信息(以防止后续查询修改后公司名字与之前库里存的公司名不一样的问题)
+                CustomCompany customCompany = new CustomCompany();
+                customCompany.setCompanyId(company.getId());
+                customCompany.setCompanyName(company.getCompanyName());
+                customCompanyMapper.update(customCompany,new QueryWrapper<CustomCompany>().eq("company_id",company.getId()));
+            }
+            msg.data = company;
+        }
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg pageList(PageUtil page, String keyName, Integer companyType) {
+        HttpRespMsg msg = new HttpRespMsg();
+        List<CompanyVO> list = new ArrayList<>();
+        PageHelper.startPage(page.getPageNum(), page.getPageSize());
+        list = companyMapper.getCustomerListByKeyName(keyName, companyType);
+        PageInfo<CompanyVO> pageInfos = new PageInfo<>(list);
+        msg.data = pageInfos;
+        return msg;
+    }
+
+    @Override
+    public List<Company> getIdAndNamelist(User user) {
+        QueryWrapper<Company> qw = new QueryWrapper<>();
+        qw.select("id", "company_name", "company_type");
+        List<Integer> ides = new ArrayList<>();
+        if (Constant.SYS_ID.equals(user.getParentId())) {
+            //此时是admin创建用户,返回可选的生产方公司,查询出当前admin的信息并获取他的公司id
+            User admin = userMapper.selectOne(new QueryWrapper<User>().eq("id", user.getId()));
+            ides = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>()
+                    .eq("assert_id", admin.getCompanyId()))
+                    .stream()
+                    .map(AssetCustomCompany::getCustomId)
+                    .collect(Collectors.toList());
+            ides.add(admin.getCompanyId());
+            ides.add(-1);
+            qw.in("id", ides);
+        } else if (Constant.SYS_PARENT_ID.equals(user.getParentId())) {
+            //系统管理员创建admin,返回资产方公司
+            qw.eq("company_type", Constant.ASSETS_COMPANY);
+        } else {
+            //此时是项目经理创建其他用户
+            User admin = userMapper.selectOne(new QueryWrapper<User>().eq("id", user.getParentId()));
+            //获取创建他的资产方管理员公司所关联的生产方
+            ides = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>()
+                    .eq("assert_id", admin.getCompanyId()))
+                    .stream()
+                    .map(AssetCustomCompany::getCustomId)
+                    .collect(Collectors.toList());
+            ides.add(admin.getCompanyId());
+            ides.add(-1);
+            qw.in("id", ides);
+        }
+        return companyMapper.selectList(qw);
+    }
+
+    @Override
+    public List<Company> addCompanyListToProject(User user) {
+        QueryWrapper<Company> qw = new QueryWrapper<>();
+        qw.eq("company_type", Constant.PRODUCER_COMPANY);
+        return companyMapper.selectList(qw);
+    }
+
+    @Override
+    public HttpRespMsg getCoutomCompanyAndMouldsByUser(UserVO userVO) {
+        HttpRespMsg msg = new HttpRespMsg();
+        List<CompanyVO> companyVOS = new ArrayList<>();
+        List<Integer> mouldIds = new ArrayList<>();
+        mouldIds.add(-1);
+        User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
+        if (Constant.SYS_ID.equals(currentUser.getParentId())) {
+            //此时是admin,可看到自己公司下的模具和交于生产的公司
+            QueryWrapper<Mould> qw = new QueryWrapper<>();
+            List<Mould> moulds = mouldMapper.selectList(qw.eq("company_id", currentUser.getCompanyId()));
+            for (Mould mould : moulds) {
+                mouldIds.add(mould.getId());
+            }
+            companyVOS = companyMapper.getListMould(mouldIds);
+        } else if (Constant.SYS_PARENT_ID.equals(currentUser.getParentId())) {
+            //系统管理员创建admin,返回资产方公司
+            List<Mould> moulds = mouldMapper.selectList(new QueryWrapper<Mould>());
+            for (Mould mould : moulds) {
+                mouldIds.add(mould.getId());
+            }
+            companyVOS = companyMapper.getListMould(mouldIds);
+        } else {
+            //此时是项目经理
+            QueryWrapper<Project> qw = new QueryWrapper<>();
+            qw.eq("manager_id", currentUser.getId());
+            List<Integer> set = new ArrayList<>();
+            set.add(-1);
+            List<Project> projects = projectMapper.selectList(qw);
+            if (projects.size() > 0) {
+                for (Project project : projects) {
+                    set.add(project.getId());
+                }
+            }
+//                //充当普通人员参与的项目
+            List<ProjectUser> projectUsers = projectUserMapper.selectList(new QueryWrapper<ProjectUser>().eq("user_id", currentUser.getId()));
+            if (projectUsers.size() > 0) {
+                for (ProjectUser projectUser : projectUsers) {
+                    set.add(projectUser.getProjectId());
+                }
+            }
+            //充当审批人员参与的项目
+            List<ProjectApprove> projectss = projectApproveMapper.selectList(new QueryWrapper<ProjectApprove>().eq("approver_id", currentUser.getId()));
+            if (projectss.size() > 0) {
+                for (ProjectApprove projectUser : projectss) {
+                    set.add(projectUser.getProjectId());
+                }
+            }
+            List<Mould> moulds = mouldMapper.selectList(new QueryWrapper<Mould>().in("project_id", set));
+            for (Mould mould : moulds) {
+                mouldIds.add(mould.getId());
+            }
+            companyVOS = companyMapper.getListMould(mouldIds);
+        }
+        msg.data = companyVOS;
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg relationList(Integer companyType) {
+        HttpRespMsg msg = new HttpRespMsg();
+        msg.data = companyMapper.selectList(new QueryWrapper<Company>().eq("company_type", companyType));
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg detail(UserVO userVO) {
+        HttpRespMsg msg = new HttpRespMsg();
+//        Company company = companyMapper.selectById(userVO.getCompanyId());
+//        if (company != null) {
+//            if (0 == company.getCompanyType()) {
+//                //资产方
+//                CompanyVO
+//
+//            }
+//        } else {
+//            msg.setError("公司不存在");
+//        }
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg getOwnerRelateCompany(CompanyVO companyVO) {
+        HttpRespMsg msg = new HttpRespMsg();
+        User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", companyVO.getToken()));
+        List<Integer> ides = new ArrayList<>();
+        ides.add(-1);
+        if (null == currentUser) {
+            msg.setError("用户不存在或者未登录");
+            return msg;
+        } else {
+            Company company = companyMapper.selectById(companyVO.getId());
+            if (Constant.PRODUCER_COMPANY .equals(company.getCompanyType())) {
+                //生产方公司,返回关联的资产方公司列表
+                ides = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>()
+                        .eq("custom_id", company.getId()))
+                        .stream()
+                        .map(AssetCustomCompany::getAssertId)
+                        .collect(Collectors.toList());
+                msg.data = companyMapper.selectList(new QueryWrapper<Company>().in("id", ides));
+            } else if (Constant.ASSETS_COMPANY .equals(company.getCompanyType())) {
+                //资产方公司,返回关联的生产方公司列表
+                ides = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>()
+                        .eq("assert_id", company.getId()))
+                        .stream()
+                        .map(AssetCustomCompany::getCustomId)
+                        .collect(Collectors.toList());
+                msg.data = companyMapper.selectList(new QueryWrapper<Company>().in("id", ides));
+            }
+        }
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg getProduceCompany(UserVO userVO) {
+        HttpRespMsg msg = new HttpRespMsg();
+        User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
+        if (null == currentUser) {
+            msg.setError("用户不存在或者未登录");
+            return msg;
+        } else {
+            Integer ownerCompany = projectMapper.selectById(userVO.getProjectId()).getOwnerCompany();
+            List<Integer> companyIds = customCompanyMapper.selectList(new QueryWrapper<CustomCompany>()
+                    .eq("project_id", userVO.getProjectId()))
+                    .stream()
+                    .map(CustomCompany::getCompanyId)
+                    .collect(Collectors.toList());
+            companyIds.add(ownerCompany);
+            List<Company> list = companyMapper.selectList(new QueryWrapper<Company>().in("id", companyIds));
+            msg.data = list;
+        }
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg getProduceCompanyByCurrentUser(UserVO userVO) {
+        HttpRespMsg msg = new HttpRespMsg();
+        User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
+        List<Company> companies = new ArrayList<>();
+        if (null == currentUser) {
+            msg.setError("用户不存在或者未登录");
+            return msg;
+        } else {
+            if (Constant.SYS_PARENT_ID .equals(currentUser.getParentId())) {
+                companies = companyMapper.selectList(new QueryWrapper<Company>());
+            } else if (Constant.SYS_ID .equals(currentUser.getParentId())) {
+                if (currentUser.getSubordinateType() == 0) {
+                    List<Integer> customCompanyIds = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("assert_id", currentUser.getCompanyId())).stream().map(AssetCustomCompany::getCustomId).collect(Collectors.toList());
+                    customCompanyIds.add(currentUser.getCompanyId());
+                    companies = companyMapper.selectList(new QueryWrapper<Company>().in("id", customCompanyIds));
+                } else if (currentUser.getSubordinateType() == 1) {
+                    List<Integer> assetCompanyIds = assetCustomCompanyMapper.selectList(new QueryWrapper<AssetCustomCompany>().eq("custom_id", currentUser.getCompanyId())).stream().map(AssetCustomCompany::getAssertId).collect(Collectors.toList());
+                    assetCompanyIds.add(currentUser.getCompanyId());
+                    companies = companyMapper.selectList(new QueryWrapper<Company>().in("id", assetCompanyIds));
+                }
+            } else {
+                List<Integer> projectIds = new ArrayList<>();
+                QueryWrapper<Project> qwPro = new QueryWrapper<>();
+                qwPro.eq("manager_id", currentUser.getId());
+                projectIds = projectMapper.selectList(qwPro).stream().map(Project::getId).collect(Collectors.toList());
+                projectIds.add(-1);
+                //项目经理或者普通用户
+                projectIds.addAll(projectUserMapper.selectList(new QueryWrapper<ProjectUser>()
+                        .eq("user_id", currentUser.getId()))
+                        .stream()
+                        .map(ProjectUser::getProjectId)
+                        .collect(Collectors.toList()));
+                //作为审批人
+                projectIds.addAll(projectApproveMapper.selectList(new QueryWrapper<ProjectApprove>()
+                        .eq("approver_id", currentUser.getId()))
+                        .stream()
+                        .map(ProjectApprove::getProjectId)
+                        .collect(Collectors.toList()));
+                String keyName = null;
+                List<ProjectVO> projects = projectMapper.getProjectListByUidInProjectIds(keyName, projectIds);
+                List<Integer> ids = projects.stream().map(Project::getOwnerCompany).collect(Collectors.toList());
+                ids.add(-1);
+                companies = companyMapper.selectList(new QueryWrapper<Company>().in("id", ids));
+            }
+            msg.data = companies;
+        }
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg deleteById(Integer id) {
+        HttpRespMsg msg = new HttpRespMsg();
+        Integer count = userMapper.selectCount(new QueryWrapper<User>().eq("company_id", id));
+        if (count > 0) {
+            msg.setError("该公司已被应用到用户中,暂不提供删除操作");
+            return msg;
+        } else {
+            Company company = companyMapper.selectById(id);
+            companyMapper.deleteById(id);
+            if (company.getCompanyType() == 0) {
+                //删除资产方关联的生产方公司
+                assetCustomCompanyMapper.delete(new QueryWrapper<AssetCustomCompany>().eq("assert_id", id));
+            } else if (company.getCompanyType() == 1) {
+                assetCustomCompanyMapper.delete(new QueryWrapper<AssetCustomCompany>().eq("custom_id", id));
+            }
+        }
+        return msg;
+    }
+
+
+}

+ 9 - 11
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/MouldFileServiceImpl.java

@@ -15,22 +15,16 @@ import lombok.extern.slf4j.Slf4j;
 import net.lingala.zip4j.core.ZipFile;
 import net.lingala.zip4j.model.ZipParameters;
 import net.lingala.zip4j.util.Zip4jConstants;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
-import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
-import java.net.URLEncoder;
-import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -70,8 +64,6 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
     NewsNoticeMapper newsNoticeMapper;
     @Resource
     NewsNoticeUserMapper newsNoticeUserMapper;
-    @Autowired
-    private OpenOfficeService openOfficeService;
     @Resource
     PdfFileMapper pdfFileMapper;
 
@@ -93,6 +85,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                 if (!dir.exists()) {
                     dir.mkdirs();
                 }
+                OpenOfficeService openOfficeService = new OpenOfficeService();
                 String fileName = "";
                 if (file != null && !file.isEmpty()) {
                     fileName = file.getOriginalFilename();
@@ -142,8 +135,6 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                             projectFile = null;
                         }
                     }
-                    //关闭openOffice
-                    openOfficeService.shutdown();
                     //零件文档时存上零件id
                     if (blongType == 1 && null != userVO.getPartId()) {
                         projectFile.setPartId(userVO.getPartId());
@@ -181,6 +172,8 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
                         pdfFile.setSourceFileUrl(projectFile.getFileUrl2());
                         pdfFileMapper.insert(pdfFile);
                     }
+                    //关闭openOffice
+                    openOfficeService.shutdown();
                     Project project = projectMapper.selectById(mould.getProjectId());
                     Integer count = projectApproveMapper.selectCount(new QueryWrapper<ProjectApprove>().eq("approver_id", user.getId()).eq("project_id", project.getId()));
 //                    if(count>0){
@@ -541,14 +534,18 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
     @Override
     public HttpRespMsg delFile(MouldFile mouldFile, String token) {
         HttpRespMsg msg = new HttpRespMsg();
+
         User currentUser = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", token));
         if (currentUser == null) {
             msg.setError("用户不存在或者未登录");
         } else {
+            MouldFile file = mouldFileMapper.selectById(mouldFile.getId());
             if (Constant.SYS_ID.equals(currentUser.getParentId())) {
                 //判断是不是资产方管理员
                 msg.data = mouldFileMapper.deleteById(mouldFile.getId());
-            } else {
+            } else if(file.getUplodtorId().equals(currentUser.getId())){
+                msg.data = mouldFileMapper.deleteById(mouldFile.getId());
+            }else{
                 msg.setError("您没有该权限!");
             }
         }
@@ -712,6 +709,7 @@ public class MouldFileServiceImpl extends ServiceImpl<MouldFileMapper, MouldFile
         Mould mould = mouldMapper.selectById(userVO.getMouldId());
         User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", userVO.getToken()));
         if (user != null) {
+            OpenOfficeService openOfficeService = new OpenOfficeService();
             List<Part> partLists = partMapper.selectList(new QueryWrapper<Part>().eq("mould_id", userVO.getMouldId()));
             openOfficeService.start();
             for (MultipartFile file : files) {

+ 1 - 2
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/ProjectFileServiceImpl.java

@@ -42,8 +42,6 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
     ProjectOperationDynamicsMapper projectOperationDynamicsMapper;
     @Resource
     ProjectMapper projectMapper;
-    @Autowired
-    private OpenOfficeService openOfficeService;
     @Resource
     PdfFileMapper pdfFileMapper;
 
@@ -81,6 +79,7 @@ public class ProjectFileServiceImpl extends ServiceImpl<ProjectFileMapper, Proje
                         saveFile.createNewFile();
                         file.transferTo(saveFile);
                         //上传完,需要生成pdf
+                        OpenOfficeService openOfficeService = new OpenOfficeService();
                         String dFile1 = path+UUID.randomUUID().toString().replaceAll("-", "")+".pdf";
                         openOfficeService.start();
                         File newFile = new File(dFile1);

File diff suppressed because it is too large
+ 774 - 783
cloud-model/src/main/java/com/hssx/cloudmodel/service/impl/ProjectServiceImpl.java


+ 1 - 2
cloud-model/src/main/java/com/hssx/cloudmodel/util/OpenOfficeService.java

@@ -9,9 +9,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.artofsolving.jodconverter.OfficeDocumentConverter;
 import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration;
 import org.artofsolving.jodconverter.office.OfficeManager;
-import org.springframework.stereotype.Service;
+
 @Slf4j
-@Service("openOfficeService")
 public class OpenOfficeService {
 	//64位windows系统默认安装路径
 	public static String OpenOffice_HOME_64 = "C://Program Files (x86)/OpenOffice 4/";

+ 4 - 1
cloud-model/src/main/resources/application-prod.properties

@@ -13,7 +13,10 @@ spring.thymeleaf.jackson.date-format=yyyy-MM-dd HH:mm:ss
 # ####################################################################################################
 # 数据源配置
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
-spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+# 云模服务器对应的数据库
+#spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+# 我们测试的自己服务器数据库
+spring.datasource.url=jdbc:mysql://118.190.47.230:3306/new_cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
 spring.datasource.username=root
 spring.datasource.password=p011430seya1026
 #spring.datasource.druid.test-on-borrow=true

二進制
cloud-model/src/main/resources/lib/jodconverter-2.2.2.jar


二進制
cloud-model/src/main/resources/lib/jodconverter-cli-2.2.2.jar


+ 301 - 295
cloud-model/src/main/resources/mapper/ProjectMapper.xml

@@ -1,295 +1,301 @@
-<?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.hssx.cloudmodel.mapper.ProjectMapper">
-
-    <!-- 通用查询映射结果 -->
-    <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.Project">
-        <id column="id" property="id" />
-        <result column="project_name" property="projectName" />
-        <result column="project_no" property="projectNo" />
-        <result column="start_time" property="startTime" />
-        <result column="end_time" property="endTime" />
-        <result column="content" property="content" />
-        <result column="creator_id" property="creatorId" />
-        <result column="creator" property="creator" />
-        <result column="is_delete" property="isDelete" />
-        <result column="owner_company" property="ownerCompany" />
-        <result column="owner_company_name" property="ownerCompanyName" />
-        <result column="indate" property="indate" />
-        <result column="manager_id" property="managerId" />
-        <result column="manager" property="manager" />
-    </resultMap>
-    <resultMap id="BaseResultMapList" type="com.hssx.cloudmodel.entity.vo.ProjectVO">
-        <id column="id" property="id" />
-        <result column="project_name" property="projectName" />
-        <result column="project_no" property="projectNo" />
-        <result column="start_time" property="startTime" />
-        <result column="end_time" property="endTime" />
-        <result column="content" property="content" />
-        <result column="creator_id" property="creatorId" />
-        <result column="creator" property="creator" />
-        <result column="is_delete" property="isDelete" />
-        <result column="owner_company" property="ownerCompany" />
-        <result column="owner_company_name" property="ownerCompanyName" />
-        <result column="indate" property="indate" />
-        <result column="manager_id" property="managerId" />
-        <result column="manager" property="manager" />
-        <!--以下是分页插件的一对多-->
-        <collection property="customCompanies" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.CustomCompany"
-                    select="queryCustomCompaniesId" column="id">
-        </collection>
-    </resultMap>
-<!-- 以上一对多的映射-->
-    <resultMap id="getCustomCompany" type="com.hssx.cloudmodel.entity.CustomCompany">
-        <result column="company_id" property="companyId" />
-        <result column="company_name" property="companyName" />
-    </resultMap>
-    <select id="getProjectListByUid" resultMap="BaseResultMapList">
-        select
-        p.id id,p.project_name project_name, p.creator creator,p.owner_company owner_company,
-        p.owner_company_name owner_company_name,p.manager_id manager_id,p.manager manager,
-        p.indate indate
-        from
-        tb_project p
-        left join tb_project_user pu
-        on p.id = pu.project_id
-        left join tb_project_approve tpa
-        on tpa.project_id = p.id
-        <where>
-            <!--<if test="currentUser.id != 1">
-                pu.user_id = #{currentUser.id} OR p.`creator_id` = #{currentUser.id} OR p.`manager_id` = #{currentUser.id} OR tpa.approver_id = #{currentUser.id}
-            </if>-->
-            <if test="keyName != null and keyName != ''">
-                AND p.project_name like concat('%',#{keyName},'%')
-            </if>
-        </where>
-        GROUP BY p.id
-        order by p.id desc
-    </select>
-    <select id="getProjectListByUidInProjectIds" resultMap="BaseResultMapList">
-        select
-        p.id id,p.project_name project_name, p.creator creator,p.owner_company owner_company,
-        p.owner_company_name owner_company_name,p.manager_id manager_id,p.manager manager,
-        p.indate indate
-        from
-        tb_project p
-        left join tb_project_user pu
-        on p.id = pu.project_id
-        left join tb_project_approve tpa
-        on tpa.project_id = p.id
-        <where>
-            p.id in <foreach collection="list" separator="," close=")" item="item" open="(" index="index">
-            #{item}
-        </foreach>
-            <!--<if test="currentUser.id != 1">
-                pu.user_id = #{currentUser.id} OR p.`creator_id` = #{currentUser.id} OR p.`manager_id` = #{currentUser.id} OR tpa.approver_id = #{currentUser.id}
-            </if>-->
-            <if test="keyName != null and keyName != ''">
-                AND p.project_name like concat('%',#{keyName},'%')
-            </if>
-        </where>
-        GROUP BY p.id
-        order by p.id desc
-    </select>
-    <!--一对多的子查询 queryCustomCompaniesId-->
-    <select id="queryCustomCompaniesId" resultMap="getCustomCompany">
-    SELECT
-     c.company_id company_id,c.company_name company_name
-    from
-      tb_project p
-    RIGHT JOIN
-      tb_custom_company c
-    on
-      c.project_id = p.id
-    WHERE
-      p.id = #{id}
-    GROUP BY c.company_id
-    </select>
-    <!-- 通用查询结果列 -->
-    <sql id="Base_Column_List">
-        id, project_name, project_no, start_time, end_time, content, creator_id, creator, is_delete, owner_company, owner_company_name, indate, manager_id, manager
-    </sql>
-
-    <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.ProjectVO">
-        <id column="id" property="id" />
-        <result column="project_name" property="projectName" />
-        <result column="project_no" property="projectNo" />
-        <result column="creator_id" property="creatorId" />
-        <result column="creator" property="creator" />
-        <result column="is_delete" property="isDelete" />
-        <result column="pindate" property="indate" />
-        <result column="manager_id" property="managerId" />
-        <result column="manager" property="manager" />
-        <result column="owner_company" property="ownerCompany" />
-        <result column="owner_company_name" property="ownerCompanyName" />
-        <collection property="models" ofType="com.hssx.cloudmodel.entity.Mould">
-            <id column="model_id" property="id" />
-            <result column="model_no" property="modelNo" />
-            <result column="model_name" property="modelName" />
-            <result column="produce_company_id" property="produceCompanyId" />
-            <result column="belong_project_grade" property="belongProjectGrade" />
-            <result column="produce_company_name" property="produceCompanyName" />
-        </collection>
-        <collection property="approves" ofType="com.hssx.cloudmodel.entity.ProjectApprove">
-            <result column="approver_id" property="approverId" />
-            <result column="approver_name" property="approverName" />
-            <result column="company_id" property="companyId" />
-            <result column="company_name" property="companyName" />
-            <result column="subordinate_type" property="subordinateType" />
-            <result column="project_id" property="projectId" />
-        </collection>
-        <collection property="customCompanies" ofType="com.hssx.cloudmodel.entity.CustomCompany">
-            <result column="companyid" property="companyId" />
-            <result column="companyname" property="companyName" />
-        </collection>
-    </resultMap>
-
-    <select id="getProjectById" resultMap="BaseResultMapVO">
-    select
-        p.id id, p.project_name project_name, p.project_no project_no, p.creator_id creator_id,p.manager_id manager_id,p.manager manager,
-        p.creator creator, p.owner_company owner_company,p.owner_company_name owner_company_name,p.indate pindate,m.belong_project_grade,
-        m.id model_id, m.model_no model_no,m.model_name model_name,a.approver_id approver_id,a.approver_name approver_name,a.subordinate_type subordinate_type,
-        c.company_id companyid,c.company_name companyname,tbc.company_name produce_company_name,tbc.id produce_company_id
-    from
-        tb_project p
-    left join tb_mould m
-    on p.id = m.project_id
-    left join tb_project_approve a
-    on p.id = a.project_id
-    left join tb_custom_company c
-    on c.project_id = p.id
-    LEFT JOIN tb_company tbc
-    ON tbc.`id` = m.`produce_company_id`
-    where
-      p.id = #{id}
-    </select>
-
-    <resultMap id="UserResultMap" type="com.hssx.cloudmodel.entity.User">
-        <id column="id" property="id" />
-        <result column="username" property="username" />
-        <result column="role_type" property="roleType" />
-        <result column="company_id" property="companyId" />
-        <result column="head_imgurl" property="headImgurl" />
-        <result column="subordinate_type" property="subordinateType" />
-    </resultMap>
-
-    <select id="getProjectUserById" resultMap="UserResultMap">
-        select
-          u.id id, u.username username, u.indate indate, u.head_imgurl head_imgurl, u.subordinate_type subordinate_type
-        from
-          tb_project_user pu
-        RIGHT join
-          tb_user u
-        on
-          pu.user_id = u.id
-        where
-          pu.project_id = #{id} and pu.role_type IS NULL
-    </select>
-
-    <resultMap id="BaseResultMapPowerList" type="com.hssx.cloudmodel.entity.vo.ProjectVO">
-        <id column="id" property="id" />
-        <result column="project_name" property="projectName" />
-        <result column="project_id" property="projectId" />
-        <result column="user_id" property="userId" />
-        <result column="company_name" property="companyName" />
-        <result column="powerString" property="powerString" />
-    </resultMap>
-    <select id="selectUserPowerList1" resultMap="BaseResultMapPowerList">
-      SELECT
-      tbpu.user_id ,tbpu.project_id ,GROUP_CONCAT(tbpu.power_type) powerString,
-        tbu.username ,tbc.company_name,
-        tbp.project_name
-      FROM `tb_power` tbpu
-      left join
-      tb_project tbp
-      on tbp.id = tbpu.project_id
-      left join
-      tb_user tbu
-      on tbpu.user_id = tbu.id
-      left join
-      tb_company tbc
-      on tbc.id = tbu.company_id
-        <where>
-            <if test="user.projectId != null">
-                tbpu.project_id = #{user.projectId}
-            </if>
-            <if test="user.companyId != null">
-                tbu.company_id = #{user.companyId}
-            </if>
-            <if test="user.keyName != null and user.keyName != ''">
-                tbu.username like concat('%',#{user.keyName},'%')
-            </if>
-            <if test="type == 0">
-                tbp.creator_id = #{user.id}
-            </if>
-            <if test="type == 1">
-                tbp.manager_id = #{user.id}
-            </if>
-        </where>
-      GROUP BY tbpu.user_id ,tbpu.project_id;
-      order by tbpu.user_id
-    </select>
-
-    <resultMap id="BaseResultMapPower" type="com.hssx.cloudmodel.entity.vo.ProjectVO">
-        <id column="id" property="id" />
-        <result column="project_name" property="projectName" />
-        <result column="project_id" property="projectId" />
-        <result column="user_id" property="userId" />
-        <result column="username" property="username"/>
-        <result column="company_name" property="companyName" />
-        <result column="powerString" property="powerString" />
-        <collection property="powers" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.Power"
-                    select="queryPowerByUserIdAndProject" column="{userId = user_id,projectId = project_id}">
-        </collection>
-    </resultMap>
-    <resultMap id="BasePower" type="com.hssx.cloudmodel.entity.Power">
-        <result column="power_type" property="powerType" />
-        <result column="user_id" property="userId" />
-        <result column="project_id" property="projectId" />
-    </resultMap>
-
-    <select id="selectUserPowerList" resultMap="BaseResultMapPower">
-        SELECT
-        tbpu.user_id user_id,tbpu.project_id project_id,tbu.username username,tbc.company_name,
-        tbp.project_name
-        FROM
-        `tb_project_user` tbpu
-        LEFT JOIN
-        tb_project tbp
-        ON tbp.id = tbpu.project_id
-        LEFT JOIN
-        tb_user tbu
-        ON tbpu.user_id = tbu.id
-        LEFT JOIN
-        tb_company tbc
-        ON tbc.id = tbu.company_id
-        <where>
-            <if test="user.projectId != null and user.projectId !=''">
-               AND tbpu.project_id = #{user.projectId}
-            </if>
-            <if test="user.cId != null and user.cId !=''">
-                AND tbu.company_id = #{user.cId}
-            </if>
-            <if test="user.keyName != null and user.keyName != ''">
-                AND tbu.username like concat('%',#{user.keyName},'%')
-            </if>
-            <if test="type == 0">
-                AND tbp.creator_id = #{user.id}
-            </if>
-            <if test="type == 1">
-                AND tbp.manager_id = #{user.id}
-            </if>
-        </where>
-    </select>
-    <!--一对多的子查询 queryCustomCompaniesId-->
-    <select id="queryPowerByUserIdAndProject" resultMap="BasePower" parameterType="java.util.Map">
-    SELECT
-    tbpw.user_id,tbpw.project_id,tbpw.power_type
-     from
-     `tb_power` tbpw
-    WHERE
-    tbpw.project_id = #{projectId}
-    and
-    tbpw.user_id  =#{userId}
-    </select>
-</mapper>
+<?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.hssx.cloudmodel.mapper.ProjectMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.hssx.cloudmodel.entity.Project">
+        <id column="id" property="id" />
+        <result column="project_name" property="projectName" />
+        <result column="project_no" property="projectNo" />
+        <result column="start_time" property="startTime" />
+        <result column="end_time" property="endTime" />
+        <result column="content" property="content" />
+        <result column="creator_id" property="creatorId" />
+        <result column="creator" property="creator" />
+        <result column="is_delete" property="isDelete" />
+        <result column="owner_company" property="ownerCompany" />
+        <result column="owner_company_name" property="ownerCompanyName" />
+        <result column="indate" property="indate" />
+        <result column="manager_id" property="managerId" />
+        <result column="manager" property="manager" />
+    </resultMap>
+    <resultMap id="BaseResultMapList" type="com.hssx.cloudmodel.entity.vo.ProjectVO">
+        <id column="id" property="id" />
+        <result column="project_name" property="projectName" />
+        <result column="project_no" property="projectNo" />
+        <result column="start_time" property="startTime" />
+        <result column="end_time" property="endTime" />
+        <result column="content" property="content" />
+        <result column="creator_id" property="creatorId" />
+        <result column="creator" property="creator" />
+        <result column="is_delete" property="isDelete" />
+        <result column="owner_company" property="ownerCompany" />
+        <result column="owner_company_name" property="ownerCompanyName" />
+        <result column="indate" property="indate" />
+        <result column="manager_id" property="managerId" />
+        <result column="manager" property="manager" />
+        <!--以下是分页插件的一对多-->
+        <collection property="customCompanies" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.CustomCompany"
+                    select="queryCustomCompaniesId" column="id">
+        </collection>
+    </resultMap>
+<!-- 以上一对多的映射-->
+    <resultMap id="getCustomCompany" type="com.hssx.cloudmodel.entity.CustomCompany">
+        <result column="company_id" property="companyId" />
+        <result column="company_name" property="companyName" />
+    </resultMap>
+    <select id="getProjectListByUid" resultMap="BaseResultMapList">
+        select
+        p.id id,p.project_name project_name, p.creator creator,tbc.id owner_company,
+        tbc.company_name owner_company_name,p.manager_id manager_id,p.manager manager,
+        p.indate indate
+        from
+        tb_project p
+        left join tb_project_user pu
+        on p.id = pu.project_id
+        left join tb_company tbc
+        on p.owner_company = tbc.id
+        left join tb_project_approve tpa
+        on tpa.project_id = p.id
+        <where>
+            <!--<if test="currentUser.id != 1">
+                pu.user_id = #{currentUser.id} OR p.`creator_id` = #{currentUser.id} OR p.`manager_id` = #{currentUser.id} OR tpa.approver_id = #{currentUser.id}
+            </if>-->
+            <if test="keyName != null and keyName != ''">
+                AND p.project_name like concat('%',#{keyName},'%')
+            </if>
+        </where>
+        GROUP BY p.id
+        order by p.id desc
+    </select>
+    <select id="getProjectListByUidInProjectIds" resultMap="BaseResultMapList">
+        select
+        p.id id,p.project_name project_name, p.creator creator,tbc.id owner_company,
+        tbc.company_name owner_company_name,p.manager_id manager_id,p.manager manager,
+        p.indate indate
+        from
+        tb_project p
+        left join tb_project_user pu
+        on p.id = pu.project_id
+        left join tb_company tbc
+        on p.owner_company = tbc.id
+        left join tb_project_approve tpa
+        on tpa.project_id = p.id
+        <where>
+            p.id in <foreach collection="list" separator="," close=")" item="item" open="(" index="index">
+            #{item}
+        </foreach>
+            <!--<if test="currentUser.id != 1">
+                pu.user_id = #{currentUser.id} OR p.`creator_id` = #{currentUser.id} OR p.`manager_id` = #{currentUser.id} OR tpa.approver_id = #{currentUser.id}
+            </if>-->
+            <if test="keyName != null and keyName != ''">
+                AND p.project_name like concat('%',#{keyName},'%')
+            </if>
+        </where>
+        GROUP BY p.id
+        order by p.id desc
+    </select>
+    <!--一对多的子查询 queryCustomCompaniesId-->
+    <select id="queryCustomCompaniesId" resultMap="getCustomCompany">
+    SELECT
+     c.company_id company_id,c.company_name company_name
+    from
+      tb_project p
+    RIGHT JOIN
+      tb_custom_company c
+    on
+      c.project_id = p.id
+    WHERE
+      p.id = #{id}
+    GROUP BY c.company_id
+    </select>
+    <!-- 通用查询结果列 -->
+    <sql id="Base_Column_List">
+        id, project_name, project_no, start_time, end_time, content, creator_id, creator, is_delete, owner_company, owner_company_name, indate, manager_id, manager
+    </sql>
+
+    <resultMap id="BaseResultMapVO" type="com.hssx.cloudmodel.entity.vo.ProjectVO">
+        <id column="id" property="id" />
+        <result column="project_name" property="projectName" />
+        <result column="project_no" property="projectNo" />
+        <result column="creator_id" property="creatorId" />
+        <result column="creator" property="creator" />
+        <result column="is_delete" property="isDelete" />
+        <result column="pindate" property="indate" />
+        <result column="manager_id" property="managerId" />
+        <result column="manager" property="manager" />
+        <result column="owner_company" property="ownerCompany" />
+        <result column="owner_company_name" property="ownerCompanyName" />
+        <collection property="models" ofType="com.hssx.cloudmodel.entity.Mould">
+            <id column="model_id" property="id" />
+            <result column="model_no" property="modelNo" />
+            <result column="model_name" property="modelName" />
+            <result column="produce_company_id" property="produceCompanyId" />
+            <result column="belong_project_grade" property="belongProjectGrade" />
+            <result column="produce_company_name" property="produceCompanyName" />
+        </collection>
+        <collection property="approves" ofType="com.hssx.cloudmodel.entity.ProjectApprove">
+            <result column="approver_id" property="approverId" />
+            <result column="approver_name" property="approverName" />
+            <result column="company_id" property="companyId" />
+            <result column="company_name" property="companyName" />
+            <result column="subordinate_type" property="subordinateType" />
+            <result column="project_id" property="projectId" />
+        </collection>
+        <collection property="customCompanies" ofType="com.hssx.cloudmodel.entity.CustomCompany">
+            <result column="companyid" property="companyId" />
+            <result column="companyname" property="companyName" />
+        </collection>
+    </resultMap>
+
+    <select id="getProjectById" resultMap="BaseResultMapVO">
+    select
+        p.id id, p.project_name project_name, p.project_no project_no, p.creator_id creator_id,p.manager_id manager_id,p.manager manager,
+        p.creator creator, tbp.id owner_company,tbp.company_name owner_company_name,p.indate pindate,m.belong_project_grade,
+        m.id model_id, m.model_no model_no,m.model_name model_name,a.approver_id approver_id,a.approver_name approver_name,a.subordinate_type subordinate_type,
+        c.company_id companyid,c.company_name companyname,tbc.company_name produce_company_name,tbc.id produce_company_id
+    from
+        tb_project p
+    left join tb_mould m
+    on p.id = m.project_id
+    left join tb_project_approve a
+    on p.id = a.project_id
+    left join tb_custom_company c
+    on c.project_id = p.id
+    LEFT JOIN tb_company tbc
+    ON tbc.`id` = m.`produce_company_id`
+    left join tb_company tbp
+    on tbp.id = p.owner_company
+    where
+      p.id = #{id}
+    </select>
+
+    <resultMap id="UserResultMap" type="com.hssx.cloudmodel.entity.User">
+        <id column="id" property="id" />
+        <result column="username" property="username" />
+        <result column="role_type" property="roleType" />
+        <result column="company_id" property="companyId" />
+        <result column="head_imgurl" property="headImgurl" />
+        <result column="subordinate_type" property="subordinateType" />
+    </resultMap>
+
+    <select id="getProjectUserById" resultMap="UserResultMap">
+        select
+          u.id id, u.username username, u.indate indate, u.head_imgurl head_imgurl, u.subordinate_type subordinate_type
+        from
+          tb_project_user pu
+        RIGHT join
+          tb_user u
+        on
+          pu.user_id = u.id
+        where
+          pu.project_id = #{id} and pu.role_type IS NULL
+    </select>
+
+    <resultMap id="BaseResultMapPowerList" type="com.hssx.cloudmodel.entity.vo.ProjectVO">
+        <id column="id" property="id" />
+        <result column="project_name" property="projectName" />
+        <result column="project_id" property="projectId" />
+        <result column="user_id" property="userId" />
+        <result column="company_name" property="companyName" />
+        <result column="powerString" property="powerString" />
+    </resultMap>
+    <select id="selectUserPowerList1" resultMap="BaseResultMapPowerList">
+      SELECT
+      tbpu.user_id ,tbpu.project_id ,GROUP_CONCAT(tbpu.power_type) powerString,
+        tbu.username ,tbc.company_name,
+        tbp.project_name
+      FROM `tb_power` tbpu
+      left join
+      tb_project tbp
+      on tbp.id = tbpu.project_id
+      left join
+      tb_user tbu
+      on tbpu.user_id = tbu.id
+      left join
+      tb_company tbc
+      on tbc.id = tbu.company_id
+        <where>
+            <if test="user.projectId != null">
+                tbpu.project_id = #{user.projectId}
+            </if>
+            <if test="user.companyId != null">
+                tbu.company_id = #{user.companyId}
+            </if>
+            <if test="user.keyName != null and user.keyName != ''">
+                tbu.username like concat('%',#{user.keyName},'%')
+            </if>
+            <if test="type == 0">
+                tbp.creator_id = #{user.id}
+            </if>
+            <if test="type == 1">
+                tbp.manager_id = #{user.id}
+            </if>
+        </where>
+      GROUP BY tbpu.user_id ,tbpu.project_id;
+      order by tbpu.user_id
+    </select>
+
+    <resultMap id="BaseResultMapPower" type="com.hssx.cloudmodel.entity.vo.ProjectVO">
+        <id column="id" property="id" />
+        <result column="project_name" property="projectName" />
+        <result column="project_id" property="projectId" />
+        <result column="user_id" property="userId" />
+        <result column="username" property="username"/>
+        <result column="company_name" property="companyName" />
+        <result column="powerString" property="powerString" />
+        <collection property="powers" javaType="java.util.List" ofType="com.hssx.cloudmodel.entity.Power"
+                    select="queryPowerByUserIdAndProject" column="{userId = user_id,projectId = project_id}">
+        </collection>
+    </resultMap>
+    <resultMap id="BasePower" type="com.hssx.cloudmodel.entity.Power">
+        <result column="power_type" property="powerType" />
+        <result column="user_id" property="userId" />
+        <result column="project_id" property="projectId" />
+    </resultMap>
+
+    <select id="selectUserPowerList" resultMap="BaseResultMapPower">
+        SELECT
+        tbpu.user_id user_id,tbpu.project_id project_id,tbu.username username,tbc.company_name,
+        tbp.project_name
+        FROM
+        `tb_project_user` tbpu
+        LEFT JOIN
+        tb_project tbp
+        ON tbp.id = tbpu.project_id
+        LEFT JOIN
+        tb_user tbu
+        ON tbpu.user_id = tbu.id
+        LEFT JOIN
+        tb_company tbc
+        ON tbc.id = tbu.company_id
+        <where>
+            <if test="user.projectId != null and user.projectId !=''">
+               AND tbpu.project_id = #{user.projectId}
+            </if>
+            <if test="user.cId != null and user.cId !=''">
+                AND tbu.company_id = #{user.cId}
+            </if>
+            <if test="user.keyName != null and user.keyName != ''">
+                AND tbu.username like concat('%',#{user.keyName},'%')
+            </if>
+            <if test="type == 0">
+                AND tbp.creator_id = #{user.id}
+            </if>
+            <if test="type == 1">
+                AND tbp.manager_id = #{user.id}
+            </if>
+        </where>
+    </select>
+    <!--一对多的子查询 queryCustomCompaniesId-->
+    <select id="queryPowerByUserIdAndProject" resultMap="BasePower" parameterType="java.util.Map">
+    SELECT
+    tbpw.user_id,tbpw.project_id,tbpw.power_type
+     from
+     `tb_power` tbpw
+    WHERE
+    tbpw.project_id = #{projectId}
+    and
+    tbpw.user_id  =#{userId}
+    </select>
+</mapper>

+ 53 - 43
cloud-model/src/test/java/com/hssx/cloudmodel/CloudModelApplicationTests.java

@@ -1,43 +1,53 @@
-package com.hssx.cloudmodel;
-
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.hssx.cloudmodel.entity.ProjectUser;
-import com.hssx.cloudmodel.entity.User;
-import com.hssx.cloudmodel.mapper.ProjectUserMapper;
-import com.hssx.cloudmodel.mapper.UserMapper;
-import com.hssx.cloudmodel.util.HttpKit;
-import com.hssx.cloudmodel.util.HttpRespMsg;
-import org.apache.commons.lang3.StringEscapeUtils;
-import org.json.JSONObject;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.junit4.SpringRunner;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-@RunWith(SpringRunner.class)
-@SpringBootTest
-public class CloudModelApplicationTests {
-//    @Autowired
-    private ProjectUserMapper projectUserMapper;
-
-    @Resource
-    UserMapper userMapper;
-    @Test
-    public void contextLoads() {
-        User user = new User();
-        user.setUsername("超级管理员");
-        user = userMapper.selectOne(new QueryWrapper<>(user));
-        System.out.println("user+++"+user);
-        //builder对象的案例
-//        User user1 = User.builder().account("13856598755").companyId(1).mobile("12345678900").parentId(1).build();
-//        int insert = userMapper.insert(user1);
-    }
-
-
-
-}
+package com.hssx.cloudmodel;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.hssx.cloudmodel.entity.CustomCompany;
+import com.hssx.cloudmodel.entity.ProjectUser;
+import com.hssx.cloudmodel.entity.User;
+import com.hssx.cloudmodel.mapper.CustomCompanyMapper;
+import com.hssx.cloudmodel.mapper.ProjectUserMapper;
+import com.hssx.cloudmodel.mapper.UserMapper;
+import com.hssx.cloudmodel.util.HttpKit;
+import com.hssx.cloudmodel.util.HttpRespMsg;
+import org.apache.commons.lang3.StringEscapeUtils;
+import org.json.JSONObject;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class CloudModelApplicationTests {
+//    @Autowired
+    private ProjectUserMapper projectUserMapper;
+
+    @Resource
+    UserMapper userMapper;
+    @Resource
+    CustomCompanyMapper customCompanyMapper;
+    @Test
+    public void contextLoads() {
+
+        CustomCompany customCompany = new CustomCompany();
+        customCompany.setCompanyId(66);
+        customCompany.setCompanyName("123456");
+        customCompanyMapper.update(customCompany,new QueryWrapper<CustomCompany>().eq("company_id",66));
+
+//        User user = new User();
+//        user.setUsername("超级管理员");
+//        user = userMapper.selectOne(new QueryWrapper<>(user));
+//        System.out.println("user+++"+user);
+        //builder对象的案例
+//        User user1 = User.builder().account("13856598755").companyId(1).mobile("12345678900").parentId(1).build();
+//        int insert = userMapper.insert(user1);
+    }
+
+
+
+}

+ 2 - 2
cloud-socket/src/com/js/kbt/UserTempGenConfig.xml

@@ -6,12 +6,12 @@
   <context id="context1" targetRuntime="MyBatis3">
   
     <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://118.190.47.230:3306/cloud_model"
-     userId="root" password="p011430seya10" >
+     userId="root" password="p011430seya1026" >
     </jdbcConnection>
     <javaModelGenerator targetPackage="com.js.kbt.model" targetProject="cloud-socket" />
     <sqlMapGenerator targetPackage="com.js.kbt.mapper" targetProject="cloud-socket" />
     <javaClientGenerator targetPackage="com.js.kbt.mapper" targetProject="cloud-socket" type="XMLMAPPER" />
-    <table schema="cloud_model" tableName="tb_user" >
+    <table schema="cloud_model" tableName="mould_down_packet" >
     	<generatedKey column="id" identity="true" sqlStatement="SELECT LAST_INSERT_ID()"/>
     </table>
 <!--     <table schema="cloud_model" tableName="tb_mould_equipment" > -->

+ 82 - 2
cloud-socket/src/com/js/kbt/controller/WeiXinUserInfoController.java

@@ -2,6 +2,7 @@ package com.js.kbt.controller;
 
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.annotation.Resource;
@@ -19,7 +20,11 @@ import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 
 import com.alibaba.fastjson.JSONObject;
+import com.js.kbt.mapper.MouldDownPacketMapper;
 import com.js.kbt.mapper.TbUserMapper;
+import com.js.kbt.model.MouldDownPacket;
+import com.js.kbt.model.MouldDownPacketExample;
+import com.js.kbt.model.PacketMessage;
 import com.js.kbt.model.TbUser;
 import com.js.kbt.model.TbUserExample;
 import com.js.kbt.util.MD5Util;
@@ -39,6 +44,10 @@ public class WeiXinUserInfoController {
 	private HttpServletRequest request;
 	@Resource(name = "tbUserMapper")
 	private TbUserMapper tbUserMapper;
+	@Resource(name = "packetMessage")
+	private PacketMessage packetMessage;
+	@Resource(name = "mouldDownPacketMapper")
+	private MouldDownPacketMapper mouldDownPacketMapper;
 
 //	@Autowired
 //	private WeiXinPlatformService weiXinPlatformService;
@@ -111,7 +120,6 @@ public class WeiXinUserInfoController {
 		} else {
 			msg.setError("账号密码错误");
 		}
-		
 		response.setContentType("application/json");
 		response.setCharacterEncoding("UTF-8");
 		try {
@@ -193,7 +201,7 @@ public class WeiXinUserInfoController {
 		}
 		return weixinUserInfo;
 	}
-
+	
 	/**
 	 * 进行用户授权,获取到需要的授权字段,比如openId
 	 * 
@@ -244,4 +252,76 @@ public class WeiXinUserInfoController {
 
 		return result;
 	}
+	
+	/**
+	 * 云平台下行配置数据包接口
+	 * lowPowerLimit 低电量报警限值:(1 字节,十六进制)如:1e
+	 * hotAlarmLimit 热报警限值:(1 字节,十六进制)如:50
+	 * equipmentNo 设备编号
+	 */
+	@RequestMapping("/setPacket")
+	public void bindAccount(HttpServletResponse response,String lowPowerLimit,String hotAlarmLimit,String equipmentNo) {
+		HttpRespMsg msg = new HttpRespMsg();
+		String setPacketMessage = "";
+		MouldDownPacket mouldDownPacket = new MouldDownPacket();
+		MouldDownPacketExample exp = new MouldDownPacketExample();
+		exp.createCriteria().andEquipmentNoEqualTo(equipmentNo);
+		List<MouldDownPacket> list = mouldDownPacketMapper.selectByExample(exp);
+		if(list.size()>0){
+			mouldDownPacket = list.get(0);
+			setPacketMessage = downProcessMsg(lowPowerLimit,hotAlarmLimit);
+			mouldDownPacket.setPacketStr(setPacketMessage);
+			mouldDownPacket.setIsUse(0);
+			mouldDownPacketMapper.updateByPrimaryKey(mouldDownPacket);
+			
+		}else{
+			setPacketMessage = downProcessMsg(lowPowerLimit,hotAlarmLimit);
+			mouldDownPacket.setEquipmentNo(equipmentNo);
+			mouldDownPacket.setPacketStr(setPacketMessage);
+			mouldDownPacketMapper.insertSelective(mouldDownPacket);
+		}
+		response.setContentType("application/json");
+		response.setCharacterEncoding("UTF-8");
+		try {
+			response.getWriter().println(msg.toJSONStr());
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	// 下行配置数据包
+		private String downProcessMsg(String lowPowerLimit,String hotAlarmLimit) {
+			//"23"不解析
+			if("23".equals(lowPowerLimit)){
+				lowPowerLimit="24";
+			}
+			if("23".equals(hotAlarmLimit)){
+				hotAlarmLimit="24";
+			}
+			String ret = "FA AF 00 07 02 1e 78 lowPowerLimit hotAlarmLimit 00 3C";
+			ret.replace("lowPowerLimit", lowPowerLimit);
+			ret.replace("hotAlarmLimit", hotAlarmLimit);
+			ret.replaceAll(" ", "");
+			//16 位 CRC 校验(低位在前;高位在后)
+			int crc = reverseParseHex(ret);
+			String crcString = crc + "";
+			ret = ret + crcString;
+			return ret;
+		}
+		
+		/**
+		 * 低位在前的16进制解析
+		 * 
+		 * @param rHex
+		 * @return
+		 */
+		public static int reverseParseHex(String rHex) {
+			int size = rHex.length() / 2;
+			StringBuilder sb = new StringBuilder();
+			for (int i = 0; i < size; i++) {
+				sb.append(rHex.substring((size - i - 1) * 2, (size - i) * 2));
+			}
+			String str = sb.toString();
+			return Integer.parseInt(str, 16);
+		}
 }

+ 96 - 0
cloud-socket/src/com/js/kbt/mapper/MouldDownPacketMapper.java

@@ -0,0 +1,96 @@
+package com.js.kbt.mapper;
+
+import com.js.kbt.model.MouldDownPacket;
+import com.js.kbt.model.MouldDownPacketExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface MouldDownPacketMapper {
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    long countByExample(MouldDownPacketExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    int deleteByExample(MouldDownPacketExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    int deleteByPrimaryKey(Integer id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    int insert(MouldDownPacket record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    int insertSelective(MouldDownPacket record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    List<MouldDownPacket> selectByExample(MouldDownPacketExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    MouldDownPacket selectByPrimaryKey(Integer id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    int updateByExampleSelective(@Param("record") MouldDownPacket record, @Param("example") MouldDownPacketExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    int updateByExample(@Param("record") MouldDownPacket record, @Param("example") MouldDownPacketExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    int updateByPrimaryKeySelective(MouldDownPacket record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    int updateByPrimaryKey(MouldDownPacket record);
+}

+ 286 - 0
cloud-socket/src/com/js/kbt/mapper/MouldDownPacketMapper.xml

@@ -0,0 +1,286 @@
+<?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.js.kbt.mapper.MouldDownPacketMapper">
+  <resultMap id="BaseResultMap" type="com.js.kbt.model.MouldDownPacket">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="equipment_no" jdbcType="VARCHAR" property="equipmentNo" />
+    <result column="packet_str" jdbcType="VARCHAR" property="packetStr" />
+    <result column="indate" jdbcType="TIMESTAMP" property="indate" />
+    <result column="is_use" jdbcType="INTEGER" property="isUse" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    id, equipment_no, packet_str, indate, is_use
+  </sql>
+  <select id="selectByExample" parameterType="com.js.kbt.model.MouldDownPacketExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from mould_down_packet
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from mould_down_packet
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    delete from mould_down_packet
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.js.kbt.model.MouldDownPacketExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    delete from mould_down_packet
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.js.kbt.model.MouldDownPacket">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into mould_down_packet (equipment_no, packet_str, indate, 
+      is_use)
+    values (#{equipmentNo,jdbcType=VARCHAR}, #{packetStr,jdbcType=VARCHAR}, #{indate,jdbcType=TIMESTAMP}, 
+      #{isUse,jdbcType=INTEGER})
+  </insert>
+  <insert id="insertSelective" parameterType="com.js.kbt.model.MouldDownPacket">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into mould_down_packet
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="equipmentNo != null">
+        equipment_no,
+      </if>
+      <if test="packetStr != null">
+        packet_str,
+      </if>
+      <if test="indate != null">
+        indate,
+      </if>
+      <if test="isUse != null">
+        is_use,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="equipmentNo != null">
+        #{equipmentNo,jdbcType=VARCHAR},
+      </if>
+      <if test="packetStr != null">
+        #{packetStr,jdbcType=VARCHAR},
+      </if>
+      <if test="indate != null">
+        #{indate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="isUse != null">
+        #{isUse,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.js.kbt.model.MouldDownPacketExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    select count(*) from mould_down_packet
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    update mould_down_packet
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=INTEGER},
+      </if>
+      <if test="record.equipmentNo != null">
+        equipment_no = #{record.equipmentNo,jdbcType=VARCHAR},
+      </if>
+      <if test="record.packetStr != null">
+        packet_str = #{record.packetStr,jdbcType=VARCHAR},
+      </if>
+      <if test="record.indate != null">
+        indate = #{record.indate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="record.isUse != null">
+        is_use = #{record.isUse,jdbcType=INTEGER},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    update mould_down_packet
+    set id = #{record.id,jdbcType=INTEGER},
+      equipment_no = #{record.equipmentNo,jdbcType=VARCHAR},
+      packet_str = #{record.packetStr,jdbcType=VARCHAR},
+      indate = #{record.indate,jdbcType=TIMESTAMP},
+      is_use = #{record.isUse,jdbcType=INTEGER}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.js.kbt.model.MouldDownPacket">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    update mould_down_packet
+    <set>
+      <if test="equipmentNo != null">
+        equipment_no = #{equipmentNo,jdbcType=VARCHAR},
+      </if>
+      <if test="packetStr != null">
+        packet_str = #{packetStr,jdbcType=VARCHAR},
+      </if>
+      <if test="indate != null">
+        indate = #{indate,jdbcType=TIMESTAMP},
+      </if>
+      <if test="isUse != null">
+        is_use = #{isUse,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.js.kbt.model.MouldDownPacket">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Wed Oct 09 18:15:27 CST 2019.
+    -->
+    update mould_down_packet
+    set equipment_no = #{equipmentNo,jdbcType=VARCHAR},
+      packet_str = #{packetStr,jdbcType=VARCHAR},
+      indate = #{indate,jdbcType=TIMESTAMP},
+      is_use = #{isUse,jdbcType=INTEGER}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 7 - 7
cloud-socket/src/com/js/kbt/mapper/MouldHistoryTimeMapper.java

@@ -9,44 +9,44 @@ public interface MouldHistoryTimeMapper {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	long countByExample(MouldHistoryTimeExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	int deleteByExample(MouldHistoryTimeExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	int insert(MouldHistoryTime record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	int insertSelective(MouldHistoryTime record);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	List<MouldHistoryTime> selectByExample(MouldHistoryTimeExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	int updateByExampleSelective(@Param("record") MouldHistoryTime record,
 			@Param("example") MouldHistoryTimeExample example);
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	int updateByExample(@Param("record") MouldHistoryTime record, @Param("example") MouldHistoryTimeExample example);
 }

+ 28 - 15
cloud-socket/src/com/js/kbt/mapper/MouldHistoryTimeMapper.xml

@@ -5,19 +5,20 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     <result column="history_id" jdbcType="BIGINT" property="historyId" />
     <result column="seq" jdbcType="INTEGER" property="seq" />
     <result column="close_time" jdbcType="TIMESTAMP" property="closeTime" />
     <result column="open_time" jdbcType="TIMESTAMP" property="openTime" />
     <result column="time_cost" jdbcType="INTEGER" property="timeCost" />
+    <result column="equipment_no" jdbcType="VARCHAR" property="equipmentNo" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     <where>
       <foreach collection="oredCriteria" item="criteria" separator="or">
@@ -51,7 +52,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     <where>
       <foreach collection="example.oredCriteria" item="criteria" separator="or">
@@ -85,15 +86,15 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
-    history_id, seq, close_time, open_time, time_cost
+    history_id, seq, close_time, open_time, time_cost, equipment_no
   </sql>
   <select id="selectByExample" parameterType="com.js.kbt.model.MouldHistoryTimeExample" resultMap="BaseResultMap">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     select
     <if test="distinct">
@@ -112,7 +113,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     delete from mould_history_time
     <if test="_parameter != null">
@@ -123,18 +124,20 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     insert into mould_history_time (history_id, seq, close_time, 
-      open_time, time_cost)
+      open_time, time_cost, equipment_no
+      )
     values (#{historyId,jdbcType=BIGINT}, #{seq,jdbcType=INTEGER}, #{closeTime,jdbcType=TIMESTAMP}, 
-      #{openTime,jdbcType=TIMESTAMP}, #{timeCost,jdbcType=INTEGER})
+      #{openTime,jdbcType=TIMESTAMP}, #{timeCost,jdbcType=INTEGER}, #{equipmentNo,jdbcType=VARCHAR}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.js.kbt.model.MouldHistoryTime">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     insert into mould_history_time
     <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -153,6 +156,9 @@
       <if test="timeCost != null">
         time_cost,
       </if>
+      <if test="equipmentNo != null">
+        equipment_no,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="historyId != null">
@@ -170,13 +176,16 @@
       <if test="timeCost != null">
         #{timeCost,jdbcType=INTEGER},
       </if>
+      <if test="equipmentNo != null">
+        #{equipmentNo,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.js.kbt.model.MouldHistoryTimeExample" resultType="java.lang.Long">
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     select count(*) from mould_history_time
     <if test="_parameter != null">
@@ -187,7 +196,7 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     update mould_history_time
     <set>
@@ -206,6 +215,9 @@
       <if test="record.timeCost != null">
         time_cost = #{record.timeCost,jdbcType=INTEGER},
       </if>
+      <if test="record.equipmentNo != null">
+        equipment_no = #{record.equipmentNo,jdbcType=VARCHAR},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -215,14 +227,15 @@
     <!--
       WARNING - @mbg.generated
       This element is automatically generated by MyBatis Generator, do not modify.
-      This element was generated on Mon Aug 05 15:38:00 CST 2019.
+      This element was generated on Thu Aug 22 16:38:14 CST 2019.
     -->
     update mould_history_time
     set history_id = #{record.historyId,jdbcType=BIGINT},
       seq = #{record.seq,jdbcType=INTEGER},
       close_time = #{record.closeTime,jdbcType=TIMESTAMP},
       open_time = #{record.openTime,jdbcType=TIMESTAMP},
-      time_cost = #{record.timeCost,jdbcType=INTEGER}
+      time_cost = #{record.timeCost,jdbcType=INTEGER},
+      equipment_no = #{record.equipmentNo,jdbcType=VARCHAR}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>

+ 96 - 0
cloud-socket/src/com/js/kbt/mapper/MouldHodingMapper.java

@@ -0,0 +1,96 @@
+package com.js.kbt.mapper;
+
+import com.js.kbt.model.MouldHoding;
+import com.js.kbt.model.MouldHodingExample;
+import java.util.List;
+import org.apache.ibatis.annotations.Param;
+
+public interface MouldHodingMapper {
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    long countByExample(MouldHodingExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    int deleteByExample(MouldHodingExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    int deleteByPrimaryKey(Integer id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    int insert(MouldHoding record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    int insertSelective(MouldHoding record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    List<MouldHoding> selectByExample(MouldHodingExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    MouldHoding selectByPrimaryKey(Integer id);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    int updateByExampleSelective(@Param("record") MouldHoding record, @Param("example") MouldHodingExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    int updateByExample(@Param("record") MouldHoding record, @Param("example") MouldHodingExample example);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    int updateByPrimaryKeySelective(MouldHoding record);
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    int updateByPrimaryKey(MouldHoding record);
+}

+ 349 - 0
cloud-socket/src/com/js/kbt/mapper/MouldHodingMapper.xml

@@ -0,0 +1,349 @@
+<?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.js.kbt.mapper.MouldHodingMapper">
+  <resultMap id="BaseResultMap" type="com.js.kbt.model.MouldHoding">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="enable" jdbcType="INTEGER" property="enable" />
+    <result column="uploadcycle_work" jdbcType="INTEGER" property="uploadcycleWork" />
+    <result column="uploadcycle_free" jdbcType="INTEGER" property="uploadcycleFree" />
+    <result column="lowpowerlimit" jdbcType="VARCHAR" property="lowpowerlimit" />
+    <result column="hotalarmlimit" jdbcType="INTEGER" property="hotalarmlimit" />
+    <result column="retain" jdbcType="INTEGER" property="retain" />
+    <result column="time_count" jdbcType="INTEGER" property="timeCount" />
+    <result column="indate" jdbcType="TIMESTAMP" property="indate" />
+  </resultMap>
+  <sql id="Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    <where>
+      <foreach collection="oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Update_By_Example_Where_Clause">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    <where>
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
+        <if test="criteria.valid">
+          <trim prefix="(" prefixOverrides="and" suffix=")">
+            <foreach collection="criteria.criteria" item="criterion">
+              <choose>
+                <when test="criterion.noValue">
+                  and ${criterion.condition}
+                </when>
+                <when test="criterion.singleValue">
+                  and ${criterion.condition} #{criterion.value}
+                </when>
+                <when test="criterion.betweenValue">
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
+                </when>
+                <when test="criterion.listValue">
+                  and ${criterion.condition}
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
+                    #{listItem}
+                  </foreach>
+                </when>
+              </choose>
+            </foreach>
+          </trim>
+        </if>
+      </foreach>
+    </where>
+  </sql>
+  <sql id="Base_Column_List">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    id, enable, uploadcycle_work, uploadcycle_free, lowpowerlimit, hotalarmlimit, retain, 
+    time_count, indate
+  </sql>
+  <select id="selectByExample" parameterType="com.js.kbt.model.MouldHodingExample" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    select
+    <if test="distinct">
+      distinct
+    </if>
+    <include refid="Base_Column_List" />
+    from mould_hoding
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+    <if test="orderByClause != null">
+      order by ${orderByClause}
+    </if>
+  </select>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    select 
+    <include refid="Base_Column_List" />
+    from mould_hoding
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    delete from mould_hoding
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <delete id="deleteByExample" parameterType="com.js.kbt.model.MouldHodingExample">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    delete from mould_hoding
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.js.kbt.model.MouldHoding">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into mould_hoding (enable, uploadcycle_work, uploadcycle_free, 
+      lowpowerlimit, hotalarmlimit, retain, 
+      time_count, indate)
+    values (#{enable,jdbcType=INTEGER}, #{uploadcycleWork,jdbcType=INTEGER}, #{uploadcycleFree,jdbcType=INTEGER}, 
+      #{lowpowerlimit,jdbcType=VARCHAR}, #{hotalarmlimit,jdbcType=INTEGER}, #{retain,jdbcType=INTEGER}, 
+      #{timeCount,jdbcType=INTEGER}, #{indate,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.js.kbt.model.MouldHoding">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into mould_hoding
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="enable != null">
+        enable,
+      </if>
+      <if test="uploadcycleWork != null">
+        uploadcycle_work,
+      </if>
+      <if test="uploadcycleFree != null">
+        uploadcycle_free,
+      </if>
+      <if test="lowpowerlimit != null">
+        lowpowerlimit,
+      </if>
+      <if test="hotalarmlimit != null">
+        hotalarmlimit,
+      </if>
+      <if test="retain != null">
+        retain,
+      </if>
+      <if test="timeCount != null">
+        time_count,
+      </if>
+      <if test="indate != null">
+        indate,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="enable != null">
+        #{enable,jdbcType=INTEGER},
+      </if>
+      <if test="uploadcycleWork != null">
+        #{uploadcycleWork,jdbcType=INTEGER},
+      </if>
+      <if test="uploadcycleFree != null">
+        #{uploadcycleFree,jdbcType=INTEGER},
+      </if>
+      <if test="lowpowerlimit != null">
+        #{lowpowerlimit,jdbcType=VARCHAR},
+      </if>
+      <if test="hotalarmlimit != null">
+        #{hotalarmlimit,jdbcType=INTEGER},
+      </if>
+      <if test="retain != null">
+        #{retain,jdbcType=INTEGER},
+      </if>
+      <if test="timeCount != null">
+        #{timeCount,jdbcType=INTEGER},
+      </if>
+      <if test="indate != null">
+        #{indate,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <select id="countByExample" parameterType="com.js.kbt.model.MouldHodingExample" resultType="java.lang.Long">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    select count(*) from mould_hoding
+    <if test="_parameter != null">
+      <include refid="Example_Where_Clause" />
+    </if>
+  </select>
+  <update id="updateByExampleSelective" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    update mould_hoding
+    <set>
+      <if test="record.id != null">
+        id = #{record.id,jdbcType=INTEGER},
+      </if>
+      <if test="record.enable != null">
+        enable = #{record.enable,jdbcType=INTEGER},
+      </if>
+      <if test="record.uploadcycleWork != null">
+        uploadcycle_work = #{record.uploadcycleWork,jdbcType=INTEGER},
+      </if>
+      <if test="record.uploadcycleFree != null">
+        uploadcycle_free = #{record.uploadcycleFree,jdbcType=INTEGER},
+      </if>
+      <if test="record.lowpowerlimit != null">
+        lowpowerlimit = #{record.lowpowerlimit,jdbcType=VARCHAR},
+      </if>
+      <if test="record.hotalarmlimit != null">
+        hotalarmlimit = #{record.hotalarmlimit,jdbcType=INTEGER},
+      </if>
+      <if test="record.retain != null">
+        retain = #{record.retain,jdbcType=INTEGER},
+      </if>
+      <if test="record.timeCount != null">
+        time_count = #{record.timeCount,jdbcType=INTEGER},
+      </if>
+      <if test="record.indate != null">
+        indate = #{record.indate,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByExample" parameterType="map">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    update mould_hoding
+    set id = #{record.id,jdbcType=INTEGER},
+      enable = #{record.enable,jdbcType=INTEGER},
+      uploadcycle_work = #{record.uploadcycleWork,jdbcType=INTEGER},
+      uploadcycle_free = #{record.uploadcycleFree,jdbcType=INTEGER},
+      lowpowerlimit = #{record.lowpowerlimit,jdbcType=VARCHAR},
+      hotalarmlimit = #{record.hotalarmlimit,jdbcType=INTEGER},
+      retain = #{record.retain,jdbcType=INTEGER},
+      time_count = #{record.timeCount,jdbcType=INTEGER},
+      indate = #{record.indate,jdbcType=TIMESTAMP}
+    <if test="_parameter != null">
+      <include refid="Update_By_Example_Where_Clause" />
+    </if>
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.js.kbt.model.MouldHoding">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    update mould_hoding
+    <set>
+      <if test="enable != null">
+        enable = #{enable,jdbcType=INTEGER},
+      </if>
+      <if test="uploadcycleWork != null">
+        uploadcycle_work = #{uploadcycleWork,jdbcType=INTEGER},
+      </if>
+      <if test="uploadcycleFree != null">
+        uploadcycle_free = #{uploadcycleFree,jdbcType=INTEGER},
+      </if>
+      <if test="lowpowerlimit != null">
+        lowpowerlimit = #{lowpowerlimit,jdbcType=VARCHAR},
+      </if>
+      <if test="hotalarmlimit != null">
+        hotalarmlimit = #{hotalarmlimit,jdbcType=INTEGER},
+      </if>
+      <if test="retain != null">
+        retain = #{retain,jdbcType=INTEGER},
+      </if>
+      <if test="timeCount != null">
+        time_count = #{timeCount,jdbcType=INTEGER},
+      </if>
+      <if test="indate != null">
+        indate = #{indate,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.js.kbt.model.MouldHoding">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 08 17:17:36 CST 2019.
+    -->
+    update mould_hoding
+    set enable = #{enable,jdbcType=INTEGER},
+      uploadcycle_work = #{uploadcycleWork,jdbcType=INTEGER},
+      uploadcycle_free = #{uploadcycleFree,jdbcType=INTEGER},
+      lowpowerlimit = #{lowpowerlimit,jdbcType=VARCHAR},
+      hotalarmlimit = #{hotalarmlimit,jdbcType=INTEGER},
+      retain = #{retain,jdbcType=INTEGER},
+      time_count = #{timeCount,jdbcType=INTEGER},
+      indate = #{indate,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 170 - 0
cloud-socket/src/com/js/kbt/model/MouldDownPacket.java

@@ -0,0 +1,170 @@
+package com.js.kbt.model;
+
+import java.util.Date;
+
+public class MouldDownPacket {
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_down_packet.id
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    private Integer id;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_down_packet.equipment_no
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    private String equipmentNo;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_down_packet.packet_str
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    private String packetStr;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_down_packet.indate
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    private Date indate;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_down_packet.is_use
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    private Integer isUse;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_down_packet.id
+     *
+     * @return the value of mould_down_packet.id
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_down_packet.id
+     *
+     * @param id the value for mould_down_packet.id
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_down_packet.equipment_no
+     *
+     * @return the value of mould_down_packet.equipment_no
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public String getEquipmentNo() {
+        return equipmentNo;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_down_packet.equipment_no
+     *
+     * @param equipmentNo the value for mould_down_packet.equipment_no
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public void setEquipmentNo(String equipmentNo) {
+        this.equipmentNo = equipmentNo;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_down_packet.packet_str
+     *
+     * @return the value of mould_down_packet.packet_str
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public String getPacketStr() {
+        return packetStr;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_down_packet.packet_str
+     *
+     * @param packetStr the value for mould_down_packet.packet_str
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public void setPacketStr(String packetStr) {
+        this.packetStr = packetStr;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_down_packet.indate
+     *
+     * @return the value of mould_down_packet.indate
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public Date getIndate() {
+        return indate;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_down_packet.indate
+     *
+     * @param indate the value for mould_down_packet.indate
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public void setIndate(Date indate) {
+        this.indate = indate;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_down_packet.is_use
+     *
+     * @return the value of mould_down_packet.is_use
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public Integer getIsUse() {
+        return isUse;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_down_packet.is_use
+     *
+     * @param isUse the value for mould_down_packet.is_use
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public void setIsUse(Integer isUse) {
+        this.isUse = isUse;
+    }
+}

+ 623 - 0
cloud-socket/src/com/js/kbt/model/MouldDownPacketExample.java

@@ -0,0 +1,623 @@
+package com.js.kbt.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class MouldDownPacketExample {
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    protected String orderByClause;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    protected boolean distinct;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    protected List<Criteria> oredCriteria;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public MouldDownPacketExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Integer value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Integer value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Integer value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Integer value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Integer value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Integer value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Integer> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Integer> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Integer value1, Integer value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Integer value1, Integer value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoIsNull() {
+            addCriterion("equipment_no is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoIsNotNull() {
+            addCriterion("equipment_no is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoEqualTo(String value) {
+            addCriterion("equipment_no =", value, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoNotEqualTo(String value) {
+            addCriterion("equipment_no <>", value, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoGreaterThan(String value) {
+            addCriterion("equipment_no >", value, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoGreaterThanOrEqualTo(String value) {
+            addCriterion("equipment_no >=", value, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoLessThan(String value) {
+            addCriterion("equipment_no <", value, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoLessThanOrEqualTo(String value) {
+            addCriterion("equipment_no <=", value, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoLike(String value) {
+            addCriterion("equipment_no like", value, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoNotLike(String value) {
+            addCriterion("equipment_no not like", value, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoIn(List<String> values) {
+            addCriterion("equipment_no in", values, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoNotIn(List<String> values) {
+            addCriterion("equipment_no not in", values, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoBetween(String value1, String value2) {
+            addCriterion("equipment_no between", value1, value2, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andEquipmentNoNotBetween(String value1, String value2) {
+            addCriterion("equipment_no not between", value1, value2, "equipmentNo");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrIsNull() {
+            addCriterion("packet_str is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrIsNotNull() {
+            addCriterion("packet_str is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrEqualTo(String value) {
+            addCriterion("packet_str =", value, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrNotEqualTo(String value) {
+            addCriterion("packet_str <>", value, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrGreaterThan(String value) {
+            addCriterion("packet_str >", value, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrGreaterThanOrEqualTo(String value) {
+            addCriterion("packet_str >=", value, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrLessThan(String value) {
+            addCriterion("packet_str <", value, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrLessThanOrEqualTo(String value) {
+            addCriterion("packet_str <=", value, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrLike(String value) {
+            addCriterion("packet_str like", value, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrNotLike(String value) {
+            addCriterion("packet_str not like", value, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrIn(List<String> values) {
+            addCriterion("packet_str in", values, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrNotIn(List<String> values) {
+            addCriterion("packet_str not in", values, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrBetween(String value1, String value2) {
+            addCriterion("packet_str between", value1, value2, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andPacketStrNotBetween(String value1, String value2) {
+            addCriterion("packet_str not between", value1, value2, "packetStr");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateIsNull() {
+            addCriterion("indate is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateIsNotNull() {
+            addCriterion("indate is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateEqualTo(Date value) {
+            addCriterion("indate =", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateNotEqualTo(Date value) {
+            addCriterion("indate <>", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateGreaterThan(Date value) {
+            addCriterion("indate >", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateGreaterThanOrEqualTo(Date value) {
+            addCriterion("indate >=", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateLessThan(Date value) {
+            addCriterion("indate <", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateLessThanOrEqualTo(Date value) {
+            addCriterion("indate <=", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateIn(List<Date> values) {
+            addCriterion("indate in", values, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateNotIn(List<Date> values) {
+            addCriterion("indate not in", values, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateBetween(Date value1, Date value2) {
+            addCriterion("indate between", value1, value2, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateNotBetween(Date value1, Date value2) {
+            addCriterion("indate not between", value1, value2, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseIsNull() {
+            addCriterion("is_use is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseIsNotNull() {
+            addCriterion("is_use is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseEqualTo(Integer value) {
+            addCriterion("is_use =", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseNotEqualTo(Integer value) {
+            addCriterion("is_use <>", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseGreaterThan(Integer value) {
+            addCriterion("is_use >", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseGreaterThanOrEqualTo(Integer value) {
+            addCriterion("is_use >=", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseLessThan(Integer value) {
+            addCriterion("is_use <", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseLessThanOrEqualTo(Integer value) {
+            addCriterion("is_use <=", value, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseIn(List<Integer> values) {
+            addCriterion("is_use in", values, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseNotIn(List<Integer> values) {
+            addCriterion("is_use not in", values, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseBetween(Integer value1, Integer value2) {
+            addCriterion("is_use between", value1, value2, "isUse");
+            return (Criteria) this;
+        }
+
+        public Criteria andIsUseNotBetween(Integer value1, Integer value2) {
+            addCriterion("is_use not between", value1, value2, "isUse");
+            return (Criteria) this;
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated do_not_delete_during_merge Wed Oct 09 18:15:27 CST 2019
+     */
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table mould_down_packet
+     *
+     * @mbg.generated Wed Oct 09 18:15:27 CST 2019
+     */
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 38 - 15
cloud-socket/src/com/js/kbt/model/MouldHistoryTime.java

@@ -6,34 +6,39 @@ public class MouldHistoryTime {
 
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.history_id
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	private Long historyId;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.seq
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	private Integer seq;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.close_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	private Date closeTime;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.open_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	private Date openTime;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.time_cost
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	private Integer timeCost;
+	/**
+	 * This field was generated by MyBatis Generator. This field corresponds to the database column mould_history_time.equipment_no
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
+	 */
+	private String equipmentNo;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.history_id
 	 * @return  the value of mould_history_time.history_id
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Long getHistoryId() {
 		return historyId;
@@ -42,7 +47,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.history_id
 	 * @param historyId  the value for mould_history_time.history_id
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setHistoryId(Long historyId) {
 		this.historyId = historyId;
@@ -51,7 +56,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.seq
 	 * @return  the value of mould_history_time.seq
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Integer getSeq() {
 		return seq;
@@ -60,7 +65,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.seq
 	 * @param seq  the value for mould_history_time.seq
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setSeq(Integer seq) {
 		this.seq = seq;
@@ -69,7 +74,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.close_time
 	 * @return  the value of mould_history_time.close_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Date getCloseTime() {
 		return closeTime;
@@ -78,7 +83,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.close_time
 	 * @param closeTime  the value for mould_history_time.close_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setCloseTime(Date closeTime) {
 		this.closeTime = closeTime;
@@ -87,7 +92,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.open_time
 	 * @return  the value of mould_history_time.open_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Date getOpenTime() {
 		return openTime;
@@ -96,7 +101,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.open_time
 	 * @param openTime  the value for mould_history_time.open_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setOpenTime(Date openTime) {
 		this.openTime = openTime;
@@ -105,7 +110,7 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.time_cost
 	 * @return  the value of mould_history_time.time_cost
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Integer getTimeCost() {
 		return timeCost;
@@ -114,9 +119,27 @@ public class MouldHistoryTime {
 	/**
 	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.time_cost
 	 * @param timeCost  the value for mould_history_time.time_cost
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setTimeCost(Integer timeCost) {
 		this.timeCost = timeCost;
 	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method returns the value of the database column mould_history_time.equipment_no
+	 * @return  the value of mould_history_time.equipment_no
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
+	 */
+	public String getEquipmentNo() {
+		return equipmentNo;
+	}
+
+	/**
+	 * This method was generated by MyBatis Generator. This method sets the value of the database column mould_history_time.equipment_no
+	 * @param equipmentNo  the value for mould_history_time.equipment_no
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
+	 */
+	public void setEquipmentNo(String equipmentNo) {
+		this.equipmentNo = equipmentNo;
+	}
 }

+ 86 - 16
cloud-socket/src/com/js/kbt/model/MouldHistoryTimeExample.java

@@ -7,23 +7,23 @@ import java.util.List;
 public class MouldHistoryTimeExample {
     /**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	protected String orderByClause;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	protected boolean distinct;
 	/**
 	 * This field was generated by MyBatis Generator. This field corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	protected List<Criteria> oredCriteria;
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public MouldHistoryTimeExample() {
 		oredCriteria = new ArrayList<Criteria>();
@@ -31,7 +31,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setOrderByClause(String orderByClause) {
 		this.orderByClause = orderByClause;
@@ -39,7 +39,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public String getOrderByClause() {
 		return orderByClause;
@@ -47,7 +47,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void setDistinct(boolean distinct) {
 		this.distinct = distinct;
@@ -55,7 +55,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public boolean isDistinct() {
 		return distinct;
@@ -63,7 +63,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public List<Criteria> getOredCriteria() {
 		return oredCriteria;
@@ -71,7 +71,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void or(Criteria criteria) {
 		oredCriteria.add(criteria);
@@ -79,7 +79,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Criteria or() {
 		Criteria criteria = createCriteriaInternal();
@@ -89,7 +89,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public Criteria createCriteria() {
 		Criteria criteria = createCriteriaInternal();
@@ -101,7 +101,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	protected Criteria createCriteriaInternal() {
 		Criteria criteria = new Criteria();
@@ -110,7 +110,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This method was generated by MyBatis Generator. This method corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public void clear() {
 		oredCriteria.clear();
@@ -120,7 +120,7 @@ public class MouldHistoryTimeExample {
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	protected abstract static class GeneratedCriteria {
 		protected List<Criterion> criteria;
@@ -462,11 +462,81 @@ public class MouldHistoryTimeExample {
 			addCriterion("time_cost not between", value1, value2, "timeCost");
 			return (Criteria) this;
 		}
+
+		public Criteria andEquipmentNoIsNull() {
+			addCriterion("equipment_no is null");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoIsNotNull() {
+			addCriterion("equipment_no is not null");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoEqualTo(String value) {
+			addCriterion("equipment_no =", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoNotEqualTo(String value) {
+			addCriterion("equipment_no <>", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoGreaterThan(String value) {
+			addCriterion("equipment_no >", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoGreaterThanOrEqualTo(String value) {
+			addCriterion("equipment_no >=", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoLessThan(String value) {
+			addCriterion("equipment_no <", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoLessThanOrEqualTo(String value) {
+			addCriterion("equipment_no <=", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoLike(String value) {
+			addCriterion("equipment_no like", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoNotLike(String value) {
+			addCriterion("equipment_no not like", value, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoIn(List<String> values) {
+			addCriterion("equipment_no in", values, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoNotIn(List<String> values) {
+			addCriterion("equipment_no not in", values, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoBetween(String value1, String value2) {
+			addCriterion("equipment_no between", value1, value2, "equipmentNo");
+			return (Criteria) this;
+		}
+
+		public Criteria andEquipmentNoNotBetween(String value1, String value2) {
+			addCriterion("equipment_no not between", value1, value2, "equipmentNo");
+			return (Criteria) this;
+		}
 	}
 
 	/**
 	 * This class was generated by MyBatis Generator. This class corresponds to the database table mould_history_time
-	 * @mbg.generated  Mon Aug 05 15:38:00 CST 2019
+	 * @mbg.generated  Thu Aug 22 16:38:14 CST 2019
 	 */
 	public static class Criterion {
 		private String condition;

+ 302 - 0
cloud-socket/src/com/js/kbt/model/MouldHoding.java

@@ -0,0 +1,302 @@
+package com.js.kbt.model;
+
+import java.util.Date;
+
+public class MouldHoding {
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_hoding.id
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    private Integer id;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_hoding.enable
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    private Integer enable;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_hoding.uploadcycle_work
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    private Integer uploadcycleWork;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_hoding.uploadcycle_free
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    private Integer uploadcycleFree;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_hoding.lowpowerlimit
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    private String lowpowerlimit;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_hoding.hotalarmlimit
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    private Integer hotalarmlimit;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_hoding.retain
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    private Integer retain;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_hoding.time_count
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    private Integer timeCount;
+
+    /**
+     *
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column mould_hoding.indate
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    private Date indate;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_hoding.id
+     *
+     * @return the value of mould_hoding.id
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_hoding.id
+     *
+     * @param id the value for mould_hoding.id
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_hoding.enable
+     *
+     * @return the value of mould_hoding.enable
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public Integer getEnable() {
+        return enable;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_hoding.enable
+     *
+     * @param enable the value for mould_hoding.enable
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void setEnable(Integer enable) {
+        this.enable = enable;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_hoding.uploadcycle_work
+     *
+     * @return the value of mould_hoding.uploadcycle_work
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public Integer getUploadcycleWork() {
+        return uploadcycleWork;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_hoding.uploadcycle_work
+     *
+     * @param uploadcycleWork the value for mould_hoding.uploadcycle_work
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void setUploadcycleWork(Integer uploadcycleWork) {
+        this.uploadcycleWork = uploadcycleWork;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_hoding.uploadcycle_free
+     *
+     * @return the value of mould_hoding.uploadcycle_free
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public Integer getUploadcycleFree() {
+        return uploadcycleFree;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_hoding.uploadcycle_free
+     *
+     * @param uploadcycleFree the value for mould_hoding.uploadcycle_free
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void setUploadcycleFree(Integer uploadcycleFree) {
+        this.uploadcycleFree = uploadcycleFree;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_hoding.lowpowerlimit
+     *
+     * @return the value of mould_hoding.lowpowerlimit
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public String getLowpowerlimit() {
+        return lowpowerlimit;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_hoding.lowpowerlimit
+     *
+     * @param lowpowerlimit the value for mould_hoding.lowpowerlimit
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void setLowpowerlimit(String lowpowerlimit) {
+        this.lowpowerlimit = lowpowerlimit;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_hoding.hotalarmlimit
+     *
+     * @return the value of mould_hoding.hotalarmlimit
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public Integer getHotalarmlimit() {
+        return hotalarmlimit;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_hoding.hotalarmlimit
+     *
+     * @param hotalarmlimit the value for mould_hoding.hotalarmlimit
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void setHotalarmlimit(Integer hotalarmlimit) {
+        this.hotalarmlimit = hotalarmlimit;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_hoding.retain
+     *
+     * @return the value of mould_hoding.retain
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public Integer getRetain() {
+        return retain;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_hoding.retain
+     *
+     * @param retain the value for mould_hoding.retain
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void setRetain(Integer retain) {
+        this.retain = retain;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_hoding.time_count
+     *
+     * @return the value of mould_hoding.time_count
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public Integer getTimeCount() {
+        return timeCount;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_hoding.time_count
+     *
+     * @param timeCount the value for mould_hoding.time_count
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void setTimeCount(Integer timeCount) {
+        this.timeCount = timeCount;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column mould_hoding.indate
+     *
+     * @return the value of mould_hoding.indate
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public Date getIndate() {
+        return indate;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column mould_hoding.indate
+     *
+     * @param indate the value for mould_hoding.indate
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void setIndate(Date indate) {
+        this.indate = indate;
+    }
+}

+ 853 - 0
cloud-socket/src/com/js/kbt/model/MouldHodingExample.java

@@ -0,0 +1,853 @@
+package com.js.kbt.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+public class MouldHodingExample {
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    protected String orderByClause;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    protected boolean distinct;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    protected List<Criteria> oredCriteria;
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public MouldHodingExample() {
+        oredCriteria = new ArrayList<Criteria>();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void setOrderByClause(String orderByClause) {
+        this.orderByClause = orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public String getOrderByClause() {
+        return orderByClause;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void setDistinct(boolean distinct) {
+        this.distinct = distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public boolean isDistinct() {
+        return distinct;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public List<Criteria> getOredCriteria() {
+        return oredCriteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void or(Criteria criteria) {
+        oredCriteria.add(criteria);
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public Criteria or() {
+        Criteria criteria = createCriteriaInternal();
+        oredCriteria.add(criteria);
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public Criteria createCriteria() {
+        Criteria criteria = createCriteriaInternal();
+        if (oredCriteria.size() == 0) {
+            oredCriteria.add(criteria);
+        }
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    protected Criteria createCriteriaInternal() {
+        Criteria criteria = new Criteria();
+        return criteria;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public void clear() {
+        oredCriteria.clear();
+        orderByClause = null;
+        distinct = false;
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    protected abstract static class GeneratedCriteria {
+        protected List<Criterion> criteria;
+
+        protected GeneratedCriteria() {
+            super();
+            criteria = new ArrayList<Criterion>();
+        }
+
+        public boolean isValid() {
+            return criteria.size() > 0;
+        }
+
+        public List<Criterion> getAllCriteria() {
+            return criteria;
+        }
+
+        public List<Criterion> getCriteria() {
+            return criteria;
+        }
+
+        protected void addCriterion(String condition) {
+            if (condition == null) {
+                throw new RuntimeException("Value for condition cannot be null");
+            }
+            criteria.add(new Criterion(condition));
+        }
+
+        protected void addCriterion(String condition, Object value, String property) {
+            if (value == null) {
+                throw new RuntimeException("Value for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value));
+        }
+
+        protected void addCriterion(String condition, Object value1, Object value2, String property) {
+            if (value1 == null || value2 == null) {
+                throw new RuntimeException("Between values for " + property + " cannot be null");
+            }
+            criteria.add(new Criterion(condition, value1, value2));
+        }
+
+        public Criteria andIdIsNull() {
+            addCriterion("id is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIsNotNull() {
+            addCriterion("id is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdEqualTo(Integer value) {
+            addCriterion("id =", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotEqualTo(Integer value) {
+            addCriterion("id <>", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThan(Integer value) {
+            addCriterion("id >", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdGreaterThanOrEqualTo(Integer value) {
+            addCriterion("id >=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThan(Integer value) {
+            addCriterion("id <", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdLessThanOrEqualTo(Integer value) {
+            addCriterion("id <=", value, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdIn(List<Integer> values) {
+            addCriterion("id in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotIn(List<Integer> values) {
+            addCriterion("id not in", values, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdBetween(Integer value1, Integer value2) {
+            addCriterion("id between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andIdNotBetween(Integer value1, Integer value2) {
+            addCriterion("id not between", value1, value2, "id");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableIsNull() {
+            addCriterion("enable is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableIsNotNull() {
+            addCriterion("enable is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableEqualTo(Integer value) {
+            addCriterion("enable =", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableNotEqualTo(Integer value) {
+            addCriterion("enable <>", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableGreaterThan(Integer value) {
+            addCriterion("enable >", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableGreaterThanOrEqualTo(Integer value) {
+            addCriterion("enable >=", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableLessThan(Integer value) {
+            addCriterion("enable <", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableLessThanOrEqualTo(Integer value) {
+            addCriterion("enable <=", value, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableIn(List<Integer> values) {
+            addCriterion("enable in", values, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableNotIn(List<Integer> values) {
+            addCriterion("enable not in", values, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableBetween(Integer value1, Integer value2) {
+            addCriterion("enable between", value1, value2, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andEnableNotBetween(Integer value1, Integer value2) {
+            addCriterion("enable not between", value1, value2, "enable");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkIsNull() {
+            addCriterion("uploadcycle_work is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkIsNotNull() {
+            addCriterion("uploadcycle_work is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkEqualTo(Integer value) {
+            addCriterion("uploadcycle_work =", value, "uploadcycleWork");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkNotEqualTo(Integer value) {
+            addCriterion("uploadcycle_work <>", value, "uploadcycleWork");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkGreaterThan(Integer value) {
+            addCriterion("uploadcycle_work >", value, "uploadcycleWork");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkGreaterThanOrEqualTo(Integer value) {
+            addCriterion("uploadcycle_work >=", value, "uploadcycleWork");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkLessThan(Integer value) {
+            addCriterion("uploadcycle_work <", value, "uploadcycleWork");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkLessThanOrEqualTo(Integer value) {
+            addCriterion("uploadcycle_work <=", value, "uploadcycleWork");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkIn(List<Integer> values) {
+            addCriterion("uploadcycle_work in", values, "uploadcycleWork");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkNotIn(List<Integer> values) {
+            addCriterion("uploadcycle_work not in", values, "uploadcycleWork");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkBetween(Integer value1, Integer value2) {
+            addCriterion("uploadcycle_work between", value1, value2, "uploadcycleWork");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleWorkNotBetween(Integer value1, Integer value2) {
+            addCriterion("uploadcycle_work not between", value1, value2, "uploadcycleWork");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeIsNull() {
+            addCriterion("uploadcycle_free is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeIsNotNull() {
+            addCriterion("uploadcycle_free is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeEqualTo(Integer value) {
+            addCriterion("uploadcycle_free =", value, "uploadcycleFree");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeNotEqualTo(Integer value) {
+            addCriterion("uploadcycle_free <>", value, "uploadcycleFree");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeGreaterThan(Integer value) {
+            addCriterion("uploadcycle_free >", value, "uploadcycleFree");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeGreaterThanOrEqualTo(Integer value) {
+            addCriterion("uploadcycle_free >=", value, "uploadcycleFree");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeLessThan(Integer value) {
+            addCriterion("uploadcycle_free <", value, "uploadcycleFree");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeLessThanOrEqualTo(Integer value) {
+            addCriterion("uploadcycle_free <=", value, "uploadcycleFree");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeIn(List<Integer> values) {
+            addCriterion("uploadcycle_free in", values, "uploadcycleFree");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeNotIn(List<Integer> values) {
+            addCriterion("uploadcycle_free not in", values, "uploadcycleFree");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeBetween(Integer value1, Integer value2) {
+            addCriterion("uploadcycle_free between", value1, value2, "uploadcycleFree");
+            return (Criteria) this;
+        }
+
+        public Criteria andUploadcycleFreeNotBetween(Integer value1, Integer value2) {
+            addCriterion("uploadcycle_free not between", value1, value2, "uploadcycleFree");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitIsNull() {
+            addCriterion("lowpowerlimit is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitIsNotNull() {
+            addCriterion("lowpowerlimit is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitEqualTo(String value) {
+            addCriterion("lowpowerlimit =", value, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitNotEqualTo(String value) {
+            addCriterion("lowpowerlimit <>", value, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitGreaterThan(String value) {
+            addCriterion("lowpowerlimit >", value, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitGreaterThanOrEqualTo(String value) {
+            addCriterion("lowpowerlimit >=", value, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitLessThan(String value) {
+            addCriterion("lowpowerlimit <", value, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitLessThanOrEqualTo(String value) {
+            addCriterion("lowpowerlimit <=", value, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitLike(String value) {
+            addCriterion("lowpowerlimit like", value, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitNotLike(String value) {
+            addCriterion("lowpowerlimit not like", value, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitIn(List<String> values) {
+            addCriterion("lowpowerlimit in", values, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitNotIn(List<String> values) {
+            addCriterion("lowpowerlimit not in", values, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitBetween(String value1, String value2) {
+            addCriterion("lowpowerlimit between", value1, value2, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andLowpowerlimitNotBetween(String value1, String value2) {
+            addCriterion("lowpowerlimit not between", value1, value2, "lowpowerlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitIsNull() {
+            addCriterion("hotalarmlimit is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitIsNotNull() {
+            addCriterion("hotalarmlimit is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitEqualTo(Integer value) {
+            addCriterion("hotalarmlimit =", value, "hotalarmlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitNotEqualTo(Integer value) {
+            addCriterion("hotalarmlimit <>", value, "hotalarmlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitGreaterThan(Integer value) {
+            addCriterion("hotalarmlimit >", value, "hotalarmlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitGreaterThanOrEqualTo(Integer value) {
+            addCriterion("hotalarmlimit >=", value, "hotalarmlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitLessThan(Integer value) {
+            addCriterion("hotalarmlimit <", value, "hotalarmlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitLessThanOrEqualTo(Integer value) {
+            addCriterion("hotalarmlimit <=", value, "hotalarmlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitIn(List<Integer> values) {
+            addCriterion("hotalarmlimit in", values, "hotalarmlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitNotIn(List<Integer> values) {
+            addCriterion("hotalarmlimit not in", values, "hotalarmlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitBetween(Integer value1, Integer value2) {
+            addCriterion("hotalarmlimit between", value1, value2, "hotalarmlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andHotalarmlimitNotBetween(Integer value1, Integer value2) {
+            addCriterion("hotalarmlimit not between", value1, value2, "hotalarmlimit");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainIsNull() {
+            addCriterion("retain is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainIsNotNull() {
+            addCriterion("retain is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainEqualTo(Integer value) {
+            addCriterion("retain =", value, "retain");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainNotEqualTo(Integer value) {
+            addCriterion("retain <>", value, "retain");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainGreaterThan(Integer value) {
+            addCriterion("retain >", value, "retain");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainGreaterThanOrEqualTo(Integer value) {
+            addCriterion("retain >=", value, "retain");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainLessThan(Integer value) {
+            addCriterion("retain <", value, "retain");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainLessThanOrEqualTo(Integer value) {
+            addCriterion("retain <=", value, "retain");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainIn(List<Integer> values) {
+            addCriterion("retain in", values, "retain");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainNotIn(List<Integer> values) {
+            addCriterion("retain not in", values, "retain");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainBetween(Integer value1, Integer value2) {
+            addCriterion("retain between", value1, value2, "retain");
+            return (Criteria) this;
+        }
+
+        public Criteria andRetainNotBetween(Integer value1, Integer value2) {
+            addCriterion("retain not between", value1, value2, "retain");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountIsNull() {
+            addCriterion("time_count is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountIsNotNull() {
+            addCriterion("time_count is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountEqualTo(Integer value) {
+            addCriterion("time_count =", value, "timeCount");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountNotEqualTo(Integer value) {
+            addCriterion("time_count <>", value, "timeCount");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountGreaterThan(Integer value) {
+            addCriterion("time_count >", value, "timeCount");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountGreaterThanOrEqualTo(Integer value) {
+            addCriterion("time_count >=", value, "timeCount");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountLessThan(Integer value) {
+            addCriterion("time_count <", value, "timeCount");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountLessThanOrEqualTo(Integer value) {
+            addCriterion("time_count <=", value, "timeCount");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountIn(List<Integer> values) {
+            addCriterion("time_count in", values, "timeCount");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountNotIn(List<Integer> values) {
+            addCriterion("time_count not in", values, "timeCount");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountBetween(Integer value1, Integer value2) {
+            addCriterion("time_count between", value1, value2, "timeCount");
+            return (Criteria) this;
+        }
+
+        public Criteria andTimeCountNotBetween(Integer value1, Integer value2) {
+            addCriterion("time_count not between", value1, value2, "timeCount");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateIsNull() {
+            addCriterion("indate is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateIsNotNull() {
+            addCriterion("indate is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateEqualTo(Date value) {
+            addCriterion("indate =", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateNotEqualTo(Date value) {
+            addCriterion("indate <>", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateGreaterThan(Date value) {
+            addCriterion("indate >", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateGreaterThanOrEqualTo(Date value) {
+            addCriterion("indate >=", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateLessThan(Date value) {
+            addCriterion("indate <", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateLessThanOrEqualTo(Date value) {
+            addCriterion("indate <=", value, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateIn(List<Date> values) {
+            addCriterion("indate in", values, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateNotIn(List<Date> values) {
+            addCriterion("indate not in", values, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateBetween(Date value1, Date value2) {
+            addCriterion("indate between", value1, value2, "indate");
+            return (Criteria) this;
+        }
+
+        public Criteria andIndateNotBetween(Date value1, Date value2) {
+            addCriterion("indate not between", value1, value2, "indate");
+            return (Criteria) this;
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table mould_hoding
+     *
+     * @mbg.generated do_not_delete_during_merge Tue Oct 08 17:17:36 CST 2019
+     */
+    public static class Criteria extends GeneratedCriteria {
+
+        protected Criteria() {
+            super();
+        }
+    }
+
+    /**
+     * This class was generated by MyBatis Generator.
+     * This class corresponds to the database table mould_hoding
+     *
+     * @mbg.generated Tue Oct 08 17:17:36 CST 2019
+     */
+    public static class Criterion {
+        private String condition;
+
+        private Object value;
+
+        private Object secondValue;
+
+        private boolean noValue;
+
+        private boolean singleValue;
+
+        private boolean betweenValue;
+
+        private boolean listValue;
+
+        private String typeHandler;
+
+        public String getCondition() {
+            return condition;
+        }
+
+        public Object getValue() {
+            return value;
+        }
+
+        public Object getSecondValue() {
+            return secondValue;
+        }
+
+        public boolean isNoValue() {
+            return noValue;
+        }
+
+        public boolean isSingleValue() {
+            return singleValue;
+        }
+
+        public boolean isBetweenValue() {
+            return betweenValue;
+        }
+
+        public boolean isListValue() {
+            return listValue;
+        }
+
+        public String getTypeHandler() {
+            return typeHandler;
+        }
+
+        protected Criterion(String condition) {
+            super();
+            this.condition = condition;
+            this.typeHandler = null;
+            this.noValue = true;
+        }
+
+        protected Criterion(String condition, Object value, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.typeHandler = typeHandler;
+            if (value instanceof List<?>) {
+                this.listValue = true;
+            } else {
+                this.singleValue = true;
+            }
+        }
+
+        protected Criterion(String condition, Object value) {
+            this(condition, value, null);
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
+            super();
+            this.condition = condition;
+            this.value = value;
+            this.secondValue = secondValue;
+            this.typeHandler = typeHandler;
+            this.betweenValue = true;
+        }
+
+        protected Criterion(String condition, Object value, Object secondValue) {
+            this(condition, value, secondValue, null);
+        }
+    }
+}

+ 327 - 266
cloud-socket/src/com/js/kbt/socket/UserHandler.java

@@ -1,5 +1,5 @@
 package com.js.kbt.socket;
- 
+
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -13,19 +13,26 @@ import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSONObject;
 import com.aliyuncs.http.HttpRequest;
+import com.js.kbt.mapper.MouldDownPacketMapper;
 import com.js.kbt.mapper.MouldHistoryMapper;
 import com.js.kbt.mapper.MouldHistoryTimeMapper;
+import com.js.kbt.mapper.MouldHodingMapper;
 import com.js.kbt.mapper.TbFactoryMapper;
 import com.js.kbt.mapper.TbMouldEquipmentMapper;
 import com.js.kbt.mapper.TbMouldMapper;
+import com.js.kbt.model.MouldDownPacket;
+import com.js.kbt.model.MouldDownPacketExample;
 import com.js.kbt.model.MouldHistory;
 import com.js.kbt.model.MouldHistoryTime;
 import com.js.kbt.model.MouldHistoryTimeExample;
+import com.js.kbt.model.MouldHoding;
+import com.js.kbt.model.PacketMessage;
 import com.js.kbt.model.TbMould;
 import com.js.kbt.model.TbMouldEquipment;
 import com.js.kbt.model.TbMouldEquipmentExample;
 import com.js.kbt.model.TbMouldExample;
 import com.js.kbt.util.MathUtil;
+import com.sun.mail.dsn.message_deliverystatus;
 
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
@@ -33,11 +40,12 @@ import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.SimpleChannelInboundHandler;
 import io.netty.handler.timeout.IdleState;
 import io.netty.handler.timeout.IdleStateEvent;
+
 @Service("userHandler")
 public class UserHandler extends SimpleChannelInboundHandler<String> {
 
-    private static final Logger logger = Logger.getLogger(UserHandler.class);
-    
+	private static final Logger logger = Logger.getLogger(UserHandler.class);
+
 	private ChannelHandlerContext ctx;
 	
 	@Resource
@@ -50,196 +58,230 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 	private TbMouldEquipmentMapper tbMouldEquipmentMapper;
 	@Resource
 	private TbFactoryMapper tbFactoryMapper;
+	@Resource
+	private MouldHodingMapper mouldHodingMapper;
+	@Resource
+	private MouldDownPacketMapper mouldDownPacketMapper;
+
+	@Override
+	protected void channelRead0(ChannelHandlerContext arg0, String arg1) {
+		System.out.println("收到===" + arg1 + "\n");
+		String equipmentNo = processMsg(arg1);
+		//以下是配置下行数据
+		sendPackage(equipmentNo);
+	}
+
+	private String processMsg(String input) {
+		String ret = "FA AF 00 07 02 1e 78 1e 50 00 3C";
+		ret.replaceAll(" ", "");
+		logger.info("=====接收到======" + input);
+		if (!input.startsWith("FAAF")) {
+			logger.info("非云模盒消息,不处理");
+			return ret;
+		}
+		MouldHistory item = new MouldHistory();
+
+		// 抽取手机号码
+		String mobilePart = input.substring(4 * 2, 15 * 2);
+		System.out.println("原始mobile=" + mobilePart);
+		String mobile = getStringFromHexStr(mobilePart);
+		System.out.println("手机号码为" + mobile);
+		item.setSim(mobile);
+		// 获取设备编码15-24
+		String deviceNumPart = input.substring(15 * 2, 25 * 2);
+		String deviceNum = getStringFromHexStr(deviceNumPart);
+		System.out.println("设备No=" + deviceNum);
+		item.setEquipmentNo(deviceNum);
+		// 软件版本号25
+		String version = input.substring(25 * 2, 26 * 2);
+		System.out.println("软件版本号=" + version);
+		item.setVersion(version);
+		String status = input.substring(26 * 2, 27 * 2);
+		System.out.println("工作状态=" + status);
+		item.setStatus(Integer.decode("0x" + status).toString());
+		// 经度27-37
+		String longitude = getStringFromHexStr(input.substring(27 * 2, 38 * 2));
+		System.out.println("经度=" + longitude);
+		item.setLng(longitude);
+		// 38-47纬度以 N 开头
+		String latitude = getStringFromHexStr(input.substring(38 * 2, 48 * 2));
+		System.out.println("纬度=" + latitude);
+		item.setLat(latitude);
+		System.out.println("==lac" + reverseParseHex(input.substring(48 * 2, 50 * 2)));
+		System.out.println("==ci" + reverseParseHex(input.substring(50 * 2, 52 * 2)));
+		item.setGprsLac("" + reverseParseHex(input.substring(48 * 2, 50 * 2)));
+		item.setGprsCi("" + reverseParseHex(input.substring(50 * 2, 52 * 2)));
+		item.setWifiBbsid(input.substring(52 * 2, 58 * 2));
+		String temp = "0x" + input.substring(58 * 2, 59 * 2);
+		System.out.println(temp);
+		int i = Integer.decode(temp);
+		System.out.println(i);
+		item.setTemperature(i);
+		item.setBattery(Integer.decode("0x" + input.substring(59 * 2, 60 * 2)));
+		item.setSig2g(Integer.decode("0x" + input.substring(60 * 2, 61 * 2)));
+		item.setSigNb(Integer.decode("0x" + input.substring(61 * 2, 62 * 2)));
+		item.setSigWifi(Integer.decode("0x" + input.substring(62 * 2, 63 * 2)));
+		item.setExt0("" + Integer.decode("0x" + input.substring(63 * 2, 64 * 2)));
+		item.setAlarm(Integer.decode("0x" + input.substring(64 * 2, 65 * 2)));
+		String str = input.substring(65 * 2, 69 * 2);
+		item.setRunCnt(reverseParseHex(str));
+
+		// 根据基站lac和ci获取经纬度
+		String api = "http://api.cellocation.com:81/cell/?mcc=460&mnc=0&lac=" + item.getGprsLac() + "&ci="
+				+ item.getGprsCi() + "&output=json";
+		String resp = com.js.kbt.util.HttpRequest.sendGet(api, null);
+		JSONObject json = JSONObject.parseObject(resp);
+		if (json.getInteger("errcode") == 0) {
+			item.setLng(json.getDouble("lon") + "");
+			item.setLat(json.getDouble("lat") + "");
+		} else {
+			logger.error("调用基站解析平台出错: " + resp);
+		}
+		String crcStr = input.substring(input.length() - 4);
+		item.setCrcCode("" + reverseParseHex(crcStr));
+		// 存入数据库
+		mouldHistoryMapper.insertSelective(item);
+		// 模具开合记录
+		int cnt = item.getRunCnt();
+		int start = 69;
+		logger.info("累计开合模次数=" + cnt);
+		int end = input.length() - 4; // 最后2位 0xXX,0xXX ,是CRC校验位
+		logger.info("时间信息==" + input.substring(start * 2, end));
+		if (end - start * 2 >= 24) {// 时间最少6位,1位显示0x00,开合算两个时间,所以是6*2*2=24
+			// 本次运行周期内的开合模次数
+			int periodCnt = (end - start * 2) / 24;
+			logger.info("本次开合模次数==" + periodCnt);
+			for (int pos = 0; pos < periodCnt; pos++) {
+				// 合模时间
+				MouldHistoryTime time = new MouldHistoryTime();
+				time.setHistoryId(item.getId());
+				time.setEquipmentNo(item.getEquipmentNo());
+				time.setSeq(pos + 1);
+				Date closeTime = parseDate(input, start, pos, 0);
+				time.setCloseTime(closeTime);
+				// 开模时间
+				Date openTime = parseDate(input, start, pos, 6);
+				time.setOpenTime(openTime);
+				int timeCost = (int) (openTime.getTime() - closeTime.getTime());
+				time.setTimeCost(timeCost);
+				mouldHistoryTimeMapper.insertSelective(time);
+			}
+		} else {
+			logger.info("本次开合模次数==0");
+		}
+		// 统计该模盒的平均开合周期
+		MouldHistoryTimeExample exp = new MouldHistoryTimeExample();
+		exp.createCriteria().andEquipmentNoEqualTo(item.getEquipmentNo());
+		List<MouldHistoryTime> list = mouldHistoryTimeMapper.selectByExample(exp);
+		int avgTime = 0;
+		int totalTime = 0;
+		for (MouldHistoryTime t : list) {
+			totalTime += t.getTimeCost();
+		}
+		if (list.size() == 0) {
+			avgTime = 0;
+		} else {
+			avgTime = totalTime / list.size();
+		}
+		handleModLogic(item, avgTime);
+		//返回设备编号
+		return deviceNum;
+	}
 	
-    @Override
-    protected void channelRead0(ChannelHandlerContext arg0, String arg1)
-            {
-        System.out.println("收到==="+arg1+"\n");
-        String ret = processMsg(arg1);
-//        sendMsg(ret);
-    }
-    
-    private String processMsg(String input) {
-    	String ret = "FA AF 00 07 02 1e 78 1e 50 00 3C";
-    	logger.info("=====接收到======"+input);
-    	MouldHistory item = new MouldHistory();
-    	
-    	//抽取手机号码
-    	String mobilePart = input.substring(4*2, 15*2);
-    	System.out.println("原始mobile="+mobilePart);
-    	String mobile = getStringFromHexStr(mobilePart);
-    	System.out.println("手机号码为"+mobile);
-    	item.setSim(mobile);
-    	//获取设备编码15-24
-    	String deviceNumPart = input.substring(15*2, 25*2);
-    	String deviceNum = getStringFromHexStr(deviceNumPart);
-    	System.out.println(deviceNum);
-    	item.setEquipmentNo(deviceNum);
-    	//软件版本号25
-    	String version = input.substring(25*2, 26*2);
-    	System.out.println("软件版本号="+version);
-    	item.setVersion(version);
-    	String status = input.substring(26*2, 27*2);
-    	System.out.println("工作状态="+status);
-    	item.setStatus(Integer.decode("0x"+status).toString());
-    	//经度27-37
-    	String longitude = getStringFromHexStr(input.substring(27*2, 38*2));
-    	System.out.println("经度="+longitude);
-    	item.setLng(longitude);
-    	//38-47纬度以 N 开头
-    	String latitude = getStringFromHexStr(input.substring(38*2, 48*2));
-    	System.out.println("纬度="+latitude);
-    	item.setLat(latitude);
-    	System.out.println("==lac"+reverseParseHex(input.substring(48*2, 50*2)));
-    	System.out.println("==ci"+reverseParseHex(input.substring(50*2, 52*2)));
-    	item.setGprsLac(""+reverseParseHex(input.substring(48*2, 50*2)));
-    	item.setGprsCi(""+reverseParseHex(input.substring(50*2, 52*2)));
-    	item.setWifiBbsid(input.substring(52*2, 58*2));
-    	String temp = "0x"+input.substring(58*2, 59*2);
-    	System.out.println(temp);
-    	int i = Integer.decode(temp);
-    	System.out.println(i);
-    	item.setTemperature(i);
-    	item.setBattery(Integer.decode("0x"+input.substring(59*2, 60*2)));
-    	item.setSig2g(Integer.decode("0x"+input.substring(60*2, 61*2)));
-    	item.setSigNb(Integer.decode("0x"+input.substring(61*2, 62*2)));
-    	item.setSigWifi(Integer.decode("0x"+input.substring(62*2, 63*2)));
-    	item.setExt0(""+Integer.decode("0x"+input.substring(63*2, 64*2)));
-    	item.setAlarm(Integer.decode("0x"+input.substring(64*2, 65*2)));
-    	String str = input.substring(65*2, 69*2);
-    	item.setRunCnt(reverseParseHex(str));
-    	
-    	//根据基站lac和ci获取经纬度
-    	String api = "http://api.cellocation.com:81/cell/?mcc=460&mnc=0&lac="+item.getGprsLac()+"&ci="+item.getGprsCi()+"&output=json";
-    	String resp = com.js.kbt.util.HttpRequest.sendGet(api, null);
-    	JSONObject json = JSONObject.parseObject(resp);
-    	if (json.getInteger("errcode") == 0) {
-    		item.setLng(json.getDouble("lon") + "");
-    		item.setLat(json.getDouble("lat") + "");
-    	} else {
-    		logger.error("调用基站解析平台出错: " + resp);
-    	}
-    	String crcStr = input.substring(input.length() - 4);
-    	item.setCrcCode(""+reverseParseHex(crcStr));
-    	//存入数据库
-    	mouldHistoryMapper.insertSelective(item);
-    	//模具开合记录
-    	int cnt = item.getRunCnt();
-    	int start = 69;
-    	System.out.println("开合模次数="+cnt);
-    	logger.info("时间=="+input.substring(start*2));
-    	int end = (start+(cnt-1)*6+5 + 6)*2;
-    	if (input.length() >= end) {//防止传过来的只有开合模次数,却没有时间
-    		for (int pos=0; pos<cnt; pos++ ) {
-        		//合模时间
-        		MouldHistoryTime time = new MouldHistoryTime();
-        		time.setHistoryId(item.getId());
-        		time.setSeq(pos + 1);
-        		Date closeTime = parseDate(input, start, pos, 0);
-        		time.setCloseTime(closeTime);
-        		//开模时间
-        		Date openTime = parseDate(input, start, pos, 6);
-        		time.setOpenTime(openTime);
-        		int timeCost = (int) (openTime.getTime() - closeTime.getTime());
-        		time.setTimeCost(timeCost);
-        		mouldHistoryTimeMapper.insertSelective(time);
-        	}
-    	}
-    	
-    	MouldHistoryTimeExample exp = new MouldHistoryTimeExample();
-    	exp.createCriteria().andHistoryIdEqualTo(item.getId());
-    	List<MouldHistoryTime> list = mouldHistoryTimeMapper.selectByExample(exp);
-    	int avgTime = 0;
-    	int totalTime = 0;
-    	for (MouldHistoryTime t : list) {
-    		totalTime += t.getTimeCost();
-    	}
-    	if (list.size() == 0) {
-    		avgTime = 0;
-    	} else {
-    		avgTime = totalTime / list.size();
-    	}
-    	
-    	handleModLogic(item, avgTime);
-    	return ret;
-    }
-    
-    private void handleModLogic(MouldHistory item, int avgTime) {
-    	TbMouldEquipmentExample meqExp = new TbMouldEquipmentExample();
-    	meqExp.createCriteria().andEquipmentNoEqualTo(item.getEquipmentNo());
-    	if (tbMouldEquipmentMapper.countByExample(meqExp) > 0) {
-    		TbMouldEquipment me = tbMouldEquipmentMapper.selectByExample(meqExp).get(0);
-    		me.setHillNumber(item.getBattery()+"%");
-    		if (item.getLng() != null) {
-    			me.setLng(Double.parseDouble(item.getLng()));
-    			me.setLat(Double.parseDouble(item.getLat()));
-    		}
-			
+	public void sendPackage(String equipmentNo){
+		if(equipmentNo.indexOf("FAAF") != -1){
+			return;
+		}
+		MouldDownPacketExample exp = new MouldDownPacketExample();
+		exp.createCriteria().andEquipmentNoEqualTo(equipmentNo);
+		List<MouldDownPacket> list = mouldDownPacketMapper.selectByExample(exp);
+		if(list.size()>0){
+			MouldDownPacket packet = list.get(0);
+			if(0==packet.getIsUse()){
+				logger.info("开始下发数据包==>"+packet.getPacketStr());
+				sendMsg(packet.getPacketStr());
+			}
+		}
+	}
+
+	
+
+	private void handleModLogic(MouldHistory item, int avgTime) {
+		TbMouldEquipmentExample meqExp = new TbMouldEquipmentExample();
+		meqExp.createCriteria().andEquipmentNoEqualTo(item.getEquipmentNo());
+		if (tbMouldEquipmentMapper.countByExample(meqExp) > 0) {
+			TbMouldEquipment me = tbMouldEquipmentMapper.selectByExample(meqExp).get(0);
+			me.setHillNumber(item.getBattery() + "%");
+			if (item.getLng() != null) {
+				me.setLng(Double.parseDouble(item.getLng()));
+				me.setLat(Double.parseDouble(item.getLat()));
+			}
+
 			me.setTemperature(item.getTemperature());
 			tbMouldEquipmentMapper.updateByPrimaryKeySelective(me);
-			
-    		TbMouldExample tExp = new TbMouldExample();	
-    		tExp.setOrderByClause("id desc limit 1");
-    		tExp.createCriteria().andEquipmentIdEqualTo(me.getId());
-    		if (tbMouldMapper.countByExample(tExp) > 0) {
-    			TbMould tm = tbMouldMapper.selectByExample(tExp).get(0);
-    			tm.setState(item.getStatus());
-    			tm.setRunTimes(tm.getRunTimes() + item.getRunCnt());
-    			
-    			//处理每模平均周期(单位秒)
-    			BigDecimal bd = new BigDecimal(avgTime*1.00/1000);
-    			tm.setOcCycle(bd);
-    			tbMouldMapper.updateByPrimaryKeySelective(tm);
-    			
-    			//处理报警
-    			if (item.getAlarm() > 0) {
-    				/**
-    				 * 无报警  0;
-					  低电量报警 1;
-					  温度过热 2;
-					  安装被拆 8。
-    				 */
-    				logger.info("设备报警啦:"+item.getAlarm());
-    			}
-    		}
-    	}
-    }
-    
-    /**
-     * 低位在前的16进制解析
-     * @param rHex
-     * @return
-     */
-    public static int reverseParseHex(String rHex) {
-    	int size = rHex.length()/2;
-    	StringBuilder sb = new StringBuilder();
-    	for (int i=0;i<size; i++) {
-    		sb.append(rHex.substring((size - i -1)*2, (size - i)*2));
-    	}
-    	String str = sb.toString();
-    	return Integer.parseInt(str, 16);
-    }
-    
-    private static Date parseDate(String input, int start, int pos, int dateStartPos) {
-    	String year = input.substring((start+pos*6 + dateStartPos)*2, (start+pos*6 + 1 + dateStartPos)*2);
-		String month = input.substring((start+pos*6+1 + dateStartPos)*2, (start+pos*6 + 2 + dateStartPos)*2);
-		String day = input.substring((start+pos*6+2 + dateStartPos)*2, (start+pos*6 + 3 + dateStartPos)*2);
-		String hh = input.substring((start+pos*6+3 + dateStartPos)*2, (start+pos*6 + 4 + dateStartPos)*2);
-		String mm = input.substring((start+pos*6+4 + dateStartPos)*2, (start+pos*6 + 5 + dateStartPos)*2);
-		String ss = input.substring((start+pos*6+5 + dateStartPos)*2, (start+pos*6 + 6 + dateStartPos)*2);
+
+			TbMouldExample tExp = new TbMouldExample();
+			tExp.setOrderByClause("id desc limit 1");
+			tExp.createCriteria().andEquipmentIdEqualTo(me.getId());
+			if (tbMouldMapper.countByExample(tExp) > 0) {
+				TbMould tm = tbMouldMapper.selectByExample(tExp).get(0);
+				tm.setState(item.getStatus());
+				tm.setRunTimes(tm.getRunTimes() + item.getRunCnt());
+
+				// 处理每模平均周期(单位秒)
+				BigDecimal bd = new BigDecimal(avgTime * 1.00 / 1000);
+				tm.setOcCycle(bd);
+				tbMouldMapper.updateByPrimaryKeySelective(tm);
+
+				// 处理报警
+				if (item.getAlarm() > 0) {
+					/**
+					 * 无报警 0; 低电量报警 1; 温度过热 2; 安装被拆 8。
+					 */
+					logger.info("设备报警啦:" + item.getAlarm());
+				}
+			}
+		}
+	}
+
+	/**
+	 * 低位在前的16进制解析
+	 * 
+	 * @param rHex
+	 * @return
+	 */
+	public static int reverseParseHex(String rHex) {
+		int size = rHex.length() / 2;
+		StringBuilder sb = new StringBuilder();
+		for (int i = 0; i < size; i++) {
+			sb.append(rHex.substring((size - i - 1) * 2, (size - i) * 2));
+		}
+		String str = sb.toString();
+		return Integer.parseInt(str, 16);
+	}
+
+	private static Date parseDate(String input, int start, int pos, int dateStartPos) {
+		String year = input.substring((start + pos * 6 + dateStartPos) * 2, (start + pos * 6 + 1 + dateStartPos) * 2);
+		String month = input.substring((start + pos * 6 + 1 + dateStartPos) * 2,
+				(start + pos * 6 + 2 + dateStartPos) * 2);
+		String day = input.substring((start + pos * 6 + 2 + dateStartPos) * 2,
+				(start + pos * 6 + 3 + dateStartPos) * 2);
+		String hh = input.substring((start + pos * 6 + 3 + dateStartPos) * 2, (start + pos * 6 + 4 + dateStartPos) * 2);
+		String mm = input.substring((start + pos * 6 + 4 + dateStartPos) * 2, (start + pos * 6 + 5 + dateStartPos) * 2);
+		String ss = input.substring((start + pos * 6 + 5 + dateStartPos) * 2, (start + pos * 6 + 6 + dateStartPos) * 2);
 		StringBuilder sb = new StringBuilder();
 		int yearInt = Integer.parseInt(year, 16);
 		if (yearInt == 0) {
 			sb.append("2019-01-01");
 		} else {
-			sb.append(yearInt < 100?"20":"2");
+			sb.append(yearInt < 100 ? "20" : "2");
 			sb.append(yearInt).append("-");
 			int monthInt = Integer.parseInt(month, 16);
-			sb.append(monthInt<10?"0":"").append(monthInt).append("-");
+			sb.append(monthInt < 10 ? "0" : "").append(monthInt).append("-");
 			int dayInt = Integer.parseInt(day, 16);
-			sb.append(dayInt<10?"0":"").append(dayInt);
+			sb.append(dayInt < 10 ? "0" : "").append(dayInt);
 		}
-		
+
 		Date parseDate = null;
 		try {
 			parseDate = new SimpleDateFormat("yyyy-MM-dd").parse(sb.toString());
@@ -250,51 +292,50 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 			e.printStackTrace();
 		}
 		return parseDate;
-    }
-    
-    
-    private String getStringFromHexStr(String hexStr) {
-    	StringBuilder sb = new StringBuilder();
-    	for (int i=0;i<hexStr.length()/2; i++) {
-    		String str = "0x"+hexStr.substring(i*2, i*2 + 2);
-    		int intVal = Integer.decode(str).intValue();
-    		char c = (char)intVal;
-    		sb.append(c);
-    	}
-    	return sb.toString();
-    }
-    
-    
-    public void close() {
-    	ctx.close();
-    }
-    
-    public void sendMsg(String hexString) {
-    	System.out.println("发送消息=="+hexString);
-    	byte[] buffer = hexStrToBinaryStr(hexString);
-    	ByteBuf bf = Unpooled.buffer(hexString.length()/2);
-    	bf.writeBytes(buffer);
-    	
-    	ctx.writeAndFlush(bf);
-//    	ctx.close();
-    }
-    
-    /**
-     * channel被激活时调用
-     */
-    @Override
-    public void channelActive(ChannelHandlerContext ctx){
-        // TODO Auto-generated method stub
-        this.ctx = ctx; 
-        System.out.println("==========Active========="+ctx.channel().localAddress().toString()+", connection num="+HelloServer.deviceMap.size());
-    }
+	}
+
+	private String getStringFromHexStr(String hexStr) {
+		StringBuilder sb = new StringBuilder();
+		for (int i = 0; i < hexStr.length() / 2; i++) {
+			String str = "0x" + hexStr.substring(i * 2, i * 2 + 2);
+			int intVal = Integer.decode(str).intValue();
+			char c = (char) intVal;
+			sb.append(c);
+		}
+		return sb.toString();
+	}
+
+	public void close() {
+		ctx.close();
+	}
+
+	public void sendMsg(String hexString) {
+		System.out.println("发送消息==" + hexString);
+		byte[] buffer = hexStrToBinaryStr(hexString);
+		ByteBuf bf = Unpooled.buffer(hexString.length() / 2);
+		bf.writeBytes(buffer);
+
+		ctx.writeAndFlush(bf);
+		// ctx.close();
+	}
+
+	/**
+	 * channel被激活时调用
+	 */
+	@Override
+	public void channelActive(ChannelHandlerContext ctx) {
+		// TODO Auto-generated method stub
+		this.ctx = ctx;
+		System.out.println("==========Active=========" + ctx.channel().localAddress().toString() + ", connection num="
+				+ HelloServer.deviceMap.size());
+	}
 
 	@Override
 	public void channelInactive(ChannelHandlerContext ctx) throws Exception {
 		super.channelInactive(ctx);
 		System.out.println("==========Inactive=========");
 	}
-	
+
 	@Override
 	public void handlerRemoved(ChannelHandlerContext ctx) throws Exception {
 		// TODO Auto-generated method stub
@@ -303,33 +344,31 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 	}
 
 	@Override
-	public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause)
-			throws Exception {
+	public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
 		// TODO Auto-generated method stub
 		super.exceptionCaught(ctx, cause);
 		System.out.println("我捕捉到异常信息了");
 	}
- 
-	
+
 	@Override
-    public void userEventTriggered(ChannelHandlerContext ctx, Object evt)
-	    throws Exception {
+	public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
 		if (evt instanceof IdleStateEvent) {
-		    IdleStateEvent event = (IdleStateEvent) evt;
-		    if (event.state().equals(IdleState.READER_IDLE)) {
-		    } else if (event.state().equals(IdleState.WRITER_IDLE)) {
-//		    	System.out.println("WRITER_IDLE=="+userInfo.getWxName());
-	//			logger.debug(ctx.channel().remoteAddress().toString()+ "WRITER_IDLE");
+			IdleStateEvent event = (IdleStateEvent) evt;
+			if (event.state().equals(IdleState.READER_IDLE)) {
+			} else if (event.state().equals(IdleState.WRITER_IDLE)) {
+				// System.out.println("WRITER_IDLE=="+userInfo.getWxName());
+				// logger.debug(ctx.channel().remoteAddress().toString()+
+				// "WRITER_IDLE");
 				// 超时关闭channel
-		//		ctx.close();
-		    } else if (event.state().equals(IdleState.ALL_IDLE)) {
-		    	// 发送心跳
-		    	ctx.channel().writeAndFlush("$&_".toString());
-		    }
+				// ctx.close();
+			} else if (event.state().equals(IdleState.ALL_IDLE)) {
+				// 发送心跳
+				ctx.channel().writeAndFlush("$&_".toString());
+			}
 		}
-//		super.userEventTriggered(ctx, evt);
-    }
-	
+		// super.userEventTriggered(ctx, evt);
+	}
+
 	/**
 	 * 将十六进制的字符串转换成字节数组
 	 *
@@ -346,44 +385,66 @@ public class UserHandler extends SimpleChannelInboundHandler<String> {
 		byte[] bytes = new byte[len / 2];
 		while (index < len) {
 			String sub = hexString.substring(index, index + 2);
-			bytes[index/2] = (byte)Integer.parseInt(sub,16);
+			bytes[index / 2] = (byte) Integer.parseInt(sub, 16);
 			index += 2;
 		}
 		return bytes;
 	}
-	
+
 	/**
 	 * 将字节数组转换成十六进制的字符串
 	 *
 	 * @return
 	 */
 	public static String BinaryToHexString(byte[] bytes) {
-	    String hexStr = "0123456789ABCDEF";
-	    String result = "";
-	    String hex = "";
-	    for (byte b : bytes) {
-	        hex = String.valueOf(hexStr.charAt((b & 0xF0) >> 4));
-	        hex += String.valueOf(hexStr.charAt(b & 0x0F));
-	        result += hex + " ";
-	    }
-	    return result;
+		String hexStr = "0123456789ABCDEF";
+		String result = "";
+		String hex = "";
+		for (byte b : bytes) {
+			hex = String.valueOf(hexStr.charAt((b & 0xF0) >> 4));
+			hex += String.valueOf(hexStr.charAt(b & 0x0F));
+			result += hex + " ";
+		}
+		return result;
 	}
-	
+
 	public static void main(String[] args) {
-//		String str = "1F51";
-		String str = "FAAF470000000000000000000000003137333030303239333810010000000000000000000000000000000000000000001F51E85F0000000000004800646400010001000000ACE1";
-//		String temp = "0x"+str;
-//		int i = Integer.decode(temp);
-//		System.out.println(i);
-//		int p = reverseParseHex(str);
-//		System.out.println(p);
-//		int start = 69;
-//		System.out.println(str.substring(69*2));
-//		Date d = parseDate(str, start, 0, 0);
-//		System.out.println(d.toGMTString());
-		str = str.substring(str.length() - 4);
-		System.out.println(str);
-		System.out.println(reverseParseHex(str));
+		// String str = "1F51";
+		String input = "FAAF530000000000000000000000003137333030303239343310010000000000000000000000000000000000000000001F51E85F00000000000045004A54000100110000001308160F171F1308160F2D188FCA";
+		// String temp = "0x"+str;
+		// int i = Integer.decode(temp);
+		// System.out.println(i);
+		// int p = reverseParseHex(str);
+		// System.out.println(p);
+		// int start = 69;
+		// System.out.println(str.substring(69*2));
+		// Date d = parseDate(str, start, 0, 0);
+		// System.out.println(d.toGMTString());
+
+		int start = 69;
+		int end = input.length() - 4; // 最后2位 0xXX,0xXX ,是CRC校验位
+		logger.info("时间信息==" + input.substring(start * 2, end));
+		if (end - start * 2 >= 24) {// 时间最少6位,1位显示0x00,开合算两个时间,所以是6*2*2=24
+			// 本次运行周期内的开合模次数
+			int periodCnt = (end - start * 2) / 24;
+			logger.info("本次开合模次数==" + periodCnt);
+			for (int pos = 0; pos < periodCnt; pos++) {
+				// 合模时间
+				MouldHistoryTime time = new MouldHistoryTime();
+				time.setSeq(pos + 1);
+				Date closeTime = parseDate(input, start, pos, 0);
+				System.out.println(closeTime);
+				time.setCloseTime(closeTime);
+				// 开模时间
+				Date openTime = parseDate(input, start, pos, 6);
+				time.setOpenTime(openTime);
+				System.out.println(openTime);
+				int timeCost = (int) (openTime.getTime() - closeTime.getTime());
+				time.setTimeCost(timeCost);
+			}
+		} else {
+			logger.info("本次开合模次数==0");
+		}
 	}
-	
+
 }

+ 8 - 7
cloud-socket/src/jdbc.properties

@@ -1,8 +1,9 @@
-classPath=D:/workspace/yunsu/cloud-socket/WebContent/WEB-INF/lib/mysql-connector-java-5.1.31-bin.jar
-driver=com.mysql.jdbc.Driver
-url=jdbc:mysql://118.190.47.230:3306/cloud_model?autoReconnect=true&rewriteBatchedStatements=TRUE&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8
-username=root
-password=p011430seya10
-maxActive=255
-maxIdle=20
+#classPath=D:/model/cloud-socket/WebContent/WEB-INF/lib/mysql-connector-java-5.1.31-bin.jar
+classPath=D:/workspace/yunsu/cloud-socket/WebContent/WEB-INF/lib/mysql-connector-java-5.1.31-bin.jar
+driver=com.mysql.jdbc.Driver
+url=jdbc:mysql://118.190.47.230:3306/cloud_model?autoReconnect=true&rewriteBatchedStatements=TRUE&zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=UTF-8
+username=root
+password=p011430seya1026
+maxActive=255
+maxIdle=20
 maxWait=100

+ 4 - 1
target/classes/main/resources/application-prod.properties

@@ -13,7 +13,10 @@ spring.thymeleaf.jackson.date-format=yyyy-MM-dd HH:mm:ss
 # ####################################################################################################
 # 数据源配置
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
-spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+# 云模服务器对应的数据库
+#spring.datasource.url=jdbc:mysql://118.190.47.230:3306/cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+# 我们测试的自己服务器数据库
+spring.datasource.url=jdbc:mysql://118.190.47.230:3306/new_cloud_model?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
 spring.datasource.username=root
 spring.datasource.password=p011430seya1026
 #spring.datasource.druid.test-on-borrow=true

+ 11 - 5
target/classes/main/resources/mapper/ProjectMapper.xml

@@ -46,13 +46,15 @@
     </resultMap>
     <select id="getProjectListByUid" resultMap="BaseResultMapList">
         select
-        p.id id,p.project_name project_name, p.creator creator,p.owner_company owner_company,
-        p.owner_company_name owner_company_name,p.manager_id manager_id,p.manager manager,
+        p.id id,p.project_name project_name, p.creator creator,tbc.id owner_company,
+        tbc.company_name owner_company_name,p.manager_id manager_id,p.manager manager,
         p.indate indate
         from
         tb_project p
         left join tb_project_user pu
         on p.id = pu.project_id
+        left join tb_company tbc
+        on p.owner_company = tbc.id
         left join tb_project_approve tpa
         on tpa.project_id = p.id
         <where>
@@ -68,13 +70,15 @@
     </select>
     <select id="getProjectListByUidInProjectIds" resultMap="BaseResultMapList">
         select
-        p.id id,p.project_name project_name, p.creator creator,p.owner_company owner_company,
-        p.owner_company_name owner_company_name,p.manager_id manager_id,p.manager manager,
+        p.id id,p.project_name project_name, p.creator creator,tbc.id owner_company,
+        tbc.company_name owner_company_name,p.manager_id manager_id,p.manager manager,
         p.indate indate
         from
         tb_project p
         left join tb_project_user pu
         on p.id = pu.project_id
+        left join tb_company tbc
+        on p.owner_company = tbc.id
         left join tb_project_approve tpa
         on tpa.project_id = p.id
         <where>
@@ -147,7 +151,7 @@
     <select id="getProjectById" resultMap="BaseResultMapVO">
     select
         p.id id, p.project_name project_name, p.project_no project_no, p.creator_id creator_id,p.manager_id manager_id,p.manager manager,
-        p.creator creator, p.owner_company owner_company,p.owner_company_name owner_company_name,p.indate pindate,m.belong_project_grade,
+        p.creator creator, tbp.id owner_company,tbp.company_name owner_company_name,p.indate pindate,m.belong_project_grade,
         m.id model_id, m.model_no model_no,m.model_name model_name,a.approver_id approver_id,a.approver_name approver_name,a.subordinate_type subordinate_type,
         c.company_id companyid,c.company_name companyname,tbc.company_name produce_company_name,tbc.id produce_company_id
     from
@@ -160,6 +164,8 @@
     on c.project_id = p.id
     LEFT JOIN tb_company tbc
     ON tbc.`id` = m.`produce_company_id`
+    left join tb_company tbp
+    on tbp.id = p.owner_company
     where
       p.id = #{id}
     </select>