Browse Source

日期格式

gaodd 6 months ago
parent
commit
6c0606e226

+ 5 - 13
src/main/java/com/chinaitop/depot/device/controller/DFacilitiesController.java

@@ -4,8 +4,6 @@ import com.chinaitop.depot.device.model.*;
4 4
 import com.chinaitop.depot.device.service.DFacilitiesBasicsService;
5 5
 import com.chinaitop.depot.device.service.DFacilitiesMaintainService;
6 6
 import com.chinaitop.depot.device.service.DFacilitiesRepairService;
7
-import com.chinaitop.depot.device.service.DSblxxjyService;
8
-import com.chinaitop.depot.utils.GeneratingEncodUtils;
9 7
 import com.fasterxml.jackson.databind.ObjectMapper;
10 8
 import com.github.pagehelper.PageHelper;
11 9
 import com.github.pagehelper.PageInfo;
@@ -13,7 +11,6 @@ import io.swagger.annotations.Api;
13 11
 import io.swagger.annotations.ApiImplicitParam;
14 12
 import io.swagger.annotations.ApiImplicitParams;
15 13
 import io.swagger.annotations.ApiOperation;
16
-import org.apache.commons.lang.StringUtils;
17 14
 import org.springframework.http.MediaType;
18 15
 import org.springframework.web.bind.annotation.RequestBody;
19 16
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -25,7 +22,6 @@ import java.util.Date;
25 22
 import java.util.HashMap;
26 23
 import java.util.List;
27 24
 import java.util.Map;
28
-import java.util.stream.Collectors;
29 25
 
30 26
 /**
31 27
  * @author yu.ren
@@ -77,17 +73,13 @@ public class DFacilitiesController {
77 73
         return pageInfo;
78 74
     }
79 75
 
80
-    @RequestMapping(value = "/basics/save", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
76
+
77
+    @RequestMapping(value="/basics/save", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
81 78
     @ApiOperation(value = "保存/编辑设施基础信息", notes = "设施基础信息")
82
-    @ApiImplicitParams({
83
-            @ApiImplicitParam(name = "dFacilitiesBasicsJson", value = "设施基础信息数据", paramType = "form")
84
-    })
85
-    public Map<String, Object> saveBasics(@RequestBody String dFacilitiesBasicsJson) {
79
+   
80
+    public Map<String, Object> saveBasics(@RequestBody DFacilitiesBasics dFacilitiesBasics) {
86 81
         Map<String, Object> modelMap = new HashMap<>();
87
-        // JSON字符串转对象
88
-        ObjectMapper mapper = new ObjectMapper();
89 82
         try {
90
-            DFacilitiesBasics dFacilitiesBasics = mapper.readValue(dFacilitiesBasicsJson, DFacilitiesBasics.class);
91 83
             if (dFacilitiesBasics.getId()==null) {
92 84
                 dFacilitiesBasics.setCreateTime(new Date()); // 创建时间
93 85
                 dFacilitiesBasicsService.save(dFacilitiesBasics); // 新增
@@ -208,7 +200,7 @@ public class DFacilitiesController {
208 200
     @RequestMapping(value = "/maintain/save", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
209 201
     @ApiOperation(value = "保存/编辑设施保养信息", notes = "设施保养信息")
210 202
     @ApiImplicitParams({
211
-            @ApiImplicitParam(name = "dFacilitiesMaintainJson", value = "设施保养信息", paramType = "form")
203
+            @ApiImplicitParam(name = "dFacilitiesMaintainJson", value = "设施保养信息", paramType = "query")
212 204
     })
213 205
     public Map<String, Object> saveMaintain(String dFacilitiesMaintainJson) {
214 206
         Map<String, Object> modelMap = new HashMap<>();

+ 7 - 0
src/main/java/com/chinaitop/depot/device/model/DFacilitiesBasics.java

@@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
4 4
 
5 5
 import java.util.Date;
6 6
 
7
+import org.springframework.format.annotation.DateTimeFormat;
8
+
7 9
 public class DFacilitiesBasics {
8 10
     private Integer id;
9 11
 
@@ -31,30 +33,35 @@ public class DFacilitiesBasics {
31 33
      * 安装时间
32 34
      */
33 35
     @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
36
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
34 37
     private Date azsj;
35 38
 
36 39
     /**
37 40
      * 调试时间
38 41
      */
39 42
     @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
43
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
40 44
     private Date tssj;
41 45
 
42 46
     /**
43 47
      * 验收时间
44 48
      */
45 49
     @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
50
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
46 51
     private Date yssj;
47 52
 
48 53
 
49 54
     private Integer orgId;
50 55
 
51 56
     @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
57
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
52 58
     private Date createTime;
53 59
 
54 60
     /**
55 61
      * 报废日期
56 62
      */
57 63
     @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
64
+    @DateTimeFormat(pattern="yyyy-MM-dd")
58 65
     private Date bfrq;
59 66
 
60 67
     /**