소스 검색

优化代码

java110 4 년 전
부모
커밋
605d245e86

+ 22 - 28
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml

@@ -2099,24 +2099,21 @@
     <select id="queryHuaningOweFeeCount" parameterType="Map" resultType="Map">
         select count(1) count
         from (
-        select f.floor_num floorNum,SUM(t.owe_amount) oweAmount,SUM(curT.owe_amount) curOweAmount
-        from report_fee_month_statistics t
-        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
-        left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
-        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
-        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        left join building_unit curBu on curBu.floor_id = f.floor_id and bu.status_cd = '0'
-        left join building_room curBr on curBr.unit_id = curBu.unit_id and br.status_cd = '0'
-        inner join report_fee_month_statistics curT on curT.obj_id = curBr.room_id
+        select t.floor_num floorNum,SUM(rfms.owe_amount) oweAmount,SUM(curT.owe_amount) curOweAmount
+        from f_floor t
+        left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and rfms.status_cd = '0'
+        inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.community_id = t.community_id
         where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
         <if test="floorId !=null and floorId != ''">
-            and f.floor_id = #{floorId}
+            and t.floor_id = #{floorId}
         </if>
         <if test="objName !=null and objName != ''">
-            and t.obj_name= #{objName}
+            and rfms.obj_name= #{objName}
         </if>
         <if test="feeYear !=null and feeYear != ''">
             and curT.fee_year= #{feeYear}
@@ -2125,35 +2122,32 @@
             and t.community_id= #{communityId}
         </if>
         <if test="startTime !=null">
-            and t.create_time &gt;= #{startTime}
+            and rfms.create_time &gt;= #{startTime}
         </if>
         <if test="endTime !=null">
-            and t.create_time &lt;= #{endTime}
+            and rfms.create_time &lt;= #{endTime}
         </if>
-        GROUP BY f.floor_num
+        GROUP BY t.floor_num
         ) t
     </select>
 
     <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
     <select id="queryHuaningOweFee" parameterType="Map" resultType="Map">
-        select f.floor_num floorNum,SUM(t.owe_amount) oweAmount,SUM(curT.owe_amount) curOweAmount
-        from report_fee_month_statistics t
-        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
-        left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
-        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
-        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        left join building_unit curBu on curBu.floor_id = f.floor_id and bu.status_cd = '0'
-        left join building_room curBr on curBr.unit_id = curBu.unit_id and br.status_cd = '0'
-        inner join report_fee_month_statistics curT on curT.obj_id = curBr.room_id
+        select t.floor_num floorNum,SUM(rfms.owe_amount) oweAmount,SUM(curT.owe_amount) curOweAmount
+        from f_floor t
+        left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and rfms.status_cd = '0'
+        inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.community_id = t.community_id
         where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
             and br.room_num= #{roomNum}
         </if>
         <if test="floorId !=null and floorId != ''">
-            and f.floor_id = #{floorId}
+            and t.floor_id = #{floorId}
         </if>
         <if test="objName !=null and objName != ''">
-            and t.obj_name= #{objName}
+            and rfms.obj_name= #{objName}
         </if>
         <if test="feeYear !=null and feeYear != ''">
             and curT.fee_year= #{feeYear}
@@ -2162,12 +2156,12 @@
             and t.community_id= #{communityId}
         </if>
         <if test="startTime !=null">
-            and t.create_time &gt;= #{startTime}
+            and rfms.create_time &gt;= #{startTime}
         </if>
         <if test="endTime !=null">
-            and t.create_time &lt;= #{endTime}
+            and rfms.create_time &lt;= #{endTime}
         </if>
-        GROUP BY f.floor_num
+        GROUP BY t.floor_num
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
         </if>

+ 78 - 66
service-common/pom.xml

@@ -37,37 +37,49 @@
             <artifactId>activiti-spring-boot-starter-basic</artifactId>
         </dependency>
 
