瀏覽代碼

提交修改

xieb 4 年之前
父節點
當前提交
d6c9f820cc

+ 17 - 5
src/main/java/com/steerinfo/baseinfo/meterfilestorage/controller/MeterFileStorageController.java

@@ -1,5 +1,6 @@
 package com.steerinfo.baseinfo.meterfilestorage.controller;
 
+import com.steerinfo.baseinfo.meterfilestorage.mapper.MeterFileStorageMapper;
 import com.steerinfo.framework.controller.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageList;
@@ -14,10 +15,8 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ArrayList;
+import java.text.SimpleDateFormat;
+import java.util.*;
 import java.math.BigDecimal;
 
 /**
@@ -39,6 +38,8 @@ public class MeterFileStorageController extends BaseRESTfulController {
 
     @Autowired
     IMeterFileStorageService meterFileStorageService;
+    @Autowired
+    MeterFileStorageMapper meterFileStorageMapper;
 
     @ApiOperation(value="获取列表", notes="分页查询")
     @ApiImplicitParams({
@@ -68,7 +69,18 @@ public class MeterFileStorageController extends BaseRESTfulController {
     @ApiImplicitParam(name = "meterFileStorage", value = "详细实体meterFileStorage", required = true, dataType = "MeterFileStorage")
     //@RequiresPermissions("meterfilestorage:create")
     @PostMapping(value = "/")
-    public RESTfulResult add(@ModelAttribute MeterFileStorage model){
+    public RESTfulResult add(@RequestBody MeterFileStorage model){
+        if (model == null) {
+            return failed("参数为空");
+        }
+        if (model.getFilePath() == null || "".equals(model.getFilePath())) {
+            return failed("请上传文件后在进行新增操作");
+        }
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        String no = meterFileStorageMapper.getNewID(sdf.format(new Date()));
+        model.setFileId(sdf.format(new Date()) + no);
+        model.setCreateTime(new Date());
+        model.setValidFlag("1");
         MeterFileStorage meterFileStorage = meterFileStorageService.add(model);
         return success(meterFileStorage);
     }

+ 1 - 0
src/main/java/com/steerinfo/baseinfo/meterfilestorage/mapper/MeterFileStorageMapper.java

@@ -7,4 +7,5 @@ import org.apache.ibatis.annotations.Mapper;
 
 @Mapper
 public interface MeterFileStorageMapper extends IBaseMapper<MeterFileStorage, String> {
+    String getNewID(@org.apache.ibatis.annotations.Param(value="afl")String afl);
 }

+ 4 - 1
src/main/java/com/steerinfo/baseinfo/meterfilestorage/mapper/MeterFileStorageMapper.xml

@@ -362,5 +362,8 @@
   </delete>
   <!-- 友情提示!!!-->
   <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
-  
+  <select id="getNewID" parameterType="java.lang.String" resultType="java.lang.String">
+    SELECT LPAD(NVL(MAX(TO_NUMBER(SUBSTR(FILE_ID,9))),0) + 1,4,'0') FILE_ID
+    FROM METER_FILE_STORAGE where instr(FILE_ID,#{afl,jdbcType=VARCHAR})>0
+  </select>
 </mapper>

+ 12 - 5
src/main/java/com/steerinfo/meterwork/meterworknotice/controller/MeterWorkNoticeController.java

@@ -4,6 +4,8 @@ import com.steerinfo.framework.controller.BaseRESTfulController;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageList;
 import com.steerinfo.framework.utils.collection.ListUtils;
+import com.steerinfo.meterwork.meterworkcaractual.mapper.MeterWorkCarActualMapper;
+import com.steerinfo.meterwork.meterworknotice.mapper.MeterWorkNoticeMapper;
 import com.steerinfo.meterwork.meterworknotice.model.MeterWorkNotice;
 import com.steerinfo.meterwork.meterworknotice.service.IMeterWorkNoticeService;
 import io.swagger.annotations.ApiImplicitParam;
@@ -14,10 +16,8 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ArrayList;
+import java.text.SimpleDateFormat;
+import java.util.*;
 import java.math.BigDecimal;
 
 /**
@@ -39,6 +39,7 @@ public class MeterWorkNoticeController extends BaseRESTfulController {
 
     @Autowired
     IMeterWorkNoticeService meterWorkNoticeService;
+    MeterWorkNoticeMapper meterWorkNoticeMapper;
 
     @ApiOperation(value="获取列表", notes="分页查询")
     @ApiImplicitParams({
@@ -68,7 +69,13 @@ public class MeterWorkNoticeController extends BaseRESTfulController {
     @ApiImplicitParam(name = "meterWorkNotice", value = "详细实体meterWorkNotice", required = true, dataType = "MeterWorkNotice")
     //@RequiresPermissions("meterworknotice:create")
     @PostMapping(value = "/")
-    public RESTfulResult add(@ModelAttribute MeterWorkNotice model){
+    public RESTfulResult add(@RequestBody MeterWorkNotice model){
+        if (model == null) {
+            return failed("参数为空");
+        }
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        model.setPublishTime(new Date());
+        model.setValidFlag("0");
         MeterWorkNotice meterWorkNotice = meterWorkNoticeService.add(model);
         return success(meterWorkNotice);
     }

+ 1 - 0
src/main/java/com/steerinfo/meterwork/meterworknotice/mapper/MeterWorkNoticeMapper.java

@@ -7,4 +7,5 @@ import org.apache.ibatis.annotations.Mapper;
 
 @Mapper
 public interface MeterWorkNoticeMapper extends IBaseMapper<MeterWorkNotice, String> {
+    String getNewID(@org.apache.ibatis.annotations.Param(value="afl")String afl);
 }

+ 4 - 1
src/main/java/com/steerinfo/meterwork/meterworknotice/mapper/MeterWorkNoticeMapper.xml

@@ -391,5 +391,8 @@
   </delete>
   <!-- 友情提示!!!-->
   <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
-  
+  <select id="getNewID" parameterType="java.lang.String" resultType="java.lang.String">
+    SELECT LPAD(NVL(MAX(TO_NUMBER(SUBSTR(NOTICE_ID,9))),0) + 1,4,'0') NOTICE_ID
+    FROM METER_WORK_NOTICE where instr(NOTICE_ID,#{afl,jdbcType=VARCHAR})>0
+  </select>
 </mapper>

+ 8 - 5
src/main/java/com/steerinfo/meterwork/meterworknotice/model/MeterWorkNotice.java

@@ -4,6 +4,8 @@ import com.steerinfo.framework.model.IBasePO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.util.Date;
+
 @ApiModel(value="通知公告表")
 public class MeterWorkNotice implements IBasePO<String> {
     /**
@@ -63,8 +65,9 @@ public class MeterWorkNotice implements IBasePO<String> {
     /**
      * 发布时间(PUBLISH_TIME,VARCHAR,30)
      */
-    @ApiModelProperty(value="发布时间",required=false)
-    private String publishTime;
+
+    @ApiModelProperty(value="创建时间(YYYY-MM-DD HH:mm:SS)",required=true)
+    private Date publishTime;
 
     /**
      * 修改人(EDIT_MAN,VARCHAR,30)
@@ -162,12 +165,12 @@ public class MeterWorkNotice implements IBasePO<String> {
         this.publishMan = publishMan == null ? null : publishMan.trim();
     }
 
-    public String getPublishTime() {
+    public Date getPublishTime() {
         return publishTime;
     }
 
-    public void setPublishTime(String publishTime) {
-        this.publishTime = publishTime == null ? null : publishTime.trim();
+    public void setPublishTime(Date publishTime) {
+        this.publishTime = publishTime;
     }
 
     public String getEditMan() {