小程序首页景区列表,任务状态接口
This commit is contained in:
parent
961df0a151
commit
8cb58289df
@ -1,8 +1,17 @@
|
||||
package com.ycwl.basic.controller.mobile;
|
||||
|
||||
import com.ycwl.basic.annotation.IgnoreToken;
|
||||
import com.ycwl.basic.model.mobile.index.TopStateResp;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicAppVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicIndexVO;
|
||||
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
@ -13,7 +22,27 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Api(tags = "首页相关接口")
|
||||
public class AppIndexController {
|
||||
|
||||
@Autowired
|
||||
private AppScenicService scenicService;
|
||||
|
||||
/**
|
||||
* 首页景区列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "首页景区列表", notes = "首页景区列表")
|
||||
@PostMapping("/scenicList")
|
||||
@IgnoreToken
|
||||
public ApiResponse<List<ScenicAppVO>> scenicList(@RequestBody ScenicIndexVO scenicIndexVO) {
|
||||
return scenicService.scenicList(scenicIndexVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "顶部状态", notes = "顶部状态")
|
||||
@GetMapping("/topState")
|
||||
@IgnoreToken
|
||||
public ApiResponse<TopStateResp> topState() {
|
||||
return scenicService.topState();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.ycwl.basic.controller.mobile;
|
||||
|
||||
import com.ycwl.basic.annotation.IgnoreToken;
|
||||
import com.ycwl.basic.model.mobile.DTO.WeChatUserInfoDTO;
|
||||
import com.ycwl.basic.model.mobile.DTO.WeChatUserInfoUpdateDTO;
|
||||
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoDTO;
|
||||
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoUpdateDTO;
|
||||
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
||||
import com.ycwl.basic.service.mobile.AppMemberService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
|
@ -1,8 +1,8 @@
|
||||
package com.ycwl.basic.mapper.pc;
|
||||
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicAppVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicIndexVO;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.req.ScenicAddOrUpdateReq;
|
||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||
@ -19,20 +19,28 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface ScenicMapper {
|
||||
List<ScenicRespVO> list(ScenicReqQuery scenicReqQuery);
|
||||
|
||||
ScenicRespVO getById(Long id);
|
||||
|
||||
int add(ScenicAddOrUpdateReq scenic);
|
||||
|
||||
int deleteById(Long id);
|
||||
|
||||
int update(ScenicAddOrUpdateReq scenic);
|
||||
|
||||
int updateStatus(Long id);
|
||||
|
||||
/**
|
||||
* 添加景区配置
|
||||
*
|
||||
* @param scenicConfig
|
||||
* @return
|
||||
*/
|
||||
int addConfig(ScenicConfigEntity scenicConfig);
|
||||
|
||||
/**
|
||||
* 修改景区配置
|
||||
*
|
||||
* @param scenicConfigEntity
|
||||
* @return
|
||||
*/
|
||||
@ -40,6 +48,7 @@ public interface ScenicMapper {
|
||||
|
||||
/**
|
||||
* 根据景区id删除配置
|
||||
*
|
||||
* @param scenicId
|
||||
*/
|
||||
void deleteConfigByscenicId(Long scenicId);
|
||||
@ -47,4 +56,12 @@ public interface ScenicMapper {
|
||||
List<ScenicAppVO> appList(ScenicReqQuery scenicReqQuery);
|
||||
|
||||
ApiResponse<ScenicRespVO> getAppById(Long id);
|
||||
|
||||
/**
|
||||
* 通过经纬度计算景区距离
|
||||
*
|
||||
* @param scenicIndexVO
|
||||
* @return
|
||||
*/
|
||||
List<ScenicAppVO> scenicListByLnLa(ScenicIndexVO scenicIndexVO);
|
||||
}
|
||||
|
@ -15,15 +15,26 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface SourceMapper {
|
||||
List<SourceRespVO> list(SourceReqQuery sourceReqQuery);
|
||||
|
||||
SourceRespVO getById(Long id);
|
||||
|
||||
int add(SourceEntity source);
|
||||
|
||||
int deleteById(Long id);
|
||||
|
||||
int update(SourceEntity source);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param sourceReqQuery
|
||||
* @return
|
||||
*/
|
||||
List<SourceRespVO> listGroupByType(SourceReqQuery sourceReqQuery);
|
||||
|
||||
/**
|
||||
* 用户素材数量
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
int countByMemberId(String userId);
|
||||
}
|
||||
|
@ -1,8 +1,5 @@
|
||||
package com.ycwl.basic.mapper.pc;
|
||||
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicEntity;
|
||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
|
||||
import com.ycwl.basic.model.pc.task.req.TaskReqQuery;
|
||||
import com.ycwl.basic.model.pc.task.resp.TaskRespVO;
|
||||
@ -18,9 +15,30 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface TaskMapper {
|
||||
List<TaskRespVO> list(TaskReqQuery taskReqQuery);
|
||||
|
||||
TaskRespVO getById(Long id);
|
||||
|
||||
int add(TaskEntity task);
|
||||
|
||||
int deleteById(Long id);
|
||||
|
||||
int update(TaskEntity task);
|
||||
|
||||
int updateStatus(Long id, Integer status);
|
||||
|
||||
/**
|
||||
* 用户制作中的视频数量
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
int countByMemberIdStau(String userId);
|
||||
|
||||
/**
|
||||
* 用户合成的视频
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
int countByMemberIdStauFinish(String userId);
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
package com.ycwl.basic.model.mobile.index;
|
||||
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: songmingsong
|
||||
* @CreateTime: 2024-12-06
|
||||
* @Description: 顶部状态
|
||||
* @Version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("顶部状态")
|
||||
public class TopStateResp {
|
||||
@ApiModelProperty("是否录入有效人脸")
|
||||
private Boolean isFace = false;
|
||||
@ApiModelProperty("是否有专属视频待制作")
|
||||
private Boolean madeVideos = false;
|
||||
@ApiModelProperty("是否有专属视频合成中")
|
||||
private Boolean compositingVideo = false;
|
||||
@ApiModelProperty("AI合成了多少个视频,null时没有合成的视频")
|
||||
private Integer aiVideoNum;
|
||||
}
|
@ -1,13 +1,10 @@
|
||||
package com.ycwl.basic.model.mobile.scenic;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ycwl.basic.model.pc.scenic.entity.ScenicConfigEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
@ -67,4 +64,16 @@ public class ScenicAppVO {
|
||||
*/
|
||||
@ApiModelProperty("详细地址")
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* 距离
|
||||
*/
|
||||
@ApiModelProperty("距离")
|
||||
private BigDecimal distance;
|
||||
|
||||
/**
|
||||
* 机位数量
|
||||
*/
|
||||
@ApiModelProperty("机位数量")
|
||||
private Integer deviceNum;
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
package com.ycwl.basic.model.mobile.scenic;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author:songmingsong
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("首页景区列表")
|
||||
public class ScenicIndexVO {
|
||||
@ApiModelProperty("经度")
|
||||
private BigDecimal longitude;
|
||||
@ApiModelProperty("纬度")
|
||||
private BigDecimal latitude;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.ycwl.basic.model.mobile.DTO;
|
||||
package com.ycwl.basic.model.mobile.weChat.DTO;
|
||||
|
||||
|
||||
import lombok.Data;
|
@ -1,4 +1,4 @@
|
||||
package com.ycwl.basic.model.mobile.DTO;
|
||||
package com.ycwl.basic.model.mobile.weChat.DTO;
|
||||
|
||||
|
||||
import lombok.Data;
|
@ -1,4 +1,4 @@
|
||||
package com.ycwl.basic.model.mobile;
|
||||
package com.ycwl.basic.model.mobile.weChat;
|
||||
|
||||
|
||||
import lombok.Data;
|
@ -1,6 +1,5 @@
|
||||
package com.ycwl.basic.model.pc.face.resp;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -25,6 +24,8 @@ public class FaceRespVO {
|
||||
private String matchSampleIds;
|
||||
@ApiModelProperty("匹配率")
|
||||
private BigDecimal firstMatchRate;
|
||||
@ApiModelProperty("人脸图片得分,不高的提示用户重新录入")
|
||||
private BigDecimal score;
|
||||
@ApiModelProperty("匹配的结果,JSON字符串")
|
||||
private String matchResult;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
|
@ -11,8 +11,8 @@ import com.ycwl.basic.enums.WechatErrorCodeEnum;
|
||||
import com.ycwl.basic.exception.AppException;
|
||||
import com.ycwl.basic.mapper.pc.MemberMapper;
|
||||
import com.ycwl.basic.model.jwt.JwtInfo;
|
||||
import com.ycwl.basic.model.mobile.DTO.WeChatUserInfoDTO;
|
||||
import com.ycwl.basic.model.mobile.DTO.WeChatUserInfoUpdateDTO;
|
||||
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoDTO;
|
||||
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoUpdateDTO;
|
||||
import com.ycwl.basic.model.pc.member.entity.MemberEntity;
|
||||
import com.ycwl.basic.model.pc.member.req.MemberReqQuery;
|
||||
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
||||
|
@ -3,18 +3,25 @@ package com.ycwl.basic.service.impl.mobile;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.constant.BaseContextHandler;
|
||||
import com.ycwl.basic.mapper.pc.DeviceMapper;
|
||||
import com.ycwl.basic.mapper.pc.ScenicMapper;
|
||||
import com.ycwl.basic.constant.NumberConstant;
|
||||
import com.ycwl.basic.mapper.pc.*;
|
||||
import com.ycwl.basic.model.mobile.index.TopStateResp;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicAppVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicIndexVO;
|
||||
import com.ycwl.basic.model.pc.face.req.FaceReqQuery;
|
||||
import com.ycwl.basic.model.pc.face.resp.FaceRespVO;
|
||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||
import com.ycwl.basic.service.mobile.AppScenicService;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -29,6 +36,15 @@ public class AppScenicServiceImpl implements AppScenicService {
|
||||
private ScenicMapper scenicMapper;
|
||||
@Autowired
|
||||
private DeviceMapper deviceMapper;
|
||||
@Autowired
|
||||
private FaceMapper faceMapper;
|
||||
@Autowired
|
||||
private SourceMapper sourceMapper;
|
||||
@Autowired
|
||||
private TaskMapper taskMapper;
|
||||
|
||||
@Value("${face.score}")
|
||||
private BigDecimal faceScore;
|
||||
|
||||
@Override
|
||||
public ApiResponse<PageInfo<ScenicAppVO>> pageQuery(ScenicReqQuery scenicReqQuery) {
|
||||
@ -49,4 +65,42 @@ public class AppScenicServiceImpl implements AppScenicService {
|
||||
public ApiResponse<ScenicRespVO> getDetails(Long id) {
|
||||
return scenicMapper.getAppById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<List<ScenicAppVO>> scenicList(ScenicIndexVO scenicIndexVO) {
|
||||
List<ScenicAppVO> dataList = scenicMapper.scenicListByLnLa(scenicIndexVO);
|
||||
return ApiResponse.success(dataList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApiResponse<TopStateResp> topState() {
|
||||
TopStateResp topStateResp = new TopStateResp();
|
||||
String userId = BaseContextHandler.getUserId();
|
||||
if (StringUtils.isBlank(userId)) {
|
||||
return ApiResponse.success(topStateResp);
|
||||
}
|
||||
// 查询是否有人脸
|
||||
FaceReqQuery faceReqQuery = new FaceReqQuery();
|
||||
faceReqQuery.setMemberId(Long.parseLong(userId));
|
||||
List<FaceRespVO> list = faceMapper.list(faceReqQuery);
|
||||
for (FaceRespVO faceRespVO : list) {
|
||||
if (faceRespVO.getScore().compareTo(faceScore) >= NumberConstant.ZERO) {
|
||||
topStateResp.setIsFace(true);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询是否有专属视频待制作
|
||||
int sourceNum = sourceMapper.countByMemberId(userId);
|
||||
topStateResp.setMadeVideos(sourceNum > 0);
|
||||
|
||||
// 是否有专属视频合成中
|
||||
int taskSynthesizingNum = taskMapper.countByMemberIdStau(userId);
|
||||
topStateResp.setCompositingVideo(taskSynthesizingNum > 0);
|
||||
|
||||
// AI合成了多少个视频 完成
|
||||
int taskFinishNum = taskMapper.countByMemberIdStauFinish(userId);
|
||||
topStateResp.setAiVideoNum(taskFinishNum);
|
||||
|
||||
return ApiResponse.success(topStateResp);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.ycwl.basic.service.mobile;
|
||||
|
||||
import com.ycwl.basic.model.mobile.DTO.WeChatUserInfoDTO;
|
||||
import com.ycwl.basic.model.mobile.DTO.WeChatUserInfoUpdateDTO;
|
||||
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoDTO;
|
||||
import com.ycwl.basic.model.mobile.weChat.DTO.WeChatUserInfoUpdateDTO;
|
||||
import com.ycwl.basic.model.pc.member.resp.MemberRespVO;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
|
||||
|
@ -1,12 +1,16 @@
|
||||
package com.ycwl.basic.service.mobile;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.ycwl.basic.model.mobile.index.TopStateResp;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicAppVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicDeviceCountVO;
|
||||
import com.ycwl.basic.model.mobile.scenic.ScenicIndexVO;
|
||||
import com.ycwl.basic.model.pc.scenic.req.ScenicReqQuery;
|
||||
import com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO;
|
||||
import com.ycwl.basic.utils.ApiResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:longbinbin
|
||||
* @Date:2024/12/6 10:23
|
||||
@ -17,4 +21,19 @@ public interface AppScenicService {
|
||||
ApiResponse<ScenicDeviceCountVO> deviceCountByScenicId(Long scenicId);
|
||||
|
||||
ApiResponse<ScenicRespVO> getDetails(Long id);
|
||||
|
||||
/**
|
||||
* 首页景区列表,按照距离排序
|
||||
*
|
||||
* @param scenicIndexVO
|
||||
* @return
|
||||
*/
|
||||
ApiResponse<List<ScenicAppVO>> scenicList(ScenicIndexVO scenicIndexVO);
|
||||
|
||||
/**
|
||||
* 首页顶部状态
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ApiResponse<TopStateResp> topState();
|
||||
}
|
||||
|
@ -88,6 +88,10 @@ wx:
|
||||
# 商户APIV3密钥
|
||||
apiV3: 1
|
||||
|
||||
# 人脸合格得分
|
||||
face:
|
||||
score: 80
|
||||
|
||||
#阿里云OSS
|
||||
aliYunOss:
|
||||
endpoint: "https://oss-cn-shanghai.aliyuncs.com"
|
||||
|
@ -42,7 +42,7 @@
|
||||
</if>
|
||||
</delete>
|
||||
<select id="list" resultType="com.ycwl.basic.model.pc.face.resp.FaceRespVO">
|
||||
select id, member_id, face_url, match_sample_ids, first_match_rate, match_result
|
||||
select id, member_id, face_url,score, match_sample_ids, first_match_rate, match_result
|
||||
from face
|
||||
<where>
|
||||
<if test="memberId!= null and memberId!= ''">
|
||||
@ -66,7 +66,7 @@
|
||||
</where>
|
||||
</select>
|
||||
<select id="getById" resultType="com.ycwl.basic.model.pc.face.resp.FaceRespVO">
|
||||
select id, member_id, face_url, match_sample_ids, first_match_rate, match_result
|
||||
select id, member_id, face_url,score, match_sample_ids, first_match_rate, match_result
|
||||
from face
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
@ -146,6 +146,31 @@
|
||||
from scenic s
|
||||
where `status` = 1 and s.id = #{id}
|
||||
</select>
|
||||
<select id="scenicListByLnLa" resultType="com.ycwl.basic.model.mobile.scenic.ScenicAppVO">
|
||||
select s.id,
|
||||
`name`,
|
||||
`phone`,
|
||||
introduction,
|
||||
longitude,
|
||||
latitude,
|
||||
radius,
|
||||
province,
|
||||
city,
|
||||
area,
|
||||
address,
|
||||
(SELECT COUNT(1) FROM device WHERE scenic_id = s.id AND status = 1) as deviceNum,
|
||||
ifnull(
|
||||
cast(
|
||||
ST_Distance_Sphere(
|
||||
Point(longitude, latitude), Point(#{params.longitude}, #{params.latitude})
|
||||
) AS
|
||||
DECIMAL(10, 2)
|
||||
), 0
|
||||
) AS distance
|
||||
from scenic s
|
||||
where `status` = 1
|
||||
ORDER BY distance ASC
|
||||
</select>
|
||||
|
||||
<resultMap id="scenicAndConfig" type="com.ycwl.basic.model.pc.scenic.resp.ScenicRespVO">
|
||||
<id property="id" column="id"/>
|
||||
|
@ -54,4 +54,7 @@
|
||||
</where>
|
||||
group by so.type
|
||||
</select>
|
||||
<select id="countByMemberId" resultType="java.lang.Integer">
|
||||
select count(1) from source where member_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
@ -45,4 +45,14 @@ from task
|
||||
from task
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="countByMemberIdStau" resultType="java.lang.Integer">
|
||||
select count(1) from task
|
||||
where member_id = #{userId} and status IN (0,2)
|
||||
</select>
|
||||
<select id="countByMemberIdStauFinish" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from task
|
||||
where member_id = #{userId}
|
||||
and status = 1
|
||||
</select>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user