Commit 238f4aef by 裴大威

Merge branch 'feat-1002766' into 'master'

1002766 add cookie check

See merge request rays/pcloud-book!634
parents 0335d905 3ce16fbb
......@@ -9,6 +9,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -58,6 +59,7 @@ public interface SearchFacade {
@ApiOperation("创建搜索记录H5")
@PostMapping("createSearchRecord4H5")
ResponseDto<?> createSearchRecord4H5(
@CookieValue(value = "userInfo") String userInfo,
@RequestBody SearchRecord searchRecord
) throws PermissionException;
......@@ -100,6 +102,7 @@ public interface SearchFacade {
@ApiOperation("获取用户最近搜索列表H5")
@GetMapping("getUserSearchList4H5")
ResponseDto<?> getUserSearchList4H5(
@CookieValue(value = "userInfo") String userInfo,
@RequestParam(value = "wxId", required = false) @ApiParam("用户id") String wxId,
@RequestParam(value = "wechatUserId", required = false) @ApiParam("微信id") Long wechatUserId,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
......
......@@ -9,11 +9,13 @@ import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.wechatgroup.message.enums.IsSystem;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -95,8 +97,10 @@ public class SearchFacadeImpl implements SearchFacade {
@PostMapping("createSearchRecord4H5")
@Override
public ResponseDto<?> createSearchRecord4H5(
@CookieValue(value = "userInfo") String userInfo,
@RequestBody SearchRecord searchRecord
) throws PermissionException {
Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
searchBiz.createSearchRecord4H5(searchRecord);
return new ResponseDto<>();
}
......@@ -177,12 +181,13 @@ public class SearchFacadeImpl implements SearchFacade {
@GetMapping("getUserSearchList4H5")
@Override
public ResponseDto<?> getUserSearchList4H5(
@CookieValue(value = "userInfo") String userInfo,
@RequestParam(value = "wxId", required = false) @ApiParam("用户id") String wxId,
@RequestParam(value = "wechatUserId", required = false) @ApiParam("微信id") Long wechatUserId,
@RequestParam("currentPage") @ApiParam("当前页") Integer currentPage,
@RequestParam("numPerPage") @ApiParam("每页条数") Integer numPerPage
) throws BizException, PermissionException {
return new ResponseDto<>(searchBiz.getUserSearchList4H5(wxId, wechatUserId, currentPage,numPerPage));
return new ResponseDto<>(searchBiz.getUserSearchList4H5(wxId, Cookie.getId(userInfo, Cookie._WECHAT_USER_ID), currentPage,numPerPage));
}
@ApiOperation("删除用户搜索记录H5")
......
......@@ -343,7 +343,7 @@ public class WechatGroupConsr {
try {
selfRobotDTO = ResponseHandleUtil.parseResponse(selfRobotService.getAvailableRobot(wechatUserId, largeTemplet, classifyId), SelfRobotDTO.class);
} catch (Exception e) {
log.error("获取可用机器人.[getAvailableRobot]:" + e.getMessage(), e);
log.error("获取可用机器人.[getAvailableRobot]:wechatUserId:{},largeTemplet:{},classifyId:{}",wechatUserId,largeTemplet,classifyId);
}
return selfRobotDTO;
}
......@@ -368,7 +368,7 @@ public class WechatGroupConsr {
try {
selfRobotDTO = ResponseHandleUtil.parseResponse(selfRobotService.getAvailableRobotByBookGroup(availableRobotParamDTO), SelfRobotDTO.class);
} catch (Exception e) {
log.error("获取可用机器人.[getAvailableRobotByBookGroup]:" + e.getMessage(), e);
log.error("获取可用机器人.[getAvailableRobotByBookGroup]获取参数为:{}",availableRobotParamDTO);
}
return selfRobotDTO;
}
......
......@@ -43,17 +43,19 @@ public class CultivateFacade {
@ApiOperation("新增养成")
@PostMapping("/createCultivate")
public ResponseDto<?> createCultivate(
@CookieValue(value = "userInfo") String userInfo,
@RequestBody CreateCultivateDTO createCultivateDTO
) throws BizException, PermissionException {
Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(cultivateBiz.createCultivate(createCultivateDTO));
}
@ApiOperation("获取养成")
@GetMapping("/getCultivate")
public ResponseDto<?> getCultivate(
@RequestParam("wechatUserId") @ApiParam("用户id") Long wechatUserId
@CookieValue(value = "userInfo") String userInfo
) throws BizException, PermissionException {
return new ResponseDto<>(cultivateBiz.getCultivate(wechatUserId));
return new ResponseDto<>(cultivateBiz.getCultivate(Cookie.getId(userInfo, Cookie._WECHAT_USER_ID)));
}
@ApiOperation("新增养成分类关联")
......@@ -68,8 +70,10 @@ public class CultivateFacade {
@ApiOperation("能量消耗")
@PostMapping("/energyConsumption")
public ResponseDto<?> getCultivate(
@CookieValue(value = "userInfo") String userInfo,
@RequestBody @ApiParam("养成分类关联")EnergyConsumptionDTO energyConsumptionDTO
) throws BizException, PermissionException {
Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
cultivateBiz.energyConsumption(energyConsumptionDTO);
return new ResponseDto<>();
}
......@@ -77,8 +81,10 @@ public class CultivateFacade {
@ApiOperation("银两兑换")
@PostMapping("/fishBallConversion")
public ResponseDto<?> fishBallConversion(
@CookieValue(value = "userInfo") String userInfo,
@RequestBody @ApiParam("银两兑换") FishBallConversionDTO fishBallConversionDTO
) throws BizException, PermissionException {
Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
cultivateBiz.fishBallConversion(fishBallConversionDTO);
return new ResponseDto<>();
}
......@@ -86,9 +92,10 @@ public class CultivateFacade {
@ApiOperation("新增技能使用记录")
@PostMapping("/addUseSkillRecord")
public ResponseDto<?> addUseSkillRecord(
@CookieValue(value = "userInfo") String userInfo,
@RequestBody @ApiParam("技能使用") SkillUseDTO skillUseDTO
) throws BizException, PermissionException {
Long wechatUserId=skillUseDTO.getWechatUserId();
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
cultivateBiz.addUseSkillRecord(wechatUserId,skillUseDTO);
return new ResponseDto<>();
}
......@@ -97,8 +104,10 @@ public class CultivateFacade {
@ApiOperation("银两摘取")
@PostMapping("/fishBallPick")
public ResponseDto<?> fishBallPick(
@CookieValue(value = "userInfo") String userInfo,
@RequestBody @ApiParam("银两摘取") FishBallPickDTO fishBallPickDTO
) throws BizException, PermissionException {
Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
cultivateBiz.fishBallPick(fishBallPickDTO);
return new ResponseDto<>();
}
......@@ -114,43 +123,35 @@ public class CultivateFacade {
@ApiOperation("获取动态记录列表")
@GetMapping("/getCultivateRecordList")
public ResponseDto<?> getCultivateRecordList(
@RequestParam Long wechatUserId,
@CookieValue(value = "userInfo") String userInfo,
@RequestParam("cultivateId") @ApiParam("养成id") Long cultivateId, @RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage
) throws BizException, PermissionException {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
if(!NumberUtil.isNumber(wechatUserId)){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(cultivateBiz.getCultivateRecordList(cultivateId,wechatUserId,currentPage,numPerPage));
}
@ApiOperation("获取陪伴天数")
@GetMapping("/getLoginDays")
public ResponseDto<?> getLoginDays(@RequestParam Long wechatUserId){
if(!NumberUtil.isNumber(wechatUserId)){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
public ResponseDto<?> getLoginDays(@CookieValue(value = "userInfo") String userInfo){
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(cultivateBiz.getLoginDays(wechatUserId));
}
@ApiOperation("获取排名")
@GetMapping("/getRanking")
public ResponseDto<?> getRanking(@RequestParam Long wechatUserId){
if(!NumberUtil.isNumber(wechatUserId)){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
public ResponseDto<?> getRanking(@CookieValue(value = "userInfo") String userInfo){
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(cultivateBiz.getRanking(wechatUserId));
}
@ApiOperation("分享")
@GetMapping("shareMedal")
public ResponseDto<?> shareMedal(@RequestParam Long wechatUserId){
if(!NumberUtil.isNumber(wechatUserId)){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
public ResponseDto<?> shareMedal(@CookieValue(value = "userInfo") String userInfo){
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(cultivateBiz.shareMedal(wechatUserId));
}
......@@ -165,8 +166,10 @@ public class CultivateFacade {
@ApiOperation("小睿养成读者喜好书籍")
@PostMapping("/createCultivateBookUser")
public ResponseDto<?> createCultivateBookUser(
@CookieValue(value = "userInfo") String userInfo,
@RequestBody CultivateBookUser cultivateBookUser
) throws BizException, PermissionException {
Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(cultivateBiz.createCultivateBookUser(cultivateBookUser));
}
......@@ -181,14 +184,13 @@ public class CultivateFacade {
@ApiOperation("获取搜索书籍记录列表")
@GetMapping("/getBookSearchRecord")
public ResponseDto<?> getBookSearchRecord(
@CookieValue(value = "userInfo" ,required = false) String userInfo,@RequestParam(value = "currentPage", required = false) Integer currentPage,
@CookieValue(value = "userInfo") String userInfo,@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage
) throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if(!NumberUtil.isNumber(wechatUserId)){
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
return new ResponseDto<>(cultivateBiz.getBookSearchRecord(wechatUserId,currentPage,numPerPage));
}
......
......@@ -97,7 +97,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
throw new BookBizException(BookBizException.ERROR,"已存在相同的权益设置");
}
rightsSetting.setUpdateTime(new Date());
rightsSettingDAO.updateByPrimaryKeySelective(rightsSetting);
rightsSettingDAO.updateByPrimaryKey(rightsSetting);
}
@Override
......
......@@ -28,7 +28,7 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement
@Override
public int updateByPrimaryKey(RightsSetting record) {
return super.getSqlSession().update(getStatement("updateByPrimaryKeySelective"),record);
return super.getSqlSession().update(getStatement("updateByPrimaryKey"),record);
}
@Override
......
......@@ -92,7 +92,6 @@
second_classify = #{secondClassify,jdbcType=BIGINT},
grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</update>
......
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