소스 검색

set时间

hanqingsong 1 년 전
부모
커밋
6d78d07901

+ 1 - 1
src/main/java/com/chinaitop/depot/qualityControl/controller/QualityInspectionController.java

@@ -40,7 +40,7 @@ public class QualityInspectionController {
40 40
     }
41 41
 
42 42
     @PutMapping("/update")
43
-    @ApiOperation(value = "新增", notes = "新增")
43
+    @ApiOperation(value = "修改", notes = "修改")
44 44
     public ResponseEntity update(@RequestBody BusinessQcQualityInspection saveParam) {
45 45
         return ResponseEntity.ok(qualityInspectionService.update(saveParam));
46 46
     }

+ 2 - 2
src/main/java/com/chinaitop/depot/qualityControl/mapper/BusinessQcQualityInspectionMapper.xml

@@ -751,10 +751,10 @@
751 751
         org_id = #{orgId}
752 752
       </if>
753 753
       <if test="basicStorehouseId != null and basicStorehouseId != ''">
754
-        basic_storehouse_id = #{basicStorehouseId}
754
+        and basic_storehouse_id = #{basicStorehouseId}
755 755
       </if>
756 756
       <if test="warehouseId != null and warehouseId != ''">
757
-        warehouse_id = #{warehouseId}
757
+        and warehouse_id = #{warehouseId}
758 758
       </if>
759 759
     </where>
760 760
     ORDER BY createdate DESC

+ 13 - 6
src/main/java/com/chinaitop/depot/qualityControl/service/impl/QualityInspectionServiceImpl.java

@@ -22,10 +22,7 @@ import org.springframework.validation.annotation.Validated;
22 22
 
23 23
 import javax.annotation.Resource;
24 24
 import javax.validation.constraints.NotBlank;
25
-import java.util.ArrayList;
26
-import java.util.HashMap;
27
-import java.util.List;
28
-import java.util.Map;
25
+import java.util.*;
29 26
 
30 27
 /**
31 28
  * @author qingsong.han
@@ -54,7 +51,7 @@ public class QualityInspectionServiceImpl implements QualityInspectionService {
54 51
         if (!StringUtils.isEmpty(xh)) {
55 52
             String substring = xh.substring(xh.length() - 4);
56 53
             int i = Integer.parseInt(substring);
57
-            if (i < 999)
54
+            if (i < 9999)
58 55
                 num += i;
59 56
         }
60 57
         // 生成质检报告单(检验类别+检验日期(yyyyMMdd)+4位顺序号组成)
@@ -65,6 +62,9 @@ public class QualityInspectionServiceImpl implements QualityInspectionService {
65 62
                         GenerateNumberUtil.integerToString(4, num)
66 63
                 )
67 64
         );
65
+        Date date = new Date();
66
+        saveParam.setCreatedate(date);
67
+        saveParam.setUpdatedate(date);
68 68
         int insert = qualityInspectionMapper.insert(saveParam);
69 69
         Integer id = saveParam.getId();
70 70
         log.info("id: {}", id);
@@ -73,6 +73,9 @@ public class QualityInspectionServiceImpl implements QualityInspectionService {
73 73
             List<BusinessQcQualityInspectionItem> item = saveParam.getItem();
74 74
             if (!ObjectUtils.isEmpty(item)) {
75 75
                 item.forEach(i -> {
76
+                    Date now = new Date();
77
+                    i.setCreatedate(now);
78
+                    i.setUpdatedate(now);
76 79
                     i.setQcQualityInspectionId(id);
77 80
                     qualityInspectionItemMapper.insert(i);
78 81
                 });
@@ -91,9 +94,13 @@ public class QualityInspectionServiceImpl implements QualityInspectionService {
91 94
     @Override
92 95
     @Transactional(rollbackFor = Exception.class)
93 96
     public int update(BusinessQcQualityInspection saveParam) {
97
+        saveParam.setUpdatedate(new Date());
94 98
         int i = qualityInspectionMapper.updateByPrimaryKey(saveParam);
95 99
         if (i > 0) {
96
-            saveParam.getItem().forEach(it -> qualityInspectionItemMapper.updateByPrimaryKey(it));
100
+            saveParam.getItem().forEach(it -> {
101
+                it.setUpdatedate(new Date());
102
+                qualityInspectionItemMapper.updateByPrimaryKey(it);
103
+            });
97 104
         }
98 105
         return i;
99 106
     }