Browse Source

新增沙盘模块,修改专家模块

wuweihao 3 years ago
parent
commit
123adc6b83

+ 1 - 1
gis_cms/src/main/java/com/gis/cms/controller/ExpertController.java

@@ -52,7 +52,7 @@ public class ExpertController {
         return entityService.remove(id);
     }
 
-    @ApiOperation("场景详情")
+    @ApiOperation("详情")
     @GetMapping("detail/{id}")
     public Result<ExpertEntity> detail(@PathVariable Long id) {
         return entityService.detail(id);

+ 13 - 28
gis_cms/src/main/java/com/gis/cms/controller/WebController.java

@@ -20,7 +20,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
-import java.util.List;
 
 
 /**
@@ -78,14 +77,23 @@ public class WebController {
     }
 
 
-    @ApiOperation("专家风采-列表")
-    @PostMapping("expertList")
-    public Result<ExpertEntity> expertList() {
-        return expertService.webList();
+    @ApiOperation(value = "专家风采-列表", notes = "专家类型:1:一级,2:二级,3:三级,4:院士, 5:其他, " +
+                                                    "loyal_1: 百世老人, loyal_2:英模专家")
+    @PostMapping("expertList/{type}")
+    public Result<ExpertEntity> expertList(@PathVariable String type) {
+        return expertService.webList(type);
+
     }
 
 
 
+    @ApiOperation("专家详情")
+    @GetMapping("expertDetail/{id}")
+    public Result<ExpertEntity> expertDetail(@PathVariable Long id) {
+        return expertService.detail(id);
+    }
+
+
     @WebControllerLog(description = "门户网站-弹幕列表")
     @ApiOperation("弹幕-列表")
     @PostMapping("barrage/list")
@@ -156,10 +164,6 @@ public class WebController {
 
 
 
-
-
-
-
     @WebControllerLog(description = "门户网站-获取题目")
     @ApiOperation("门户网站-获取题目")
     @PostMapping("questionGroup/list")
@@ -190,24 +194,5 @@ public class WebController {
     }
 
 
-//    @WebControllerLog(description = "门户网站-找回密码", addDb = true)
-//    @ApiOperation(value = "门户网站-找回密码", notes = "验证正确返回code, 否则为空对象")
-//    @PostMapping("retrieve/password")
-//    public Result retrievePassword(@RequestBody ResetPasswordDto param){
-//        return sysUserService.retrievePassword(param);
-//    }
-//
-//    @WebControllerLog(description = "门户网站-修改密码", addDb = true)
-//    @ApiOperation("门户网站-修改密码")
-//    @PostMapping("updatePwd")
-//    public Result updatePwd(@Valid @RequestBody PasswordDto param) {
-//        // 密码加密了,需要解密
-//        String newPassword = Base64Converter.decodePassword(param.getNewPassword());
-//        param.setNewPassword(newPassword);
-//
-//        return sysUserService.updatePwdByWeb(param);
-//
-//    }
-
 
 }

+ 0 - 150
gis_cms/src/main/java/com/gis/cms/controller/WebManageController.java

@@ -1,150 +0,0 @@
-package com.gis.cms.controller;
-
-import com.gis.admin.entity.dto.UserDto;
-import com.gis.admin.entity.dto.UserWebDto;
-import com.gis.admin.entity.po.SysUserEntity;
-import com.gis.admin.service.SysUserService;
-import com.gis.cms.entity.dto.CountAnswerDto;
-import com.gis.cms.entity.po.QuestionGroupEntity;
-import com.gis.cms.service.*;
-import com.gis.common.base.aop.WebControllerLog;
-import com.gis.common.base.entity.dto.PageDateDto;
-import com.gis.common.constant.ConfigConstant;
-import com.gis.common.util.RedisUtil;
-import com.gis.common.util.Result;
-import com.gis.cms.entity.dto.CommentDto;
-import com.gis.cms.entity.dto.ExpertDto;
-import com.gis.cms.entity.dto.StatusPageDataDto;
-import com.gis.cms.entity.vo.CommentVo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import springfox.documentation.annotations.ApiIgnore;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.validation.Valid;
-
-/**
- * Created by owen on 2021/6/28 0028 10:58
- */
-@ApiIgnore
-@Slf4j
-@Api(tags = "门户网站(需要token)")
-@RestController
-@RequestMapping("cms/web/manage")
-public class WebManageController {
-
-    @Autowired
-    BarrageService barrageService;
-
-    @Autowired
-    QuestionGroupService questionGroupService;
-
-    @Autowired
-    QuestionUserService questionUserService;
-
-    @Autowired
-    CommentService commentService;
-
-    @Autowired
-    ExpertService mournService;
-
-    @Autowired
-    SysUserService sysUserService;
-
-    @Autowired
-    RedisUtil redisUtil;
-
-    @Autowired
-    HttpServletRequest request;
-
-    @Autowired
-    ConfigConstant configConstant;
-
-
-
-
-//    @WebControllerLog(description = "门户网站-弹幕新增留言", addDb = true)
-//    @ApiOperation("门户网站-弹幕新增留言")
-//    @PostMapping("barrageSave")
-//    public Result barrageSave(@Valid @RequestBody CommentDto param) {
-//        return barrageService.saveEntity(param);
-//    }
-
-    @WebControllerLog(description = "门户网站-题组列表", addDb = true)
-    @ApiOperation("门户网站-题组列表")
-    @PostMapping("questionGroup/list")
-    public Result<QuestionGroupEntity> questionGroupList(@Valid @RequestBody StatusPageDataDto param) {
-        param.setStatus(3);
-        return questionGroupService.search(param, 1);
-    }
-
-    @WebControllerLog(description = "门户网站-题组详情", addDb = true)
-    @ApiOperation("门户网站-题组详情")
-    @GetMapping("questionGroup/detail/{id}")
-    public Result<QuestionGroupEntity> questionGroupDetail(@PathVariable Long id) {
-        return questionGroupService.detail(id);
-    }
-
-
-    @WebControllerLog(description = "门户网站-提交答案", addDb = true)
-    @ApiOperation(value = "门户网站-提交答案")
-    @PostMapping("questionUser/submit")
-    public Result questionUserSubmit(@Valid @RequestBody CountAnswerDto param) {
-        return questionUserService.submit2(param);
-    }
-
-
-    @WebControllerLog(description = "门户网站-答题排名")
-    @ApiOperation(value = "门户网站-答题排名", notes = "排名前十的")
-    @GetMapping("questionUser/ranking/{questionGroupId}")
-    public Result questionUserRanking(@PathVariable Long questionGroupId) {
-        return questionUserService.ranking(questionGroupId);
-    }
-
-
-    @WebControllerLog(description = "门户网站-留言", addDb = true)
-    @ApiOperation(value = "门户网站-留言")
-    @PostMapping("comment/save")
-    public Result commentSave(@Valid @RequestBody CommentDto param) {
-        return commentService.saveEntity(param);
-    }
-
-    @WebControllerLog(description = "门户网站-留言树列表")
-    @ApiOperation("门户网站-留言树列表")
-    @PostMapping("comment/listTree")
-    public Result<CommentVo> list(@RequestBody PageDateDto param) {
-        return commentService.voListTree(param, 1);
-    }
-
-
-    @WebControllerLog(description = "门户网站-保存悼念留言", addDb = true)
-    @ApiOperation(value = "门户网站-保存悼念留言")
-    @PostMapping("mourn/save")
-    public Result mournSave(@Valid @RequestBody ExpertDto param) {
-        return mournService.saveEntity(param);
-    }
-
-    @ApiOperation("用户详情")
-    @GetMapping("user/detail/{id}")
-    public Result<SysUserEntity> detail(@PathVariable Long id) {
-        return sysUserService.detail(id);
-    }
-
-    @WebControllerLog(description = "用户管理-修改用户", addDb = true)
-    @ApiOperation("新增/修改用户信息")
-    @PostMapping("save")
-    public Result save(@Valid @RequestBody UserWebDto param) {
-        UserDto userDto = new UserDto();
-        BeanUtils.copyProperties(param, userDto);
-        return sysUserService.saveEntity(userDto);
-    }
-
-
-
-
-
-}

+ 1 - 1
gis_cms/src/main/java/com/gis/cms/entity/po/ExpertEntity.java

@@ -17,7 +17,7 @@ import java.io.Serializable;
 public class ExpertEntity extends BaseEntity implements Serializable {
     private static final long serialVersionUID = 7167520531265687441L;
 
-    @ApiModelProperty(value = "专家类型:1:一级,2:二级,3:三级,4:院士")
+    @ApiModelProperty(value = "专家类型:1:一级,2:二级,3:三级,4:院士, 5:其他")
     private Integer level;
 
     @ApiModelProperty(value = "姓名")

+ 4 - 0
gis_cms/src/main/java/com/gis/cms/mapper/ExpertMapper.java

@@ -2,6 +2,7 @@ package com.gis.cms.mapper;
 
 
 import com.gis.cms.entity.dto.ExpertPageDto;
+import com.gis.cms.mapper.provider.BaseProvider;
 import com.gis.cms.mapper.provider.ExpertProvider;
 import com.gis.common.base.entity.dto.PageDateDto;
 import com.gis.common.base.mapper.IBaseMapper;
@@ -23,5 +24,8 @@ public interface ExpertMapper extends IBaseMapper<ExpertEntity, Long> {
     @Update("update tb_mourn set visit = visit + 1 , update_time = NOW() where is_delete = 0  and id = #{id}")
     void addVisit(Long id);
 
+    @SelectProvider(type = BaseProvider.class, method = "selectSql")
+    List<ExpertEntity> expertSql(String sql);
+
 
 }

+ 7 - 0
gis_cms/src/main/java/com/gis/cms/mapper/MyBaseMapper.java

@@ -1,10 +1,15 @@
 package com.gis.cms.mapper;
 
 
+import com.gis.cms.entity.po.BarrageEntity;
 import com.gis.cms.entity.po.FileEntity;
+import com.gis.cms.mapper.provider.BarrageProvider;
+import com.gis.cms.mapper.provider.BaseProvider;
+import com.gis.common.base.entity.dto.PageDateDto;
 import com.gis.common.base.mapper.IBaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.SelectProvider;
 import org.apache.ibatis.annotations.Update;
 import org.springframework.stereotype.Component;
 
@@ -22,4 +27,6 @@ public interface MyBaseMapper extends IBaseMapper<FileEntity, Long> {
 
     @Select("select visit from tb_visit where is_delete = 0  and module = #{module}")
     Integer getVisit(String module);
+
+
 }

+ 17 - 0
gis_cms/src/main/java/com/gis/cms/mapper/provider/BaseProvider.java

@@ -0,0 +1,17 @@
+package com.gis.cms.mapper.provider;
+
+
+
+/**
+ * Created by owen on 2020/5/13.
+ */
+public class BaseProvider {
+
+    public String selectSql(String sql){
+
+        return sql;
+    }
+
+
+
+}

+ 1 - 1
gis_cms/src/main/java/com/gis/cms/service/ExpertService.java

@@ -29,7 +29,7 @@ public interface ExpertService extends IBaseService<ExpertEntity, Long> {
 
     void addVisit(Long id);
 
-    Result<ExpertEntity> webList();
+    Result<ExpertEntity> webList(String type);
 
     Result upload(MultipartFile file, String type);
 }

+ 81 - 47
gis_cms/src/main/java/com/gis/cms/service/impl/ExpertServiceImpl.java

@@ -1,18 +1,15 @@
 package com.gis.cms.service.impl;
 
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.io.FileUtil;
 import com.gis.cms.entity.dto.ExpertPageDto;
 import com.gis.cms.entity.dto.ExpertDto;
 import com.gis.cms.entity.po.ExpertEntity;
 import com.gis.cms.mapper.ExpertMapper;
+import com.gis.cms.mapper.MyBaseMapper;
 import com.gis.cms.service.SensitiveService;
 import com.gis.common.base.exception.BaseRuntimeException;
 import com.gis.common.base.mapper.IBaseMapper;
 import com.gis.common.base.service.impl.IBaseServiceImpl;
 import com.gis.common.constant.MsgCode;
-import com.gis.common.util.FileUtils;
-import com.gis.common.util.RegexUtil;
 import com.gis.common.util.Result;
 import com.gis.cms.service.ExpertService;
 import com.github.pagehelper.PageInfo;
@@ -41,6 +38,19 @@ public class ExpertServiceImpl extends IBaseServiceImpl<ExpertEntity, Long> impl
     @Autowired
     SensitiveService sensitiveService;
 
+
+    final static HashMap<String, String> typeMap;
+    static {
+        typeMap = new HashMap<>();
+        typeMap.put("1", "1");
+        typeMap.put("2", "2");
+        typeMap.put("3", "3");
+        typeMap.put("4", "4");
+        typeMap.put("5", "4");
+        typeMap.put("loyal_1", "1");
+        typeMap.put("loyal_2", "2");
+    }
+
     @Override
     public IBaseMapper<ExpertEntity, Long> getBaseMapper() {
         return this.entityMapper;
@@ -73,55 +83,79 @@ public class ExpertServiceImpl extends IBaseServiceImpl<ExpertEntity, Long> impl
         entityMapper.addVisit(id);
     }
 
+//    @Override
+//    public Result<ExpertEntity> webList(String type) {
+//        List<ExpertEntity> all = this.findAll();
+//
+//        List<ExpertEntity> levle_1 = new ArrayList<>();
+//        List<ExpertEntity> levle_2 = new ArrayList<>();
+//        List<ExpertEntity> levle_3 = new ArrayList<>();
+//        List<ExpertEntity> levle_4 = new ArrayList<>();
+//        List<ExpertEntity> levle_5 = new ArrayList<>();
+//        // 忠诚力量
+//        List<ExpertEntity> loyal_1 = new ArrayList<>();
+//        List<ExpertEntity> loyal_2 = new ArrayList<>();
+//        for (ExpertEntity entity : all) {
+//            Integer level = entity.getLevel();
+//            String type = entity.getType();
+//            if (level == 1) {
+//                levle_1.add(entity);
+//            } else if (level == 2) {
+//                levle_2.add(entity);
+//            } else if (level == 3) {
+//                levle_3.add(entity);
+//            }else if (level == 4) {
+//                levle_4.add(entity);
+//            }else if (level == 5) {
+//                levle_5.add(entity);
+//            }
+//
+//            // 添加 忠诚力量
+//            if (StringUtils.isNotBlank(type)) {
+//                if ("1".equals(type)){
+//                    loyal_1.add(entity);
+//                } else {
+//                    loyal_2.add(entity);
+//                }
+//            }
+//        }
+//        HashMap<Object, Object> result = new HashMap<>();
+//        result.put("level_1", levle_1);
+//        result.put("level_2", levle_2);
+//        result.put("level_3", levle_3);
+//        result.put("level_4", levle_4);
+//        result.put("level_5", levle_5);
+//        result.put("loyal_1", loyal_1);
+//        result.put("loyal_2", loyal_2);
+//
+//        return Result.success(result);
+//    }
+
     @Override
-    public Result<ExpertEntity> webList() {
-        List<ExpertEntity> all = this.findAll();
-
-        List<ExpertEntity> levle_1 = new ArrayList<>();
-        List<ExpertEntity> levle_2 = new ArrayList<>();
-        List<ExpertEntity> levle_3 = new ArrayList<>();
-        List<ExpertEntity> levle_4 = new ArrayList<>();
-        List<ExpertEntity> levle_5 = new ArrayList<>();
-        // 忠诚力量
-        List<ExpertEntity> loyal_1 = new ArrayList<>();
-        List<ExpertEntity> loyal_2 = new ArrayList<>();
-        for (ExpertEntity entity : all) {
-            Integer level = entity.getLevel();
-            String type = entity.getType();
-            if (level == 1) {
-                levle_1.add(entity);
-            } else if (level == 2) {
-                levle_2.add(entity);
-            } else if (level == 3) {
-                levle_3.add(entity);
-            }else if (level == 4) {
-                levle_4.add(entity);
-            }else if (level == 5) {
-                levle_5.add(entity);
-            }
+    public Result<ExpertEntity> webList(String type) {
+        StringBuffer sql = new StringBuffer();
+        sql.append("select * from tb_expert where is_delete = '0' and display=1 ");
 
-            // 添加 忠诚力量
-            if (StringUtils.isNotBlank(type)) {
-                if ("1".equals(type)){
-                    loyal_1.add(entity);
-                } else {
-                    loyal_2.add(entity);
-                }
-            }
+        String [] typeCheck = {"1","2","3","4","5","loyal_1","loyal_2"};
+        if (!Arrays.asList(typeCheck).contains(type)) {
+            return Result.failure("非法类型");
+        }
+        String key = typeMap.get(type);
+        if (type.startsWith("loyal_")){
+            sql.append(" and type='").append(key).append("'");
+        } else {
+            sql.append(" and level=").append(key);
         }
-        HashMap<Object, Object> result = new HashMap<>();
-        result.put("level_1", levle_1);
-        result.put("level_2", levle_2);
-        result.put("level_3", levle_3);
-        result.put("level_4", levle_4);
-        result.put("level_5", levle_5);
-        result.put("loyal_1", loyal_1);
-        result.put("loyal_2", loyal_2);
-
-        return Result.success(result);
+
+        sql.append(" order by create_time desc");
+        log.info("sql: {}", sql.toString());
+
+
+        return Result.success(entityMapper.expertSql(sql.toString()));
     }
 
 
+
     @Override
     public Result saveEntity(ExpertDto param) {
         Long id = param.getId();