Parcourir la source

Merge branch 'master' of http://122.237.99.185:3000/dcs/realty

whx il y a 3 mois
Parent
commit
8e1a4f46a4
21 fichiers modifiés avec 153 ajouts et 34 suppressions
  1. 13 1
      virgo.api/src/main/java/com/bosshand/virgo/api/controller/WeeklyController.java
  2. 2 0
      virgo.api/src/main/java/com/bosshand/virgo/api/dao/ContractDao.java
  3. 2 0
      virgo.api/src/main/java/com/bosshand/virgo/api/dao/PaymentDao.java
  4. 2 0
      virgo.api/src/main/java/com/bosshand/virgo/api/dao/PaymentOrdinaryDao.java
  5. 2 0
      virgo.api/src/main/java/com/bosshand/virgo/api/dao/ProjectItemTargetRoomDao.java
  6. 1 1
      virgo.api/src/main/java/com/bosshand/virgo/api/job/JobCityWeatherQuartz.java
  7. 5 21
      virgo.api/src/main/java/com/bosshand/virgo/api/job/JobProjectWeeklyQuartz.java
  8. 1 1
      virgo.api/src/main/java/com/bosshand/virgo/api/model/WeeklyType.java
  9. 2 0
      virgo.api/src/main/java/com/bosshand/virgo/api/operate/dao/OperateDeviceDao.java
  10. 4 0
      virgo.api/src/main/java/com/bosshand/virgo/api/service/ManagerClient.java
  11. 81 10
      virgo.api/src/main/java/com/bosshand/virgo/api/service/WeeklyService.java
  12. 4 0
      virgo.api/src/main/resources/mapper/ContractMapper.xml
  13. 4 0
      virgo.api/src/main/resources/mapper/OperateDeviceMapper.xml
  14. 4 0
      virgo.api/src/main/resources/mapper/PaymentMapper.xml
  15. 4 0
      virgo.api/src/main/resources/mapper/PaymentOrdinaryMapper.xml
  16. 4 0
      virgo.api/src/main/resources/mapper/ProjectItemTargetRoomMapper.xml
  17. 1 0
      virgo.core/src/main/java/com/bosshand/virgo/core/config/ShiroConfig.java
  18. 2 0
      virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrClientDao.java
  19. 4 0
      virgo.core/src/main/resources/mapper/MgrClientMapper.xml
  20. 7 0
      virgo.manager/src/main/java/com/bosshand/virgo/controller/ClientController.java
  21. 4 0
      virgo.manager/src/main/java/com/bosshand/virgo/service/ClientService.java

+ 13 - 1
virgo.api/src/main/java/com/bosshand/virgo/api/controller/WeeklyController.java

@@ -42,12 +42,24 @@ public class WeeklyController {
         return Response.ok(weeklyService.updateState(weekly));
     }
 
-    @ApiOperation(value = "周报类型详情", notes = "周报类型详情")
+    @ApiOperation(value = "周报详情", notes = "周报详情")
+    @RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
+    public Response getWeekly(@PathVariable long id) {
+        return Response.ok(weeklyService.get(id));
+    }
+
+    @ApiOperation(value = "周报类型列表", notes = "周报类型列表")
     @RequestMapping(value = "/type/{weeklyId}", method = RequestMethod.GET)
     public Response getWeeklyType(@PathVariable long weeklyId) {
         return Response.ok(weeklyService.getByWeeklyId(weeklyId));
     }
 
+    @ApiOperation(value = "周报类型详情", notes = "周报类型详情")
+    @RequestMapping(value = "/typeId/{id}", method = RequestMethod.GET)
+    public Response getWeeklyTypeId(@PathVariable long id) {
+        return Response.ok(weeklyService.getWeeklyType(id));
+    }
+
     @ApiOperation(value = "新增类型", notes = "新增类型")
     @RequestMapping(value = "/type", method = RequestMethod.POST)
     public Response addWeeklyType(@RequestBody WeeklyType weeklyType) {

+ 2 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/ContractDao.java

@@ -23,4 +23,6 @@ public interface ContractDao {
 
     List<Contract> getLimit(@Param("p") Contract p, @Param("currIndex") int currIndex, @Param("pageSize") int pageSize);
 
+    List<Contract> getProjectId(@Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate, @Param(value = "projectId") long projectId);
+
 }

+ 2 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/PaymentDao.java

@@ -23,6 +23,8 @@ public interface PaymentDao {
 
     List<Payment> getContractId(long contractId);
 
+    List<Payment> getProjectId(@Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate, @Param(value = "projectId") long projectId);
+
     int getTotalCount(Payment payment);
 
     List<Payment> getLimit(@Param("p") Payment p, @Param("currIndex") int currIndex, @Param("pageSize") int pageSize);

+ 2 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/PaymentOrdinaryDao.java

@@ -20,6 +20,8 @@ public interface PaymentOrdinaryDao {
 
     int getTotalCount(PaymentOrdinary paymentOrdinary);
 
+    List<PaymentOrdinary> getProjectId(@Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate, @Param(value = "projectId") long projectId);
+
     List<PaymentOrdinary> getLimit(@Param("p") PaymentOrdinary p, @Param("currIndex") int currIndex, @Param("pageSize") int pageSize);
 
     PaymentOrdinary get(long id);

+ 2 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/dao/ProjectItemTargetRoomDao.java

@@ -31,4 +31,6 @@ public interface ProjectItemTargetRoomDao {
 
     List<ProjectItemTargetRoom> getProjectId(long projectId);
 
+    List<ProjectItemTargetRoom> listByDate(@Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate, @Param(value = "projectId") long projectId);
+
 }

+ 1 - 1
virgo.api/src/main/java/com/bosshand/virgo/api/job/JobCityWeatherQuartz.java

@@ -56,7 +56,7 @@ public class JobCityWeatherQuartz extends QuartzJobBean {
         String url = "https://www.weatherol.cn/api/home/getCurrAnd15dAnd24h?cityid=" + weatherCityCode;
         String result = HttpsUtils.getResult(url);
         JSONObject jsonObject = JSONObject.parseObject(result);
-        String cityWeather = jsonObject.getJSONObject("data").getJSONArray("forecast15d").getJSONObject(1).toJSONString();
+        String cityWeather = jsonObject.getJSONObject("data").getJSONArray("forecast15d").getJSONObject(2).toJSONString();
         projectCityWeather.setWeatherData(cityWeather);
         projectCityWeatherDao.save(projectCityWeather);
 

+ 5 - 21
virgo.api/src/main/java/com/bosshand/virgo/api/job/JobProjectWeeklyQuartz.java

@@ -86,42 +86,26 @@ public class JobProjectWeeklyQuartz extends QuartzJobBean {
                 case 0:
                     wt.setData(null);
                     break;
-                //进度情况
+                //客户管理
                 case 1:
                     wt.setData(null);
                     break;
-                //安全情况
+                //合同管理
                 case 2:
                     wt.setData(null);
                     break;
-                //质量情况
+                //费用管理
                 case 3:
                     wt.setData(null);
                     break;
-                //技术情况
+                //设备管理
                 case 4:
                     wt.setData(null);
                     break;
-                //资源情况
+                //房源管理
                 case 5:
                     wt.setData(null);
                     break;
-                //下周计划
-                case 6:
-                    wt.setData(null);
-                    break;
-                //问题协调
-                case 7:
-                    wt.setData(null);
-                    break;
-                //现场照片
-                case 8:
-                    wt.setData(null);
-                    break;
-                //周报文档
-                case 9:
-                    wt.setData(null);
-                    break;
                 default:
                     throw new IllegalStateException("Unexpected value: " + i);
             }

+ 1 - 1
virgo.api/src/main/java/com/bosshand/virgo/api/model/WeeklyType.java

@@ -5,7 +5,7 @@ package com.bosshand.virgo.api.model;
  */
 public class WeeklyType {
 
-    public static final String[] TYPENAMELIST = {"天气情况", "进度情况", "安全情况", "质量情况", "技术情况", "资源情况", "下周计划", "问题协调", "现场照片", "周报文档"};
+    public static final String[] TYPENAMELIST = {"天气情况", "客户管理", "合同管理", "费用管理", "设备管理", "房源管理"};
 
     private long id;
 

+ 2 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/operate/dao/OperateDeviceDao.java

@@ -20,6 +20,8 @@ public interface OperateDeviceDao {
 
     public OperateDevice get(long id);
 
+    List<OperateDevice> getProjectId(@Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate, @Param(value = "projectId") long projectId);
+
     public List<OperateDevice> getExport(OperateDevice operateDevice);
 
     public int getTotalCount(OperateDevice operateDevice);

+ 4 - 0
virgo.api/src/main/java/com/bosshand/virgo/api/service/ManagerClient.java

@@ -2,6 +2,7 @@ package com.bosshand.virgo.api.service;
 
 import com.alibaba.fastjson.JSONArray;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -12,4 +13,7 @@ public interface ManagerClient {
     @RequestMapping(value = "/message/reminder", method = RequestMethod.POST)
     public void pushReminderMessage(@RequestBody JSONArray data);
 
+    @RequestMapping(value = "/client/listByDate/{projectId}/{start}/{end}", method = RequestMethod.GET)
+    public String listByDate(@PathVariable String start, @PathVariable String end, @PathVariable long projectId);
+
 }

+ 81 - 10
virgo.api/src/main/java/com/bosshand/virgo/api/service/WeeklyService.java

@@ -1,15 +1,12 @@
 package com.bosshand.virgo.api.service;
 
 import cn.hutool.core.date.DateUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.bosshand.virgo.api.dao.ProjectCityWeatherDao;
-import com.bosshand.virgo.api.dao.WeeklyDao;
-import com.bosshand.virgo.api.dao.WeeklySetDao;
-import com.bosshand.virgo.api.dao.WeeklyTypeDao;
-import com.bosshand.virgo.api.model.ProjectCityWeather;
-import com.bosshand.virgo.api.model.Weekly;
-import com.bosshand.virgo.api.model.WeeklySet;
-import com.bosshand.virgo.api.model.WeeklyType;
+import com.bosshand.virgo.api.dao.*;
+import com.bosshand.virgo.api.model.*;
+import com.bosshand.virgo.api.operate.dao.OperateDeviceDao;
+import com.bosshand.virgo.api.operate.model.OperateDevice;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -31,6 +28,28 @@ public class WeeklyService {
     @Autowired
     ProjectCityWeatherDao projectCityWeatherDao;
 
+    @Autowired
+    ContractDao contractDao;
+
+    @Autowired
+    PaymentDao paymentDao;
+
+    @Autowired
+    PaymentOrdinaryDao paymentOrdinaryDao;
+
+    @Autowired
+    OperateDeviceDao operateDeviceDao;
+
+    @Autowired
+    ProjectItemTargetRoomDao projectItemTargetRoomDao;
+
+    @Autowired
+    ManagerClient managerClient;
+
+    public Weekly get(long id){
+        return weeklyDao.get(id);
+    }
+
     public List<Weekly> getByProjectId(long projectId){
        return weeklyDao.getByProjectId(projectId);
     }
@@ -87,8 +106,60 @@ public class WeeklyService {
         return list;
     }
 
-    public WeeklyType getWeeklyType (long id){
-        return weeklyTypeDao.getWeeklyType(id);
+    public WeeklyType getWeeklyType(long id) {
+        WeeklyType weeklyType = weeklyTypeDao.getWeeklyType(id);
+        Weekly weekly = weeklyDao.get(weeklyType.getWeeklyId());
+        String startDate = weekly.getStartDate();
+        String endDate = weekly.getEndDate();
+        long projectId = weekly.getProjectId();
+        switch (weeklyType.getType()) {
+            //客户管理
+            case 1:
+                if (weeklyType.getData() == null) {
+                    String data = managerClient.listByDate(startDate, endDate, projectId);
+                    weeklyType.setData(data);
+                    weeklyTypeDao.update(weeklyType);
+                }
+                break;
+            //合同管理
+            case 2:
+                if (weeklyType.getData() == null) {
+                    List<Contract> data = contractDao.getProjectId(startDate, endDate, projectId);
+                    weeklyType.setData(JSON.toJSONString(data));
+                    weeklyTypeDao.update(weeklyType);
+                }
+                break;
+            //费用管理
+            case 3:
+                if (weeklyType.getData() == null) {
+                    JSONObject js = new JSONObject();
+                    List<Payment> paymentList = paymentDao.getProjectId(startDate, endDate, projectId);
+                    js.put("payment", paymentList);
+                    List<PaymentOrdinary> paymentOrdinaryList = paymentOrdinaryDao.getProjectId(startDate, endDate, projectId);
+                    js.put("paymentOrdinary", paymentOrdinaryList);
+                    weeklyType.setData(js.toJSONString());
+                }
+                break;
+            //设备管理
+            case 4:
+                if (weeklyType.getData() == null) {
+                    List<OperateDevice> data = operateDeviceDao.getProjectId(startDate, endDate, projectId);
+                    weeklyType.setData(JSON.toJSONString(data));
+                    weeklyTypeDao.update(weeklyType);
+                }
+                break;
+            //房源管理
+            case 5:
+                if (weeklyType.getData() == null) {
+                    List<ProjectItemTargetRoom> data = projectItemTargetRoomDao.listByDate(startDate, endDate, projectId);
+                    weeklyType.setData(JSON.toJSONString(data));
+                    weeklyTypeDao.update(weeklyType);
+                }
+                break;
+            default:
+                throw new IllegalStateException("Unexpected value: " + weeklyType.getType());
+        }
+        return weeklyType;
     }
 
     public WeeklySet saveWeeklySet(WeeklySet weeklySet) {

+ 4 - 0
virgo.api/src/main/resources/mapper/ContractMapper.xml

@@ -170,6 +170,10 @@
         where c.id = #{id}
     </select>
 
+    <select id="getProjectId" resultMap="contractResult">
+        select * from contract where signingDate  <![CDATA[>=]]>  #{startDate} and signingDate <![CDATA[<=]]> #{endDate} and projectId = #{projectId}
+    </select>
+
     <select id="getList" resultMap="contractResult">
         SELECT * FROM contract
         <where>

+ 4 - 0
virgo.api/src/main/resources/mapper/OperateDeviceMapper.xml

@@ -40,6 +40,10 @@
         SELECT * FROM operate_device where id = #{id}
     </select>
 
+    <select id="getProjectId" resultMap="OperateDeviceResult">
+        select * from operate_device where entryTime  <![CDATA[>=]]>  #{startDate} and entryTime <![CDATA[<=]]> #{endDate} and projectId = #{projectId}
+    </select>
+
     <select id="getExport" resultMap="OperateDeviceResult">
         SELECT * FROM operate_device
         <where>

+ 4 - 0
virgo.api/src/main/resources/mapper/PaymentMapper.xml

@@ -45,6 +45,10 @@
         UPDATE payment SET reminderStatus= #{reminderStatus} WHERE id=#{id}
     </update>
 
+    <select id="getProjectId" resultMap="paymentResult">
+        select * from payment where reminderDate  <![CDATA[>=]]>  #{startDate} and reminderDate <![CDATA[<=]]> #{endDate} and projectId = #{projectId}
+    </select>
+
     <select id="getContractId" resultMap="paymentResult">
         SELECT contractId FROM payment where contractId = #{contractId}
     </select>

+ 4 - 0
virgo.api/src/main/resources/mapper/PaymentOrdinaryMapper.xml

@@ -106,6 +106,10 @@
         <include refid="query"/> where a.id = #{id}
     </select>
 
+    <select id="getProjectId" resultMap="result">
+        select * from payment_ordinary where reminderDate  <![CDATA[>=]]>  #{startDate} and reminderDate <![CDATA[<=]]> #{endDate} and projectId = #{projectId}
+    </select>
+
     <select id="getLimit" resultMap="result">
         <include refid="query"/>
         <where>

+ 4 - 0
virgo.api/src/main/resources/mapper/ProjectItemTargetRoomMapper.xml

@@ -41,6 +41,10 @@
         SELECT a.*, b.name as chargePersonName, b.portrait as chargePersonPortrait, b.phone as chargePersonPhone FROM project_item_target_room a LEFT JOIN mgr_user b ON a.chargePersonId = b.id
     </sql>
 
+    <select id="listByDate" resultMap="projectItemTargetRoomResult">
+        select * from project_item_target_room where invocationDate  <![CDATA[>=]]>  #{startDate} and invocationDate <![CDATA[<=]]> #{endDate} and projectId = #{projectId}
+    </select>
+
     <select id="getProjectId" resultMap="projectItemTargetRoomResult">
         <include refid="ProjectItemTargetRoomQuery"/>
         where a.projectId=#{projectId}

+ 1 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/config/ShiroConfig.java

@@ -62,6 +62,7 @@ public class ShiroConfig {
 
 
 		filterChainDefinitionMap.put("/client/downloadModel", "anon");
+		filterChainDefinitionMap.put("/client/listByDate/**", "anon");
 		filterChainDefinitionMap.put("/test/downloadModel", "anon");
 		filterChainDefinitionMap.put("/project/getProjectName/**", "anon");
 		filterChainDefinitionMap.put("/projectItemTargetRoom/open/**", "anon");

+ 2 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/dao/MgrClientDao.java

@@ -18,6 +18,8 @@ public interface MgrClientDao {
 
     MgrClient get(long id);
 
+    List<MgrClient> getProjectId(@Param(value = "startDate") String startDate, @Param(value = "endDate") String endDate, @Param(value = "projectId") long projectId);
+
     int delete(long id);
 
     int getTotalCount(MgrClient mgrClient);

+ 4 - 0
virgo.core/src/main/resources/mapper/MgrClientMapper.xml

@@ -76,6 +76,10 @@
         SELECT * FROM mgr_client where id = #{id}
     </select>
 
+    <select id="getProjectId" resultMap="clientResult">
+        select * from mgr_client where visitingTime  <![CDATA[>=]]>  #{startDate} and visitingTime <![CDATA[<=]]> #{endDate} and projectId = #{projectId}
+    </select>
+
     <select id="typeCount" resultType="map">
         SELECT type, COUNT(*) as number FROM mgr_client
         <where>

+ 7 - 0
virgo.manager/src/main/java/com/bosshand/virgo/controller/ClientController.java

@@ -1,5 +1,6 @@
 package com.bosshand.virgo.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.bosshand.virgo.core.config.OperationControllerLog;
 import com.bosshand.virgo.core.model.MgrClient;
 import com.bosshand.virgo.core.response.Response;
@@ -30,6 +31,12 @@ public class ClientController {
     @Autowired
     ClientService clientService;
 
+    @RequestMapping(value = "/listByDate/{projectId}/{start}/{end}", method = RequestMethod.GET)
+    public String listByDate(@PathVariable String start, @PathVariable String end, @PathVariable long projectId) {
+        List<MgrClient> list = clientService.getProjectId(start, end, projectId);
+        return JSON.toJSONString(list);
+    }
+
     @OperationControllerLog(module = "CRM", operation = "客户管理-客户列表查询")
     @ApiOperation("获取")
     @RequestMapping(value = "/{currPage}/{pageSize}", method = RequestMethod.POST)

+ 4 - 0
virgo.manager/src/main/java/com/bosshand/virgo/service/ClientService.java

@@ -47,6 +47,10 @@ public class ClientService {
         return mgrClient;
     }
 
+    public List<MgrClient> getProjectId(String start, String end, long projectId){
+        return clientDao.getProjectId(start, end, projectId);
+    }
+
     public int delete(long id) {
         return clientDao.delete(id);
     }