Browse Source

Merge branches 'develop' and 'huangyuan-user' of http://132.232.206.88:3000/lift-manager/lift-server into huangyuan-user

黄远 5 years ago
parent
commit
61e86da5ac
17 changed files with 130 additions and 52 deletions
  1. 3 3
      lift-business-service/src/main/java/cn/com/ty/lift/business/capital/service/SignInService.java
  2. 13 13
      lift-business-service/src/main/java/cn/com/ty/lift/business/common/CommonController.java
  3. 6 6
      lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/LiftService.java
  4. 5 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/controller/PropertyMaintenanceController.java
  5. 38 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/model/response/RepairResponse.java
  6. 5 5
      lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/mapper/PropertyMaintenanceMapper.java
  7. 3 3
      lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceRecordService.java
  8. 1 1
      lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceService.java
  9. 10 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/PropertyService.java
  10. 4 6
      lift-business-service/src/main/resources/mapper/maintenance/MaintenanceRecordMapper.xml
  11. 1 1
      lift-business-service/src/main/resources/mapper/project/ProjectMapper.xml
  12. 0 2
      lift-common/src/main/java/cn.com.ty.lift.common/constants/CommonEnum.java
  13. 21 0
      lift-common/src/main/java/cn.com.ty.lift.common/constants/SqlConstants.java
  14. 0 3
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/service/impl/PropertyCompanyServiceImpl.java
  15. 4 4
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AttendanceController.java
  16. 2 2
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/option/controller/MaintenanceOptionController.java
  17. 14 3
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/organization/service/OrganizationService.java

+ 3 - 3
lift-business-service/src/main/java/cn/com/ty/lift/business/capital/service/SignInService.java

