Commit 5622bf4a authored by daniel's avatar daniel

perf(richText+module): 改造自主服务模块

parent 1d656452
## 打包
```bash
mvn clean package -DskipTests
```
\ No newline at end of file
......@@ -7,7 +7,8 @@ public class RichTextBean {
// 服务类型(3:特色民宿:4:旅游景点,5:特色餐饮 6:当地特产 7: 应急避险 8: 医疗点位 9:运动产品)
private String type;
// 点位类型 (1:打卡点,2:服务驿站,3:民宿:4:景点,5:餐饮)
private String category;
// 分类id
private Integer moduleId;
private String title;
private String lng;
// 赛事id
......
......@@ -155,6 +155,11 @@
a.cmpt_name as cmptName,
a.logo,
date_format(start_time,'%Y-%m-%d') startTime,
date_format(end_time,'%Y-%m-%d') endTime,
date_format(a.start_time,'%Y-%m-%d %H:%i:%s') as startTimeStr,
date_format(a.end_time,'%Y-%m-%d %H:%i:%s') as endTimeStr,
date_format(c.openTime,'%Y-%m-%d %H:%i:%s') as openTime,
date_format(c.deadLine,'%Y-%m-%d %H:%i:%s') as deadLine,
a.bg_color as cmptbgColor,
a.create_by AS "createBy",
a.create_date AS "createDate",
......@@ -251,7 +256,11 @@
<select id="getCmptFromEnroll" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt">
select cmptName,date_format(startTime,'%Y-%m-%d %H:%i:%s') startTime,
date_format(ifnull(endTime,now()),'%Y-%m-%d %H:%i:%s') endTime,type cmptType
date_format(ifnull(endTime,now()),'%Y-%m-%d %H:%i:%s') endTime,type as cmptType,
b.city as city,
b.province as province,
b.area as area,
b.location as location
from common.neucmpt a inner join raceenroll.competition b on a.gcmptid = b.cmptid
where a.gtcmptid=#{cmptid}
</select>
......
package com.dlbridge.jadp.plugins.cmpt.dao.mapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulCheckinRecords;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 活动签到打卡记录
*
* @author LI
*/
public interface JoyfulCheckinRecordsMapper {
int insJoyfulCheckinRecords(JoyfulCheckinRecords joyfulCheckinRecords);
List<JoyfulCheckinRecords> getJoyfulCheckinRecordsList(@Param("userId") String userId, @Param("offset") int offset, @Param("pageCount") int pageCount);
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.JoyfulCheckinRecordsMapper">
<insert id="insJoyfulCheckinRecords">
INSERT INTO gksite.joyful_checkin_records (
userId
,activity_id
,checkin_time
) VALUES (
#{userId}
,#{activityId}
,now()
)
</insert>
<select id="getJoyfulCheckinRecordsList" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulCheckinRecords">
SELECT
t2.title
,DATE_FORMAT(t1.checkin_time,'%Y/%m/%d %H:%i:%s') AS checkinTime
FROM
gksite.joyful_checkin_records t1
INNER JOIN gksite.joyful_rich_text t2
ON t1.activity_id = t2.id
AND t2.del_flg = '0'
WHERE
t1.userId = #{userId}
ORDER BY t1.checkin_time DESC
LIMIT #{offset}, #{pageCount}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.dlbridge.jadp.plugins.cmpt.dao.mapper.JoyfulRichTextMapper">
<insert id="insJoyfulRichText">
INSERT INTO gksite.joyful_rich_text(
userId
,type
,category
,title
,address
,lng
,lat
,content
,img_url
,remark1
,remark2
,remark3
,remark4
,status
,del_flg
,create_time
,create_user
) VALUES (
#{userId}
,#{type}
,#{category}
,#{title}
,#{address}
,#{lng}
,#{lat}
,#{content}
,#{imgUrl}
,#{remark1}
,#{remark2}
,#{remark3}
,#{remark4}
,#{status}
,'0'
,now()
,#{userId}
)
</insert>
<update id="updJoyfulRichText">
UPDATE
gksite.joyful_rich_text
SET
userId = #{userId}
,type = #{type}
,category = #{category}
,title = #{title}
,address = #{address}
,lng = #{lng}
,lat = #{lat}
,content = #{content}
,img_url = #{imgUrl}
,remark1 = #{remark1}
,remark2 = #{remark2}
,remark3 = #{remark3}
,remark4 = #{remark4}
,status = #{status}
,update_time = now()
,update_user = #{userId}
WHERE
id = #{id}
</update>
<update id="delJoyfulRichText">
UPDATE
gksite.joyful_rich_text
SET
del_flg = '1'
,update_time = now()
,update_user = #{userId}
WHERE
id = #{id}
</update>
<select id="getJoyfulRichTextById" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulRichText">
SELECT id
, userId
, type
, title
, address
, lng
, lat
, content
, img_url AS imgUrl
, remark1
, remark2
, remark3
, remark4
, status
, category
FROM gksite.joyful_rich_text
WHERE id = #{id}
</select>
<select id="getJoyfulRichTextList" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulRichText">
SELECT
id
,title
,address
,lng
,lat
,img_url AS imgUrl
,remark1
,remark2
,remark3
,remark4
,type
,status
,category
FROM
gksite.joyful_rich_text
WHERE
del_flg = '0'
<if test="type != null and type != ''">
AND type = #{type}
</if>
<if test="title != null and title != ''">
AND title like concat('%',#{title},'%')
</if>
<if test="category != null and category != ''">
AND FIND_IN_SET(#{category}, category)
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -13,7 +13,7 @@ public interface ModuleMapper {
int delete(Module module);
List<Module> getList(@Param("status") Integer status);
List<Module> getList(@Param("cmptId") Integer cmptId,@Param("status") Integer status);
int update(Module module);
......
......@@ -4,13 +4,10 @@
<insert id="add">
INSERT INTO gk_module (
icon, name, sort, path, is_deleted, status, create_time, update_time
) VALUES (
#{icon}, #{name}, #{sort}, #{path}, #{isDeleted}, #{status}, NOW(), NOW()
)
icon, name, sort, path, is_deleted, status, create_time, update_time,cmpt_id
) VALUES (#{icon}, #{name}, #{sort}, #{path}, #{isDeleted}, #{status}, NOW(), NOW(),#{cmptId})
</insert>
<update id="delete">
UPDATE gk_module
SET is_deleted = true
......@@ -18,21 +15,21 @@
</update>
<select id="getList" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.Module">
SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime
SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status,cmpt_id AS cmptId, create_time AS createTime, update_time AS updateTime
FROM gk_module
WHERE is_deleted = 0
WHERE is_deleted = 0 AND cmpt_id = #{cmptId}
<if test="status!= null">
AND status = #{status}
</if>
ORDER BY sort ASC
</select>
<select id="getById" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.Module">
SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime
SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status,cmpt_id AS cmptId, create_time AS createTime, update_time AS updateTime
FROM gk_module
WHERE id = #{id} AND is_deleted = 0
</select>
<select id="getByName" resultType="com.dlbridge.jadp.plugins.cmpt.dao.model.Module">
SELECT id, icon, name,path, sort, is_deleted AS isDeleted, status, create_time AS createTime, update_time AS updateTime
SELECT id, icon, name,path, sort, is_deleted AS isDeleted,cmpt_id AS cmptId, status, create_time AS createTime, update_time AS updateTime
FROM gk_module
WHERE name = #{name} AND is_deleted = 0
</select>
......
......@@ -20,5 +20,5 @@ public interface RichTextMapper {
List<RichText> getById(@Param("id") String id);
List<RichText> getPage(@Param("type") String type, @Param("title") String title, @Param("category") String category,@Param("cmptId") Integer cmptId, @Param("page") Integer page, @Param("pageSize") Integer pageSize);
List<RichText> getPage(@Param("type") String type, @Param("title") String title, @Param("moduleId") Integer category,@Param("cmptId") Integer cmptId, @Param("page") Integer page, @Param("pageSize") Integer pageSize);
}
\ No newline at end of file
......@@ -5,7 +5,9 @@
<insert id="add">
INSERT INTO gksite.gk_rich_text( userId
, type
, category
, path
, app_id
, module_id
, title
, address
, lng
......@@ -23,7 +25,9 @@
, cmpt_id)
VALUES ( #{userId}
, #{type}
, #{category}
, #{path}
, #{appId}
, #{moduleId}
, #{title}
, #{address}
, #{lng}
......@@ -47,7 +51,9 @@
SET
userId = #{userId}
,type = #{type}
,category = #{category}
,app_id = #{appId}
,path = #{path}
,module_id = #{moduleId}
,title = #{title}
,address = #{address}
,lng = #{lng}
......@@ -81,6 +87,8 @@
SELECT id
, userId
, cmpt_id AS cmptId
, app_id AS appId
, path
, type
, title
, address
......@@ -93,7 +101,7 @@
, remark3
, remark4
, status
, category
, module_id AS moduleId
FROM gksite.gk_rich_text
WHERE id = #{id}
</select>
......@@ -103,6 +111,8 @@
id
,title
,address
,app_id AS appId
,path
,lng
,lat
,img_url AS imgUrl
......@@ -112,7 +122,7 @@
,remark4
,type
,status
,category
,module_id AS moduleId
FROM
gksite.gk_rich_text
WHERE
......@@ -126,8 +136,8 @@
<if test="title != null and title != ''">
AND title like concat('%',#{title},'%')
</if>
<if test="category != null and category != ''">
AND FIND_IN_SET(#{category}, category)
<if test="moduleId != null and moduleId != ''">
AND FIND_IN_SET(#{moduleId}, module_id)
</if>
LIMIT #{pageSize} OFFSET #{page}
</select>
......
......@@ -33,6 +33,26 @@ public class Cmpt extends JaapRecord<Cmpt> {
private String startTime;
@ApiModelProperty(value = "赛事结束时间", notes = "赛事结束时间")
private String endTime;
@ApiModelProperty(value = "赛事开始时间", notes = "赛事开始时间")
private String startTimeStr;
@ApiModelProperty(value = "赛事结束时间", notes = "赛事结束时间")
private String endTimeStr;
@ApiModelProperty(value = "报名开始时间", notes = "报名开始时间")
private String openTime;
@ApiModelProperty(value = "报名结束时间", notes = "报名结束时间")
private String deadLine;
@ApiModelProperty(value = "城市", notes = "城市")
private String city;
@ApiModelProperty(value = "省份", notes = "省份")
private String province;
@ApiModelProperty(value = "区域", notes = "区域")
private String area;
@ApiModelProperty(value = "详细地址", notes = "详细地址")
private String location;
private boolean isDayRank;
private boolean isWeekRank;
......@@ -47,6 +67,11 @@ public class Cmpt extends JaapRecord<Cmpt> {
private int cmptStatus;
@ApiModelProperty(value = "报名状态", notes = "报名状态")
private int enrollStatus;
@ApiModelProperty(value = "比赛状态", notes = "比赛状态")
private int openStatus;
private int auditStatus;
}
package com.dlbridge.jadp.plugins.cmpt.dao.model;
import lombok.Data;
@Data
public class JoyfulCheckinRecords {
private String userId;
private String activityId;
private String checkinTime;
private String title;
}
\ No newline at end of file
......@@ -7,8 +7,12 @@ import java.sql.Timestamp;
@Data
public class Module {
private Long id;
//赛事id
private Long cmptId;
// 图标URL
private String icon;
......@@ -34,5 +38,6 @@ public class Module {
// 更新时间
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Timestamp updateTime;
}
......@@ -7,10 +7,10 @@ public class RichText {
private Integer id;
private Integer userId;
private Integer cmptId;
// 服务类型(3:特色民宿:4:旅游景点,5:特色餐饮 6:当地特产 7: 应急避险 8: 医疗点位 9:运动产品)
// 类型配置(1 网页 2 小程序(appId,path) 3 短连接(#小程序://) 4 页面(小程序) 5文档word,pdf 6 图片 png 7 定位)
private Integer type;
// 点位类型 (1:打卡点,2:服务驿站,3:民宿:4:景点,5:餐饮)
private String category;
// 分类id
private Integer moduleId;
private String title;
private String address;
private Double lng;
......@@ -23,4 +23,8 @@ public class RichText {
private String remark4;
private Integer status;
private Integer delFlg;
// appId
private String appId;
// 小程序路径/文件地址/图片地址
private String path;
}
\ No newline at end of file
package com.dlbridge.jadp.plugins.cmpt.service;
import com.dlbridge.jadp.plugins.cmpt.dao.mapper.JoyfulCheckinRecordsMapper;
import com.dlbridge.jadp.plugins.cmpt.dao.model.JoyfulCheckinRecords;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* 活动签到打卡记录
*
* @author LI
*/
@Service
public class JoyfulCheckinRecordsService {
@Resource
JoyfulCheckinRecordsMapper joyfulCheckinRecordsMapper;
/**
* 活动签到打卡记录 追加
*
* @param joyfulCheckinRecords
* @return
*/
public int insJoyfulCheckinRecords(JoyfulCheckinRecords joyfulCheckinRecords) {
return joyfulCheckinRecordsMapper.insJoyfulCheckinRecords(joyfulCheckinRecords);
}
/**
* 活动签到打卡记录 条件检索
*
* @param userId
* @param pageNo
* @param pageCount
* @return
*/
public List<JoyfulCheckinRecords> getJoyfulCheckinRecordsList(String userId, int pageNo, int pageCount) {
int offset = PointService.getOffset(pageNo, pageCount);
List<JoyfulCheckinRecords> joyfulCheckinRecordsList = joyfulCheckinRecordsMapper.getJoyfulCheckinRecordsList(userId, offset, pageCount);
return joyfulCheckinRecordsList;
}
}
\ No newline at end of file
......@@ -21,8 +21,8 @@ public class ModuleService {
return moduleMapper.delete(module);
}
public List<Module> listModules(Integer status) {
return moduleMapper.getList(status);
public List<Module> listModules(Integer cmptId,Integer status) {
return moduleMapper.getList(cmptId,status);
}
public int updateModuleStatus(Module module) {
......
......@@ -82,7 +82,7 @@ public class RichTextService {
* @return
*/
public List<RichText> getPage(RichTextBean richTextBean, int page, int pageSize) {
List<RichText> RichTextList = richTextMapper.getPage(richTextBean.getType(), richTextBean.getTitle(),richTextBean.getCategory(),richTextBean.getCmptId(),page,pageSize);
List<RichText> RichTextList = richTextMapper.getPage(richTextBean.getType(), richTextBean.getTitle(),richTextBean.getModuleId(),richTextBean.getCmptId(),page,pageSize);
if (StringUtils.isNotBlank(richTextBean.getDistance())) {
RichTextList = RichTextList.stream().filter(model -> this.notGtDistance(model, richTextBean)).collect(Collectors.toList());
}
......
......@@ -132,6 +132,9 @@ public class MicroApiController {
@Resource
CustomerService customerService;
@Resource
private WeatherService weatherService;
@PostMapping(value = "/bindCmpt")
@ApiResponses({
@ApiResponse(code = 200, message = "成功"),
......@@ -1495,6 +1498,25 @@ public class MicroApiController {
return Result.success().setContent(hashOperations.keys("best_mark_no"));
}
@GetMapping(value = "/getWeatherNow/{areacode}")
@ApiOperation(value = "当前天气", notes = "当前天气", tags = "当前天气")
@ApiImplicitParam(value = "地区编码", name = "areacode", required = true, paramType = "path", defaultValue = "101090301")
public Result<Map<String, Object>> getWeatherNow(@PathVariable("areacode") String areacode) {
Map<String, Object> map = weatherService.getWeatherNow(areacode);
return Result.success().setContent(map);
}
@GetMapping(value = "/getWeatherDay/{areacode}/{days}")
@ApiOperation(value = "近期天气", notes = "近期天气", tags = "近期天气")
@ApiImplicitParams({
@ApiImplicitParam(value = "地区编码", name = "areacode", required = true, paramType = "path", defaultValue = "101090301"),
@ApiImplicitParam(value = "未来天数", name = "days", required = true, paramType = "path", defaultValue = "3")})
public Result<Map<String, Object>> getWeatherDay(@PathVariable("areacode") String areacode, @PathVariable("days") String days) {
Map<String, Object> map = weatherService.getWeatherDay(areacode, days);
return Result.success().setContent(map);
}
public static void main(String[] args) {
System.out.println("-aaa".split("-")[0]+","+"-aaa".split("-")[1]);
}
......
package com.dlbridge.jadp.plugins.cmpt.web;
import com.dlbridge.jadp.common.interceptor.PageView;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Cmpt;
import com.dlbridge.jadp.plugins.cmpt.dao.model.Module;
import com.dlbridge.jadp.plugins.cmpt.service.CmptService;
import com.dlbridge.jadp.plugins.cmpt.service.ModuleService;
import com.neusoft.www.utils.web.Result;
import io.swagger.annotations.Api;
......@@ -10,6 +13,7 @@ import io.swagger.annotations.ApiSort;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import java.util.List;
......@@ -17,14 +21,15 @@ import java.util.List;
@Log4j2
@RestController
@RequestMapping(value = "gk/module")
@Api(value = "自助服务模块", tags = "自助服务模块")
@Api(value = "分类管理", tags = "分类管理")
@ApiSort(10)
public class ModuleController {
@Resource
private ModuleService moduleService;
//-------------------------自助服务模块-----------------------
//-------------------------服务分类模块-----------------------
@PostMapping("/add")
@ApiOperation(value = "新增服务模块", notes = "新增一个新的服务模块")
......@@ -33,16 +38,6 @@ public class ModuleController {
if (StringUtils.isBlank(module.getName())) {
return Result.fail().setMsg("服务模块名称不能为空!");
}
if (StringUtils.isBlank(module.getIcon())) {
return Result.fail().setMsg("服务模块图标不能为空!");
}
if (StringUtils.isBlank(module.getIcon())) {
return Result.fail().setMsg("服务模块图标不能为空!");
}
Module exitModule = moduleService.getModuleByName(module.getName());
if(exitModule != null){
return Result.fail().setMsg("服务模块已存在!");
}
int result = moduleService.addModule(module);
if (result != 1) {
return Result.fail().setMsg("新增失败!");
......@@ -56,13 +51,6 @@ public class ModuleController {
if (StringUtils.isBlank(module.getName())) {
return Result.fail().setMsg("服务模块名称不能为空!");
}
if (StringUtils.isBlank(module.getIcon())) {
return Result.fail().setMsg("服务模块图标不能为空!");
}
if (StringUtils.isBlank(module.getPath())) {
return Result.fail().setMsg("跳转路径不能为空!");
}
int result = moduleService.updateModule(module);
if (result != 1) {
return Result.fail().setMsg("更新失败!");
......@@ -88,8 +76,8 @@ public class ModuleController {
@GetMapping("/list")
@ApiOperation(value = "获取服务模块列表", notes = "获取所有服务模块列表")
public Result<List<Module>> listModules(@RequestParam(value = "status", required = false) Integer status) {
List<Module> serviceModules = moduleService.listModules(status);
public Result<List<Module>> listModules(@RequestParam(value = "cmptId") Integer cmptId,@RequestParam(value = "status", required = false) Integer status) {
List<Module> serviceModules = moduleService.listModules(cmptId,status);
return Result.success().setContent(serviceModules);
}
......
......@@ -23,7 +23,7 @@ public class ModuleSettingController {
@RequestMapping("index/{cmptId}")
@PageView
public ModelAndView outterLink(@PathVariable("cmptId") Integer cmptId, ModelAndView mv) {
public ModelAndView modulePage(@PathVariable("cmptId") Integer cmptId, ModelAndView mv) {
Cmpt cmpt = cmptService.queryCmptBycmptId(cmptId);
mv.addObject("cmpt", cmpt);
......
......@@ -29,7 +29,7 @@ public class ServiceSettingController {
@RequestMapping("index/{cmptId}")
@PageView
public ModelAndView outterLink(@PathVariable("cmptId") Integer cmptId, ModelAndView mv) {
public ModelAndView servicePage(@PathVariable("cmptId") Integer cmptId, ModelAndView mv) {
Cmpt cmpt = cmptService.queryCmptBycmptId(cmptId);
mv.addObject("cmpt", cmpt);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment