瀏覽代碼

Merge branch 'feature-wcz' of lift-manager/lift-server into develop

wucizhong 5 年之前
父節點
當前提交
8a5e1f5dc6
共有 14 個文件被更改,包括 177 次插入41 次删除
  1. 2 2
      lift-business-service/src/main/java/cn/com/ty/lift/business/BusinessApplication.java
  2. 37 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/common/RestResult.java
  3. 41 5
      lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/controller/EmergencyRepairController.java
  4. 12 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/dto/RepairCondition.java
  5. 6 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/service/EmergencyRepairService.java
  6. 14 0
      lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/service/impl/EmergencyRepairServiceImpl.java
  7. 1 1
      lift-business-service/src/main/resources/logback-spring.xml
  8. 1 1
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/EnterpriseApplication.java
  9. 37 0
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/common/RestResult.java
  10. 7 13
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AnnouncementController.java
  11. 4 6
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AttendanceController.java
  12. 12 11
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/LiftCertificateController.java
  13. 2 1
      lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/LiftCertificateHistoryController.java
  14. 1 1
      lift-enterprise-service/src/main/resources/logback-spring.xml

+ 2 - 2
lift-business-service/src/main/java/cn/com/ty/lift/business/BusinessApplication.java

@@ -12,12 +12,12 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
  */
 @Slf4j
 @EnableFeignClients