@@ -65,9 +65,9 @@ public class SignInService extends ServiceImpl<SignInMapper, SignIn> {
      * @date 2020/4/20 9:29 下午
      */
     public RestResponse signIn(CapitalRepairRequest request) {
-        boolean ret = VerifyUtils.preJudgment(request.getCoordinate());
-        if (!ret)
-            return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
+//        boolean ret = VerifyUtils.preJudgment(request.getCoordinate());
+//        if (!ret)
+//            return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
         SignIn oldSignIn = getOne(request.getMtCompanyId(), request.getProjectId(), request.getUserId());
         if (ObjectUtil.isNotEmpty(oldSignIn)) {
             String approachTime = oldSignIn.getApproachTime();

+ 13 - 13
lift-business-service/src/main/java/cn/com/ty/lift/business/common/CommonController.java

@@ -98,13 +98,13 @@ public class CommonController {
         for (MultipartFile file : files) {
             String currentTime = DateUtil.formatDateTime(new Date());
             //上传图片加图片水印
-            ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
+            //ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
             //上传图片加文字水印
-            ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
-            File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
-            FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
-            MultipartFile mfile = new CommonsMultipartFile(fileItem);
-            String fileName = handleFile(mfile);
+            //ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
+            //File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
+            //FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
+            //MultipartFile mfile = new CommonsMultipartFile(fileItem);
+            String fileName = handleFile(file);
             fileMap.put(fileName, file);
         }
         //2 批量上传
@@ -132,15 +132,15 @@ public class CommonController {
     @PostMapping("upload")
     public RestResponse upload(@RequestParam("file") MultipartFile file) {
         Validate.notTrue(Objects.isNull(file) || file.isEmpty(), ValuePool.UPLOAD_DATA_MISSING);
-        String currentTime = DateUtil.formatDateTime(new Date());
+        //String currentTime = DateUtil.formatDateTime(new Date());
         //上传图片加图片水印
-        ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
+        //ImageUtil.pressImage(null, file, "/home/ying/server/lift-business/tmp/watermark.png", "/home/ying/server/lift-business/tmp/imgBack.png", "right-bottom", null);
         //上传图片加文字水印
-        ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
-        File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
-        FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
-        MultipartFile mfile = new CommonsMultipartFile(fileItem);
-        String fileName = handleFile(mfile);
+        //ImageUtil.pressText("/home/ying/server/lift-business/tmp/imgBack.png", currentTime, "/home/ying/server/lift-business/tmp/imgBack.png", "黑体", Font.BOLD + Font.ITALIC, 30, "left-bottom", Color.GRAY);
+        //File downloadFile = new File("/home/ying/server/lift-business/tmp/imgBack.png");
+        //FileItem fileItem = ImageUtil.createFileItem(downloadFile, downloadFile.getName());
+        //MultipartFile mfile = new CommonsMultipartFile(fileItem);
+        String fileName = handleFile(file);
         try {
             String url = systemConfiguration.build().putObject(fileName, file.getBytes());
             log.info("upload file complete, file URL: {}", url);

+ 6 - 6
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/LiftService.java

@@ -407,12 +407,12 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
         Optional<Lift> oldLift = getOne(null, lift.getId());
         if (!oldLift.isPresent())
             return RestResponse.fail(MessageUtils.get("msg.lift.not.exist"));
-        String coordinate = lift.getCoordinate();
-        if (Objects.nonNull(coordinate)) {
-            boolean ret = VerifyUtils.preJudgment(coordinate);
-            if (!ret)
-                return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
-        }
+//        String coordinate = lift.getCoordinate();
+//        if (Objects.nonNull(coordinate)) {
+//            boolean ret = VerifyUtils.preJudgment(coordinate);
+//            if (!ret)
+//                return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
+//        }
         LocalDate lastDay = lift.getAnnualInspectionDate().with(TemporalAdjusters.lastDayOfMonth());
         lift.setAnnualInspectionDate(lastDay);
         boolean result = updateById(lift);

+ 5 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/controller/PropertyMaintenanceController.java

@@ -52,4 +52,9 @@ public class PropertyMaintenanceController {
     public RestResponse<?> project(@RequestBody PropertyVo propertyVo) {
         return propertyService.queryJoinProjectList(propertyVo);
     }
+
+    @PostMapping("repair")
+    public RestResponse<?> repair(@RequestBody PropertyVo propertyVo) {
+        return propertyService.queryRepairList(propertyVo);
+    }
 }

+ 38 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/entity/model/response/RepairResponse.java

@@ -0,0 +1,38 @@
+package cn.com.ty.lift.business.maintenance.dao.entity.model.response;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+public class RepairResponse {
+    private Long repairId;
+    private String projectName;
+    /**
+     * 是否紧急 0否 1是
+     */
+    private Integer isCritical;
+    /**
+     * 急修原因 0其它 1停电 2故障
+     */
+    private Integer repairReason;
+    /**
+     * 保修来源 1物业 2维保 3物联
+     */
+    private Integer source;
+    /**
+     * 报修时间
+     */
+    private LocalDateTime callerDate;
+    private String registrationCode;
+    /**
+     * 电梯类型 1直梯 2扶梯
+     */
+    private Integer liftType;
+    /**
+     * 电梯类别(1:曳引梯;2:液压梯;3:杂物梯;4:自动扶梯;5:自动人行道)
+     */
+    private Integer category;
+    private String devicePosition;
+    private String workerName;
+}

+ 5 - 5
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/mapper/PropertyMaintenanceMapper.java

@@ -1,10 +1,7 @@
 package cn.com.ty.lift.business.maintenance.dao.mapper;
 
 import cn.com.ty.lift.business.maintenance.dao.entity.model.dto.MaintenancePlanMonthTaskNum;
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.DynamicMessageResponse;
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.PropertyEvaluateAuthResponse;
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.PropertyMtResponse;
-import cn.com.ty.lift.business.maintenance.dao.entity.model.response.PropertyProjectListResponse;
+import cn.com.ty.lift.business.maintenance.dao.entity.model.response.*;
 import cn.com.ty.lift.common.constants.SqlConstants;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Select;
@@ -32,5 +29,8 @@ public interface PropertyMaintenanceMapper {
     List<PropertyProjectListResponse> queryJoinProjectList(Long userId);
 
     @Select(SqlConstants.QUERY_EVALUATE_AUTH)
-    List<PropertyEvaluateAuthResponse> queryEvaluateAuth(String table,Long userId);
+    List<PropertyEvaluateAuthResponse> queryEvaluateAuth(String table, Long userId);
+
+    @Select(SqlConstants.QUERY_REPAIR_LIST)
+    List<RepairResponse> queryRepairList(Long userId);
 }

+ 3 - 3
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceRecordService.java

@@ -194,9 +194,9 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
             return RestResponse.fail(MessageUtils.get("msg.exist.record"));
         String coordinate = request.getCoordinate();
         //校验是否为经纬度
-        boolean verifyResult = VerifyUtils.preJudgment(coordinate);
-        if (!verifyResult)
-            return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
+//        boolean verifyResult = VerifyUtils.preJudgment(coordinate);
+//        if (!verifyResult)
+//            return RestResponse.fail(MessageUtils.get("msg.longitude.error"));
         //维保工是否在电梯附近
         boolean result = calc(liftCoordinate, coordinate);
         if (result)

+ 1 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceService.java

@@ -33,6 +33,6 @@ public class MaintenanceService {
         int limitedNum = company.getLimitedNum();
         //获取该公司企业电梯关联表的实际电梯台量
         int currentNum = platformService.countLiftNum(mtCompanyId);
-        return currentNum >= limitedNum;
+        return limitedNum >= currentNum;
     }
 }

+ 10 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/PropertyService.java

@@ -175,4 +175,14 @@ public class PropertyService {
         }
         return RestResponse.success(propertyMaintenanceMapper.queryEvaluateAuth(table, propertyVo.getUserId()));
     }
+
+    /**
+     * 根据用户id查询用户加入的项目的急修列表
+     *
+     * @param propertyVo userId
+     * @return 急修列表
+     */
+    public RestResponse<?> queryRepairList(PropertyVo propertyVo) {
+        return RestResponse.success(propertyMaintenanceMapper.queryRepairList(propertyVo.getUserId()));
+    }
 }

+ 4 - 6
lift-business-service/src/main/resources/mapper/maintenance/MaintenanceRecordMapper.xml

@@ -100,7 +100,7 @@
 	<!--app端 保养任务列表 (1:保养中、2:已完成) -->
 	<select id="findRecordByWorkerId" resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceAppResponse"
 			parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest">
-		SELECT p.project_name AS projectName,
+		SELECT DISTINCT p.project_name AS projectName,
 			p.id                AS projectId,
 			mr.id               AS mtPlanId,
 			mr.id               AS recordId,
@@ -224,7 +224,7 @@
         LEFT JOIN user_info ui ON mr.worker_id1 = ui.user_id
         LEFT JOIN project pr ON mr.project_id = pr.id AND pr.mt_company_id = mr.mt_company_id
         LEFT JOIN evaluation ev ON mr.id = ev.record_id
-        <where>
+        WHERE ((status = '2' AND has_evaluate = '0') or (status = '2' AND has_evaluate = '1'))
             <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
                 AND mr.mt_company_id = #{cond.mtCompanyId}
             </if>
@@ -246,21 +246,19 @@
             <if test="cond.workDate != null">
                 AND mr.work_date = #{cond.workDate}
             </if>
-        </where>
     </select>
 
     <!--日常保养-保养单:根据条件汇总条数-->
     <select id="countRecordByCondition" resultType="java.lang.Long"
             parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MtRecordRequest">
         SELECT
-        count(*)
+        count(1)
         FROM
         maintenance_record mr
-        <where>
+        WHERE  ((status = '2' AND has_evaluate = '0') or (status = '2' AND has_evaluate = '1'))
             <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
                 AND mr.mt_company_id = #{cond.mtCompanyId}
             </if>
-        </where>
     </select>
 
     <!--日常保养-保养单:根据id查询,带关联信息-->

+ 1 - 1
lift-business-service/src/main/resources/mapper/project/ProjectMapper.xml

@@ -166,7 +166,7 @@
 		p.actual_num    AS actualNum,
 		p.project_status AS projectStatus
 		FROM project p
-		WHERE 1=1
+		WHERE project_status != '3'
 		<if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
 			AND p.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
 		</if>

+ 0 - 2
lift-common/src/main/java/cn.com.ty.lift.common/constants/CommonEnum.java

@@ -148,8 +148,6 @@ public class CommonEnum {
      * 项目状态
      */
     public enum ProjectStatus implements IEnum {
-
-        DELETE("删除", "0"),
         NOT_START("尚未开始", "1"),
         IN_SERVICE("服务中", "2"),
         STOP_SERVICE("停止服务", "3"),

+ 21 - 0
lift-common/src/main/java/cn.com.ty.lift.common/constants/SqlConstants.java

@@ -112,4 +112,25 @@ public interface SqlConstants {
                     "         left join project_user pu on pu.project_id = temp.project_id" +
                     "   where user_role in (21, 22)" +
                     "  and user_id =#{userId}";
+
+    //查询用户加入的项目的急修列表
+    String QUERY_REPAIR_LIST =
+            "select         er.id               repairId," +
+                    "       p.project_name      projectName," +
+                    "       er.is_critical      isCritical," +
+                    "       er.repair_reason    repairReason," +
+                    "       er.source           source," +
+                    "       er.caller_date      callerDate," +
+                    "       l.registration_code registrationCode," +
+                    "       l.lift_type         liftType," +
+                    "       l.category          category," +
+                    "       l.device_position   devicePosition," +
+                    "       ui.name             workerName" +
+                    "   from emergency_repair er" +
+                    "         left join project_user pu on er.project_id = pu.project_id" +
+                    "         left join project p on er.project_id = p.id" +
+                    "         left join lift l on er.lift_id = l.id" +
+                    "         left join project_lift_relevance plr on er.lift_id = plr.lift_id" +
+                    "         left join user_info ui on plr.worker_id = ui.user_id" +
+                    "   where pu.user_id = #{userId}";
 }

+ 0 - 3
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/service/impl/PropertyCompanyServiceImpl.java

@@ -58,9 +58,6 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
                 propertyCompany.setMailingAddress("未设置地址");
             }
         });
-        if (records.getRecords().isEmpty()) {
-            return RestResponse.success();
-        }
         return RestResponse.success(records);
     }
 

+ 4 - 4
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AttendanceController.java

@@ -185,10 +185,10 @@ public class AttendanceController {
      */
     @PostMapping("clock")
     public RestResponse clock(@Valid @RequestBody Attendance entity) {
-        String coordinate = entity.getCoordinate();
-        boolean ret = VerifyUtils.preJudgment(coordinate);
-        if (!ret)
-            return RestResponse.fail("请输入正确的经纬度");
+//        String coordinate = entity.getCoordinate();
+//        boolean ret = VerifyUtils.preJudgment(coordinate);
+//        if (!ret)
+//            return RestResponse.fail("请输入正确的经纬度");
         Long mtCompanyId = entity.getMtCompanyId();
         Long userId = entity.getUserId();
         Integer type = entity.getType();

+ 2 - 2
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/option/controller/MaintenanceOptionController.java

@@ -45,7 +45,7 @@ public class MaintenanceOptionController {
                         .in("mt_company_id", 10086L, req.getMtCompanyId())
                         .in(req.getType() != null, "type", type(req))
                         .eq(req.getLiftCategory() != null, "lift_category", req.getLiftCategory())
-                        .eq(req.getStatus() != null, "status", req.getStatus())
+                        .eq( "status",2)
                         .orderByAsc("id"));
         if (page.getRecords().isEmpty()) {
             return RestResponse.success();
@@ -76,7 +76,7 @@ public class MaintenanceOptionController {
                         .in("mt_company_id", 10086L, req.getMtCompanyId())
                         .in(req.getType() != null, "type", type(req))
                         .eq(req.getLiftCategory() != null, "lift_category", req.getLiftCategory())
-                        .eq(req.getStatus() != null, "status", req.getStatus())
+                        .eq("status", 2)
                         .in(sort != null, "sort", sort));
         if (options.isEmpty()) {
             return RestResponse.success();

+ 14 - 3
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/organization/service/OrganizationService.java

@@ -23,7 +23,7 @@ public class OrganizationService {
      * @param project 项目id
      * @return RestResponse 项目相关人员
      */
-    public RestResponse users(Project project) {
+    public RestResponse<?> users(Project project) {
         List<HashMap<String, Object>> projectUsers = projectService.getBaseMapper().users(project.getId());
         if (projectUsers.isEmpty()) {
             return RestResponse.success();
@@ -63,7 +63,7 @@ public class OrganizationService {
      * @return 省,市,区,项目列表
      * @since 2019/12/17 10:05
      */
-    public RestResponse organizationTree(Long mtCompanyId) {
+    public RestResponse<?> organizationTree(Long mtCompanyId) {
         List<Organization> ps = new ArrayList<>();
         List<Organization> cs = new ArrayList<>();
         List<Organization> ds = new ArrayList<>();
@@ -167,6 +167,17 @@ public class OrganizationService {
         }
 
         for (Organization c : cs) {
+            //防止空指针 ---
+            List<Organization> organizations = c.getOrganizations();
+            if (organizations == null || organizations.get(0) == null) {
+                continue;
+            }
+            List<Project> projectsList = organizations.get(0).getProjects();
+            if (projectsList == null || projectsList.get(0) == null) {
+                continue;
+            }
+            //防止空指针 ---
+
             //获取省名
             String province = c.getOrganizations().get(0).getProjects().get(0).getProvince();
             for (Organization p : ps) {
@@ -181,6 +192,6 @@ public class OrganizationService {
         if (ps.isEmpty()) {
             return RestResponse.success();
         }
-        return RestResponse.success(ps, "成功");
+        return RestResponse.success(ps);
     }
 }