-		<dependency>
-			<groupId>org.activiti</groupId>
-			<artifactId>activiti-json-converter</artifactId>
-			<version>6.0.0</version>
-			<exclusions>
-				<exclusion>
-					<groupId>org.activiti</groupId>
-					<artifactId>activiti-bpmn-model</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.xmlgraphics</groupId>
-			<artifactId>batik-codec</artifactId>
-			<version>1.7</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.xmlgraphics</groupId>
-			<artifactId>batik-css</artifactId>
-			<version>1.7</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.xmlgraphics</groupId>
-			<artifactId>batik-svg-dom</artifactId>
-			<version>1.7</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.xmlgraphics</groupId>
-			<artifactId>batik-svggen</artifactId>
-			<version>1.7</version>
-		</dependency>
+        <dependency>
+            <groupId>org.activiti</groupId>
+            <artifactId>activiti-json-converter</artifactId>
+            <version>6.0.0</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.activiti</groupId>
+                    <artifactId>activiti-bpmn-model</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.xmlgraphics</groupId>
+            <artifactId>batik-codec</artifactId>
+            <version>1.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.xmlgraphics</groupId>
+            <artifactId>batik-css</artifactId>
+            <version>1.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.xmlgraphics</groupId>
+            <artifactId>batik-svg-dom</artifactId>
+            <version>1.7</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.xmlgraphics</groupId>
+            <artifactId>batik-svggen</artifactId>
+            <version>1.7</version>
+        </dependency>
+
+<!--        <dependency>-->
+<!--            <groupId>org.activiti</groupId>-->
+<!--            <artifactId>activiti-app-rest</artifactId>-->
+<!--            <version>6.0.0</version>-->
+<!--            <exclusions>-->
+<!--                <exclusion>-->
+<!--                    <groupId>org.slf4j</groupId>-->
+<!--                    <artifactId>slf4j-api</artifactId>-->
+<!--                </exclusion>-->
+<!--            </exclusions>-->
+<!--        </dependency>-->
 
 
     </dependencies>
@@ -75,41 +87,41 @@
     <build>
         <finalName>service-common</finalName>
 
-	        <plugins>
-	            <plugin>
-	                <groupId>org.apache.maven.plugins</groupId>
-	                <artifactId>maven-dependency-plugin</artifactId>
-	                <version>2.10</version>
-	                <executions>
-	                    <execution>
-	                        <id>unpack</id>
-	                        <phase>generate-resources</phase>
-	                        <goals>
-	                            <goal>unpack</goal>
-	                        </goals>
-	                        <configuration>
-	                            <artifactItems>
-	                                <artifactItem>
-	                                    <groupId>com.java110</groupId>
-	                                    <artifactId>java110-interface</artifactId>
-	                                    <version>${microcommunity.version}</version>
-	                                    <type>jar</type>
-	                                    <overWrite>true</overWrite>
-	                                    <outputDirectory>${project.build.directory}/classes</outputDirectory>
-	                                </artifactItem>
-	                            </artifactItems>
-	                        </configuration>
-	                    </execution>
-	                </executions>
-	            </plugin>
-	            <plugin>
-	                <groupId>org.springframework.boot</groupId>
-	                <artifactId>spring-boot-maven-plugin</artifactId>
-	                <configuration>
-	                    <mainClass>com.java110.common.CommonServiceApplicationStart</mainClass>
-	                </configuration>
-	            </plugin>
-	        </plugins>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <version>2.10</version>
+                <executions>
+                    <execution>
+                        <id>unpack</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                            <goal>unpack</goal>
+                        </goals>
+                        <configuration>
+                            <artifactItems>
+                                <artifactItem>
+                                    <groupId>com.java110</groupId>
+                                    <artifactId>java110-interface</artifactId>
+                                    <version>${microcommunity.version}</version>
+                                    <type>jar</type>
+                                    <overWrite>true</overWrite>
+                                    <outputDirectory>${project.build.directory}/classes</outputDirectory>
+                                </artifactItem>
+                            </artifactItems>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <configuration>
+                    <mainClass>com.java110.common.CommonServiceApplicationStart</mainClass>
+                </configuration>
+            </plugin>
+        </plugins>
 
     </build>
 </project>

+ 0 - 50
service-common/src/main/java/com/java110/common/api/ModelController.java