-@MapperScan("cn.com.ty.**.dao.mapper")
+@MapperScan("cn.com.ty.**.mapper")
 @SpringBootApplication(scanBasePackages = {"cn.com.ty.lift", "cn.com.xwy.boot"})
 public class BusinessApplication {
 
     public static void main(String[] args) {
-        log.debug("DemoApplication startup main");
+        log.debug("BusinessApplication startup main");
         SpringApplication application = new SpringApplication(BusinessApplication.class);
         application.run(args);
     }

+ 37 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/common/RestResult.java

@@ -0,0 +1,37 @@
+package cn.com.ty.lift.business.common;
+
+import cn.com.ty.lift.common.constants.ApiConstants;
+import cn.com.xwy.boot.web.dto.RestResponse;
+
+/**
+ * @author wcz
+ * @date 2019/12/5
+ * @description
+ */
+public class RestResult {
+
+    public static final String MSG_ERR_PARAM = "缺少参数或参数有误";
+    public static final String MSG_ERR_EXCEPTION = "操作发生异常";
+
+    public static final String MSG_OK = "操作成功";
+
+    public static RestResponse err(String msg){
+        return RestResponse.error(ApiConstants.RESULT_ERROR,msg);
+    }
+
+    public static RestResponse errParam(){
+        return RestResponse.error(ApiConstants.RESULT_ERROR,MSG_ERR_PARAM);
+    }
+
+    public static RestResponse errException(){
+        return RestResponse.error(ApiConstants.RESULT_ERROR,MSG_ERR_EXCEPTION);
+    }
+
+    public static RestResponse okData(Object data){
+        return RestResponse.ok(data,ApiConstants.RESULT_SUCCESS,MSG_OK);
+    }
+
+    public static RestResponse okNoData(){
+        return RestResponse.ok(null,ApiConstants.RESULT_NO_DATA,MSG_OK);
+    }
+}

+ 41 - 5
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/controller/EmergencyRepairController.java

@@ -1,10 +1,14 @@
 package cn.com.ty.lift.business.emergency.controller;
 
 
-import cn.com.ty.lift.business.emergency.service.EmergencyRepairService;
-import org.springframework.beans.factory.annotation.Autowired;
+import cn.com.ty.lift.business.common.RestResult;
+import cn.com.ty.lift.business.emergency.entity.EmergencyRepair;
+import cn.com.ty.lift.business.emergency.service.impl.EmergencyRepairServiceImpl;
+import cn.com.xwy.boot.web.dto.RestResponse;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
-
 import org.springframework.web.bind.annotation.RestController;
 
 /**
@@ -16,10 +20,42 @@ import org.springframework.web.bind.annotation.RestController;
  * @since 2019-12-04
  */
 @RestController
+@AllArgsConstructor
 @RequestMapping("/emergency/emergency-repair")
 public class EmergencyRepairController {
 
-    @Autowired
-    private EmergencyRepairService emergencyRepairService;
+    private EmergencyRepairServiceImpl emergencyRepairService;
+
+    @PostMapping("findOne")
+    public RestResponse<Object> findOne(Long id){
+        if(null == id || id == 0){
+            return RestResult.errParam();
+        }
+        EmergencyRepair result = emergencyRepairService.getById(id);
+        return RestResult.okData(result);
+    }
+
+    @PostMapping("add")
+    public RestResponse<Object> add(EmergencyRepair entity){
+
+        if(null == entity){
+            return RestResult.errParam();
+        }
+        boolean result = emergencyRepairService.save(entity);
+        if(result){
+            return RestResult.okData(result);
+        }
+        return RestResult.errException();
+    }
+
+    @PostMapping("list")
+    public RestResponse list(Integer pageNum,Integer pageSize,Integer status){
+        if(null == status){
+            return RestResult.errParam();
+        }
+        IPage<EmergencyRepair> page = emergencyRepairService.listByStatus(pageNum,pageSize,status);
+        return RestResult.okData(page);
+    }
+
 
 }

+ 12 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/dto/RepairCondition.java

@@ -0,0 +1,12 @@
+package cn.com.ty.lift.business.emergency.dto;
+
+/**
+ * @author wcz
+ * @date 2019/12/5
+ * @description
+ */
+public class RepairCondition {
+
+    private long regionId;
+
+}

+ 6 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/service/EmergencyRepairService.java

@@ -1,6 +1,10 @@
 package cn.com.ty.lift.business.emergency.service;
 
 import cn.com.ty.lift.business.emergency.entity.EmergencyRepair;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 /**
@@ -13,4 +17,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface EmergencyRepairService extends IService<EmergencyRepair> {
 
+    public IPage<EmergencyRepair> listByStatus(Integer pageNum,Integer pageSize,Integer status);
+
 }

+ 14 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/emergency/service/impl/EmergencyRepairServiceImpl.java

@@ -3,6 +3,10 @@ package cn.com.ty.lift.business.emergency.service.impl;
 import cn.com.ty.lift.business.emergency.entity.EmergencyRepair;
 import cn.com.ty.lift.business.emergency.mapper.EmergencyRepairMapper;
 import cn.com.ty.lift.business.emergency.service.EmergencyRepairService;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
@@ -17,4 +21,14 @@ import org.springframework.stereotype.Service;
 @Service
 public class EmergencyRepairServiceImpl extends ServiceImpl<EmergencyRepairMapper, EmergencyRepair> implements EmergencyRepairService {
 
+
+    @Override
+    public IPage<EmergencyRepair> listByStatus(Integer pageNum, Integer pageSize, Integer status) {
+        IPage<EmergencyRepair> page = new Page<>(pageNum,pageSize);
+        QueryWrapper<EmergencyRepair> queryWrapper = new QueryWrapper<>();
+        LambdaQueryWrapper<EmergencyRepair> lambdaQueryWrapper = queryWrapper.lambda();
+        lambdaQueryWrapper.eq(EmergencyRepair::getStatus, status);
+        page = page(page,queryWrapper);
+        return page;
+    }
 }

+ 1 - 1
lift-business-service/src/main/resources/logback-spring.xml

@@ -12,7 +12,7 @@
     <!-- 控制台打印 -->
     <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
         <encoder charset="utf-8">
-            <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n
+            <pattern>%red([%-5level]) %green(%d{${DATETIME}}) %cyan([%thread]) %boldMagenta(%logger{36}) - %m%n
             </pattern>
         </encoder>
     </appender>

+ 1 - 1
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/EnterpriseApplication.java

@@ -17,7 +17,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 public class EnterpriseApplication {
 
     public static void main(String[] args) {
-        log.debug("DemoApplication startup main");
+        log.debug("EnterpriseApplication startup main");
         SpringApplication application = new SpringApplication(EnterpriseApplication.class);
         application.run(args);
     }

+ 37 - 0
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/common/RestResult.java

@@ -0,0 +1,37 @@
+package cn.com.ty.lift.enterprise.common;
+
+import cn.com.ty.lift.common.constants.ApiConstants;
+import cn.com.xwy.boot.web.dto.RestResponse;
+
+/**
+ * @author wcz
+ * @date 2019/12/5
+ * @description
+ */
+public class RestResult {
+
+    public static final String MSG_ERR_PARAM = "缺少参数或参数有误";
+    public static final String MSG_ERR_EXCEPTION = "操作发生异常";
+
+    public static final String MSG_OK = "操作成功";
+
+    public static RestResponse err(String msg){
+        return RestResponse.error(ApiConstants.RESULT_ERROR,msg);
+    }
+
+    public static RestResponse errParam(){
+        return RestResponse.error(ApiConstants.RESULT_ERROR,MSG_ERR_PARAM);
+    }
+
+    public static RestResponse errException(){
+        return RestResponse.error(ApiConstants.RESULT_ERROR,MSG_ERR_EXCEPTION);
+    }
+
+    public static RestResponse okData(Object data){
+        return RestResponse.ok(data,ApiConstants.RESULT_SUCCESS,MSG_OK);
+    }
+
+    public static RestResponse okNoData(){
+        return RestResponse.ok(null,ApiConstants.RESULT_NO_DATA,MSG_OK);
+    }
+}

+ 7 - 13
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/AnnouncementController.java

@@ -1,22 +1,16 @@
 package cn.com.ty.lift.enterprise.oa.controller;
 
+import cn.com.ty.lift.enterprise.common.RestResult;
 import cn.com.ty.lift.enterprise.oa.entity.Announcement;
-import cn.com.ty.lift.enterprise.oa.entity.Attendance;
 import cn.com.ty.lift.enterprise.oa.service.AnnouncementService;
-import cn.com.ty.lift.enterprise.oa.service.AttendanceService;
 import cn.com.xwy.boot.web.dto.RestResponse;
-import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import lombok.extern.slf4j.Slf4j;
 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.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.Date;
-import java.util.List;
-
 /**
  * 公司公告
  */
@@ -37,31 +31,31 @@ public class AnnouncementController {
     public RestResponse<Announcement> findOne(Long id) {
         log.info("id: " + id);
         Announcement entity = announcementService.getById(id);
-        return RestResponse.ok(entity);
+        return RestResult.okData(entity);
     }
 
     @PostMapping("list")
     public RestResponse<IPage<Announcement>> list(int pageNum, int pageSize, Long mtCompanyId){
         IPage<Announcement> results = announcementService.selectByCondition(pageNum,pageSize,mtCompanyId);
         if(null == results){
-            return RestResponse.error("查询异常");
+            return RestResult.errException();
         }
-        return RestResponse.ok(results);
+        return RestResult.okData(results);
     }
 
     @PostMapping("add")
     public RestResponse<Object> add(Announcement entity){
         if(null == entity){
-            return RestResponse.error("缺少参数");
+            return RestResult.errParam();
         }
         boolean result = announcementService.save(entity);
 
-        return RestResponse.ok(result);
+        return RestResult.okData(result);
     }
 
     @PostMapping("delete")
     public RestResponse<Boolean> delete(Long id){
         boolean result = announcementService.removeById(id);
-        return RestResponse.ok(result);
+        return RestResult.okData(result);
     }
 }

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

@@ -1,14 +1,12 @@
 package cn.com.ty.lift.enterprise.oa.controller;
 
+import cn.com.ty.lift.enterprise.common.RestResult;
 import cn.com.ty.lift.enterprise.oa.entity.Attendance;
-import cn.com.ty.lift.enterprise.oa.entity.LiftCertificate;
 import cn.com.ty.lift.enterprise.oa.service.AttendanceService;
-import cn.com.ty.lift.enterprise.oa.service.LiftCertificateService;
 import cn.com.xwy.boot.web.dto.RestResponse;
 import cn.hutool.core.util.StrUtil;
 import lombok.extern.slf4j.Slf4j;
 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.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -37,7 +35,7 @@ public class AttendanceController {
     public RestResponse<Attendance> findOne(Long id) {
         log.info("id: " + id);
         Attendance entity = attendanceService.getById(id);
-        return RestResponse.ok(entity);
+        return RestResult.okData(entity);
     }
 
     @PostMapping("list")
@@ -48,9 +46,9 @@ public class AttendanceController {
 
         List<Attendance> results = attendanceService.selectByCondition(pageNum,pageSize,mtCompanyId,name,begin,end);
         if(null == results){
-            return RestResponse.error("查询异常");
+            return RestResult.errException();
         }
-        return RestResponse.ok(results);
+        return RestResult.okData(results);
     }
 
 }

+ 12 - 11
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/LiftCertificateController.java

@@ -2,6 +2,7 @@ package cn.com.ty.lift.enterprise.oa.controller;
 
 import cn.com.ty.lift.common.utils.AliyunOSSUtil;
 import cn.com.ty.lift.enterprise.common.Conf;
+import cn.com.ty.lift.enterprise.common.RestResult;
 import cn.com.ty.lift.enterprise.oa.entity.LiftCertificate;
 import cn.com.ty.lift.enterprise.oa.service.LiftCertificateService;
 import cn.com.xwy.boot.web.dto.RestResponse;
@@ -53,7 +54,7 @@ public class LiftCertificateController {
         LiftCertificate entity = liftCertificateService.getById(id);
 
 
-        return RestResponse.ok(entity);
+        return RestResult.okData(entity);
     }
 
     @PostMapping("list")
@@ -67,9 +68,9 @@ public class LiftCertificateController {
         }
         IPage<LiftCertificate> results = liftCertificateService.selectByTypeCondition(pageNum, pageSize, certificateType, name, status);
         if (results == null) {
-            return RestResponse.error("查询异常");
+            return RestResult.errException();
         }
-        return RestResponse.ok(results);
+        return RestResult.okData(results);
     }
 
     /**
@@ -81,13 +82,13 @@ public class LiftCertificateController {
     @PostMapping("modify")
     public RestResponse<Boolean> modify(LiftCertificate entity) {
         if (null == entity) {
-            return RestResponse.error("参数有误");
+            return RestResult.errParam();
         }
         boolean result = liftCertificateService.updateById(entity);
         if (result) {
-            return RestResponse.ok(result);
+            return RestResult.okData(result);
         }
-        return RestResponse.error("更新失败");
+        return RestResult.errException();
     }
 
     /**
@@ -101,7 +102,7 @@ public class LiftCertificateController {
         //0:无证,1:待审核,2:审核未通过,3:审核通过,4:超期
         int status = pass ? 3 : 2;
         int result = liftCertificateService.updateAudit(id, status);
-        return RestResponse.ok(result);
+        return RestResult.okData(result);
     }
 
     /**
@@ -113,16 +114,16 @@ public class LiftCertificateController {
     @PostMapping("add")
     public RestResponse<Object> add(MultipartFile[] files,LiftCertificate entity) throws Exception{
         if(null == files || files.length == 0){
-            return RestResponse.error("请上传操作证图片");
+            return RestResult.err("请上传操作证图片");
         }
 
         if (null == entity) {
-            return RestResponse.error("参数有误");
+            return RestResult.errParam();
         }
         for (int i = 0;i < files.length; i++){
             MultipartFile file = files[i];
             if(file.isEmpty()){
-                return RestResponse.error("请上传操作证图片");
+                return RestResult.err("请上传操作证图片");
             }
             String originalFilename = file.getOriginalFilename();
             String suffix = originalFilename.substring(originalFilename.indexOf("."));
@@ -137,7 +138,7 @@ public class LiftCertificateController {
         }
 
         boolean result = liftCertificateService.save(entity);
-        return RestResponse.ok(result);
+        return RestResult.okData(result);
 
     }
 }

+ 2 - 1
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/oa/controller/LiftCertificateHistoryController.java

@@ -1,5 +1,6 @@
 package cn.com.ty.lift.enterprise.oa.controller;
 
+import cn.com.ty.lift.enterprise.common.RestResult;
 import cn.com.ty.lift.enterprise.oa.entity.LiftCertificateHistory;
 import cn.com.ty.lift.enterprise.oa.service.LiftCertificateHistoryService;
 import cn.com.xwy.boot.web.dto.RestResponse;
@@ -30,7 +31,7 @@ public class LiftCertificateHistoryController {
     public RestResponse<LiftCertificateHistory> findOne(Long id) {
         log.info("id: " + id);
         LiftCertificateHistory entity = liftCertificateHistoryService.getById(id);
-        return RestResponse.ok(entity);
+        return RestResult.okData(entity);
     }
 
 }

+ 1 - 1
lift-enterprise-service/src/main/resources/logback-spring.xml

@@ -12,7 +12,7 @@
     <!-- 控制台打印 -->
     <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
         <encoder charset="utf-8">
-            <pattern>[%-5level] %d{${DATETIME}} [%thread] %logger{36} - %m%n
+            <pattern>%red([%-5level]) %green(%d{${DATETIME}}) %cyan([%thread]) %boldMagenta(%logger{36}) - %m%n
             </pattern>
         </encoder>
     </appender>