فهرست منبع

第一次推送

lym 4 سال پیش
والد
کامیت
0c7f11ad29
93فایلهای تغییر یافته به همراه10187 افزوده شده و 0 حذف شده
  1. 322 0
      pom.xml
  2. 26 0
      src/main/java/com/hcloud/microservice/goods/GoodsManageServiceApplication.java
  3. 51 0
      src/main/java/com/hcloud/microservice/goods/bo/GoodsBatchInfoBO.java
  4. 31 0
      src/main/java/com/hcloud/microservice/goods/bo/GoodsFeedbackBO.java
  5. 21 0
      src/main/java/com/hcloud/microservice/goods/bo/GoodsGradeBO.java
  6. 68 0
      src/main/java/com/hcloud/microservice/goods/bo/GoodsQRCodeInfoBO.java
  7. 46 0
      src/main/java/com/hcloud/microservice/goods/bo/GoodsQRCodeRecordBO.java
  8. 167 0
      src/main/java/com/hcloud/microservice/goods/config/DruidDBConfig.java
  9. 85 0
      src/main/java/com/hcloud/microservice/goods/controller/GoodsBatchGradeManageController.java
  10. 192 0
      src/main/java/com/hcloud/microservice/goods/controller/GoodsBatchManageController.java
  11. 87 0
      src/main/java/com/hcloud/microservice/goods/controller/GoodsDealerController.java
  12. 80 0
      src/main/java/com/hcloud/microservice/goods/controller/GoodsFeedbackManageController.java
  13. 115 0
      src/main/java/com/hcloud/microservice/goods/controller/GoodsFieldManageController.java
  14. 112 0
      src/main/java/com/hcloud/microservice/goods/controller/GoodsManageController.java
  15. 82 0
      src/main/java/com/hcloud/microservice/goods/controller/GoodsProInputsManageController.java
  16. 82 0
      src/main/java/com/hcloud/microservice/goods/controller/GoodsProNormalManageController.java
  17. 139 0
      src/main/java/com/hcloud/microservice/goods/controller/GoodsQRCodeInfoController.java
  18. 165 0
      src/main/java/com/hcloud/microservice/goods/controller/GoodsQRCodeRecordController.java
  19. 79 0
      src/main/java/com/hcloud/microservice/goods/controller/GoodsTracedUserManageController.java
  20. 27 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsAssayInfoMapper.java
  21. 38 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsBatchFeedbackMapper.java
  22. 37 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsBatchGradeMapper.java
  23. 23 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsBatchInfoMapper.java
  24. 45 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsBatchLabelMapper.java
  25. 45 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsDealerMapper.java
  26. 41 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsFieldMapper.java
  27. 37 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsInfoAuxiliaryMapper.java
  28. 24 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsInfoMapper.java
  29. 45 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsLabelMapper.java
  30. 42 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsProInputsMapper.java
  31. 43 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsProNormalMapper.java
  32. 73 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsQRCodeInfoMapper.java
  33. 93 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsQRCodeRecordMapper.java
  34. 28 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsTracedUserMapper.java
  35. 12 0
      src/main/java/com/hcloud/microservice/goods/dao/GoodsTypeMapper.java
  36. 28 0
      src/main/java/com/hcloud/microservice/goods/enums/TracedCodeImgInfoEnum.java
  37. 21 0
      src/main/java/com/hcloud/microservice/goods/event/TracedQRCodeImgEvent.java
  38. 57 0
      src/main/java/com/hcloud/microservice/goods/eventlisteners/BusinessListener.java
  39. 47 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsAssayInfoService.java
  40. 35 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsBatchFeedbackService.java
  41. 35 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsBatchGradeService.java
  42. 56 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsBatchInfoService.java
  43. 34 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsDealerService.java
  44. 43 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsFieldService.java
  45. 27 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsInfoService.java
  46. 10 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsInterAuxiliaryService.java
  47. 41 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsProInputsService.java
  48. 41 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsProNormalService.java
  49. 87 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsQRCodeInfoService.java
  50. 58 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsQRCodeRecordService.java
  51. 21 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsQRCodeRecordStatService.java
  52. 29 0
      src/main/java/com/hcloud/microservice/goods/service/GoodsTracedUserService.java
  53. 263 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodQRCodeRecordServiceImpl.java
  54. 215 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsAssayInfServiceImpl.java
  55. 114 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsBatchFeedbackServiceImpl.java
  56. 111 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsBatchGradeServiceImpl.java
  57. 531 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsBatchInfoServiceImpl.java
  58. 125 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsDealerServiceImpl.java
  59. 221 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsFieldServiceImpl.java
  60. 94 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsInfoServiceImpl.java
  61. 69 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsInterAuxiliaryServiceImpl.java
  62. 136 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsProInputsServiceImpl.java
  63. 135 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsProNormalServiceImpl.java
  64. 377 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsQRCodeInfoServiceImpl.java
  65. 188 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsQRCodeRecordStatServiceImpl.java
  66. 101 0
      src/main/java/com/hcloud/microservice/goods/service/impl/GoodsTracedUserServiceImpl.java
  67. 76 0
      src/main/resources/application-dev.properties
  68. 79 0
      src/main/resources/application-pro.properties
  69. 71 0
      src/main/resources/application-test.properties
  70. 3 0
      src/main/resources/application.properties
  71. 38 0
      src/main/resources/generatorConfig.xml
  72. 176 0
      src/main/resources/mappers/GoodsAssayInfoMapper.xml
  73. 240 0
      src/main/resources/mappers/GoodsBatchFeedbackMapper.xml
  74. 189 0
      src/main/resources/mappers/GoodsBatchGradeMapper.xml
  75. 277 0
      src/main/resources/mappers/GoodsBatchInfoMapper.xml
  76. 171 0
      src/main/resources/mappers/GoodsBatchLabelMapper.xml
  77. 286 0
      src/main/resources/mappers/GoodsDealerMapper.xml
  78. 249 0
      src/main/resources/mappers/GoodsFieldMapper.xml
  79. 191 0
      src/main/resources/mappers/GoodsInfoAuxiliaryMapper.xml
  80. 190 0
      src/main/resources/mappers/GoodsInfoMapper.xml
  81. 143 0
      src/main/resources/mappers/GoodsLabelMapper.xml
  82. 246 0
      src/main/resources/mappers/GoodsProInputsMapper.xml
  83. 248 0
      src/main/resources/mappers/GoodsProNormalMapper.xml
  84. 393 0
      src/main/resources/mappers/GoodsQRCodeInfoMapper.xml
  85. 350 0
      src/main/resources/mappers/GoodsQRCodeRecordMapper.xml
  86. 212 0
      src/main/resources/mappers/GoodsTracedUserMapper.xml
  87. 117 0
      src/main/resources/mappers/GoodsTypeMapper.xml
  88. 54 0
      src/main/resources/swagger-ui.html
  89. 17 0
      src/test/java/com/hcloud/microservice/goods/GoodsManageServiceApplicationTests.java
  90. 70 0
      src/test/java/com/hcloud/microservice/goods/controller/GoodsQRCodeInfoControllerTest.java
  91. 33 0
      src/test/java/com/hcloud/microservice/goods/service/impl/GoodsBatchInfoServiceImplTest.java
  92. 36 0
      src/test/java/com/hcloud/microservice/goods/service/impl/GoodsQRCodeInfoServiceImplTest.java
  93. 79 0
      src/test/java/com/hcloud/microservice/goods/service/impl/GoodsQRCodeRecordStatServiceImplTest.java

+ 322 - 0
pom.xml

@@ -0,0 +1,322 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.hcloud.microserver</groupId>
+        <artifactId>common-parent</artifactId>
+        <version>0.0.1-SNAPSHOT</version>
+        <relativePath>../common-parent/pom.xml</relativePath>
+    </parent>
+    <groupId>com.hcloud.miroserver</groupId>
+    <artifactId>goods-manage-service</artifactId>
+    <version>${goods.managerclient.version}</version>
+    <packaging>jar</packaging>
+
+    <name>goods-manage-service</name>
+    <description>Demo project for Spring Boot</description>
+
+
+
+    <dependencies>
+        <dependency>
+            <groupId>com.hcloud.microserver</groupId>
+            <artifactId>common-core</artifactId>
+            <version>${common.core.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.hcloud.microserver</groupId>
+            <artifactId>goods-manage-client</artifactId>
+            <version>${goods.managerclient.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis</groupId>
+            <artifactId>mybatis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-eureka</artifactId>
+        </dependency>
+        <!--druid -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid</artifactId>
+        </dependency>
+        <!-- 分页支持pageHelper -->
+        <dependency>
+            <groupId>com.github.pagehelper</groupId>
+            <artifactId>pagehelper-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-cache</artifactId>
+            <version>1.5.18.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-ribbon</artifactId>
+        </dependency>
+        <!-- java9+版本以后,JAXB默认没有加载,手动添加jaxb模块 -->
+        <!-- <dependency>
+		    <groupId>javax.xml.bind</groupId>
+		    <artifactId>jaxb-api</artifactId>
+		    <version>2.2.11</version>
+		</dependency>
+		<dependency>
+		    <groupId>com.sun.xml.bind</groupId>
+		    <artifactId>jaxb-core</artifactId>
+		    <version>2.2.11</version>
+		</dependency>
+		<dependency>
+		    <groupId>com.sun.xml.bind</groupId>
+		    <artifactId>jaxb-impl</artifactId>
+		    <version>2.2.11</version>
+		</dependency>
+		<dependency>
+		    <groupId>javax.activation</groupId>
+		    <artifactId>activation</artifactId>
+		    <version>1.1.1</version>
+		</dependency> -->
+		 <!-- SpringWeb模块 -->
+	    <!-- dependency>
+           <groupId>org.springframework</groupId>
+           <artifactId>spring-web</artifactId>
+           <version>5.2.1.RELEASE</version>
+        </dependency>
+        <dependency>
+		    <groupId>org.springframework.boot</groupId>
+		    <artifactId>spring-boot</artifactId>
+		    <version>1.5.18.RELEASE</version>
+		</dependency>
+		<dependency>
+		    <groupId>org.springframework</groupId>
+		    <artifactId>spring-expression</artifactId>
+		    <version>5.2.1.RELEASE</version>
+		</dependency> -->
+    </dependencies>
+
+    <!-- <build>
+        <plugins>
+            打JAR包
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    不打包资源文件(配置文件和依赖包分开)
+                    <excludes>
+                        <exclude>*.**</exclude>
+                        <exclude>*/*.xml</exclude>
+                    </excludes>
+                    <archive>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                            MANIFEST.MF 中 Class-Path 加入前缀
+                            <classpathPrefix>lib/</classpathPrefix>
+                            jar包不包含唯一版本标识
+                            <useUniqueVersions>false</useUniqueVersions>
+                            指定入口类
+                            <mainClass>com.hcloud.microservice.goods.GoodsManageServiceApplication</mainClass>
+                        </manifest>
+                        <manifestEntries>
+                            MANIFEST.MF 中 Class-Path 加入资源文件目录
+                            <Class-Path>./resources/</Class-Path>
+                        </manifestEntries>
+                    </archive>
+                    <outputDirectory>${project.build.directory}</outputDirectory>
+                </configuration>
+            </plugin>
+
+            该插件的作用是用于复制依赖的jar包到指定的文件夹里
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/lib/</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            该插件的作用是用于复制指定的文件
+            <plugin>
+                <artifactId>maven-resources-plugin</artifactId>
+                <executions>
+                    <execution> 复制配置文件
+                        <id>copy-resources</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/resources</directory>
+                                    <includes>
+                                        <include>*.properties</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                            <outputDirectory>${project.build.directory}/resources</outputDirectory>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+
+            SpringBoot 打包插件,把 maven-jar-plugin 打成的jar包重新打成可运行jar包
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    重写包含依赖,包含不存在的依赖,jar里没有pom里的依赖
+                    <includes>
+                        <include>
+                            <groupId>null</groupId>
+                            <artifactId>null</artifactId>
+                        </include>
+                    </includes>
+                    <layout>ZIP</layout>
+                    使用外部配置文件,jar包里没有资源文件
+                    <addResources>true</addResources>
+                    <outputDirectory>${project.build.directory}/resources</outputDirectory>
+                </configuration>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                        <configuration>
+                            配置jar包特殊标识 配置后,保留原文件,生成新文件 *-run.jar
+                            配置jar包特殊标识 不配置,原文件命名为 *.jar.original,生成新文件 *.jar
+                            <classifier>run</classifier>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.mybatis.generator</groupId>
+                <artifactId>mybatis-generator-maven-plugin</artifactId>
+                <version>1.3.5</version>
+                <dependencies>
+                    <dependency>
+                        <groupId> mysql</groupId>
+                        <artifactId> mysql-connector-java</artifactId>
+                        <version>5.1.39</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.mybatis.generator</groupId>
+                        <artifactId>mybatis-generator-core</artifactId>
+                        <version>1.3.5</version>
+                    </dependency>
+                </dependencies>
+                <executions>
+                    <execution>
+                        <id>Generate MyBatis Artifacts</id>
+                        <phase>deploy</phase>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    允许移动生成的文件
+                    <verbose>true</verbose>
+                    是否覆盖
+                    <overwrite>true</overwrite>
+                    自动生成的配置
+                    <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>  -->
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.18.1</version>
+                <configuration>
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.mybatis.generator</groupId>
+                <artifactId>mybatis-generator-maven-plugin</artifactId>
+                <version>1.3.5</version>
+                <dependencies>
+                    <dependency>
+                        <groupId> mysql</groupId>
+                        <artifactId> mysql-connector-java</artifactId>
+                        <version>5.1.39</version>
+                    </dependency>
+                    <dependency>
+                        <groupId>org.mybatis.generator</groupId>
+                        <artifactId>mybatis-generator-core</artifactId>
+                        <version>1.3.5</version>
+                    </dependency>
+                </dependencies>
+                <executions>
+                    <execution>
+                        <id>Generate MyBatis Artifacts</id>
+                        <phase>deploy</phase>
+                        <goals>
+                            <goal>generate</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <!--允许移动生成的文件 -->
+                    <verbose>true</verbose>
+                    <!-- 是否覆盖 -->
+                    <overwrite>true</overwrite>
+                    <!-- 自动生成的配置 -->
+                    <configurationFile>src/main/resources/generatorConfig.xml</configurationFile>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 26 - 0
src/main/java/com/hcloud/microservice/goods/GoodsManageServiceApplication.java

@@ -0,0 +1,26 @@
+package com.hcloud.microservice.goods;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.netflix.feign.EnableFeignClients;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+@EnableAsync
+@EnableDiscoveryClient
+@EnableFeignClients(basePackages = {"com.hcloud.microservice"})
+@EnableTransactionManagement
+@ComponentScan(basePackages = "com.hcloud")
+@MapperScan(basePackages = {"com.hcloud.microservice.goods.dao"})
+@SpringBootApplication
+public class GoodsManageServiceApplication {
+
+    public static void main(String[] args) {
+        SpringApplication.run(GoodsManageServiceApplication.class, args);
+    }
+
+}
+

+ 51 - 0
src/main/java/com/hcloud/microservice/goods/bo/GoodsBatchInfoBO.java

@@ -0,0 +1,51 @@
+package com.hcloud.microservice.goods.bo;
+
+import com.hcloud.microserver.commoncore.base.BaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author JYJ
+ */
+@Data
+public class GoodsBatchInfoBO extends BaseEntity {
+
+    private String guid;
+
+    /**
+     * 商品Id
+     */
+    private String fkGoodsGuid;
+
+    /**
+     * 商品名称
+     */
+    private String goodsName;
+    /**
+     * 商品批次号
+     */
+    private String goodsBatchNo;
+    /**
+     * 商品规格
+     */
+    private String goodsUnit;
+    /**
+     * 生产日期
+     */
+    private String goodsProductDate;
+    /**
+     * 保质期
+     */
+    private String goodsExpired;
+    /**
+     * 产地名称
+     */
+    private String fieldName;
+
+    /**
+     * 销售地址
+     */
+    private String goodsSaleUrl;
+
+}

+ 31 - 0
src/main/java/com/hcloud/microservice/goods/bo/GoodsFeedbackBO.java

@@ -0,0 +1,31 @@
+package com.hcloud.microservice.goods.bo;
+
+import com.hcloud.microserver.commoncore.base.BaseEntity;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.Date;
+
+/**
+ * @author JYJ
+ */
+@Slf4j
+@Data
+public class GoodsFeedbackBO extends BaseEntity {
+    private String guid;
+
+    private String goodsName;
+
+    private String goodsBatchNo;
+
+    private String gradeLevel;
+
+    private String commentVal;
+
+    private Date createTime;
+
+    private String tracedUserName;
+
+    private Integer gradeStar;
+
+}

+ 21 - 0
src/main/java/com/hcloud/microservice/goods/bo/GoodsGradeBO.java

@@ -0,0 +1,21 @@
+package com.hcloud.microservice.goods.bo;
+
+import com.hcloud.microserver.commoncore.base.BaseEntity;
+import lombok.Data;
+import lombok.extern.slf4j.Slf4j;
+
+import java.util.Date;
+
+/**
+ * @author JYJ
+ */
+@Slf4j
+@Data
+public class GoodsGradeBO extends BaseEntity {
+    private String guid;
+    private Integer gradeStart;
+    private String goodsName;
+    private String goodsBatchNo;
+    private Date createTime;
+    private String tracedUserName;
+}

+ 68 - 0
src/main/java/com/hcloud/microservice/goods/bo/GoodsQRCodeInfoBO.java

@@ -0,0 +1,68 @@
+package com.hcloud.microservice.goods.bo;
+
+import java.util.Date;
+
+import com.hcloud.microserver.commoncore.base.BaseEntity;
+
+import lombok.Data;
+
+/**
+ * @author xiezt
+ */
+@Data
+public class GoodsQRCodeInfoBO extends BaseEntity {
+
+    private String guid;
+
+    private String fkOrgGuid;
+
+    private String fkGoodsGuid;
+
+    private String fkBatchRecordGuid;
+
+    private String qrcode;
+
+    private String qrcodeParentCode;
+
+    private String qrcodeToken;
+
+    private String qrcodeUrl;
+
+    private String qrcodeImg;
+
+    private Integer scanCount;
+
+    private Date scanFirstTimed;
+
+    private Date scanLastTimed;
+
+    private String goodsName;
+
+    private String orgAddress;
+
+    private String orgName;
+
+    private String principals;
+
+    private String tel;
+
+    private String remark;
+
+    private String companyUrl;
+
+    private String companyTel;
+
+    private String qqCode;
+
+    private String wxQRImg;
+    
+    private String ico;
+    
+    private String tmallUrl;
+    
+    private String jdUrl;
+    
+    private String qualificaImgs;
+    
+    private String qrImgUrl;
+}

+ 46 - 0
src/main/java/com/hcloud/microservice/goods/bo/GoodsQRCodeRecordBO.java

@@ -0,0 +1,46 @@
+package com.hcloud.microservice.goods.bo;
+
+import com.hcloud.microserver.commoncore.base.BaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author xiezt
+ */
+@Data
+public class GoodsQRCodeRecordBO extends BaseEntity {
+
+    private String guid;
+
+    private String goodsBatchNo;
+
+    private String goodsName;
+
+    private String goodsParentQrcode;
+
+    private String qrcodeRecordTime;
+
+    private String originNum;
+
+    private String cancelNum;
+
+    private String usedNum;
+
+    private String scanNum;
+    
+    private String templeType;
+   
+    //二维码总数
+    private int qrTotalNum;
+    //打印数量
+    private int printNum;
+    
+    //未打印数量
+    private int notPrintNum;
+
+    public int getNotPrintNum() {
+    	this.notPrintNum = this.qrTotalNum - this.printNum;
+    	return this.notPrintNum;
+    }
+}

+ 167 - 0
src/main/java/com/hcloud/microservice/goods/config/DruidDBConfig.java

@@ -0,0 +1,167 @@
+package com.hcloud.microservice.goods.config;
+
+import com.alibaba.druid.filter.Filter;
+import com.alibaba.druid.pool.DruidDataSource;
+import com.alibaba.druid.support.http.StatViewServlet;
+import com.alibaba.druid.support.http.WebStatFilter;
+import com.alibaba.druid.wall.WallConfig;
+import com.alibaba.druid.wall.WallFilter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.context.annotation.Primary;
+
+import javax.sql.DataSource;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Created by PrimaryKey on 17/2/4.
+ */
+@SuppressWarnings("AlibabaRemoveCommentedCode")
+@Configuration
+public class DruidDBConfig {
+    private Logger logger = LoggerFactory.getLogger(DruidDBConfig.class);
+    @Value("${spring.datasource.url}")
+    private String dbUrl;
+
+    @Value("${spring.datasource.username}")
+    private String username;
+
+    @Value("${spring.datasource.password}")
+    private String password;
+
+    @Value("${spring.datasource.driver-class-name}")
+    private String driverClassName;
+
+    @Value("${spring.datasource.initialSize}")
+    private int initialSize;
+
+    @Value("${spring.datasource.minIdle}")
+    private int minIdle;
+
+    @Value("${spring.datasource.maxActive}")
+    private int maxActive;
+
+    @Value("${spring.datasource.maxWait}")
+    private int maxWait;
+
+    @Value("${spring.datasource.timeBetweenEvictionRunsMillis}")
+    private int timeBetweenEvictionRunsMillis;
+
+    @Value("${spring.datasource.minEvictableIdleTimeMillis}")
+    private int minEvictableIdleTimeMillis;
+
+    @Value("${spring.datasource.validationQuery}")
+    private String validationQuery;
+
+    @Value("${spring.datasource.testWhileIdle}")
+    private boolean testWhileIdle;
+
+    @Value("${spring.datasource.testOnBorrow}")
+    private boolean testOnBorrow;
+
+    @Value("${spring.datasource.testOnReturn}")
+    private boolean testOnReturn;
+
+    @Value("${spring.datasource.poolPreparedStatements}")
+    private boolean poolPreparedStatements;
+
+    @Value("${spring.datasource.maxPoolPreparedStatementPerConnectionSize}")
+    private int maxPoolPreparedStatementPerConnectionSize;
+
+    @Value("${spring.datasource.filters}")
+    private String filters;
+
+    @Value("{spring.datasource.connectionProperties}")
+    private String connectionProperties;
+
+    @Autowired
+    private WallFilter wallFilter;
+
+    @Bean(initMethod = "init", destroyMethod = "close")   //声明其为Bean实例
+    @Primary  //在同样的DataSource中,首先使用被标注的DataSource
+    public DataSource dataSource() {
+        DruidDataSource datasource = new DruidDataSource();
+
+        datasource.setUrl(this.dbUrl);
+        datasource.setUsername(username);
+        datasource.setPassword(password);
+        datasource.setDriverClassName(driverClassName);
+
+        //configuration
+        datasource.setInitialSize(initialSize);
+        datasource.setMinIdle(minIdle);
+        datasource.setMaxActive(maxActive);
+        datasource.setMaxWait(maxWait);
+        datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
+        datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
+        datasource.setValidationQuery(validationQuery);
+        datasource.setTestWhileIdle(testWhileIdle);
+        datasource.setTestOnBorrow(testOnBorrow);
+        datasource.setTestOnReturn(testOnReturn);
+
+        List<Filter> filterss = new ArrayList<>();
+        filterss.add(wallFilter);
+        datasource.setProxyFilters(filterss);
+
+        datasource.setPoolPreparedStatements(poolPreparedStatements);
+        datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
+        try {
+            datasource.setFilters(filters);
+        } catch (SQLException e) {
+            logger.error("druid configuration initialization filter", e);
+        }
+        datasource.setConnectionProperties(connectionProperties);
+
+        return datasource;
+    }
+
+    @Bean
+    public ServletRegistrationBean druidServlet() {
+        ServletRegistrationBean reg = new ServletRegistrationBean();
+        reg.setServlet(new StatViewServlet());
+        reg.addUrlMappings("/druid/*");
+        //白名单
+        reg.addInitParameter("allow", "");
+        return reg;
+    }
+
+    @Bean
+    public FilterRegistrationBean filterRegistrationBean() {
+        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
+        filterRegistrationBean.setFilter(new WebStatFilter());
+        filterRegistrationBean.addUrlPatterns("/*");
+        filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
+        filterRegistrationBean.addInitParameter("profileEnable", "true");
+        filterRegistrationBean.addInitParameter("principalCookieName","USER_COOKIE");
+        filterRegistrationBean.addInitParameter("principalSessionName","USER_SESSION");
+        filterRegistrationBean.addInitParameter("DruidWebStatFilter","/*");
+        return filterRegistrationBean;
+    }
+    @Bean(name = "wallFilter")
+    @DependsOn("wallConfig")
+    public WallFilter wallFilter(WallConfig wallConfig){
+        WallFilter wallFilter = new WallFilter();
+        wallFilter.setConfig(wallConfig);
+        return wallFilter;
+    }
+
+    @Bean(name = "wallConfig")
+    public WallConfig wallConfig(){
+        WallConfig wallConfig = new WallConfig();
+        //允许一次执行多条语句
+        wallConfig.setMultiStatementAllow(true);
+        //允许一次执行多条语句
+        wallConfig.setNoneBaseStatementAllow(true);
+        return wallConfig;
+    }
+}
+

+ 85 - 0
src/main/java/com/hcloud/microservice/goods/controller/GoodsBatchGradeManageController.java

@@ -0,0 +1,85 @@
+package com.hcloud.microservice.goods.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microservice.goods.facade.clients.GoodsBatchGradeManagerService;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchGradeForm;
+import com.hcloud.microservice.goods.service.GoodsBatchGradeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author xiezt
+ */
+@RestController
+@RequestMapping("/goods/grade")
+public class GoodsBatchGradeManageController extends BaseController implements GoodsBatchGradeManagerService {
+
+
+    @Autowired
+    private GoodsBatchGradeService goodsBatchGradeService;
+
+    /**
+     * 分页查询商品评级信息
+     *
+     * @param gradeForm
+     * @return
+     */
+    @PostMapping("/searchBatchGradeByPage")
+    @Override
+    public ResultVO searchBatchGradeByPage(@RequestBody GoodsBatchGradeForm gradeForm) {
+        PageInfo pageInfo = goodsBatchGradeService.searchBatchGradeByPage(gradeForm);
+        return success(pageInfo.getList(),pageInfo.getTotal());
+    }
+
+    /**
+     * 获取用户评级信息
+     *
+     * @param userId
+     * @return
+     */
+    @GetMapping("/getBatchGradeByUserId")
+    @Override
+    public ResultVO getBatchGradeByUserId(@RequestParam("userId") String userId,
+                                          @RequestParam("batchId") String batchId) {
+        List<GoodsBatchGradeForm> list = goodsBatchGradeService.getBatchGradeInfoByCond(userId,batchId);
+        return success(list);
+    }
+
+    /**
+     * 保存用户评级信息
+     *
+     * @param gradeForm
+     * @return
+     */
+    @PostMapping("/saveBatchGradeInfo")
+    @Override
+    public ResultVO saveBatchGradeInfo(@RequestBody GoodsBatchGradeForm gradeForm) {
+       int i = goodsBatchGradeService.saveSelective(gradeForm);
+       if(i>0){
+    	   return success();
+       }
+        return failure();
+    }
+
+    /**
+     * 批量删除商品评级信息
+     *
+     * @param gradeForm
+     * @return
+     */
+    @PostMapping("/delBatchGradeInfo")
+    @Override
+    public ResultVO delBatchGradeInfo(@RequestBody GoodsBatchGradeForm gradeForm) {
+        if(gradeForm.getPkList()!=null && gradeForm.getPkList().size()>0){
+            int i = goodsBatchGradeService.delBatchGradeInfo(gradeForm.getPkList());
+            if(i>0){
+                return success();
+            }
+        }
+        return failure();
+    }
+}

+ 192 - 0
src/main/java/com/hcloud/microservice/goods/controller/GoodsBatchManageController.java

@@ -0,0 +1,192 @@
+package com.hcloud.microservice.goods.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.annotation.AuthOrgValidate;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microserver.commoncore.enums.ResultEnum;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microservice.goods.facade.clients.GoodsBatchManagerService;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchFeedbackForm;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchGradeForm;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchInfoForm;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordForm;
+import com.hcloud.microservice.goods.service.GoodsBatchFeedbackService;
+import com.hcloud.microservice.goods.service.GoodsBatchGradeService;
+import com.hcloud.microservice.goods.service.GoodsBatchInfoService;
+import com.hcloud.microservice.goods.service.GoodsQRCodeRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+@RestController
+@RequestMapping("/goods/batch")
+public class GoodsBatchManageController extends BaseController implements GoodsBatchManagerService {
+
+    @Autowired
+    private GoodsBatchInfoService goodsBatchInfoService;
+
+    @Autowired
+    private GoodsQRCodeRecordService goodsQRCodeRecordService;
+
+    @Autowired
+    private GoodsBatchFeedbackService goodsBatchFeedbackService;
+
+    @Autowired
+    private GoodsBatchGradeService goodsBatchGradeService;
+
+    /**
+     * 分页查询商品批次记录
+     *
+     * @param goodsBatchInfoForm
+     * @return
+     */
+    @PostMapping("/queryGoodsBatchRecordByPage")
+    @AuthOrgValidate
+    @Override
+    public ResultVO queryGoodsBatchRecordByPage(@RequestBody GoodsBatchInfoForm goodsBatchInfoForm) {
+        PageInfo pageInfo = goodsBatchInfoService.searchGoodsBatchInfoByPage(goodsBatchInfoForm);
+        return success(pageInfo.getList(),pageInfo.getTotal());
+    }
+
+    /**
+     * 添加商品批次记录
+     *
+     * @param goodsBatchInfoForm
+     * @return
+     */
+    @PostMapping("/addGoodsBatchRecord")
+    @AuthOrgValidate
+    @Override
+    public ResultVO addGoodsBatchRecord(@RequestBody GoodsBatchInfoForm goodsBatchInfoForm) {
+        GoodsBatchInfoForm queryForm = new GoodsBatchInfoForm();
+        queryForm.setFkOrgGuid(goodsBatchInfoForm.getFkOrgGuid());
+        queryForm.setGoodsBatchNo(goodsBatchInfoForm.getGoodsBatchNo());
+        queryForm.setFkGoodsGuid(goodsBatchInfoForm.getFkGoodsGuid());
+        PageInfo pageInfo = goodsBatchInfoService.searchGoodsBatchInfoByPage(queryForm);
+        if(pageInfo.getTotal()>0){
+            return new ResultVO(ResultEnum.CODE_BATCH_DUPLICATE);
+        }
+        int i = goodsBatchInfoService.addGoodsBatchInfo(goodsBatchInfoForm);
+        if(i==0){
+            return failure();
+        }
+        return success();
+    }
+
+    /**
+     * 编辑商品批次记录
+     *
+     * @param goodsBatchInfoForm
+     * @return
+     */
+    @PostMapping("/editGoodsBatchRecord")
+    @AuthOrgValidate
+    @Override
+    public ResultVO editGoodsBatchRecord(@RequestBody GoodsBatchInfoForm goodsBatchInfoForm) {
+        int i = goodsBatchInfoService.editGoodsBatchInfo(goodsBatchInfoForm);
+        if(i==0){
+            return failure();
+        }
+        return success();
+    }
+
+    /**
+     * 查询商品批次记录明细
+     *
+     * @param guid
+     * @return
+     */
+    @GetMapping("/getGoodsBatchRecordById")
+    @AuthOrgValidate
+    @Override
+    public ResultVO getGoodsBatchRecordById(@RequestParam("id") String guid) {
+        GoodsBatchInfoForm batchInfoForm = goodsBatchInfoService.searchGoodsBatchInfoById(guid);
+        return success(batchInfoForm);
+    }
+
+    /**
+     * 删除商品批次记录
+     *
+     * @param guid
+     * @return
+     */
+    @GetMapping("/delGoodsBatchRecordById")
+    @AuthOrgValidate
+    @Override
+    public ResultVO delGoodsBatchRecordById(@RequestParam("id") String guid,
+                                            @RequestParam("orgGuid") String orgGuid) {
+        GoodsBatchInfoForm batchInfoForm = new GoodsBatchInfoForm();
+        batchInfoForm.setGuid(guid);
+        batchInfoForm.setFkOrgGuid(orgGuid);
+        int i = goodsBatchInfoService.deleteGoodsBatchInfo(batchInfoForm);
+        if(i==0){
+            return failure();
+        }
+        return success();
+    }
+
+    /**
+     * 生成根据产品批次信息生成溯源码记录
+     *
+     * @param goodsBatchInfoForm
+     * @return
+     */
+    @PostMapping("/batchGoodsQRCode")
+    @AuthOrgValidate
+    @Override
+    public ResultVO batchGoodsQRCode(@RequestBody GoodsBatchInfoForm goodsBatchInfoForm) {
+        //TODO 生成二维码生成记录
+        GoodsQRCodeRecordForm  recordForm = new GoodsQRCodeRecordForm();
+        BeanCopyUtil.copyBean(goodsBatchInfoForm,recordForm);
+        recordForm.setFkGoodsBatchGuid(goodsBatchInfoForm.getGuid());
+        recordForm.setCodeCount(goodsBatchInfoForm.getQrcodeCount());
+        int i = goodsQRCodeRecordService.generateGoodsQRCodeInfo(recordForm);
+        if(i==0){
+            return failure();
+        }
+        return success();
+    }
+
+    /**
+     * 保存评价及评级信息
+     *
+     * @param goodsBatchInfoForm
+     * @return
+     */
+    @PostMapping("/saveFeedback")
+    @Override
+    public ResultVO saveAllFeedbackInfo(@RequestBody GoodsBatchInfoForm goodsBatchInfoForm) {
+        int i = goodsBatchInfoService.saveAllFeedbackInfo(goodsBatchInfoForm);
+        if(i==0){failure();}
+        return success();
+    }
+
+    /**
+     * 查询用户商品批次评价信息
+     *
+     * @param batchId
+     * @param userId
+     * @return
+     */
+    @GetMapping("/getAllFeedback")
+    @Override
+    public ResultVO searchAllFeedbackInfo(@RequestParam("batchId") String batchId,@RequestParam("userId") String userId) {
+        GoodsBatchInfoForm resultInfo = new GoodsBatchInfoForm();
+        List<GoodsBatchFeedbackForm> feedbackList = goodsBatchFeedbackService.getGoodsFeedbackByUserId(userId,batchId);
+        List<GoodsBatchGradeForm> gradeFormList = goodsBatchGradeService.getBatchGradeInfoByCond(batchId,userId);
+        if(null!=feedbackList && feedbackList.size()>0){
+            resultInfo.setIsFeedback(1);
+            resultInfo.setFeedbackForm(feedbackList.get(0));
+        }
+        if(null!=gradeFormList && gradeFormList.size()>0){
+            resultInfo.setIsGrade(1);
+            resultInfo.setGradeForm(gradeFormList.get(0));
+        }
+       return success(resultInfo);
+    }
+}

+ 87 - 0
src/main/java/com/hcloud/microservice/goods/controller/GoodsDealerController.java

@@ -0,0 +1,87 @@
+package com.hcloud.microservice.goods.controller;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microservice.goods.facade.clients.GoodsDealerClient;
+import com.hcloud.microservice.goods.facade.entity.GoodsDealer;
+import com.hcloud.microservice.goods.facade.forms.GoodsDealerForm;
+import com.hcloud.microservice.goods.service.GoodsDealerService;
+
+@RestController
+@RequestMapping("/goods/dealer")
+public class GoodsDealerController extends BaseController implements GoodsDealerClient{
+	
+	@Autowired
+	private GoodsDealerService goodsDealerService;
+
+	@Override
+	@PostMapping("/save")
+	public ResultVO add(@RequestBody GoodsDealer goodsDealer) {
+		// TODO Auto-generated method stub
+		int i = goodsDealerService.saveSelective(goodsDealer);
+		if(i == 0) {
+			return failure();
+		}
+		return success();
+	}
+
+	@Override
+	@PostMapping("/edit")
+	public ResultVO edit(@RequestBody GoodsDealer goodsDealer) {
+		int i = goodsDealerService.modifyByPrimaryKeySelective(goodsDealer);
+		if(i == 0) {
+			return failure();
+		}
+		return success();
+	}
+
+	@Override
+	@GetMapping("/findById")
+	public ResultVO findById(@RequestParam("guid") String guid) {
+		GoodsDealer goodsDealer = goodsDealerService.queryByPrimaryKey(guid);
+		return success(goodsDealer);
+	}
+
+	@Override
+	@PostMapping("/searchByPage")
+	public ResultVO searchByPage(@RequestBody GoodsDealerForm goodsDealerForm) {
+		// TODO Auto-generated method stub
+		PageInfo pageInfo = goodsDealerService.searchByPage(goodsDealerForm);
+		return success(pageInfo);
+	}
+
+	@Override
+	@GetMapping("/getMaxCode")
+	public ResultVO getMaxCode() {
+		String code = goodsDealerService.getMaxCode();
+		if(code == null) {
+			return failure();
+		}
+		Map<String, Object> map = new HashMap<>();
+		map.put("dealerCode", code);
+		return success(map);
+	}
+
+	@Override
+	@GetMapping("/delete")
+	public ResultVO delete(@RequestParam("guid") String guid) {
+		int i = goodsDealerService.delByPrimaryKey(guid);
+		if(i == 0) {
+			return failure();
+		}
+		return success();
+	}
+
+}

+ 80 - 0
src/main/java/com/hcloud/microservice/goods/controller/GoodsFeedbackManageController.java

@@ -0,0 +1,80 @@
+package com.hcloud.microservice.goods.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microservice.goods.facade.clients.GoodsFeedbackManagerService;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchFeedbackForm;
+import com.hcloud.microservice.goods.service.GoodsBatchFeedbackService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+@RestController
+@RequestMapping("/goods/feedback")
+public class GoodsFeedbackManageController extends BaseController implements GoodsFeedbackManagerService {
+
+    @Autowired
+    private GoodsBatchFeedbackService goodsBatchFeedbackService;
+
+    /**
+     * 分页查询商品评价信息
+     *
+     * @param gradeForm
+     * @return
+     */
+    @PostMapping("/searchGoodsFeedbackByPage")
+    @Override
+    public ResultVO searchGoodsFeedbackByPage(@RequestBody GoodsBatchFeedbackForm gradeForm) {
+        PageInfo pageInfo =  goodsBatchFeedbackService.searchBatchFeedbackByPage(gradeForm);
+        return success(pageInfo.getList(),pageInfo.getTotal());
+    }
+
+    /**
+     * 获取用户评价信息
+     * @param userId
+     * @return
+     */
+    @GetMapping("/getGoodsFeedbackByUserId")
+    @Override
+    public ResultVO getGoodsFeedbackByUserId(@RequestParam("userId") String userId,@RequestParam("batchId") String batchId) {
+        List<GoodsBatchFeedbackForm> resultList = goodsBatchFeedbackService.getGoodsFeedbackByUserId(userId,batchId);
+        return success(resultList);
+    }
+
+    /**
+     * 保存用户评价信息
+     * @param gradeForm
+     * @return
+     */
+    @PostMapping("/saveGoodsFeedbackInfo")
+    @Override
+    public ResultVO saveGoodsFeedbackInfo(@RequestBody GoodsBatchFeedbackForm gradeForm) {
+        int i = goodsBatchFeedbackService.saveSelective(gradeForm);
+        if(i>0){
+            return success();
+        }
+        return failure();
+    }
+
+    /**
+     * 批量删除用户评价
+     * @param feedbackForm
+     * @return
+     */
+    @PostMapping("/delGoodsFeedbackInfo")
+    @Override
+    public ResultVO delGoodsFeedbackInfo(@RequestBody GoodsBatchFeedbackForm feedbackForm) {
+        if(feedbackForm.getPkList()!=null && feedbackForm.getPkList().size()>0){
+           int i =  goodsBatchFeedbackService.delGoodsFeedbackByList(feedbackForm.getPkList());
+            if(i>0){
+                return success();
+            }
+        }
+        return failure();
+    }
+}

+ 115 - 0
src/main/java/com/hcloud/microservice/goods/controller/GoodsFieldManageController.java

@@ -0,0 +1,115 @@
+package com.hcloud.microservice.goods.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.annotation.AuthOrgValidate;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microserver.commoncore.constant.GlobleConstant;
+import com.hcloud.microserver.commoncore.domain.FileDO;
+import com.hcloud.microserver.commoncore.enums.ResultEnum;
+import com.hcloud.microserver.commoncore.util.FileType;
+import com.hcloud.microserver.commoncore.util.FileUtil;
+import com.hcloud.microservice.goods.facade.clients.GoodsFieldManageService;
+import com.hcloud.microservice.goods.facade.forms.GoodsFieldForm;
+import com.hcloud.microservice.goods.service.GoodsFieldService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.Date;
+
+/**
+ * @author xiezt
+ */
+@RestController
+@RequestMapping("/goods/field")
+public class GoodsFieldManageController extends BaseController implements GoodsFieldManageService {
+
+
+    @Autowired
+    private GoodsFieldService goodsFieldService;
+
+    /**
+     * 分页查询产地信息
+     *
+     * @param fieldForm
+     * @return
+     */
+    @PostMapping("/searchByPage")
+    @AuthOrgValidate
+    @Override
+    public ResultVO queryGoodsFieldByPage(@RequestBody GoodsFieldForm fieldForm) {
+       PageInfo pageInfo =  goodsFieldService.searchGoodsFieldByPage(fieldForm);
+        return success(pageInfo.getList(),pageInfo.getTotal());
+    }
+
+    /**
+     * 添加商品产地信息
+     *
+     * @param fieldForm
+     * @return
+     */
+    @PostMapping("/addGoodsField")
+    @AuthOrgValidate
+    @Override
+    public ResultVO addGoodsField(@RequestBody GoodsFieldForm fieldForm) {
+
+        int i = goodsFieldService.addGoodsFieldInfo(fieldForm);
+        if (i == 0) {
+            return new ResultVO(ResultEnum.SYS_ERROR);
+        }
+        return success();
+    }
+
+    /**
+     * 编辑商品产地信息
+     *
+     * @param fieldForm
+     * @return
+     */
+    @PostMapping("/editGoodsField")
+    @AuthOrgValidate
+    @Override
+    public ResultVO editGoodsField(@RequestBody GoodsFieldForm fieldForm) {
+        int i = goodsFieldService.updateGoodsFieldInfo(fieldForm);
+        if (i == 0) {
+            return new ResultVO(ResultEnum.SYS_ERROR);
+        }
+        return success();
+    }
+
+    /**
+     * 获取商品产地明细信息
+     *
+     * @param guid
+     * @return
+     */
+    @GetMapping("/getGoodsField")
+    @AuthOrgValidate
+    @Override
+    public ResultVO getGoodsField(@RequestParam("id") String guid,@RequestParam("orgId") String orgGuid) {
+       GoodsFieldForm goodsFieldForm =  goodsFieldService.getGoodsFieldInfoById(guid,orgGuid);
+       if(null!= goodsFieldForm){
+           return success(goodsFieldForm);
+       }
+        return new ResultVO(ResultEnum.SYS_ERROR);
+    }
+
+    /**
+     * 删除商品产地信息
+     *
+     * @param guid
+     * @return
+     */
+    @GetMapping("/delGoodsField")
+    @AuthOrgValidate
+    @Override
+    public ResultVO delGoodsField(@RequestParam("id") String guid,@RequestParam("orgId") String orgGuid) {
+       int i= goodsFieldService.delByPrimaryKey(guid);
+       if (i == 0) {
+            return new ResultVO(ResultEnum.SYS_ERROR); }
+        return success();
+    }
+
+
+}

+ 112 - 0
src/main/java/com/hcloud/microservice/goods/controller/GoodsManageController.java

@@ -0,0 +1,112 @@
+package com.hcloud.microservice.goods.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.annotation.AuthOrgValidate;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microserver.commoncore.constant.GlobleConstant;
+import com.hcloud.microserver.commoncore.enums.ResultEnum;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microservice.goods.facade.clients.GoodsManagerService;
+import com.hcloud.microservice.goods.facade.entity.GoodsInfo;
+import com.hcloud.microservice.goods.facade.forms.GoodsInfoForm;
+import com.hcloud.microservice.goods.service.GoodsInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+
+/**
+ * @author xiezt
+ */
+@RestController
+@RequestMapping("/goods/info")
+public class GoodsManageController extends BaseController implements GoodsManagerService {
+
+    @Autowired
+    private GoodsInfoService goodsInfoService;
+
+    /**
+     * 分页查询商品信息
+     *
+     * @param goodsInfoForm
+     * @return
+     */
+    @PostMapping("/searchByPage")
+    @AuthOrgValidate
+    @Override
+    public ResultVO searchGoodsInfoByPage(@RequestBody GoodsInfoForm goodsInfoForm) {
+       PageInfo pageInfo =  goodsInfoService.searchGoodsInfoByPage(goodsInfoForm);
+        return success(pageInfo.getList(), pageInfo.getTotal());
+    }
+
+    /**
+     * 添加产品信息
+     *
+     * @param goodsInfoForm
+     * @return
+     */
+    @PostMapping("/addGoodsInfo")
+    @AuthOrgValidate
+    @Override
+    public ResultVO addGoodsInfo(@RequestBody GoodsInfoForm goodsInfoForm) {
+        GoodsInfo goodsInfo = new GoodsInfo();
+        BeanCopyUtil.copyBean(goodsInfoForm,goodsInfo);
+        int i = goodsInfoService.saveSelective(goodsInfo);
+        if(i==0){
+            return new ResultVO(ResultEnum.SYS_ERROR);
+        }
+        return success();
+    }
+
+    /**
+     * 编辑产品信息
+     *
+     * @param goodsInfoForm
+     * @return
+     */
+    @PostMapping("/editGoodsInfo")
+    @AuthOrgValidate
+    @Override
+    public ResultVO editGoodsInfo(@RequestBody GoodsInfoForm goodsInfoForm) {
+        GoodsInfo goodsInfo = new GoodsInfo();
+        BeanCopyUtil.copyBean(goodsInfoForm,goodsInfo);
+        int i = goodsInfoService.modifyByPrimaryKeySelective(goodsInfo);
+        if(i==0){
+            return new ResultVO(ResultEnum.SYS_ERROR);
+        }
+        return success();
+    }
+
+    /**
+     * 通过Id获取产品信息明细
+     *
+     * @param guid
+     * @return
+     */
+    @GetMapping("/getGoodsInfoById")
+    @AuthOrgValidate
+    @Override
+    public ResultVO getGoodsInfoById(@RequestParam("id") String guid) {
+       GoodsInfoForm goodsInfoForm =  goodsInfoService.searchGoodsInfoById(guid);
+        return success(goodsInfoForm);
+    }
+
+    /**
+     * 删除产品信息
+     *
+     * @param guid
+     * @return
+     */
+    @GetMapping("/delGoodsInfoById")
+    @Override
+    public ResultVO delGoodsInfoById(@RequestParam("id") String guid) {
+        GoodsInfo goodsInfo = new GoodsInfo();
+        goodsInfo.setGuid(guid);
+        goodsInfo.setState(0);
+        goodsInfo.setModifiedTime(new Date());
+       int i = goodsInfoService.modifyByPrimaryKeySelective(goodsInfo);
+       if(i==0){return failure();}
+        return success();
+    }
+}

+ 82 - 0
src/main/java/com/hcloud/microservice/goods/controller/GoodsProInputsManageController.java

@@ -0,0 +1,82 @@
+package com.hcloud.microservice.goods.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microservice.goods.facade.clients.GoodsProInputsManagerService;
+import com.hcloud.microservice.goods.facade.forms.GoodsProInputsForm;
+import com.hcloud.microservice.goods.service.GoodsProInputsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+@RestController
+@RequestMapping("/pro/inputs")
+public class GoodsProInputsManageController extends BaseController implements GoodsProInputsManagerService {
+
+    @Autowired
+    private GoodsProInputsService goodsProInputsService;
+
+
+    /**
+     * 分页查询投入品内容
+     *
+     * @param goodsProInputsForm
+     * @return
+     */
+    @PostMapping("/searchProInputsByPage")
+    @Override
+    public ResultVO searchProInputsByPage(@RequestBody GoodsProInputsForm goodsProInputsForm) {
+        PageInfo pageInfo = goodsProInputsService.searchProInputsByPage(goodsProInputsForm);
+        return success(pageInfo.getList(),pageInfo.getTotal());
+    }
+
+    /**
+     * 查询投入品列表通过商品批次键
+     *
+     * @param foreignKey
+     * @return
+     */
+    @GetMapping("/searchProInputsByFK")
+    @Override
+    public ResultVO searchProInputsByFK(@RequestParam("fk") String foreignKey) {
+        List<GoodsProInputsForm> list =  goodsProInputsService.searchProInputsByBatchGuid(foreignKey);
+        return success(list);
+    }
+
+    /**
+     * 删除投入品信息
+     *
+     * @param pk
+     * @return
+     */
+    @GetMapping("/delProInputs")
+    @Override
+    public ResultVO delProInputs(@RequestParam("pk") String pk) {
+        int i = goodsProInputsService.delByPrimaryKey(pk);
+        if(i>0){
+            return success();
+        }
+        return failure();
+    }
+
+    /**
+     * 保存投入品信息
+     *
+     * @param goodsProInputsForm
+     * @return
+     */
+    @PostMapping("/saveProInputs")
+    @Override
+    public ResultVO saveProInputs(@RequestBody GoodsProInputsForm goodsProInputsForm) {
+        int i = goodsProInputsService.saveSelective(goodsProInputsForm);
+        if(i>0){
+            return success();
+        }
+        return failure();
+    }
+}

+ 82 - 0
src/main/java/com/hcloud/microservice/goods/controller/GoodsProNormalManageController.java

@@ -0,0 +1,82 @@
+package com.hcloud.microservice.goods.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microservice.goods.facade.clients.GoodsProNormalManagerService;
+import com.hcloud.microservice.goods.facade.forms.GoodsProNormalForm;
+import com.hcloud.microservice.goods.service.GoodsProNormalService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author JYJ
+ */
+@RestController
+@RequestMapping("/pro/normal")
+public class GoodsProNormalManageController extends BaseController implements GoodsProNormalManagerService {
+
+    @Autowired
+    private GoodsProNormalService goodsProNormalService;
+
+    /**
+     * 分页查询流通信息
+     *
+     * @param goodsProNormalForm
+     * @return
+     */
+    @PostMapping("/searchProNormalByPage")
+    @Override
+    public ResultVO searchProNormalByPage(@RequestBody GoodsProNormalForm goodsProNormalForm) {
+        PageInfo pageInfo = goodsProNormalService.searchProNormalByPage(goodsProNormalForm);
+        return success(pageInfo.getList(),pageInfo.getTotal());
+    }
+
+    /**
+     * 保存流程通用信息
+     *
+     * @param goodsProNormalForm
+     * @return
+     */
+    @PostMapping("/saveProNormal")
+    @Override
+    public ResultVO saveProNormal(@RequestBody GoodsProNormalForm goodsProNormalForm) {
+        int i = goodsProNormalService.saveSelective(goodsProNormalForm);
+        if (i>0){
+            return success();
+        }
+        return failure();
+    }
+
+    /**
+     * 更新流通通用信息
+     *
+     * @param goodsProNormalForm
+     * @return
+     */
+    @PostMapping("/updateProNormal")
+    @Override
+    public ResultVO updateProNormal(@RequestBody GoodsProNormalForm goodsProNormalForm) {
+        int i = goodsProNormalService.modifyByPrimaryKeySelective(goodsProNormalForm);
+        if (i>0){
+            return success();
+        }
+        return failure();
+    }
+
+    /**
+     * 通过主键删除通用流通信息
+     *
+     * @param pk
+     * @return
+     */
+    @GetMapping("/delProNormalByPK")
+    @Override
+    public ResultVO delProNormalByPK(@RequestParam("pk") String pk) {
+        int i = goodsProNormalService.delByPrimaryKey(pk);
+        if (i>0){
+            return success();
+        }
+        return failure();
+    }
+}

+ 139 - 0
src/main/java/com/hcloud/microservice/goods/controller/GoodsQRCodeInfoController.java

@@ -0,0 +1,139 @@
+package com.hcloud.microservice.goods.controller;
+
+import java.util.List;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.annotation.AuthOrgValidate;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microserver.commoncore.enums.ResultEnum;
+import com.hcloud.microservice.goods.facade.clients.GoodsQRCodeManagerService;
+import com.hcloud.microservice.goods.facade.entity.GoodsQRCodeInfo;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeInfoForm;
+import com.hcloud.microservice.goods.service.GoodsQRCodeInfoService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author xiezt
+ */
+@RestController
+@RequestMapping("/qrcode/info")
+public class GoodsQRCodeInfoController extends BaseController implements GoodsQRCodeManagerService {
+
+    @Autowired
+    private GoodsQRCodeInfoService goodsQRCodeInfoService;
+
+    /**
+     * 分页查询商品溯源码信息
+     *
+     * @param goodsQRCodeInfoForm
+     * @return
+     */
+    @PostMapping("/searchByPage")
+    @AuthOrgValidate
+    @Override
+    public ResultVO searchGoodsQRCodeByPage(@RequestBody GoodsQRCodeInfoForm goodsQRCodeInfoForm) {
+        PageInfo pageInfo = goodsQRCodeInfoService.queryGoodsQRCodeInfoByRecId(goodsQRCodeInfoForm);
+        return success(pageInfo.getList(),pageInfo.getTotal());
+    }
+
+    /**
+     * 获取商品溯源码明细信息
+     *
+     * @param guid
+     * @return
+     */
+    @GetMapping("/getGoodsQRCodeById")
+    @AuthOrgValidate
+    @Override
+    public ResultVO getGoodsQRCodeById(@RequestParam("id") String guid) {
+        GoodsQRCodeInfo info = goodsQRCodeInfoService.queryByPrimaryKey(guid);
+        return success(info);
+    }
+
+    /**
+     * 删除商品溯源码信息
+     *
+     * @param goodsQRCodeInfoForm
+     * @return
+     */
+    @PostMapping("/delGoodsQRCodeById")
+    @AuthOrgValidate
+    @Override
+    public ResultVO delGoodsQRCodeById(@RequestBody GoodsQRCodeInfoForm goodsQRCodeInfoForm) {
+       GoodsQRCodeInfo codeInfo =  goodsQRCodeInfoService.queryByPrimaryKey(goodsQRCodeInfoForm.getGuid());
+       if(codeInfo.getState()!=0){
+           int i = goodsQRCodeInfoService.forbiddenCodeInfoByCodeId(goodsQRCodeInfoForm);
+           if(i==0){
+               return failure();
+           }
+           return success();
+       }
+        return new ResultVO(ResultEnum.CODE_DEL_DUPLICATE);
+    }
+
+    /**
+     * 查询导出溯源码信息
+     *
+     * @param guid
+     * @return
+     */
+    @GetMapping("/searchGoodsQRCodeForExport")
+    @AuthOrgValidate
+    @Override
+    public ResultVO searchGoodsQRCodeForExport(@RequestParam("id") String guid) {
+        GoodsQRCodeInfo info = goodsQRCodeInfoService.queryByPrimaryKey(guid);
+        return success(info);
+    }
+
+    /**
+     * 通过二维码传输码查询溯源码信息
+     *
+     * @param tokenStr
+     * @return
+     */
+    @GetMapping("/searchByToken")
+    @AuthOrgValidate
+    @Override
+    public ResultVO searchGoodsQRCodeInfoByTokenStr(@RequestParam("token") String tokenStr) {
+        int i =goodsQRCodeInfoService.updateGoodsQRInfoByScan(tokenStr);
+        if(i!=0){
+            GoodsQRCodeInfoForm codeInfoForm = goodsQRCodeInfoService.getGoodsQRInfo(tokenStr);
+            return success(codeInfoForm);
+        }
+        return failure();
+    }
+
+    /**
+     * 通过二维码传输码预览溯源码信息
+     *
+     * @param tokenStr
+     * @return
+     */
+    @GetMapping("/getDetailByToken")
+    @AuthOrgValidate
+    @Override
+    public ResultVO getGoodsQRCodeDetailInfoByToken(@RequestParam("token") String tokenStr) {
+        GoodsQRCodeInfoForm codeInfoForm = goodsQRCodeInfoService.getGoodsQRInfo(tokenStr);
+        return success(codeInfoForm);
+    }
+    
+    @PostMapping("/getPrintDetail")
+    @AuthOrgValidate
+    @Override
+    public ResultVO getPrintDetail(@RequestBody GoodsQRCodeInfoForm goodsQRCodeInfoForm){
+    	PageInfo pageInfo = goodsQRCodeInfoService.getPrintGoodsQRInfo(goodsQRCodeInfoForm);
+        return success(pageInfo);
+    }
+
+    @PostMapping("/updateQRIsPrint")
+	@Override
+	public ResultVO updateQRIsPrint(@RequestBody List<String> ids) {
+		int i = goodsQRCodeInfoService.updateQRIsPrint(ids);
+		if(i == 0) {
+			return failure();
+		}
+		return success(i);
+	}
+}

+ 165 - 0
src/main/java/com/hcloud/microservice/goods/controller/GoodsQRCodeRecordController.java

@@ -0,0 +1,165 @@
+package com.hcloud.microservice.goods.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.annotation.AuthOrgValidate;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microservice.goods.facade.clients.GoodsQRCodeRecordManagerService;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeInfoForm;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordForm;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordStatForm;
+import com.hcloud.microservice.goods.facade.results.ScanNumStatResult;
+import com.hcloud.microservice.goods.facade.results.ScanNumStatisResult;
+import com.hcloud.microservice.goods.service.GoodsQRCodeRecordService;
+import com.hcloud.microservice.goods.service.GoodsQRCodeRecordStatService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author xiezt
+ */
+@RestController
+@RequestMapping("/qrcode/record")
+public class GoodsQRCodeRecordController extends BaseController implements GoodsQRCodeRecordManagerService {
+
+    @Autowired
+    private GoodsQRCodeRecordService goodsQRCodeRecordService;
+
+    @Autowired
+    private GoodsQRCodeRecordStatService goodsQRCodeRecordStatService;
+
+    /**
+     * 分页查询溯源码生成记录
+     *
+     * @param goodsQRCodeRecordForm
+     * @return
+     */
+    @PostMapping("/searchByPage")
+    @AuthOrgValidate
+    @Override
+    public ResultVO searchGoodsQRCodeRecordByPage(@RequestBody GoodsQRCodeRecordForm goodsQRCodeRecordForm) {
+        PageInfo pageInfo = goodsQRCodeRecordService.searchQRCodeRecordByPage(goodsQRCodeRecordForm);
+        return success(pageInfo.getList(),pageInfo.getTotal());
+    }
+
+    /**
+     * 查询溯源码生成记录为导出
+     *
+     * @param goodsQRCodeRecordForm
+     * @return
+     */
+    @PostMapping("/searchForExport")
+    @AuthOrgValidate
+    @Override
+    public ResultVO searchGoodsQRCodeRecordForExport(@RequestBody GoodsQRCodeRecordForm goodsQRCodeRecordForm) {
+        GoodsQRCodeInfoForm queryInfo = new GoodsQRCodeInfoForm();
+        queryInfo.setPageSize(goodsQRCodeRecordForm.getPageSize());
+        queryInfo.setFkBatchRecordGuid(goodsQRCodeRecordForm.getGuid());
+        PageInfo<GoodsQRCodeRecordForm> pageInfo = goodsQRCodeRecordService.getGoodsQRCodeDetailById(queryInfo);
+        return success(pageInfo.getList());
+    }
+
+    /**
+     * 批量删除溯源码生成记录
+     * @param goodsQRCodeRecordForm
+     * @return
+     */
+    @PostMapping("/delGoodsQRCodeRecord")
+    @AuthOrgValidate
+    @Override
+    public ResultVO delGoodsQRCodeRecord(@RequestBody GoodsQRCodeRecordForm goodsQRCodeRecordForm) {
+        int i = goodsQRCodeRecordService.delGoodsQRCodeRecord(goodsQRCodeRecordForm);
+        if(i==0){
+            return failure();
+        }
+        return success();
+    }
+
+    /**
+     * 通过recordId查询生成记录明细
+     *
+     * @param goodsQRCodeRecordForm
+     * @return
+     */
+    @PostMapping("/getGoodsQRCodeInfoByRecordId")
+    @AuthOrgValidate
+    @Override
+    public ResultVO getGoodsQRCodeInfoByRecordId(@RequestBody GoodsQRCodeRecordForm goodsQRCodeRecordForm) {
+        GoodsQRCodeInfoForm queryInfo = new GoodsQRCodeInfoForm();
+        queryInfo.setFkBatchRecordGuid(goodsQRCodeRecordForm.getGuid());
+        queryInfo.setPageNum(goodsQRCodeRecordForm.getPageNum());
+        queryInfo.setPageSize(goodsQRCodeRecordForm.getPageSize());
+        PageInfo pageInfo = goodsQRCodeRecordService.getGoodsQRCodeDetailById(queryInfo);
+        return success(pageInfo.getList(),pageInfo.getTotal());
+    }
+
+    /**
+     * 物理删除溯源码生成记录
+     *
+     * @param recordId
+     * @return
+     */
+    @Override
+    @GetMapping("/delQRCodeInfoPhysical")
+    @AuthOrgValidate
+    public ResultVO delQRCodeInfoPhysical(@RequestParam("recordId") String recordId) {
+        int i = goodsQRCodeRecordService.delQRcodeInfoByPhysical(recordId);
+        if(i==0){
+            return failure();
+        }
+        return success();
+    }
+
+    /**
+     * 统计全年各月的扫码人数
+     * @param goodsQRCodeRecordStatForm
+     * @return
+     */
+    @Override
+    @AuthOrgValidate
+    @PostMapping("/statOneYear")
+    public ResultVO statOneYearScanNumber(@RequestBody GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm) {
+    	LinkedList<ScanNumStatisResult> result = this.goodsQRCodeRecordStatService.statOneYearAllMonthData(goodsQRCodeRecordStatForm);
+        return success(result);
+    }
+
+    /**
+     * 统计昨日和历史累计扫码人数
+     * @param goodsQRCodeRecordStatForm
+     * @return
+     */
+    @Override
+    @AuthOrgValidate
+    @PostMapping("/statYesterdayAndAllTime")
+    public ResultVO statYesterdayAndAllTimeScanNumber(@RequestBody GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm) {
+        List<ScanNumStatResult> results = this.goodsQRCodeRecordStatService.statYesterdayAndAllTimeData(goodsQRCodeRecordStatForm);
+        return success(results);
+    }
+
+    @Override
+    @AuthOrgValidate
+    @PostMapping("/statOneDayAllHours")
+    public ResultVO statOneDayAllHoursScanNumber(@RequestBody GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm) {
+        List<ScanNumStatResult> results = this.goodsQRCodeRecordStatService.statOneDayAllHoursData(goodsQRCodeRecordStatForm);
+        return success(results);
+    }
+
+    @Override
+    @AuthOrgValidate
+    @PostMapping("/statOneWeekSevenDay")
+    public ResultVO statOneWeekSevenDayScanNumber(@RequestBody GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm) {
+        List<ScanNumStatResult> results = this.goodsQRCodeRecordStatService.statOneWeekSevenDaysData(goodsQRCodeRecordStatForm);
+        return success(results);
+    }
+
+    @Override
+    @AuthOrgValidate
+    @PostMapping("/statOneMonthAllDays")
+    public ResultVO statOneMonthAllDaysScanNumber(@RequestBody GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm) {
+        List<ScanNumStatResult> results = this.goodsQRCodeRecordStatService.statOneMonthAllDaysData(goodsQRCodeRecordStatForm);
+        return success(results);
+    }
+}

+ 79 - 0
src/main/java/com/hcloud/microservice/goods/controller/GoodsTracedUserManageController.java

@@ -0,0 +1,79 @@
+package com.hcloud.microservice.goods.controller;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseController;
+import com.hcloud.microserver.commoncore.base.ResultVO;
+import com.hcloud.microservice.goods.facade.clients.GoodsTracedUserManagerService;
+import com.hcloud.microservice.goods.facade.forms.GoodsTracedUserForm;
+import com.hcloud.microservice.goods.service.GoodsTracedUserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author JYJ
+ */
+@RestController
+@RequestMapping("/traced/user")
+public class GoodsTracedUserManageController extends BaseController implements GoodsTracedUserManagerService {
+
+    @Autowired
+    private GoodsTracedUserService goodsTracedUserService;
+
+    /**
+     * 查询用户信息通过第三方编码
+     *
+     * @param code
+     * @return
+     */
+    @PostMapping("searchByCode")
+    @Override
+    public ResultVO searchTracedUserByCode(@RequestBody GoodsTracedUserForm tracedUserForm) {
+        GoodsTracedUserForm form = goodsTracedUserService.searchTracedUserByCode(tracedUserForm.getTracedThirdCode(),tracedUserForm.getTracedUserOpenid());
+        return success(form);
+    }
+
+    /**
+     * 保存用户信息
+     *
+     * @param tracedUserForm
+     * @return
+     */
+    @PostMapping("saveTracedUser")
+    @Override
+    public ResultVO saveTracedUser(@RequestBody GoodsTracedUserForm tracedUserForm) {
+        int i = goodsTracedUserService.saveSelective(tracedUserForm);
+        if(i>0){
+            return success();
+        }
+        return failure();
+    }
+
+    /**
+     * 更新用户信息
+     *
+     * @param tracedUserForm
+     * @return
+     */
+    @PostMapping("updateTracedUser")
+    @Override
+    public ResultVO updateTracedUser(@RequestBody GoodsTracedUserForm tracedUserForm) {
+        int i = goodsTracedUserService.modifyByPrimaryKeySelective(tracedUserForm);
+        if(i>0){
+            return success();
+        }
+        return failure();
+    }
+
+    /**
+     * 分页查询溯源用户信息
+     *
+     * @param tracedUserForm
+     * @return
+     */
+    @PostMapping("/searchTracedUserByPage")
+    @Override
+    public ResultVO searchTracedUserByPage(@RequestBody GoodsTracedUserForm tracedUserForm) {
+        PageInfo pageInfo = goodsTracedUserService.searchTracedUserByPage(tracedUserForm);
+        return success(pageInfo.getList(),pageInfo.getTotal());
+    }
+}

+ 27 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsAssayInfoMapper.java

@@ -0,0 +1,27 @@
+package com.hcloud.microservice.goods.dao;
+
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsAssayInfo;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.web.bind.annotation.PostMapping;
+
+/**
+ * @author xiezt
+ */
+public interface GoodsAssayInfoMapper extends BaseMapper<GoodsAssayInfo,String> {
+
+    /**
+     * 获取产品检验检疫信息通过产品批次Id
+     * @param batchId
+     * @return
+     */
+    GoodsAssayInfo getGoodsAssayInfoByBatchId(@Param("batchId") String batchId);
+
+    /**
+     * 删除商品检验信息通过商品批次编号
+     * @param goodsAssayInfo
+     * @return
+     */
+    int delGoodsAssayInfoByBatchId(GoodsAssayInfo goodsAssayInfo);
+}

+ 38 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsBatchFeedbackMapper.java

@@ -0,0 +1,38 @@
+package com.hcloud.microservice.goods.dao;
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microservice.goods.bo.GoodsFeedbackBO;
+import com.hcloud.microservice.goods.facade.entity.GoodsBatchFeedback;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchFeedbackForm;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+public interface GoodsBatchFeedbackMapper extends BaseMapper<GoodsBatchFeedback,String> {
+    /**
+     * 分页查询评价信息
+     * @param pageBean
+     * @return
+     */
+    List<GoodsFeedbackBO> searchBatchFeedbackByPage(PageBean<GoodsBatchFeedbackForm> pageBean);
+
+    /**
+     * 通过用户id查询用户评价信息
+     * @param userId
+     * @param batchId
+     * @return
+     */
+    List<GoodsBatchFeedback> getGoodsFeedbackByUserId(@Param("uid") String userId,@Param("batchId") String batchId);
+
+    /**
+     * 批量删除评价信息
+     * @param list
+     * @return
+     */
+    int delGoodsFeedbackByList(@Param("list") List<String> list);
+
+}

+ 37 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsBatchGradeMapper.java

@@ -0,0 +1,37 @@
+package com.hcloud.microservice.goods.dao;
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microservice.goods.bo.GoodsGradeBO;
+import com.hcloud.microservice.goods.facade.entity.GoodsBatchGrade ;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchGradeForm;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+public interface GoodsBatchGradeMapper extends BaseMapper<GoodsBatchGrade,String> {
+    /**
+     * 分页查询评价星级
+     * @param pageBean
+     * @return
+     */
+     List<GoodsGradeBO> searchBatchGradeByPage(PageBean<GoodsBatchGradeForm> pageBean);
+
+    /**
+     * 获取商品评价信息列表
+     * @param goodsBatchId
+     * @param uid
+     * @return
+     */
+    List<GoodsBatchGrade> getBatchGradeInfoByCond(@Param("uid") String uid, @Param("batchId") String goodsBatchId);
+
+    /**
+     * 批量删除评价星级信息
+     * @param list
+     * @return 结果
+     */
+    int delBatchGradeInfo(@Param("list") List<String> list);
+}

+ 23 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsBatchInfoMapper.java

@@ -0,0 +1,23 @@
+package com.hcloud.microservice.goods.dao;
+
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microservice.goods.bo.GoodsBatchInfoBO;
+import com.hcloud.microservice.goods.facade.entity.GoodsBatchInfo;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchInfoForm;
+
+import java.util.List;
+
+/**
+ * @author xiezt
+ */
+public interface GoodsBatchInfoMapper extends BaseMapper<GoodsBatchInfo,String> {
+    /**
+     * 分页查询商品批次信息
+     * @param pageBean
+     * @return
+     */
+    List<GoodsBatchInfoBO> searchByPage(PageBean<GoodsBatchInfoForm> pageBean);
+
+}

+ 45 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsBatchLabelMapper.java

@@ -0,0 +1,45 @@
+package com.hcloud.microservice.goods.dao;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.hcloud.microservice.goods.facade.entity.GoodsBatchLabel;
+
+public interface GoodsBatchLabelMapper{
+    int deleteByPrimaryKey(String guid);
+
+    int insert(GoodsBatchLabel record);
+
+    int insertSelective(GoodsBatchLabel record);
+
+    GoodsBatchLabel selectByPrimaryKey(String guid);
+
+    int updateByPrimaryKeySelective(GoodsBatchLabel record);
+
+    int updateByPrimaryKey(GoodsBatchLabel record);
+    
+    /**
+     * 查询产品标签
+     * @author lym
+     * @param record
+     * @return
+     */
+    List<GoodsBatchLabel> selectGoodsBatchLabelList(GoodsBatchLabel record);
+    
+    /**
+     * 删除产品关联标签
+     * @author lym
+     * ids 不需要删除的数据ID  goodsBatchGuids 产品批次id
+     * @return
+     */
+    int deleteGoodsBatchLabelByNotIds(@Param("goodsBatchGuid") String goodsBatchGuid,@Param("ids") List<String> ids);
+    
+    /**
+     * 删除产品批次产品标签
+     * @author lym
+     * @param batchGuid
+     * @return
+     */
+    int deleteByBatchGuid(@Param("goodsBatchGuid") String goodsBatchGuid);
+}

+ 45 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsDealerMapper.java

@@ -0,0 +1,45 @@
+package com.hcloud.microservice.goods.dao;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microservice.goods.facade.entity.GoodsDealer;
+import com.hcloud.microservice.goods.facade.forms.GoodsDealerForm;
+
+public interface GoodsDealerMapper extends BaseMapper<GoodsDealer, String>{
+	
+	/**
+	 * 分页查询
+	 * @author lym
+	 * @param goodsDealerForm
+	 * @return
+	 */
+	List<GoodsDealer> searchByPage(PageBean<GoodsDealerForm> pageBean);
+	
+	/**
+	 * 获取最大编码
+	 * @author lym
+	 * @param orgGuid
+	 * @return
+	 */
+	String getMaxCode();
+	
+	/**
+     * 查询企业所有经销商
+     * @author lym
+     * @param orgGuid
+     * @return
+     */
+	List<GoodsDealer> selectList(@Param("orgGuid") String orgGuid);
+	
+	/**
+	 * 编码是否存在
+	 * @author lym
+	 * @param code
+	 * @return
+	 */
+	int existCode(@Param("code") String code);
+}

+ 41 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsFieldMapper.java

@@ -0,0 +1,41 @@
+package com.hcloud.microservice.goods.dao;
+
+
+import com.github.pagehelper.Page;
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microservice.goods.facade.entity.GoodsField;
+import com.hcloud.microservice.goods.facade.forms.GoodsFieldForm;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author xiezt
+ */
+public interface GoodsFieldMapper extends BaseMapper<GoodsField,String> {
+
+    /**
+     * 分页查询产地信息
+     * @param pageBean
+     * @return
+     */
+    Page<GoodsField> searchByPage(PageBean<GoodsFieldForm> pageBean);
+
+    /**
+     * 查询产品明细
+     * @param guid
+     * @param orgGuid
+     * @return
+     */
+    GoodsField getGoodsFieldInfoById(@Param("goodsId") String guid,@Param("orgGuid") String orgGuid);
+    
+    /**
+     * 检验产地是否存在
+     * lym
+     * @param goodsField
+     * @return
+     */
+    int isExist(GoodsField goodsField);
+
+}

+ 37 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsInfoAuxiliaryMapper.java

@@ -0,0 +1,37 @@
+package com.hcloud.microservice.goods.dao;
+
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsInfoAuxiliary;
+import com.hcloud.microservice.goods.facade.forms.GoodsInfoAuxiliaryForm;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author xiezt
+ */
+public interface GoodsInfoAuxiliaryMapper extends BaseMapper<GoodsInfoAuxiliary,String> {
+
+    /**
+     * 批量插入辅助信息
+     * @param list
+     * @return
+     */
+     int bathSaveAuxiliaryInfo(List<GoodsInfoAuxiliaryForm> list);
+
+    /**
+     * 删除商品辅助信息通过关联ID
+     * @param goodsId
+     * @param fkOrgGuid
+     * @return
+     */
+     int delGoodsFieldAuxiliaryinfoByFkId(@Param("goodsId") String goodsId);
+
+    /**
+     * 通过关联Id查询辅助列表信息
+     * @param fkAuxItemId
+     * @return
+     */
+     List<GoodsInfoAuxiliary> queryListByParentId(@Param("itemId") String fkAuxItemId);
+}

+ 24 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsInfoMapper.java

@@ -0,0 +1,24 @@
+package com.hcloud.microservice.goods.dao;
+
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microservice.goods.facade.entity.GoodsInfo;
+import com.hcloud.microservice.goods.facade.forms.GoodsInfoForm;
+
+import java.util.List;
+
+/**
+ * @author xiezt
+ */
+public interface GoodsInfoMapper extends BaseMapper<GoodsInfo,String> {
+
+    /**
+     * 分页查询商品信息
+     * @param pageBean
+     * @return
+     */
+    List<GoodsInfo> searchByPage(PageBean<GoodsInfoForm> pageBean);
+
+
+}

+ 45 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsLabelMapper.java

@@ -0,0 +1,45 @@
+package com.hcloud.microservice.goods.dao;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+
+import com.hcloud.microservice.goods.facade.entity.GoodsLabel;
+
+public interface GoodsLabelMapper {
+    int deleteByPrimaryKey(String guid);
+
+    int insert(GoodsLabel record);
+
+    int insertSelective(GoodsLabel record);
+
+    GoodsLabel selectByPrimaryKey(String guid);
+
+    int updateByPrimaryKeySelective(GoodsLabel record);
+
+    int updateByPrimaryKey(GoodsLabel record);
+    
+    /**
+     *根据标签名称 查询产品标签信息
+     * @author lym
+     * @param labelName
+     * @return
+     */
+    GoodsLabel selectGoodsLabelByLabelName(String labelName);
+    
+    /**
+     * 查询产品关联标签信息
+     * @author lym
+     * @param goodsBatchGuid
+     * @return
+     */
+    List<GoodsLabel> selectListBygoodsBatchGuid(@Param("goodsBatchGuid") String goodsBatchGuid);
+    
+    /**
+     * 查询产品管理标签
+     * @author lym
+     * @param goodsBatchGuid
+     * @return
+     */
+    String selectLabelNamesBygoodsBatchGuid(@Param("goodsBatchGuid") String goodsBatchGuid);
+}

+ 42 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsProInputsMapper.java

@@ -0,0 +1,42 @@
+package com.hcloud.microservice.goods.dao;
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microservice.goods.facade.entity.GoodsProInputs;
+import com.hcloud.microservice.goods.facade.forms.GoodsProInputsForm;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+public interface GoodsProInputsMapper extends BaseMapper<GoodsProInputs,String> {
+    /**
+     * 分页查询投入品信息
+     * @param pageBean
+     * @return
+     */
+    List<GoodsProInputs> searchProInputsByPage(PageBean<GoodsProInputsForm> pageBean);
+
+    /**
+     *  查询投入品信息通过商品批次GUID
+     * @param batchGuid
+     * @return
+     */
+    List<GoodsProInputs> searchProInputsByBatchGuid(String batchGuid);
+
+    /**
+     * 批量保存生产原料投入信息
+     * @param list
+     * @return
+     */
+    int batchSaveProInputs(List<GoodsProInputs> list);
+
+    /**
+     * 删除原料投入品信息
+     * @param batchGuid
+     * @return
+     */
+    int delProInputsByFK(@Param("batid") String batchGuid);
+}

+ 43 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsProNormalMapper.java

@@ -0,0 +1,43 @@
+package com.hcloud.microservice.goods.dao;
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microservice.goods.facade.entity.GoodsProNormal;
+import com.hcloud.microservice.goods.facade.forms.GoodsProNormalForm;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+public interface GoodsProNormalMapper extends BaseMapper<GoodsProNormal,String> {
+    /**
+     * 分页查询通用流通信息
+     * @param pageBean
+     * @return
+     */
+    List<GoodsProNormal> searchProNormalByPage(PageBean<GoodsProNormalForm> pageBean);
+
+    /**
+     * 批量插入生产过程信息
+     * @param list
+     * @return
+     */
+    int batchSaveProNormal(List<GoodsProNormal> list);
+
+    /**
+     * 通过商品批次号查询生产过程信息
+     * @param batchId
+     * @param processType
+     * @return
+     */
+    List<GoodsProNormal> searchProNormalByFK(@Param("batid") String batchId,@Param("type") Integer processType);
+
+    /**
+     * 删除加工生产过程信息
+     * @param batchId
+     * @return
+     */
+    int delProNormalByFK(@Param("batid") String batchId);
+}

+ 73 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsQRCodeInfoMapper.java

@@ -0,0 +1,73 @@
+package com.hcloud.microservice.goods.dao;
+
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microservice.goods.bo.GoodsQRCodeInfoBO;
+import com.hcloud.microservice.goods.facade.entity.GoodsQRCodeInfo;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeInfoForm;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author apple
+ */
+public interface GoodsQRCodeInfoMapper extends BaseMapper<GoodsQRCodeInfo,String> {
+    /**
+     * 通过生成记录ID查询溯源码记录
+     * @param recodeId
+     * @return
+     */
+    List<GoodsQRCodeInfoBO> queryGoodsQRCodeInfoByRecId(@Param("recodeId") String recodeId);
+
+    /**
+     * 通过扫码识别token查询
+     * @param qrToken
+     * @return
+     */
+    GoodsQRCodeInfoBO getGoodsQRInfoByQrToken(@Param("qrToken") String qrToken);
+
+    /**
+     * 批量添加溯源码信息记录
+     * @param list
+     * @return
+     */
+    int batchSaveQRCodeInfo(List<GoodsQRCodeInfo> list);
+
+    /**
+     * 更新溯源码信息通过生成记录Id
+     * @param goodsQRCodeInfo
+     * @return
+     */
+    int updateGoodsQRCodeInfoByRecord(GoodsQRCodeInfo goodsQRCodeInfo);
+
+    /**
+     * 删除溯源码明细信息
+     * @param recordId
+     * @return
+     */
+    int delQRCodeInfoByRecordId(@Param("recordId") String recordId);
+
+    /**
+     * 批量更新溯源码信息通过生成记录Id
+     * @param list
+     * @return
+     */
+    int batchUpdateGoodsQRCodeInfoByRecord(List<String> list);
+    
+    /**
+     * 通过生成记录Id查询打印溯源码信息
+     * @author lym
+     * @param qrToken
+     * @return
+     */
+    List<GoodsQRCodeInfoBO> getPrintGoodsQRInfo(GoodsQRCodeInfoForm goodsQRCodeInfoForm);
+    
+    /**
+     * 修改是否打印状态
+     * @author lym
+     * @param ids
+     * @return
+     */
+    int updateQRIsPrint(@Param("ids") List<String> ids);
+}

+ 93 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsQRCodeRecordMapper.java

@@ -0,0 +1,93 @@
+package com.hcloud.microservice.goods.dao;
+
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microservice.goods.bo.GoodsQRCodeRecordBO;
+import com.hcloud.microservice.goods.facade.entity.GoodsQRCodeRecord;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordForm;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordStatForm;
+import com.hcloud.microservice.goods.facade.results.ScanNumStatResult;
+import com.hcloud.microservice.goods.facade.results.ScanNumStatisResult;
+
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author xiezt
+ */
+public interface GoodsQRCodeRecordMapper extends BaseMapper<GoodsQRCodeRecord,String> {
+
+    /**
+     * 分页查询
+     * @param pageBean
+     * @return
+     */
+    List<GoodsQRCodeRecordBO> searchByPage(PageBean<GoodsQRCodeRecordForm> pageBean);
+
+    /**
+     * 获取二维码生成父码最大值
+     * @param codePrefix 父码前缀
+     * @return
+     */
+    String getMaxParentCode(@Param("parentCode") String codePrefix);
+
+    /**
+     * 批量更新溯源码生成记录
+     * @param list
+     * @return
+     */
+    int batchUpdateGoodsQRCodeRecord(List<String> list);
+
+    /**
+     * 通过商品批次编号查询溯源码生成记录
+     * @param batchId
+     * @return
+     */
+    List<GoodsQRCodeRecord> getGoodsQRCodeRecordByBatchId(@Param("batchId") String batchId);
+
+    /**
+     * 统计全年各月的扫码人数
+     * @param goodsQRCodeRecordStatForm
+     * @return
+     */
+    ScanNumStatResult statQRCodeScanNumForOneYeaAllMonth(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm);
+
+    /**
+     * 统计当天和历史累计扫码人数
+     * @param goodsQRCodeRecordStatForm
+     * @return
+     */
+    List<ScanNumStatResult> statYesterdayAndAllTime(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm);
+
+    /**
+     * 统计一天24小时的扫码数
+     * @param goodsQRCodeRecordStatForm
+     * @return
+     */
+    List<ScanNumStatResult> statOneDayAllHours(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm);
+
+    /**
+     *
+     * 统计一周7天的扫码人数
+     * @param goodsQRCodeRecordStatForm
+     * @return
+     */
+    List<ScanNumStatResult> statOneWeekSevenDays(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm);
+
+    /**
+     * 统计一个月每天的扫码人数
+     * @param goodsQRCodeRecordStatForm
+     * @return
+     */
+    List<ScanNumStatResult> statOneMonthAllDays(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm);
+    
+    /**
+     * 统计个月扫码人数
+     * @author lym
+     * @param goodsQRCodeRecordStatForm
+     * @return
+     */
+    List<ScanNumStatisResult> statQRCodeScanNumByMonth(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm);
+}

+ 28 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsTracedUserMapper.java

@@ -0,0 +1,28 @@
+package com.hcloud.microservice.goods.dao;
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microservice.goods.facade.entity.GoodsTracedUser ;
+import com.hcloud.microservice.goods.facade.forms.GoodsTracedUserForm;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+public interface GoodsTracedUserMapper extends BaseMapper<GoodsTracedUser,String> {
+    /**
+     * 分页查询溯源用户信息
+     * @param pageBean
+     * @return
+     */
+    List<GoodsTracedUser> searchTracedUserByPage(PageBean<GoodsTracedUserForm> pageBean);
+
+    /**
+     * 查询溯源用户信息,通过用户第三方编号
+     * @param code
+     * @return
+     */
+    GoodsTracedUser searchTracedUserByCode(@Param("code") String code,@Param("userOpenid") String userOpenid);
+}

+ 12 - 0
src/main/java/com/hcloud/microservice/goods/dao/GoodsTypeMapper.java

@@ -0,0 +1,12 @@
+package com.hcloud.microservice.goods.dao;
+
+
+import com.hcloud.microserver.commoncore.base.BaseMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsType;
+
+/**
+ * @author xiezt
+ */
+public interface GoodsTypeMapper extends BaseMapper<GoodsType,Integer> {
+
+}

+ 28 - 0
src/main/java/com/hcloud/microservice/goods/enums/TracedCodeImgInfoEnum.java

@@ -0,0 +1,28 @@
+package com.hcloud.microservice.goods.enums;
+
+/**
+ * @author xiezt
+ */
+
+public enum TracedCodeImgInfoEnum {
+    /**
+     * 二维码图片存放子目录名称
+     */
+    IMG_SUB_DIR_NAME,
+    /**
+     * 二维码访问内容
+     */
+    CODE_CONTENT,
+    /**
+     * 企业logo路径
+     */
+    ORG_LOGO_NAME,
+    /**
+     * 二维码图片后缀名
+     */
+    IMG_SUFFIX,
+    /**
+     * 图片名称
+     */
+    IMG_NAME;
+}

+ 21 - 0
src/main/java/com/hcloud/microservice/goods/event/TracedQRCodeImgEvent.java

@@ -0,0 +1,21 @@
+package com.hcloud.microservice.goods.event;
+
+import lombok.Getter;
+import org.springframework.context.ApplicationEvent;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author xiezt
+ */
+@Getter
+public class TracedQRCodeImgEvent extends ApplicationEvent {
+
+    private List<Map> qrcodeInfoList;
+
+    public TracedQRCodeImgEvent(Object source,List<Map> qrcodeInfoList) {
+        super(source);
+        this.qrcodeInfoList = qrcodeInfoList;
+    }
+}

+ 57 - 0
src/main/java/com/hcloud/microservice/goods/eventlisteners/BusinessListener.java

@@ -0,0 +1,57 @@
+package com.hcloud.microservice.goods.eventlisteners;
+
+import com.hcloud.microserver.commoncore.util.QrCodeUtil;
+import com.hcloud.microservice.goods.enums.TracedCodeImgInfoEnum;
+import com.hcloud.microservice.goods.event.TracedQRCodeImgEvent;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.event.EventListener;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+@Slf4j
+@Component
+public class BusinessListener {
+
+    @Value("${qr.code.path}")
+    private String qrcodeImgPath;
+
+    @Value("${qr.code.logo.path}")
+    private String orgLogoDirectory;
+
+    @Async
+    @EventListener
+    public void generateQRCodeWithLogo(TracedQRCodeImgEvent tracedQRCodeImgEvent){
+        //获取生成二维码图片信息列表
+        List<Map> tracedCodeList = tracedQRCodeImgEvent.getQrcodeInfoList();
+        if(null!= tracedCodeList && tracedCodeList.size()>0){
+            QrCodeUtil qrCodeUtil = new QrCodeUtil();
+            for(Map map : tracedCodeList){
+                String imgSubPathName = (String) map.get(TracedCodeImgInfoEnum.IMG_SUB_DIR_NAME);
+                String logoName = (String) map.get(TracedCodeImgInfoEnum.ORG_LOGO_NAME);
+                String codeContent = (String) map.get(TracedCodeImgInfoEnum.CODE_CONTENT);
+                String imgName = (String) map.get(TracedCodeImgInfoEnum.IMG_NAME);
+                String orgLogoPath= orgLogoDirectory+logoName;
+                String imgPath = qrcodeImgPath+imgSubPathName;
+                try {
+                    log.info("codeContent==============>{}",codeContent);
+                    log.info("orgLogoPath==============>{}",orgLogoPath);
+                    log.info("imgPath==============>{}",imgPath);
+                    File filePath = new File(orgLogoPath);
+                    if(!filePath.exists()){
+                        qrCodeUtil.generateQRCode(codeContent,imgPath,imgName,"png");
+                    }else{
+                        qrCodeUtil.generateQRCodeWithLogo(codeContent,orgLogoPath,imgPath,imgName,"png");
+                    }
+                } catch (Exception e) {
+                    log.info("generate qr code error  =============>{}",e.getMessage());
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+}

+ 47 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsAssayInfoService.java

@@ -0,0 +1,47 @@
+package com.hcloud.microservice.goods.service;
+
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microservice.goods.facade.entity.GoodsAssayInfo;
+import com.hcloud.microservice.goods.facade.forms.GoodsAssayInfoForm;
+
+/**
+ * 商品批次检疫信息
+ * @author xiezt
+ */
+public interface GoodsAssayInfoService extends BaseServie<GoodsAssayInfo,String> {
+    /**
+     * 保存商品批次检疫检验信息
+     * @param goodsAssayInfoForm
+     * @return
+     */
+    int saveBatchGoodsAssayInfo(GoodsAssayInfoForm goodsAssayInfoForm);
+
+    /**
+     * 通过商品批次id查询商品批次检疫检验信息
+     * @param batchId
+     * @return
+     */
+    GoodsAssayInfoForm searchByGoodsBatchId(String batchId);
+
+    /**
+     * 编辑商品批次检验信息
+     * @param goodsAssayInfoForm
+     * @return
+     */
+    int editBatchGoodsAssayInfo(GoodsAssayInfoForm goodsAssayInfoForm);
+
+    /**
+     * 删除商品批次检验信息
+     * @param guid
+     * @param orgGuid
+     * @return
+     */
+    int delBatchGoodsAssayInfo(String guid,String orgGuid);
+
+    /**
+     * 删除商品批次检验信息通过商品批次ID
+     * @param batchId
+     * @return
+     */
+    int delBatchGoodsAssayInfoByBatchId(String batchId);
+}

+ 35 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsBatchFeedbackService.java

@@ -0,0 +1,35 @@
+package com.hcloud.microservice.goods.service;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchFeedbackForm;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+public interface GoodsBatchFeedbackService extends BaseServie<GoodsBatchFeedbackForm,String> {
+
+    /**
+     * 分页查询评价列表
+     * @param feedbackForm
+     * @return
+     */
+    PageInfo searchBatchFeedbackByPage(GoodsBatchFeedbackForm feedbackForm);
+
+    /**
+     * 通过溯源用户id,查询商品评价列表
+     * @param userId
+     * @param batchId
+     * @return
+     */
+    List<GoodsBatchFeedbackForm> getGoodsFeedbackByUserId(String userId,String batchId);
+
+    /**
+     * 批量删除评价信息
+     * @param pkList
+     * @return
+     */
+    int delGoodsFeedbackByList(List<String> pkList);
+}

+ 35 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsBatchGradeService.java

@@ -0,0 +1,35 @@
+package com.hcloud.microservice.goods.service;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microservice.goods.facade.entity.GoodsBatchGrade;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchGradeForm;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+public interface GoodsBatchGradeService extends BaseServie<GoodsBatchGradeForm,String> {
+
+    /**
+     * 分页查询评价星级
+     * @param gradeForm
+     * @return
+     */
+    PageInfo searchBatchGradeByPage(GoodsBatchGradeForm gradeForm);
+
+    /**
+     * 获取商品评价信息列表
+     * @param goodsBatchId
+     * @param uid
+     * @return
+     */
+    List<GoodsBatchGradeForm> getBatchGradeInfoByCond(String uid,String goodsBatchId);
+
+    /**
+     * 批量删除评价星级信息
+     * @param pkList
+     */
+    int delBatchGradeInfo(List<String> pkList);
+}

+ 56 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsBatchInfoService.java

@@ -0,0 +1,56 @@
+package com.hcloud.microservice.goods.service;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microservice.goods.facade.entity.GoodsBatchInfo;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchInfoForm;
+
+/**
+ * 产品批次记录服务
+ * @author xiezt
+ */
+public interface GoodsBatchInfoService extends BaseServie<GoodsBatchInfo,String> {
+
+    /**
+     * 分页查询商品批次信息
+     * @param batchInfoForm
+     * @return
+     */
+    PageInfo searchGoodsBatchInfoByPage(GoodsBatchInfoForm batchInfoForm);
+
+    /**
+     * 添加商品批次信息
+     * @param batchInfoForm
+     * @return
+     */
+    int addGoodsBatchInfo(GoodsBatchInfoForm batchInfoForm);
+
+    /**
+     * 编辑商品批次信息
+     * @param batchInfoForm
+     * @return
+     */
+    int editGoodsBatchInfo(GoodsBatchInfoForm batchInfoForm);
+
+    /**
+     * 删除商品批次信息
+     * @param batchInfoForm
+     * @return
+     */
+    int deleteGoodsBatchInfo(GoodsBatchInfoForm batchInfoForm);
+
+    /**
+     * 查询商品批次信息
+     * @param goodsBatchId
+     * @return
+     */
+    GoodsBatchInfoForm searchGoodsBatchInfoById(String goodsBatchId);
+
+    /**
+     * 添加评价及评级信息
+     * @param batchInfoForm
+     * @return
+     */
+    int saveAllFeedbackInfo(GoodsBatchInfoForm batchInfoForm);
+
+}

+ 34 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsDealerService.java

@@ -0,0 +1,34 @@
+package com.hcloud.microservice.goods.service;
+
+import java.util.List;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microservice.goods.facade.entity.GoodsDealer;
+import com.hcloud.microservice.goods.facade.forms.GoodsDealerForm;
+
+public interface GoodsDealerService extends BaseServie<GoodsDealer, String>{
+
+	/**
+     *  分页查询商品信息
+     * @param goodsInfoForm
+     * @return
+     */
+    PageInfo searchByPage(GoodsDealerForm goodsDealerForm);
+    
+    /**
+	 * 获取最大编码
+	 * @author lym
+	 * @param orgGuid
+	 * @return
+	 */
+    String getMaxCode();
+    
+    /**
+     * 查询企业所有经销商
+     * @author lym
+     * @param orgGuid
+     * @return
+     */
+    List<GoodsDealer> selectList(String orgGuid);
+}

+ 43 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsFieldService.java

@@ -0,0 +1,43 @@
+package com.hcloud.microservice.goods.service;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microservice.goods.facade.entity.GoodsField;
+import com.hcloud.microservice.goods.facade.forms.GoodsFieldForm;
+
+/**
+ * 产品产地服务
+ * @author xiezt
+ */
+public interface GoodsFieldService extends BaseServie<GoodsField,String> {
+
+    /**
+     * 分页查询产地信息
+     * @param goodsFieldForm
+     * @return
+     */
+    PageInfo searchGoodsFieldByPage(GoodsFieldForm goodsFieldForm);
+
+    /**
+     * 添加商品产地
+     * @param goodsFieldForm
+     * @return
+     */
+    int addGoodsFieldInfo(GoodsFieldForm goodsFieldForm);
+
+    /**
+     * 修改商品产地
+     * @param goodsFieldForm
+     * @return
+     */
+    int updateGoodsFieldInfo(GoodsFieldForm goodsFieldForm);
+
+
+    /**
+     * 查询产地明细
+     * @param goodsId
+     * @param orgGuid
+     * @return
+     */
+    GoodsFieldForm getGoodsFieldInfoById(String goodsId,String orgGuid);
+}

+ 27 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsInfoService.java

@@ -0,0 +1,27 @@
+package com.hcloud.microservice.goods.service;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microservice.goods.facade.entity.GoodsInfo;
+import com.hcloud.microservice.goods.facade.forms.GoodsInfoForm;
+
+/**
+ * 产品信息服务
+ * @author xiezt
+ */
+public interface GoodsInfoService extends BaseServie<GoodsInfo,String> {
+
+    /**
+     *  分页查询商品信息
+     * @param goodsInfoForm
+     * @return
+     */
+    PageInfo searchGoodsInfoByPage(GoodsInfoForm goodsInfoForm);
+
+    /**
+     * 查询商品明细
+     * @param guid
+     * @return
+     */
+    GoodsInfoForm searchGoodsInfoById(String guid);
+}

+ 10 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsInterAuxiliaryService.java

@@ -0,0 +1,10 @@
+package com.hcloud.microservice.goods.service;
+
+import java.util.List;
+
+import com.hcloud.microservice.goods.facade.entity.GoodsInterAuxiliary;
+
+public interface GoodsInterAuxiliaryService {
+
+	List<GoodsInterAuxiliary> selectGoodsInterAux(String fieldGuid);
+}

+ 41 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsProInputsService.java

@@ -0,0 +1,41 @@
+package com.hcloud.microservice.goods.service;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microservice.goods.facade.forms.GoodsProInputsForm;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+public interface GoodsProInputsService extends BaseServie<GoodsProInputsForm,String> {
+
+    /**
+     * 分页查询投入品信息
+     * @param inputsForm
+     * @return
+     */
+    PageInfo searchProInputsByPage(GoodsProInputsForm inputsForm);
+
+    /**
+     *  查询投入品信息通过商品批次GUID
+     * @param batchGuid
+     * @return
+     */
+    List<GoodsProInputsForm> searchProInputsByBatchGuid(String batchGuid);
+
+    /**
+     * 批量保存生产原料信息
+     * @param list
+     * @return
+     */
+    int batchSaveProInputs(List<GoodsProInputsForm> list);
+
+    /**
+     * 删除原料投入品信息
+     * @param batchGuid
+     * @return
+     */
+    int delProInputs(String batchGuid);
+}

+ 41 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsProNormalService.java

@@ -0,0 +1,41 @@
+package com.hcloud.microservice.goods.service;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microservice.goods.facade.entity.GoodsProNormal;
+import com.hcloud.microservice.goods.facade.forms.GoodsProNormalForm;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+public interface GoodsProNormalService extends BaseServie<GoodsProNormalForm,String> {
+    /**
+     * 分页查询通用流通信息
+     * @param goodsProNormalForm
+     * @return
+     */
+    PageInfo searchProNormalByPage(GoodsProNormalForm goodsProNormalForm);
+
+    /**
+     * 批量保存生产过程信息
+     * @param list
+     * @return
+     */
+    int batchSaveProNormal(List<GoodsProNormalForm> list);
+
+    /**
+     * 通过商品批次号查询生产过程信息
+     * @param batchId
+     * @return
+     */
+    List<GoodsProNormalForm> searchProNormalByFK(String batchId,Integer processType);
+
+    /**
+     * 删除加工生产过程信息
+     * @param batchId
+     * @return
+     */
+    int delProNormalByFK(String batchId);
+}

+ 87 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsQRCodeInfoService.java

@@ -0,0 +1,87 @@
+package com.hcloud.microservice.goods.service;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microservice.goods.facade.entity.GoodsQRCodeInfo;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeInfoForm;
+
+import java.util.List;
+
+/**
+ * 二维码基本信息
+ * @author xiezt
+ */
+public interface GoodsQRCodeInfoService extends BaseServie<GoodsQRCodeInfo,String> {
+    /**
+     * 通过扫码更新溯源码信息
+     * @param qrToken
+     * @return
+     */
+    int updateGoodsQRInfoByScan(String qrToken);
+
+    /**
+     * 通过溯源传输码查询溯源码信息
+     * @param qrToken
+     * @return
+     */
+    GoodsQRCodeInfoForm getGoodsQRInfo(String qrToken);
+
+    /**
+     * 批量保存溯源码信息
+     * @param codeInfoForm
+     * @return
+     */
+    int batchSaveGoodsQRCodeInfo(GoodsQRCodeInfoForm codeInfoForm);
+
+    /**
+     * 通过溯源码生成记录Id查询溯源码信息
+     * @param goodsQRCodeInfoForm
+     * @return
+     */
+    PageInfo queryGoodsQRCodeInfoByRecId(GoodsQRCodeInfoForm goodsQRCodeInfoForm);
+
+    /**
+     * 删除溯源明细信息(逻辑删除)
+     * @param goodsQRCodeInfoForm
+     * @return
+     */
+    int delGoodsQRCodeInfoByRecordId(GoodsQRCodeInfoForm goodsQRCodeInfoForm);
+
+    /**
+     * 删除溯源明细信息(物理删除)
+     * @param recordId
+     * @return
+     */
+    int delQRCodeInfoByPhysical(String recordId);
+
+    /**
+     * 废弃单个溯源码信息(逻辑删除)
+     * @param goodsQRCodeInfoForm
+     * @return
+     */
+    int forbiddenCodeInfoByCodeId(GoodsQRCodeInfoForm goodsQRCodeInfoForm);
+
+    /**
+     * 批量更新溯源码信息通过生成记录Id
+     * @param list
+     * @return
+     */
+    int batchUpdateGoodsQRCodeInfoByRecord(List<String> list);
+    
+    /**
+     * 通过生成记录Id查询打印溯源码信息
+     * @author lym
+     * @param recordId
+     * @return
+     */
+    PageInfo getPrintGoodsQRInfo(GoodsQRCodeInfoForm goodsQRCodeInfoForm);
+    
+    /**
+     * 修改是否打印状态
+     * @author lym
+     * @param ids
+     * @return
+     */
+    int updateQRIsPrint(List<String> ids);
+}

+ 58 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsQRCodeRecordService.java

@@ -0,0 +1,58 @@
+package com.hcloud.microservice.goods.service;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microservice.goods.facade.entity.GoodsQRCodeRecord;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeInfoForm;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordForm;
+
+import java.util.List;
+
+/**
+ * 二维码生成记录
+ * @author xiezt
+ */
+public interface GoodsQRCodeRecordService extends BaseServie<GoodsQRCodeRecord,String> {
+    /**
+     * 分页查询二维码生成记录
+     * @param recordForm
+     * @return
+     */
+    PageInfo searchQRCodeRecordByPage(GoodsQRCodeRecordForm recordForm);
+
+    /**
+     * 生成溯源二维码记录(含溯源码明细、包含溯源码信息、溯源码图片)
+     * @param goodsQRCodeRecordForm
+     * @return
+     */
+    int generateGoodsQRCodeInfo(GoodsQRCodeRecordForm goodsQRCodeRecordForm);
+
+
+    /**
+     * 获取二维码生成详情
+     * @param queryInfo
+     * @return
+     */
+    PageInfo getGoodsQRCodeDetailById(GoodsQRCodeInfoForm queryInfo);
+
+    /**
+     * 删除二维码生成记录
+     * @param goodsQRCodeRecordForm
+     * @return
+     */
+    int delGoodsQRCodeRecord(GoodsQRCodeRecordForm goodsQRCodeRecordForm);
+
+    /**
+     * 删除二维码生成记录(物理删除)
+     * @param recordId
+     * @return
+     */
+    int delQRcodeInfoByPhysical(String recordId);
+
+    /**
+     * 批量删除溯源码生成记录(逻辑删除)
+     * @param batchId
+     * @return
+     */
+    int delGoodsQRCodeRecordByBatchId(String batchId);
+}

+ 21 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsQRCodeRecordStatService.java

@@ -0,0 +1,21 @@
+package com.hcloud.microservice.goods.service;
+
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordStatForm;
+import com.hcloud.microservice.goods.facade.results.ScanNumStatResult;
+import com.hcloud.microservice.goods.facade.results.ScanNumStatisResult;
+
+import java.util.LinkedList;
+import java.util.List;
+
+public interface GoodsQRCodeRecordStatService {
+
+	LinkedList<ScanNumStatisResult> statOneYearAllMonthData(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm);
+
+    List<ScanNumStatResult> statYesterdayAndAllTimeData(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm);
+
+    List<ScanNumStatResult> statOneDayAllHoursData(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm);
+
+    List<ScanNumStatResult> statOneWeekSevenDaysData(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm);
+
+    List<ScanNumStatResult> statOneMonthAllDaysData(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm);
+}

+ 29 - 0
src/main/java/com/hcloud/microservice/goods/service/GoodsTracedUserService.java

@@ -0,0 +1,29 @@
+package com.hcloud.microservice.goods.service;
+
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.BaseServie;
+import com.hcloud.microservice.goods.facade.forms.GoodsTracedUserForm;
+
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+public interface GoodsTracedUserService extends BaseServie<GoodsTracedUserForm,String> {
+
+    /**
+     * 分页查询溯源用户信息
+     * @param goodsTracedUserForm
+     * @return
+     */
+    PageInfo searchTracedUserByPage(GoodsTracedUserForm goodsTracedUserForm);
+
+    /**
+     * 查询溯源用户信息,通过用户第三方编号
+     * @param code
+     * @return
+     */
+    GoodsTracedUserForm searchTracedUserByCode(String code,String userOpenid);
+
+
+}

+ 263 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodQRCodeRecordServiceImpl.java

@@ -0,0 +1,263 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.google.common.collect.Lists;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microserver.commoncore.util.GetUUID;
+import com.hcloud.microservice.goods.bo.GoodsQRCodeInfoBO;
+import com.hcloud.microservice.goods.bo.GoodsQRCodeRecordBO;
+import com.hcloud.microservice.goods.dao.GoodsBatchInfoMapper;
+import com.hcloud.microservice.goods.dao.GoodsQRCodeRecordMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsBatchInfo;
+import com.hcloud.microservice.goods.facade.entity.GoodsQRCodeInfo;
+import com.hcloud.microservice.goods.facade.entity.GoodsQRCodeRecord;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeInfoForm;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordForm;
+import com.hcloud.microservice.goods.service.GoodsQRCodeInfoService;
+import com.hcloud.microservice.goods.service.GoodsQRCodeRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author apple
+ */
+@Transactional(rollbackFor = Exception.class)
+@Service("goodsQRCodeRecordService")
+public class GoodQRCodeRecordServiceImpl implements GoodsQRCodeRecordService {
+
+    /**
+     * 样本数据
+     */
+    private static final Integer SAMPLE_TEN_VALUE=10;
+
+    private static final Integer SAMPLE_HUNDRED_VALUE=100;
+
+    @Resource
+    private GoodsQRCodeRecordMapper goodsQRCodeRecordMapper;
+
+    @Resource
+    private GoodsBatchInfoMapper goodsBatchInfoMapper;
+
+    @Autowired
+    private GoodsQRCodeInfoService goodsQRCodeInfoService;
+
+    /**
+     * 分页查询二维码生成记录
+     *
+     * @param recordForm
+     * @return
+     */
+    @Override
+    public PageInfo searchQRCodeRecordByPage(GoodsQRCodeRecordForm recordForm) {
+        PageBean pageBean = new PageBean(recordForm);
+        PageHelper.startPage(recordForm.getPageNo(),recordForm.getPageSize());
+        List<GoodsQRCodeRecordBO> list = goodsQRCodeRecordMapper.searchByPage(pageBean);
+        return new PageInfo(list);
+    }
+
+    /**
+     * 生成溯源二维码记录(含溯源码明细、包含溯源码信息、溯源码图片)
+     *
+     * @param goodsQRCodeRecordForm
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int generateGoodsQRCodeInfo(GoodsQRCodeRecordForm goodsQRCodeRecordForm) {
+        if(null!=goodsQRCodeRecordForm && !"".equals(goodsQRCodeRecordForm.getFkGoodsBatchGuid())){
+            //TODO 产生二维码生成记录数据
+            GoodsQRCodeRecord goodsQRCodeRecord = new GoodsQRCodeRecord();
+            BeanCopyUtil.copyBean(goodsQRCodeRecordForm,goodsQRCodeRecord);
+            String orgBrevity = goodsQRCodeRecordForm.getOrgBrevity();
+            String goodsBatchId = goodsQRCodeRecord.getFkGoodsBatchGuid();
+            //生成二维码父码
+            goodsQRCodeRecord.setGoodsParentQrcode(getMaxParentCode(orgBrevity,goodsBatchId));
+            goodsQRCodeRecord.setQrcodeRecordTime(new Date());
+            goodsQRCodeRecord.setOriginNum(goodsQRCodeRecordForm.getCodeCount());
+            goodsQRCodeRecord.setCancelNum(0);
+            goodsQRCodeRecord.setScanNum(0);
+            goodsQRCodeRecord.setUsedNum(0);
+            int i =this.saveSelective(goodsQRCodeRecord);
+            if(i!=0){
+                //TODO 产生二维码生成记录明细
+                GoodsQRCodeInfoForm codeInfoForm = new GoodsQRCodeInfoForm();
+                codeInfoForm.setCodeCount(goodsQRCodeRecordForm.getCodeCount());
+                codeInfoForm.setFkOrgGuid(goodsQRCodeRecord.getFkOrgGuid());
+                codeInfoForm.setFkBatchRecordGuid(goodsQRCodeRecord.getGuid());
+                codeInfoForm.setQrcodeParentCode(goodsQRCodeRecord.getGoodsParentQrcode());
+                codeInfoForm.setGoodsBatchInfoId(goodsBatchId);
+                codeInfoForm.setOrgBrevity(orgBrevity);
+                codeInfoForm.setIco(goodsQRCodeRecordForm.getIco());
+                codeInfoForm.setCodeUrlPrefix(goodsQRCodeRecordForm.getCodeUrlPrefix());
+                codeInfoForm.setCreateUser(goodsQRCodeRecordForm.getCreateUser());
+                codeInfoForm.setModifiedUser(goodsQRCodeRecordForm.getModifiedUser());
+                int insertCount = goodsQRCodeInfoService.batchSaveGoodsQRCodeInfo(codeInfoForm);
+                return insertCount;
+            }
+        }
+        return 0;
+    }
+
+    /**
+     * 生成最大的二维码父码信息
+     * @param orgBrevity 机构简码
+     * @param guid 商品批次记录主键
+     * @return
+     */
+    private String getMaxParentCode(String orgBrevity,String guid){
+        StringBuilder stb = new StringBuilder();
+        GoodsBatchInfo goodsBatchInfo = goodsBatchInfoMapper.selectByPrimaryKey(guid);
+        if(goodsBatchInfo!=null){
+            String batchNo = goodsBatchInfo.getGoodsBatchNo();
+            String codePrefix = orgBrevity+batchNo;
+            stb.append(codePrefix);
+            String maxCode = goodsQRCodeRecordMapper.getMaxParentCode(codePrefix);
+            if(null!=maxCode && !"".equals(maxCode)){
+                Integer num = Integer.valueOf(maxCode.substring(codePrefix.length()));
+                num++;
+                if(num<SAMPLE_TEN_VALUE){
+                    stb.append("00").append(num);
+                }else if(num<SAMPLE_HUNDRED_VALUE){
+                    stb.append("0").append(num);
+                }
+            }else{
+                stb.append("001");
+            }
+            return stb.toString();
+        }
+        return null;
+    }
+
+    /**
+     * 获取二维码生成详情
+     *
+     * @param queryInfo
+     * @return
+     */
+    @Override
+    public PageInfo getGoodsQRCodeDetailById(GoodsQRCodeInfoForm queryInfo) {
+        PageInfo pageInfo = goodsQRCodeInfoService.queryGoodsQRCodeInfoByRecId(queryInfo);
+        List<GoodsQRCodeInfoForm> resultList = BeanCopyUtil.convertList(pageInfo.getList(),GoodsQRCodeInfoForm.class);
+        pageInfo.setList(resultList);
+        return pageInfo;
+    }
+
+    /**
+     * 删除二维码生成记录
+     * @param goodsQRCodeRecordForm
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int delGoodsQRCodeRecord(GoodsQRCodeRecordForm goodsQRCodeRecordForm) {
+        //TODO 删除溯源码生成记录
+        GoodsQRCodeRecord codeRecord = goodsQRCodeRecordMapper.selectByPrimaryKey(goodsQRCodeRecordForm.getGuid());
+        codeRecord.setState(0);
+        codeRecord.setCancelNum(codeRecord.getOriginNum());
+        codeRecord.setModifiedUser(goodsQRCodeRecordForm.getModifiedUser());
+        codeRecord.setModifiedTime(new Date());
+        int i = goodsQRCodeRecordMapper.updateByPrimaryKeySelective(codeRecord);
+        if (i==0){throw new RuntimeException();}
+        //TODO 删除溯源码详细信息记录
+        GoodsQRCodeInfoForm codeInfoForm = new GoodsQRCodeInfoForm();
+        codeInfoForm.setFkBatchRecordGuid(goodsQRCodeRecordForm.getGuid());
+        codeInfoForm.setState(0);
+        codeInfoForm.setModifiedUser(goodsQRCodeRecordForm.getModifiedUser());
+        codeInfoForm.setModifiedTime(new Date());
+        int j = goodsQRCodeInfoService.delGoodsQRCodeInfoByRecordId(codeInfoForm);
+        if(j==0){throw new RuntimeException();}
+        //TODO 删除溯源码图片
+        return 1;
+    }
+
+    /**
+     * 删除二维码生成记录(物理删除)
+     *
+     * @param recordId
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int delQRcodeInfoByPhysical(String recordId) {
+        int i = goodsQRCodeRecordMapper.deleteByPrimaryKey(recordId);
+        if (i==0){throw new RuntimeException();}
+        goodsQRCodeInfoService.delQRCodeInfoByPhysical(recordId);
+        return i;
+    }
+
+    /**
+     * 批量删除溯源码生成记录(逻辑删除)
+     *
+     * @param batchId
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int delGoodsQRCodeRecordByBatchId(String batchId) {
+        if(batchId!=null && !"".equals(batchId)){
+            List<String> recordIdList = Lists.newArrayList();
+           List<GoodsQRCodeRecord> batchIdList =  goodsQRCodeRecordMapper.getGoodsQRCodeRecordByBatchId(batchId);
+           if(null!=batchIdList && batchIdList.size()>0){
+               for (GoodsQRCodeRecord bean:batchIdList) {
+                   recordIdList.add(bean.getGuid());
+               }
+              //删除溯源码记录信息
+               int i = goodsQRCodeRecordMapper.batchUpdateGoodsQRCodeRecord(recordIdList);
+               if(i==0){throw new RuntimeException();}
+              //删除溯源码明细记录
+               int j =  goodsQRCodeInfoService.batchUpdateGoodsQRCodeInfoByRecord(recordIdList);
+               if(j==0){throw new RuntimeException();}
+               return j;
+           }
+           return 1;
+        }
+        return 0;
+    }
+
+    @Override
+    public int delByPrimaryKey(String guid) {
+        return goodsQRCodeRecordMapper.deleteByPrimaryKey(guid);
+    }
+
+    @Override
+    public int save(GoodsQRCodeRecord record) {
+        record.setGuid(GetUUID.getUUID());
+        return goodsQRCodeRecordMapper.insert(record);
+    }
+
+    @Override
+    public int saveSelective(GoodsQRCodeRecord record) {
+        record.setGuid(GetUUID.getUUID());
+        return goodsQRCodeRecordMapper.insertSelective(record);
+    }
+
+    @Override
+    public GoodsQRCodeRecord queryByPrimaryKey(String guid) {
+        return goodsQRCodeRecordMapper.selectByPrimaryKey(guid);
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(GoodsQRCodeRecord record) {
+        return goodsQRCodeRecordMapper.updateByPrimaryKeySelective(record);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(GoodsQRCodeRecord record) {
+        //TODO empty implements
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(GoodsQRCodeRecord record) {
+        return goodsQRCodeRecordMapper.updateByPrimaryKey(record);
+    }
+}

+ 215 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsAssayInfServiceImpl.java

@@ -0,0 +1,215 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microserver.commoncore.util.UUIDUtils;
+import com.hcloud.microserver.commoncore.util.string.ConvertStringToList;
+import com.hcloud.microservice.goods.dao.GoodsAssayInfoMapper;
+import com.hcloud.microservice.goods.dao.GoodsInfoAuxiliaryMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsAssayInfo;
+import com.hcloud.microservice.goods.facade.entity.GoodsInfoAuxiliary;
+import com.hcloud.microservice.goods.facade.forms.GoodsAssayInfoForm;
+import com.hcloud.microservice.goods.facade.forms.GoodsInfoAuxiliaryForm;
+import com.hcloud.microservice.goods.service.GoodsAssayInfoService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+@Transactional(rollbackFor = Exception.class)
+@Service("goodsAssayInfService")
+public class GoodsAssayInfServiceImpl implements GoodsAssayInfoService {
+
+    @Resource
+    private GoodsAssayInfoMapper goodsAssayInfoMapper;
+
+    @Resource
+    private GoodsInfoAuxiliaryMapper goodsInfoAuxiliaryMapper;
+
+    /**
+     * 保存商品批次检疫检验信息
+     *
+     * @param goodsAssayInfoForm
+     * @return
+     */
+    @Override
+    public int saveBatchGoodsAssayInfo(GoodsAssayInfoForm goodsAssayInfoForm) {
+        //TODO 保存检验主表
+        if(goodsAssayInfoForm!=null){
+            GoodsAssayInfo goodsAssayInfo = new GoodsAssayInfo();
+            BeanCopyUtil.copyBean(goodsAssayInfoForm,goodsAssayInfo);
+            int i = this.saveSelective(goodsAssayInfo);
+                List<GoodsInfoAuxiliaryForm> auxList = goodsAssayInfoForm.getAuxList();
+                //TODO 判断是否有自定义属性字段
+                if(null!=auxList && auxList.size()>0){
+                    for (GoodsInfoAuxiliaryForm aux:auxList) {
+                        aux.setFkOrgGuid(goodsAssayInfoForm.getFkOrgGuid());
+                        aux.setFkAuxItmeId(goodsAssayInfo.getGuid());
+                        aux.setFkGoodsGuid(goodsAssayInfoForm.getFkGoodsBatchId());
+                        aux.setState(goodsAssayInfoForm.getState());
+                        aux.setCreateUser(goodsAssayInfoForm.getCreateUser());
+                        aux.setCreateTime(new Date());
+                        aux.setModifiedUser(goodsAssayInfoForm.getModifiedUser());
+                        aux.setModifiedTime(new Date());
+                    }
+                    goodsInfoAuxiliaryMapper.bathSaveAuxiliaryInfo(auxList);
+                }
+            return i;
+            }
+        return 0;
+    }
+
+    /**
+     * 通过商品批次id查询商品批次检疫检验信息
+     *
+     * @param batchId
+     * @return
+     */
+    @Override
+    public GoodsAssayInfoForm searchByGoodsBatchId(String batchId) {
+        GoodsAssayInfoForm goodsAssayInfoForm = new GoodsAssayInfoForm();
+        GoodsAssayInfo assayInfo =  goodsAssayInfoMapper.getGoodsAssayInfoByBatchId(batchId);
+        if(assayInfo!=null){
+           BeanCopyUtil.copyBean(assayInfo,goodsAssayInfoForm);
+           String assayInfoId =  assayInfo.getGuid();
+           String imgStr = assayInfo.getAssayImgs();
+           List<GoodsInfoAuxiliary> auxList = goodsInfoAuxiliaryMapper.queryListByParentId(assayInfoId);
+           List<GoodsInfoAuxiliaryForm> auxFormList =  BeanCopyUtil.convertList(auxList,GoodsInfoAuxiliaryForm.class);
+           //TODO 查询辅助信息
+            goodsAssayInfoForm.setAuxList(auxFormList);
+            //TODO 查询图片信息
+            List<String> list = ConvertStringToList.getListFormSplitString(imgStr,",");
+            goodsAssayInfoForm.setImagesList(list);
+        }
+        return goodsAssayInfoForm;
+    }
+
+    /**
+     * 编辑商品批次检验信息
+     *
+     * @param goodsAssayInfoForm
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int editBatchGoodsAssayInfo(GoodsAssayInfoForm goodsAssayInfoForm) {
+        if(goodsAssayInfoForm!=null){
+            //更新商品检验信息
+            String guid = goodsAssayInfoForm.getGuid();
+            String orgGuid = goodsAssayInfoForm.getFkOrgGuid();
+            GoodsAssayInfo assayInfo = goodsAssayInfoMapper.selectByPrimaryKey(guid);
+            if(assayInfo!=null){
+                assayInfo.setState(0);
+                assayInfo.setModifiedUser(goodsAssayInfoForm.getModifiedUser());
+                assayInfo.setModifiedTime(new Date());
+                BeanCopyUtil.copyBean(goodsAssayInfoForm,assayInfo);
+               int i = goodsAssayInfoMapper.updateByPrimaryKeySelective(assayInfo);
+               if(i==0){throw new RuntimeException();}
+                //更新商品检验辅助信息
+                List<GoodsInfoAuxiliaryForm> auxList = goodsAssayInfoForm.getAuxList();
+                if(null!=auxList && auxList.size()>0){
+                    for (GoodsInfoAuxiliaryForm bean:auxList) {
+                        bean.setFkOrgGuid(goodsAssayInfoForm.getFkOrgGuid());
+                        bean.setFkAuxItmeId(assayInfo.getGuid());
+                        bean.setFkGoodsGuid(assayInfo.getGuid());
+                        bean.setState(1);
+                        bean.setCreateUser(goodsAssayInfoForm.getCreateUser());
+                        bean.setCreateTime(goodsAssayInfoForm.getCreateTime());
+                        bean.setModifiedUser(goodsAssayInfoForm.getModifiedUser());
+                        bean.setModifiedTime(goodsAssayInfoForm.getModifiedTime());
+                    }
+                    goodsInfoAuxiliaryMapper.delGoodsFieldAuxiliaryinfoByFkId(guid);
+                    goodsInfoAuxiliaryMapper.bathSaveAuxiliaryInfo(auxList);
+                }
+                return i;
+            }
+        }
+        return 0;
+    }
+
+    /**
+     * 删除商品批次检验信息
+     *
+     * @param guid
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int delBatchGoodsAssayInfo(String guid,String orgGuid) {
+        GoodsAssayInfo assayInfo = goodsAssayInfoMapper.selectByPrimaryKey(guid);
+        if(assayInfo!=null){
+            assayInfo.setState(0);
+            assayInfo.setModifiedTime(new Date());
+            int i = goodsAssayInfoMapper.updateByPrimaryKeySelective(assayInfo);
+            if(i==0){throw new RuntimeException();}
+            goodsInfoAuxiliaryMapper.delGoodsFieldAuxiliaryinfoByFkId(guid);
+            return i;
+        }
+        return 0;
+    }
+
+    /**
+     * 删除商品批次检验信息通过商品批次ID
+     * @param batchId
+     * @return
+     */
+    @Override
+    public int delBatchGoodsAssayInfoByBatchId(String batchId) {
+        GoodsAssayInfo assayInfo = goodsAssayInfoMapper.getGoodsAssayInfoByBatchId(batchId);
+        if(null!=assayInfo){
+            String assayId = assayInfo.getGuid();
+            String orgGuid = assayInfo.getFkOrgGuid();
+            assayInfo.setState(0);
+            assayInfo.setModifiedTime(new Date());
+            int i = goodsAssayInfoMapper.updateByPrimaryKeySelective(assayInfo);
+            if(i==0){throw new RuntimeException();}
+            goodsInfoAuxiliaryMapper.delGoodsFieldAuxiliaryinfoByFkId(assayId);
+        }
+
+
+
+        return 0;
+    }
+
+    @Override
+    public int delByPrimaryKey(String guid) {
+        return goodsAssayInfoMapper.deleteByPrimaryKey(guid);
+    }
+
+    @Override
+    public int save(GoodsAssayInfo record) {
+        record.setGuid(UUIDUtils.randomUUID());
+        return goodsAssayInfoMapper.insert(record);
+    }
+
+    @Override
+    public int saveSelective(GoodsAssayInfo record) {
+        record.setGuid(UUIDUtils.randomUUID());
+        return goodsAssayInfoMapper.insertSelective(record);
+    }
+
+    @Override
+    public GoodsAssayInfo queryByPrimaryKey(String guid) {
+        return goodsAssayInfoMapper.selectByPrimaryKey(guid);
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(GoodsAssayInfo record) {
+        return goodsAssayInfoMapper.updateByPrimaryKeySelective(record);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(GoodsAssayInfo record) {
+        //TODO empty implements
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(GoodsAssayInfo record) {
+        return goodsAssayInfoMapper.updateByPrimaryKey(record);
+    }
+}

+ 114 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsBatchFeedbackServiceImpl.java

@@ -0,0 +1,114 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microserver.commoncore.util.UUIDUtils;
+import com.hcloud.microservice.goods.bo.GoodsFeedbackBO;
+import com.hcloud.microservice.goods.dao.GoodsBatchFeedbackMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsBatchFeedback;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchFeedbackForm;
+import com.hcloud.microservice.goods.service.GoodsBatchFeedbackService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+@Service("goodsBatchFeedbackService")
+public class GoodsBatchFeedbackServiceImpl implements GoodsBatchFeedbackService {
+
+
+    @Resource
+    private GoodsBatchFeedbackMapper goodsBatchFeedbackMapper;
+
+    /**
+     * 分页查询评价列表
+     *
+     * @param feedbackForm
+     * @return
+     */
+    @Override
+    public PageInfo searchBatchFeedbackByPage(GoodsBatchFeedbackForm feedbackForm) {
+       PageHelper.startPage(feedbackForm.getPageNo(),feedbackForm.getPageSize());
+       List<GoodsFeedbackBO> list =  goodsBatchFeedbackMapper.searchBatchFeedbackByPage(new PageBean(feedbackForm));
+       return new PageInfo(list);
+    }
+
+    /**
+     * 通过溯源用户id,查询商品评价列表
+     *
+     * @param userId
+     * @return
+     */
+    @Override
+    public List<GoodsBatchFeedbackForm> getGoodsFeedbackByUserId(String userId,String batchId) {
+        List<GoodsBatchFeedback> list = goodsBatchFeedbackMapper.getGoodsFeedbackByUserId(userId,batchId);
+        List<GoodsBatchFeedbackForm> resultList = BeanCopyUtil.convertList(list,GoodsBatchFeedbackForm.class);
+        return resultList;
+    }
+
+    /**
+     * 批量删除评价信息
+     *
+     * @param pkList
+     * @return
+     */
+    @Override
+    public int delGoodsFeedbackByList(List<String> pkList) {
+        return goodsBatchFeedbackMapper.delGoodsFeedbackByList(pkList);
+    }
+
+    @Override
+    public int delByPrimaryKey(String guid) {
+        return goodsBatchFeedbackMapper.deleteByPrimaryKey(guid);
+    }
+
+    @Override
+    public int save(GoodsBatchFeedbackForm record) {
+        GoodsBatchFeedback batchFeedback = new GoodsBatchFeedback();
+        BeanCopyUtil.copyBean(record,batchFeedback);
+        batchFeedback.setGuid(UUIDUtils.randomUUID());
+        return goodsBatchFeedbackMapper.insert(batchFeedback);
+    }
+
+    @Override
+    public int saveSelective(GoodsBatchFeedbackForm record) {
+        GoodsBatchFeedback batchFeedback = new GoodsBatchFeedback();
+        BeanCopyUtil.copyBean(record,batchFeedback);
+        batchFeedback.setGuid(UUIDUtils.randomUUID());
+        return goodsBatchFeedbackMapper.insertSelective(batchFeedback);
+    }
+
+    @Override
+    public GoodsBatchFeedbackForm queryByPrimaryKey(String guid) {
+        GoodsBatchFeedbackForm feedbackForm = new GoodsBatchFeedbackForm();
+        GoodsBatchFeedback goodsBatchFeedback = goodsBatchFeedbackMapper.selectByPrimaryKey(guid);
+        BeanCopyUtil.copyBean(goodsBatchFeedback,feedbackForm);
+        return feedbackForm;
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(GoodsBatchFeedbackForm record) {
+        GoodsBatchFeedback batchFeedback = new GoodsBatchFeedback();
+        BeanCopyUtil.copyBean(record,batchFeedback);
+        return goodsBatchFeedbackMapper.updateByPrimaryKeySelective(batchFeedback);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(GoodsBatchFeedbackForm record) {
+        //TODO empty implements
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(GoodsBatchFeedbackForm record) {
+        GoodsBatchFeedback batchFeedback = new GoodsBatchFeedback();
+        BeanCopyUtil.copyBean(record,batchFeedback);
+        return goodsBatchFeedbackMapper.updateByPrimaryKey(batchFeedback);
+    }
+
+}

+ 111 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsBatchGradeServiceImpl.java

@@ -0,0 +1,111 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microserver.commoncore.util.UUIDUtils;
+import com.hcloud.microservice.goods.bo.GoodsGradeBO;
+import com.hcloud.microservice.goods.dao.GoodsBatchGradeMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsBatchGrade;
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchGradeForm;
+import com.hcloud.microservice.goods.service.GoodsBatchGradeService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+@Service("goodsBatchGradeService")
+public class GoodsBatchGradeServiceImpl implements GoodsBatchGradeService {
+
+
+    @Resource
+    private GoodsBatchGradeMapper goodsBatchGradeMapper;
+
+    /**
+     * 分页查询评价星级
+     *
+     * @param gradeForm
+     * @return
+     */
+    @Override
+    public PageInfo searchBatchGradeByPage(GoodsBatchGradeForm gradeForm) {
+        PageHelper.startPage(gradeForm.getPageNo(),gradeForm.getPageSize());
+        List<GoodsGradeBO> resultList = goodsBatchGradeMapper.searchBatchGradeByPage(new PageBean(gradeForm));
+        return new PageInfo(resultList);
+    }
+
+    /**
+     * 获取商品评价信息列表
+     * @param goodsBatchId
+     * @param uid
+     * @return
+     */
+    @Override
+    public List<GoodsBatchGradeForm> getBatchGradeInfoByCond(String uid, String goodsBatchId) {
+        List<GoodsBatchGrade> list =  goodsBatchGradeMapper.getBatchGradeInfoByCond(uid,goodsBatchId);
+        List<GoodsBatchGradeForm> resultList = BeanCopyUtil.convertList(list,GoodsBatchGradeForm.class);
+        return resultList;
+    }
+
+    /**
+     * 批量删除评价星级信息
+     * @param pkList
+     */
+    @Override
+    public int delBatchGradeInfo(List<String> pkList) {
+        return goodsBatchGradeMapper.delBatchGradeInfo(pkList);
+    }
+
+    @Override
+    public int delByPrimaryKey(String guid) {
+        return goodsBatchGradeMapper.deleteByPrimaryKey(guid);
+    }
+
+    @Override
+    public int save(GoodsBatchGradeForm record) {
+        GoodsBatchGrade batchGrade = new GoodsBatchGrade();
+        BeanCopyUtil.copyBean(record,batchGrade);
+        batchGrade.setGuid(UUIDUtils.randomUUID());
+        return goodsBatchGradeMapper.insert(batchGrade);
+    }
+
+    @Override
+    public int saveSelective(GoodsBatchGradeForm record) {
+        GoodsBatchGrade batchGrade = new GoodsBatchGrade();
+        BeanCopyUtil.copyBean(record,batchGrade);
+        batchGrade.setGuid(UUIDUtils.randomUUID());
+        return goodsBatchGradeMapper.insertSelective(batchGrade);
+    }
+
+    @Override
+    public GoodsBatchGradeForm queryByPrimaryKey(String guid) {
+        GoodsBatchGradeForm goodsBatchGradeForm = new GoodsBatchGradeForm();
+        GoodsBatchGrade goodsBatchGrade = goodsBatchGradeMapper.selectByPrimaryKey(guid);
+        BeanCopyUtil.copyBean(goodsBatchGrade,goodsBatchGradeForm);
+        return goodsBatchGradeForm;
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(GoodsBatchGradeForm record) {
+        GoodsBatchGrade batchGrade = new GoodsBatchGrade();
+        BeanCopyUtil.copyBean(record,batchGrade);
+        return goodsBatchGradeMapper.updateByPrimaryKeySelective(batchGrade);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(GoodsBatchGradeForm record) {
+        //TODO empty implements
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(GoodsBatchGradeForm record) {
+        GoodsBatchGrade batchGrade = new GoodsBatchGrade();
+        BeanCopyUtil.copyBean(record,batchGrade);
+        return goodsBatchGradeMapper.updateByPrimaryKey(batchGrade);
+    }
+}

+ 531 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsBatchInfoServiceImpl.java

@@ -0,0 +1,531 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microserver.commoncore.enums.ResultEnum;
+import com.hcloud.microserver.commoncore.exception.GlobalException;
+import com.hcloud.microserver.commoncore.service.RedisUtils;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microserver.commoncore.util.DateUtils;
+import com.hcloud.microserver.commoncore.util.GetUUID;
+import com.hcloud.microserver.commoncore.util.string.ConvertStringToList;
+import com.hcloud.microserver.commoncore.util.string.StringUtil;
+import com.hcloud.microservice.goods.dao.GoodsBatchInfoMapper;
+import com.hcloud.microservice.goods.dao.GoodsBatchLabelMapper;
+import com.hcloud.microservice.goods.dao.GoodsInfoAuxiliaryMapper;
+import com.hcloud.microservice.goods.dao.GoodsLabelMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsBatchInfo;
+import com.hcloud.microservice.goods.facade.entity.GoodsBatchLabel;
+import com.hcloud.microservice.goods.facade.entity.GoodsInfoAuxiliary;
+import com.hcloud.microservice.goods.facade.entity.GoodsInterAuxiliary;
+import com.hcloud.microservice.goods.facade.entity.GoodsLabel;
+import com.hcloud.microservice.goods.facade.forms.*;
+import com.hcloud.microservice.goods.service.*;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+@Transactional(rollbackFor = Exception.class)
+@Service("goodsBatchInfoService")
+public class GoodsBatchInfoServiceImpl implements GoodsBatchInfoService {
+	
+	private Logger log = LoggerFactory.getLogger(GoodsBatchInfoServiceImpl.class);
+
+    private static final Integer PROCESS_SOURCE_TYPE=1;
+
+    private static final Integer PROCESS_PRODUCT_TYPE=2;
+
+    @Resource
+    private GoodsBatchInfoMapper goodsBatchInfoMapper;
+
+    @Resource
+    private GoodsInfoAuxiliaryMapper goodsInfoAuxiliaryMapper;
+
+    @Autowired
+    private GoodsAssayInfoService goodsAssayInfoService;
+
+    @Autowired
+    private GoodsQRCodeRecordService goodsQRCodeRecordService;
+
+    @Autowired
+    private GoodsProInputsService goodsProInputsService;
+
+    @Autowired
+    private GoodsProNormalService goodsProNormalService;
+
+    @Autowired
+    private GoodsBatchFeedbackService goodsBatchFeedbackService;
+
+    @Autowired
+    private GoodsBatchGradeService goodsBatchGradeService;
+    
+    @Resource
+    private GoodsLabelMapper goodsLabelMapper;
+    
+    @Resource
+    private GoodsBatchLabelMapper goodsBatchLabelMapper;
+    
+    @Autowired
+    private GoodsInterAuxiliaryService goodsInterAuxiliaryService;
+    
+    @Override
+    public int delByPrimaryKey(String guid) {
+        return goodsBatchInfoMapper.deleteByPrimaryKey(guid);
+    }
+
+    @Override
+    public int save(GoodsBatchInfo record) {
+        record.setGuid(GetUUID.getUUID());
+        return goodsBatchInfoMapper.insert(record);
+    }
+
+    @Override
+    public int saveSelective(GoodsBatchInfo record) {
+        record.setGuid(GetUUID.getUUID());
+        return goodsBatchInfoMapper.insertSelective(record);
+    }
+
+    @Override
+    public GoodsBatchInfo queryByPrimaryKey(String guid) {
+        return goodsBatchInfoMapper.selectByPrimaryKey(guid);
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(GoodsBatchInfo record) {
+        return goodsBatchInfoMapper.updateByPrimaryKeySelective(record);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(GoodsBatchInfo record) {
+        //TODO empty implements
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(GoodsBatchInfo record) {
+        return goodsBatchInfoMapper.updateByPrimaryKey(record);
+    }
+
+    /**
+     * 分页查询商品批次信息
+     *
+     * @param batchInfoForm
+     * @return
+     */
+    @Override
+    public PageInfo searchGoodsBatchInfoByPage(GoodsBatchInfoForm batchInfoForm) {
+        PageBean pageBean = new PageBean(batchInfoForm);
+        PageHelper.startPage(batchInfoForm.getPageNo(),batchInfoForm.getPageSize());
+        List list = goodsBatchInfoMapper.searchByPage(pageBean);
+        return new PageInfo(list);
+    }
+
+    /**
+     * 添加商品批次信息
+     *
+     * @param batchInfoForm
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int addGoodsBatchInfo(GoodsBatchInfoForm batchInfoForm) {
+        //TODO 添加商品批次信息
+        if(null!=batchInfoForm){
+            GoodsAssayInfoForm assayInfo = batchInfoForm.getAssayInfoForm();
+            List<GoodsProInputsForm> inputsFormList = batchInfoForm.getInputsFormList();
+            List<GoodsProNormalForm> materialList = batchInfoForm.getMaterialList();
+            List<GoodsProNormalForm> productList = batchInfoForm.getProductList();
+            GoodsBatchInfo batchInfo = new GoodsBatchInfo();
+            BeanCopyUtil.copyBean(batchInfoForm,batchInfo);
+            int i = this.saveSelective(batchInfo);
+            //添加产品标签
+            batchInfoForm.setGuid(batchInfo.getGuid());
+            saveOrUpdateGoodsBatchLabel(batchInfoForm);
+            //添加辅助项信息
+            List<GoodsInfoAuxiliaryForm> auxList = batchInfoForm.getAuxList();
+            if(null!=auxList && auxList.size()>0){
+                for (GoodsInfoAuxiliaryForm bean :auxList) {
+                    bean.setFkOrgGuid(batchInfoForm.getFkOrgGuid());
+                    bean.setFkAuxItmeId(batchInfo.getGuid());
+                    bean.setFkGoodsGuid(batchInfoForm.getFkGoodsGuid());
+                }
+                goodsInfoAuxiliaryMapper.bathSaveAuxiliaryInfo(auxList);
+            }
+            //添加检验信息
+            if(assayInfo!=null){
+                assayInfo.setFkGoodsBatchId(batchInfo.getGuid());
+                assayInfo.setFkOrgGuid(batchInfoForm.getFkOrgGuid());
+                assayInfo.setState(batchInfoForm.getState());
+                assayInfo.setCreateUser(batchInfoForm.getCreateUser());
+                assayInfo.setCreateTime(batchInfoForm.getCreateTime());
+                assayInfo.setModifiedUser(batchInfoForm.getModifiedUser());
+                assayInfo.setModifiedTime(batchInfoForm.getModifiedTime());
+                goodsAssayInfoService.saveBatchGoodsAssayInfo(assayInfo);
+            }
+            //添加生产原料投入品
+            if(inputsFormList!=null){
+                for (GoodsProInputsForm bean:inputsFormList) {
+                    bean.setFkOrgGuid(batchInfoForm.getFkOrgGuid());
+                    bean.setFkGoodsBatchGuid(batchInfo.getGuid());
+                    bean.setInputsTime(new Date());
+                    bean.setState(1);
+                    bean.setCreateTime(new Date());
+                    bean.setCreateUser(batchInfoForm.getCreateUser());
+                    bean.setModifiedUser(batchInfoForm.getModifiedUser());
+                    bean.setModifiedTime(new Date());
+                }
+                goodsProInputsService.batchSaveProInputs(inputsFormList);
+            }
+            //添加生产过程信息
+            fillProNormalInfo(materialList,batchInfo.getGuid(),batchInfoForm);
+            //添加加工过程信息
+            fillProNormalInfo(productList,batchInfo.getGuid(),batchInfoForm);
+            //添加物联监测信息
+            //batchInfoForm.setGuid(batchInfo.getGuid());
+            //saveOrUpdateInterAux(batchInfoForm);
+            
+            return i;
+        }
+        return 0;
+    }
+
+    /**
+     * 填充流通生产过程信息
+     * @param list
+     * @param batchId
+     * @param batchInfoForm
+     * @throws RuntimeException
+     */
+    private void fillProNormalInfo(List<GoodsProNormalForm> list,String batchId,GoodsBatchInfoForm batchInfoForm) throws RuntimeException{
+        if(list!=null && list.size()>0){
+            for (GoodsProNormalForm bean :list) {
+                bean.setFkOrgGuid(batchInfoForm.getFkOrgGuid());
+                bean.setFkGoodsBatchGuid(batchId);
+                bean.setState(1);
+                bean.setCreateTime(new Date());
+                bean.setCreateUser(batchInfoForm.getCreateUser());
+                bean.setModifiedUser(batchInfoForm.getModifiedUser());
+                bean.setModifiedTime(new Date());
+            }
+            goodsProNormalService.batchSaveProNormal(list);
+        }
+    }
+
+
+    /**
+     * 编辑商品批次信息
+     *
+     * @param batchInfoForm
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int editGoodsBatchInfo(GoodsBatchInfoForm batchInfoForm) {
+        if(null!=batchInfoForm){
+            GoodsBatchInfo batchInfo = new GoodsBatchInfo();
+            BeanCopyUtil.copyBean(batchInfoForm,batchInfo);
+            int i = goodsBatchInfoMapper.updateByPrimaryKeySelective(batchInfo);
+            //添加或删除产品标签
+            saveOrUpdateGoodsBatchLabel(batchInfoForm);
+            
+            List<GoodsInfoAuxiliaryForm> auxList = batchInfoForm.getAuxList();
+            GoodsAssayInfoForm goodsAssayInfoForm = batchInfoForm.getAssayInfoForm();
+            if(null!=auxList && auxList.size()>0){
+                for (GoodsInfoAuxiliaryForm bean:auxList) {
+                    bean.setFkOrgGuid(batchInfoForm.getFkOrgGuid());
+                    bean.setFkAuxItmeId(batchInfoForm.getGuid());
+                    bean.setFkGoodsGuid(batchInfoForm.getFkGoodsGuid());
+                    bean.setState(batchInfoForm.getState());
+                    bean.setCreateUser(batchInfoForm.getCreateUser());
+                    bean.setCreateTime(new Date());
+                    bean.setModifiedUser(batchInfoForm.getModifiedUser());
+                    bean.setModifiedTime(new Date());
+                }
+                goodsInfoAuxiliaryMapper.delGoodsFieldAuxiliaryinfoByFkId(batchInfo.getGuid());
+                goodsInfoAuxiliaryMapper.bathSaveAuxiliaryInfo(auxList);
+            }
+            if(goodsAssayInfoForm!=null){
+                goodsAssayInfoForm.setState(batchInfoForm.getState());
+                goodsAssayInfoForm.setModifiedUser(batchInfoForm.getModifiedUser());
+                goodsAssayInfoForm.setModifiedTime(batchInfoForm.getModifiedTime());
+                if(goodsAssayInfoForm.getGuid()!=null){
+                    goodsAssayInfoService.editBatchGoodsAssayInfo(goodsAssayInfoForm);
+                }else{
+                    goodsAssayInfoForm.setFkGoodsBatchId(batchInfo.getGuid());
+                    goodsAssayInfoForm.setFkOrgGuid(batchInfoForm.getFkOrgGuid());
+                    goodsAssayInfoForm.setCreateUser(batchInfoForm.getCreateUser());
+                    goodsAssayInfoForm.setCreateTime(batchInfoForm.getCreateTime());
+                    goodsAssayInfoService.saveBatchGoodsAssayInfo(goodsAssayInfoForm);
+                }
+            }
+            //添加物联监测信息
+            //saveOrUpdateInterAux(batchInfoForm);
+            
+            return i;
+        }
+        return 0;
+    }
+
+    /**
+     * 删除商品批次信息
+     * @param batchInfoForm
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int deleteGoodsBatchInfo(GoodsBatchInfoForm batchInfoForm) {
+        if(null!=batchInfoForm && !"".equals(batchInfoForm.getGuid())){
+            String batchId = batchInfoForm.getGuid();
+            GoodsBatchInfo batchInfo = new GoodsBatchInfo();
+            BeanCopyUtil.copyBean(batchInfoForm,batchInfo);
+            batchInfo.setState(0);
+            batchInfo.setModifiedTime(new Date());
+            //更新产品批次信息
+            int i = goodsBatchInfoMapper.updateByPrimaryKeySelective(batchInfo);
+            //删除商品批次辅助信息
+            goodsInfoAuxiliaryMapper.delGoodsFieldAuxiliaryinfoByFkId(batchId);
+            //删除检验信息
+            goodsAssayInfoService.delBatchGoodsAssayInfoByBatchId(batchId);
+            //删除溯源码生成记录信息
+            goodsQRCodeRecordService.delGoodsQRCodeRecordByBatchId(batchId);
+            //删除原料投入品信息
+            goodsProInputsService.delProInputs(batchId);
+            //删除流通生产过程信息
+            goodsProNormalService.delProNormalByFK(batchId);
+            //删除产品标签
+            goodsBatchLabelMapper.deleteByBatchGuid(batchId);
+            //删除物联监测信息
+            //goodsInterService.deleteByBatchGuid(batchId);
+            
+            return i;
+        }
+        return 0;
+    }
+
+    /**
+     * 查询商品批次明细信息
+     *
+     * @param goodsBatchId
+     * @return
+     */
+    @Override
+    public GoodsBatchInfoForm searchGoodsBatchInfoById(String goodsBatchId) {
+        GoodsBatchInfoForm batchInfoForm = new GoodsBatchInfoForm();
+        GoodsBatchInfo batchInfo = goodsBatchInfoMapper.selectByPrimaryKey(goodsBatchId);
+        if(null!=batchInfo){
+        	batchInfoForm.setFkGoodsBatchGuid(goodsBatchId);
+            String imgStr = batchInfo.getGoodsBatchImages();
+            List<String> list = ConvertStringToList.getListFormSplitString(imgStr,",");
+            List<GoodsInfoAuxiliary> auxList = goodsInfoAuxiliaryMapper.queryListByParentId(goodsBatchId);
+            BeanCopyUtil.copyBean(batchInfo,batchInfoForm);
+            batchInfoForm.setImagesList(list);
+            //获取辅助信息列表
+            if(null!=auxList && auxList.size()>0){
+                List<GoodsInfoAuxiliaryForm> auxFormList = BeanCopyUtil.convertList(auxList,GoodsInfoAuxiliaryForm.class);
+                batchInfoForm.setAuxList(auxFormList);
+            }
+            GoodsAssayInfoForm assayInfoForm = goodsAssayInfoService.searchByGoodsBatchId(goodsBatchId);
+            if(assayInfoForm!=null){
+                batchInfoForm.setAssayInfoForm(assayInfoForm);
+            }
+            //添加生产原料投入品
+            List<GoodsProInputsForm> proInputsList = goodsProInputsService.searchProInputsByBatchGuid(goodsBatchId);
+            if(null!=proInputsList && proInputsList.size()>0){
+                batchInfoForm.setInputsFormList(proInputsList);
+            }
+            //添加通用生产过程信息
+           List<GoodsProNormalForm> sourceList = goodsProNormalService.searchProNormalByFK(goodsBatchId,PROCESS_SOURCE_TYPE);
+           if(null!=sourceList && sourceList.size()>0){
+               batchInfoForm.setMaterialList(sourceList);
+           }
+           //添加通用加工流通过程信息
+           List<GoodsProNormalForm> productList = goodsProNormalService.searchProNormalByFK(goodsBatchId,PROCESS_PRODUCT_TYPE);
+           if(null!=productList && productList.size()>0){
+               batchInfoForm.setProductList(productList);
+           }
+           //添加产品标签
+           List<GoodsLabel> labelList = goodsLabelMapper.selectListBygoodsBatchGuid(goodsBatchId);
+           if(null!=labelList && labelList.size()>0){
+               batchInfoForm.setLabelList(labelList);
+               String labelNames = goodsLabelMapper.selectLabelNamesBygoodsBatchGuid(goodsBatchId);
+               batchInfoForm.setLabelNames(labelNames);
+           }
+           //添加物联监测信息
+           List<GoodsInterAuxiliary> interAuxList = goodsInterAuxiliaryService.selectGoodsInterAux(batchInfoForm.getFkFieldGuid());
+           batchInfoForm.setInterAuxList(interAuxList);
+           
+           return batchInfoForm;
+        }
+        return null;
+    }
+
+    /**
+     * 添加评价及评级信息
+     *
+     * @param batchInfoForm
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int saveAllFeedbackInfo(GoodsBatchInfoForm batchInfoForm) {
+        GoodsBatchFeedbackForm feedbackForm = batchInfoForm.getFeedbackForm();
+        GoodsBatchGradeForm gradeForm = batchInfoForm.getGradeForm();
+        if(gradeForm!=null && gradeForm.getGradeUser()!=null){
+            gradeForm.setState(1);
+            gradeForm.setCreateTime(new Date());
+            gradeForm.setModifiedTime(new Date());
+            feedbackForm.setGradeLevel(gradeForm.getGradeStart());
+            int j =goodsBatchGradeService.saveSelective(gradeForm);
+            if(j==0){throw new RuntimeException();}
+        }
+        if(feedbackForm!=null && feedbackForm.getFeedbackUser()!=null){
+            String batchId = feedbackForm.getFkGoodsBatchGuid();
+            String userId = feedbackForm.getFeedbackUser();
+            List<GoodsBatchGradeForm> gradeList = goodsBatchGradeService.getBatchGradeInfoByCond(batchId,userId);
+            if(null!=gradeList && gradeList.size()>0){
+                GoodsBatchGradeForm tmp = gradeList.get(0);
+                feedbackForm.setGradeLevel(tmp.getGradeStart());
+            }
+            feedbackForm.setState(1);
+            feedbackForm.setCreateTime(new Date());
+            feedbackForm.setModifiedTime(new Date());
+            int i = goodsBatchFeedbackService.saveSelective(feedbackForm);
+            if(i==0){throw new RuntimeException();}
+        }
+        return 1;
+    }
+    
+    /**
+     * 添加或删除产品标签
+     * @author lym
+     */
+    private void saveOrUpdateGoodsBatchLabel(GoodsBatchInfoForm batchInfoForm) {
+    	log.info("添加产品标签");
+    	String labelNames = batchInfoForm.getLabelNames();
+    	List<String> labelIds = new ArrayList<>();
+    	
+    	if(StringUtil.isNotNull(labelNames)) {
+    		//List<GoodsLabel> labelList = batchInfoForm.getLabelList();
+    		List<String> labelList = ConvertStringToList.getListFormSplitString(labelNames, ",");
+			for (String labelName: labelList) {
+				GoodsLabel goodLabel = new GoodsLabel();
+				goodLabel.setLabelName(labelName);
+				//标签是否存在
+				GoodsLabel label = goodsLabelMapper.selectGoodsLabelByLabelName(goodLabel.getLabelName());
+				if(label != null) {//存在
+					//是否已关联产品
+					GoodsBatchLabel goodsBatchLabel = new GoodsBatchLabel();
+					goodsBatchLabel.setFkGoodsBatchGuid(batchInfoForm.getGuid());
+					goodsBatchLabel.setFkGoodLabelGuid(label.getGuid());
+					goodsBatchLabel.setState(1);
+					
+					List<GoodsBatchLabel> list = goodsBatchLabelMapper.selectGoodsBatchLabelList(goodsBatchLabel);
+					if(list != null && list.size() > 0) { //存在
+						labelIds.add(list.get(0).getGuid());
+					}else {//添加产品标签
+						goodsBatchLabel.setGuid(GetUUID.getUUID());
+						goodsBatchLabel.setCreateUser(batchInfoForm.getCreateUser());
+						goodsBatchLabel.setCreateTime(new Date());
+						int i = goodsBatchLabelMapper.insertSelective(goodsBatchLabel);
+						if (i < 1) {
+							log.info("添加产品标签");
+							throw new GlobalException(ResultEnum.FAILURE.getCode(), ResultEnum.FAILURE.getMsg());
+						}
+						labelIds.add(goodsBatchLabel.getGuid());
+					}
+				}else {//不存在,添加标签
+					goodLabel.setGuid(GetUUID.getUUID());  
+					goodLabel.setCreateUser(batchInfoForm.getCreateUser());
+					goodLabel.setCreateTime(new Date());
+					goodLabel.setState(1);
+					goodsLabelMapper.insertSelective(goodLabel);
+					//添加产品标签
+					GoodsBatchLabel goodsBatchLabel = new GoodsBatchLabel();
+					goodsBatchLabel.setFkGoodsBatchGuid(batchInfoForm.getGuid());
+					goodsBatchLabel.setFkGoodLabelGuid(goodLabel.getGuid());
+					goodsBatchLabel.setState(1);
+					goodsBatchLabel.setGuid(GetUUID.getUUID());
+					goodsBatchLabel.setCreateUser(batchInfoForm.getCreateUser());
+					goodsBatchLabel.setCreateTime(new Date());
+					
+					int i= goodsBatchLabelMapper.insertSelective(goodsBatchLabel);
+					if (i < 1) {
+						log.info("添加产品标签");
+						throw new GlobalException(ResultEnum.FAILURE.getCode(), ResultEnum.FAILURE.getMsg());
+					}
+					labelIds.add(goodsBatchLabel.getGuid());
+				}
+			}
+			
+			//删除产品标签
+			goodsBatchLabelMapper.deleteGoodsBatchLabelByNotIds(batchInfoForm.getGuid(), labelIds);
+		}else {//无产品标签,删除产品标签
+			goodsBatchLabelMapper.deleteGoodsBatchLabelByNotIds(batchInfoForm.getGuid(), null);
+		}
+    }
+    
+    /**
+     * 添加后修改物联监测信息
+     * @author lym
+     */
+    /*private void saveOrUpdateInterInfo(GoodsBatchInfoForm batchInfoForm) {
+    	GoodsInterInfoForm goodsInterInfoForm = batchInfoForm.getInterInfoForm();
+        if(goodsInterInfoForm != null) {
+        	goodsInterInfoForm.setFkOrgGuid(batchInfoForm.getFkOrgGuid());
+    		goodsInterInfoForm.setFkGoodsGuid(batchInfoForm.getFkGoodsGuid());
+    		goodsInterInfoForm.setFkGoodsBatchGuid(batchInfoForm.getGuid());
+    		goodsInterInfoForm.setState(batchInfoForm.getState());
+    		
+        	if(goodsInterInfoForm.getGuid() != null) {
+        		goodsInterInfoForm.setModifiedUser(batchInfoForm.getModifiedUser());
+        		goodsInterInfoForm.setModifiedTime(new Date());
+        		goodsInterService.edit(goodsInterInfoForm);
+        	}else {
+        		goodsInterInfoForm.setCreateUser(batchInfoForm.getCreateUser());
+        		goodsInterInfoForm.setCreateTime(new Date());
+        		goodsInterService.add(goodsInterInfoForm);
+        	}
+        }
+    }*/
+    
+    /**
+     * 添加后修改物联监测辅助信息
+     * @author lym
+     */
+    /*private void saveOrUpdateInterAux(GoodsBatchInfoForm form) {
+    	//删除商品批次物联监测辅助信息
+		goodsInterAuxiliaryMapper.deleteByBatchGuid(form.getGuid());
+    	
+    	List<GoodsInterAuxiliary> auxList = form.getInterAuxList();
+        if(auxList != null && auxList.size() > 0) {
+        	for (GoodsInterAuxiliary bean : auxList) {
+				bean.setFkOrgGuid(form.getFkOrgGuid());
+                bean.setFkGoodsGuid(form.getFkGoodsGuid());  
+                bean.setFkGoodsBatchGuid(form.getFkGoodsBatchGuid());
+                bean.setState(form.getState());
+                bean.setCreateUser(form.getCreateUser());
+                bean.setCreateTime(form.getCreateTime());
+                bean.setModifiedUser(form.getModifiedUser());
+                bean.setModifiedTime(form.getModifiedTime());
+			}
+			//添加物联监测辅助信息
+			int i = goodsInterAuxiliaryMapper.batchSave(auxList);
+			if(i < 1) {
+				throw new GlobalException(ResultEnum.FAILURE.getCode(), "添加物联监测辅助信息失败");
+			}
+        }
+    }*/
+}

+ 125 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsDealerServiceImpl.java

@@ -0,0 +1,125 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import java.util.List;
+
+import javax.annotation.Resource;
+
+import org.springframework.stereotype.Service;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microserver.commoncore.util.CodeUtil;
+import com.hcloud.microserver.commoncore.util.GetUUID;
+import com.hcloud.microservice.goods.dao.GoodsDealerMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsDealer;
+import com.hcloud.microservice.goods.facade.forms.GoodsDealerForm;
+import com.hcloud.microservice.goods.service.GoodsDealerService;
+
+@Service
+public class GoodsDealerServiceImpl implements GoodsDealerService{
+	
+	private static final Integer POSITION_HEAD_LENGTH=6;
+
+    private static final Integer POSITION_LEVEL_STEP=3;
+	
+	@Resource
+	GoodsDealerMapper goodsDealerMapper;
+
+	@Override
+	public int delByPrimaryKey(String guid) {
+		// TODO Auto-generated method stub
+		return goodsDealerMapper.deleteByPrimaryKey(guid);
+	}
+
+	@Override
+	public int save(GoodsDealer record) {
+		// TODO Auto-generated method stub
+		return saveSelective(record);
+	}
+
+	@Override
+	public int saveSelective(GoodsDealer record) {
+		record.setGuid(GetUUID.getUUID());
+		if(goodsDealerMapper.existCode(record.getDealerCode()) > 0) {
+			record.setDealerCode(getMaxCode());
+		}
+		return goodsDealerMapper.insertSelective(record);
+	}
+
+	@Override
+	public GoodsDealer queryByPrimaryKey(String guid) {
+		// TODO Auto-generated method stub
+		GoodsDealer dealer = goodsDealerMapper.selectByPrimaryKey(guid);
+		//处理地址信息
+		dealPositionInfo(dealer);
+		return dealer;
+	}
+
+	@Override
+	public int modifyByPrimaryKeySelective(GoodsDealer record) {
+		// TODO Auto-generated method stub
+		return goodsDealerMapper.updateByPrimaryKeySelective(record);
+	}
+
+	@Override
+	public int modifyByPrimaryKeyWithBLOBs(GoodsDealer record) {
+		// TODO Auto-generated method stub
+		return goodsDealerMapper.updateByPrimaryKeyWithBLOBs(record);
+	}
+
+	@Override
+	public int modifyByPrimaryKey(GoodsDealer record) {
+		// TODO Auto-generated method stub
+		return goodsDealerMapper.updateByPrimaryKey(record);
+	}
+
+	@Override
+	public PageInfo searchByPage(GoodsDealerForm goodsDealerForm) {
+		PageBean pageBean = new PageBean(goodsDealerForm);
+		PageHelper.startPage(goodsDealerForm.getPageNo(), goodsDealerForm.getPageSize());
+		List<GoodsDealer> list = goodsDealerMapper.searchByPage(pageBean);
+		return new PageInfo<>(list);
+	}
+
+	@Override
+	public String getMaxCode() {
+		String maxCode = goodsDealerMapper.getMaxCode();
+		String newCode = "JXS00001";
+		if(maxCode != null) {
+			newCode = CodeUtil.getNextCode(maxCode, "JXS", 5);
+		}
+				
+		return newCode;
+	}
+
+	@Override
+	public List<GoodsDealer> selectList(String orgGuid) {
+		// TODO Auto-generated method stub
+		return goodsDealerMapper.selectList(orgGuid);
+	}
+	
+	private void dealPositionInfo(GoodsDealer dealer){
+		String positionId = dealer.getFkPostionId();
+        if(null!= positionId && !"".equals(positionId)){
+            int nextLen =0;
+            int totalLen = positionId.length();
+            String provinceId = positionId.substring(0,POSITION_HEAD_LENGTH);
+            dealer.setProvinceId(provinceId);
+            int currentLen = totalLen-POSITION_HEAD_LENGTH;
+            if(currentLen>=POSITION_LEVEL_STEP){
+                nextLen = POSITION_HEAD_LENGTH+POSITION_LEVEL_STEP;
+                String cityId = positionId.substring(0,nextLen);
+                dealer.setCityId(cityId);
+                currentLen = totalLen-cityId.length();
+                if(currentLen>=POSITION_LEVEL_STEP){
+                    nextLen = cityId.length()+POSITION_LEVEL_STEP;
+                    String countyId = positionId.substring(0,nextLen);
+                    dealer.setCountyId(countyId);
+                }
+            }
+        }
+
+    }
+
+}

+ 221 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsFieldServiceImpl.java

@@ -0,0 +1,221 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microserver.commoncore.enums.ResultEnum;
+import com.hcloud.microserver.commoncore.exception.GlobalException;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microserver.commoncore.util.GetUUID;
+import com.hcloud.microserver.commoncore.util.string.ConvertStringToList;
+import com.hcloud.microservice.goods.dao.GoodsFieldMapper;
+import com.hcloud.microservice.goods.dao.GoodsInfoAuxiliaryMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsField;
+import com.hcloud.microservice.goods.facade.entity.GoodsInfoAuxiliary;
+import com.hcloud.microservice.goods.facade.forms.GoodsFieldForm;
+import com.hcloud.microservice.goods.facade.forms.GoodsInfoAuxiliaryForm;
+import com.hcloud.microservice.goods.service.GoodsFieldService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author xiezt
+ */
+@Service("goodsFieldService")
+public class GoodsFieldServiceImpl implements GoodsFieldService {
+
+    private static final Integer POSITION_HEAD_LENGTH=6;
+
+    private static final Integer POSITION_LEVEL_STEP=3;
+
+    @Resource
+    private GoodsFieldMapper goodsFieldMapper;
+
+    @Resource
+    private GoodsInfoAuxiliaryMapper goodsInfoAuxiliaryMapper;
+
+
+    @Override
+    public int delByPrimaryKey(String guid) {
+        int i = goodsFieldMapper.deleteByPrimaryKey(guid);
+        if(i > 0) {
+        	goodsInfoAuxiliaryMapper.delGoodsFieldAuxiliaryinfoByFkId(guid);
+        }
+        return i;
+    }
+
+    @Override
+    public int save(GoodsField record) {
+        record.setGuid(GetUUID.getUUID());
+        return goodsFieldMapper.insert(record);
+    }
+
+    @Override
+    public int saveSelective(GoodsField record) {
+        return goodsFieldMapper.insertSelective(record);
+    }
+
+    @Override
+    public GoodsField queryByPrimaryKey(String guid) {
+        return goodsFieldMapper.selectByPrimaryKey(guid);
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(GoodsField record) {
+        return goodsFieldMapper.updateByPrimaryKeySelective(record);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(GoodsField record) {
+        //TODO empty implements
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(GoodsField record) {
+        return goodsFieldMapper.updateByPrimaryKey(record);
+    }
+
+    /**
+     * 分页查询产地信息
+     *
+     * @param goodsFieldForm
+     * @return
+     */
+    @Override
+    public PageInfo searchGoodsFieldByPage(GoodsFieldForm goodsFieldForm) {
+        PageBean pageBean = new PageBean(goodsFieldForm);
+        PageHelper.startPage(goodsFieldForm.getPageNo(),goodsFieldForm.getPageSize());
+        Page page =goodsFieldMapper.searchByPage(pageBean);
+        List<GoodsFieldForm> list = BeanCopyUtil.convertList(page,GoodsFieldForm.class);
+        return new PageInfo(list);
+    }
+
+    /**
+     * 添加商品产地
+     *
+     * @param goodsFieldForm
+     * @return
+     */
+    @Override
+    public int addGoodsFieldInfo(GoodsFieldForm goodsFieldForm) {
+        //TODO 添加产地信息
+        GoodsField record = new GoodsField();
+        BeanCopyUtil.copyBean(goodsFieldForm,record);
+        // 验证唯一
+        int i = goodsFieldMapper.isExist(record);
+    	if(i > 0) {
+    		throw new GlobalException(ResultEnum.FAILED.getCode(), "产地已存在!");
+    	}
+        i = this.saveSelective(record);
+        //TODO 添加产品辅助信息
+        List<GoodsInfoAuxiliaryForm> auxList =goodsFieldForm.getAuxList();
+        if(null!=auxList && auxList.size()>0){
+            for (GoodsInfoAuxiliaryForm bean: auxList) {
+            	bean.setFkGoodsGuid(record.getGuid());
+                bean.setFkAuxItmeId(goodsFieldForm.getGuid());
+                bean.setFkOrgGuid(goodsFieldForm.getFkOrgGuid());
+                bean.setState(goodsFieldForm.getState());
+                bean.setCreateUser(goodsFieldForm.getCreateUser());
+                bean.setCreateTime(goodsFieldForm.getCreateTime());
+                bean.setModifiedUser(goodsFieldForm.getModifiedUser());
+                bean.setModifiedTime(goodsFieldForm.getModifiedTime());
+            }
+            goodsInfoAuxiliaryMapper.bathSaveAuxiliaryInfo(auxList);
+        }
+
+        return i;
+    }
+
+    /**
+     * 修改商品产地信息
+     *
+     * @param goodsFieldForm
+     * @return
+     */
+    @Override
+    public int updateGoodsFieldInfo(GoodsFieldForm goodsFieldForm) {
+        //TODO 添加产地信息
+        GoodsField record = new GoodsField();
+        BeanCopyUtil.copyBean(goodsFieldForm,record);
+        int i = goodsFieldMapper.updateByPrimaryKeySelective(record);
+        //TODO 删除辅助信息
+        List<GoodsInfoAuxiliaryForm> auxList =goodsFieldForm.getAuxList();
+        // 如果前端没有传auxList
+        if (auxList == null || auxList.size() == 0) {
+            goodsInfoAuxiliaryMapper.delGoodsFieldAuxiliaryinfoByFkId(goodsFieldForm.getGuid());
+        }
+        if(null!=auxList && auxList.size()>0){
+            goodsInfoAuxiliaryMapper.delGoodsFieldAuxiliaryinfoByFkId(goodsFieldForm.getGuid());
+            for (GoodsInfoAuxiliaryForm bean: auxList) {
+            	bean.setFkGoodsGuid(record.getGuid());
+                bean.setFkAuxItmeId(goodsFieldForm.getGuid());
+                bean.setFkOrgGuid(goodsFieldForm.getFkOrgGuid());
+                bean.setState(1);
+                bean.setCreateUser(goodsFieldForm.getModifiedUser());
+                bean.setCreateTime(goodsFieldForm.getModifiedTime());
+                bean.setModifiedUser(goodsFieldForm.getModifiedUser());
+                bean.setModifiedTime(goodsFieldForm.getModifiedTime());
+            }
+            goodsInfoAuxiliaryMapper.bathSaveAuxiliaryInfo(auxList);
+        }
+        return i;
+    }
+
+    /**
+     * 查询产地明细
+     * @param goodsId
+     * @param orgGuid
+     * @return
+     */
+    @Override
+    public GoodsFieldForm getGoodsFieldInfoById(String goodsId, String orgGuid) {
+        GoodsFieldForm goodsFieldForm =  new GoodsFieldForm();
+        if(null!=goodsId && !"".equals(goodsId)){
+            GoodsField record = goodsFieldMapper.getGoodsFieldInfoById(goodsId,orgGuid);
+            if(record!=null){
+                //TODO 处理图片信息
+                String imgStr = record.getFieldImages();
+                List<String> list = ConvertStringToList.getListFormSplitString(imgStr,",");
+                BeanCopyUtil.copyBean(record,goodsFieldForm);
+                //TODO 补充产地信息
+                List<GoodsInfoAuxiliary> auxList =  goodsInfoAuxiliaryMapper.queryListByParentId(record.getGuid());
+                goodsFieldForm.setImagesList(list);
+                if(null!= auxList && auxList.size()>0){
+                   List<GoodsInfoAuxiliaryForm> auxFormList =  BeanCopyUtil.convertList(auxList,GoodsInfoAuxiliaryForm.class);
+                   goodsFieldForm.setAuxList(auxFormList);
+                }
+                //TODO 处理地址信息
+                dealPositionInfo(goodsFieldForm);
+                return goodsFieldForm;
+            }
+        }
+       return null;
+    }
+
+    private void dealPositionInfo(GoodsFieldForm goodsFieldForm){
+        String positionId = goodsFieldForm.getFkPostionId();
+        if(null!= positionId && !"".equals(positionId)){
+            int nextLen =0;
+            int totalLen = positionId.length();
+            String provinceId = positionId.substring(0,POSITION_HEAD_LENGTH);
+            goodsFieldForm.setProvinceId(provinceId);
+            int currentLen = totalLen-POSITION_HEAD_LENGTH;
+            if(currentLen>=POSITION_LEVEL_STEP){
+                nextLen = POSITION_HEAD_LENGTH+POSITION_LEVEL_STEP;
+                String cityId = positionId.substring(0,nextLen);
+                goodsFieldForm.setCityId(cityId);
+                currentLen = totalLen-cityId.length();
+                if(currentLen>=POSITION_LEVEL_STEP){
+                    nextLen = cityId.length()+POSITION_LEVEL_STEP;
+                    String countyId = positionId.substring(0,nextLen);
+                    goodsFieldForm.setCountyId(countyId);
+                }
+            }
+        }
+
+    }
+}

+ 94 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsInfoServiceImpl.java

@@ -0,0 +1,94 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microserver.commoncore.util.GetUUID;
+import com.hcloud.microservice.goods.dao.GoodsInfoMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsInfo;
+import com.hcloud.microservice.goods.facade.forms.GoodsInfoForm;
+import com.hcloud.microservice.goods.service.GoodsInfoService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author xiezt
+ */
+@Slf4j
+@Service("goodsInfoService")
+public class GoodsInfoServiceImpl implements GoodsInfoService {
+
+    @Resource
+    private GoodsInfoMapper goodsInfoMapper;
+
+
+    @Override
+    public int delByPrimaryKey(String guid) {
+        return goodsInfoMapper.deleteByPrimaryKey(guid);
+    }
+
+    @Override
+    public int save(GoodsInfo record) {
+        record.setGuid(GetUUID.getUUID());
+        return goodsInfoMapper.insert(record);
+    }
+
+    @Override
+    public int saveSelective(GoodsInfo record) {
+        record.setGuid(GetUUID.getUUID());
+        return goodsInfoMapper.insertSelective(record);
+    }
+
+    @Override
+    public GoodsInfo queryByPrimaryKey(String guid) {
+        return goodsInfoMapper.selectByPrimaryKey(guid);
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(GoodsInfo record) {
+        return goodsInfoMapper.updateByPrimaryKeySelective(record);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(GoodsInfo record) {
+        // TODO empty implements
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(GoodsInfo record) {
+        return goodsInfoMapper.updateByPrimaryKey(record);
+    }
+
+    /**
+     * 分页查询商品信息
+     *
+     * @param goodsInfoForm
+     * @return
+     */
+    @Override
+    public PageInfo searchGoodsInfoByPage(GoodsInfoForm goodsInfoForm) {
+        PageBean pageBean = new PageBean(goodsInfoForm);
+        PageHelper.startPage(goodsInfoForm.getPageNo(),goodsInfoForm.getPageSize());
+        List list =  goodsInfoMapper.searchByPage(pageBean);
+        return new PageInfo(list);
+    }
+
+    /**
+     * 查询商品明细
+     *
+     * @param guid
+     * @return
+     */
+    @Override
+    public GoodsInfoForm searchGoodsInfoById(String guid) {
+        GoodsInfoForm goodsInfoForm = new GoodsInfoForm();
+        GoodsInfo goodsInfo = goodsInfoMapper.selectByPrimaryKey(guid);
+        BeanCopyUtil.copyBean(goodsInfo,goodsInfoForm);
+        return goodsInfoForm;
+    }
+}

+ 69 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsInterAuxiliaryServiceImpl.java

@@ -0,0 +1,69 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.hcloud.microserver.commoncore.util.EasyHttpUtils;
+import com.hcloud.microservice.goods.facade.entity.GoodsInterAuxiliary;
+import com.hcloud.microservice.goods.service.GoodsInterAuxiliaryService;
+
+@Service
+public class GoodsInterAuxiliaryServiceImpl implements GoodsInterAuxiliaryService{
+	
+	@Value("${wlw.address}")
+    private String wlwhost;
+	
+	@Override
+	public List<GoodsInterAuxiliary> selectGoodsInterAux(String fieldGuid) {
+		List<GoodsInterAuxiliary> interAuxList = new ArrayList<>();
+		
+		EasyHttpUtils easyHttpUtils = EasyHttpUtils.LoadInstance();
+    	String url = wlwhost + "/devid/orchardSeCon?base_id=" + fieldGuid;
+    	String s = null;
+    	try {
+    		s = easyHttpUtils.get(url);
+		} catch (Exception e) {
+			// TODO: handle exception
+			System.out.println(e.getMessage());
+		}
+    	
+    	if(s == null) {
+    		return interAuxList;
+    	}
+        JSONObject jsonObject = JSON.parseObject(s);
+        String key = "retHead";
+        JSONObject retDataJson = jsonObject.getJSONObject(key);
+        key = "errCod";
+        String string = retDataJson.getString(key);
+        List<Object> list = null;
+        
+        if ("0".equals(string)) {
+            key = "retBody";
+            retDataJson = jsonObject.getJSONObject(key);
+            if (!StringUtils.isEmpty(retDataJson)) {
+                key = "list";
+                list = retDataJson.getJSONArray(key);
+                
+                if(list != null && list.size() > 0) {
+                	for (Object object : list) {
+                		JSONObject date = (JSONObject) object;
+                		GoodsInterAuxiliary form = new GoodsInterAuxiliary();
+						form.setAuxItme(date.getString("orchard_type"));
+						form.setAuxItmeNormval(date.getString("dat_value") != null ? date.getString("dat_value") : "0");
+						//form.setAuxItmeNormval(date.getString("dat_value") != null ? date.getString("dat_value") + date.getString("unit") : "0" + date.getString("unit"));
+						form.setUnit(date.getString("unit"));
+						interAuxList.add(form);
+					}
+                }
+            }
+        }
+        return interAuxList;
+	}
+
+}

+ 136 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsProInputsServiceImpl.java

@@ -0,0 +1,136 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microserver.commoncore.util.UUIDUtils;
+import com.hcloud.microservice.goods.dao.GoodsProInputsMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsProInputs;
+import com.hcloud.microservice.goods.facade.forms.GoodsProInputsForm;
+import com.hcloud.microservice.goods.service.GoodsProInputsService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+@Service("goodsProInputsService")
+public class GoodsProInputsServiceImpl implements GoodsProInputsService {
+
+
+    @Resource
+    private GoodsProInputsMapper goodsProInputsMapper;
+
+    /**
+     * 分页查询投入品信息
+     *
+     * @param inputsForm
+     * @return
+     */
+    @Override
+    public PageInfo searchProInputsByPage(GoodsProInputsForm inputsForm) {
+        PageHelper.startPage(inputsForm.getPageNo(),inputsForm.getPageSize());
+        List<GoodsProInputs> resultList = goodsProInputsMapper.searchProInputsByPage(new PageBean<>(inputsForm));
+        List<GoodsProInputsForm> list = BeanCopyUtil.convertList(resultList,GoodsProInputsForm.class);
+        return new PageInfo(list);
+    }
+
+    /**
+     * 查询投入品信息通过商品批次GUID
+     *
+     * @param batchGuid
+     * @return
+     */
+    @Override
+    public List<GoodsProInputsForm> searchProInputsByBatchGuid(String batchGuid) {
+        List<GoodsProInputs> resultList = goodsProInputsMapper.searchProInputsByBatchGuid(batchGuid);
+        List<GoodsProInputsForm> list = BeanCopyUtil.convertList(resultList,GoodsProInputsForm.class);
+        return list;
+    }
+
+    /**
+     * 批量保存生产原料信息
+     *
+     * @param list
+     * @return
+     */
+    @Override
+    public int batchSaveProInputs(List<GoodsProInputsForm> list) {
+        if(null!=list && list.size()>0){
+            List<GoodsProInputs> resultList = BeanCopyUtil.convertList(list,GoodsProInputs.class);
+            for (GoodsProInputs bean:resultList) {
+                String processName = bean.getInputsProcessName();
+                String inputDoUser = bean.getInputDoUser();
+                String inputProviderUser = bean.getInputProviderUser();
+                bean.setInputsProcessName(processName==null ? "":processName);
+                bean.setInputDoUser(inputDoUser==null ? "":inputDoUser);
+                bean.setInputProviderUser(inputProviderUser==null ? "":inputProviderUser);
+            }
+           return goodsProInputsMapper.batchSaveProInputs(resultList);
+        }
+        return 0;
+    }
+
+    /**
+     * 删除原料投入品信息
+     *
+     * @param batchGuid
+     * @return
+     */
+    @Override
+    public int delProInputs(String batchGuid) {
+        return goodsProInputsMapper.delProInputsByFK(batchGuid);
+    }
+
+    @Override
+    public int delByPrimaryKey(String guid) {
+        return goodsProInputsMapper.deleteByPrimaryKey(guid);
+    }
+
+    @Override
+    public int save(GoodsProInputsForm record) {
+        GoodsProInputs goodsProInputs = new GoodsProInputs();
+        BeanCopyUtil.copyBean(record,goodsProInputs);
+        goodsProInputs.setGuid(UUIDUtils.randomUUID());
+        return goodsProInputsMapper.insert(goodsProInputs);
+    }
+
+    @Override
+    public int saveSelective(GoodsProInputsForm record) {
+        GoodsProInputs goodsProInputs = new GoodsProInputs();
+        BeanCopyUtil.copyBean(record,goodsProInputs);
+        goodsProInputs.setGuid(UUIDUtils.randomUUID());
+        return goodsProInputsMapper.insertSelective(goodsProInputs);
+    }
+
+    @Override
+    public GoodsProInputsForm queryByPrimaryKey(String guid) {
+        GoodsProInputsForm inputsForm = new GoodsProInputsForm();
+        GoodsProInputs proInputs = goodsProInputsMapper.selectByPrimaryKey(guid);
+        BeanCopyUtil.copyBean(proInputs,inputsForm);
+        return inputsForm;
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(GoodsProInputsForm record) {
+        GoodsProInputs goodsProInputs = new GoodsProInputs();
+        BeanCopyUtil.copyBean(record,goodsProInputs);
+        return goodsProInputsMapper.updateByPrimaryKeySelective(goodsProInputs);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(GoodsProInputsForm record) {
+        //TODO empty implements
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(GoodsProInputsForm record) {
+        GoodsProInputs goodsProInputs = new GoodsProInputs();
+        BeanCopyUtil.copyBean(record,goodsProInputs);
+        return goodsProInputsMapper.updateByPrimaryKey(goodsProInputs);
+    }
+}

+ 135 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsProNormalServiceImpl.java

@@ -0,0 +1,135 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microserver.commoncore.util.UUIDUtils;
+import com.hcloud.microservice.goods.dao.GoodsProNormalMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsProNormal;
+import com.hcloud.microservice.goods.facade.forms.GoodsProNormalForm;
+import com.hcloud.microservice.goods.service.GoodsProNormalService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+@Service("goodProNormalService")
+public class GoodsProNormalServiceImpl implements GoodsProNormalService {
+
+
+    @Resource
+    private GoodsProNormalMapper goodsProNormalMapper;
+
+    @Override
+    public int delByPrimaryKey(String guid) {
+        return goodsProNormalMapper.deleteByPrimaryKey(guid);
+    }
+
+    @Override
+    public int save(GoodsProNormalForm record) {
+        GoodsProNormal goodsProNormal = new GoodsProNormal();
+        BeanCopyUtil.copyBean(record,goodsProNormal);
+        goodsProNormal.setGuid(UUIDUtils.randomUUID());
+        return goodsProNormalMapper.insert(goodsProNormal);
+    }
+
+    @Override
+    public int saveSelective(GoodsProNormalForm record) {
+        GoodsProNormal goodsProNormal = new GoodsProNormal();
+        BeanCopyUtil.copyBean(record,goodsProNormal);
+        goodsProNormal.setGuid(UUIDUtils.randomUUID());
+        return goodsProNormalMapper.insertSelective(goodsProNormal);
+    }
+
+    @Override
+    public GoodsProNormalForm queryByPrimaryKey(String guid) {
+        GoodsProNormalForm record = new GoodsProNormalForm();
+        GoodsProNormal goodsProNormal = goodsProNormalMapper.selectByPrimaryKey(guid);
+        BeanCopyUtil.copyBean(goodsProNormal,record);
+        return record;
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(GoodsProNormalForm record) {
+        GoodsProNormal goodsProNormal = new GoodsProNormal();
+        BeanCopyUtil.copyBean(record,goodsProNormal);
+        return goodsProNormalMapper.updateByPrimaryKeySelective(goodsProNormal);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(GoodsProNormalForm record) {
+        //TODO empty implements
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(GoodsProNormalForm record) {
+        GoodsProNormal goodsProNormal = new GoodsProNormal();
+        BeanCopyUtil.copyBean(record,goodsProNormal);
+        return goodsProNormalMapper.updateByPrimaryKey(goodsProNormal);
+    }
+
+    /**
+     * 分页查询通用流通信息
+     *
+     * @param goodsProNormalForm
+     * @return
+     */
+    @Override
+    public PageInfo searchProNormalByPage(GoodsProNormalForm goodsProNormalForm) {
+        PageHelper.startPage(goodsProNormalForm.getPageNo(),goodsProNormalForm.getPageSize());
+        List<GoodsProNormal> resultList = goodsProNormalMapper.searchProNormalByPage(new PageBean<>(goodsProNormalForm));
+        return new PageInfo(resultList);
+    }
+
+    /**
+     * 批量保存生产过程信息
+     *
+     * @param list
+     * @return
+     */
+    @Override
+    public int batchSaveProNormal(List<GoodsProNormalForm> list) {
+        if(null!=list && list.size()>0){
+            List<GoodsProNormal> resultList = BeanCopyUtil.convertList(list,GoodsProNormal.class);
+            for (GoodsProNormal bean:resultList) {
+                String processAddress = bean.getProcessAddress();
+                String processImgs = bean.getProcessImgs();
+                bean.setProcessAddress(processAddress==null ? "":processAddress);
+                bean.setProcessImgs(processImgs==null ? "":processImgs);
+            }
+           return goodsProNormalMapper.batchSaveProNormal(resultList);
+        }
+        return 0;
+    }
+
+    /**
+     * 通过商品批次号查询生产过程信息
+     *
+     * @param batchId
+     * @return
+     */
+    @Override
+    public List<GoodsProNormalForm> searchProNormalByFK(String batchId,Integer processType) {
+       List<GoodsProNormal> resultList =  goodsProNormalMapper.searchProNormalByFK(batchId,processType);
+       if(null!=resultList && resultList.size()>0){
+            return BeanCopyUtil.convertList(resultList,GoodsProNormalForm.class);
+       }
+       return null;
+    }
+
+    /**
+     * 删除加工生产过程信息
+     *
+     * @param batchId
+     * @return
+     */
+    @Override
+    public int delProNormalByFK(String batchId) {
+        return goodsProNormalMapper.delProNormalByFK(batchId);
+    }
+}

+ 377 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsQRCodeInfoServiceImpl.java

@@ -0,0 +1,377 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.google.common.collect.Lists;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microserver.commoncore.service.RedisUtils;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microserver.commoncore.util.Md5Util;
+import com.hcloud.microserver.commoncore.util.TracedCodeUtils;
+import com.hcloud.microservice.goods.bo.GoodsQRCodeInfoBO;
+import com.hcloud.microservice.goods.dao.GoodsQRCodeInfoMapper;
+import com.hcloud.microservice.goods.dao.GoodsQRCodeRecordMapper;
+import com.hcloud.microservice.goods.enums.TracedCodeImgInfoEnum;
+import com.hcloud.microservice.goods.event.TracedQRCodeImgEvent;
+import com.hcloud.microservice.goods.facade.entity.GoodsDealer;
+import com.hcloud.microservice.goods.facade.entity.GoodsProInputs;
+import com.hcloud.microservice.goods.facade.entity.GoodsQRCodeInfo;
+import com.hcloud.microservice.goods.facade.entity.GoodsQRCodeRecord;
+import com.hcloud.microservice.goods.facade.forms.*;
+import com.hcloud.microservice.goods.service.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author apple
+ */
+@Slf4j
+@Transactional(rollbackFor = Exception.class)
+@Service("goodsQRCodeInfoService")
+public class GoodsQRCodeInfoServiceImpl implements GoodsQRCodeInfoService {
+
+    /**
+     * 二维码流水号长度
+     */
+    private static final Integer SN_LENGTH=5;
+
+    private static final Integer PROCESS_SOURCE_TYPE=1;
+
+    private static final Integer PROCESS_PRODUCT_TYPE=2;
+
+    @Autowired
+    private ApplicationContext applicationContext;
+
+    @Resource
+    private GoodsQRCodeInfoMapper goodsQRCodeInfoMapper;
+
+    @Resource
+    private GoodsQRCodeRecordMapper goodsQRCodeRecordMapper;
+
+    @Autowired
+    private GoodsBatchInfoService goodsBatchInfoService;
+
+    @Autowired
+    private GoodsFieldService goodsFieldService;
+
+    @Autowired
+    private GoodsAssayInfoService goodsAssayInfoService;
+
+    @Autowired
+    private GoodsProInputsService goodsProInputsService;
+
+    @Autowired
+    private GoodsProNormalService goodsProNormalService;
+
+    @Autowired
+    private RedisUtils redisUtils;
+    
+    //@Autowired
+    //private GoodsDealerService goodsDealerService;
+
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int updateGoodsQRInfoByScan(String qrToken) {
+        if(null!=qrToken && !"".equals(qrToken)){
+            //查询溯源码明细信息
+            GoodsQRCodeInfoBO codeInfo = goodsQRCodeInfoMapper.getGoodsQRInfoByQrToken(qrToken);
+            if(codeInfo!=null){
+                //查询溯源码生成记录
+                GoodsQRCodeRecord goodsQRCodeRecord =goodsQRCodeRecordMapper.selectByPrimaryKey(codeInfo.getFkBatchRecordGuid());
+                if(goodsQRCodeRecord==null){throw new RuntimeException();}
+                //判断是否是首次扫码
+                if(codeInfo.getScanFirstTimed()==null){
+                    int usedCount =goodsQRCodeRecord.getUsedNum();
+                    usedCount++;
+                    codeInfo.setScanFirstTimed(new Date());
+                    goodsQRCodeRecord.setUsedNum(usedCount);
+                }
+                //累加扫码次数,更新最后扫码时间
+                Integer totalScount =goodsQRCodeRecord.getScanNum();
+                Integer scount = codeInfo.getScanCount();
+                totalScount++;
+                scount++;
+                goodsQRCodeRecord.setScanNum(totalScount);
+                codeInfo.setScanCount(scount);
+                codeInfo.setScanLastTimed(new Date());
+                //更新溯源码信息
+                GoodsQRCodeInfo updateInfo = new GoodsQRCodeInfo();
+                BeanCopyUtil.copyBean(codeInfo,updateInfo);
+                int i = goodsQRCodeInfoMapper.updateByPrimaryKeySelective(updateInfo);
+                if(i==0){
+                    throw new RuntimeException();
+                }
+                //更新溯源码生成记录
+                return goodsQRCodeRecordMapper.updateByPrimaryKeySelective(goodsQRCodeRecord);
+            }
+        }
+        return 0;
+    }
+
+    @Override
+    public GoodsQRCodeInfoForm getGoodsQRInfo(String qrToken) {
+        GoodsQRCodeInfoForm cacheObj = (GoodsQRCodeInfoForm) redisUtils.getValue(qrToken);
+        GoodsQRCodeInfoBO codeInfo =  goodsQRCodeInfoMapper.getGoodsQRInfoByQrToken(qrToken);
+        if(cacheObj!=null){
+        	BeanCopyUtil.copyNotNullProperties(codeInfo, cacheObj);
+        	return cacheObj;
+        }
+        GoodsQRCodeInfoForm resultForm = new GoodsQRCodeInfoForm();
+        if(null!=codeInfo){
+            BeanCopyUtil.copyBean(codeInfo,resultForm);
+            String recordId = resultForm.getFkBatchRecordGuid();
+            GoodsQRCodeRecord goodsQRCodeRecord = goodsQRCodeRecordMapper.selectByPrimaryKey(recordId);
+            String goodsBatchId =  goodsQRCodeRecord.getFkGoodsBatchGuid();
+            GoodsBatchInfoForm goodsBatchInfoForm = goodsBatchInfoService.searchGoodsBatchInfoById(goodsBatchId);
+            String fieldId = goodsBatchInfoForm.getFkFieldGuid();
+            String batchId = goodsBatchInfoForm.getGuid();
+            GoodsFieldForm goodsFieldForm = goodsFieldService.getGoodsFieldInfoById(fieldId,codeInfo.getFkOrgGuid());
+            GoodsAssayInfoForm assayInfoForm = goodsAssayInfoService.searchByGoodsBatchId(batchId);
+            List<GoodsProInputsForm> inputsList = goodsProInputsService.searchProInputsByBatchGuid(batchId);
+            List<GoodsProNormalForm> sourceList = goodsProNormalService.searchProNormalByFK(batchId,PROCESS_SOURCE_TYPE);
+            List<GoodsProNormalForm> productList = goodsProNormalService.searchProNormalByFK(batchId,PROCESS_PRODUCT_TYPE);
+            //List<GoodsDealer> dealerList = goodsDealerService.selectList(codeInfo.getFkOrgGuid());
+            resultForm.setGoodsBatchInfoForm(goodsBatchInfoForm);
+            resultForm.setGoodsFieldForm(goodsFieldForm);
+            resultForm.setAssayInfoForm(assayInfoForm);
+            resultForm.setInputsList(inputsList);
+            resultForm.setSourceList(sourceList);
+            resultForm.setProductList(productList);
+            //resultForm.setDealerList(dealerList);
+            redisUtils.setValue(qrToken,resultForm,600,TimeUnit.SECONDS);
+        }
+        return resultForm;
+    }
+
+    /**
+     * 批量保存溯源码信息
+     *
+     * @param codeInfoForm
+     * @return
+     */
+    @Override
+    public int batchSaveGoodsQRCodeInfo(GoodsQRCodeInfoForm codeInfoForm) {
+        if(codeInfoForm!=null && codeInfoForm.getCodeCount()>0){
+            List<GoodsQRCodeInfo> insertList = Lists.newArrayList();
+            List<Map> qrcodeImgList = Lists.newArrayList();
+            //查询商品批次信息
+            GoodsBatchInfoForm batchInfoForm = goodsBatchInfoService.searchGoodsBatchInfoById(codeInfoForm.getGoodsBatchInfoId());
+            if(null!=batchInfoForm){
+                //查询生成二维码记录信息
+                List<String> containerList = Lists.newArrayList();
+                Integer codeCount = codeInfoForm.getCodeCount();
+                String goodsId = batchInfoForm.getFkGoodsGuid();
+                for(int i=0;i<codeCount;i++){
+                    Map map = new ConcurrentHashMap(4);
+                    GoodsQRCodeInfo info = new GoodsQRCodeInfo();
+                    info.setFkBatchRecordGuid(codeInfoForm.getFkBatchRecordGuid());
+                    info.setFkOrgGuid(codeInfoForm.getFkOrgGuid());
+                    info.setFkGoodsGuid(goodsId);
+                    info.setScanCount(0);
+                    info.setCreateTime(new Date());
+                    info.setCreateUser(codeInfoForm.getCreateUser());
+                    info.setModifiedTime(new Date());
+                    info.setModifiedUser(codeInfoForm.getModifiedUser());
+                    info.setState(1);
+                    //二维码信息
+                    getQrcode(codeInfoForm,info,String.valueOf(i+1),containerList);
+                    if(insertList.size()>2000){
+                        goodsQRCodeInfoMapper.batchSaveQRCodeInfo(insertList);
+                        insertList.clear();
+                    }
+                    insertList.add(info);
+                    //组装二维码生成图片信息
+                    map.put(TracedCodeImgInfoEnum.IMG_SUB_DIR_NAME,codeInfoForm.getQrcodeParentCode());
+                    map.put(TracedCodeImgInfoEnum.CODE_CONTENT,info.getQrcodeUrl());
+                    map.put(TracedCodeImgInfoEnum.ORG_LOGO_NAME,codeInfoForm.getIco()==null?"logo.png":codeInfoForm.getIco());
+                    map.put(TracedCodeImgInfoEnum.IMG_NAME,info.getQrcodeImg());
+                    qrcodeImgList.add(map);
+                }
+                //生成二维码记录
+                goodsQRCodeInfoMapper.batchSaveQRCodeInfo(insertList);
+                //异步生成二维码图片
+                applicationContext.publishEvent(new TracedQRCodeImgEvent(new Object(),qrcodeImgList));
+                return 1;
+            }
+        }
+        return 0;
+    }
+
+    /**
+     * 通过溯源码生成记录Id查询溯源码信息
+     *
+     * @param goodsQRCodeInfoForm
+     * @return
+     */
+    @Override
+    public PageInfo queryGoodsQRCodeInfoByRecId(GoodsQRCodeInfoForm goodsQRCodeInfoForm) {
+        PageHelper.startPage(goodsQRCodeInfoForm.getPageNum(),goodsQRCodeInfoForm.getPageSize());
+        List<GoodsQRCodeInfoBO> list = goodsQRCodeInfoMapper.queryGoodsQRCodeInfoByRecId(goodsQRCodeInfoForm.getFkBatchRecordGuid());
+        return new PageInfo(list);
+    }
+
+    /**
+     * 删除溯源明细信息(逻辑删除)
+     *
+     * @param goodsQRCodeInfoForm
+     * @return
+     */
+    @Override
+    public int delGoodsQRCodeInfoByRecordId(GoodsQRCodeInfoForm goodsQRCodeInfoForm) {
+        GoodsQRCodeInfo codeInfo = new GoodsQRCodeInfo();
+        BeanCopyUtil.copyBean(goodsQRCodeInfoForm,codeInfo);
+        return  goodsQRCodeInfoMapper.updateGoodsQRCodeInfoByRecord(codeInfo);
+    }
+
+    /**
+     * 删除溯源明细信息(物理删除)
+     *
+     * @param recordId
+     * @return
+     */
+    @Override
+    public int delQRCodeInfoByPhysical(String recordId) {
+        return goodsQRCodeInfoMapper.delQRCodeInfoByRecordId(recordId);
+    }
+
+    /**
+     * 废弃单个溯源码信息(逻辑删除)
+     * @param goodsQRCodeInfoForm
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int forbiddenCodeInfoByCodeId(GoodsQRCodeInfoForm goodsQRCodeInfoForm) {
+        //废弃单个溯源码信息,更新状态
+       String codeInfoId = goodsQRCodeInfoForm.getGuid();
+       GoodsQRCodeInfo goodsQRCodeInfo =  goodsQRCodeInfoMapper.selectByPrimaryKey(codeInfoId);
+       if(goodsQRCodeInfo!=null){
+           String batchRecord = goodsQRCodeInfo.getFkBatchRecordGuid();
+           goodsQRCodeInfo.setState(0);
+           goodsQRCodeInfo.setModifiedUser(goodsQRCodeInfoForm.getModifiedUser());
+           goodsQRCodeInfo.setModifiedTime(new Date());
+           int i = goodsQRCodeInfoMapper.updateByPrimaryKeySelective(goodsQRCodeInfo);
+           if(i>0){
+               //更新废弃数量
+               GoodsQRCodeRecord record = goodsQRCodeRecordMapper.selectByPrimaryKey(batchRecord);
+               if(record!=null){
+                   int count = record.getCancelNum();
+                   count++;
+                   record.setCancelNum(count);
+                   record.setModifiedTime(new Date());
+                   record.setModifiedUser(goodsQRCodeInfoForm.getModifiedUser());
+                   goodsQRCodeRecordMapper.updateByPrimaryKeySelective(record);
+               }
+           }
+           return i;
+       }
+
+        return 0;
+    }
+
+    /**
+     * 批量更新溯源码信息通过生成记录Id
+     *
+     * @param list
+     * @return
+     */
+    @Override
+    public int batchUpdateGoodsQRCodeInfoByRecord(List<String> list) {
+        return goodsQRCodeInfoMapper.batchUpdateGoodsQRCodeInfoByRecord(list);
+    }
+
+    /**
+     * 获取溯源码
+     * @param codeInfoForm
+     * @param info
+     * @param currentNum
+     */
+    private void getQrcode(GoodsQRCodeInfoForm codeInfoForm,GoodsQRCodeInfo info,String currentNum, List<String> containerList){
+        if(null!= codeInfoForm && !"".equals(codeInfoForm.getQrcodeParentCode())){
+            StringBuilder stb = new StringBuilder();
+            String parentCode = codeInfoForm.getQrcodeParentCode();
+            int len = SN_LENGTH-currentNum.length();
+            String sn="";
+            for (int i = 0; i < len; i++) {
+                sn+="0";
+            }
+            String qrcode = parentCode+sn+currentNum;
+            String codeSuffix = sn+currentNum;
+            info.setQrcode(qrcode);
+            info.setQrcodeToken(TracedCodeUtils.generalTracedCode(codeInfoForm.getOrgBrevity(),codeSuffix,containerList));
+            info.setQrcodeImg(info.getQrcodeToken()+".png");
+            stb.append(codeInfoForm.getCodeUrlPrefix()).append("?qrToken=").append(info.getQrcodeToken());
+            info.setQrcodeUrl(stb.toString());
+        }
+    }
+
+
+
+
+
+
+
+
+    @Override
+    public int delByPrimaryKey(String guid) {
+        return goodsQRCodeInfoMapper.deleteByPrimaryKey(guid);
+    }
+
+    @Override
+    public int save(GoodsQRCodeInfo record) {
+        return goodsQRCodeInfoMapper.insert(record);
+    }
+
+    @Override
+    public int saveSelective(GoodsQRCodeInfo record) {
+        return goodsQRCodeInfoMapper.insertSelective(record);
+    }
+
+    @Override
+    public GoodsQRCodeInfo queryByPrimaryKey(String guid) {
+        return goodsQRCodeInfoMapper.selectByPrimaryKey(guid);
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(GoodsQRCodeInfo record) {
+        return goodsQRCodeInfoMapper.updateByPrimaryKeySelective(record);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(GoodsQRCodeInfo record) {
+        //TODO empty implements
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(GoodsQRCodeInfo record) {
+        return goodsQRCodeInfoMapper.updateByPrimaryKey(record);
+    }
+    
+    @Override
+    public PageInfo getPrintGoodsQRInfo(GoodsQRCodeInfoForm goodsQRCodeInfoForm) {
+    	PageHelper.startPage(goodsQRCodeInfoForm.getPageNum(),goodsQRCodeInfoForm.getPageSize());
+        List<GoodsQRCodeInfoBO> list =  goodsQRCodeInfoMapper.getPrintGoodsQRInfo(goodsQRCodeInfoForm);
+    	return new PageInfo<>(list);
+    }
+
+	@Override
+	@Transactional
+	public int updateQRIsPrint(List<String> ids) {
+		// TODO Auto-generated method stub
+		return goodsQRCodeInfoMapper.updateQRIsPrint(ids);
+	}
+}

+ 188 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsQRCodeRecordStatServiceImpl.java

@@ -0,0 +1,188 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.hcloud.microservice.goods.dao.GoodsQRCodeRecordMapper;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordStatForm;
+import com.hcloud.microservice.goods.facade.results.ScanNumStatResult;
+import com.hcloud.microservice.goods.facade.results.ScanNumStatisResult;
+import com.hcloud.microservice.goods.service.GoodsQRCodeRecordStatService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.LinkedList;
+import java.util.List;
+
+@Slf4j
+@Service
+public class GoodsQRCodeRecordStatServiceImpl implements GoodsQRCodeRecordStatService {
+
+    @Resource
+    private GoodsQRCodeRecordMapper goodsQRCodeRecordMapper;
+
+    /**
+     * 统计某一年12个月的扫码数量
+     *
+     * @param goodsQRCodeRecordStatForm
+     * @return
+     */
+    @Override
+    public LinkedList<ScanNumStatisResult> statOneYearAllMonthData(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm) {
+        //ScanNumStatResult result = this.goodsQRCodeRecordMapper.statQRCodeScanNumForOneYeaAllMonth(goodsQRCodeRecordStatForm);
+        List<ScanNumStatisResult> list = goodsQRCodeRecordMapper.statQRCodeScanNumByMonth(goodsQRCodeRecordStatForm);
+        LinkedList<ScanNumStatisResult> result = new LinkedList();
+        for (int i = 1; i <= 12; i++) {
+        	String index = String.valueOf(i);
+        	ScanNumStatisResult obj = new ScanNumStatisResult();
+        	int num = 0;
+        	for (ScanNumStatisResult scanNumStatisResult : list) {
+				if(index.equals(scanNumStatisResult.getDate())) {
+					num = scanNumStatisResult.getNum();
+				}
+			}
+        	obj.setDate(index);
+        	obj.setNum(num);
+        	
+        	result.add(obj);
+		}
+        
+        return result;
+    }
+
+    /**
+     * 统计昨天和历史累计扫码人数
+     *
+     * @param goodsQRCodeRecordStatForm
+     * @return
+     */
+    @Override
+    public List<ScanNumStatResult> statYesterdayAndAllTimeData(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm) {
+        return this.goodsQRCodeRecordMapper.statYesterdayAndAllTime(goodsQRCodeRecordStatForm);
+    }
+
+    @Override
+    public List<ScanNumStatResult> statOneDayAllHoursData(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm) {
+        List<ScanNumStatResult> results = this.goodsQRCodeRecordMapper.statOneDayAllHours(goodsQRCodeRecordStatForm);
+        // 以下逻辑处理数据库的统计数据若不是24个整点的数据,那么缺失整点数据需要补充上
+        if (results.size() < 24) {
+            List<ScanNumStatResult> finalResults = setZeroToResult(results, 24, 0);
+
+            return finalResults;
+        }
+        return results;
+    }
+
+    @Override
+    public List<ScanNumStatResult> statOneWeekSevenDaysData(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm) {
+        List<ScanNumStatResult> results = this.goodsQRCodeRecordMapper.statOneWeekSevenDays(goodsQRCodeRecordStatForm);
+        // 如果结果集长度不足7,需要补零
+        if (results.size() < 7) {
+            return setZeroToResult(results, 7, 1);
+        }
+        return results;
+    }
+
+    @Override
+    public List<ScanNumStatResult> statOneMonthAllDaysData(GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm) {
+        Calendar c = Calendar.getInstance();
+        int maxDay = c.getActualMaximum(Calendar.DAY_OF_MONTH);
+        List<ScanNumStatResult> results = this.goodsQRCodeRecordMapper.statOneMonthAllDays(goodsQRCodeRecordStatForm);
+        if (results.size() < maxDay) {
+            return setZeroToResult(results, maxDay, 2);
+        }
+        return results;
+    }
+
+    /**
+     * 在数据库中统计一天
+     * @param results
+     * @param length
+     * @param mode
+     * @return
+     */
+    private List<ScanNumStatResult> setZeroToResult(List<ScanNumStatResult> results, int length, int mode) {
+        List<ScanNumStatResult> finalResults = new ArrayList<>();
+        int i = (mode == 2) ? 1 : 0;
+        length = (mode == 2) ? length + 1 : length;
+        for (; i < length; i++) {
+            boolean flag = false;
+            for (int j = 0; j < results.size(); j++) {
+                int cs = 0;
+                switch (mode) {
+                    case 0:
+                        cs = results.get(j).getHour();
+                        break;
+                    case 1:
+                        cs = results.get(j).getDayOfWeek();
+                        break;
+                    case 2:
+                        cs = results.get(j).getDayOfMonth();
+                        break;
+                    default:
+                        throw new RuntimeException("比许有一个mode值知名依据小时,星期几来补零");
+
+                }
+                if (cs == i) {
+                    flag = true;
+                }
+            }
+            if (flag == true) {
+                continue;
+            } else {
+                ScanNumStatResult temp = new ScanNumStatResult();
+                switch (mode) {
+                    case 0:
+                        temp.setHour(i);
+                        break;
+                    case 1:
+                        temp.setDayOfWeek(i == 0 ? 7 : i);
+                        break;
+                    case 2:
+                        temp.setDayOfMonth(i);
+                        break;
+                    default:
+                        throw new RuntimeException("补零出错了");
+
+                }
+                temp.setScanNum(0);
+                finalResults.add(temp);
+            }
+        }
+
+        finalResults.addAll(results);
+
+        if (mode == 0) {
+            finalResults.sort((o1, o2) -> {
+                if (o1.getHour() < o2.getHour()) {
+                    return -1;
+                } else if (o1.getHour() > o2.getHour()) {
+                    return 1;
+                } else {
+                    return 0;
+                }
+            });
+        } else if (mode == 1) {
+            finalResults.sort((o1, o2) -> {
+                if (o1.getDayOfWeek() < o2.getDayOfWeek()) {
+                    return -1;
+                } else if (o1.getDayOfWeek() > o2.getDayOfWeek()) {
+                    return 1;
+                } else {
+                    return 0;
+                }
+            });
+        } else if (mode == 2) {
+            finalResults.sort((o1, o2) -> {
+                if (o1.getDayOfMonth() < o2.getDayOfMonth()) {
+                    return -1;
+                } else if (o1.getDayOfMonth() > o2.getDayOfMonth()) {
+                    return 1;
+                } else {
+                    return 0;
+                }
+            });
+        }
+        return finalResults;
+    }
+}

+ 101 - 0
src/main/java/com/hcloud/microservice/goods/service/impl/GoodsTracedUserServiceImpl.java

@@ -0,0 +1,101 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.hcloud.microserver.commoncore.base.PageBean;
+import com.hcloud.microserver.commoncore.util.BeanCopyUtil;
+import com.hcloud.microservice.goods.dao.GoodsTracedUserMapper;
+import com.hcloud.microservice.goods.facade.entity.GoodsTracedUser;
+import com.hcloud.microservice.goods.facade.forms.GoodsTracedUserForm;
+import com.hcloud.microservice.goods.service.GoodsTracedUserService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author JYJ
+ */
+@Service("goodsTracedUserService")
+public class GoodsTracedUserServiceImpl implements GoodsTracedUserService {
+
+    @Resource
+    private GoodsTracedUserMapper goodsTracedUserMapper;
+
+
+    @Override
+    public int delByPrimaryKey(String guid) {
+        return goodsTracedUserMapper.deleteByPrimaryKey(guid);
+    }
+
+    @Override
+    public int save(GoodsTracedUserForm record) {
+        GoodsTracedUser goodsTracedUser = new GoodsTracedUser();
+        BeanCopyUtil.copyBean(record,goodsTracedUser);
+        return goodsTracedUserMapper.insert(goodsTracedUser);
+    }
+
+    @Override
+    public int saveSelective(GoodsTracedUserForm record) {
+        GoodsTracedUser goodsTracedUser = new GoodsTracedUser();
+        BeanCopyUtil.copyBean(record,goodsTracedUser);
+        return goodsTracedUserMapper.insertSelective(goodsTracedUser);
+    }
+
+    @Override
+    public GoodsTracedUserForm queryByPrimaryKey(String guid) {
+        GoodsTracedUserForm tracedUserForm = new GoodsTracedUserForm();
+        GoodsTracedUser goodsTracedUser = goodsTracedUserMapper.selectByPrimaryKey(guid);
+        BeanCopyUtil.copyBean(goodsTracedUser,tracedUserForm);
+        return tracedUserForm;
+    }
+
+    @Override
+    public int modifyByPrimaryKeySelective(GoodsTracedUserForm record) {
+        GoodsTracedUser goodsTracedUser = new GoodsTracedUser();
+        BeanCopyUtil.copyBean(record,goodsTracedUser);
+        return goodsTracedUserMapper.updateByPrimaryKeySelective(goodsTracedUser);
+    }
+
+    @Override
+    public int modifyByPrimaryKeyWithBLOBs(GoodsTracedUserForm record) {
+        //TODO empty implements
+        return 0;
+    }
+
+    @Override
+    public int modifyByPrimaryKey(GoodsTracedUserForm record) {
+        GoodsTracedUser goodsTracedUser = new GoodsTracedUser();
+        BeanCopyUtil.copyBean(record,goodsTracedUser);
+        return goodsTracedUserMapper.updateByPrimaryKey(goodsTracedUser);
+    }
+
+    /**
+     * 分页查询溯源用户信息
+     *
+     * @param goodsTracedUserForm
+     * @return
+     */
+    @Override
+    public PageInfo searchTracedUserByPage(GoodsTracedUserForm goodsTracedUserForm) {
+        PageHelper.startPage(goodsTracedUserForm.getPageNo(),goodsTracedUserForm.getPageSize());
+        List<GoodsTracedUser> list = goodsTracedUserMapper.searchTracedUserByPage(new PageBean(goodsTracedUserForm));
+        return new PageInfo(list);
+    }
+
+    /**
+     * 查询溯源用户信息,通过用户第三方编号
+     *
+     * @param code
+     * @return
+     */
+    @Override
+    public GoodsTracedUserForm searchTracedUserByCode(String code,String userOpenid) {
+        GoodsTracedUserForm resultForm = new GoodsTracedUserForm();
+        GoodsTracedUser tracedUser =  goodsTracedUserMapper.searchTracedUserByCode(code,userOpenid);
+        if(tracedUser!=null){
+            BeanCopyUtil.copyBean(tracedUser,resultForm);
+        }
+        return resultForm;
+    }
+}

+ 76 - 0
src/main/resources/application-dev.properties

@@ -0,0 +1,76 @@
+server.port=21884
+spring.application.name=goods-service
+spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
+spring.jackson.time-zone=GMT+8
+## upload files setting
+spring.http.multipart.maxFileSize=10Mb
+spring.http.multipart.maxRequestSize=10Mb
+#img.location=C:/nginx-1.15.2/html/uploadfile/
+#spring.mvc.static-path-pattern=/images/**
+#spring.resources.static-locations=file:${img.location}
+
+#mysql datasource setting
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
+spring.datasource.url=jdbc:mysql://127.0.0.1:3306/traced_source?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false&&allowMultiQueries=true
+#spring.datasource.url=jdbc:mysql://localhost:3306/food_security_db?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
+spring.datasource.username=root
+spring.datasource.password=123456
+#spring.datasource.password=root
+spring.datasource.initialSize=5
+spring.datasource.minIdle=5
+spring.datasource.maxActive=20
+spring.datasource.maxWait=60000
+spring.datasource.timeBetweenEvictionRunsMillis=60000
+spring.datasource.minEvictableIdleTimeMillis=30000
+spring.datasource.validationQuery=SELECT 1
+spring.datasource.testWhileIdle=true
+spring.datasource.testOnBorrow=false
+spring.datasource.testOnReturn=false
+spring.datasource.poolPreparedStatements=true
+spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
+spring.datasource.filters=stat,wall
+spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=2000
+#mybatis setting
+mybatis.type-aliases-package=com.hcloud.microservice.goods.facade.entity
+mybatis.mapper-locations=classpath:mappers/*.xml
+mybatis.check-config-location=true
+mybatis.executor-type=simple
+
+#pagehelper setting
+pagehelper.helperDialect=mysql
+pagehelper.reasonable=true
+pagehelper.supportMethodsArguments=true
+pagehelper.params=count=countSql
+
+
+#zuul timeout setting
+zuul.host.connect-timeout-millis=10000
+zuul.host.socket-timeout-millis=10000
+
+#hystix timeout setting
+hystrix.metrics.enabled=true
+hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=60000
+# eureka setting
+eureka.instance.hostname=localhost
+eureka.client.service-url.defaultZone=http://localhost:8761/eureka/
+
+###redis配置#########
+spring.redis.database=0
+spring.redis.host=127.0.0.1
+spring.redis.port=6379
+spring.redis.pool.max-idle=8
+spring.redis.pool.min-idle=0
+spring.redis.pool.max-active=10
+spring.redis.pool.max-wait=-1
+spring.redis.timeout=5000
+
+#qr.code.path=C:/nginx-1.15.2/html/uploadfile/images/
+#qr.code.logo.path=C:/nginx-1.15.2/html/uploadfile/
+
+qr.code.path=F:/mt/upload/images/
+qr.code.logo.path=F:/mt/upload
+
+wlw.address=http://47.111.224.169:8085
+
+

+ 79 - 0
src/main/resources/application-pro.properties

@@ -0,0 +1,79 @@
+server.port=21884
+spring.application.name=goods-service
+spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
+spring.jackson.time-zone=GMT+8
+## upload files setting
+spring.http.multipart.maxFileSize=10Mb
+spring.http.multipart.maxRequestSize=10Mb
+#img.location=/usr/home/images/
+#spring.mvc.static-path-pattern=/images/**
+#spring.resources.static-locations=file:${img.location}
+
+#mysql datasource setting
+spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
+spring.datasource.url=jdbc:mysql://47.111.224.169:3306/traced_source?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false&&allowMultiQueries=true
+#spring.datasource.url=jdbc:mysql://localhost:3306/food_security_db?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
+spring.datasource.username=trace
+spring.datasource.password=Admin123
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.initialSize=5
+spring.datasource.minIdle=5
+spring.datasource.maxActive=20
+spring.datasource.maxWait=60000
+spring.datasource.timeBetweenEvictionRunsMillis=60000
+spring.datasource.minEvictableIdleTimeMillis=30000
+spring.datasource.validationQuery=SELECT 1
+spring.datasource.testWhileIdle=true
+spring.datasource.testOnBorrow=false
+spring.datasource.testOnReturn=false
+spring.datasource.poolPreparedStatements=true
+spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
+spring.datasource.filters=stat,wall
+spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=3000
+#mybatis setting
+mybatis.type-aliases-package=com.hcloud.microserver.org.facade.entity
+mybatis.mapper-locations=classpath:mappers/*.xml
+mybatis.check-config-location=true
+mybatis.executor-type=simple
+#pagehelper setting
+pagehelper.helperDialect=mysql
+pagehelper.reasonable=true
+pagehelper.supportMethodsArguments=true
+pagehelper.params=count=countSql
+
+
+# Max number of next servers to retry (excluding the first server)
+system-service.ribbon.MaxAutoRetriesNextServer=1
+
+# Whether all operations can be retried for this client
+system-service.ribbon.OkToRetryOnAllOperations=true
+
+# Interval to refresh the server list from the source
+system-service.ribbon.ServerListRefreshInterval=2000
+
+# Connect timeout used by Apache HttpClient
+system-service.ribbon.ConnectTimeout=50000
+
+# Read timeout used by Apache HttpClient
+system-service.ribbon.ReadTimeout=50000
+#hystix timeout setting
+hystrix.metrics.enabled=true
+hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds = 10000
+# eureka setting
+eureka.instance.hostname=localhost
+eureka.client.service-url.defaultZone=http://127.0.0.1:8761/eureka/
+
+###redis配置#########
+spring.redis.database=0
+spring.redis.host=127.0.0.1
+spring.redis.port=6379
+spring.redis.pool.max-idle=8
+spring.redis.pool.min-idle=0
+spring.redis.pool.max-active=10
+spring.redis.pool.max-wait=-1
+spring.redis.timeout=5000
+
+qr.code.path=/home/appServer/trace/upload/images/
+qr.code.logo.path=/home/appServer/trace/upload
+
+wlw.address=http://47.111.224.169:8085

+ 71 - 0
src/main/resources/application-test.properties

@@ -0,0 +1,71 @@
+server.port=21884
+spring.application.name=goods-service
+spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
+spring.jackson.time-zone=GMT+8
+## upload files setting
+spring.http.multipart.maxFileSize=10Mb
+spring.http.multipart.maxRequestSize=10Mb
+#img.location=C:/nginx-1.15.2/html/uploadfile/
+#spring.mvc.static-path-pattern=/images/**
+#spring.resources.static-locations=file:${img.location}
+
+#mysql datasource setting
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
+#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/traced_source?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=true&&allowMultiQueries=true
+spring.datasource.url=jdbc:mysql://frp.h.gyhywa.com:56524/traced_source?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&autoReconnect=true&useSSL=false&&allowMultiQueries=true
+#spring.datasource.url=jdbc:mysql://localhost:3306/food_security_db?characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
+spring.datasource.username=root
+#spring.datasource.password=root123456
+spring.datasource.password=hw123456
+#spring.datasource.password=root
+spring.datasource.initialSize=5
+spring.datasource.minIdle=5
+spring.datasource.maxActive=20
+spring.datasource.maxWait=60000
+spring.datasource.timeBetweenEvictionRunsMillis=60000
+spring.datasource.minEvictableIdleTimeMillis=30000
+spring.datasource.validationQuery=SELECT 1
+spring.datasource.testWhileIdle=true
+spring.datasource.testOnBorrow=false
+spring.datasource.testOnReturn=false
+spring.datasource.poolPreparedStatements=true
+spring.datasource.maxPoolPreparedStatementPerConnectionSize=20
+spring.datasource.filters=stat,wall
+spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=2000
+#mybatis setting
+mybatis.type-aliases-package=com.hcloud.microservice.goods.facade.entity
+mybatis.mapper-locations=classpath:mappers/*.xml
+mybatis.check-config-location=true
+mybatis.executor-type=simple
+
+#pagehelper setting
+pagehelper.helperDialect=mysql
+pagehelper.reasonable=true
+pagehelper.supportMethodsArguments=true
+pagehelper.params=count=countSql
+
+
+#zuul timeout setting
+zuul.host.connect-timeout-millis=10000
+zuul.host.socket-timeout-millis=10000
+
+#hystix timeout setting
+hystrix.metrics.enabled=true
+hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=60000
+# eureka setting
+eureka.instance.hostname=localhost
+eureka.client.service-url.defaultZone=http://127.0.0.1:8761/eureka/
+
+###redis配置#########
+spring.redis.database=0
+spring.redis.host=127.0.0.1
+spring.redis.port=6379
+spring.redis.pool.max-idle=8
+spring.redis.pool.min-idle=0
+spring.redis.pool.max-active=10
+spring.redis.pool.max-wait=-1
+spring.redis.timeout=5000
+
+qr.code.path=/home/project/traced/upload/images/
+qr.code.logo.path=/home/project/traced/upload/

+ 3 - 0
src/main/resources/application.properties

@@ -0,0 +1,3 @@
+spring.profiles.active=pro
+logging.level.com.hcloud=debug
+spring.devtools.restart.enabled=true

+ 38 - 0
src/main/resources/generatorConfig.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE generatorConfiguration
+        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
+        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
+<generatorConfiguration>
+    <context id="DB2Tables" targetRuntime="MyBatis3">
+        <commentGenerator>
+            <property name="suppressDate" value="true"/>
+            <property name="suppressAllComments" value="true"/>
+        </commentGenerator>
+        <!--数据库链接地址账号密码-->
+        <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://127.0.0.1:3306/traced_source?characterEncoding=UTF-8" userId="root" password="root">
+    </jdbcConnection>
+        <javaTypeResolver>
+            <property name="forceBigDecimals" value="false"/>
+        </javaTypeResolver>
+        <!--生成Model类存放位置-->
+        <javaModelGenerator targetPackage="com.hcloud.microservice.goods.entity" targetProject="src/main/java">
+            <property name="enableSubPackages" value="true"/>
+            <property name="trimStrings" value="true"/>
+        </javaModelGenerator>
+        <!--生成映射文件存放位置-->
+        <sqlMapGenerator targetPackage="mappers" targetProject="src/main/resources">
+            <property name="enableSubPackages" value="true"/>
+        </sqlMapGenerator>
+        <!--生成Dao类存放位置-->
+        <!-- 客户端代码,生成易于使用的针对Model对象和XML配置文件 的代码
+                type="ANNOTATEDMAPPER",生成Java Model 和基于注解的Mapper对象
+                type="MIXEDMAPPER",生成基于注解的Java Model 和相应的Mapper对象
+                type="XMLMAPPER",生成SQLMap XML文件和独立的Mapper接口
+        -->
+        <javaClientGenerator type="XMLMAPPER" targetPackage="com.hcloud.microservice.goods.dao" targetProject="src/main/java">
+            <property name="enableSubPackages" value="true"/>
+        </javaClientGenerator>
+        <!--生成对应表及类名-->
+        <table tableName="t_goods_batch_grade"    domainObjectName="GoodsBatchGrade" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>
+    </context>
+</generatorConfiguration>

+ 176 - 0
src/main/resources/mappers/GoodsAssayInfoMapper.xml

@@ -0,0 +1,176 @@
+<?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.hcloud.microservice.goods.dao.GoodsAssayInfoMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsAssayInfo">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="fk_goods_batch_id" jdbcType="CHAR" property="fkGoodsBatchId" />
+    <result column="assay_department" jdbcType="VARCHAR" property="assayDepartment" />
+    <result column="assay_imgs" jdbcType="VARCHAR" property="assayImgs" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid,fk_org_guid, fk_goods_batch_id, assay_department, assay_imgs, state, create_user, create_time,
+    modified_user, modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_assay_info
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <select id="getGoodsAssayInfoByBatchId" resultMap="BaseResultMap">
+    select
+      <include refid="Base_Column_List" />
+      from t_goods_assay_info
+    where fk_goods_batch_id = #{batchId,jdbcType=CHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_assay_info
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+    <update id="delGoodsAssayInfoByBatchId" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsAssayInfo">
+      update t_goods_assay_info
+      <set>
+        <if test="state != null">
+          state = #{state,jdbcType=INTEGER},
+        </if>
+        <if test="createUser != null">
+          create_user = #{createUser,jdbcType=CHAR},
+        </if>
+        <if test="createTime != null">
+          create_time = #{createTime,jdbcType=TIMESTAMP},
+        </if>
+        <if test="modifiedUser != null">
+          modified_user = #{modifiedUser,jdbcType=CHAR},
+        </if>
+        <if test="modifiedTime != null">
+          modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+        </if>
+      </set>
+      where fk_goods_batch_id = #{fkGoodsBatchId,jdbcType=CHAR}
+    </update>
+    <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsAssayInfo">
+    insert into t_goods_assay_info (guid,fk_org_guid, fk_goods_batch_id, assay_department,
+      assay_imgs, state, create_user, 
+      create_time, modified_user, modified_time
+      )
+    values (#{guid,jdbcType=CHAR},#{fkOrgGuid,jdbcType=CHAR}, #{fkGoodsBatchId,jdbcType=CHAR}, #{assayDepartment,jdbcType=VARCHAR},
+      #{assayImgs,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}, #{createUser,jdbcType=CHAR}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{modifiedUser,jdbcType=CHAR}, #{modifiedTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsAssayInfo">
+    insert into t_goods_assay_info
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="fkGoodsBatchId != null">
+        fk_goods_batch_id,
+      </if>
+      <if test="assayDepartment != null">
+        assay_department,
+      </if>
+      <if test="assayImgs != null">
+        assay_imgs,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchId != null">
+        #{fkGoodsBatchId,jdbcType=CHAR},
+      </if>
+      <if test="assayDepartment != null">
+        #{assayDepartment,jdbcType=VARCHAR},
+      </if>
+      <if test="assayImgs != null">
+        #{assayImgs,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsAssayInfo">
+    update t_goods_assay_info
+    <set>
+      <if test="fkGoodsBatchId != null">
+        fk_goods_batch_id = #{fkGoodsBatchId,jdbcType=CHAR},
+      </if>
+      <if test="assayDepartment != null">
+        assay_department = #{assayDepartment,jdbcType=VARCHAR},
+      </if>
+      <if test="assayImgs != null">
+        assay_imgs = #{assayImgs,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsAssayInfo">
+    update t_goods_assay_info
+    set fk_goods_batch_id = #{fkGoodsBatchId,jdbcType=CHAR},
+      assay_department = #{assayDepartment,jdbcType=VARCHAR},
+      assay_imgs = #{assayImgs,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+</mapper>

+ 240 - 0
src/main/resources/mappers/GoodsBatchFeedbackMapper.xml

@@ -0,0 +1,240 @@
+<?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.hcloud.microservice.goods.dao.GoodsBatchFeedbackMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsBatchFeedback">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="fk_goods_batch_guid" jdbcType="CHAR" property="fkGoodsBatchGuid" />
+    <result column="fk_batch_record_guid" jdbcType="CHAR" property="fkBatchRecordGuid" />
+    <result column="grade_level" jdbcType="INTEGER" property="gradeLevel" />
+    <result column="comment_val" jdbcType="VARCHAR" property="commentVal" />
+    <result column="comment_title" jdbcType="VARCHAR" property="commentTitle" />
+    <result column="checked" jdbcType="INTEGER" property="checked" />
+    <result column="checked_user" jdbcType="CHAR" property="checkedUser" />
+    <result column="feedback_user" jdbcType="CHAR" property="feedbackUser" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_org_guid, fk_goods_batch_guid,fk_batch_record_guid,grade_level,comment_val, comment_title, checked, checked_user,
+    feedback_user,state, create_time, modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_batch_feedback
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+    <select id="searchBatchFeedbackByPage" parameterType="com.hcloud.microserver.commoncore.base.PageBean"
+            resultType="com.hcloud.microservice.goods.bo.GoodsFeedbackBO">
+      SELECT
+        aa.guid,
+        bb.goods_name AS goodsName,
+        bb.goods_batch_no AS goodsBatchNo,
+        aa.grade_level AS gradeLevel,
+        aa.comment_val AS commentVal,
+        aa.create_time AS createTime,
+        cc.traced_user_name AS tracedUserName
+      FROM
+        t_goods_batch_feedback aa
+      LEFT JOIN t_goods_batch_info bb ON aa.fk_goods_batch_guid = bb.guid
+      LEFT JOIN t_goods_traced_user cc ON aa.feedback_user = cc.guid
+      WHERE aa.state=1
+      <if test="data.beginTime!=null and data.beginTime!=''">
+      and aa.create_time >= CONCAT(#{data.beginTime},' 00:00:00')
+      </if>
+      <if test="data.endTime!=null and data.endTime!=''">
+        <![CDATA[
+        and aa.create_time <= CONCAT(#{data.endTime},' 23:59:59')
+        ]]>
+      </if>
+      <if test="data.fkGoodsBatchGuid!=null and data.fkGoodsBatchGuid!=''">
+      and aa.fk_goods_batch_guid = #{data.fkGoodsBatchGuid}
+      </if>
+      <if test="data.gradeStar!=null">
+        and aa.grade_level = #{data.gradeStar}
+      </if>
+      <if test="data.fkOrgGuid!=null and data.fkOrgGuid!=''">
+      and aa.fk_org_guid = #{data.fkOrgGuid}
+      </if>
+      <if test="data.condStr!=null and data.condStr!=''">
+        and( bb.goods_batch_no like concat(#{data.condStr},'%')
+        or bb.goods_name like concat('%',#{data.condStr},'%')
+        or cc.traced_user_name like concat('%',#{data.condStr},'%'))
+      </if>
+      <if test="data.commentVal!=null and data.commentVal!=''">
+        and aa.comment_val like concat('%',#{data.commentVal},'%')
+      </if>
+      order by aa.create_time desc
+    </select>
+    <select id="getGoodsFeedbackByUserId" parameterType="java.lang.String" resultMap="BaseResultMap">
+      select
+      <include refid="Base_Column_List" />
+      from t_goods_batch_feedback
+      where state = 1 and fk_batch_record_guid = #{batchId}
+       <if test="uid != null">
+      	  and feedback_user = #{uid}
+       </if>
+      ORDER BY create_time DESC
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_batch_feedback
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+  <delete id="delGoodsFeedbackByList">
+    delete from t_goods_batch_feedback where guid in
+    <foreach collection="list" item="id" separator="," open="(" close=")">
+      #{id}
+    </foreach>
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchFeedback">
+    insert into t_goods_batch_feedback (
+    guid, fk_org_guid, fk_goods_batch_guid,fk_batch_record_guid
+      grade_level,comment_val, comment_title, checked,
+      checked_user,feedback_user ,state,create_time,modified_time)
+    values (#{guid,jdbcType=CHAR}, #{fkOrgGuid,jdbcType=CHAR}, #{fkGoodsBatchGuid,jdbcType=CHAR}, #{fkBatchRecordGuid,jdbcType=CHAR},
+      #{gradeLevel,jdbcType=INTEGER},#{commentVal,jdbcType=VARCHAR}, #{commentTitle,jdbcType=VARCHAR}, #{checked,jdbcType=INTEGER},
+      #{checkedUser,jdbcType=CHAR},#{feedbackUser,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER},
+      #{createTime,jdbcType=TIMESTAMP},#{modifiedTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchFeedback">
+    insert into t_goods_batch_feedback
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid,
+      </if>
+      <if test="fkBatchRecordGuid != null">
+        fk_batch_record_guid,
+      </if>
+      <if test="gradeLevel != null">
+        grade_level,
+      </if>
+      <if test="commentVal != null">
+        comment_val,
+      </if>
+      <if test="commentTitle != null">
+        comment_title,
+      </if>
+      <if test="checked != null">
+        checked,
+      </if>
+      <if test="checkedUser != null">
+        checked_user,
+      </if>
+      <if test="feedbackUser != null">
+        feedback_user,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkBatchRecordGuid != null">
+        #{fkBatchRecordGuid,jdbcType=CHAR},
+      </if>
+      <if test="gradeLevel != null">
+        #{gradeLevel,jdbcType=INTEGER},
+      </if>
+      <if test="commentVal != null">
+        #{commentVal,jdbcType=VARCHAR},
+      </if>
+      <if test="commentTitle != null">
+        #{commentTitle,jdbcType=VARCHAR},
+      </if>
+      <if test="checked != null">
+        #{checked,jdbcType=INTEGER},
+      </if>
+      <if test="checkedUser != null">
+        #{checkedUser,jdbcType=CHAR},
+      </if>
+      <if test="feedbackUser != null">
+        #{feedbackUser,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchFeedback">
+    update t_goods_batch_feedback
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="gradeLevel != null">
+       grade_level = #{gradeLevel,jdbcType=INTEGER},
+      </if>
+      <if test="commentVal != null">
+        comment_val = #{commentVal,jdbcType=VARCHAR},
+      </if>
+      <if test="commentTitle != null">
+        comment_title = #{commentTitle,jdbcType=VARCHAR},
+      </if>
+      <if test="checked != null">
+        checked = #{checked,jdbcType=INTEGER},
+      </if>
+      <if test="checkedUser != null">
+        checked_user = #{checkedUser,jdbcType=CHAR},
+      </if>
+      <if test="feedbackUser != null">
+        feedback_user = #{feedbackUser,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchFeedback">
+    update t_goods_batch_feedback
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      grade_level = #{gradeLevel,jdbcType=INTEGER},
+      comment_val = #{commentVal,jdbcType=VARCHAR},
+      comment_title = #{commentTitle,jdbcType=VARCHAR},
+      checked = #{checked,jdbcType=INTEGER},
+      checked_user = #{checkedUser,jdbcType=CHAR},
+      feedback_user = #{feedbackUser,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+</mapper>

+ 189 - 0
src/main/resources/mappers/GoodsBatchGradeMapper.xml

@@ -0,0 +1,189 @@
+<?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.hcloud.microservice.goods.dao.GoodsBatchGradeMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsBatchGrade">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="fk_goods_batch_guid" jdbcType="CHAR" property="fkGoodsBatchGuid" />
+    <result column="fk_batch_record_guid" jdbcType="CHAR" property="fkBatchRecordGuid" />
+    <result column="grade_start" jdbcType="INTEGER" property="gradeStart" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="grade_user" jdbcType="CHAR" property="gradeUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_org_guid, fk_goods_batch_guid, fk_batch_record_guid, grade_start, state, grade_user, create_time, 
+    modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_batch_grade
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <select id="searchBatchGradeByPage" parameterType="com.hcloud.microserver.commoncore.base.PageBean"
+          resultType="com.hcloud.microservice.goods.bo.GoodsGradeBO">
+      SELECT
+        aa.guid,
+        bb.goods_name AS goodsName,
+        bb.goods_batch_no AS goodsBatchNo,
+        aa.grade_start AS gradeStart,
+        aa.create_time AS createTime,
+        cc.traced_user_name AS tracedUserName
+      FROM
+          t_goods_batch_grade aa
+      LEFT JOIN t_goods_batch_info bb ON aa.fk_goods_batch_guid = bb.guid
+      LEFT JOIN t_goods_traced_user cc ON aa.grade_user = cc.guid
+      WHERE
+         aa.state=1
+    <if test="data.beginTime!=null and data.beginTime!=''">
+      and aa.create_time >= CONCAT(#{data.beginTime},' 00:00:00')
+    </if>
+    <if test="data.endTime!=null and data.endTime!=''">
+      <![CDATA[
+      and aa.create_time <= CONCAT(#{data.endTime},' 23:59:59')
+      ]]>
+    </if>
+    <if test="data.fkGoodsBatchGuid!=null adn data.fkGoodsBatchGuid!=''">
+      and aa.fk_goods_batch_guid = #{data.begifkGoodsBatchGuidnTime}
+    </if>
+    <if test="data.fkOrgGuid!=null adn data.fkOrgGuid!=''">
+      and aa.fk_org_guid = #{data.fkOrgGuid}
+    </if>
+    <if test="data.goodsBatchNo!=null adn data.goodsBatchNo!=''">
+      and bb.goods_batch_no = #{data.goodsBatchNo}
+    </if>
+    <if test="data.fkGoodsGuid!=null adn data.fkGoodsGuid!=''">
+      and bb.fk_goods_guid = #{data.fkGoodsGuid}
+    </if>
+    order by aa.create_time desc
+  </select>
+    <select id="getBatchGradeInfoByCond" resultMap="BaseResultMap">
+      select
+        <include refid="Base_Column_List" />
+      from t_goods_batch_grade
+      where state = 1 and fk_batch_record_guid = #{batchId}
+      <if test="uid != null">
+      	and grade_user = #{uid}
+      </if>
+      ORDER BY create_time DESC
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_batch_grade
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+  <delete id="delBatchGradeInfo">
+    delete from t_goods_batch_grade where guid in
+    <foreach collection="list" item="id" separator="," open="(" close=")">
+      #{id}
+    </foreach>
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchGrade">
+    insert into t_goods_batch_grade (guid, fk_org_guid, fk_goods_batch_guid, fk_batch_record_guid
+      grade_start, state, grade_user, 
+      create_time, modified_time)
+    values (#{guid,jdbcType=CHAR}, #{fkOrgGuid,jdbcType=CHAR}, #{fkGoodsBatchGuid,jdbcType=CHAR}, #{fkBatchRecordGuid,jdbcType=CHAR},
+      #{gradeStart,jdbcType=INTEGER}, #{state,jdbcType=INTEGER}, #{gradeUser,jdbcType=CHAR}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{modifiedTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchGrade">
+    insert into t_goods_batch_grade
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid,
+      </if>
+      <if test="fkBatchRecordGuid != null">
+        fk_batch_record_guid,
+      </if>
+      <if test="gradeStart != null">
+        grade_start,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="gradeUser != null">
+        grade_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkBatchRecordGuid != null">
+        #{fkBatchRecordGuid,jdbcType=CHAR},
+      </if>
+      <if test="gradeStart != null">
+        #{gradeStart,jdbcType=INTEGER},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="gradeUser != null">
+        #{gradeUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchGrade">
+    update t_goods_batch_grade
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="gradeStart != null">
+        grade_start = #{gradeStart,jdbcType=INTEGER},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="gradeUser != null">
+        grade_user = #{gradeUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchGrade">
+    update t_goods_batch_grade
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      grade_start = #{gradeStart,jdbcType=INTEGER},
+      state = #{state,jdbcType=INTEGER},
+      grade_user = #{gradeUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+</mapper>

+ 277 - 0
src/main/resources/mappers/GoodsBatchInfoMapper.xml

@@ -0,0 +1,277 @@
+<?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.hcloud.microservice.goods.dao.GoodsBatchInfoMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsBatchInfo">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="fk_field_guid" jdbcType="CHAR" property="fkFieldGuid" />
+    <result column="fk_goods_guid" jdbcType="CHAR" property="fkGoodsGuid" />
+    <result column="goods_name" jdbcType="VARCHAR" property="goodsName" />
+    <result column="goods_batch_no" jdbcType="VARCHAR" property="goodsBatchNo" />
+    <result column="goods_unit" jdbcType="VARCHAR" property="goodsUnit" />
+    <result column="goods_product_date" jdbcType="DATE" property="goodsProductDate" />
+    <result column="goods_expired" jdbcType="VARCHAR" property="goodsExpired" />
+    <result column="goods_qrcode_limited" jdbcType="INTEGER" property="goodsQrcodeLimited" />
+    <result column="goods_batch_images" jdbcType="VARCHAR" property="goodsBatchImages" />
+    <result column="goods_sale_url" jdbcType="VARCHAR" property="goodsSaleUrl" />
+    <result column="goods_feedback_star" jdbcType="VARCHAR" property="goodsFeedbackStar" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_org_guid, fk_field_guid, fk_goods_guid, goods_name, goods_batch_no, goods_unit, 
+    goods_product_date, goods_expired, goods_qrcode_limited, goods_batch_images,goods_sale_url,
+    goods_feedback_star,state,create_user, create_time, modified_user, modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_batch_info
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <select id="searchByPage" parameterType="com.hcloud.microserver.commoncore.base.PageBean"
+          resultType="com.hcloud.microservice.goods.bo.GoodsBatchInfoBO">
+      SELECT
+        aa.guid,
+        aa.fk_goods_guid AS fkGoodsGuid,
+        aa.goods_name AS goodsName,
+        cc.field_name AS fieldName,
+        aa.goods_batch_no AS goodsBatchNo,
+        aa.goods_unit AS goodsUnit,
+        aa.goods_product_date AS goodsProductDate,
+        aa.goods_expired AS goodsExpired,
+        aa.goods_sale_url AS goodsSaleUrl,
+        aa.goods_feedback_star AS goodsFeedbackStar
+    FROM
+        t_goods_batch_info aa
+    LEFT JOIN t_goods_field cc ON aa.fk_field_guid = cc.guid
+    <where>
+       aa.state=1 AND aa.fk_org_guid=#{data.fkOrgGuid}
+      <if test="data.fkGoodsGuid!=null and data.fkGoodsGuid!=''">
+        AND aa.fk_goods_guid=#{data.fkGoodsGuid}
+      </if>
+      <if test="data.goodsName!=null and data.goodsName!=''">
+        AND aa.goods_name LIKE CONCAT('%',#{data.goodsName},'%')
+      </if>
+      <if test="data.goodsBatchNo!=null and data.goodsBatchNo!=''">
+        AND aa.goods_batch_no = #{data.goodsBatchNo}
+      </if>
+    </where>
+    order by aa.create_time desc
+  </select>
+
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_batch_info
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchInfo">
+    insert into t_goods_batch_info (guid, fk_org_guid, fk_field_guid, 
+      fk_goods_guid, goods_name, goods_batch_no, 
+      goods_unit, goods_product_date, goods_expired, 
+      goods_qrcode_limited, goods_batch_images,goods_sale_url,
+      goods_feedback_star,state,create_user, create_time, modified_user,
+      modified_time)
+    values (#{guid,jdbcType=CHAR}, #{fkOrgGuid,jdbcType=CHAR}, #{fkFieldGuid,jdbcType=CHAR}, 
+      #{fkGoodsGuid,jdbcType=CHAR}, #{goodsName,jdbcType=VARCHAR}, #{goodsBatchNo,jdbcType=VARCHAR}, 
+      #{goodsUnit,jdbcType=VARCHAR}, #{goodsProductDate,jdbcType=DATE}, #{goodsExpired,jdbcType=VARCHAR}, 
+      #{goodsQrcodeLimited,jdbcType=INTEGER}, #{goodsBatchImages,jdbcType=VARCHAR},#{goodsSaleUrl,jdbcType=VARCHAR} ,
+      #{goodsFeedbackStar,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createUser,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, #{modifiedUser,jdbcType=CHAR},
+      #{modifiedTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchInfo">
+    insert into t_goods_batch_info
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="fkFieldGuid != null">
+        fk_field_guid,
+      </if>
+      <if test="fkGoodsGuid != null">
+        fk_goods_guid,
+      </if>
+      <if test="goodsName != null">
+        goods_name,
+      </if>
+      <if test="goodsBatchNo != null">
+        goods_batch_no,
+      </if>
+      <if test="goodsUnit != null">
+        goods_unit,
+      </if>
+      <if test="goodsProductDate != null">
+        goods_product_date,
+      </if>
+      <if test="goodsExpired != null">
+        goods_expired,
+      </if>
+      <if test="goodsQrcodeLimited != null">
+        goods_qrcode_limited,
+      </if>
+      <if test="goodsBatchImages != null">
+        goods_batch_images,
+      </if>
+      <if test="goodsSaleUrl != null">
+        goods_sale_url,
+      </if>
+      <if test="goodsFeedbackStar != null">
+        goods_feedback_star,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkFieldGuid != null">
+        #{fkFieldGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsGuid != null">
+        #{fkGoodsGuid,jdbcType=CHAR},
+      </if>
+      <if test="goodsName != null">
+        #{goodsName,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsBatchNo != null">
+        #{goodsBatchNo,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsUnit != null">
+        #{goodsUnit,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsProductDate != null">
+        #{goodsProductDate,jdbcType=DATE},
+      </if>
+      <if test="goodsExpired != null">
+        #{goodsExpired,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsQrcodeLimited != null">
+        #{goodsQrcodeLimited,jdbcType=INTEGER},
+      </if>
+      <if test="goodsBatchImages != null">
+        #{goodsBatchImages,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsSaleUrl != null">
+        #{goodsSaleUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsFeedbackStar != null">
+        #{goodsFeedbackStar,jdbcType=INTEGER},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchInfo">
+    update t_goods_batch_info
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkFieldGuid != null">
+        fk_field_guid = #{fkFieldGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsGuid != null">
+        fk_goods_guid = #{fkGoodsGuid,jdbcType=CHAR},
+      </if>
+      <if test="goodsName != null">
+        goods_name = #{goodsName,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsBatchNo != null">
+        goods_batch_no = #{goodsBatchNo,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsUnit != null">
+        goods_unit = #{goodsUnit,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsProductDate != null">
+        goods_product_date = #{goodsProductDate,jdbcType=DATE},
+      </if>
+      <if test="goodsExpired != null">
+        goods_expired = #{goodsExpired,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsQrcodeLimited != null">
+        goods_qrcode_limited = #{goodsQrcodeLimited,jdbcType=INTEGER},
+      </if>
+      <if test="goodsBatchImages != null">
+        goods_batch_images = #{goodsBatchImages,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsSaleUrl != null">
+        goods_sale_url = #{goodsSaleUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsFeedbackStar != null">
+        goods_feedback_star = #{goodsFeedbackStar,jdbcType=INTEGER},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchInfo">
+    update t_goods_batch_info
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      fk_field_guid = #{fkFieldGuid,jdbcType=CHAR},
+      fk_goods_guid = #{fkGoodsGuid,jdbcType=CHAR},
+      goods_name = #{goodsName,jdbcType=VARCHAR},
+      goods_batch_no = #{goodsBatchNo,jdbcType=VARCHAR},
+      goods_unit = #{goodsUnit,jdbcType=VARCHAR},
+      goods_product_date = #{goodsProductDate,jdbcType=DATE},
+      goods_expired = #{goodsExpired,jdbcType=VARCHAR},
+      goods_qrcode_limited = #{goodsQrcodeLimited,jdbcType=INTEGER},
+      goods_batch_images = #{goodsBatchImages,jdbcType=VARCHAR},
+      goods_sale_url = #{goodsSaleUrl,jdbcType=VARCHAR},
+      goods_feedback_star = #{goodsFeedbackStar,jdbcType=INTEGER},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+</mapper>

+ 171 - 0
src/main/resources/mappers/GoodsBatchLabelMapper.xml

@@ -0,0 +1,171 @@
+<?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.hcloud.microservice.goods.dao.GoodsBatchLabelMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsBatchLabel">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_goods_batch_guid" jdbcType="CHAR" property="fkGoodsBatchGuid" />
+    <result column="fk_good_label_guid" jdbcType="CHAR" property="fkGoodLabelGuid" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_goods_batch_guid, fk_good_label_guid, state, create_user, create_time, modified_user, 
+    modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_batch_label
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_batch_label
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchLabel">
+    insert into t_goods_batch_label (guid, fk_goods_batch_guid, fk_good_label_guid, 
+      state, create_user, create_time, 
+      modified_user, modified_time)
+    values (#{guid,jdbcType=CHAR}, #{fkGoodsBatchGuid,jdbcType=CHAR}, #{fkGoodLabelGuid,jdbcType=CHAR}, 
+      #{state,jdbcType=INTEGER}, #{createUser,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{modifiedUser,jdbcType=CHAR}, #{modifiedTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchLabel">
+    insert into t_goods_batch_label
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid,
+      </if>
+      <if test="fkGoodLabelGuid != null">
+        fk_good_label_guid,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodLabelGuid != null">
+        #{fkGoodLabelGuid,jdbcType=CHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchLabel">
+    update t_goods_batch_label
+    <set>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodLabelGuid != null">
+        fk_good_label_guid = #{fkGoodLabelGuid,jdbcType=CHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchLabel">
+    update t_goods_batch_label
+    set fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      fk_good_label_guid = #{fkGoodLabelGuid,jdbcType=CHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  
+  <!-- 查询产品标签  lym -->
+  <select id="selectGoodsBatchLabelList" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsBatchLabel" resultMap="BaseResultMap">
+      select 
+	    <include refid="Base_Column_List" />
+	    from t_goods_batch_label
+	    <where>
+	      <if test="fkGoodsBatchGuid != null">
+	       	AND fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR}
+	      </if>
+	      <if test="fkGoodLabelGuid != null">
+	        AND fk_good_label_guid = #{fkGoodLabelGuid,jdbcType=CHAR}
+	      </if>
+	      <if test="state != null">
+	        AND state = #{state,jdbcType=INTEGER}
+	      </if>
+	      <if test="guid != null">
+	        AND guid = #{guid,jdbcType=CHAR}
+	      </if>
+	    </where>
+  </select>
+  
+  <!-- 删除产品关联标签  lym -->
+  <delete id="deleteGoodsBatchLabelByNotIds" parameterType="String">
+        delete from t_goods_batch_label 
+         <where>
+         	<if test="ids != null">
+         		guid not in
+         		<foreach close=")" collection="ids" item="id" open="(" separator=",">
+		            #{id}
+		        </foreach>
+         	</if>
+         	<if test="goodsBatchGuid != null and goodsBatchGuid != ''">
+        		and fk_goods_batch_guid = #{goodsBatchGuid}
+        	</if>
+         </where> 
+  </delete>
+  
+  <delete id="deleteByBatchGuid" parameterType="String">
+  	  delete from t_goods_batch_label
+  		where fk_goods_batch_guid = #{goodsBatchGuid}
+  </delete>
+</mapper>

+ 286 - 0
src/main/resources/mappers/GoodsDealerMapper.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.hcloud.microservice.goods.dao.GoodsDealerMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsDealer">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="dealer_code" jdbcType="VARCHAR" property="dealerCode" />
+    <result column="dealer_name" jdbcType="VARCHAR" property="dealerName" />
+    <result column="link_phone" jdbcType="VARCHAR" property="linkPhone" />
+    <result column="fk_postion_id" jdbcType="CHAR" property="fkPostionId" />
+    <result column="dealer_address" jdbcType="VARCHAR" property="dealerAddress" />
+    <result column="latitude_longitude" jdbcType="VARCHAR" property="latitudeLongitude" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.hcloud.microservice.goods.facade.entity.GoodsDealer">
+    <result column="remark" jdbcType="LONGVARCHAR" property="remark" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_org_guid, dealer_code, dealer_name, link_phone, fk_postion_id, dealer_address, 
+    latitude_longitude, state, create_user, create_time, modified_user, modified_time
+  </sql>
+  <sql id="Blob_Column_List">
+    remark
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
+    select 
+    <include refid="Base_Column_List" />
+    ,
+    <include refid="Blob_Column_List" />
+    from t_goods_dealer
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_dealer
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsDealer">
+    insert into t_goods_dealer (guid, fk_org_guid, dealer_code, 
+      dealer_name, link_phone, fk_postion_id, 
+      dealer_address, latitude_longitude, state, 
+      create_user, create_time, modified_user, 
+      modified_time, remark)
+    values (#{guid,jdbcType=CHAR}, #{fkOrgGuid,jdbcType=CHAR}, #{dealerCode,jdbcType=VARCHAR}, 
+      #{dealerName,jdbcType=VARCHAR}, #{linkPhone,jdbcType=VARCHAR}, #{fkPostionId,jdbcType=CHAR}, 
+      #{dealerAddress,jdbcType=VARCHAR}, #{latitudeLongitude,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}, 
+      #{createUser,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, #{modifiedUser,jdbcType=CHAR}, 
+      #{modifiedTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=LONGVARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsDealer">
+    insert into t_goods_dealer
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="dealerCode != null">
+        dealer_code,
+      </if>
+      <if test="dealerName != null">
+        dealer_name,
+      </if>
+      <if test="linkPhone != null">
+        link_phone,
+      </if>
+      <if test="fkPostionId != null">
+        fk_postion_id,
+      </if>
+      <if test="dealerAddress != null">
+        dealer_address,
+      </if>
+      <if test="latitudeLongitude != null">
+        latitude_longitude,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+      <if test="remark != null">
+        remark,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="dealerCode != null">
+        #{dealerCode,jdbcType=VARCHAR},
+      </if>
+      <if test="dealerName != null">
+        #{dealerName,jdbcType=VARCHAR},
+      </if>
+      <if test="linkPhone != null">
+        #{linkPhone,jdbcType=VARCHAR},
+      </if>
+      <if test="fkPostionId != null">
+        #{fkPostionId,jdbcType=CHAR},
+      </if>
+      <if test="dealerAddress != null">
+        #{dealerAddress,jdbcType=VARCHAR},
+      </if>
+      <if test="latitudeLongitude != null">
+        #{latitudeLongitude,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="remark != null">
+        #{remark,jdbcType=LONGVARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsDealer">
+    update t_goods_dealer
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="dealerCode != null">
+        dealer_code = #{dealerCode,jdbcType=VARCHAR},
+      </if>
+      <if test="dealerName != null">
+        dealer_name = #{dealerName,jdbcType=VARCHAR},
+      </if>
+      <if test="linkPhone != null">
+        link_phone = #{linkPhone,jdbcType=VARCHAR},
+      </if>
+      <if test="fkPostionId != null">
+        fk_postion_id = #{fkPostionId,jdbcType=CHAR},
+      </if>
+      <if test="dealerAddress != null">
+        dealer_address = #{dealerAddress,jdbcType=VARCHAR},
+      </if>
+      <if test="latitudeLongitude != null">
+        latitude_longitude = #{latitudeLongitude,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="remark != null">
+        remark = #{remark,jdbcType=LONGVARCHAR},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsDealer">
+    update t_goods_dealer
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      dealer_code = #{dealerCode,jdbcType=VARCHAR},
+      dealer_name = #{dealerName,jdbcType=VARCHAR},
+      link_phone = #{linkPhone,jdbcType=VARCHAR},
+      fk_postion_id = #{fkPostionId,jdbcType=CHAR},
+      dealer_address = #{dealerAddress,jdbcType=VARCHAR},
+      latitude_longitude = #{latitudeLongitude,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      remark = #{remark,jdbcType=LONGVARCHAR}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsDealer">
+    update t_goods_dealer
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      dealer_code = #{dealerCode,jdbcType=VARCHAR},
+      dealer_name = #{dealerName,jdbcType=VARCHAR},
+      link_phone = #{linkPhone,jdbcType=VARCHAR},
+      fk_postion_id = #{fkPostionId,jdbcType=CHAR},
+      dealer_address = #{dealerAddress,jdbcType=VARCHAR},
+      latitude_longitude = #{latitudeLongitude,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  
+  <select id="searchByPage" parameterType="com.hcloud.microservice.goods.facade.forms.GoodsDealerForm" resultMap="ResultMapWithBLOBs">
+    select 
+	    <include refid="Base_Column_List" />
+	    ,
+	    <include refid="Blob_Column_List" />
+	    ,(SELECT `name` FROM t_base_position WHERE `code` = b.provinceId) AS provinceName,
+		(SELECT `name` FROM t_base_position WHERE `code` = b.cityId) AS cityName,
+		(SELECT `name` FROM t_base_position WHERE `code` = b.countyId) AS countyName
+	    from t_goods_dealer
+	    LEFT JOIN (SELECT guid AS addressGuid,
+			(CASE WHEN LENGTH(fk_postion_id) > 6 THEN SUBSTRING(fk_postion_id,1,6) ELSE fk_postion_id END) AS provinceId,
+			(CASE WHEN LENGTH(fk_postion_id) > 9 THEN SUBSTRING(fk_postion_id,1,9) ELSE fk_postion_id END) AS cityId,
+			(CASE WHEN LENGTH(fk_postion_id) > 12 THEN SUBSTRING(fk_postion_id,1,12) ELSE fk_postion_id END) AS countyId
+			FROM t_goods_dealer WHERE state = 1
+			<if test="data.fkOrgGuid != null">
+		       AND fk_org_guid = #{data.fkOrgGuid,jdbcType=CHAR}
+		    </if>
+		    <if test="data.params != null">
+	          AND dealer_name LIKE CONCAT("%",#{data.params,jdbcType=VARCHAR},"%")
+	        </if>
+		) b ON b.addressGuid = guid
+	    where state = 1
+      <if test="data.fkOrgGuid != null">
+        AND fk_org_guid = #{data.fkOrgGuid,jdbcType=CHAR}
+      </if>
+      <if test="data.dealerCode != null">
+        AND dealer_code = #{data.dealerCode,jdbcType=VARCHAR}
+      </if>
+      <if test="data.dealerName != null">
+        AND dealer_name = =#{dealerName,jdbcType=VARCHAR}
+      </if>
+      <if test="data.linkPhone != null">
+        AND link_phone = #{data.linkPhone,jdbcType=VARCHAR}
+      </if>
+      <if test="data.params != null">
+        AND dealer_name LIKE CONCAT("%",#{data.params,jdbcType=VARCHAR},"%")
+      </if>
+      	ORDER BY create_time DESC
+  </select>
+  
+  <select id="getMaxCode" resultType="String">
+  	select MAX(dealer_code) from t_goods_dealer where state = 1
+  </select>
+  
+  <!-- 查询企业所有经销商  lym -->
+  <select id="selectList" parameterType="String" resultMap="ResultMapWithBLOBs">
+  	select 
+	    <include refid="Base_Column_List" />
+	    ,
+	    <include refid="Blob_Column_List" />
+	    from t_goods_dealer
+	    where state = 1
+      <if test="orgGuid != null">
+        AND fk_org_guid = #{orgGuid,jdbcType=CHAR}
+      </if>
+      	ORDER BY create_time DESC
+  </select>
+  
+  <!-- 编码是否存在  lym -->
+  <select id="existCode" parameterType="String" resultType="int">
+  	select count(*) from t_goods_dealer where state = 1 and dealer_code = #{code}
+  </select>
+  
+</mapper>

+ 249 - 0
src/main/resources/mappers/GoodsFieldMapper.xml

@@ -0,0 +1,249 @@
+<?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.hcloud.microservice.goods.dao.GoodsFieldMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsField">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="field_code" jdbcType="VARCHAR" property="fieldCode" />
+    <result column="field_name" jdbcType="VARCHAR" property="fieldName" />
+    <result column="fk_postion_id" jdbcType="CHAR" property="fkPostionId" />
+    <result column="field_address" jdbcType="VARCHAR" property="fieldAddress" />
+    <result column="field_area" jdbcType="VARCHAR" property="fieldArea" />
+    <result column="sale_goods_range" jdbcType="VARCHAR" property="saleGoodsRange" />
+    <result column="field_images" jdbcType="VARCHAR" property="fieldImages" />
+    <result column="remark" jdbcType="VARCHAR" property="remark" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+    <result column="one_map" jdbcType="VARCHAR" property="oneMap" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_org_guid, field_code, field_name, fk_postion_id, field_address, field_area, 
+    sale_goods_range, field_images, remark, state, create_user, create_time, modified_user, 
+    modified_time,one_map
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_field
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+    <select id="searchByPage" parameterType="com.hcloud.microserver.commoncore.base.PageBean"
+            resultMap="BaseResultMap">
+      select
+      <include refid="Base_Column_List" />
+      from t_goods_field
+      where
+        state = 1
+          and fk_org_guid = #{data.fkOrgGuid}
+        <if test="data.fieldName!=null and data.fieldName!=''">
+         and field_name like concat('%',#{data.fieldName},'%')
+        </if>
+        <if test="data.saleGoodsRange!=null and data.saleGoodsRange!=''">
+         and sale_goods_range like concat('%',#{data.saleGoodsRange},'%')
+        </if>
+        ORDER BY modified_time DESC
+    </select>
+    <select id="getGoodsFieldInfoById" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from t_goods_field
+        where guid = #{goodsId,jdbcType=CHAR}
+        and fk_org_guid=#{orgGuid,jdbcType=CHAR}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_field
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsField">
+    insert into t_goods_field (guid, fk_org_guid, field_code, 
+      field_name, fk_postion_id, field_address, 
+      field_area, sale_goods_range, field_images, 
+      remark, state, create_user, 
+      create_time, modified_user, modified_time,one_map
+      )
+    values (#{guid,jdbcType=CHAR}, #{fkOrgGuid,jdbcType=CHAR}, #{fieldCode,jdbcType=VARCHAR}, 
+      #{fieldName,jdbcType=VARCHAR}, #{fkPostionId,jdbcType=CHAR}, #{fieldAddress,jdbcType=VARCHAR}, 
+      #{fieldArea,jdbcType=VARCHAR}, #{saleGoodsRange,jdbcType=VARCHAR}, #{fieldImages,jdbcType=VARCHAR}, 
+      #{remark,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}, #{createUser,jdbcType=CHAR}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{modifiedUser,jdbcType=CHAR}, #{modifiedTime,jdbcType=TIMESTAMP}, #{oneMap,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsField">
+    insert into t_goods_field
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="fieldCode != null">
+        field_code,
+      </if>
+      <if test="fieldName != null">
+        field_name,
+      </if>
+      <if test="fkPostionId != null">
+        fk_postion_id,
+      </if>
+      <if test="fieldAddress != null">
+        field_address,
+      </if>
+      <if test="fieldArea != null">
+        field_area,
+      </if>
+      <if test="saleGoodsRange != null">
+        sale_goods_range,
+      </if>
+      <if test="fieldImages != null">
+        field_images,
+      </if>
+      <if test="remark != null">
+        remark,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+      <if test="oneMap != null">
+        one_map,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fieldCode != null">
+        #{fieldCode,jdbcType=VARCHAR},
+      </if>
+      <if test="fieldName != null">
+        #{fieldName,jdbcType=VARCHAR},
+      </if>
+      <if test="fkPostionId != null">
+        #{fkPostionId,jdbcType=CHAR},
+      </if>
+      <if test="fieldAddress != null">
+        #{fieldAddress,jdbcType=VARCHAR},
+      </if>
+      <if test="fieldArea != null">
+        #{fieldArea,jdbcType=VARCHAR},
+      </if>
+      <if test="saleGoodsRange != null">
+        #{saleGoodsRange,jdbcType=VARCHAR},
+      </if>
+      <if test="fieldImages != null">
+        #{fieldImages,jdbcType=VARCHAR},
+      </if>
+      <if test="remark != null">
+        #{remark,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="oneMap != null">
+        #{oneMap,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsField">
+    update t_goods_field
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fieldCode != null">
+        field_code = #{fieldCode,jdbcType=VARCHAR},
+      </if>
+      <if test="fieldName != null">
+        field_name = #{fieldName,jdbcType=VARCHAR},
+      </if>
+      <if test="fkPostionId != null">
+        fk_postion_id = #{fkPostionId,jdbcType=CHAR},
+      </if>
+      <if test="fieldAddress != null">
+        field_address = #{fieldAddress,jdbcType=VARCHAR},
+      </if>
+      <if test="fieldArea != null">
+        field_area = #{fieldArea,jdbcType=VARCHAR},
+      </if>
+      <if test="saleGoodsRange != null">
+        sale_goods_range = #{saleGoodsRange,jdbcType=VARCHAR},
+      </if>
+      <if test="fieldImages != null">
+        field_images = #{fieldImages,jdbcType=VARCHAR},
+      </if>
+      <if test="remark != null">
+        remark = #{remark,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsField">
+    update t_goods_field
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      field_code = #{fieldCode,jdbcType=VARCHAR},
+      field_name = #{fieldName,jdbcType=VARCHAR},
+      fk_postion_id = #{fkPostionId,jdbcType=CHAR},
+      field_address = #{fieldAddress,jdbcType=VARCHAR},
+      field_area = #{fieldArea,jdbcType=VARCHAR},
+      sale_goods_range = #{saleGoodsRange,jdbcType=VARCHAR},
+      field_images = #{fieldImages,jdbcType=VARCHAR},
+      remark = #{remark,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  
+  <!-- 检验产地是否存在  lym -->
+  <select id="isExist" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsField" resultType="int">
+  	SELECT COUNT(*) FROM t_goods_field
+		WHERE state = 1 AND guid = #{guid,jdbcType=CHAR}
+  </select>
+</mapper>

+ 191 - 0
src/main/resources/mappers/GoodsInfoAuxiliaryMapper.xml

@@ -0,0 +1,191 @@
+<?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.hcloud.microservice.goods.dao.GoodsInfoAuxiliaryMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsInfoAuxiliary">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="fk_goods_guid" jdbcType="CHAR" property="fkGoodsGuid" />
+    <result column="fk_aux_itme_id" jdbcType="CHAR" property="fkAuxItmeId" />
+    <result column="aux_itme" jdbcType="VARCHAR" property="auxItme" />
+    <result column="aux_itme_val" jdbcType="VARCHAR" property="auxItmeVal" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_org_guid, fk_goods_guid, fk_aux_itme_id, aux_itme, aux_itme_val, state, 
+    create_user, create_time, modified_user, modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_info_auxiliary
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+    <select id="queryListByParentId" resultMap="BaseResultMap">
+      select
+      <include refid="Base_Column_List" />
+      from t_goods_info_auxiliary
+      where fk_aux_itme_id = #{itemId,jdbcType=CHAR}
+    </select>
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_info_auxiliary
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+  <delete id="delGoodsFieldAuxiliaryinfoByFkId">
+    delete from t_goods_info_auxiliary
+      where fk_aux_itme_id = #{goodsId,jdbcType=CHAR}
+      <!-- and fk_org_guid = #{orgGuid,jdbcType=CHAR} -->
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsInfoAuxiliary">
+    insert into t_goods_info_auxiliary (guid, fk_org_guid, fk_goods_guid, 
+      fk_aux_itme_id, aux_itme, aux_itme_val, 
+      state, create_user, create_time, 
+      modified_user, modified_time)
+    values (#{guid,jdbcType=CHAR}, #{fkOrgGuid,jdbcType=CHAR}, #{fkGoodsGuid,jdbcType=CHAR}, 
+      #{fkAuxItmeId,jdbcType=CHAR}, #{auxItme,jdbcType=VARCHAR}, #{auxItmeVal,jdbcType=VARCHAR}, 
+      #{state,jdbcType=INTEGER}, #{createUser,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{modifiedUser,jdbcType=CHAR}, #{modifiedTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="bathSaveAuxiliaryInfo" parameterType="com.hcloud.microservice.goods.facade.forms.GoodsInfoAuxiliaryForm">
+     insert into t_goods_info_auxiliary (guid, fk_org_guid, fk_goods_guid,
+      fk_aux_itme_id, aux_itme, aux_itme_val,
+      state, create_user, create_time,
+      modified_user, modified_time) values
+      <foreach collection="list" item="bean" open="" separator="," close="">
+        (REPLACE(UUID(),'-',''), #{bean.fkOrgGuid,jdbcType=CHAR}, #{bean.fkGoodsGuid,jdbcType=CHAR},
+        #{bean.fkAuxItmeId,jdbcType=CHAR}, #{bean.auxItme,jdbcType=VARCHAR}, #{bean.auxItmeVal,jdbcType=VARCHAR},
+        #{bean.state,jdbcType=INTEGER}, #{bean.createUser,jdbcType=CHAR}, #{bean.createTime,jdbcType=TIMESTAMP},
+        #{bean.modifiedUser,jdbcType=CHAR}, #{bean.modifiedTime,jdbcType=TIMESTAMP})
+      </foreach>
+
+
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsInfoAuxiliary">
+    insert into t_goods_info_auxiliary
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="fkGoodsGuid != null">
+        fk_goods_guid,
+      </if>
+      <if test="fkAuxItmeId != null">
+        fk_aux_itme_id,
+      </if>
+      <if test="auxItme != null">
+        aux_itme,
+      </if>
+      <if test="auxItmeVal != null">
+        aux_itme_val,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsGuid != null">
+        #{fkGoodsGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkAuxItmeId != null">
+        #{fkAuxItmeId,jdbcType=CHAR},
+      </if>
+      <if test="auxItme != null">
+        #{auxItme,jdbcType=VARCHAR},
+      </if>
+      <if test="auxItmeVal != null">
+        #{auxItmeVal,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsInfoAuxiliary">
+    update t_goods_info_auxiliary
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsGuid != null">
+        fk_goods_guid = #{fkGoodsGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkAuxItmeId != null">
+        fk_aux_itme_id = #{fkAuxItmeId,jdbcType=CHAR},
+      </if>
+      <if test="auxItme != null">
+        aux_itme = #{auxItme,jdbcType=VARCHAR},
+      </if>
+      <if test="auxItmeVal != null">
+        aux_itme_val = #{auxItmeVal,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsInfoAuxiliary">
+    update t_goods_info_auxiliary
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      fk_goods_guid = #{fkGoodsGuid,jdbcType=CHAR},
+      fk_aux_itme_id = #{fkAuxItmeId,jdbcType=CHAR},
+      aux_itme = #{auxItme,jdbcType=VARCHAR},
+      aux_itme_val = #{auxItmeVal,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+
+</mapper>

+ 190 - 0
src/main/resources/mappers/GoodsInfoMapper.xml

@@ -0,0 +1,190 @@
+<?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.hcloud.microservice.goods.dao.GoodsInfoMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsInfo">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="fk_goods_type" jdbcType="INTEGER" property="fkGoodsType" />
+    <result column="goods_code" jdbcType="VARCHAR" property="goodsCode" />
+    <result column="goods_name" jdbcType="VARCHAR" property="goodsName" />
+    <result column="goods_remark" jdbcType="VARCHAR" property="goodsRemark" />
+    <result column="goods_images" jdbcType="VARCHAR" property="goodsImages" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="VARCHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_org_guid, fk_goods_type, goods_code, goods_name, goods_remark, goods_images, 
+    state, create_user, create_time, modified_user, modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_info
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+
+  <select id="searchByPage" parameterType="com.hcloud.microserver.commoncore.base.PageBean" resultMap="BaseResultMap">
+    select
+      <include refid="Base_Column_List" />
+    from t_goods_info
+    where
+    state=1
+    and fk_org_guid = #{data.fkOrgGuid,jdbcType=CHAR}
+    <if test="data.goodsName!=null and data.goodsName!=''">
+     and goods_name like concat('%',#{data.goodsName},'%')
+    </if>
+  </select>
+
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_info
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsInfo">
+    insert into t_goods_info (guid, fk_org_guid, fk_goods_type, 
+      goods_code, goods_name, goods_remark, 
+      goods_images, state, create_user, 
+      create_time, modified_user, modified_time
+      )
+    values (#{guid,jdbcType=CHAR}, #{fkOrgGuid,jdbcType=CHAR}, #{fkGoodsType,jdbcType=INTEGER}, 
+      #{goodsCode,jdbcType=VARCHAR}, #{goodsName,jdbcType=VARCHAR}, #{goodsRemark,jdbcType=VARCHAR}, 
+      #{goodsImages,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}, #{createUser,jdbcType=CHAR}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{modifiedUser,jdbcType=VARCHAR}, #{modifiedTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsInfo">
+    insert into t_goods_info
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="fkGoodsType != null">
+        fk_goods_type,
+      </if>
+      <if test="goodsCode != null">
+        goods_code,
+      </if>
+      <if test="goodsName != null">
+        goods_name,
+      </if>
+      <if test="goodsRemark != null">
+        goods_remark,
+      </if>
+      <if test="goodsImages != null">
+        goods_images,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsType != null">
+        #{fkGoodsType,jdbcType=INTEGER},
+      </if>
+      <if test="goodsCode != null">
+        #{goodsCode,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsName != null">
+        #{goodsName,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsRemark != null">
+        #{goodsRemark,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsImages != null">
+        #{goodsImages,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=VARCHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsInfo">
+    update t_goods_info
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsType != null">
+        fk_goods_type = #{fkGoodsType,jdbcType=INTEGER},
+      </if>
+      <if test="goodsCode != null">
+        goods_code = #{goodsCode,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsName != null">
+        goods_name = #{goodsName,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsRemark != null">
+        goods_remark = #{goodsRemark,jdbcType=VARCHAR},
+      </if>
+      <if test="goodsImages != null">
+        goods_images = #{goodsImages,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=VARCHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsInfo">
+    update t_goods_info
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      fk_goods_type = #{fkGoodsType,jdbcType=INTEGER},
+      goods_code = #{goodsCode,jdbcType=VARCHAR},
+      goods_name = #{goodsName,jdbcType=VARCHAR},
+      goods_remark = #{goodsRemark,jdbcType=VARCHAR},
+      goods_images = #{goodsImages,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=VARCHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+</mapper>

+ 143 - 0
src/main/resources/mappers/GoodsLabelMapper.xml

@@ -0,0 +1,143 @@
+<?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.hcloud.microservice.goods.dao.GoodsLabelMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsLabel">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="label_name" jdbcType="VARCHAR" property="labelName" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, label_name, state, create_user, create_time, modified_user, modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_label
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_label
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsLabel">
+    insert into t_goods_label (guid, label_name, state, 
+      create_user, create_time, modified_user, 
+      modified_time)
+    values (#{guid,jdbcType=CHAR}, #{labelName,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}, 
+      #{createUser,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, #{modifiedUser,jdbcType=CHAR}, 
+      #{modifiedTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsLabel">
+    insert into t_goods_label
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="labelName != null">
+        label_name,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="labelName != null">
+        #{labelName,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsLabel">
+    update t_goods_label
+    <set>
+      <if test="labelName != null">
+        label_name = #{labelName,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsLabel">
+    update t_goods_label
+    set label_name = #{labelName,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  
+  <!--  查询产品标签信息 lym -->
+  <select id="selectGoodsLabelByLabelName" parameterType="String" resultMap="BaseResultMap">
+     select 
+	    <include refid="Base_Column_List" />
+	    from t_goods_label
+      	where state = 1 AND label_name = #{labelName}
+  </select>
+  
+  <!--  查询产品关联标签信息  lym -->
+  <select id="selectListBygoodsBatchGuid" parameterType="String" resultMap="BaseResultMap">
+     select 
+	    <include refid="Base_Column_List" />
+	    from t_goods_label
+      	where state = 1 
+      		AND guid in (select fk_good_label_guid from t_goods_batch_label WHERE state =1 AND fk_goods_batch_guid = #{goodsBatchGuid,jdbcType=CHAR})
+  </select>
+  
+  <!-- 查询产品管理标签  lym -->
+  <select id="selectLabelNamesBygoodsBatchGuid" parameterType="String" resultType="String">
+     select 
+	    GROUP_CONCAT(label_name ORDER BY create_time)
+	    from t_goods_label
+      	where state = 1 
+      		AND guid in (select fk_good_label_guid from t_goods_batch_label WHERE state =1 AND fk_goods_batch_guid = #{goodsBatchGuid,jdbcType=CHAR})
+  </select>
+</mapper>

+ 246 - 0
src/main/resources/mappers/GoodsProInputsMapper.xml

@@ -0,0 +1,246 @@
+<?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.hcloud.microservice.goods.dao.GoodsProInputsMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsProInputs">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="fk_goods_batch_guid" jdbcType="CHAR" property="fkGoodsBatchGuid" />
+    <result column="pro_inputs_no" jdbcType="CHAR" property="proInputsNo" />
+    <result column="pro_inputs_name" jdbcType="CHAR" property="proInputsName" />
+    <result column="inputs_process_name" jdbcType="VARCHAR" property="inputsProcessName" />
+    <result column="inputs_time" jdbcType="TIMESTAMP" property="inputsTime" />
+    <result column="input_do_user" jdbcType="VARCHAR" property="inputDoUser" />
+    <result column="input_provider_user" jdbcType="VARCHAR" property="inputProviderUser" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_org_guid, fk_goods_batch_guid, pro_inputs_no, pro_inputs_name, inputs_process_name, 
+    inputs_time, input_do_user, input_provider_user, state, create_user, create_time, 
+    modified_user, modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_pro_inputs
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <select id="searchProInputsByPage" parameterType="com.hcloud.microserver.commoncore.base.PageBean" resultMap="BaseResultMap">
+    select
+      <include refid="Base_Column_List" />
+    from t_goods_pro_inputs
+    where
+    data.state=1
+    <if test="data.fkOrgGuid!=null and data.fkOrgGuid!=''">
+      and fk_org_guid = #{data.fkOrgGuid,jdbcType=CHAR}
+    </if>
+    <if test="data.fkGoodsBatchGuid!=null and data.fkGoodsBatchGuid!=''">
+     and fk_goods_batch_guid = #{data.fkGoodsBatchGuid,jdbcType=CHAR}
+    </if>
+    <if test="data.proInputsName!=null and data.proInputsName!=''">
+     and pro_inputs_name = #{data.proInputsName,jdbcType=CHAR}
+    </if>
+    <if test="data.inputsProcessName!=null and data.inputsProcessName!=''">
+     and inputs_process_name = #{data.inputsProcessName,jdbcType=CHAR}
+    </if>
+  </select>
+
+    <select id="searchProInputsByBatchGuid" parameterType="java.lang.String" resultMap="BaseResultMap">
+      select
+      <include refid="Base_Column_List" />
+      from t_goods_pro_inputs
+      where fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR}
+      order by inputs_time desc
+    </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+      delete from t_goods_pro_inputs
+      where guid = #{guid,jdbcType=CHAR}
+    </delete>
+    <delete id="delProInputsByFK">
+      delete from t_goods_pro_inputs
+      where fk_goods_batch_guid = #{batid}
+    </delete>
+    <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsProInputs">
+    insert into t_goods_pro_inputs (guid, fk_org_guid, fk_goods_batch_guid, 
+      pro_inputs_no, pro_inputs_name, inputs_process_name, 
+      inputs_time, input_do_user, input_provider_user, 
+      state, create_user, create_time, 
+      modified_user, modified_time)
+    values (#{guid,jdbcType=CHAR}, #{fkOrgGuid,jdbcType=CHAR}, #{fkGoodsBatchGuid,jdbcType=CHAR}, 
+      #{proInputsNo,jdbcType=CHAR}, #{proInputsName,jdbcType=CHAR}, #{inputsProcessName,jdbcType=VARCHAR}, 
+      #{inputsTime,jdbcType=TIMESTAMP}, #{inputDoUser,jdbcType=VARCHAR}, #{inputProviderUser,jdbcType=VARCHAR}, 
+      #{state,jdbcType=INTEGER}, #{createUser,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, 
+      #{modifiedUser,jdbcType=CHAR}, #{modifiedTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsProInputs">
+    insert into t_goods_pro_inputs
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid,
+      </if>
+      <if test="proInputsNo != null">
+        pro_inputs_no,
+      </if>
+      <if test="proInputsName != null">
+        pro_inputs_name,
+      </if>
+      <if test="inputsProcessName != null">
+        inputs_process_name,
+      </if>
+      <if test="inputsTime != null">
+        inputs_time,
+      </if>
+      <if test="inputDoUser != null">
+        input_do_user,
+      </if>
+      <if test="inputProviderUser != null">
+        input_provider_user,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="proInputsNo != null">
+        #{proInputsNo,jdbcType=CHAR},
+      </if>
+      <if test="proInputsName != null">
+        #{proInputsName,jdbcType=CHAR},
+      </if>
+      <if test="inputsProcessName != null">
+        #{inputsProcessName,jdbcType=VARCHAR},
+      </if>
+      <if test="inputsTime != null">
+        #{inputsTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="inputDoUser != null">
+        #{inputDoUser,jdbcType=VARCHAR},
+      </if>
+      <if test="inputProviderUser != null">
+        #{inputProviderUser,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <insert id="batchSaveProInputs">
+     insert into t_goods_pro_inputs (guid, fk_org_guid, fk_goods_batch_guid,
+    pro_inputs_name, inputs_process_name,
+    inputs_time, input_do_user, input_provider_user,
+    state, create_user, create_time,
+    modified_user, modified_time)values
+    <foreach collection="list" item="bean" open="" separator="," close="">
+      (REPLACE(UUID(),'-',''), #{bean.fkOrgGuid,jdbcType=CHAR}, #{bean.fkGoodsBatchGuid,jdbcType=CHAR},
+      #{bean.proInputsName,jdbcType=CHAR}, #{bean.inputsProcessName,jdbcType=VARCHAR},
+      #{bean.inputsTime,jdbcType=TIMESTAMP}, #{bean.inputDoUser,jdbcType=VARCHAR},
+      #{bean.inputProviderUser,jdbcType=VARCHAR},#{bean.state,jdbcType=INTEGER}, #{bean.createUser,jdbcType=CHAR},
+      #{bean.createTime,jdbcType=TIMESTAMP},#{bean.modifiedUser,jdbcType=CHAR}, #{bean.modifiedTime,jdbcType=TIMESTAMP})
+    </foreach>
+  </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsProInputs">
+    update t_goods_pro_inputs
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="proInputsNo != null">
+        pro_inputs_no = #{proInputsNo,jdbcType=CHAR},
+      </if>
+      <if test="proInputsName != null">
+        pro_inputs_name = #{proInputsName,jdbcType=CHAR},
+      </if>
+      <if test="inputsProcessName != null">
+        inputs_process_name = #{inputsProcessName,jdbcType=VARCHAR},
+      </if>
+      <if test="inputsTime != null">
+        inputs_time = #{inputsTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="inputDoUser != null">
+        input_do_user = #{inputDoUser,jdbcType=VARCHAR},
+      </if>
+      <if test="inputProviderUser != null">
+        input_provider_user = #{inputProviderUser,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsProInputs">
+    update t_goods_pro_inputs
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      pro_inputs_no = #{proInputsNo,jdbcType=CHAR},
+      pro_inputs_name = #{proInputsName,jdbcType=CHAR},
+      inputs_process_name = #{inputsProcessName,jdbcType=VARCHAR},
+      inputs_time = #{inputsTime,jdbcType=TIMESTAMP},
+      input_do_user = #{inputDoUser,jdbcType=VARCHAR},
+      input_provider_user = #{inputProviderUser,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+</mapper>

+ 248 - 0
src/main/resources/mappers/GoodsProNormalMapper.xml

@@ -0,0 +1,248 @@
+<?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.hcloud.microservice.goods.dao.GoodsProNormalMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsProNormal">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="fk_goods_batch_guid" jdbcType="CHAR" property="fkGoodsBatchGuid" />
+    <result column="process_type" jdbcType="INTEGER" property="processType" />
+    <result column="process_item" jdbcType="VARCHAR" property="processItem" />
+    <result column="process_time" jdbcType="TIMESTAMP" property="processTime" />
+    <result column="process_user" jdbcType="VARCHAR" property="processUser" />
+    <result column="process_desc" jdbcType="VARCHAR" property="processDesc" />
+    <result column="process_address" jdbcType="VARCHAR" property="processAddress" />
+    <result column="process_imgs" jdbcType="VARCHAR" property="processImgs" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_org_guid, fk_goods_batch_guid, process_type, process_item, process_time, 
+    process_user, process_desc, process_address,process_imgs ,state, create_user, create_time,
+    modified_user,modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_pro_normal
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <select id="searchProNormalByPage" parameterType="com.hcloud.microserver.commoncore.base.PageBean"  resultMap="BaseResultMap">
+    select
+      <include refid="Base_Column_List" />
+    from t_goods_pro_normal
+    where state=1
+      <if test="data.fkOrgGuid!=null and data.fkOrgGuid!=''">
+        and fk_org_guid = #{data.fkOrgGuid,jdbcType=CHAR}
+      </if>
+      <if test="data.fkGoodsBatchGuid!=null and data.fkGoodsBatchGuid!=''">
+        and fk_goods_batch_guid = #{data.fkGoodsBatchGuid,jdbcType=CHAR}
+      </if>
+  </select>
+  <select id="searchProNormalByFK"  resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from t_goods_pro_normal
+    where fk_goods_batch_guid = #{batid} and process_type=#{type}
+    order by process_time desc
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_pro_normal
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+    <delete id="delProNormalByFK">
+    delete from t_goods_pro_normal
+    where fk_goods_batch_guid = #{batid}
+    </delete>
+    <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsProNormal">
+    insert into t_goods_pro_normal (guid, fk_org_guid, fk_goods_batch_guid, 
+      process_type, process_item, process_time, 
+      process_user, process_desc, process_address,
+      process_imgs,state, create_user, create_time,
+      modified_user, modified_time)
+    values (#{guid,jdbcType=CHAR}, #{fkOrgGuid,jdbcType=CHAR}, #{fkGoodsBatchGuid,jdbcType=CHAR}, 
+      #{processType,jdbcType=INTEGER}, #{processItem,jdbcType=VARCHAR}, #{processTime,jdbcType=TIMESTAMP}, 
+      #{processUser,jdbcType=VARCHAR}, #{processDesc,jdbcType=VARCHAR}, #{processAddress,jdbcType=VARCHAR},
+      #{processImgs,jdbcType=VARCHAR},#{state,jdbcType=INTEGER}, #{createUser,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP},
+      #{modifiedUser,jdbcType=CHAR}, #{modifiedTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsProNormal">
+    insert into t_goods_pro_normal
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid,
+      </if>
+      <if test="processType != null">
+        process_type,
+      </if>
+      <if test="processItem != null">
+        process_item,
+      </if>
+      <if test="processTime != null">
+        process_time,
+      </if>
+      <if test="processUser != null">
+        process_user,
+      </if>
+      <if test="processDesc != null">
+        process_desc,
+      </if>
+      <if test="processAddress != null">
+        process_address,
+      </if>
+      <if test="processImgs != null">
+        process_imgs,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="processType != null">
+        #{processType,jdbcType=INTEGER},
+      </if>
+      <if test="processItem != null">
+        #{processItem,jdbcType=VARCHAR},
+      </if>
+      <if test="processTime != null">
+        #{processTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="processUser != null">
+        #{processUser,jdbcType=VARCHAR},
+      </if>
+      <if test="processDesc != null">
+        #{processDesc,jdbcType=VARCHAR},
+      </if>
+      <if test="processAddress != null">
+        #{processAddress,jdbcType=VARCHAR},
+      </if>
+      <if test="processImgs != null">
+        #{processImgs,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+    <insert id="batchSaveProNormal">
+       insert into t_goods_pro_normal (guid, fk_org_guid, fk_goods_batch_guid,
+      process_type, process_item, process_time,
+      process_user, process_desc, process_address,
+      process_imgs,state, create_user, create_time,
+      modified_user, modified_time)values
+      <foreach collection="list" item="bean" open="" separator="," close="">
+      (REPLACE(UUID(),'-',''), #{bean.fkOrgGuid,jdbcType=CHAR}, #{bean.fkGoodsBatchGuid,jdbcType=CHAR},
+      #{bean.processType,jdbcType=INTEGER}, #{bean.processItem,jdbcType=VARCHAR}, #{bean.processTime,jdbcType=TIMESTAMP},
+      #{bean.processUser,jdbcType=VARCHAR}, #{bean.processDesc,jdbcType=VARCHAR}, #{bean.processAddress,jdbcType=VARCHAR},
+      #{bean.processImgs,jdbcType=VARCHAR},#{bean.state,jdbcType=INTEGER}, #{bean.createUser,jdbcType=CHAR}, #{bean.createTime,jdbcType=TIMESTAMP},
+      #{bean.modifiedUser,jdbcType=CHAR}, #{bean.modifiedTime,jdbcType=TIMESTAMP})
+      </foreach>
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsProNormal">
+    update t_goods_pro_normal
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="processType != null">
+        process_type = #{processType,jdbcType=INTEGER},
+      </if>
+      <if test="processItem != null">
+        process_item = #{processItem,jdbcType=VARCHAR},
+      </if>
+      <if test="processTime != null">
+        process_time = #{processTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="processUser != null">
+        process_user = #{processUser,jdbcType=VARCHAR},
+      </if>
+      <if test="processDesc != null">
+        process_desc = #{processDesc,jdbcType=VARCHAR},
+      </if>
+      <if test="processAddress != null">
+        process_address = #{processAddress,jdbcType=VARCHAR},
+      </if>
+      <if test="processImgs != null">
+        process_imgs = #{processImgs,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsProNormal">
+    update t_goods_pro_normal
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      process_type = #{processType,jdbcType=INTEGER},
+      process_item = #{processItem,jdbcType=VARCHAR},
+      process_time = #{processTime,jdbcType=TIMESTAMP},
+      process_user = #{processUser,jdbcType=VARCHAR},
+      process_desc = #{processDesc,jdbcType=VARCHAR},
+      process_address = #{processAddress,jdbcType=VARCHAR},
+      process_imgs = #{processImgs,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+</mapper>

+ 393 - 0
src/main/resources/mappers/GoodsQRCodeInfoMapper.xml

@@ -0,0 +1,393 @@
+<?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.hcloud.microservice.goods.dao.GoodsQRCodeInfoMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsQRCodeInfo">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="fk_goods_guid" jdbcType="CHAR" property="fkGoodsGuid" />
+    <result column="fk_batch_record_guid" jdbcType="CHAR" property="fkBatchRecordGuid" />
+    <result column="qrcode" jdbcType="VARCHAR" property="qrcode" />
+    <result column="qrcode_token" jdbcType="VARCHAR" property="qrcodeToken" />
+    <result column="qrcode_url" jdbcType="VARCHAR" property="qrcodeUrl" />
+    <result column="qrcode_img" jdbcType="VARCHAR" property="qrcodeImg" />
+    <result column="scan_count" jdbcType="INTEGER" property="scanCount" />
+    <result column="scan_first_timed" jdbcType="TIMESTAMP" property="scanFirstTimed" />
+    <result column="scan_last_timed" jdbcType="TIMESTAMP" property="scanLastTimed" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="VARCHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_org_guid, fk_goods_guid, fk_batch_record_guid, qrcode, qrcode_token, qrcode_url, 
+    qrcode_img, scan_count,scan_first_timed,scan_last_timed,state, create_user, create_time,
+    modified_user, modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_qrcode_info
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <select id="queryGoodsQRCodeInfoByRecId" resultType="com.hcloud.microservice.goods.bo.GoodsQRCodeInfoBO">
+    SELECT
+        aa.guid,
+        bb.goods_name AS goodsName,
+        aa.qrcode AS qrcode,
+        dd.goods_parent_qrcode AS qrcodeParentCode,
+        aa.qrcode_img AS qrcodeImg,
+        aa.qrcode_token AS qrcodeToken,
+        aa.qrcode_url AS qrcodeUrl,
+        aa.scan_count AS scanCount,
+        aa.scan_first_timed AS scanFirstTimed,
+        aa.scan_last_timed AS scanLastTimed
+    FROM
+        t_goods_qrcode_info aa
+    LEFT JOIN t_goods_info bb ON aa.fk_goods_guid = bb.guid
+    LEFT JOIN t_goods_qrcode_record dd ON aa.fk_batch_record_guid = dd.guid
+    WHERE
+    aa.state=1
+    AND aa.fk_batch_record_guid = #{recodeId,jdbcType=CHAR}
+  </select>
+
+  <select id="getGoodsQRInfoByQrToken" resultType="com.hcloud.microservice.goods.bo.GoodsQRCodeInfoBO">
+    SELECT
+        aa.guid,
+        aa.fk_org_guid AS fkOrgGuid,
+        aa.fk_batch_record_guid AS fkBatchRecordGuid,
+        aa.fk_goods_guid AS fkGoodsGuid,
+        bb.goods_name AS goodsName,
+        aa.qrcode AS qrcode,
+        dd.goods_parent_qrcode AS qrcodeParentCode,
+        aa.qrcode_img AS qrcodeImg,
+        aa.qrcode_token AS qrcodeToken,
+        aa.qrcode_url AS qrcodeUrl,
+        aa.scan_count AS scanCount,
+        aa.scan_first_timed AS scanFirstTimed,
+        aa.scan_last_timed AS scanLastTimed,
+        hh.company_url AS companyUrl,
+        hh.company_tel AS companyTel,
+        hh.qq_code AS qqCode,
+        hh.wx_qr_img AS wxQRImg,
+        hh.org_address AS orgAddress,
+        hh.org_name AS orgName,
+        hh.principals AS principals,
+        hh.tel AS tel,
+        hh.remark AS remark,
+        hh.ico AS ico,
+        hh.tmall_url AS tmallUrl,
+        hh.jd_url AS jdUrl,
+        hh.qualifica_imgs AS qualificaImgs
+    FROM
+        t_goods_qrcode_info aa
+    LEFT JOIN t_goods_info bb ON aa.fk_goods_guid = bb.guid
+    LEFT JOIN t_goods_qrcode_record dd ON aa.fk_batch_record_guid = dd.guid
+    LEFT JOIN t_base_org hh ON hh.guid = aa.fk_org_guid
+    WHERE
+    aa.state=1
+    AND aa.qrcode_token = #{qrToken,jdbcType=VARCHAR}
+  </select>
+
+    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_qrcode_info
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+
+  <delete id="delQRCodeInfoByRecordId">
+     delete from t_goods_qrcode_info
+    where fk_batch_record_guid = #{recordId,jdbcType=CHAR}
+  </delete>
+
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsQRCodeInfo">
+    insert into t_goods_qrcode_info (guid, fk_org_guid, fk_goods_guid, 
+      fk_batch_record_guid, qrcode, qrcode_token, 
+      qrcode_url, qrcode_img, scan_count,scan_first_timed,scan_last_timed,
+      state,create_user, create_time, modified_user, modified_time)
+    values (#{guid,jdbcType=CHAR}, #{fkOrgGuid,jdbcType=CHAR}, #{fkGoodsGuid,jdbcType=CHAR}, 
+      #{fkBatchRecordGuid,jdbcType=CHAR}, #{qrcode,jdbcType=VARCHAR}, #{qrcodeToken,jdbcType=VARCHAR}, 
+      #{qrcodeUrl,jdbcType=VARCHAR}, #{qrcodeImg,jdbcType=VARCHAR},#{scanCount,jdbcType=INTEGER} ,
+      #{scanFirstTimed,jdbcType=TIMESTAMP},#{scanLastTimed,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER},
+      #{createUser,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, #{modifiedUser,jdbcType=VARCHAR}, 
+      #{modifiedTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsQRCodeInfo">
+    insert into t_goods_qrcode_info
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="fkGoodsGuid != null">
+        fk_goods_guid,
+      </if>
+      <if test="fkBatchRecordGuid != null">
+        fk_batch_record_guid,
+      </if>
+      <if test="qrcode != null">
+        qrcode,
+      </if>
+      <if test="qrcodeToken != null">
+        qrcode_token,
+      </if>
+      <if test="qrcodeUrl != null">
+        qrcode_url,
+      </if>
+      <if test="qrcodeImg != null">
+        qrcode_img,
+      </if>
+      <if test="scanCount != null">
+        scan_count,
+      </if>
+      <if test="scanFirstTimed != null">
+        scan_first_timed,
+      </if>
+      <if test="scanLastTimed != null">
+        scan_last_timed,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsGuid != null">
+        #{fkGoodsGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkBatchRecordGuid != null">
+        #{fkBatchRecordGuid,jdbcType=CHAR},
+      </if>
+      <if test="qrcode != null">
+        #{qrcode,jdbcType=VARCHAR},
+      </if>
+      <if test="qrcodeToken != null">
+        #{qrcodeToken,jdbcType=VARCHAR},
+      </if>
+      <if test="qrcodeUrl != null">
+        #{qrcodeUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="qrcodeImg != null">
+        #{qrcodeImg,jdbcType=VARCHAR},
+      </if>
+      <if test="scanCount != null">
+        #{scanCount,jdbcType=INTEGER},
+      </if>
+      <if test="scanFirstTimed != null">
+        #{scanFirstTimed,jdbcType=TIMESTAMP},
+      </if>
+      <if test="scanLastTimed != null">
+        #{scanLastTimed,jdbcType=TIMESTAMP},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=VARCHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+    <insert id="batchSaveQRCodeInfo">
+      insert into t_goods_qrcode_info (guid, fk_org_guid, fk_goods_guid,
+      fk_batch_record_guid, qrcode, qrcode_token,
+      qrcode_url, qrcode_img, scan_count,scan_first_timed,scan_last_timed,
+      state,create_user, create_time, modified_user, modified_time)
+    values
+    <foreach collection="list" item="bean" open="" separator="," close="">
+      (REPLACE(UUID(),'-',''), #{bean.fkOrgGuid,jdbcType=CHAR}, #{bean.fkGoodsGuid,jdbcType=CHAR},
+      #{bean.fkBatchRecordGuid,jdbcType=CHAR}, #{bean.qrcode,jdbcType=VARCHAR}, #{bean.qrcodeToken,jdbcType=VARCHAR},
+      #{bean.qrcodeUrl,jdbcType=VARCHAR}, #{bean.qrcodeImg,jdbcType=VARCHAR},#{bean.scanCount,jdbcType=INTEGER} ,
+      #{bean.scanFirstTimed,jdbcType=TIMESTAMP},#{bean.scanLastTimed,jdbcType=TIMESTAMP},#{bean.state,jdbcType=INTEGER},
+      #{bean.createUser,jdbcType=CHAR}, #{bean.createTime,jdbcType=TIMESTAMP}, #{bean.modifiedUser,jdbcType=VARCHAR},
+      #{bean.modifiedTime,jdbcType=TIMESTAMP})
+    </foreach>
+
+
+    </insert>
+    <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsQRCodeInfo">
+    update t_goods_qrcode_info
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsGuid != null">
+        fk_goods_guid = #{fkGoodsGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkBatchRecordGuid != null">
+        fk_batch_record_guid = #{fkBatchRecordGuid,jdbcType=CHAR},
+      </if>
+      <if test="qrcode != null">
+        qrcode = #{qrcode,jdbcType=VARCHAR},
+      </if>
+      <if test="qrcodeToken != null">
+        qrcode_token = #{qrcodeToken,jdbcType=VARCHAR},
+      </if>
+      <if test="qrcodeUrl != null">
+        qrcode_url = #{qrcodeUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="qrcodeImg != null">
+        qrcode_img = #{qrcodeImg,jdbcType=VARCHAR},
+      </if>
+      <if test="scanCount != null">
+        scan_count=#{scanCount,jdbcType=INTEGER},
+      </if>
+      <if test="scanFirstTimed != null">
+        scan_first_timed=#{scanFirstTimed,jdbcType=TIMESTAMP},
+      </if>
+      <if test="scanLastTimed != null">
+        scan_last_timed=#{scanLastTimed,jdbcType=TIMESTAMP},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=VARCHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsQRCodeInfo">
+    update t_goods_qrcode_info
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      fk_goods_guid = #{fkGoodsGuid,jdbcType=CHAR},
+      fk_batch_record_guid = #{fkBatchRecordGuid,jdbcType=CHAR},
+      qrcode = #{qrcode,jdbcType=VARCHAR},
+      qrcode_token = #{qrcodeToken,jdbcType=VARCHAR},
+      qrcode_url = #{qrcodeUrl,jdbcType=VARCHAR},
+      qrcode_img = #{qrcodeImg,jdbcType=VARCHAR},
+      scan_count=#{scanCount,jdbcType=INTEGER},
+      scan_first_timed=#{scanFirstTimed,jdbcType=TIMESTAMP},
+      scan_last_timed=#{scanLastTimed,jdbcType=TIMESTAMP},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=VARCHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateGoodsQRCodeInfoByRecord" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsQRCodeInfo">
+    update t_goods_qrcode_info
+    <set>
+      <if test="qrcode != null">
+        qrcode = #{qrcode,jdbcType=VARCHAR},
+      </if>
+      <if test="qrcodeToken != null">
+        qrcode_token = #{qrcodeToken,jdbcType=VARCHAR},
+      </if>
+      <if test="qrcodeUrl != null">
+        qrcode_url = #{qrcodeUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="qrcodeImg != null">
+        qrcode_img = #{qrcodeImg,jdbcType=VARCHAR},
+      </if>
+      <if test="scanCount != null">
+        scan_count=#{scanCount,jdbcType=INTEGER},
+      </if>
+      <if test="scanFirstTimed != null">
+        scan_first_timed=#{scanFirstTimed,jdbcType=TIMESTAMP},
+      </if>
+      <if test="scanLastTimed != null">
+        scan_last_timed=#{scanLastTimed,jdbcType=TIMESTAMP},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=VARCHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where fk_batch_record_guid = #{fkBatchRecordGuid,jdbcType=CHAR}
+  </update>
+  <update id="batchUpdateGoodsQRCodeInfoByRecord">
+     update t_goods_qrcode_info
+        set state = 0,modified_time = NOW()
+      where fk_batch_record_guid in
+      <foreach collection="list" item="guid" open="(" separator="," close=")">
+         #{guid}
+      </foreach>
+  </update>
+  
+  <!-- 通过生成记录Id查询打印溯源码信息  lym -->
+  <select id="getPrintGoodsQRInfo" parameterType="com.hcloud.microservice.goods.facade.forms.GoodsQRCodeInfoForm"
+  	 resultType="com.hcloud.microservice.goods.bo.GoodsQRCodeInfoBO">
+    SELECT
+        aa.guid,
+        bb.goods_name AS goodsName,
+        aa.qrcode AS qrcode,
+        dd.goods_parent_qrcode AS qrcodeParentCode,
+        aa.qrcode_img AS qrcodeImg,
+        aa.qrcode_token AS qrcodeToken,
+        aa.qrcode_url AS qrcodeUrl,
+        hh.company_url AS companyUrl,
+        hh.company_tel AS companyTel,
+        hh.org_address AS orgAddress,
+        hh.org_name AS orgName,
+        CONCAT("/images/",dd.goods_parent_qrcode,"/",aa.qrcode_img) AS qrImgUrl
+    FROM
+        t_goods_qrcode_info aa
+    LEFT JOIN t_goods_info bb ON aa.fk_goods_guid = bb.guid
+    LEFT JOIN t_goods_qrcode_record dd ON aa.fk_batch_record_guid = dd.guid
+    LEFT JOIN t_base_org hh ON hh.guid = aa.fk_org_guid
+    WHERE
+    aa.state=1 AND aa.is_print = 0
+    AND aa.fk_batch_record_guid = #{fkBatchRecordGuid,jdbcType=CHAR}
+  </select>
+  
+  <!-- 修改是否打印状态  lym -->
+  <update id="updateQRIsPrint" parameterType="list">
+  	 update t_goods_qrcode_info set is_print = 1
+  	   <where>
+  	   	  <if test="ids != null">
+  	   	  	guid in
+  	   	  	<foreach collection="ids" item="id" separator="," open="(" close=")">
+		      #{id}
+		    </foreach>
+  	   	  </if>
+  	   </where>
+  </update>
+</mapper>

+ 350 - 0
src/main/resources/mappers/GoodsQRCodeRecordMapper.xml

@@ -0,0 +1,350 @@
+<?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.hcloud.microservice.goods.dao.GoodsQRCodeRecordMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsQRCodeRecord">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="fk_goods_batch_guid" jdbcType="CHAR" property="fkGoodsBatchGuid" />
+    <result column="goods_parent_qrcode" jdbcType="VARCHAR" property="goodsParentQrcode" />
+    <result column="qrcode_record_time" jdbcType="TIMESTAMP" property="qrcodeRecordTime" />
+    <result column="origin_num" jdbcType="INTEGER" property="originNum" />
+    <result column="cancel_num" jdbcType="INTEGER" property="cancelNum" />
+    <result column="used_num" jdbcType="INTEGER" property="usedNum" />
+    <result column="scan_num" jdbcType="INTEGER" property="scanNum" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, fk_org_guid, fk_goods_batch_guid, goods_parent_qrcode, qrcode_record_time, 
+    origin_num, cancel_num, used_num, scan_num, state, create_user, create_time, modified_user, 
+    modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_qrcode_record
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+  <select id="searchByPage" parameterType="com.hcloud.microserver.commoncore.base.PageBean"
+          resultType="com.hcloud.microservice.goods.bo.GoodsQRCodeRecordBO">
+    SELECT
+        aa.guid,
+        bb.goods_batch_no AS goodsBatchNo,
+        bb.goods_name AS goodsName,
+        aa.goods_parent_qrcode AS goodsParentQrcode,
+        DATE_FORMAT(aa.qrcode_record_time,'%Y-%m-%d') AS qrcodeRecordTime,
+        aa.origin_num AS originNum,
+        aa.cancel_num AS cancelNum,
+        aa.used_num AS usedNum,
+        aa.scan_num AS scanNum,
+        cc.temple_type AS templeType,
+		(SELECT COUNT(guid) FROM t_goods_qrcode_info WHERE state = 1 AND fk_batch_record_guid = aa.guid) AS qrTotalNum,
+        (SELECT COUNT(guid) FROM t_goods_qrcode_info WHERE state = 1 AND fk_batch_record_guid = aa.guid AND is_print = 1) AS printNum
+    FROM
+        t_goods_qrcode_record aa
+    LEFT JOIN t_goods_batch_info bb ON aa.fk_goods_batch_guid = bb.guid
+    LEFT JOIN t_base_org cc ON aa.fk_org_guid = cc.guid
+    WHERE
+        aa.fk_org_guid=#{data.fkOrgGuid}
+        <if test="data.goodsName!=null and data.goodsName!=null">
+         AND bb.goods_name LIKE CONCAT('%',#{data.goodsName},'%')
+        </if>
+        <if test="data.goodsParentQrcode!=null and data.goodsParentQrcode!=''">
+          AND aa.goods_parent_qrcode = #{data.goodsParentQrcode}
+        </if>
+        <if test="data.goodsBatchNo!=null and data.goodsBatchNo!=''">
+          AND bb.goods_batch_no = #{data.goodsBatchNo}
+        </if>
+      order by aa.create_time desc
+  </select>
+  <select id="getMaxParentCode" resultType="java.lang.String">
+    select
+      max(bb.goods_parent_qrcode)
+    from
+      t_goods_qrcode_record bb
+    where
+      bb.goods_parent_qrcode like concat(#{parentCode},'%')
+  </select>
+  <select id="getGoodsQRCodeRecordByBatchId" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from t_goods_qrcode_record
+    where fk_goods_batch_guid = #{batchId,jdbcType=CHAR}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_qrcode_record
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+    <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsQRCodeRecord">
+    insert into t_goods_qrcode_record (guid, fk_org_guid, fk_goods_batch_guid, 
+      goods_parent_qrcode, qrcode_record_time, 
+      origin_num, cancel_num, used_num, 
+      scan_num, state, create_user, 
+      create_time, modified_user, modified_time
+      )
+    values (#{guid,jdbcType=CHAR}, #{fkOrgGuid,jdbcType=CHAR}, #{fkGoodsBatchGuid,jdbcType=CHAR}, 
+      #{goodsParentQrcode,jdbcType=VARCHAR}, #{qrcodeRecordTime,jdbcType=TIMESTAMP}, 
+      #{originNum,jdbcType=INTEGER}, #{cancelNum,jdbcType=INTEGER}, #{usedNum,jdbcType=INTEGER}, 
+      #{scanNum,jdbcType=INTEGER}, #{state,jdbcType=INTEGER}, #{createUser,jdbcType=CHAR}, 
+      #{createTime,jdbcType=TIMESTAMP}, #{modifiedUser,jdbcType=CHAR}, #{modifiedTime,jdbcType=TIMESTAMP}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsQRCodeRecord">
+    insert into t_goods_qrcode_record
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid,
+      </if>
+      <if test="goodsParentQrcode != null">
+        goods_parent_qrcode,
+      </if>
+      <if test="qrcodeRecordTime != null">
+        qrcode_record_time,
+      </if>
+      <if test="originNum != null">
+        origin_num,
+      </if>
+      <if test="cancelNum != null">
+        cancel_num,
+      </if>
+      <if test="usedNum != null">
+        used_num,
+      </if>
+      <if test="scanNum != null">
+        scan_num,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="goodsParentQrcode != null">
+        #{goodsParentQrcode,jdbcType=VARCHAR},
+      </if>
+      <if test="qrcodeRecordTime != null">
+        #{qrcodeRecordTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="originNum != null">
+        #{originNum,jdbcType=INTEGER},
+      </if>
+      <if test="cancelNum != null">
+        #{cancelNum,jdbcType=INTEGER},
+      </if>
+      <if test="usedNum != null">
+        #{usedNum,jdbcType=INTEGER},
+      </if>
+      <if test="scanNum != null">
+        #{scanNum,jdbcType=INTEGER},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsQRCodeRecord">
+    update t_goods_qrcode_record
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="fkGoodsBatchGuid != null">
+        fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      </if>
+      <if test="goodsParentQrcode != null">
+        goods_parent_qrcode = #{goodsParentQrcode,jdbcType=VARCHAR},
+      </if>
+      <if test="qrcodeRecordTime != null">
+        qrcode_record_time = #{qrcodeRecordTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="originNum != null">
+        origin_num = #{originNum,jdbcType=INTEGER},
+      </if>
+      <if test="cancelNum != null">
+        cancel_num = #{cancelNum,jdbcType=INTEGER},
+      </if>
+      <if test="usedNum != null">
+        used_num = #{usedNum,jdbcType=INTEGER},
+      </if>
+      <if test="scanNum != null">
+        scan_num = #{scanNum,jdbcType=INTEGER},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsQRCodeRecord">
+    update t_goods_qrcode_record
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      fk_goods_batch_guid = #{fkGoodsBatchGuid,jdbcType=CHAR},
+      goods_parent_qrcode = #{goodsParentQrcode,jdbcType=VARCHAR},
+      qrcode_record_time = #{qrcodeRecordTime,jdbcType=TIMESTAMP},
+      origin_num = #{originNum,jdbcType=INTEGER},
+      cancel_num = #{cancelNum,jdbcType=INTEGER},
+      used_num = #{usedNum,jdbcType=INTEGER},
+      scan_num = #{scanNum,jdbcType=INTEGER},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="batchUpdateGoodsQRCodeRecord" parameterType="java.util.List">
+    UPDATE t_goods_qrcode_record
+      SET cancel_num = origin_num,
+      state = 0,
+      modified_time = NOW()
+    WHERE guid IN
+     <foreach collection="list" item="batchId" open="(" separator="," close=")">
+       #{batchId}
+     </foreach>
+  </update>
+
+  <!-- 统计全年各月的扫码人数 -->
+  <select id="statQRCodeScanNumForOneYeaAllMonth" parameterType="com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordStatForm" resultType="com.hcloud.microservice.goods.facade.results.ScanNumStatResult">
+    select
+      ifnull(sum(case when month(qrcode_record_time) = 1 then scan_num else 0 end), 0) as 'january',
+      ifnull(sum(case when month(qrcode_record_time) = 2 then scan_num else 0 end), 0) as 'february',
+      ifnull(sum(case when month(qrcode_record_time) = 3 then scan_num else 0 end), 0) as 'march',
+      ifnull(sum(case when month(qrcode_record_time) = 4 then scan_num else 0 end), 0) as 'april',
+      ifnull(sum(case when month(qrcode_record_time) = 5 then scan_num else 0 end), 0) as 'may',
+      ifnull(sum(case when month(qrcode_record_time) = 6 then scan_num else 0 end), 0) as 'june',
+      ifnull(sum(case when month(qrcode_record_time) = 7 then scan_num else 0 end), 0) as 'july',
+      ifnull(sum(case when month(qrcode_record_time) = 8 then scan_num else 0 end), 0) as 'august',
+      ifnull(sum(case when month(qrcode_record_time) = 9 then scan_num else 0 end), 0) as 'september',
+      ifnull(sum(case when month(qrcode_record_time) = 10 then scan_num else 0 end), 0) as 'october',
+      ifnull(sum(case when month(qrcode_record_time) = 11 then scan_num else 0 end), 0) as 'november',
+      ifnull(sum(case when month(qrcode_record_time) = 12 then scan_num else 0 end), 0) as 'december'
+    from t_goods_qrcode_record
+    <where>
+        <if test="fkOrgGuid != null and fkOrgGuid != ''">
+            and fk_org_guid = #{fkOrgGuid,jdbcType=CHAR}
+        </if>
+        <if test="year != null">
+            and year(qrcode_record_time) = #{year,jdbcType=INTEGER}
+        </if>
+    </where>
+  </select>
+
+  <!-- 统计当天和历史累计的扫码人数 -->
+  <select id="statYesterdayAndAllTime" parameterType="com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordStatForm" resultType="com.hcloud.microservice.goods.facade.results.ScanNumStatResult">
+    select
+		IFNULL(SUM(a.scan_count),0) AS scanNum,
+		IFNULL(b.newScanNum,0) AS newScanNum
+	    from t_goods_qrcode_info a
+			LEFT JOIN (
+			SELECT SUM(scan_count) AS newScanNum,fk_org_guid FROM t_goods_qrcode_info 
+			WHERE state = 1 AND DATE_FORMAT(scan_last_timed,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
+			AND fk_org_guid = #{fkOrgGuid,jdbcType=CHAR}
+			GROUP BY fk_org_guid
+	
+		) b ON a.fk_org_guid = b.fk_org_guid
+    where a.fk_org_guid = #{fkOrgGuid,jdbcType=CHAR}
+	GROUP BY a.fk_org_guid
+  </select>
+
+  <!-- 统计一天24个整点,每个整点的扫码人数 -->
+  <select id="statOneDayAllHours" parameterType="com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordStatForm" resultType="com.hcloud.microservice.goods.facade.results.ScanNumStatResult">
+    select
+      hour(qrcode_record_time) as `hour`,
+      sum(scan_num) as scanNum
+    from t_goods_qrcode_record
+    where true
+        and fk_org_guid = #{fkOrgGuid,jdbcType=CHAR}
+        and date(qrcode_record_time) = curdate()
+    group by `hour`
+  </select>
+
+  <select id="statOneWeekSevenDays" parameterType="com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordStatForm" resultType="com.hcloud.microservice.goods.facade.results.ScanNumStatResult">
+    select
+      case dayofweek(qrcode_record_time) - 1 when 0 then 7 else dayofweek(qrcode_record_time) - 1 end as `dayOfWeek`,
+      sum(scan_num) as scanNum
+    from t_goods_qrcode_record
+    where true
+        and fk_org_guid = #{fkOrgGuid,jdbcType=CHAR}
+        and yearweek(qrcode_record_time, 1) = yearweek(curdate(), 1)
+    group by `dayOfWeek`
+  </select>
+
+  <select id="statOneMonthAllDays" parameterType="com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordStatForm" resultType="com.hcloud.microservice.goods.facade.results.ScanNumStatResult">
+  select
+	dayofmonth(qrcode_record_time) as `dayOfMonth`,
+    sum(scan_num) as scanNum
+  from t_goods_qrcode_record
+  where true
+      and fk_org_guid = #{fkOrgGuid,jdbcType=CHAR}
+      and month(qrcode_record_time) = month(curdate())
+  group by `dayOfMonth`
+  </select>
+  
+  <!-- 统计个月扫码人数 lym -->
+  <select id="statQRCodeScanNumByMonth" parameterType="com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordStatForm" resultType="com.hcloud.microservice.goods.facade.results.ScanNumStatisResult">
+    select month(scan_last_timed) AS date,SUM(scan_count) AS num
+    from t_goods_qrcode_info
+    <where>
+        <if test="fkOrgGuid != null and fkOrgGuid != ''">
+            and fk_org_guid = #{fkOrgGuid,jdbcType=CHAR}
+        </if>
+        <if test="year != null">
+            and year(scan_last_timed) = #{year,jdbcType=INTEGER}
+        </if>
+    </where>
+    GROUP BY fk_org_guid,month(scan_last_timed)
+  </select>
+</mapper>

+ 212 - 0
src/main/resources/mappers/GoodsTracedUserMapper.xml

@@ -0,0 +1,212 @@
+<?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.hcloud.microservice.goods.dao.GoodsTracedUserMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsTracedUser">
+    <id column="guid" jdbcType="CHAR" property="guid" />
+    <result column="traced_user_openid" jdbcType="VARCHAR" property="tracedUserOpenid" />
+    <result column="traced_tel" jdbcType="CHAR" property="tracedTel" />
+    <result column="traced_user_name" jdbcType="VARCHAR" property="tracedUserName" />
+    <result column="traced_user_mail" jdbcType="VARCHAR" property="tracedUserMail" />
+    <result column="traced_user_img" jdbcType="VARCHAR" property="tracedUserImg" />
+    <result column="traced_sex" jdbcType="INTEGER" property="tracedSex" />
+    <result column="traced_third_code" jdbcType="CHAR" property="tracedThirdCode" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="create_user" jdbcType="CHAR" property="createUser" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="modified_user" jdbcType="CHAR" property="modifiedUser" />
+    <result column="modified_time" jdbcType="TIMESTAMP" property="modifiedTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    guid, traced_user_openid, traced_tel, traced_user_name, traced_user_mail, traced_user_img, 
+    traced_sex, traced_third_code, state, create_user, create_time, modified_user, modified_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_traced_user
+    where guid = #{guid,jdbcType=CHAR}
+  </select>
+    <select id="searchTracedUserByPage" parameterType="com.hcloud.microserver.commoncore.base.PageBean" resultMap="BaseResultMap">
+      select
+        <include refid="Base_Column_List" />
+      from t_goods_traced_user
+      where state=1
+      <if test="data.tracedUserName!=null and data.tracedUserName!=''">
+        traced_user_name like concat(#{data.tracedUserName},'%')
+      </if>
+      <if test="data.tracedSex!=null ">
+        traced_sex =#{data.tracedSex}
+      </if>
+    </select>
+  <select id="searchTracedUserByCode"  parameterType="java.lang.String" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from t_goods_traced_user
+    where state = 1 
+     <if test="code != null">
+     	AND traced_third_code = #{code}
+     </if>
+     <if test="userOpenid != null">
+     	AND traced_user_openid = #{userOpenid}
+     </if>
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
+    delete from t_goods_traced_user
+    where guid = #{guid,jdbcType=CHAR}
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsTracedUser">
+    insert into t_goods_traced_user (guid, traced_user_openid, traced_tel, 
+      traced_user_name, traced_user_mail, traced_user_img, 
+      traced_sex, traced_third_code, state, 
+      create_user, create_time, modified_user, 
+      modified_time)
+    values (#{guid,jdbcType=CHAR}, #{tracedUserOpenid,jdbcType=VARCHAR}, #{tracedTel,jdbcType=CHAR}, 
+      #{tracedUserName,jdbcType=VARCHAR}, #{tracedUserMail,jdbcType=VARCHAR}, #{tracedUserImg,jdbcType=VARCHAR}, 
+      #{tracedSex,jdbcType=INTEGER}, #{tracedThirdCode,jdbcType=CHAR}, #{state,jdbcType=INTEGER}, 
+      #{createUser,jdbcType=CHAR}, #{createTime,jdbcType=TIMESTAMP}, #{modifiedUser,jdbcType=CHAR}, 
+      #{modifiedTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsTracedUser">
+    insert into t_goods_traced_user
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        guid,
+      </if>
+      <if test="tracedUserOpenid != null">
+        traced_user_openid,
+      </if>
+      <if test="tracedTel != null">
+        traced_tel,
+      </if>
+      <if test="tracedUserName != null">
+        traced_user_name,
+      </if>
+      <if test="tracedUserMail != null">
+        traced_user_mail,
+      </if>
+      <if test="tracedUserImg != null">
+        traced_user_img,
+      </if>
+      <if test="tracedSex != null">
+        traced_sex,
+      </if>
+      <if test="tracedThirdCode != null">
+        traced_third_code,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="createUser != null">
+        create_user,
+      </if>
+      <if test="createTime != null">
+        create_time,
+      </if>
+      <if test="modifiedUser != null">
+        modified_user,
+      </if>
+      <if test="modifiedTime != null">
+        modified_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="guid != null">
+        #{guid,jdbcType=CHAR},
+      </if>
+      <if test="tracedUserOpenid != null">
+        #{tracedUserOpenid,jdbcType=VARCHAR},
+      </if>
+      <if test="tracedTel != null">
+        #{tracedTel,jdbcType=CHAR},
+      </if>
+      <if test="tracedUserName != null">
+        #{tracedUserName,jdbcType=VARCHAR},
+      </if>
+      <if test="tracedUserMail != null">
+        #{tracedUserMail,jdbcType=VARCHAR},
+      </if>
+      <if test="tracedUserImg != null">
+        #{tracedUserImg,jdbcType=VARCHAR},
+      </if>
+      <if test="tracedSex != null">
+        #{tracedSex,jdbcType=INTEGER},
+      </if>
+      <if test="tracedThirdCode != null">
+        #{tracedThirdCode,jdbcType=CHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsTracedUser">
+    update t_goods_traced_user
+    <set>
+      <if test="tracedUserOpenid != null">
+        traced_user_openid = #{tracedUserOpenid,jdbcType=VARCHAR},
+      </if>
+      <if test="tracedTel != null">
+        traced_tel = #{tracedTel,jdbcType=CHAR},
+      </if>
+      <if test="tracedUserName != null">
+        traced_user_name = #{tracedUserName,jdbcType=VARCHAR},
+      </if>
+      <if test="tracedUserMail != null">
+        traced_user_mail = #{tracedUserMail,jdbcType=VARCHAR},
+      </if>
+      <if test="tracedUserImg != null">
+        traced_user_img = #{tracedUserImg,jdbcType=VARCHAR},
+      </if>
+      <if test="tracedSex != null">
+        traced_sex = #{tracedSex,jdbcType=INTEGER},
+      </if>
+      <if test="tracedThirdCode != null">
+        traced_third_code = #{tracedThirdCode,jdbcType=CHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="createUser != null">
+        create_user = #{createUser,jdbcType=CHAR},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="modifiedUser != null">
+        modified_user = #{modifiedUser,jdbcType=CHAR},
+      </if>
+      <if test="modifiedTime != null">
+        modified_time = #{modifiedTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsTracedUser">
+    update t_goods_traced_user
+    set traced_user_openid = #{tracedUserOpenid,jdbcType=VARCHAR},
+      traced_tel = #{tracedTel,jdbcType=CHAR},
+      traced_user_name = #{tracedUserName,jdbcType=VARCHAR},
+      traced_user_mail = #{tracedUserMail,jdbcType=VARCHAR},
+      traced_user_img = #{tracedUserImg,jdbcType=VARCHAR},
+      traced_sex = #{tracedSex,jdbcType=INTEGER},
+      traced_third_code = #{tracedThirdCode,jdbcType=CHAR},
+      state = #{state,jdbcType=INTEGER},
+      create_user = #{createUser,jdbcType=CHAR},
+      create_time = #{createTime,jdbcType=TIMESTAMP},
+      modified_user = #{modifiedUser,jdbcType=CHAR},
+      modified_time = #{modifiedTime,jdbcType=TIMESTAMP}
+    where guid = #{guid,jdbcType=CHAR}
+  </update>
+</mapper>

+ 117 - 0
src/main/resources/mappers/GoodsTypeMapper.xml

@@ -0,0 +1,117 @@
+<?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.hcloud.microservice.goods.dao.GoodsTypeMapper">
+  <resultMap id="BaseResultMap" type="com.hcloud.microservice.goods.facade.entity.GoodsType">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="fk_org_guid" jdbcType="CHAR" property="fkOrgGuid" />
+    <result column="parent_code" jdbcType="VARCHAR" property="parentCode" />
+    <result column="type_code" jdbcType="VARCHAR" property="typeCode" />
+    <result column="type_name" jdbcType="VARCHAR" property="typeName" />
+    <result column="state" jdbcType="INTEGER" property="state" />
+    <result column="modified" jdbcType="TIMESTAMP" property="modified" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, fk_org_guid, parent_code, type_code, type_name, state, modified
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_goods_type
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from t_goods_type
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsType">
+    insert into t_goods_type (id, fk_org_guid, parent_code, 
+      type_code, type_name, state, 
+      modified)
+    values (#{id,jdbcType=INTEGER}, #{fkOrgGuid,jdbcType=CHAR}, #{parentCode,jdbcType=VARCHAR}, 
+      #{typeCode,jdbcType=VARCHAR}, #{typeName,jdbcType=VARCHAR}, #{state,jdbcType=INTEGER}, 
+      #{modified,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsType">
+    insert into t_goods_type
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        id,
+      </if>
+      <if test="fkOrgGuid != null">
+        fk_org_guid,
+      </if>
+      <if test="parentCode != null">
+        parent_code,
+      </if>
+      <if test="typeCode != null">
+        type_code,
+      </if>
+      <if test="typeName != null">
+        type_name,
+      </if>
+      <if test="state != null">
+        state,
+      </if>
+      <if test="modified != null">
+        modified,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="id != null">
+        #{id,jdbcType=INTEGER},
+      </if>
+      <if test="fkOrgGuid != null">
+        #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="parentCode != null">
+        #{parentCode,jdbcType=VARCHAR},
+      </if>
+      <if test="typeCode != null">
+        #{typeCode,jdbcType=VARCHAR},
+      </if>
+      <if test="typeName != null">
+        #{typeName,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        #{state,jdbcType=INTEGER},
+      </if>
+      <if test="modified != null">
+        #{modified,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsType">
+    update t_goods_type
+    <set>
+      <if test="fkOrgGuid != null">
+        fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      </if>
+      <if test="parentCode != null">
+        parent_code = #{parentCode,jdbcType=VARCHAR},
+      </if>
+      <if test="typeCode != null">
+        type_code = #{typeCode,jdbcType=VARCHAR},
+      </if>
+      <if test="typeName != null">
+        type_name = #{typeName,jdbcType=VARCHAR},
+      </if>
+      <if test="state != null">
+        state = #{state,jdbcType=INTEGER},
+      </if>
+      <if test="modified != null">
+        modified = #{modified,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.hcloud.microservice.goods.facade.entity.GoodsType">
+    update t_goods_type
+    set fk_org_guid = #{fkOrgGuid,jdbcType=CHAR},
+      parent_code = #{parentCode,jdbcType=VARCHAR},
+      type_code = #{typeCode,jdbcType=VARCHAR},
+      type_name = #{typeName,jdbcType=VARCHAR},
+      state = #{state,jdbcType=INTEGER},
+      modified = #{modified,jdbcType=TIMESTAMP}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 54 - 0
src/main/resources/swagger-ui.html

@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="UTF-8">
+    <title>Swagger UI</title>
+    <link rel="icon" type="image/png" href="webjars/springfox-swagger-ui/images/favicon-32x32.png" sizes="32x32"/>
+    <link rel="icon" type="image/png" href="webjars/springfox-swagger-ui/images/favicon-16x16.png" sizes="16x16"/>
+    <link href='webjars/springfox-swagger-ui/css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
+    <link href='webjars/springfox-swagger-ui/css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
+    <link href='webjars/springfox-swagger-ui/css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
+    <link href='webjars/springfox-swagger-ui/css/reset.css' media='print' rel='stylesheet' type='text/css'/>
+    <link href='webjars/springfox-swagger-ui/css/print.css' media='print' rel='stylesheet' type='text/css'/>
+
+    <script src='webjars/springfox-swagger-ui/lib/object-assign-pollyfill.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/jquery-1.8.0.min.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/jquery.slideto.min.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/jquery.wiggle.min.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/handlebars-4.0.5.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/lodash.min.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/backbone-min.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/swagger-ui.min.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/highlight.9.1.0.pack.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/highlight.9.1.0.pack_extended.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/jsoneditor.min.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/marked.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lib/swagger-oauth.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/springfox.js' type='text/javascript'></script>
+
+    <!--国际化操作:选择中文版 -->
+    <script src='webjars/springfox-swagger-ui/lang/translator.js' type='text/javascript'></script>
+    <script src='webjars/springfox-swagger-ui/lang/zh-cn.js' type='text/javascript'></script>
+
+</head>
+
+<body class="swagger-section">
+<div id='header'>
+    <div class="swagger-ui-wrap">
+        <a id="logo" href="http://swagger.io">![](webjars/springfox-swagger-ui/images/logo_small.png)<span class="logo__title">swagger</span></a>
+        <form id='api_selector'>
+            <div class='input'>
+                <select id="select_baseUrl" name="select_baseUrl"></select>
+            </div>
+            <div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
+            <div id='auth_container'></div>
+            <div class='input'><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div>
+        </form>
+    </div>
+</div>
+
+<div id="message-bar" class="swagger-ui-wrap" data-sw-translate> </div>
+<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
+</body>
+</html>

+ 17 - 0
src/test/java/com/hcloud/microservice/goods/GoodsManageServiceApplicationTests.java

@@ -0,0 +1,17 @@
+package com.hcloud.microservice.goods;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class GoodsManageServiceApplicationTests {
+
+    @Test
+    public void contextLoads() {
+    }
+
+}
+

+ 70 - 0
src/test/java/com/hcloud/microservice/goods/controller/GoodsQRCodeInfoControllerTest.java

@@ -0,0 +1,70 @@
+package com.hcloud.microservice.goods.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeInfoForm;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.http.MediaType;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+
+import java.util.Date;
+
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
+
+@Slf4j
+@RunWith(SpringRunner.class)
+@SpringBootTest
+@AutoConfigureMockMvc
+public class GoodsQRCodeInfoControllerTest {
+
+    @Autowired
+    private MockMvc mockMvc;
+
+
+    @Test
+    public void searchGoodsQRCodeByPage() {
+
+    }
+
+    @Test
+    public void getGoodsQRCodeById() {
+
+    }
+
+    @Test
+    public void delGoodsQRCodeById() throws Exception {
+        GoodsQRCodeInfoForm codeForm = new GoodsQRCodeInfoForm();
+        codeForm.setGuid("8c2940003e5411e98964408d5c9b0a5c");
+        codeForm.setModifiedUser("d9278d25e4a94ee5bfdc2b8433279ad1");
+        codeForm.setModifiedTime(new Date());
+        MvcResult result = mockMvc.perform(post("/qrcode/info/delGoodsQRCodeById").
+                contentType(MediaType.APPLICATION_JSON_UTF8).
+                content(JSONObject.toJSONString(codeForm))).
+                andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)).
+                andExpect(status().isOk()).andReturn();
+        log.info("json===================>{}", result.getResponse().getContentAsString());
+    }
+
+    @Test
+    public void searchGoodsQRCodeForExport() {
+
+    }
+
+    @Test
+    public void searchGoodsQRCodeInfoByTokenStr() {
+
+    }
+
+    @Test
+    public void getGoodsQRCodeDetailInfoByToken() {
+
+    }
+}

+ 33 - 0
src/test/java/com/hcloud/microservice/goods/service/impl/GoodsBatchInfoServiceImplTest.java

@@ -0,0 +1,33 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.hcloud.microservice.goods.facade.forms.GoodsBatchInfoForm;
+import com.hcloud.microservice.goods.service.GoodsBatchInfoService;
+import lombok.extern.slf4j.Slf4j;
+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 static org.junit.Assert.*;
+
+@Slf4j
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class GoodsBatchInfoServiceImplTest {
+
+    @Autowired
+    private GoodsBatchInfoService goodsBatchInfoService;
+
+    @Test
+    public void addGoodsBatchInfo() {
+        GoodsBatchInfoForm goodsBatchInfoForm = new GoodsBatchInfoForm();
+        goodsBatchInfoService.addGoodsBatchInfo(goodsBatchInfoForm);
+
+    }
+
+    @Test
+    public void searchGoodsBatchInfoById() {
+
+    }
+}

+ 36 - 0
src/test/java/com/hcloud/microservice/goods/service/impl/GoodsQRCodeInfoServiceImplTest.java

@@ -0,0 +1,36 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeInfoForm;
+import com.hcloud.microservice.goods.service.GoodsQRCodeInfoService;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.Assert;
+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 java.util.Date;
+
+import static org.junit.Assert.*;
+
+@Slf4j
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class GoodsQRCodeInfoServiceImplTest {
+
+    @Autowired
+    private GoodsQRCodeInfoService goodsQRCodeInfoService;
+
+    @Test
+    public void forbiddenCodeInfoByCodeId() {
+        GoodsQRCodeInfoForm codeForm = new GoodsQRCodeInfoForm();
+        codeForm.setGuid("8c2940003e5411e98964408d5c9b0a5c");
+        codeForm.setModifiedUser("d9278d25e4a94ee5bfdc2b8433279ad1");
+        codeForm.setModifiedTime(new Date());
+        int i = goodsQRCodeInfoService.forbiddenCodeInfoByCodeId(codeForm);
+        if(i>0){
+            Assert.assertEquals(1,i);
+        }
+    }
+}

+ 79 - 0
src/test/java/com/hcloud/microservice/goods/service/impl/GoodsQRCodeRecordStatServiceImplTest.java

@@ -0,0 +1,79 @@
+package com.hcloud.microservice.goods.service.impl;
+
+import com.hcloud.microservice.goods.facade.forms.GoodsQRCodeRecordStatForm;
+import com.hcloud.microservice.goods.facade.results.ScanNumStatResult;
+import com.hcloud.microservice.goods.service.GoodsQRCodeRecordStatService;
+import lombok.extern.slf4j.Slf4j;
+import org.junit.Assert;
+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 java.util.List;
+
+@Slf4j
+@RunWith(SpringRunner.class)
+@SpringBootTest
+public class GoodsQRCodeRecordStatServiceImplTest {
+
+    @Autowired
+    private GoodsQRCodeRecordStatService goodsQRCodeRecordStatService;
+
+    @Test
+    public void testStatOneYearAllMonthData() {
+        GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm = new GoodsQRCodeRecordStatForm();
+        goodsQRCodeRecordStatForm.setFkOrgGuid("79c0f0a56d044d8a9b712c1c454e648f");
+        goodsQRCodeRecordStatForm.setYear(2019);
+        ScanNumStatResult result = null;//this.goodsQRCodeRecordStatService.statOneYearAllMonthData(goodsQRCodeRecordStatForm);
+        log.info("数据: {}", result);
+        Assert.assertNotNull(result);
+    }
+
+    @Test
+    public void testStatYesterdayAndAllTimeScanNumber() {
+        GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm = new GoodsQRCodeRecordStatForm();
+        goodsQRCodeRecordStatForm.setFkOrgGuid("79c0f0a56d044d8a9b712c1c454e648f");
+        List<ScanNumStatResult> results = this.goodsQRCodeRecordStatService.statYesterdayAndAllTimeData(goodsQRCodeRecordStatForm);
+        log.info("数据: {}", results);
+        Assert.assertNotNull(results);
+    }
+
+    @Test
+    public void testStatTodayScanNumber() {
+        GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm = new GoodsQRCodeRecordStatForm();
+        goodsQRCodeRecordStatForm.setFkOrgGuid("79c0f0a56d044d8a9b712c1c454e648f");
+        List<ScanNumStatResult> results = this.goodsQRCodeRecordStatService.statOneDayAllHoursData(goodsQRCodeRecordStatForm);
+
+        for (ScanNumStatResult result : results) {
+            log.info("整点: {} ----- 扫描人数: {}", result.getHour(), result.getScanNum());
+        }
+
+        Assert.assertNotNull(results);
+    }
+
+    @Test
+    public void testStatOneWeekSevenDays() {
+        GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm = new GoodsQRCodeRecordStatForm();
+        goodsQRCodeRecordStatForm.setFkOrgGuid("79c0f0a56d044d8a9b712c1c454e648f");
+        List<ScanNumStatResult> results = this.goodsQRCodeRecordStatService.statOneWeekSevenDaysData(goodsQRCodeRecordStatForm);
+
+        for (ScanNumStatResult result : results) {
+            log.info("星期{}: ----- 扫描人数: {}", result.getDayOfWeek(), result.getScanNum());
+        }
+
+        Assert.assertNotNull(results);
+    }
+
+    @Test
+    public void testStatOneMonthAllDays() {
+        GoodsQRCodeRecordStatForm goodsQRCodeRecordStatForm = new GoodsQRCodeRecordStatForm();
+        goodsQRCodeRecordStatForm.setFkOrgGuid("79c0f0a56d044d8a9b712c1c454e648f");
+        List<ScanNumStatResult> results = this.goodsQRCodeRecordStatService.statOneMonthAllDaysData(goodsQRCodeRecordStatForm);
+        for (ScanNumStatResult result : results) {
+            log.info("{}号: ----- 扫描人数: {}", result.getDayOfMonth(), result.getScanNum());
+        }
+        Assert.assertNotNull(results);
+    }
+}