Browse Source

添加工作台

jaikuai 3 years ago
parent
commit
2ec207ce7c

+ 13 - 15
src/main/java/cn/fastfun/controller/api/ApiAppDeviceLogController.java

@@ -1,27 +1,25 @@
 package cn.fastfun.controller.api;
 
-import cn.fastfun.controller.dto.DeviceAttrDTO;
 import cn.fastfun.controller.param.*;
 import cn.fastfun.service.AppDeviceLogService;
 import cn.fastfun.service.AppDeviceService;
-import cn.fastfun.service.SysExcelFieldService;
-import cn.fastfun.service.entity.AppDevice;
 import cn.fastfun.util.DateUtils;
 import cn.fastfun.util.ObjectUtil;
-import cn.fastfun.util.VerifyUtil;
-import com.bridge.dto.*;
+import com.bridge.dto.ApiDTO;
+import com.bridge.dto.ApiPageDTO;
+import com.bridge.dto.QueryParam;
+import com.bridge.dto.QueryParamExp;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
-import org.springframework.data.domain.Page;
 import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
-import javax.servlet.http.HttpServletResponse;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -41,7 +39,6 @@ public class ApiAppDeviceLogController {
     @Resource
     AppDeviceLogService deviceLogService;
 
-
     @ApiOperation(value = "入库")
     @RequestMapping(value = "instorage", method = RequestMethod.POST)
     public ApiDTO inStorage(@RequestBody @ApiParam(name = "入库参数", value = "传入json格式", required = true) LibraryInFormParam param) {
@@ -70,9 +67,10 @@ public class ApiAppDeviceLogController {
         return ApiDTO.ok();
     }
 
-    @ApiOperation(value = "记录搜索列表")
+    @ApiOperation(value = "处置搜索列表")
     @RequestMapping(value = "pageQuery", method = RequestMethod.POST)
-    public ApiDTO deviceLogPageQuery(@RequestBody QueryParam param) {
+    public ApiDTO deviceLogPageQuery(@RequestBody HandelQueryParam param) {
+        param.addParam(QueryParamExp.eq("type", 3));
         return ApiDTO.ok(deviceLogService.findByParam(param));
     }
 
@@ -88,7 +86,7 @@ public class ApiAppDeviceLogController {
         }
 
         // 类型搜索
-        if(!StringUtils.isEmpty(param.getType())){
+        if (!StringUtils.isEmpty(param.getType())) {
             sql.append(StringUtils.isEmpty(param.getSn()) ? "where" : "and");
             sql.append(" t.tf_device_type = '").append(param.getType()).append("'");
         }
@@ -121,7 +119,7 @@ public class ApiAppDeviceLogController {
         }
 
         // 类型搜索
-        if(!StringUtils.isEmpty(param.getType())){
+        if (!StringUtils.isEmpty(param.getType())) {
             sql.append(StringUtils.isEmpty(param.getSn()) ? "where" : "and");
             sql.append(" t.out_type = '").append(param.getType()).append("'");
         }

+ 19 - 0
src/main/java/cn/fastfun/controller/api/IndexController.java

@@ -0,0 +1,19 @@
+package cn.fastfun.controller.api;
+
+import cn.fastfun.controller.dto.IndexStatDTO;
+import com.bridge.dto.ApiDTO;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@RequestMapping("/api/v1")
+public class IndexController {
+
+
+    @ApiOperation(value = "设备管理系统工作台")
+    @PostMapping("stat")
+    public ApiDTO index() {
+        IndexStatDTO dto = new IndexStatDTO();
+        return ApiDTO.ok(dto);
+    }
+}

+ 40 - 0
src/main/java/cn/fastfun/controller/dto/IndexStatDTO.java

@@ -0,0 +1,40 @@
+package cn.fastfun.controller.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 工作台统计信息
+ */
+@Setter
+@Getter
+public class IndexStatDTO {
+
+    @ApiModelProperty(value = "电池总量", name = "batteryTotal")
+    private long batteryTotal = 0;
+
+    @ApiModelProperty(value = "配件总量", name = "partsTotal")
+    private long partsTotal = 0;
+
+    @ApiModelProperty(value = "今日录入", name = "todayEnter")
+    private long todayEnter = 0;
+
+    @ApiModelProperty(value = "今日入库", name = "todayPut")
+    private long todayPut = 0;
+
+    @ApiModelProperty(value = "历史电池出库", name = "historyOutBattery")
+    private long historyOutBattery = 0;
+
+    @ApiModelProperty(value = "历史配件出库", name = "historyOutParts")
+    private long historyOutParts = 0;
+
+    @ApiModelProperty(value = "历史处置", name = "historyHandle")
+    private long historyHandle = 0;
+
+    @ApiModelProperty(value = "库存", name = "stock")
+    private long stock = 0;
+
+    @ApiModelProperty(value = "库存故障", name = "stockFault")
+    private long stockFault = 0;
+}

+ 1 - 2
src/main/java/cn/fastfun/controller/param/HandelFormParam.java

@@ -4,14 +4,13 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
 import lombok.Setter;
 
-import javax.persistence.Column;
 import java.util.List;
 
 @Setter
 @Getter
 public class HandelFormParam {
 
-    @ApiModelProperty(value = "设备编号", name = "sn", required = false)
+    @ApiModelProperty(value = "设备编号", name = "sn")
     private List<String> sn;
 
 

+ 23 - 0
src/main/java/cn/fastfun/controller/param/HandelQueryParam.java

@@ -0,0 +1,23 @@
+package cn.fastfun.controller.param;
+
+import com.bridge.dto.QueryParam;
+import com.bridge.dto.QueryParamExp;
+import io.swagger.annotations.ApiModelProperty;
+import org.springframework.util.StringUtils;
+
+/**
+ * 处置搜索条件
+ */
+public class HandelQueryParam extends QueryParam {
+
+    @ApiModelProperty(value = "SN, 模糊搜索", name = "sn")
+    public void setSn(String sn) {
+        if (!StringUtils.isEmpty(sn))
+            addParam(QueryParamExp.like("sn", "%" + sn + "%"));
+    }
+
+    @ApiModelProperty(value = "处置类型", name = "type")
+    public void setType(String type) {
+        if (!StringUtils.isEmpty(type)) addParam(QueryParamExp.eq("hfEvent", type));
+    }
+}

+ 4 - 1
src/main/java/cn/fastfun/controller/param/TransferFormParam.java

@@ -10,7 +10,10 @@ import java.util.List;
 @Getter
 public class TransferFormParam {
 
-    @ApiModelProperty(value = "设备编号", name = "sn", required = false)
+    @ApiModelProperty(value = "批次号", name = "batchNum")
+    private List<String> batchNum;
+    
+    @ApiModelProperty(value = "设备编号", name = "sn")
     private List<String> sn;
 
     @ApiModelProperty(value = "划拨设备类型", name = "deviceType", required = true)

+ 37 - 0
src/main/java/cn/fastfun/service/entity/AppImeiHistory.java

@@ -0,0 +1,37 @@
+package cn.fastfun.service.entity;
+
+import com.bridge.entity.DateEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Table;
+
+
+@Entity
+@Table(name = "app_imei_history")
+@Setter
+@Getter
+public class AppImeiHistory extends DateEntity {
+
+    private static final long serialVersionUID = 1L;
+
+
+    @ApiModelProperty(value = "IMEI", name = "imei", required = true)
+    @Column(name = "imei")
+    private String imei;
+
+
+    @ApiModelProperty(value = "SN", name = "sn", required = true)
+    @Column(name = "sn")
+    private String sn;
+
+
+    @ApiModelProperty(value = "操作记录", name = "logId", required = true)
+    @Column(name = "log_id")
+    private String logId;
+
+
+}

+ 7 - 0
src/main/java/cn/fastfun/service/impl/AppDeviceLogServiceImpl.java

@@ -8,8 +8,11 @@ import cn.fastfun.service.AppDeviceLogService;
 import cn.fastfun.service.AppDeviceService;
 import cn.fastfun.service.entity.AppDevice;
 import cn.fastfun.service.entity.AppDeviceLog;
+import cn.fastfun.service.entity.AppImeiHistory;
+import cn.fastfun.service.entity.SysUserRole;
 import com.bridge.dto.QueryParamExp;
 import com.bridge.exception.ApiRuntimeException;
+import com.bridge.service.JpaService;
 import com.bridge.service.impl.JpaServiceImp;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -28,6 +31,10 @@ public class AppDeviceLogServiceImpl extends JpaServiceImp<AppDeviceLog, String>
     @Resource
     AppDeviceService appDeviceService;
 
+    //业务类
+    @Resource(name = "appImeiHistoryService")
+    JpaService<AppImeiHistory, String> appImeiHistoryService;
+
     @Override
     @Transactional
     public void putInStorage(LibraryInFormParam param) {

+ 14 - 0
src/main/java/cn/fastfun/service/impl/AppImeiHistoryServiceImp.java

@@ -0,0 +1,14 @@
+package cn.fastfun.service.impl;
+
+import cn.fastfun.service.entity.AppImeiHistory;
+import com.bridge.service.JpaService;
+import com.bridge.service.impl.JpaServiceImp;
+import org.springframework.stereotype.Service;
+
+/**
+ * 服务实现类 Created by Bridge.
+ */
+@Service("appImeiHistoryService")
+public class AppImeiHistoryServiceImp extends JpaServiceImp<AppImeiHistory, String> implements JpaService<AppImeiHistory, String> {
+
+}

+ 15 - 0
src/main/java/cn/fastfun/service/repository/AppImeiHistoryRepository.java

@@ -0,0 +1,15 @@
+package cn.fastfun.service.repository;
+
+import cn.fastfun.service.entity.AppImeiHistory;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+/**
+ * Created by Eye
+ *
+ * @Author Bridge
+ */
+public interface AppImeiHistoryRepository extends JpaRepository<AppImeiHistory, String>, JpaSpecificationExecutor<AppImeiHistory> {
+
+
+}