xiao547607 5 jaren geleden
bovenliggende
commit
57f606eb66

+ 36 - 3
src/main/java/com/jpsoft/smart/modules/base/controller/InformationInfoController.java

@@ -35,7 +35,39 @@ public class InformationInfoController {
 
         return msgResult;
     }
-    
+
+    @ApiOperation(value="添加信息")
+    @PostMapping("addMobile")
+    public MessageResult<InformationInfo> addMobile(@RequestBody InformationInfo informationInfo,@RequestAttribute String subject){
+        MessageResult<InformationInfo> msgResult = new MessageResult<>();
+
+        try {
+            informationInfo.setId(UUID.randomUUID().toString());
+            informationInfo.setDelFlag(false);
+            informationInfo.setCreateBy(subject);
+            informationInfo.setCreateTime(new Date());
+            informationInfo.setStatus("0");
+
+            int affectCount = informationInfoService.insert(informationInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(informationInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+
     @ApiOperation(value="添加信息")
     @PostMapping("add")
     public MessageResult<InformationInfo> add(@RequestBody InformationInfo informationInfo,@RequestAttribute String subject){
@@ -46,7 +78,8 @@ public class InformationInfoController {
             informationInfo.setDelFlag(false);
             informationInfo.setCreateBy(subject);
             informationInfo.setCreateTime(new Date());
-            
+            informationInfo.setStatus("0");
+
             int affectCount = informationInfoService.insert(informationInfo);
 
             if (affectCount > 0) {
@@ -207,7 +240,7 @@ public class InformationInfoController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("id_","asc"));
+        sortList.add(new Sort("create_time","desc"));
 
         if (StringUtils.isNotEmpty(id)) {
             searchParams.put("id","%" + id + "%");

+ 50 - 0
src/main/java/com/jpsoft/smart/modules/business/controller/MobileApiController.java

@@ -3,8 +3,10 @@ package com.jpsoft.smart.modules.business.controller;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.github.pagehelper.Page;
 import com.jpsoft.smart.config.RedisConfig;
+import com.jpsoft.smart.modules.base.entity.InformationInfo;
 import com.jpsoft.smart.modules.base.entity.RechargeRecord;
 import com.jpsoft.smart.modules.base.entity.RoomInfo;
+import com.jpsoft.smart.modules.base.service.InformationInfoService;
 import com.jpsoft.smart.modules.base.service.RechargeRecordService;
 import com.jpsoft.smart.modules.base.service.RoomInfoService;
 import com.jpsoft.smart.modules.business.service.RechargeService;
@@ -47,6 +49,10 @@ public class MobileApiController {
     @Autowired
     private RechargeRecordService rechargeRecordService;
 
+    @Autowired
+    private InformationInfoService informationInfoService;
+
+
     @Autowired
     ValueOperations<String, Object> valueOperations;
 
@@ -432,4 +438,48 @@ public class MobileApiController {
 
         return msgResult;
     }
+
+
+    @PostMapping(value="addMobile")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="ownerId",value="户主ID",dataType="string",paramType = "query"),
+            @ApiImplicitParam(name="content",value="内容",dataType="string",paramType = "query"),
+            @ApiImplicitParam(name="type",value="类型/1投诉/2报修",dataType="string",paramType = "query")
+    })
+    public MessageResult<InformationInfo> addMobile(
+            String ownerId,
+            String content,
+            String type){
+        MessageResult<InformationInfo> msgResult = new MessageResult<>();
+        InformationInfo informationInfo = new InformationInfo();
+        try {
+            informationInfo.setId(UUID.randomUUID().toString());
+            informationInfo.setDelFlag(false);
+            informationInfo.setCreateBy(ownerId);
+            informationInfo.setCreateTime(new Date());
+            informationInfo.setStatus("0");
+            informationInfo.setContent(content);
+            informationInfo.setOwnerId(ownerId);
+            informationInfo.setType(type);
+            informationInfo.setOwnerId("1-2-1601");
+
+            int affectCount = informationInfoService.insert(informationInfo);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(informationInfo);
+            } else {
+                msgResult.setResult(false);
+                msgResult.setMessage("数据库添加失败");
+            }
+        }
+        catch(Exception ex){
+            log.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
 }