初始化

This commit is contained in:
谢洪龙
2017-07-10 11:41:07 +08:00
commit 6e08af9959
334 changed files with 26855 additions and 0 deletions
@@ -0,0 +1,55 @@
package com.ifish.action;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ifish.dto.JsonResult;
import com.ifish.enums.AdTypeEnum;
import com.ifish.enums.ResultEnum;
import com.ifish.exception.IfishException;
import com.ifish.service.AdInfoService;
/**
* 广告信息
*
* @author Administrator
*
*/
@Controller
@RequestMapping(value = "/adInfos")
@ResponseBody
public class AdInfoAction {
@Autowired
private AdInfoService adInfoService;
/**
* 根据类型获取广告信息
*
* @param adType
* @return
*/
@RequestMapping(value = "/type/{adType}", method = RequestMethod.GET)
public JsonResult<?> getAdInfosByType(@PathVariable("adType") int adType) {
//校验类型
AdTypeEnum adTypeEnum = AdTypeEnum.getAdTypeEnum(adType);
if (adTypeEnum == null) {
throw new IfishException(ResultEnum.error401);
}
return adInfoService.getAdInfosByType(adTypeEnum);
}
/**
* 获取广告信息表最大ID
*
* @return
*/
@RequestMapping(value = "getMaxInfo", method = RequestMethod.GET)
public JsonResult<?> getMaxInfo() {
return adInfoService.getMaxInfo();
}
}
@@ -0,0 +1,97 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.action;
import com.ifish.bean.CommodityInfoBean;
import com.ifish.dto.JsonResult;
import com.ifish.dto.PageingDto;
import com.ifish.enums.ResultEnum;
import com.ifish.exception.IfishException;
import com.ifish.helper.CommodityInfoHelperI;
import com.ifish.helper.RedisHelperI;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/**
*
* @author Administrator
*/
@RestController
public class CommodityAction {
@Autowired
private CommodityInfoHelperI commodityInfoHelperI;
/**
* 创建商品
*
* @param commodityInfoBean
* @return
*/
@RequestMapping(value = "/createCommodity", method = RequestMethod.POST)
public JsonResult<?> createCommodityInfo(CommodityInfoBean commodityInfoBean, MultipartFile img, MultipartFile video) {
return commodityInfoHelperI.createCommodityInfo(commodityInfoBean, img, video);
}
/**
* 修改商品
*
* @param commodityInfoBean
* @return
*/
@RequestMapping(value = "/updateCommodity", method = RequestMethod.POST)
public JsonResult<?> updateCommodityInfo(CommodityInfoBean commodityInfoBean) {
return commodityInfoHelperI.updateCommodityInfo(commodityInfoBean);
}
/**
* 根据商品ID查询商品详情
*
* @param commodityId
* @return
*/
@RequestMapping(value = "/getCommodityById", method = RequestMethod.GET)
public JsonResult<?> getCommodityInfo(Integer commodityId) {
return commodityInfoHelperI.getCommodityInfo(commodityId);
}
/**
* 根据店铺ID分页获取商品列表
*
* @param pageSize
* @param firstResult
* @param shopId
* @param commodityState
* @return
*/
@RequestMapping(value = "/getCommodityInfoByPage", method = RequestMethod.GET)
public PageingDto<?> getCommodityInfoByPage(Integer pageSize, Integer firstResult, Integer shopId, Integer commodityState, String orderBy) {
//参数校验
if (firstResult < 0 || (pageSize < 1 || pageSize > 20)) {
throw new IfishException(ResultEnum.error401);
}
if (commodityState == null) {
commodityState = 1;
}
return commodityInfoHelperI.getCommodityInfoByPage(pageSize, firstResult, shopId, commodityState, orderBy);
}
/**
* 删除商品
*
* @param commodityId
* @return
*/
@RequestMapping(value = "/deleteCommodityById", method = RequestMethod.POST)
public JsonResult<?> deleteCommodityInfo(Integer commodityId) {
return commodityInfoHelperI.deleteCommodityInfo(commodityId);
}
}
@@ -0,0 +1,63 @@
package com.ifish.action;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.ifish.dto.JsonResult;
import com.ifish.dto.PageingDto;
import com.ifish.enums.ResultEnum;
import com.ifish.exception.IfishException;
import com.ifish.service.CouponService;
import com.ifish.validator.PageParam;
/**
* 优惠券
* @author Administrator
*
*/
@RestController
public class CouponAction {
@Autowired
private CouponService couponService;
/**
* 获取所有有效优惠券
* @return
*/
@RequestMapping(value="/validatingCoupons",method=RequestMethod.GET)
public JsonResult<?> getAllValidCoupon(){
return couponService.getAllValidCoupon();
}
/**
* 兑换优惠券
* @param userId
* @param couponId
* @return
*/
@RequestMapping(value="/exchangeCoupon/{userId}/{couponId}",method=RequestMethod.POST)//
public JsonResult<?> exchangeCoupon(@PathVariable("userId")Integer userId,@PathVariable("couponId")Integer couponId){
return couponService.exchangeCoupon(userId, couponId);
}
/**
* 分页获取兑换记录
* @param param
* @return
*/
@RequestMapping(value="/couponRecords",method=RequestMethod.GET)
public PageingDto<?> getCouponRecordByPage(@Validated PageParam param,BindingResult result){
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return couponService.getCouponRecordByPage(param);
}
}
@@ -0,0 +1,32 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.action;
import com.ifish.helper.FastDFSClientI;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
/**
*
* @author Administrator
*/
@RestController
@RequestMapping("/file")
public class FileAction {
@Autowired
private FastDFSClientI fastDFSClientI;
@RequestMapping(value = "/fileupload", method = RequestMethod.POST)
public Object testfile(MultipartFile uploadFile, HttpServletRequest request) throws IOException {
return fastDFSClientI.uploadFileToFastDFS(uploadFile);
}
}
@@ -0,0 +1,109 @@
package com.ifish.action;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ifish.dto.JsonResult;
import com.ifish.enums.ResultEnum;
import com.ifish.exception.IfishException;
import com.ifish.service.GoldService;
import com.ifish.validator.AddValueParam;
import com.ifish.validator.PageParam;
/**
* 金币
* @author Administrator
*
*/
@Controller
@RequestMapping("/gold")
@ResponseBody
public class GoldAction {
@Autowired
private GoldService goldService;
/**
* 新增金币
* @param addValueParam
* @param result
* @return
*/
@RequestMapping(value="/goldValue.do",method=RequestMethod.POST)
public Object addGoldValue(@Validated AddValueParam addValueParam,BindingResult result) {
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return goldService.addGoldValue(addValueParam);
}
/**
* 分页金币获取记录
* @param pageParam
* @param result
* @return
*/
@RequestMapping(value="/goldGetRecord.do",method=RequestMethod.GET)
public Object getGoldGetRecordByPage(@Validated PageParam pageParam,BindingResult result){
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return goldService.getGoldGetRecordByPage(pageParam);
}
/**
* 分页金币消耗记录
* @param pageParam
* @param result
* @return
*/
@RequestMapping(value="/goldExpendRecord.do",method=RequestMethod.GET)
public Object getGoldExpendRecordByPage(@Validated PageParam pageParam,BindingResult result){
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return goldService.getGoldExpendRecordByPage(pageParam);
}
/**
* 签到
* @param userId
* @return
*/
@RequestMapping(value="/signin.do",method=RequestMethod.POST)
public Object signin(@RequestParam Integer userId) {
return goldService.signin(userId);
}
/**
* 砸金蛋
* @param userId
* @return
*/
@RequestMapping(value="/hitGoldenEgg.do",method=RequestMethod.POST)
public Object hitGoldenEgg(@RequestParam Integer userId){
return goldService.hitGoldenEgg(userId);
}
/**
* 爱鱼看看金币打赏
* @param userId 打赏人用户ID
* @param userId2 被打赏人用户ID
* @return
*/
@RequestMapping(value="/liveRoomReward/{userId}/{userId2}",method=RequestMethod.POST)
public JsonResult<?> liveRoomReward(@PathVariable("userId")Integer userId,@PathVariable("userId2")Integer userId2){
return goldService.liveRoomReward(userId, userId2);
}
}
@@ -0,0 +1,71 @@
package com.ifish.action;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ifish.enums.ResultEnum;
import com.ifish.exception.IfishException;
import com.ifish.service.GradeService;
import com.ifish.validator.AddValueParam;
import com.ifish.validator.PageParam;
/**
* 等级
* @author Administrator
*
*/
@Controller
@RequestMapping("/grade")
@ResponseBody
public class GradeAction {
@Autowired
private GradeService gradeService;
/**
* 新增经验值
* @param addValueParam
* @param result
* @return
*/
@RequestMapping(value="/gradeValue.do",method=RequestMethod.POST)
public Object addGradeValue(@Validated AddValueParam addValueParam,BindingResult result) {
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return this.gradeService.addGradeValue(addValueParam);
}
/**
* 获取规则等级信息
* @param version
* @return
*/
@RequestMapping(value="/gradeRuleInfo.do",method=RequestMethod.GET)
public Object gradeRuleInfo(@RequestParam Integer userId){
return this.gradeService.getGradeRuleInfo(userId);
}
/**
* 分页经验值获取记录
* @param pageParam
* @param result
* @return
*/
@RequestMapping(value="/gradeRecord.do",method=RequestMethod.GET)
public Object getGradeRecordByPage(@Validated PageParam pageParam,BindingResult result){
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return this.gradeService.getGradeRecordByPage(pageParam);
}
}
@@ -0,0 +1,54 @@
package com.ifish.action;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ifish.dto.JsonResult;
import com.ifish.entity.IfishDoctor;
import com.ifish.enums.ResultEnum;
import com.ifish.exception.IfishException;
import com.ifish.service.IfishDoctorService;
/**
*
* @author ggw
*
*/
@Controller
@RequestMapping("/ifishDoctor")
@ResponseBody
public class IfishDoctorAction {
@Autowired
private IfishDoctorService ifishDoctorService;
/**
* 提交问题
* @param ifishDoctor
* @return
*/
@RequestMapping(value="/v3/saveIfishDoctor.do",method=RequestMethod.POST)
public Object saveIfishDoctor(IfishDoctor ifishDoctor) {
return ifishDoctorService.saveIfishDoctor(ifishDoctor);
}
/**
* 金币打赏提交问题
* @param ifishDoctor
* @param result
* @return
*/
@RequestMapping(value="/payTourQuestion",method=RequestMethod.POST)
public JsonResult<?> payTourSubmitQuestion(String payTourType,@Validated IfishDoctor ifishDoctor,BindingResult result){
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return ifishDoctorService.payTourSubmitQuestion(ifishDoctor,payTourType);
}
}
@@ -0,0 +1,51 @@
package com.ifish.action;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.ifish.dto.JsonResult;
import com.ifish.enums.IfishShopPlaceEnum;
import com.ifish.enums.ResultEnum;
import com.ifish.exception.IfishException;
import com.ifish.service.IfishGoodsService;
/**
* 商品信息Controller
* @author Administrator
*
*/
@RestController
public class IfishGoodsAction {
@Autowired
private IfishGoodsService ifishGoodsService;
/**
* 根据位置获取商品信息
* @param goodsPlace
* @return
*/
@RequestMapping(value="/ifishGoods/type/{goodsType}",method=RequestMethod.GET)
public JsonResult<?> getIfishGoodsByGoodsPlace(@PathVariable("goodsType") Integer goodsPlace){
//校验类型
IfishShopPlaceEnum shopPlaceEnum = IfishShopPlaceEnum.getAdTypeEnum(goodsPlace);
if(shopPlaceEnum==null){
throw new IfishException(ResultEnum.error401);
}
return ifishGoodsService.getIfishGoodsByGoodsPlace(shopPlaceEnum);
}
/**
* 增加商品点击数
* @param goodsId
* @return
*/
@RequestMapping(value="/ifishGoods/{goodsId}/additionClickNum",method=RequestMethod.POST)
public JsonResult<?> addClickNum(@PathVariable("goodsId") Integer goodsId){
return ifishGoodsService.addClickNum(goodsId);
}
}
@@ -0,0 +1,76 @@
package com.ifish.action;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ifish.dto.JsonResult;
import com.ifish.dto.PageingDto;
import com.ifish.entity.Comment;
import com.ifish.enums.ResultEnum;
import com.ifish.exception.IfishException;
import com.ifish.service.InformationService;
import com.ifish.validator.PageParam;
@Controller
@ResponseBody
public class InformationAction {
@Autowired
private InformationService informationService;
/**
* 获取用户评论
* @param comment
* @return
*/
@RequestMapping(value="/information/v3/findCommentsByUeditorId.do",method=RequestMethod.POST)
public Object findCommentsByUeditorId(Integer ueditorId,Integer firstResult,Integer pageSize,HttpServletResponse response){
response.setHeader("Access-Control-Allow-Origin", "*");
return informationService.findCommentsByUeditorId(ueditorId, firstResult, pageSize);
}
/**
* 保存评论
* @param comment
* @return
*/
@RequestMapping(value="/information/v3/saveComment.do",method=RequestMethod.POST)
public Object saveComment(Comment comment,HttpServletResponse response){
response.setHeader("Access-Control-Allow-Origin", "*");
return informationService.saveComment(comment);
}
/**
* 分页获取资讯
* @param pageParam
* @param result
* @return
*/
@RequestMapping(value="/informations",method=RequestMethod.GET)
public PageingDto<?> getInformationsByPage(@Validated PageParam pageParam,BindingResult result){
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return informationService.getInformationsByPage(pageParam);
}
/**
* 增加点击数
* @param infoId
* @return
*/
@RequestMapping(value="/informations/{infoId}/additionClickNum",method=RequestMethod.POST)
public JsonResult<?> addClickNum(@PathVariable("infoId") Integer infoId){
return informationService.addClickNum(infoId);
}
}
@@ -0,0 +1,209 @@
package com.ifish.action;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.ifish.dto.JsonResult;
import com.ifish.dto.PageingDto;
import com.ifish.entity.LiveBanner;
import com.ifish.entity.LiveMessage;
import com.ifish.enums.LiveRoomOrderTypeEnum;
import com.ifish.enums.ResultEnum;
import com.ifish.enums.SubDirectoryEnum;
import com.ifish.exception.IfishException;
import com.ifish.service.LiveRoomService;
import com.ifish.util.IfishFilePath;
import com.ifish.util.IfishFileUtils;
import com.ifish.util.IfishUtil;
import com.ifish.util.ResultUtil;
import com.ifish.validator.LiveRoomParam;
import com.ifish.validator.PageParam;
/**
*
* @author ggw
*
*/
@RestController
public class LiveRoomAction {
@Autowired
private LiveRoomService liveRoomService;
/**
* 新增直播间
* @param liveRoom
* @param fileUpload
* @return
*/
@RequestMapping(value="/liveRoom/v3/addLiveRoom.do",method=RequestMethod.POST)
public JsonResult<?> addLiveRoom(MultipartFile fileUpload,LiveRoomParam liveRoomParam,BindingResult result){
//校验参数
if(result.hasErrors() || fileUpload==null){
throw new IfishException(ResultEnum.error401);
}
//上传封面不能大于1M
if(fileUpload.getSize()>1048576){
throw new IfishException(ResultEnum.warn206);
}
//新增直播间
JSONObject json = liveRoomService.addLiveRoom(liveRoomParam);
//图片名称
String picName = json.getInteger("roomId")+".png";
try {
//上传文件
IfishFileUtils.uploadFile(IfishFilePath.path_room_img, picName, fileUpload);
} catch (Exception e) {
throw new RuntimeException(e);
}
return ResultUtil.success(json);
}
/**
* 修改直播间
* @param liveRoom
* @param fileUpload
* @return
*/
@RequestMapping(value="/liveRoom/v3/updateLiveRoom.do",method=RequestMethod.POST)
public JsonResult<?> updateLiveRoom(MultipartFile fileUpload,@RequestParam("roomId")Integer roomId,LiveRoomParam liveRoomParam,BindingResult result){
//校验参数
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
//上传的图片不能大于1M
if(fileUpload!=null && fileUpload.getSize()>1048576){
throw new IfishException(ResultEnum.warn206);
}
//更新
JsonResult<?> jsonResult = liveRoomService.updateLiveRoom(roomId,liveRoomParam);
//更新文件
if(fileUpload!=null){
//图片名称
String picName = roomId+".png";
try {
//上传文件
IfishFileUtils.uploadFile(IfishFilePath.path_room_img, picName, fileUpload);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
return jsonResult;
}
/**
* 直播间人气加一
* @param roomId
* @return
*/
@RequestMapping(value="/liveRoom/v3/popularityValue.do",method=RequestMethod.POST)
public Object popularityValue(Integer roomId,Integer userId){
return liveRoomService.popularityValue(roomId,userId);
}
/**
* 获取直播间信息(修改直播间信息)
* @param roomId
* @return
*/
@RequestMapping(value="/liveRoom/v3/getLiveRoomInfo.do",method=RequestMethod.POST)
public Object getLiveRoomInfo(Integer userId){
return liveRoomService.getLiveRoomInfo(userId);
}
/**
* 获取直播列表
* @param firstResult
* @param pageSize
* @return
*/
@RequestMapping(value="/liveRoom/v3/getLiveRooms.do",method=RequestMethod.POST)
public Object popularityValue(Integer firstResult,Integer pageSize,Integer userId,String orders){
return liveRoomService.getLiveRoomsByPage(firstResult, pageSize,userId,orders);
}
/**
* 获取直播banner图
* @return
*/
@RequestMapping(value="/liveRoom/v3/getLiveBanners.do",method=RequestMethod.POST)
public Object getLiveBanners(){
List<LiveBanner> list = liveRoomService.getLiveBanners();
if(list!=null){
for (LiveBanner liveBanner : list) {
liveBanner.setBannerImg(IfishFilePath.getPath(SubDirectoryEnum.banner,liveBanner.getBannerImg()));
}
return IfishUtil.toJson(ResultEnum.success.getKey(), list);
}
return IfishUtil.toJson(ResultEnum.fail101.getKey(), "");
}
/**
* 直播间留言
* @param liveMessage
* @return
*/
@RequestMapping(value="/liveRoom/v3/leaveMessage.do",method=RequestMethod.POST)
public Object leaveMessage(LiveMessage liveMessage){
return liveRoomService.leaveMessage(liveMessage);
}
/**
* 留言列表
* @param liveMessage
* @return
*/
@RequestMapping(value="/liveRoom/v3/getLiveMessage.do",method=RequestMethod.POST)
public Object getLiveMessageByPage(Integer roomId,Integer firstResult,Integer pageSize){
return liveRoomService.getLiveMessageByPage(firstResult, pageSize, roomId);
}
/**
* 按类型分页获取直播间信息
* @param pageParam
* @param result
* @return
*/
@RequestMapping(value="/liveRooms",method=RequestMethod.GET)
public PageingDto<?> getLiveRoomByPate(@RequestParam("orderType") Integer orderType,@Validated PageParam pageParam,BindingResult result){
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
//按时间倒序
if(LiveRoomOrderTypeEnum.one.getKey().equals(orderType)){
return liveRoomService.getLiveRoomsByTime(pageParam);
}
//人气值倒序
else if(LiveRoomOrderTypeEnum.two.getKey().equals(orderType)){
return liveRoomService.getLiveRoomsByPopularityValue(pageParam);
}
//后台推荐顺序倒序
else if(LiveRoomOrderTypeEnum.three.getKey().equals(orderType)){
return liveRoomService.getLiveRoomsByTuijian(pageParam);
}
else{
throw new IfishException(ResultEnum.error402);
}
}
/**
* 直播间点赞
* @param roomId
* @param userId
* @return
*/
@RequestMapping(value="/liveRoomZan/{roomId}/{userId}",method=RequestMethod.POST)
public JsonResult<?> liveRoomsZan(@PathVariable("roomId")Integer roomId,@PathVariable("userId")Integer userId){
return liveRoomService.liveRoomsZan(roomId, userId);
}
}
@@ -0,0 +1,85 @@
package com.ifish.action;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ifish.dto.ShopsLookUserDto;
import com.ifish.entity.PushList;
import com.ifish.hibernate.Pagination;
import com.ifish.service.PageListService;
import com.ifish.util.IfishUtil;
/**
* @ClassName: PageListAction
* @Description: TODO
* @author ggw
*/
@Controller
@RequestMapping("/pageList")
public class PageListAction {
@Autowired
private PageListService pageListService;
private static Logger log = LoggerFactory.getLogger(PageListAction.class);
/**
* 推送信息列表
*
* @param createDate
* @param userId
* @param firstResult
* @param pageSize
* @return
*/
@RequestMapping("/pushListInf.do")
@ResponseBody
public Object pushListInf(Integer pushId, Integer userId, Integer firstResult, Integer pageSize) {
try {
if (firstResult == null) {
firstResult = 0;
}
if (pageSize == null) {
pageSize = 10;
}
Pagination<PushList> page = this.pageListService.getPushListByPage(pushId, userId, firstResult, pageSize);
return IfishUtil.returnPageData(page);
} catch (Exception e) {
log.error("get pushListInf page information:error message:{}", e.toString());
}
return null;
}
/**
* 看护工作台
*
* @param createDate
* @param userId
* @param firstResult
* @param pageSize
* @return
*/
@RequestMapping("/lookList.do")
@ResponseBody
public Object lookList(Integer shopsUserId, Integer firstResult, Integer pageSize) {
try {
if (firstResult == null) {
firstResult = 0;
}
if (pageSize == null) {
pageSize = 10;
}
Pagination<ShopsLookUserDto> page = this.pageListService.getLookListByPage(shopsUserId, firstResult, pageSize);
return IfishUtil.returnPageData(page);
} catch (Exception e) {
e.printStackTrace();
log.error("lookList:error message:{}", e.toString());
}
return null;
}
}
@@ -0,0 +1,194 @@
package com.ifish.action;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ifish.dto.JsonResult;
import com.ifish.dto.PageingDto;
import com.ifish.entity.ShopsInfo;
import com.ifish.enums.ResultEnum;
import com.ifish.exception.IfishException;
import com.ifish.service.ShopsService;
import com.ifish.util.IfishUtil;
import com.ifish.validator.PageParam;
import com.ifish.validator.ShopsUserInfoParam;
/**
*
* @author ggw
*
*/
@RestController
public class ShopsAction {
@Autowired
private ShopsService shopsService;
/**
* 保存商户信息
* @param shopsInfo
* @param file1
* @param file2
* @param file3
* @return
*/
@RequestMapping(value="/shops/v3/saveShopsInfo.do",method=RequestMethod.POST)
public Object saveShopsInfo(ShopsInfo shopsInfo,MultipartFile file1,MultipartFile file2,MultipartFile file3) {
if(file1.getSize()>3145728 || file2.getSize()>3145728 || file3.getSize()>3145728){
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
}
else{
return this.shopsService.saveShopsInfo(shopsInfo,file1,file2,file3);
}
}
/**
* 审核失败后修改商户信息
* @param shopsInfo
* @param file1
* @param file2
* @param file3
* @return
*/
@RequestMapping(value="/shops/v3/updateShopsInfo.do",method=RequestMethod.POST)
public Object updateShopsInfo(ShopsInfo shopsInfo,MultipartFile file1,MultipartFile file2,MultipartFile file3) {
if(file1!=null && !file1.isEmpty() && file1.getSize()>3145728){
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
}
if(file2!=null && !file2.isEmpty() && file2.getSize()>3145728){
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
}
if(file3!=null && !file3.isEmpty() && file3.getSize()>3145728){
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
}
else{
return this.shopsService.updateShopsInfo(shopsInfo,file1,file2,file3);
}
}
/**
* 审核成功后修改商户信息
* @param shopsInfo
* @param file4
* @return
*/
@RequestMapping(value="/shops/v3/updateBaseShopsInfo.do",method=RequestMethod.POST)
public Object updateBaseShopsInfo(ShopsInfo shopsInfo,MultipartFile file4) {
if(file4!=null && !file4.isEmpty() && file4.getSize()>3145728){
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
}
else{
return this.shopsService.updateBaseShopsInfo(shopsInfo,file4);
}
}
/**
* 查询审核状态
* @param shopsId
* @return
*/
@RequestMapping(value="/shops/v3/getShopsStatus.do",method=RequestMethod.POST)
public Object getShopsStatus(Integer shopsId) {
return this.shopsService.getShopsStatus(shopsId);
}
/**
* 看护商家列表
* @param firstResult
* @param pageSize
* @return
*/
@RequestMapping(value="/shops/v3/getShopsInfo.do",method=RequestMethod.POST)
public Object pushListInf(Integer userId,Integer firstResult,Integer pageSize) {
return this.shopsService.getShopsInfoByPage(userId,firstResult, pageSize);
}
/**
* 选择看护商家
* @param shopsUserId
* @param userId
* @return
*/
@RequestMapping(value="/shops/v3/choiceShops.do",method=RequestMethod.POST)
public Object choiceShops(@RequestParam Integer shopsUserId,@RequestParam Integer userId) {
return this.shopsService.choiceShops(shopsUserId,userId);
}
/**
* 解除看护关系
* @param shopsUserId
* @param userId
* @return
*/
@RequestMapping(value="/shops/v3/removeLook.do",method=RequestMethod.POST)
public Object removeLook(Integer userId) {
return this.shopsService.removeLook(userId);
}
/**
* 获取商家会员信息
* @param userId
* @param shopsId
* @return
*/
@RequestMapping(value="/shopsUserInfo/{userId}/{shopsId}",method=RequestMethod.GET)
public JsonResult<?> getShopsUserInfoById(@PathVariable("userId")Integer userId,@PathVariable("shopsId")Integer shopsId){
return shopsService.getShopsUserInfoById(userId, shopsId);
}
/**
* 更新商家会员信息
* @param userId
* @param shopsId
* @param result
* @param info
* @return
*/
@RequestMapping(value="/shopsUserInfo/{userId}/{shopsId}",method=RequestMethod.POST)
public JsonResult<?> updateShopsUserInfo(@PathVariable("userId")Integer userId,
@PathVariable("shopsId")Integer shopsId,
@Validated ShopsUserInfoParam param,
BindingResult result){
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return shopsService.updateShopsUserInfo(userId,shopsId,param);
}
/**
* 分页获取商家会员信息
* @param pageParam
* @param result
* @return
*/
@RequestMapping(value="/shopsUserInfo",method=RequestMethod.GET)
public PageingDto<?> getShopsUserInfoById(@RequestParam("shopsId")Integer shopsId,
@Validated PageParam pageParam,
BindingResult result){
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return shopsService.getShopsUserInfoByPage(shopsId,pageParam);
}
/**
* 成为商家会员
* @param userId
* @param shopsId
* @return
*/
@RequestMapping(value="/becomingShopsUser/{userId}/{shopsId}",method=RequestMethod.POST)
public JsonResult<?> becomeShopsUser(@PathVariable("userId")Integer userId,@PathVariable("shopsId")Integer shopsId){
return shopsService.becomeShopsUser(userId, shopsId);
}
}
@@ -0,0 +1,76 @@
package com.ifish.action;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.ifish.entity.User;
import com.ifish.enums.ResultEnum;
import com.ifish.service.BaseService;
import com.ifish.util.IfishUtil;
/**
* @ClassName: UpdateUserAction
* @Description: TODO
* @author ggw
*/
@Controller
@RequestMapping("/updateUser")
public class UpdateUserAction {
@Autowired
private BaseService baseService;
private static Logger log = LoggerFactory.getLogger(UpdateUserAction.class);
@ModelAttribute("user")
public User getUser(@RequestParam Integer userId) {
return baseService.findById(userId);
}
/**
* 更新用户信息
* @param user
* @return
*/
@RequestMapping("/updateUser.do")
@ResponseBody
public Object update(@ModelAttribute("user") User user){
try {
return baseService.updateInfo(user);
} catch (Exception e) {
log.error("update userinfo:userId:{},error message:{}",user.getUserId(),e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 上传头像
* @param user
* @param fileUpload
* @return
* @throws Exception
*/
@RequestMapping(value = "/uploadFile.do")
@ResponseBody
public Object upload(@ModelAttribute("user") User user,@RequestParam MultipartFile fileUpload){
try {
if(fileUpload.getSize()>1048576){
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
}
else{
return baseService.uploadFile(user,fileUpload);
}
} catch (Exception e) {
log.error("upload images:userId:{},error message:{}",user.getUserId(),e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
}
@@ -0,0 +1,642 @@
package com.ifish.action;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ifish.entity.CameraUserId;
import com.ifish.entity.Device;
import com.ifish.entity.DeviceUser;
import com.ifish.entity.QuestionsFeedback;
import com.ifish.entity.ShopsInfo;
import com.ifish.entity.User;
import com.ifish.enums.ResultEnum;
import com.ifish.helper.UserHelperI;
import com.ifish.service.BaseService;
import com.ifish.service.UserService;
import com.ifish.util.IfishFilePath;
import com.ifish.util.IfishUtil;
/**
* @ClassName:UserAction
* @Description:TODO
* @author ggw
*/
@RestController
@RequestMapping("/user")
public class UserAction {
@Autowired
private UserService userService;
@Autowired
private BaseService baseService;
@Autowired
private UserHelperI userHelperI;
private static Logger log = LoggerFactory.getLogger(UserAction.class);
/**
* 获取验证码
*
* @param sendType
* @param phoneNumber
* @return
*/
@Deprecated
@RequestMapping("/getSecurityCode.do")
public Object getSecurityCode(@RequestParam String sendType, @RequestParam String phoneNumber) {
try {
return this.baseService.getSecurityCode(phoneNumber, sendType);
} catch (Exception e) {
log.error("send sms:phoneNumber:{},error message:{}", phoneNumber, e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 通过短信验证后新增注册用户信息
*
* @param user
* @return
*/
@Deprecated
@RequestMapping("/addUser.do")
public Object addUser(User user) {
try {
return this.baseService.save(user);
} catch (Exception e) {
e.printStackTrace();
log.error("user register:phoneNumber:{},error message:{}", user.getPhoneNumber(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 通过短信验证后修改密码
*
* @param user
* @return
*/
@RequestMapping("/resetPassword.do")
public Object resetPassword(User user) {
try {
return this.baseService.resetPassword(user);
} catch (Exception e) {
log.error("forget password:phoneNumber:{},error message:{}", user.getPhoneNumber(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 用户登录
*/
@Deprecated
@RequestMapping("/userLogin.do")
public Object userLogin(User user) {
try {
return userHelperI.login(user);
} catch (Exception e) {
log.error("user login:phoneNumber:{},error message:{}", user.getPhoneNumber(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 用户登录
*/
@Deprecated
@RequestMapping("/userLoginold.do")
public Object userLogin1(User user) {
try {
return this.baseService.login(user);
} catch (Exception e) {
log.error("user login:phoneNumber:{},error message:{}", user.getPhoneNumber(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 验证原密码后修改密码
*
* @param oldPassword
* @param user
* @return
*/
@RequestMapping("/updatePwd.do")
public Object updatePwd(@RequestParam String oldPassword, User user) {
try {
return baseService.updatePwd(user, oldPassword);
} catch (Exception e) {
log.error("change password:userId:{},error message:{}", user.getUserId(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 问题反馈
*
* @param questionsFeedback
* @return
*/
@Deprecated
@RequestMapping("/questionsFeedback.do")
public Object questionsFeedback(QuestionsFeedback questionsFeedback) {
try {
return this.baseService.saveQuestionsFeedback(questionsFeedback);
} catch (Exception e) {
log.error("submit questions:userId:{},error message:{}", questionsFeedback.getUserId(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 绑定设备
*
* @param user
* @param macAddress
* @return
*/
@Deprecated
@RequestMapping("/bindDevice.do")
public Object bindDevice(User user, String macAddress) {
try {
return baseService.bindDevice(user, macAddress.toLowerCase());
} catch (Exception e) {
log.error("bind device:userId:{},macAddress:{},error message:{}", user.getUserId(), macAddress.toLowerCase(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 绑定摄像头
*
* @param user
* @param macAddress
* @return
*/
@RequestMapping("/bindCamera.do")
public Object bindCamera(Integer userId, String cameraId) {
return baseService.bindCamera(userId, cameraId);
}
/**
* 关联设备和摄像头
*
* @param user
* @param macAddress
* @return
*/
@RequestMapping("/deviceBindCamera.do")
public Object deviceBindCamera(Integer deviceId, String cameraId) {
try {
return baseService.deviceBindCamera(deviceId, cameraId);
} catch (Exception e) {
log.error("DeviceBindCamera:cameraId:{},error message:{}", deviceId, cameraId, e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 关联设备和摄像头1
*
* @param user
* @param macAddress
* @return
*/
@RequestMapping("/deviceBindCamera1.do")
public Object deviceBindCamera1(Integer userId, Integer deviceId, String cameraId) {
try {
return baseService.deviceBindCamera1(userId, deviceId, cameraId);
} catch (Exception e) {
log.error("DeviceBindCamera1:userId:{},cameraId:{},error message:{}", userId, deviceId, cameraId, e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 激活摄像头
*
* @param user
* @param macAddress
* @return
*/
@RequestMapping("/activeCamera.do")
public Object activeCamera(String activeCode, String cameraId) {
try {
return baseService.activeCamera(activeCode, cameraId);
} catch (Exception e) {
log.error("activeCamera:activeCode:{},cameraId:{},error message:{}", activeCode, cameraId, e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 保存自定义图标
*
* @param user
* @param macAddress
* @return
*/
@RequestMapping("/saveCustomIcon.do")
public Object saveCustomIcon(DeviceUser deviceUser) {
try {
return baseService.updateCustomIcon(deviceUser);
} catch (Exception e) {
log.error("saveCustomIcon:userId:{},deviceId:{},error message:{}", deviceUser.getPriId().getUserId(), deviceUser.getPriId().getDeviceId(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 获取单个设备信息
*
* @param user
* @return
*/
@RequestMapping("/getSingleDeviceInf.do")
public Object getSingleDeviceInf(DeviceUser deviceUser) {
try {
return baseService.getSingleDeviceInf(deviceUser);
} catch (Exception e) {
log.error("get getDeviceInfByMacAddress Information:userId:{},deviceId:{},error message:{}", deviceUser.getPriId().getUserId(), deviceUser.getPriId().getDeviceId(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 修改设备信息
*
* @param deviceUser
* @return
*/
@RequestMapping("/updateDeviceUser.do")
public Object updateDeviceUser(DeviceUser deviceUser) {
try {
return baseService.update(deviceUser);
} catch (Exception e) {
log.error("update device Information:userId:{},deviceId:{},error message:{}", deviceUser.getPriId().getUserId(), deviceUser.getPriId().getDeviceId(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 修改摄像头信息
*
* @param deviceUser
* @return
*/
@RequestMapping("/updateCameraUser.do")
public Object updateCameraUser(Integer userId, String cameraId, String showName) {
try {
CameraUserId id = new CameraUserId(userId, cameraId);
return baseService.update(id, showName);
} catch (Exception e) {
log.error("updateCameraUser:userId:{},cameraId:{},error message:{}", userId, cameraId, e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 删除绑定设备
*
* @param deviceUser
* @return
*/
@RequestMapping("/deleteDeviceUser.do")
public Object deleteDeviceUser(DeviceUser deviceUser) {
try {
return baseService.deleteDeviceUser(deviceUser);
} catch (Exception e) {
log.error("delete the binding device:userId:{},deviceId:{},error message:{}", deviceUser.getPriId().getUserId(), deviceUser.getPriId().getDeviceId(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 删除绑定的摄像头
*
* @param deviceUser
* @return
*/
@RequestMapping("/deleteCameraUser.do")
public Object deleteCameraUser(Integer userId, String cameraId) {
try {
return baseService.deleteCameraUser(userId, cameraId);
} catch (Exception e) {
log.error("delete the binding camera:userId:{},cameraId:{},error message:{}", userId, cameraId, e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 删除设备和摄像头关联
*
* @param deviceUser
* @return
*/
@RequestMapping("/deleteDeviceCamera.do")
public Object deleteDeviceCamera(Integer deviceId, String cameraId) {
try {
return baseService.deleteDeviceCamera(deviceId, cameraId);
} catch (Exception e) {
log.error("deleteDeviceCamera:deviceId:{},cameraId:{},error message:{}", deviceId, cameraId, e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 扫一扫分享设备
*
* @param user
* @param device
* @return
*/
@Deprecated
@RequestMapping("/shareDeviceByQrCode.do")
public Object shareDeviceByQrCode(Integer userId, Integer deviceId) {
try {
return baseService.shareDeviceByQrCode(userId, deviceId);
} catch (Exception e) {
log.error("share device by qrCode:userId:{},deviceId:{},error message:{}", userId, deviceId, e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 获取最新版本信息
*/
@RequestMapping("/getNewestVersion.do")
public Object getNewest(String phoneType) {
try {
return this.baseService.getNewestVersionInf(phoneType.toLowerCase());
} catch (Exception e) {
log.error("get the latest version information:error message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 获取换水提醒信息
*
* @param deviceId
* @return
*/
@RequestMapping("/getRemindWaterInf.do")
public Object getRemindWaterInf(Integer deviceId) {
try {
return this.baseService.getRemindWaterInf(deviceId);
} catch (Exception e) {
log.error("getRemindWaterInf:deviceId:{},error message:{}", deviceId, e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 设置换水提醒信息
*
* @param deviceId
* @return
*/
@RequestMapping("/setRemindWaterInf.do")
public Object setRemindWaterInf(Device device) {
try {
return this.baseService.setRemindWaterInf(device);
} catch (Exception e) {
log.error("setRemindWaterInf:deviceId:{},error message:{}", device.getDeviceId(), e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 保存商户信息
*
* @param shopsInfo
* @param file1
* @param file2
* @param file3
* @return
*/
@RequestMapping("/saveShopsInfo.do")
public Object saveShopsInfo(ShopsInfo shopsInfo, MultipartFile file1, MultipartFile file2, MultipartFile file3) {
try {
if (file1.getSize() > 3145728 || file2.getSize() > 3145728 || file3.getSize() > 3145728) {
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
} else {
return this.baseService.saveShopsInfo(shopsInfo, file1, file2, file3);
}
} catch (Exception e) {
log.error("saveShopsInfo:error message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 审核失败后修改商户信息
*
* @param shopsInfo
* @param file1
* @param file2
* @param file3
* @return
*/
@RequestMapping("/updateShopsInfo.do")
public Object updateShopsInfo(ShopsInfo shopsInfo, MultipartFile file1, MultipartFile file2, MultipartFile file3) {
try {
if (file1 != null && !file1.isEmpty() && file1.getSize() > 3145728) {
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
}
if (file2 != null && !file2.isEmpty() && file2.getSize() > 3145728) {
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
}
if (file3 != null && !file3.isEmpty() && file3.getSize() > 3145728) {
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
} else {
return this.baseService.updateShopsInfo(shopsInfo, file1, file2, file3);
}
} catch (Exception e) {
log.error("updateShopsInfo:error message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 审核成功后修改商户信息
*
* @param shopsInfo
* @param file1
* @param file2
* @param file3
* @return
*/
@RequestMapping("/updateBaseShopsInfo.do")
public Object updateBaseShopsInfo(ShopsInfo shopsInfo, MultipartFile file4) {
try {
if (file4 != null && !file4.isEmpty() && file4.getSize() > 3145728) {
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
} else {
return this.baseService.updateBaseShopsInfo(shopsInfo, file4);
}
} catch (Exception e) {
log.error("updateBaseShopsInfo:error message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 查询审核状态
*
* @param shopsId
* @return
*/
@RequestMapping("/getShopsStatus.do")
public Object getShopsStatus(Integer shopsId) {
try {
return this.baseService.getShopsStatus(shopsId);
} catch (Exception e) {
log.error("getShopsStatus:error message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 选择看护商家
*
* @param phoneNumber
* @param userId
* @return
*/
@RequestMapping("/choiceShops.do")
public Object choiceShops(String phoneNumber, Integer userId) {
try {
return this.baseService.choiceShops(phoneNumber, userId);
} catch (Exception e) {
e.printStackTrace();
log.error("choiceShops:error message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 关闭看护摄像头
*
* @param cameraId
* @param userId
* @param status
* @return
*/
@RequestMapping("/onoffLook.do")
public Object closeLook(String cameraId, Integer userId, String status) {
try {
return this.baseService.onoffLook(cameraId, userId, status);
} catch (Exception e) {
log.error("closeLook:error message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 生成微信分享页面
*
* @param title
* @param base64
* @return
*/
@RequestMapping("/getHtmlFile.do")
public Object getHtmlFile(@RequestParam String title, @RequestParam MultipartFile fileUpload) {
try {
if (fileUpload != null && fileUpload.getSize() > 3145728) {
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
}
String pngName = IfishUtil.uploadFile(fileUpload, IfishFilePath.path_share_img);
if (pngName != null && !pngName.equals("")) {
String fileName = IfishUtil.getHtmlFile(title, pngName, IfishFilePath.html_name, IfishFilePath.path_share_html);
if (fileName != null && !fileName.equals("")) {
return IfishUtil.returnJson(ResultEnum.success.getKey(), fileName);
}
}
} catch (Exception e) {
log.error("getHtmlFile:error message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 生成看护报告
*
* @param index1
* @param index2
* @param index3
* @param suggestion
* @return
*/
@RequestMapping("/getLookReport.do")
public Object getLookReport(Integer userId, String index1, String index2, String index3, String suggestion, MultipartFile fileUpload) {
try {
if (fileUpload != null && fileUpload.getSize() > 3145728) {
return IfishUtil.returnJson(ResultEnum.warn206.getKey(), "");
}
return this.baseService.lookReport(userId, index1, index2, index3, suggestion, fileUpload);
} catch (Exception e) {
log.error("getLookReport:error message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 发送看护报告给用户(旧)
*
* @param userId
* @param fileName
* @return
*/
@Deprecated
@RequestMapping("/sendReport.do")
public Object sendReport(Integer userId, String fileName) {
try {
return this.baseService.sendReport(userId, fileName);
} catch (Exception e) {
log.error("sendReport message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 发送看护报告给用户(新)
*
* @param userId
* @param fileName
* @param reportId
* @return
*/
@RequestMapping("/sendReport1.do")
public Object sendReport1(Integer userId, String fileName, Integer reportId) {
try {
return this.baseService.sendReport(userId, fileName, reportId);
} catch (Exception e) {
log.error("sendReport1 message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
/**
* 根据ID查询看护报告详情
*
* @param reportId
* @return
*/
@RequestMapping("/getLookReportById.do")
public Object getLookReportById(Integer reportId) {
try {
return this.baseService.getLookReportById(reportId);
} catch (Exception e) {
log.error("getLookReportById message:{}", e.toString());
}
return IfishUtil.returnJson(ResultEnum.fail101.getKey(), "");
}
}
@@ -0,0 +1,56 @@
package com.ifish.action;
import com.ifish.dto.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.ifish.dto.PageingDto;
import com.ifish.enums.ResultEnum;
import com.ifish.exception.IfishException;
import com.ifish.helper.UserActivityHelperI;
import com.ifish.service.UserActivityService;
import org.apache.ibatis.annotations.Param;
/**
* 用户动态
*
* @author Administrator
*
*/
@RestController
public class UserActivityAction {
@Autowired
private UserActivityService userActivityService;
@Autowired
private UserActivityHelperI userActivityHelperI;
/**
* 分页获取用户动态
*
* @param param
* @param result
* @return
*/
@RequestMapping(value = "/userActivities", method = RequestMethod.GET)
public PageingDto<?> getUserActivityByPage(Integer pageSize, Integer firstResult) {
//参数校验
if (firstResult < 0 || (pageSize < 1 || pageSize > 20)) {
throw new IfishException(ResultEnum.error401);
}
return userActivityHelperI.getUserActivityByPage(pageSize, firstResult);
}
@RequestMapping(value = "/userActivitiesMaxCount", method = RequestMethod.GET)
public JsonResult<?> getUserActivityMaxCount() {
try {
return userActivityHelperI.getUserActivityMaxCount();
} catch (Exception e) {
throw new IfishException(ResultEnum.fail101);
}
}
}
@@ -0,0 +1,144 @@
package com.ifish.action;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.ifish.dto.JsonResult;
import com.ifish.entity.User;
import com.ifish.enums.ResultEnum;
import com.ifish.exception.IfishException;
import com.ifish.service.UserService;
import com.ifish.validator.LoginParam;
import com.ifish.validator.RegisterParam;
/**
* @ClassName:UsersAction
* @author ggw
*/
@RestController
@RequestMapping("/users")
public class UsersAction {
@Autowired
private UserService userService;
/**
* 获取验证码
* @param sendType
* @param phoneNumber
* @return
*/
@RequestMapping(value="/v3/getVerificateCode.do",method=RequestMethod.POST)
public JsonResult<?> getVerificateCode(String sendType,String phoneNumber){
return userService.getVerificateCode(phoneNumber, sendType);
}
/**
* 用户注册
* @param version
* @param userParam
* @param result
* @return
*/
@RequestMapping(value={"/v3/register.do","register.do"},method=RequestMethod.POST)
public JsonResult<?> register(@Validated RegisterParam registerParam,BindingResult result) {
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return userService.register(registerParam);
}
/**
* 用户登录
* @param version
* @param userParam
* @param result
* @return
*/
@RequestMapping(value={"/v3/login.do","/login.do"},method=RequestMethod.POST)
public JsonResult<?> login(@Validated LoginParam loginParam,BindingResult result) {
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return userService.login(loginParam);
}
/**
* 登陆验证
* @param loginParam
* @param result
* @return
*/
@RequestMapping(value="/loginValidation",method=RequestMethod.POST)
public JsonResult<?> loginValidate(@Validated LoginParam loginParam,BindingResult result) {
//参数校验
if(result.hasErrors()){
throw new IfishException(ResultEnum.error401);
}
return userService.loginValidate(loginParam);
}
/**
* 更多用户数据
* @param userId
* @return
*/
@RequestMapping(value="/moreUserData/{userId}",method=RequestMethod.GET)
public JsonResult<?> moreUserData(@PathVariable("userId") Integer userId) {
return userService.moreUserData(userId);
}
/**
* 绑定设备
* @param userId
* @param macAddress
* @return
*/
@RequestMapping(value="/bindingDevice/{userId}",method=RequestMethod.POST)
public JsonResult<?> bindDevice(@PathVariable("userId") Integer userId,@RequestParam("macAddress") String macAddress) {
return userService.bindDevice(userId, macAddress);
}
/**
* 扫一扫分享设备
* @param userId
* @param macAddress
* @return
*/
@RequestMapping(value="/sharingDevice/{userId}",method=RequestMethod.POST)
public JsonResult<?> shareDevice(@PathVariable("userId") Integer userId,@RequestParam("deviceId") Integer deviceId) {
return userService.shareDevice(userId, deviceId);
}
/**
* 修改用户信息
* @param user
* @return
*/
@RequestMapping(value="/v3/updateInfo.do",method=RequestMethod.POST)
public JsonResult<?> updateInfo(User user) {
return userService.updateInfo(user);
}
/**
* 上传用户头像
* @param userId
* @param fileUpload
* @return
*/
@RequestMapping(value="/v3/uploadUserImg.do",method=RequestMethod.POST)
public JsonResult<?> uploadUserImg(@RequestParam("userId")Integer userId,MultipartFile fileUpload) {
return userService.uploadUserImg(userId,fileUpload);
}
}
@@ -0,0 +1,15 @@
package com.ifish.apiVersion;
/**
* 接口版本号
* @author Administrator
*
*/
public class ApiVersion {
//1.0
public static final String version1_0 = "1.0";
//1.1
public static final String version1_1 = "1.1";
//1.2
public static final String version1_2 = "1.2";
}
@@ -0,0 +1,308 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.bean;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
*
* @author Administrator
*/
@Entity
@Table(name = "tbl_commodity_info")
public class CommodityInfoBean implements java.io.Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = -5102166720334127839L;
/**
* 商品详情表ID
*/
@Id
@Column(name = "commodity_id", unique = true, nullable = false, length = 10)
private Integer commodityId;
public CommodityInfoBean(Integer commodityId, Integer shopId, Integer userId, String commodityName, String commodityDetail, String commodityImg, String commodityVideo, Integer commodityStatus, Date createTime, Integer click, Integer backstageStatus) {
this.commodityId = commodityId;
this.shopId = shopId;
this.userId = userId;
this.commodityName = commodityName;
this.commodityDetail = commodityDetail;
this.commodityImg = commodityImg;
this.commodityVideo = commodityVideo;
this.commodityStatus = commodityStatus;
this.createTime = createTime;
this.click = click;
this.backstageStatus = backstageStatus;
}
public CommodityInfoBean() {
}
/**
* 店铺ID
*/
@Column(name = "shop_id", nullable = false, length = 10)
private Integer shopId;
/**
* 用户ID
*/
@Column(name = "user_id", nullable = false, length = 10)
private Integer userId;
/**
* 商品名称
*/
@Column(name = "commodity_name", nullable = false, length = 20)
private String commodityName;
/**
* 商品描述
*/
@Column(name = "commodity_detail", nullable = true, length = 100)
private String commodityDetail;
/**
* 商品图片
*/
@Column(name = "commodity_img", nullable = true, length = 100)
private String commodityImg;
/**
* 商品视频
*/
@Column(name = "commodity_video", nullable = true, length = 100)
private String commodityVideo;
/**
* 商品状态(用户管理)
*/
@Column(name = "commodity_status", nullable = false, length = 10)
private Integer commodityStatus;
/**
* 创建时间
*/
@Column(name = "create_time", nullable = false)
private Date createTime;
/**
* 商品点击数
*/
@Column(name = "click", nullable = true, length = 10)
private Integer click;
/**
* 后台管理商品状态
*/
@Column(name = "backstage_status", nullable = false, length = 10)
private Integer backstageStatus;
/**
* 获取商品详情表ID
*
* @return 商品详情表ID
*/
public Integer getCommodityId() {
return this.commodityId;
}
/**
* 设置商品详情表ID
*
* @param commodityId 商品详情表ID
*/
public void setCommodityId(Integer commodityId) {
this.commodityId = commodityId;
}
/**
* 获取店铺ID
*
* @return 店铺ID
*/
public Integer getShopId() {
return this.shopId;
}
/**
* 设置店铺ID
*
* @param shopId 店铺ID
*/
public void setShopId(Integer shopId) {
this.shopId = shopId;
}
/**
* 获取用户ID
*
* @return 用户ID
*/
public Integer getUserId() {
return this.userId;
}
/**
* 设置用户ID
*
* @param userId 用户ID
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* 获取商品名称
*
* @return 商品名称
*/
public String getCommodityName() {
return this.commodityName;
}
/**
* 设置商品名称
*
* @param commodityName 商品名称
*/
public void setCommodityName(String commodityName) {
this.commodityName = commodityName;
}
/**
* 获取商品描述
*
* @return 商品描述
*/
public String getCommodityDetail() {
return this.commodityDetail;
}
/**
* 设置商品描述
*
* @param commodityDetail 商品描述
*/
public void setCommodityDetail(String commodityDetail) {
this.commodityDetail = commodityDetail;
}
/**
* 获取商品图片
*
* @return 商品图片
*/
public String getCommodityImg() {
return this.commodityImg;
}
/**
* 设置商品图片
*
* @param commodityImg 商品图片
*/
public void setCommodityImg(String commodityImg) {
this.commodityImg = commodityImg;
}
/**
* 获取商品视频
*
* @return 商品视频
*/
public String getCommodityVideo() {
return this.commodityVideo;
}
/**
* 设置商品视频
*
* @param commodityVideo 商品视频
*/
public void setCommodityVideo(String commodityVideo) {
this.commodityVideo = commodityVideo;
}
/**
* 获取商品状态(用户管理)
*
* @return 商品状态(用户管理)
*/
public Integer getCommodityStatus() {
return this.commodityStatus;
}
/**
* 设置商品状态(用户管理)
*
* @param commodityStatus 商品状态(用户管理)
*/
public void setCommodityStatus(Integer commodityStatus) {
this.commodityStatus = commodityStatus;
}
/**
* 获取创建时间
*
* @return 创建时间
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置创建时间
*
* @param createTime 创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取商品点击数
*
* @return 商品点击数
*/
public Integer getClick() {
return this.click;
}
/**
* 设置商品点击数
*
* @param click 商品点击数
*/
public void setClick(Integer click) {
this.click = click;
}
/**
* 获取后台管理商品状态
*
* @return 后台管理商品状态
*/
public Integer getBackstageStatus() {
return this.backstageStatus;
}
/**
* 设置后台管理商品状态
*
* @param backstageStatus 后台管理商品状态
*/
public void setBackstageStatus(Integer backstageStatus) {
this.backstageStatus = backstageStatus;
}
}
@@ -0,0 +1,228 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.bean;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
*
* @author Administrator
*/
@Entity
@Table(name = "tbl_device_user")
public class DeviceUserBean implements java.io.Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = -8887049051247467842L;
/**
*
*/
@Id
@Column(name = "user_id", unique = true, nullable = false, length = 10)
private Integer userId;
/**
*
*/
@Id
@Column(name = "device_id", unique = true, nullable = false, length = 10)
private Integer deviceId;
/**
*
*/
@Column(name = "is_master", nullable = true, length = 1)
private String isMaster;
/**
*
*/
@Column(name = "show_name", nullable = true, length = 50)
private String showName;
/**
*
*/
@Column(name = "create_time", nullable = true)
private Date createTime;
/**
*
*/
@Column(name = "update_time", nullable = true)
private Date updateTime;
/**
*
*/
@Column(name = "custom_icon_name", nullable = true, length = 100)
private String customIconName;
/**
*
*/
@Column(name = "custom_show_name", nullable = true, length = 100)
private String customShowName;
/**
* 获取
*
* @return
*/
public Integer getUserId() {
return this.userId;
}
/**
* 设置
*
* @param userId
*
*/
public void setUserId(Integer userId) {
this.userId = userId;
}
/**
* 获取
*
* @return
*/
public Integer getDeviceId() {
return this.deviceId;
}
/**
* 设置
*
* @param deviceId
*
*/
public void setDeviceId(Integer deviceId) {
this.deviceId = deviceId;
}
/**
* 获取
*
* @return
*/
public String getIsMaster() {
return this.isMaster;
}
/**
* 设置
*
* @param isMaster
*
*/
public void setIsMaster(String isMaster) {
this.isMaster = isMaster;
}
/**
* 获取
*
* @return
*/
public String getShowName() {
return this.showName;
}
/**
* 设置
*
* @param showName
*
*/
public void setShowName(String showName) {
this.showName = showName;
}
/**
* 获取
*
* @return
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置
*
* @param createTime
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取
*
* @return
*/
public Date getUpdateTime() {
return this.updateTime;
}
/**
* 设置
*
* @param updateTime
*
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取
*
* @return
*/
public String getCustomIconName() {
return this.customIconName;
}
/**
* 设置
*
* @param customIconName
*
*/
public void setCustomIconName(String customIconName) {
this.customIconName = customIconName;
}
/**
* 获取
*
* @return
*/
public String getCustomShowName() {
return this.customShowName;
}
/**
* 设置
*
* @param customShowName
*
*/
public void setCustomShowName(String customShowName) {
this.customShowName = customShowName;
}
}
@@ -0,0 +1,243 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.bean;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
*
* @author Administrator
*/
@Entity
@Table(name = "tbl_vender_list")
public class VenderListBean implements java.io.Serializable {
/**
* 版本号
*/
private static final long serialVersionUID = 190528374520461795L;
/**
* */
@Column(name = "brand_logo", nullable = true, length = 100)
private String brandLogo;
/**
* */
@Column(name = "brand_name", nullable = false, length = 20)
private String brandName;
/**
* */
@Column(name = "brand_introduce", nullable = true, length = 100)
private String brandIntroduce;
/**
* */
@Column(name = "app_show", nullable = true, length = 1)
private String appShow;
/**
* */
@Id
@Column(name = "brand_code", unique = true, nullable = false, length = 20)
private String brandCode;
/**
* */
@Column(name = "contact_phone", nullable = true, length = 30)
private String contactPhone;
/**
* */
@Column(name = "contact_address", nullable = true, length = 50)
private String contactAddress;
/**
* */
@Column(name = "update_time", nullable = true)
private Date updateTime;
/**
* */
@Column(name = "create_time", nullable = true)
private Date createTime;
/**
* 获取
*
* @return
*/
public String getBrandLogo() {
return this.brandLogo;
}
/**
* 设置
*
* @param brandLogo
*
*/
public void setBrandLogo(String brandLogo) {
this.brandLogo = brandLogo;
}
/**
* 获取
*
* @return
*/
public String getBrandName() {
return this.brandName;
}
/**
* 设置
*
* @param brandName
*
*/
public void setBrandName(String brandName) {
this.brandName = brandName;
}
/**
* 获取
*
* @return
*/
public String getBrandIntroduce() {
return this.brandIntroduce;
}
/**
* 设置
*
* @param brandIntroduce
*
*/
public void setBrandIntroduce(String brandIntroduce) {
this.brandIntroduce = brandIntroduce;
}
/**
* 获取
*
* @return
*/
public String getAppShow() {
return this.appShow;
}
/**
* 设置
*
* @param appShow
*
*/
public void setAppShow(String appShow) {
this.appShow = appShow;
}
/**
* 获取
*
* @return
*/
public String getBrandCode() {
return this.brandCode;
}
/**
* 设置
*
* @param brandCode
*
*/
public void setBrandCode(String brandCode) {
this.brandCode = brandCode;
}
/**
* 获取
*
* @return
*/
public String getContactPhone() {
return this.contactPhone;
}
/**
* 设置
*
* @param contactPhone
*
*/
public void setContactPhone(String contactPhone) {
this.contactPhone = contactPhone;
}
/**
* 获取
*
* @return
*/
public String getContactAddress() {
return this.contactAddress;
}
/**
* 设置
*
* @param contactAddress
*
*/
public void setContactAddress(String contactAddress) {
this.contactAddress = contactAddress;
}
/**
* 获取
*
* @return
*/
public Date getUpdateTime() {
return this.updateTime;
}
/**
* 设置
*
* @param updateTime
*
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取
*
* @return
*/
public Date getCreateTime() {
return this.createTime;
}
/**
* 设置
*
* @param createTime
*
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
@@ -0,0 +1,59 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.ifish.config;
import com.ifish.util.IfishFilePath;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
/**
*
* @author Administrator
*/
@Configuration
public class RedisConfig {
@Bean
public RedisConnectionFactory redisCF() {
JedisConnectionFactory cf = new JedisConnectionFactory();
// //获取当前操作系统(servers_os为服务器设置的属性JAVA_OPTS=%JAVA_OPTS% -Dservers_os=online84)
// String servers_os = System.getProperty("servers_os") == null ? "" : System.getProperty("servers_os");
if (IfishFilePath.link_img_head.contains("ifish7")) {
//114.55.42.84 站点线上服务器
cf.setHostName("120.55.190.56");//本机访问
// cf.setHostName("10.25.172.5");//内网ip地址,用于多服务器负载
cf.setPort(3796);
cf.setPassword("ifish7myredis");
} else {
//192.168.1.237 站点测试服务器
cf.setHostName("139.196.24.156");
cf.setPort(3796);
cf.setPassword("ifish7myredis");
// FileUtil.writeLinesByLog("测试缓存连接");
}
return cf;
}
@Bean
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory cf) {
RedisTemplate<String, String> redis = new RedisTemplate<String, String>();
redis.setConnectionFactory(cf);
return redis;
}
@Bean
public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory cf) {
StringRedisTemplate redis = new StringRedisTemplate();
redis.setConnectionFactory(cf);
return redis;
}
}
@@ -0,0 +1,12 @@
package com.ifish.dao;
import com.ifish.entity.AdInfo;
/**
* 广告信息
* @author Administrator
*
*/
public interface AdInfoDao extends BaseDao<AdInfo, Integer>{
}
+37
View File
@@ -0,0 +1,37 @@
package com.ifish.dao;
import java.io.Serializable;
import java.util.List;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import com.ifish.hibernate.Pagination;
/**
* @ClassName: BaseDao
* @Description: TODO
* @author ggw
*
*/
public interface BaseDao<T, ID extends Serializable> {
public T get(ID id);
public T save(T t);
public T update(T t);
public T saveOrUpdate(T t);
public void delete(T t);
public List<T> findByProperty(Criterion... criterions);
public List<T> findByProperty(Order order,Criterion... criterions);
public T findUniqueByProperty(Criterion... criterions);
public Pagination<T> findByCriteria(Integer firstResult,Integer pageSize,Order order,Criterion... criterion);
}
@@ -0,0 +1,14 @@
package com.ifish.dao;
import com.ifish.entity.BrowseRoom;
import com.ifish.entity.BrowseRoomId;
/**
* @ClassName: BrowseRoomDao
* @Description: TODO
* @author ggw
*
*/
public interface BrowseRoomDao extends BaseDao<BrowseRoom, BrowseRoomId>{
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.CameraActive;
/**
* @ClassName: CameraActiveDao
* @Description: TODO
* @author ggw
*
*/
public interface CameraActiveDao extends BaseDao<CameraActive, String>{
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.Camera;
/**
* @ClassName: CameraDao
* @Description: TODO
* @author ggw
*
*/
public interface CameraDao extends BaseDao<Camera, String>{
}
@@ -0,0 +1,20 @@
package com.ifish.dao;
import com.ifish.entity.CameraUser;
import com.ifish.entity.CameraUserId;
/**
* @ClassName: CameraUserDao
* @Description: TODO
* @author ggw
*
*/
public interface CameraUserDao extends BaseDao<CameraUser, CameraUserId>{
/**
* 查询用户的摄像头数量
* @param userId
* @return
*/
public int getCameraNumById(Integer userId);
}
@@ -0,0 +1,15 @@
package com.ifish.dao;
import com.ifish.entity.Comment;
/**
* @ClassName: CommentDao
* @Description: TODO
* @author ggw
*
*/
public interface CommentDao extends BaseDao<Comment, Integer>{
public Integer getPinglunNum(Integer ueditorId);
}
@@ -0,0 +1,12 @@
package com.ifish.dao;
import com.ifish.entity.Coupon;
/**
* 优惠券
* @author Administrator
*
*/
public interface CouponDao extends BaseDao<Coupon, Integer> {
}
@@ -0,0 +1,26 @@
package com.ifish.dao;
import com.ifish.entity.CouponRecord;
/**
* 优惠券兑换记录
* @author Administrator
*
*/
public interface CouponRecordDao extends BaseDao<CouponRecord, Integer> {
/**
* 查询兑换券的兑换数量
* @param couponId
* @return
*/
int getCouponRecordCountByCouponId(Integer couponId);
/**
* 查询用户的兑换数量
* @param couponId
* @return
*/
int getCouponRecordCountByUser(Integer userId,Integer couponId);
}
@@ -0,0 +1,18 @@
package com.ifish.dao;
import java.util.List;
import com.ifish.entity.DeviceCamera;
import com.ifish.entity.DeviceCameraId;
/**
* @ClassName: DeviceCameraDao
* @Description: TODO
* @author ggw
*
*/
public interface DeviceCameraDao extends BaseDao<DeviceCamera, DeviceCameraId>{
public void removeAll(List<DeviceCamera> list);
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.Device;
/**
* @ClassName: DeviceDao
* @Description: TODO
* @author ggw
*
*/
public interface DeviceDao extends BaseDao<Device, Integer>{
}
@@ -0,0 +1,25 @@
package com.ifish.dao;
import java.util.List;
import com.ifish.entity.DeviceUser;
import com.ifish.entity.DeviceUserId;
/**
* @ClassName: DeviceUserDao
* @Description: TODO
* @author ggw
*
*/
public interface DeviceUserDao extends BaseDao<DeviceUser, DeviceUserId>{
public void removeAll(List<DeviceUser> list);
/**
* 查询用户的设备数量
* @param userId
* @return
*/
public int getDeviceNumById(Integer userId);
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.GoldControl;
import com.ifish.entity.GoldControlId;
/**
* 金币控制信息
* @author Administrator
*
*/
public interface GoldControlDao extends BaseDao<GoldControl, GoldControlId> {
}
@@ -0,0 +1,12 @@
package com.ifish.dao;
import com.ifish.entity.GoldExpendRecord;
/**
* 金币消耗记录
* @author Administrator
*
*/
public interface GoldExpendRecordDao extends BaseDao<GoldExpendRecord, Integer>{
}
@@ -0,0 +1,21 @@
package com.ifish.dao;
import java.math.BigDecimal;
import com.ifish.entity.GoldGetRecord;
/**
* 获取金币记录
* @author Administrator
*
*/
public interface GoldGetRecordDao extends BaseDao<GoldGetRecord, Integer>{
/**
* 打赏金额数量
* @param userId
* @return
*/
BigDecimal getQuestionPayTourGoldValue(Integer userId);
}
@@ -0,0 +1,12 @@
package com.ifish.dao;
import com.ifish.entity.GoldTask;
/**
* 金币获取规则
* @author Administrator
*
*/
public interface GoldRuleDao extends BaseDao<GoldTask, String> {
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.GradeControl;
import com.ifish.entity.GradeControlId;
/**
* 等级经验控制
* @author Administrator
*
*/
public interface GradeControlDao extends BaseDao<GradeControl, GradeControlId> {
}
+13
View File
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.Grade;
/**
* @ClassName: GradeDao
* @Description: TODO
* @author ggw
*
*/
public interface GradeDao extends BaseDao<Grade, Integer>{
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.GradeRecord;
/**
* @ClassName: GradeRecordDao
* @Description: TODO
* @author ggw
*
*/
public interface GradeRecordDao extends BaseDao<GradeRecord, Integer>{
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.GradeTask;
/**
* @ClassName: GradeRuleDao
* @Description: TODO
* @author ggw
*
*/
public interface GradeRuleDao extends BaseDao<GradeTask, String>{
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.HardwareType;
/**
* @ClassName: HardwareTypeDao
* @Description: TODO
* @author ggw
*
*/
public interface HardwareTypeDao extends BaseDao<HardwareType, String>{
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.IfishDoctor;
/**
* @ClassName: IfishDoctorDao
* @Description: TODO
* @author ggw
*
*/
public interface IfishDoctorDao extends BaseDao<IfishDoctor, Integer>{
}
@@ -0,0 +1,12 @@
package com.ifish.dao;
import com.ifish.entity.IfishGoods;
/**
* 商品管理dao
* @author Administrator
*
*/
public interface IfishGoodsDao extends BaseDao<IfishGoods, Integer> {
}
@@ -0,0 +1,12 @@
package com.ifish.dao;
import com.ifish.entity.IfishShop;
/**
* 店铺管理dao
* @author Administrator
*
*/
public interface IfishShopDao extends BaseDao<IfishShop, Integer> {
}
@@ -0,0 +1,14 @@
package com.ifish.dao;
import com.ifish.entity.Information;
/**
* @ClassName: InformationDao
* @Description: TODO
* @author ggw
*
*/
public interface InformationDao extends BaseDao<Information, Integer>{
}
@@ -0,0 +1,12 @@
package com.ifish.dao;
import com.ifish.entity.InformationStats;
/**
* 资讯数据统计
* @author Administrator
*
*/
public interface InformationStatsDao extends BaseDao<InformationStats, Integer> {
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.LiveBanner;
/**
* @ClassName: LiveBannerDao
* @Description: TODO
* @author ggw
*
*/
public interface LiveBannerDao extends BaseDao<LiveBanner, Integer>{
}
@@ -0,0 +1,21 @@
package com.ifish.dao;
import com.ifish.entity.LiveMessage;
/**
* @ClassName: LiveMessageDao
* @Description: TODO
* @author ggw
*
*/
public interface LiveMessageDao extends BaseDao<LiveMessage, Integer>{
/**
* 获取直播间评论数
* @param roomId
* @return
*/
public int getLiveMessageCount(Integer roomId);
}
@@ -0,0 +1,62 @@
package com.ifish.dao;
import java.util.List;
import com.ifish.dto.LiveRoomInfoDto;
import com.ifish.entity.LiveRoom;
import com.ifish.hibernate.Pagination;
/**
* @ClassName: LiveRoomDao
* @Description: TODO
* @author ggw
*
*/
public interface LiveRoomDao extends BaseDao<LiveRoom, Integer>{
/**
* 获取离用户最近的5条记录
* @param longitude
* @param latitude
* @return
*/
public List<LiveRoomInfoDto> findByDistance(Double longitude,Double latitude);
/**
* 获取用户最近浏览的5条记录
* @param userId
* @return
*/
public List<LiveRoomInfoDto> findByBrowse(Integer userId);
/**
* 获取人气值最高的5条记录
* @return
*/
public List<LiveRoomInfoDto> findByPopularityValue();
/**
* 根据开播时间倒序
* @param firstResult
* @param pageSize
* @return
*/
public Pagination<LiveRoomInfoDto> findByTime(Integer firstResult,Integer pageSize,String orders);
/**
* 根据人气值倒序
* @param firstResult
* @param pageSize
* @return
*/
public Pagination<LiveRoomInfoDto> findByPopularityValue(Integer firstResult,Integer pageSize);
/**
* 根据推荐顺序
* @param firstResult
* @param pageSize
* @return
*/
public Pagination<LiveRoomInfoDto> getLiveRoomsByTuijian(Integer firstResult,Integer pageSize);
}
@@ -0,0 +1,20 @@
package com.ifish.dao;
import com.ifish.entity.LiveRoomZan;
import com.ifish.entity.LiveRoomZanId;
/**
* 直播间点赞
* @author Administrator
*
*/
public interface LiveRoomZanDao extends BaseDao<LiveRoomZan, LiveRoomZanId> {
/**
* 点赞数量
* @param roomId
* @return
*/
public Integer getZanNum(Integer roomId);
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.LookReport;
/**
* @ClassName: LookReportDao
* @Description: TODO
* @author ggw
*
*/
public interface LookReportDao extends BaseDao<LookReport, Integer>{
}
@@ -0,0 +1,15 @@
package com.ifish.dao;
import com.ifish.entity.PushList;
import com.ifish.hibernate.Pagination;
/**
* @ClassName: PushListDao
* @Description: TODO
* @author ggw
*
*/
public interface PushListDao extends BaseDao<PushList, Integer>{
public Pagination<PushList> findByCriteria(Integer pushId,Integer userId,Integer firstResult,Integer pageSize);
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.QuestionsFeedback;
/**
* @ClassName: QuestionsFeedbackDao
* @Description: TODO
* @author ggw
*
*/
public interface QuestionsFeedbackDao extends BaseDao<QuestionsFeedback, Integer>{
}
@@ -0,0 +1,35 @@
package com.ifish.dao;
import java.util.List;
import com.ifish.dto.ShopsListDto;
import com.ifish.entity.ShopsInfo;
import com.ifish.hibernate.Pagination;
/**
* @ClassName: ShopsInfoDao
* @Description: TODO
* @author ggw
*
*/
public interface ShopsInfoDao extends BaseDao<ShopsInfo, Integer>{
/**
* 根据距离获取数据
* @param longitude
* @param latitude
* @param firstResult
* @param pageSize
* @return
*/
public Pagination<ShopsListDto> findByDistance(Double longitude,Double latitude,Integer firstResult,Integer pageSize);
/**
* 随机取得用户ID
* @return
*/
public List<Integer> getShopsUserIdByRand(Integer userId);
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.ShopsUserInfo;
import com.ifish.entity.ShopsUserInfoId;
/**
* 商家会员信息dao
* @author Administrator
*
*/
public interface ShopsUserInfoDao extends BaseDao<ShopsUserInfo, ShopsUserInfoId>{
}
@@ -0,0 +1,13 @@
package com.ifish.dao;
import com.ifish.entity.Ueditor;
/**
* @ClassName: UeditorDao
* @Description: TODO
* @author ggw
*
*/
public interface UeditorDao extends BaseDao<Ueditor, Integer>{
}
@@ -0,0 +1,12 @@
package com.ifish.dao;
import com.ifish.entity.UserActivity;
/**
* 用户动态
* @author Administrator
*
*/
public interface UserActivityDao extends BaseDao<UserActivity, Integer>{
}
@@ -0,0 +1,12 @@
package com.ifish.dao;
import com.ifish.entity.UserAsset;
/**
* 用户资产(金币,经验值等信息)
* @author Administrator
*
*/
public interface UserAssetDao extends BaseDao<UserAsset, Integer>{
}
+42
View File
@@ -0,0 +1,42 @@
package com.ifish.dao;
import java.util.List;
import com.ifish.dto.ShopsLookUserDto;
import com.ifish.entity.User;
import com.ifish.hibernate.Pagination;
/**
* @ClassName: UserDao
* @Description: TODO
* @author ggw
*
*/
public interface UserDao extends BaseDao<User, Integer>{
/**
* 商家看护下的某个用户的所有摄像头
* @param shopsUserId
* @param firstResult
* @param pageSize
* @return
*/
public Pagination<ShopsLookUserDto> findByCriteria(Integer shopsUserId,Integer firstResult,Integer pageSize);
/**
* 更新用户登陆时间和登陆次数
* @param userId
* @return
*/
public int executeLoginUpdate(Integer userId,String loginType);
/**
* 获取用户ID
* @param userId
* @param firstResult
* @param maxResults
* @return
*/
public List<Integer> getUserIds(Integer userId,Integer firstResult,int maxResults);
}
@@ -0,0 +1,18 @@
package com.ifish.dao;
import com.ifish.entity.VenderList;
import com.ifish.hibernate.Pagination;
/**
* @ClassName: VenderListDao
* @Description: TODO
* @author ggw
*
*/
public interface VenderListDao extends BaseDao<VenderList, String>{
public VenderList getDefaultVenderList();
public Pagination<VenderList> findByCriteria(Integer firstResult,Integer pageSize);
}
@@ -0,0 +1,15 @@
package com.ifish.dao;
import com.ifish.entity.Version;
/**
* @ClassName: UserDao
* @Description: TODO
* @author ggw
*
*/
public interface VersionDao {
public Version getNewestVersion(String phoneType);
}
@@ -0,0 +1,20 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.AdInfoDao;
import com.ifish.entity.AdInfo;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 广告信息
*/
@Repository
public class AdInfoDaoImpl extends HibernateBaseDao<AdInfo, Integer> implements AdInfoDao {
@Override
protected Class<AdInfo> getEntityClass() {
return AdInfo.class;
}
}
@@ -0,0 +1,25 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.BrowseRoomDao;
import com.ifish.entity.BrowseRoom;
import com.ifish.entity.BrowseRoomId;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: CameraDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class BrowseRoomDaoImpl extends HibernateBaseDao<BrowseRoom, BrowseRoomId> implements BrowseRoomDao {
@Override
protected Class<BrowseRoom> getEntityClass() {
return BrowseRoom.class;
}
}
@@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.CameraActiveDao;
import com.ifish.entity.CameraActive;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: CameraActiveDao
* @Description: TODO
* @author ggw
*
*/
@Repository
public class CameraActiveDaoImpl extends HibernateBaseDao<CameraActive, String> implements CameraActiveDao {
@Override
public Class<CameraActive> getEntityClass() {
return CameraActive.class;
}
}
@@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.CameraDao;
import com.ifish.entity.Camera;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: CameraDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class CameraDaoImpl extends HibernateBaseDao<Camera, String> implements CameraDao {
@Override
protected Class<Camera> getEntityClass() {
return Camera.class;
}
}
@@ -0,0 +1,39 @@
package com.ifish.daoImpl;
import java.math.BigInteger;
import org.springframework.stereotype.Repository;
import com.ifish.dao.CameraUserDao;
import com.ifish.entity.CameraUser;
import com.ifish.entity.CameraUserId;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: CameraUserDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class CameraUserDaoImpl extends HibernateBaseDao<CameraUser, CameraUserId> implements CameraUserDao {
@Override
protected Class<CameraUser> getEntityClass() {
return CameraUser.class;
}
/**
* 查询用户的摄像头数量
* @param userId
* @return
*/
@Override
public int getCameraNumById(Integer userId) {
String sql = "select count(*) from tbl_camera_user where user_id=?";
int deviceNum = ((BigInteger)this.getSession().createSQLQuery(sql).setInteger(0, userId).uniqueResult()).intValue();
return deviceNum;
}
}
@@ -0,0 +1,31 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.CommentDao;
import com.ifish.entity.Comment;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: CommentDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository()
public class CommentDaoImpl extends HibernateBaseDao<Comment, Integer> implements CommentDao {
@Override
protected Class<Comment> getEntityClass() {
return Comment.class;
}
@Override
public Integer getPinglunNum(Integer ueditorId) {
//查询评论数据
String sql = "SELECT count(*) FROM tbl_comment where ueditor_id=?";
return ((Number)getSession().createSQLQuery(sql).setInteger(0, ueditorId).uniqueResult()).intValue();
}
}
@@ -0,0 +1,22 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.CouponDao;
import com.ifish.entity.Coupon;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 优惠券
* @author Administrator
*
*/
@Repository
public class CouponDaoImpl extends HibernateBaseDao<Coupon, Integer> implements CouponDao {
@Override
protected Class<Coupon> getEntityClass() {
return Coupon.class;
}
}
@@ -0,0 +1,37 @@
package com.ifish.daoImpl;
import java.math.BigInteger;
import org.springframework.stereotype.Repository;
import com.ifish.dao.CouponRecordDao;
import com.ifish.entity.CouponRecord;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 优惠价兑换记录
* @author Administrator
*
*/
@Repository
public class CouponRecordDaoImpl extends HibernateBaseDao<CouponRecord, Integer> implements CouponRecordDao {
@Override
protected Class<CouponRecord> getEntityClass() {
return CouponRecord.class;
}
@Override
public int getCouponRecordCountByCouponId(Integer couponId) {
String sql = "select count(*) from tbl_coupon_record where coupon_id=?";
return ((BigInteger)getSession().createSQLQuery(sql).setInteger(0, couponId).uniqueResult()).intValue();
}
@Override
public int getCouponRecordCountByUser(Integer userId, Integer couponId) {
String sql = "select count(*) from tbl_coupon_record where user_id=? and coupon_id=?";
return ((BigInteger)getSession().createSQLQuery(sql).setInteger(0, userId).setInteger(1, couponId).uniqueResult()).intValue();
}
}
@@ -0,0 +1,35 @@
package com.ifish.daoImpl;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.ifish.dao.DeviceCameraDao;
import com.ifish.entity.DeviceCamera;
import com.ifish.entity.DeviceCameraId;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: DeviceCameraDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class DeviceCameraDaoImpl extends HibernateBaseDao<DeviceCamera, DeviceCameraId> implements DeviceCameraDao {
@Override
protected Class<DeviceCamera> getEntityClass() {
return DeviceCamera.class;
}
@Override
public void removeAll(List<DeviceCamera> list) {
for (DeviceCamera deviceCamera:list) {
delete(deviceCamera);
}
}
}
@@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.DeviceDao;
import com.ifish.entity.Device;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: DeviceDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class DeviceDaoImpl extends HibernateBaseDao<Device, Integer> implements DeviceDao {
@Override
protected Class<Device> getEntityClass() {
return Device.class;
}
}
@@ -0,0 +1,47 @@
package com.ifish.daoImpl;
import java.math.BigInteger;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.ifish.dao.DeviceUserDao;
import com.ifish.entity.DeviceUser;
import com.ifish.entity.DeviceUserId;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: DeviceUserDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class DeviceUserDaoImpl extends HibernateBaseDao<DeviceUser, DeviceUserId> implements DeviceUserDao {
@Override
protected Class<DeviceUser> getEntityClass() {
return DeviceUser.class;
}
@Override
public void removeAll(List<DeviceUser> list) {
for (DeviceUser deviceUser:list) {
delete(deviceUser);
}
}
/**
* 查询用户的设备数量
* @param userId
* @return
*/
@Override
public int getDeviceNumById(Integer userId) {
String sql = "select count(*) from tbl_device_user where user_id=?";
int deviceNum = ((BigInteger)this.getSession().createSQLQuery(sql).setInteger(0, userId).uniqueResult()).intValue();
return deviceNum;
}
}
@@ -0,0 +1,23 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.GoldControlDao;
import com.ifish.entity.GoldControl;
import com.ifish.entity.GoldControlId;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 金币控制信息
* @author Administrator
*
*/
@Repository
public class GoldControlDaoImpl extends HibernateBaseDao<GoldControl, GoldControlId> implements GoldControlDao{
@Override
protected Class<GoldControl> getEntityClass() {
return GoldControl.class;
}
}
@@ -0,0 +1,22 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.GoldExpendRecordDao;
import com.ifish.entity.GoldExpendRecord;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 金币消耗记录
* @author Administrator
*
*/
@Repository
public class GoldExpendRecordDaoImpl extends HibernateBaseDao<GoldExpendRecord, Integer> implements GoldExpendRecordDao {
@Override
protected Class<GoldExpendRecord> getEntityClass() {
return GoldExpendRecord.class;
}
}
@@ -0,0 +1,31 @@
package com.ifish.daoImpl;
import java.math.BigDecimal;
import org.springframework.stereotype.Repository;
import com.ifish.dao.GoldGetRecordDao;
import com.ifish.entity.GoldGetRecord;
import com.ifish.enums.GoldGetTypeEnum;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 金币获取记录
* @author Administrator
*
*/
@Repository
public class GoldGetRecordDaoImpl extends HibernateBaseDao<GoldGetRecord, Integer> implements GoldGetRecordDao {
@Override
protected Class<GoldGetRecord> getEntityClass() {
return GoldGetRecord.class;
}
@Override
public BigDecimal getQuestionPayTourGoldValue(Integer userId) {
String sql = "select sum(get_value) from tbl_gold_get_record where get_type=? and user_id=?";
return (BigDecimal) getSession().createSQLQuery(sql).setString(0, GoldGetTypeEnum.liveRoomPayTour.getKey()).setInteger(1, userId).uniqueResult();
}
}
@@ -0,0 +1,23 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.GoldRuleDao;
import com.ifish.entity.GoldTask;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 金币获取规则
* @author Administrator
*
*/
@Repository
public class GoldRuleImpl extends HibernateBaseDao<GoldTask, String> implements GoldRuleDao {
@Override
protected Class<GoldTask> getEntityClass() {
return GoldTask.class;
}
}
@@ -0,0 +1,23 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.GradeControlDao;
import com.ifish.entity.GradeControl;
import com.ifish.entity.GradeControlId;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 等级信息控制
* @author Administrator
*
*/
@Repository
public class GradeControlDaoImpl extends HibernateBaseDao<GradeControl, GradeControlId> implements GradeControlDao {
@Override
protected Class<GradeControl> getEntityClass() {
return GradeControl.class;
}
}
@@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.GradeDao;
import com.ifish.entity.Grade;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: GradeDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class GradeDaoImpl extends HibernateBaseDao<Grade, Integer> implements GradeDao {
@Override
protected Class<Grade> getEntityClass() {
return Grade.class;
}
}
@@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.GradeRecordDao;
import com.ifish.entity.GradeRecord;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: GradeRecordDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class GradeRecordDaoImpl extends HibernateBaseDao<GradeRecord, Integer> implements GradeRecordDao {
@Override
protected Class<GradeRecord> getEntityClass() {
return GradeRecord.class;
}
}
@@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.GradeRuleDao;
import com.ifish.entity.GradeTask;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: GradeRuleImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class GradeRuleImpl extends HibernateBaseDao<GradeTask, String> implements GradeRuleDao {
@Override
protected Class<GradeTask> getEntityClass() {
return GradeTask.class;
}
}
@@ -0,0 +1,25 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.HardwareTypeDao;
import com.ifish.entity.HardwareType;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: HardwareTypeDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class HardwareTypeDaoImpl extends HibernateBaseDao<HardwareType, String> implements HardwareTypeDao {
@Override
protected Class<HardwareType> getEntityClass() {
return HardwareType.class;
}
}
@@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.IfishDoctorDao;
import com.ifish.entity.IfishDoctor;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: IfishDoctorDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class IfishDoctorDaoImpl extends HibernateBaseDao<IfishDoctor, Integer> implements IfishDoctorDao {
@Override
protected Class<IfishDoctor> getEntityClass() {
return IfishDoctor.class;
}
}
@@ -0,0 +1,22 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.IfishGoodsDao;
import com.ifish.entity.IfishGoods;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 商品管理dao
* @author Administrator
*
*/
@Repository
public class IfishGoodsDaoImpl extends HibernateBaseDao<IfishGoods,Integer> implements IfishGoodsDao {
@Override
protected Class<IfishGoods> getEntityClass() {
return IfishGoods.class;
}
}
@@ -0,0 +1,22 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.IfishShopDao;
import com.ifish.entity.IfishShop;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 店铺管理dao
* @author Administrator
*
*/
@Repository
public class IfishShopDaoImpl extends HibernateBaseDao<IfishShop,Integer> implements IfishShopDao {
@Override
protected Class<IfishShop> getEntityClass() {
return IfishShop.class;
}
}
@@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.InformationDao;
import com.ifish.entity.Information;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: InformationDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository("informationDao")
public class InformationDaoImpl extends HibernateBaseDao<Information, Integer> implements InformationDao {
@Override
protected Class<Information> getEntityClass() {
return Information.class;
}
}
@@ -0,0 +1,22 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.InformationStatsDao;
import com.ifish.entity.InformationStats;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 资讯数据统计
* @author Administrator
*
*/
@Repository
public class InformationStatsDaoImpl extends HibernateBaseDao<InformationStats, Integer> implements InformationStatsDao {
@Override
protected Class<InformationStats> getEntityClass() {
return InformationStats.class;
}
}
@@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.LiveBannerDao;
import com.ifish.entity.LiveBanner;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: LiveBannerImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class LiveBannerImpl extends HibernateBaseDao<LiveBanner, Integer> implements LiveBannerDao {
@Override
protected Class<LiveBanner> getEntityClass() {
return LiveBanner.class;
}
}
@@ -0,0 +1,32 @@
package com.ifish.daoImpl;
import java.math.BigInteger;
import org.springframework.stereotype.Repository;
import com.ifish.dao.LiveMessageDao;
import com.ifish.entity.LiveMessage;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: LiveMessageDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class LiveMessageDaoImpl extends HibernateBaseDao<LiveMessage, Integer> implements LiveMessageDao {
@Override
protected Class<LiveMessage> getEntityClass() {
return LiveMessage.class;
}
@Override
public int getLiveMessageCount(Integer roomId) {
String sql = "SELECT COUNT(*) FROM tbl_live_message WHERE room_id=?";
return ((BigInteger)getSession().createSQLQuery(sql).setInteger(0, roomId).uniqueResult()).intValue();
}
}
@@ -0,0 +1,203 @@
package com.ifish.daoImpl;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.SQLQuery;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;
import com.ifish.dao.LiveRoomDao;
import com.ifish.dto.LiveRoomInfoDto;
import com.ifish.entity.LiveRoom;
import com.ifish.enums.BooleanEnum;
import com.ifish.enums.RoomStatusEnum;
import com.ifish.hibernate.HibernateBaseDao;
import com.ifish.hibernate.Pagination;
/**
* @ClassName: LiveRoomImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class LiveRoomImpl extends HibernateBaseDao<LiveRoom, Integer> implements LiveRoomDao {
@Override
protected Class<LiveRoom> getEntityClass() {
return LiveRoom.class;
}
@SuppressWarnings("unchecked")
@Override
public List<LiveRoomInfoDto> findByDistance(Double longitude,Double latitude) {
if(longitude!=null && latitude!=null){
String sql = "select l.room_id AS roomId,u.user_id AS userId,u.user_type AS userType,u.nick_name AS nickName,u.user_img AS userImg,u.login_time AS loginTime,c.camera_id AS cameraId,l.room_name AS roomName,l.room_desc AS roomDesc,l.popularity_value AS popularityValue,(TO_DAYS(NOW())-TO_DAYS(l.create_time)) AS numberDays,round(6378.138*2*asin(sqrt(pow(sin((?*pi()/180-u.latitude*pi()/180)/2),2)+cos(?*pi()/180)*cos(u.latitude*pi()/180)* pow(sin((?*pi()/180-u.longitude*pi()/180)/2),2)))*1000) AS distance from tbl_user u LEFT JOIN tbl_camera_user c ON u.user_id=c.user_id LEFT JOIN tbl_live_room l on c.user_id=l.user_id WHERE c.is_live=? AND l.room_status=? HAVING distance IS NOT NULL ORDER BY distance ASC LIMIT 5";
return this.getSession().createSQLQuery(sql)
.setParameter(0, latitude)
.setParameter(1, latitude)
.setParameter(2, longitude)
.setParameter(3, BooleanEnum.YES.getKey())
.setParameter(4, RoomStatusEnum.status1.getKey())
.setResultTransformer(Transformers.aliasToBean(LiveRoomInfoDto.class))
.list();
}
else{
return new ArrayList<LiveRoomInfoDto>();
}
}
@SuppressWarnings("unchecked")
@Override
public List<LiveRoomInfoDto> findByBrowse(Integer userId) {
if(userId!=null){
String sql = "select l.room_id AS roomId,u.user_id AS userId,u.user_type AS userType,u.nick_name AS nickName,u.user_img AS userImg,u.login_time AS loginTime,c.camera_id AS cameraId,l.room_name AS roomName,l.room_desc AS roomDesc,l.popularity_value AS popularityValue,(TO_DAYS(NOW())-TO_DAYS(l.create_time)) AS numberDays from tbl_browse_room b LEFT JOIN tbl_live_room l ON b.room_id=l.room_id LEFT JOIN tbl_camera_user c ON c.user_id=l.user_id LEFT JOIN tbl_user u ON c.user_id=u.user_id where b.user_id=? AND c.is_live=? AND l.room_status=? ORDER BY b.update_time DESC LIMIT 5";
return this.getSession().createSQLQuery(sql)
.setParameter(0, userId)
.setParameter(1, BooleanEnum.YES.getKey())
.setParameter(2, RoomStatusEnum.status1.getKey())
.setResultTransformer(Transformers.aliasToBean(LiveRoomInfoDto.class))
.list();
}
else{
return new ArrayList<LiveRoomInfoDto>();
}
}
@SuppressWarnings("unchecked")
@Override
public List<LiveRoomInfoDto> findByPopularityValue() {
String sql = "select l.room_id AS roomId,u.user_id AS userId,u.user_type AS userType,u.nick_name AS nickName,u.user_img AS userImg,u.login_time AS loginTime,c.camera_id AS cameraId,l.room_name AS roomName,l.room_desc AS roomDesc,l.popularity_value AS popularityValue,(TO_DAYS(NOW())-TO_DAYS(l.create_time)) AS numberDays from tbl_user u LEFT JOIN tbl_camera_user c ON u.user_id=c.user_id LEFT JOIN tbl_live_room l ON u.user_id=l.user_id WHERE c.is_live=? AND l.room_status=? ORDER BY l.popularity_value DESC LIMIT 5";
return this.getSession().createSQLQuery(sql)
.setParameter(0, BooleanEnum.YES.getKey())
.setParameter(1, RoomStatusEnum.status1.getKey())
.setResultTransformer(Transformers.aliasToBean(LiveRoomInfoDto.class))
.list();
}
@SuppressWarnings("unchecked")
@Override
public Pagination<LiveRoomInfoDto> findByTime(Integer firstResult,Integer pageSize,String orders) {
//综合数据
Integer length = 0;
String[] strOrder = null;
if(orders!=null && orders.length()>0){
strOrder = orders.split(",");
length = strOrder.length;
}
//总条数
String countSql = "select count(*) from tbl_user u LEFT JOIN tbl_camera_user c ON u.user_id=c.user_id LEFT JOIN tbl_live_room l ON u.user_id=l.user_id WHERE ### c.is_live=? AND l.room_status=? ORDER BY l.create_time DESC";
//分页数据
String sql = "select l.room_id AS roomId,u.user_id AS userId,u.user_type AS userType,u.nick_name AS nickName,u.user_img AS userImg,u.login_time AS loginTime,l.create_time AS createTime,c.camera_id AS cameraId,l.room_name AS roomName,l.room_desc AS roomDesc,l.popularity_value AS popularityValue,(TO_DAYS(NOW())-TO_DAYS(l.create_time)) AS numberDays from tbl_user u LEFT JOIN tbl_camera_user c ON u.user_id=c.user_id LEFT JOIN tbl_live_room l ON u.user_id=l.user_id WHERE ### c.is_live=? AND l.room_status=? ORDER BY l.create_time DESC LIMIT ?,?";
//查询条件去除综合数据
Object[] intOrder = new Integer[length];
StringBuilder pingjie = new StringBuilder("");
if(length>0){
pingjie.append("l.room_id NOT IN (");
for (int i = 0; i < length; i++) {
if(i==0){
pingjie.append("?");
}
else{
pingjie.append(",?");
}
intOrder[i] = Integer.valueOf(strOrder[i]);
}
pingjie.append(") AND");
}
countSql = countSql.replaceAll("###", pingjie.toString());
sql = sql.replaceAll("###", pingjie.toString());
//查询total
SQLQuery countQuery = this.getSession().createSQLQuery(countSql);
if(length>0){
for (int i = 0; i < length; i++) {
countQuery.setParameter(i, intOrder[i]);
}
countQuery.setParameter(length, BooleanEnum.YES.getKey());
countQuery.setParameter((length+1), RoomStatusEnum.status1.getKey());
}
else{
countQuery.setParameter(0, BooleanEnum.YES.getKey());
countQuery.setParameter(1, RoomStatusEnum.status1.getKey());
}
int totalCount = ((BigInteger)countQuery.uniqueResult()).intValue();
//分页数据
SQLQuery query = this.getSession().createSQLQuery(sql);
if(length>0){
for (int i = 0; i < length; i++) {
query.setParameter(i, intOrder[i]);
}
query.setParameter(length, BooleanEnum.YES.getKey());
query.setParameter((length+1), RoomStatusEnum.status1.getKey());
query.setParameter((length+2), firstResult);
query.setParameter((length+3), pageSize);
}
else{
query.setParameter(0, BooleanEnum.YES.getKey());
query.setParameter(1, RoomStatusEnum.status1.getKey());
query.setParameter(2, firstResult);
query.setParameter(3, pageSize);
}
List<LiveRoomInfoDto> list = query.setResultTransformer(Transformers.aliasToBean(LiveRoomInfoDto.class)).list();
//分页封装
Pagination<LiveRoomInfoDto> page = new Pagination<LiveRoomInfoDto>();
page.setTotalCount(totalCount);
page.setList(list);
return page;
}
@SuppressWarnings("unchecked")
@Override
public Pagination<LiveRoomInfoDto> findByPopularityValue(Integer firstResult,Integer pageSize) {
//总条数
String countSql = "select count(*) from tbl_user u LEFT JOIN tbl_camera_user c ON u.user_id=c.user_id LEFT JOIN tbl_live_room l ON u.user_id=l.user_id WHERE c.is_live=? AND l.room_status=? ORDER BY l.popularity_value DESC";
int totalCount = ((BigInteger) this.getSession().createSQLQuery(countSql)
.setParameter(0, BooleanEnum.YES.getKey())
.setParameter(1, RoomStatusEnum.status1.getKey())
.uniqueResult()).intValue();
String sql = "select l.room_id AS roomId,u.user_id AS userId,u.user_type AS userType,u.nick_name AS nickName,u.user_img AS userImg,u.login_time AS loginTime,c.camera_id AS cameraId,l.room_name AS roomName,l.room_desc AS roomDesc,l.popularity_value AS popularityValue,(TO_DAYS(NOW())-TO_DAYS(l.create_time)) AS numberDays from tbl_user u LEFT JOIN tbl_camera_user c ON u.user_id=c.user_id LEFT JOIN tbl_live_room l ON u.user_id=l.user_id WHERE c.is_live=? AND l.room_status=? ORDER BY l.popularity_value DESC LIMIT ?,?";
//分页数据
List<LiveRoomInfoDto> list = this.getSession().createSQLQuery(sql)
.setParameter(0, BooleanEnum.YES.getKey())
.setParameter(1, RoomStatusEnum.status1.getKey())
.setParameter(2, firstResult)
.setParameter(3, pageSize)
.setResultTransformer(Transformers.aliasToBean(LiveRoomInfoDto.class))
.list();
//分页封装
Pagination<LiveRoomInfoDto> page = new Pagination<LiveRoomInfoDto>();
page.setTotalCount(totalCount);
page.setList(list);
return page;
}
@SuppressWarnings("unchecked")
@Override
public Pagination<LiveRoomInfoDto> getLiveRoomsByTuijian(Integer firstResult, Integer pageSize) {
//总条数
String countSql = "select count(*) from tbl_user u LEFT JOIN tbl_camera_user c ON u.user_id=c.user_id LEFT JOIN tbl_live_room l ON u.user_id=l.user_id WHERE c.is_live=? AND l.room_status=? ORDER BY l.popularity_value DESC";
int totalCount = ((BigInteger) this.getSession().createSQLQuery(countSql)
.setParameter(0, BooleanEnum.YES.getKey())
.setParameter(1, RoomStatusEnum.status1.getKey())
.uniqueResult()).intValue();
String sql = "select l.room_id AS roomId,u.user_id AS userId,u.user_type AS userType,u.nick_name AS nickName,u.user_img AS userImg,u.login_time AS loginTime,c.camera_id AS cameraId,l.room_name AS roomName,l.room_desc AS roomDesc,l.popularity_value AS popularityValue,(TO_DAYS(NOW())-TO_DAYS(l.create_time)) AS numberDays from tbl_user u LEFT JOIN tbl_camera_user c ON u.user_id=c.user_id LEFT JOIN tbl_live_room l ON u.user_id=l.user_id WHERE l.is_tuijian='1' AND c.is_live=? AND l.room_status=? ORDER BY l.tuijian_num ASC LIMIT ?,?";
//分页数据
List<LiveRoomInfoDto> list = this.getSession().createSQLQuery(sql)
.setParameter(0, BooleanEnum.YES.getKey())
.setParameter(1, RoomStatusEnum.status1.getKey())
.setParameter(2, firstResult)
.setParameter(3, pageSize)
.setResultTransformer(Transformers.aliasToBean(LiveRoomInfoDto.class))
.list();
//分页封装
Pagination<LiveRoomInfoDto> page = new Pagination<LiveRoomInfoDto>();
page.setTotalCount(totalCount);
page.setList(list);
return page;
}
}
@@ -0,0 +1,31 @@
package com.ifish.daoImpl;
import java.math.BigInteger;
import org.springframework.stereotype.Repository;
import com.ifish.dao.LiveRoomZanDao;
import com.ifish.entity.LiveRoomZan;
import com.ifish.entity.LiveRoomZanId;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 直播间点赞
* @author Administrator
*
*/
@Repository
public class LiveRoomZanDaoImpl extends HibernateBaseDao<LiveRoomZan, LiveRoomZanId> implements LiveRoomZanDao {
@Override
protected Class<LiveRoomZan> getEntityClass() {
return LiveRoomZan.class;
}
@Override
public Integer getZanNum(Integer roomId) {
String sql = "select count(*) from tbl_live_room_zan where room_id=?";
return ((BigInteger)getSession().createSQLQuery(sql).setInteger(0, roomId).uniqueResult()).intValue();
}
}
@@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.LookReportDao;
import com.ifish.entity.LookReport;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: LookReportDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class LookReportDaoImpl extends HibernateBaseDao<LookReport, Integer> implements LookReportDao {
@Override
protected Class<LookReport> getEntityClass() {
return LookReport.class;
}
}
@@ -0,0 +1,51 @@
package com.ifish.daoImpl;
import java.util.ArrayList;
import java.util.List;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import com.ifish.dao.PushListDao;
import com.ifish.entity.PushList;
import com.ifish.enums.PushTypeEnum;
import com.ifish.hibernate.HibernateBaseDao;
import com.ifish.hibernate.Pagination;
/**
* @ClassName: PushListDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class PushListDaoImpl extends HibernateBaseDao<PushList, Integer> implements PushListDao {
@Override
protected Class<PushList> getEntityClass() {
return PushList.class;
}
@Override
public Pagination<PushList> findByCriteria(Integer pushId,Integer userId,Integer firstResult, Integer pageSize) {
//查询条件
List<Criterion> queryList = new ArrayList<Criterion>();
if(pushId!=null){
Criterion criterion = Restrictions.gt("pushId", pushId);
queryList.add(criterion);
}
if(userId!=null){
Criterion criterion = Restrictions.or(Restrictions.eq("userId", userId),Restrictions.eq("pushType", PushTypeEnum.all_push.getKey()));
queryList.add(criterion);
}
else{
Criterion criterion = Restrictions.eq("pushType", PushTypeEnum.all_push.getKey());
queryList.add(criterion);
}
return this.findByCriteria(firstResult, pageSize,Order.desc("pushId"), queryList.toArray(new Criterion[queryList.size()]));
}
}
@@ -0,0 +1,25 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.QuestionsFeedbackDao;
import com.ifish.entity.QuestionsFeedback;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: QuestionsFeedbackDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class QuestionsFeedbackDaoImpl extends HibernateBaseDao<QuestionsFeedback, Integer> implements QuestionsFeedbackDao {
@Override
protected Class<QuestionsFeedback> getEntityClass() {
return QuestionsFeedback.class;
}
}
@@ -0,0 +1,78 @@
package com.ifish.daoImpl;
import java.math.BigInteger;
import java.util.List;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;
import com.ifish.dao.ShopsInfoDao;
import com.ifish.dto.ShopsListDto;
import com.ifish.entity.ShopsInfo;
import com.ifish.enums.BooleanEnum;
import com.ifish.enums.ShopsStatusEnum;
import com.ifish.hibernate.HibernateBaseDao;
import com.ifish.hibernate.Pagination;
/**
* @ClassName: ShopsInfoDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class ShopsInfoDaoImpl extends HibernateBaseDao<ShopsInfo, Integer> implements ShopsInfoDao {
@Override
protected Class<ShopsInfo> getEntityClass() {
return ShopsInfo.class;
}
@SuppressWarnings("unchecked")
@Override
public Pagination<ShopsListDto> findByDistance(Double longitude,Double latitude,Integer firstResult, Integer pageSize) {
//总条数
String countSql = "select count(*) from tbl_shops_info where status=?";
int totalCount = ((BigInteger) this.getSession().createSQLQuery(countSql)
.setParameter(0, ShopsStatusEnum.status1.getKey())
.uniqueResult()).intValue();
String sql ="select s.shops_id shopsId,s.is_ping_bi as isPingBi,s.user_id AS userId,u.user_img AS userImg,u.nick_name AS userName,s.shops_name AS shopsName,s.shops_phone AS shopsPhone,s.shops_province AS shopsProvince,s.shops_city AS shopsCity,s.shops_area AS shopsArea,s.shops_address AS shopsAddress,s.picture4 AS picture4,s.remark AS remark,s.weixin_code AS weixinCode,s.shop_link AS shopLink,ifnull(round(6378.138*2*asin(sqrt(pow(sin((?*pi()/180-u.latitude*pi()/180)/2),2)+cos(?*pi()/180)*cos(u.latitude*pi()/180)*pow(sin((?*pi()/180-u.longitude*pi()/180)/2),2)))*1000),99999999999) AS distance from tbl_shops_info s LEFT JOIN tbl_user u ON s.user_id=u.user_id where s.status=? and app_show=? ORDER BY distance ASC LIMIT ?,?";
//分页数据
List<ShopsListDto> list = this.getSession().createSQLQuery(sql)
.setParameter(0, latitude)
.setParameter(1, latitude)
.setParameter(2, longitude)
.setParameter(3, ShopsStatusEnum.status1.getKey())
.setParameter(4, BooleanEnum.YES.getKey())
.setParameter(5, firstResult)
.setParameter(6, pageSize)
.setResultTransformer(Transformers.aliasToBean(ShopsListDto.class))
.list();
String pingbiMsg = "请通过下方咨询联系我";
for (ShopsListDto shopsList : list) {
if(shopsList.getIsPingBi().equals(BooleanEnum.YES.getKey())){
shopsList.setShopsAddress("");
shopsList.setShopsPhone(pingbiMsg);
shopsList.setWeixinCode(pingbiMsg);
shopsList.setShopLink(pingbiMsg);
}
}
//分页封装
Pagination<ShopsListDto> page = new Pagination<ShopsListDto>();
page.setTotalCount(totalCount);
page.setList(list);
return page;
}
@Override
@SuppressWarnings("unchecked")
public List<Integer> getShopsUserIdByRand(Integer userId) {
String sql = "SELECT user_id FROM tbl_shops_info WHERE status='1' AND user_id!=? AND user_id!=12 AND app_show='1' ORDER BY RAND() LIMIT 9";
List<Integer> list = this.getSession().createSQLQuery(sql).setParameter(0, userId).list();
//固定发送给小陈
list.add(12);
return list;
}
}
@@ -0,0 +1,23 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.ShopsUserInfoDao;
import com.ifish.entity.ShopsUserInfo;
import com.ifish.entity.ShopsUserInfoId;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 商家会员信息
* @author Administrator
*
*/
@Repository
public class ShopsUserInfoDaoImpl extends HibernateBaseDao<ShopsUserInfo, ShopsUserInfoId> implements ShopsUserInfoDao{
@Override
protected Class<ShopsUserInfo> getEntityClass() {
return ShopsUserInfo.class;
}
}
@@ -0,0 +1,24 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.UeditorDao;
import com.ifish.entity.Ueditor;
import com.ifish.hibernate.HibernateBaseDao;
/**
* @ClassName: UeditorDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository()
public class UeditorDaoImpl extends HibernateBaseDao<Ueditor, Integer> implements UeditorDao {
@Override
protected Class<Ueditor> getEntityClass() {
return Ueditor.class;
}
}
@@ -0,0 +1,22 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.UserActivityDao;
import com.ifish.entity.UserActivity;
import com.ifish.hibernate.HibernateBaseDao;
/**
* 用户动态
* @author Administrator
*
*/
@Repository
public class UserActivityDaoImpl extends HibernateBaseDao<UserActivity, Integer>implements UserActivityDao {
@Override
protected Class<UserActivity> getEntityClass() {
return UserActivity.class;
}
}
@@ -0,0 +1,17 @@
package com.ifish.daoImpl;
import org.springframework.stereotype.Repository;
import com.ifish.dao.UserAssetDao;
import com.ifish.entity.UserAsset;
import com.ifish.hibernate.HibernateBaseDao;
@Repository
public class UserAssetDaoImpl extends HibernateBaseDao<UserAsset, Integer> implements UserAssetDao {
@Override
protected Class<UserAsset> getEntityClass() {
return UserAsset.class;
}
}
@@ -0,0 +1,66 @@
package com.ifish.daoImpl;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.transform.Transformers;
import org.springframework.stereotype.Repository;
import com.ifish.dao.UserDao;
import com.ifish.dto.ShopsLookUserDto;
import com.ifish.entity.User;
import com.ifish.enums.BooleanEnum;
import com.ifish.hibernate.HibernateBaseDao;
import com.ifish.hibernate.Pagination;
/**
* @ClassName: UserDaoImpl
* @Description: TODO
* @author ggw
*
*/
@Repository
public class UserDaoImpl extends HibernateBaseDao<User, Integer> implements UserDao {
@Override
protected Class<User> getEntityClass() {
return User.class;
}
@Override
public User update(User user) {
getSession().update(user);
return user;
}
@SuppressWarnings("unchecked")
@Override
public Pagination<ShopsLookUserDto> findByCriteria(Integer shopsUserId,Integer firstResult, Integer pageSize) {
String sql = "select u.user_id as userId,u.nick_name as nickName,c.camera_id as cameraId,u.user_img as userImg from tbl_user u LEFT JOIN tbl_camera_user c ON u.user_id=c.user_id where c.is_look=1 and shops_user_id="+shopsUserId;
List<ShopsLookUserDto> list = this.getSession().createSQLQuery(sql).setResultTransformer(Transformers.aliasToBean(ShopsLookUserDto.class)).list();
Pagination<ShopsLookUserDto> page = new Pagination<ShopsLookUserDto>();
page.setTotalCount(list.size());
page.setList(list);
return page;
}
@Override
public int executeLoginUpdate(Integer userId,String loginType) {
String sql = "update tbl_user set login_count=if(login_count is null,1,login_count+1),login_type=?,login_time=current_timestamp() where user_id=?";
Query query = this.getSession().createSQLQuery(sql).setString(0, loginType).setInteger(1, userId);
return query.executeUpdate();
}
@SuppressWarnings("unchecked")
@Override
public List<Integer> getUserIds(Integer userId,Integer firstResult, int maxResults) {
String sql = "select user_id from tbl_user where user_id!=? and is_register_netease=? limit ?,?";
List<Integer> list = this.getSession().createSQLQuery(sql).setInteger(0, userId).setString(1, BooleanEnum.YES.getKey()).setInteger(2, firstResult).setInteger(3,maxResults).list();
return list;
}
}

Some files were not shown because too many files have changed in this diff Show More