@@ -22,56 +22,6 @@ import java.io.IOException;
 @Controller
 public class ModelController {
 
-    private static final Logger logger = LoggerFactory.getLogger(ModelController.class);
 
-    @Autowired
-    private RepositoryService repositoryService;
-    @Autowired
-    private ObjectMapper objectMapper;
-
-    /**
-     * 创建模型
-     * @param response
-     * @param name 模型名称
-     * @param key 模型key
-     */
-    @RequestMapping("/create")
-    @ResponseBody
-    public String create(HttpServletResponse response, String name, String key) throws IOException {
-        logger.info("创建模型入参name:{},key:{}",name,key);
-        Model model = repositoryService.newModel();
-        ObjectNode modelNode = objectMapper.createObjectNode();
-        modelNode.put(ModelDataJsonConstants.MODEL_NAME, name);
-        modelNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, "");
-        modelNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);
-        model.setName(name);
-        model.setKey(key);
-        model.setMetaInfo(modelNode.toString());
-        repositoryService.saveModel(model);
-        createObjectNode(model.getId());
-        logger.info("创建模型结束,返回模型ID:{}",model.getId());
-        return model.getId();
-    }
-
-    /**
-     * 创建模型时完善ModelEditorSource
-     * @param modelId
-     */
-    @SuppressWarnings("deprecation")
-    private void createObjectNode(String modelId){
-        logger.info("创建模型完善ModelEditorSource入参模型ID:{}",modelId);
-        ObjectNode editorNode = objectMapper.createObjectNode();
-        editorNode.put("id", "canvas");
-        editorNode.put("resourceId", "canvas");
-        ObjectNode stencilSetNode = objectMapper.createObjectNode();
-        stencilSetNode.put("namespace","http://b3mn.org/stencilset/bpmn2.0#");
-        editorNode.put("stencilset", stencilSetNode);
-        try {
-            repositoryService.addModelEditorSource(modelId,editorNode.toString().getBytes("utf-8"));
-        } catch (Exception e) {
-            logger.info("创建模型时完善ModelEditorSource服务异常:{}",e);
-        }
-        logger.info("创建模型完善ModelEditorSource结束");
-    }
 
 }

+ 62 - 0
service-common/src/main/java/com/java110/common/api/WorkflowApi.java

@@ -1,11 +1,21 @@
 package com.java110.common.api;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.java110.common.bmo.workflow.IQueryWorkFlowFirstStaffBMO;
 import com.java110.dto.workflow.WorkflowDto;
+import org.activiti.editor.constants.ModelDataJsonConstants;
+import org.activiti.engine.RepositoryService;
+import org.activiti.engine.repository.Model;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+
 @RestController
 @RequestMapping("/workflow")
 public class WorkflowApi {
@@ -23,4 +33,56 @@ public class WorkflowApi {
         workflowDto.setStoreId(storeId);
         return queryWorkFlowFirstStaffBMOImpl.query(workflowDto);
     }
+
+    private static final Logger logger = LoggerFactory.getLogger(ModelController.class);
+
+    @Autowired
+    private RepositoryService repositoryService;
+    @Autowired
+    private ObjectMapper objectMapper;
+
+    /**
+     * 创建模型
+     * @param response
+     * @param name 模型名称
+     * @param key 模型key
+     */
+    @RequestMapping("/create")
+    @ResponseBody
+    public String create(HttpServletResponse response, String name, String key) throws IOException {
+        logger.info("创建模型入参name:{},key:{}",name,key);
+        Model model = repositoryService.newModel();
+        ObjectNode modelNode = objectMapper.createObjectNode();
+        modelNode.put(ModelDataJsonConstants.MODEL_NAME, name);
+        modelNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, "");
+        modelNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);
+        model.setName(name);
+        model.setKey(key);
+        model.setMetaInfo(modelNode.toString());
+        repositoryService.saveModel(model);
+        createObjectNode(model.getId());
+        logger.info("创建模型结束,返回模型ID:{}",model.getId());
+        return model.getId();
+    }
+
+    /**
+     * 创建模型时完善ModelEditorSource
+     * @param modelId
+     */
+    @SuppressWarnings("deprecation")
+    private void createObjectNode(String modelId){
+        logger.info("创建模型完善ModelEditorSource入参模型ID:{}",modelId);
+        ObjectNode editorNode = objectMapper.createObjectNode();
+        editorNode.put("id", "canvas");
+        editorNode.put("resourceId", "canvas");
+        ObjectNode stencilSetNode = objectMapper.createObjectNode();
+        stencilSetNode.put("namespace","http://b3mn.org/stencilset/bpmn2.0#");
+        editorNode.put("stencilset", stencilSetNode);
+        try {
+            repositoryService.addModelEditorSource(modelId,editorNode.toString().getBytes("utf-8"));
+        } catch (Exception e) {
+            logger.info("创建模型时完善ModelEditorSource服务异常:{}",e);
+        }
+        logger.info("创建模型完善ModelEditorSource结束");
+    }
 }