Browse Source

群众评议完结

jz.kai 2 years ago
parent
commit
1ca3b34c6a

+ 1 - 0
common/src/main/resources/mapper/base/Office.xml

@@ -80,6 +80,7 @@ id_,area_id,name_,del_flag,create_time,create_by,update_time,update_by		from bas
 			select * from base_office
 		]]>
 		<where>
+			del_flag = 0
 			<if test="searchParams.areaId != null">
 				and area_id = #{searchParams.areaId}
 			</if>

+ 139 - 0
web/src/main/java/com/jpsoft/excellent/modules/open/OfficeOpinionApiController.java

@@ -0,0 +1,139 @@
+package com.jpsoft.excellent.modules.open;
+
+import com.github.pagehelper.Page;
+import com.jpsoft.excellent.config.OSSConfig;
+import com.jpsoft.excellent.modules.base.entity.*;
+import com.jpsoft.excellent.modules.base.service.*;
+import com.jpsoft.excellent.modules.common.dto.MessageResult;
+import com.jpsoft.excellent.modules.common.dto.Sort;
+import com.jpsoft.excellent.modules.common.utils.OSSUtil;
+import com.jpsoft.excellent.modules.common.utils.SMSUtil;
+import com.jpsoft.excellent.modules.sys.entity.DataDictionary;
+import com.jpsoft.excellent.modules.sys.entity.SysLog;
+import com.jpsoft.excellent.modules.sys.service.DataDictionaryService;
+import com.jpsoft.excellent.modules.sys.service.SysLogService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+import sun.misc.BASE64Decoder;
+
+import java.io.ByteArrayInputStream;
+import java.text.SimpleDateFormat;
+import java.util.*;
+
+@RestController
+@RequestMapping("/open/officeOpinionApi")
+@Api(description = "移动端")
+public class OfficeOpinionApiController {
+    private Logger logger = LoggerFactory.getLogger(getClass());
+
+    @Autowired
+    private OSSConfig ossConfig;
+    @Autowired
+    private SysLogService sysLogService;
+    @Autowired
+    private DataDictionaryService dataDictionaryService;
+    @Autowired
+    private WorkStationService workStationService;
+    @Autowired
+    private WorkWindowService workWindowService;
+    @Autowired
+    private OfficeService officeService;
+    @Autowired
+    private OfficeOpinionService officeOpinionService;
+    @Autowired
+    private AreaService areaService;
+
+    @ApiOperation(value="添加反馈信息")
+    @PostMapping("add")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="connect", value="联系人", required=true, paramType="query"),
+            @ApiImplicitParam(name="connectPhone", value="联系电话", required=true, paramType="query"),
+            @ApiImplicitParam(name="officeId", value="单位编号", required=true, paramType="query"),
+            @ApiImplicitParam(name="isSatisfied", value="是否满意", required=true, paramType="query", dataType="Boolean"),
+            @ApiImplicitParam(name="content", value="内容", paramType="query"),
+            @ApiImplicitParam(name="appendixs", value="附件", paramType="query"),
+    })
+    public MessageResult<OfficeOpinion> add(String connect,String connectPhone,String officeId,String isSatisfied,String content,String[] appendixs){
+        MessageResult<OfficeOpinion> msgResult = new MessageResult<>();
+
+        try {
+            OfficeOpinion officeOpinion = new OfficeOpinion();
+            officeOpinion.setId(UUID.randomUUID().toString());
+            officeOpinion.setConnect(connect);
+            officeOpinion.setConnectPhone(connectPhone);
+            officeOpinion.setOfficeId(officeId);
+            if("0".equals(isSatisfied)) {
+                officeOpinion.setIsSatisfied(false);
+            }
+            else{
+                officeOpinion.setIsSatisfied(true);
+            }
+            officeOpinion.setContent(content);
+            officeOpinion.setAppendix(String.join(",",appendixs));
+            officeOpinion.setDelFlag(false);
+            officeOpinion.setCreateTime(new Date());
+            officeOpinion.setOpinionStatus(false);
+            officeOpinion.setConfirmStatus(false);
+            
+            int affectCount = officeOpinionService.insert(officeOpinion);
+
+            if (affectCount > 0) {
+                msgResult.setResult(true);
+                msgResult.setData(officeOpinion);
+            } 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("officeList")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name="name", value="单位名", required=true, paramType="query"),
+    })
+    public MessageResult officeList(String name){
+        MessageResult msgResult = new MessageResult<>();
+
+        try {
+            Map<String, Object> searchParams = new HashMap<>();
+            if (StringUtils.isNotEmpty(name)) {
+                searchParams.put("name","%" + name + "%");
+            }
+
+            List<Sort> sortList = new ArrayList<>();
+            sortList.add(new Sort("name_", "asc"));
+
+            Page<Office> page = officeService.pageSearch(searchParams, 1, 10000, false, sortList);
+
+            msgResult.setResult(true);
+            msgResult.setData(page.getResult());
+        }
+        catch(Exception ex){
+            logger.error(ex.getMessage(),ex);
+
+            msgResult.setResult(false);
+            msgResult.setMessage(ex.getMessage());
+        }
+
+        return msgResult;
+    }
+}

+ 5 - 5
web/src/main/resources/application-dev.yml

@@ -5,12 +5,12 @@ server:
 
 spring:
   datasource:
-#    url: jdbc:log4jdbc:mysql://39.104.144.104:3308/double_excellent?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
-#    username: root
-#    password: jpsoft8121234
-    url: jdbc:log4jdbc:mysql://192.168.33.20:3306/double_excellent?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+    url: jdbc:log4jdbc:mysql://39.104.144.104:3308/double_excellent?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
     username: root
-    password: jpsoft2016
+    password: jpsoft8121234
+#    url: jdbc:log4jdbc:mysql://192.168.33.20:3306/double_excellent?autoReconnect=true&characterEncoding=utf8&serverTimezone=GMT%2B8
+#    username: root
+#    password: jpsoft2016
   devtools:
     add-properties: false
     restart: