dcs vor 9 Monaten
Ursprung
Commit
26e9b9bd5e

+ 3 - 2
virgo.api/src/main/java/com/bosshand/virgo/api/controller/ProjectController.java

@@ -57,8 +57,9 @@ public class ProjectController {
     @OperationControllerLog(module = "空间管理", operation = "项目详情")
     @ApiOperation("详情")
     @RequestMapping(value = "/getProject/{id}", method = RequestMethod.GET)
-    public Response getProject(@PathVariable long id) {
-        return Response.ok(projectService.get(id));
+    public Response getProject(@PathVariable long id, @RequestParam(required = false) String coordinates) {
+        Project project = projectService.get(id);
+        return Response.ok(projectService.coordinates(project, coordinates));
     }
 
     @ApiOperation("根据组织获取项目列表")

+ 3 - 2
virgo.api/src/main/java/com/bosshand/virgo/api/controller/ProjectItemTargetRoomController.java

@@ -57,6 +57,7 @@ public class ProjectItemTargetRoomController {
         ProjectItemTargetRoom room = new ProjectItemTargetRoom();
         room.setOpenState(2);
         room.setCoordinates(projectItemTargetRoom.getCoordinates());
+        room.setTagIds(projectItemTargetRoom.getTagIds());
         return getResponse(currPage, pageSize, room);
     }
 
@@ -106,7 +107,7 @@ public class ProjectItemTargetRoomController {
     @OperationControllerLog(module = "房源管理", operation = "房源详情")
     @ApiOperation("详情")
     @RequestMapping(value = "/{id}", method = RequestMethod.GET)
-    public Response get(@PathVariable long id) {
+    public Response get(@PathVariable long id, @RequestParam(required = false) String coordinates) {
         ProjectItemTargetRoom room = projectItemTargetRoomService.get(id);
         if (room != null) {
             String tagIds = room.getTagIds();
@@ -123,7 +124,7 @@ public class ProjectItemTargetRoomController {
                 room.setRoomCollection(true);
             }
         }
-        return Response.ok(room);
+        return Response.ok(projectItemTargetRoomService.coordinates(room, coordinates));
     }
 
     @ApiOperation("层级结构")

+ 10 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/model/PaymentInvoice.java

@@ -19,6 +19,8 @@ public class PaymentInvoice {
      */
     private long paymentId;
 
+    private long[] paymentIds;
+
     /**
      * 组织id
      */
@@ -126,6 +128,14 @@ public class PaymentInvoice {
         this.paymentId = paymentId;
     }
 
+    public long[] getPaymentIds() {
+        return paymentIds;
+    }
+
+    public void setPaymentIds(long[] paymentIds) {
+        this.paymentIds = paymentIds;
+    }
+
     public long getOrganizationId() {
         return organizationId;
     }

+ 21 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/service/ProjectItemTargetRoomService.java

@@ -145,6 +145,27 @@ public class ProjectItemTargetRoomService {
         return list;
     }
 
+    /**
+     * 返回距离
+     */
+    public ProjectItemTargetRoom coordinates(ProjectItemTargetRoom room, String coordinates) {
+        if (StringUtil.notBlank(coordinates)) {
+            Project project = this.getProject(room.getProjectId());
+            String[] currentCoordinates = coordinates.split(",");
+            if (StringUtil.notBlank(project.getCoordinates())) {
+                String[] targetCoordinates = project.getCoordinates().split(",");
+                Double distance = PositionUtil.getDistance4(
+                        Double.parseDouble(currentCoordinates[0]),
+                        Double.parseDouble(currentCoordinates[1]),
+                        Double.parseDouble(targetCoordinates[0]),
+                        Double.parseDouble(targetCoordinates[1])
+                );
+                room.setDistance(distance);
+            }
+        }
+        return room;
+    }
+
     public Map<String, Object> queryKeyWord(String keyWord) {
         Map<String, Object> map = new HashMap<>();
 

+ 20 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/service/ProjectService.java

@@ -79,6 +79,26 @@ public class ProjectService {
 		return list;
 	}
 
+	/**
+	 * 返回距离
+	 */
+	public Project coordinates(Project p, String coordinates) {
+		if (StringUtil.notBlank(coordinates)) {
+			String[] currentCoordinates = coordinates.split(",");
+			if (StringUtil.notBlank(p.getCoordinates())) {
+				String[] targetCoordinates = p.getCoordinates().split(",");
+				Double distance = PositionUtil.getDistance4(
+						Double.parseDouble(currentCoordinates[0]),
+						Double.parseDouble(currentCoordinates[1]),
+						Double.parseDouble(targetCoordinates[0]),
+						Double.parseDouble(targetCoordinates[1])
+				);
+				p.setDistance(distance);
+			}
+		}
+		return p;
+	}
+
 	public void deleteProject(long id) {
 		projectDao.delete(id);
 	}

+ 7 - 1
virgo.api/src/main/resources/mapper/ContractMapper.xml

@@ -201,7 +201,13 @@
                 </foreach>
             </if>
             <if test="projectId!=0">and projectId=#{projectId}</if>
-            <if test="projectItemTargetRoomIds!=null">and projectItemTargetRoomIds=#{projectItemTargetRoomIds}</if>
+
+            <if test="projectItemTargetRoomIds != null">and
+                <foreach item="projectItemTargetRoomId" collection="projectItemTargetRoomIds.split(',')" open="(" separator=" or " close=")">
+                    FIND_IN_SET (#{projectItemTargetRoomId}, projectItemTargetRoomIds)
+                </foreach>
+            </if>
+
             <if test="attachment!=null">and attachment=#{attachment}</if>
             <if test="document!=null">and document=#{document}</if>
             <if test="status!=null">and status=#{status}</if>

+ 16 - 0
virgo.api/src/main/resources/mapper/PaymentInvoiceMapper.xml

@@ -100,6 +100,14 @@
             <if test="paymentOrdinaryId!=0">and paymentOrdinaryId=#{paymentOrdinaryId}</if>
             <if test="paymentId!=0">and paymentId=#{paymentId}</if>
 
+            <if test="paymentIds!=null">
+                and paymentId in (
+                <foreach collection="paymentIds" item="item" index="index" separator=",">
+                    #{item}
+                </foreach>
+                )
+            </if>
+
             <if test="organizationId!=0">and organizationId=#{organizationId}</if>
             <if test="projectId!=0">and projectId=#{projectId}</if>
             <if test="projectItemTargetRoomIds!=null">and projectItemTargetRoomIds=#{projectItemTargetRoomIds}</if>
@@ -132,6 +140,14 @@
             <if test="p.paymentOrdinaryId!=0">and a.paymentOrdinaryId=#{p.paymentOrdinaryId}</if>
             <if test="p.paymentId!=0">and a.paymentId=#{p.paymentId}</if>
 
+            <if test="p.paymentIds!=null">
+                and a.paymentId in (
+                <foreach collection="p.paymentIds" item="item" index="index" separator=",">
+                    #{item}
+                </foreach>
+                )
+            </if>
+
             <if test="p.organizationId!=0">and a.organizationId=#{p.organizationId}</if>
             <if test="p.projectId!=0">and a.projectId=#{p.projectId}</if>
             <if test="p.projectItemTargetRoomIds!=null">and a.projectItemTargetRoomIds=#{p.projectItemTargetRoomIds}</if>

+ 14 - 2
virgo.api/src/main/resources/mapper/WorkOrderMapper.xml

@@ -83,7 +83,13 @@
         SELECT count(*) FROM work_order
         <where>
             <if test="projectId!=0">and projectId=#{projectId}</if>
-            <if test="projectItemTargetRoomIds!=null">and projectItemTargetRoomIds=#{projectItemTargetRoomIds}</if>
+
+            <if test="projectItemTargetRoomIds != null">and
+                <foreach item="projectItemTargetRoomId" collection="projectItemTargetRoomIds.split(',')" open="(" separator=" or " close=")">
+                    FIND_IN_SET (#{projectItemTargetRoomId}, projectItemTargetRoomIds)
+                </foreach>
+            </if>
+
             <if test="tenantType!=null">and tenantType=#{tenantType}</if>
             <if test="merchantId!=0">and merchantId=#{merchantId}</if>
             <if test="clientId!=0">and clientId=#{clientId}</if>
@@ -112,7 +118,13 @@
         <include refid="query"/>
         <where>
             <if test="p.projectId!=0">and a.projectId=#{p.projectId}</if>
-            <if test="p.projectItemTargetRoomIds!=null">and a.projectItemTargetRoomIds=#{p.projectItemTargetRoomIds}</if>
+
+            <if test="p.projectItemTargetRoomIds != null">and
+                <foreach item="projectItemTargetRoomId" collection="p.projectItemTargetRoomIds.split(',')" open="(" separator=" or " close=")">
+                    FIND_IN_SET (#{projectItemTargetRoomId}, a.projectItemTargetRoomIds)
+                </foreach>
+            </if>
+
             <if test="p.tenantType!=null">and a.tenantType=#{p.tenantType}</if>
             <if test="p.merchantId!=0">and a.merchantId=#{p.merchantId}</if>
             <if test="p.clientId!=0">and a.clientId=#{p.clientId}</if>

+ 25 - 0
virgo.file/src/main/java/com/bosshand/virgo/file/controller/FileNodeController.java

@@ -149,6 +149,31 @@ public class FileNodeController {
 			}
 		}
 	}
+
+	@RequestMapping(value = "/filenode/{id}/type/{xx}", method = RequestMethod.GET)
+	public void getFileTo(@PathVariable int id, @PathVariable String xx, final HttpServletResponse response) {
+		logger.info("Ready to get file byte on parentId:" + id);
+		byte[] data = null;
+		OutputStream outputStream = null;
+		try {
+			data = fileManagerService.getByte(id);
+			response.setCharacterEncoding("UTF-8");
+			response.setContentType("application/x-msdownload");
+			response.setHeader("Content-Disposition","attachment; filename=" + URLEncoder.encode(xx, "UTF-8"));
+			OutputStream outputSream = response.getOutputStream();
+			outputSream.write(data);
+			outputSream.flush();
+		} catch (IOException e) {
+			throw new BadRequestException("Fail to write stream", Constant.RET_DOCUMENT_ERROR, e);
+		} finally {
+			if (outputStream != null) {
+				try {
+					outputStream.close();
+				} catch (IOException e) {
+				}
+			}
+		}
+	}
 	
 	@RequestMapping(value = "/filenode/{id}/render", method = RequestMethod.GET)
 	public Response renderDocument( @PathVariable int id , final HttpServletResponse response) {