Commit 3dbcd483 by XiaHou

微信扫码登录相关代码提交

parent c584e28e
...@@ -232,6 +232,22 @@ ...@@ -232,6 +232,22 @@
<artifactId>wxpay-sdk</artifactId> <artifactId>wxpay-sdk</artifactId>
<version>0.0.3</version> <version>0.0.3</version>
</dependency> </dependency>
<!--引入微信相关jar保存-->
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>3.5.0</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-pay</artifactId>
<version>3.5.0</version>
</dependency>
</dependencies> </dependencies>
<repositories> <repositories>
......
package com.hwstudio.antaile.controller;
import com.hwstudio.antaile.common.Constants;
import com.hwstudio.antaile.dto.WxInsertUserParam;
import com.hwstudio.antaile.dto.WxPayCreateOrderQureyParam;
import com.hwstudio.antaile.service.AtlNotifyService;
import com.hwstudio.antaile.service.AtlWxService;
import com.hwstudio.antaile.utils.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.IOException;
/**
* @Author xh
* @Date 2021/5/17
* description:
*/
@Controller
@RequestMapping(value = "/notify")
@Api(tags = "安泰乐回调地址相关接口")
@CrossOrigin(origins = "*",maxAge = 3600)
public class AtlNotifyController extends BaseController{
@Autowired
private AtlNotifyService atlNotifyService;
/**
* 微信支付回调
*/
@RequestMapping(value = "/wxPayCallback")
public String wxPayCallback(HttpServletRequest request, HttpServletResponse response) {
String inputLine;
String notifyXml = "";
String resXml = "";
try {
while ((inputLine = request.getReader().readLine()) != null) {
notifyXml += inputLine;
}
request.getReader().close();
} catch (IOException e) {
e.printStackTrace();
}
JsonResult res = atlNotifyService.dealWxpayNotify(notifyXml);
//如果成功 返回微信停止回调的代码,否则 微信继续回调
if (res.getStatus().equals(Constants.RESPONSE_STATUS_500)) {
return res.getMessage();
}
String msg = "";
try {
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
msg = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
out.write(msg.getBytes());
out.flush();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
return msg;
}
}
package com.hwstudio.antaile.controller; package com.hwstudio.antaile.controller;
import com.hwstudio.antaile.dto.*; import com.hwstudio.antaile.dto.*;
import com.hwstudio.antaile.entity.AtlMemorial;
import com.hwstudio.antaile.entity.AtlTime; import com.hwstudio.antaile.entity.AtlTime;
import com.hwstudio.antaile.queryparam.QueryReleaseArticleParam;
import com.hwstudio.antaile.service.*; import com.hwstudio.antaile.service.*;
import com.hwstudio.antaile.utils.JsonResult; import com.hwstudio.antaile.utils.JsonResult;
import com.hwstudio.antaile.utils.Page;
import com.hwstudio.antaile.vo.*; import com.hwstudio.antaile.vo.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -69,7 +67,7 @@ public class AtlTimeController extends BaseController { ...@@ -69,7 +67,7 @@ public class AtlTimeController extends BaseController {
return JsonResult.notLogin(); return JsonResult.notLogin();
} }
List<AtlTimeListDto> list = atlTimeService.findMyTimeAllList(userId); List<AtlTimeListDto> list = atlTimeService.findMyTimeAllList(userId);
for (AtlTimeListDto dto :list) { for (AtlTimeListDto dto : list) {
Long timeId = dto.getId(); Long timeId = dto.getId();
Integer count = atlTimeArticleServie.getArticleCountByTimeId(timeId); Integer count = atlTimeArticleServie.getArticleCountByTimeId(timeId);
dto.setArticleCount(count); dto.setArticleCount(count);
...@@ -88,10 +86,10 @@ public class AtlTimeController extends BaseController { ...@@ -88,10 +86,10 @@ public class AtlTimeController extends BaseController {
if (userId == null) { if (userId == null) {
return JsonResult.notLogin(); return JsonResult.notLogin();
} }
if(null == timeId){ if (null == timeId) {
AtlTimeListDto dto = atlTimeService.getDefaultTime(userId); AtlTimeListDto dto = atlTimeService.getDefaultTime(userId);
return JsonResult.success("获取快捷发布默认时光纪成功", dto); return JsonResult.success("获取快捷发布默认时光纪成功", dto);
}else { } else {
AtlTime atlTime = atlTimeService.getById(timeId); AtlTime atlTime = atlTimeService.getById(timeId);
return JsonResult.success("获取快捷发布默认时光纪成功", atlTime); return JsonResult.success("获取快捷发布默认时光纪成功", atlTime);
} }
...@@ -143,8 +141,8 @@ public class AtlTimeController extends BaseController { ...@@ -143,8 +141,8 @@ public class AtlTimeController extends BaseController {
return JsonResult.notLogin(); return JsonResult.notLogin();
} }
atlTimeService.addTime(atlTimeVo, userId); AtlTime atlTime = atlTimeService.addTime(atlTimeVo, userId);
return JsonResult.success("新增时光纪成功"); return JsonResult.success("新增时光纪成功", atlTime);
} }
@PostMapping(value = "/selectDefault") @PostMapping(value = "/selectDefault")
...@@ -317,10 +315,10 @@ public class AtlTimeController extends BaseController { ...@@ -317,10 +315,10 @@ public class AtlTimeController extends BaseController {
return JsonResult.success("获取时光纪详情成功", atlTimeDetailsDto); return JsonResult.success("获取时光纪详情成功", atlTimeDetailsDto);
} }
@RequestMapping(value = "/releaseFile") @PostMapping(value = "/releaseFile")
@ApiOperation(value = "新增图片/视频/音频", httpMethod = "POST", notes = "新增图片/视频/音频") @ApiOperation(value = "新增图片/视频/音频", httpMethod = "POST", notes = "新增图片/视频/音频")
@ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = JsonResult.class)) @ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = JsonResult.class))
public JsonResult releaseFile(AtlTimeArticleFileVo atlTimeArticleFileVo) { public JsonResult releaseFile(@ApiParam(value = "传入对象") @RequestBody AtlTimeArticleFileVo atlTimeArticleFileVo) {
Long userId = super.getUserId(); Long userId = super.getUserId();
if (userId == null) { if (userId == null) {
return JsonResult.notLogin(); return JsonResult.notLogin();
...@@ -571,9 +569,14 @@ public class AtlTimeController extends BaseController { ...@@ -571,9 +569,14 @@ public class AtlTimeController extends BaseController {
@PostMapping(value = "/selectRandomAtlTime") @PostMapping(value = "/selectRandomAtlTime")
@ApiOperation(value = "随机获取推荐3个时光纪", httpMethod = "POST", notes = "随机获取推荐3个时光纪") @ApiOperation(value = "随机获取推荐3个时光纪", httpMethod = "POST", notes = "随机获取推荐3个时光纪")
public JsonResult selectRandomAtlTime( ) { public JsonResult selectRandomAtlTime() {
return JsonResult.success("获取时光纪详情成功", this.atlTimeService.selectRandomAtlTime()); return JsonResult.success("获取时光纪详情成功", this.atlTimeService.selectRandomAtlTime());
} }
@ApiOperation("查询我的待办相关时光纪数据")
@RequestMapping(value = "/selectAtlTimeCountMap", method = RequestMethod.GET)
public JsonResult selectAtlTimeCountMap(@ApiParam(value = "用户id", required = true) @RequestParam(value = "userId", required = true) Long userId) {
return this.atlTimeService.selectAtlTimeCountMap(userId);
}
} }
...@@ -2,16 +2,20 @@ package com.hwstudio.antaile.controller; ...@@ -2,16 +2,20 @@ package com.hwstudio.antaile.controller;
import com.hwstudio.antaile.dto.AtlNewsListDto; import com.hwstudio.antaile.dto.AtlNewsListDto;
import com.hwstudio.antaile.dto.AtlTimeMessageListDto; import com.hwstudio.antaile.dto.AtlTimeMessageListDto;
import com.hwstudio.antaile.dto.WxInsertUserParam;
import com.hwstudio.antaile.mbg.po.SysAtlTimeMessage;
import com.hwstudio.antaile.queryparam.QueryAtlTimeMessageParam;
import com.hwstudio.antaile.service.AtlTimeMessageService; import com.hwstudio.antaile.service.AtlTimeMessageService;
import com.hwstudio.antaile.utils.CommonPage;
import com.hwstudio.antaile.utils.JsonResult; import com.hwstudio.antaile.utils.JsonResult;
import com.hwstudio.antaile.utils.Page;
import com.hwstudio.antaile.vo.AtlTimeMessageVO;
import com.hwstudio.antaile.vo.PageVo; import com.hwstudio.antaile.vo.PageVo;
import io.swagger.annotations.Api; import io.swagger.annotations.*;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* @Name: * @Name:
...@@ -114,4 +118,16 @@ public class AtlTimeMessageController extends BaseController{ ...@@ -114,4 +118,16 @@ public class AtlTimeMessageController extends BaseController{
} }
return atlTimeMessageService.isMessageUnRead(userId); return atlTimeMessageService.isMessageUnRead(userId);
} }
@RequestMapping(value = "/queryAtlTimeMessageListByPage",method = RequestMethod.GET)
@ApiOperation("分页查询留言List 不分页不传递分页参数(会员中心留言管理)")
public JsonResult<List<AtlTimeMessageVO>> queryAtlTimeMessageListByPage(@ModelAttribute QueryAtlTimeMessageParam queryAtlTimeMessageParam, @ModelAttribute Page page) {
return JsonResult.success("获取成功",this.atlTimeMessageService.queryAtlTimeMessageListByPage(queryAtlTimeMessageParam,page ));
}
@RequestMapping(value = "/updateAtlTimeMessageById",method = RequestMethod.POST)
@ApiOperation("根据id 修改一条安泰乐的留言数据(需要改啥数据传哪个参数即可)")
public JsonResult updateAtlTimeMessageById(@ApiParam(value = "传入对象") @RequestBody SysAtlTimeMessage sysAtlTimeMessage) {
return this.atlTimeMessageService.updateAtlTimeMessageById(sysAtlTimeMessage);
}
} }
package com.hwstudio.antaile.controller; package com.hwstudio.antaile.controller;
import com.hwstudio.antaile.dto.WxInsertUserParam; import com.hwstudio.antaile.dto.WxInsertUserParam;
import com.hwstudio.antaile.dto.WxPayCreateOrderQureyParam;
import com.hwstudio.antaile.service.AtlWxService; import com.hwstudio.antaile.service.AtlWxService;
import com.hwstudio.antaile.utils.JsonResult; import com.hwstudio.antaile.utils.JsonResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -10,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -10,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
/** /**
* @Author xh * @Author xh
* @Date 2021/5/17 * @Date 2021/5/17
...@@ -17,7 +20,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -17,7 +20,7 @@ import org.springframework.web.bind.annotation.*;
*/ */
@Controller @Controller
@RequestMapping(value = "/wx") @RequestMapping(value = "/wx")
@Api(tags = "用户相关接口") @Api(tags = "安泰乐微信相关接口")
@CrossOrigin(origins = "*",maxAge = 3600) @CrossOrigin(origins = "*",maxAge = 3600)
public class AtlWxController extends BaseController{ public class AtlWxController extends BaseController{
...@@ -25,30 +28,55 @@ public class AtlWxController extends BaseController{ ...@@ -25,30 +28,55 @@ public class AtlWxController extends BaseController{
private AtlWxService atlWxService; private AtlWxService atlWxService;
@RequestMapping(value = "getQrcodeUrl",method = RequestMethod.GET) @RequestMapping(value = "getQrcodeUrl",method = RequestMethod.GET)
@ApiOperation("获取二维码链接地址") @ApiOperation("获取二维码链接地址(微信网页应用)")
@ResponseBody @ResponseBody
public JsonResult getQrcodeUrl() { public JsonResult getQrcodeUrl() {
return this.atlWxService.getQrcodeUrl(); return this.atlWxService.getQrcodeUrl();
} }
@RequestMapping(value = "getQrcodeAndState",method = RequestMethod.GET) @RequestMapping(value = "getQrcodeAndState",method = RequestMethod.GET)
@ApiOperation("微信二维码回调地址") @ApiOperation("微信二维码回调地址,通过微信code换取openId等信息(微信网页应用)")
@ResponseBody @ResponseBody
public JsonResult getQrcodeAndState(@RequestParam(value = "code", required = true) String code, @RequestParam(value = "state", required = true) String state) { public JsonResult getQrcodeAndState(@RequestParam(value = "code", required = true) String code, @RequestParam(value = "state", required = false) String state) {
return this.atlWxService.getAccessToken(code,state ); return this.atlWxService.getAccessToken(code,state,1 );
} }
@RequestMapping(value = "returnQrcodeAndState",method = RequestMethod.GET) @RequestMapping(value = "returnQrcodeAndState",method = RequestMethod.GET)
@ApiOperation("重定向:返回微信Code与state") @ApiOperation("重定向:返回微信Code与state(微信网页应用)")
public String returnQrcodeAndState(@RequestParam(value = "code", required = true) String code, @RequestParam(value = "state", required = true) String state) { public String returnQrcodeAndState(@RequestParam(value = "code", required = true) String code, @RequestParam(value = "state", required = true) String state) {
return "redirect:https://www.atl-life.com/#/bindPage?code="+code+"&state="+state; return "redirect:https://www.atl-life.com/#/bindPage?code="+code+"&state="+state;
} }
@RequestMapping(value = "insertAtlUserByWxLogin",method = RequestMethod.POST) @RequestMapping(value = "insertAtlUserByWxLogin",method = RequestMethod.POST)
@ApiOperation("新用户微信扫码登录,绑定手机号密码") @ApiOperation("新用户微信扫码登录,绑定手机号密码(微信网页应用)")
@ResponseBody @ResponseBody
public JsonResult insertAtlUserByWxLogin(@ApiParam(value = "传入对象") @RequestBody WxInsertUserParam wxInsertUserParam) { public JsonResult insertAtlUserByWxLogin(@ApiParam(value = "传入对象") @RequestBody WxInsertUserParam wxInsertUserParam) {
//插入获取accessToken来源 1表示网页应用 2表示公众号
wxInsertUserParam.setType(1);
return this.atlWxService.insertAtlUserByWxLogin(wxInsertUserParam);
}
@RequestMapping(value = "getOfficeAccessToken",method = RequestMethod.GET)
@ApiOperation("获取公众号accessToken,通过微信code换取openId等信息(公众号应用)")
@ResponseBody
public JsonResult getOfficeAccessToken(@RequestParam(value = "code", required = true) String code, @RequestParam(value = "state", required = false) String state) {
return this.atlWxService.getAccessToken(code,state,2 );
}
@RequestMapping(value = "insertAtlUserByOfficeWxLogin",method = RequestMethod.POST)
@ApiOperation("绑定手机号密码(公众号应用)")
@ResponseBody
public JsonResult insertAtlUserByOfficeWxLogin(@ApiParam(value = "传入对象") @RequestBody WxInsertUserParam wxInsertUserParam) {
//插入获取accessToken来源 1表示网页应用 2表示公众号
wxInsertUserParam.setType(2);
return this.atlWxService.insertAtlUserByWxLogin(wxInsertUserParam); return this.atlWxService.insertAtlUserByWxLogin(wxInsertUserParam);
} }
@ApiOperation("微信支付统一下单(公众号jsapi支付)")
@PostMapping(value = "/wxPayCreateOrder")
public JsonResult wxPayCreateOrder(HttpServletRequest request, @ApiParam(value = "传入对象") @RequestBody WxPayCreateOrderQureyParam wxPayCreateOrderQureyParam) {
wxPayCreateOrderQureyParam.setRemoteAdd(request.getRemoteAddr());
return this.atlWxService.officeWxPayByJsapi(wxPayCreateOrderQureyParam);
}
} }
package com.hwstudio.antaile.controller;
import com.hwstudio.antaile.dto.WxInsertUserParam;
import com.hwstudio.antaile.dto.WxPayCreateOrderQureyParam;
import com.hwstudio.antaile.mbg.po.SysMsgMain;
import com.hwstudio.antaile.queryparam.QueryAtlTimeMessageParam;
import com.hwstudio.antaile.queryparam.QueryMsgMainParam;
import com.hwstudio.antaile.service.AtlWxService;
import com.hwstudio.antaile.service.MsgMainService;
import com.hwstudio.antaile.utils.CommonPage;
import com.hwstudio.antaile.utils.JsonResult;
import com.hwstudio.antaile.utils.Page;
import com.hwstudio.antaile.vo.AtlTimeMessageVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @Author xh
* @Date 2021/5/17
* description:
*/
@RestController
@RequestMapping(value = "/msgMain")
@Api(tags = "系统消息相关接口")
@CrossOrigin(origins = "*",maxAge = 3600)
public class MsgMainController extends BaseController{
@Autowired
private MsgMainService msgMainService;
@RequestMapping(value = "/queryMsgMainListByPage",method = RequestMethod.GET)
@ApiOperation("分页查询系统消息List 不分页不传递分页参数")
public JsonResult<List<SysMsgMain>> queryMsgMainListByPage(@ModelAttribute QueryMsgMainParam queryMsgMainParam, @ModelAttribute Page page) {
return JsonResult.success("查询成功",this.msgMainService.queryMsgMainListByPage(queryMsgMainParam, page));
}
}
...@@ -42,10 +42,12 @@ public class RegisterController { ...@@ -42,10 +42,12 @@ public class RegisterController {
@ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "pwd", value = "密码", required = true, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "pwd", value = "密码", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "verifyCode", value = "验证码", required = true, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "verifyCode", value = "验证码", required = true, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "nickName", value = "昵称", required = false, dataType = "string", paramType = "query") @ApiImplicitParam(name = "nickName", value = "昵称", required = false, dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "fromTimeid", value = "时光纪id", required = false, dataType = "Long", paramType = "query"),
@ApiImplicitParam(name = "fromUserid", value = "推荐人id", required = false, dataType = "Long", paramType = "query")
}) })
public JsonResult registerMobile(String mobile, String pwd, String verifyCode, String nickName) { public JsonResult registerMobile(String mobile, String pwd, String verifyCode, String nickName,Long fromTimeid,Long fromUserid) {
registerService.registerMobile(mobile, pwd, verifyCode, nickName); registerService.registerMobile(mobile, pwd, verifyCode, nickName,fromTimeid,fromUserid);
return JsonResult.success("注册成功"); return JsonResult.success("注册成功");
} }
......
...@@ -23,4 +23,6 @@ public class WxInsertUserParam implements Serializable { ...@@ -23,4 +23,6 @@ public class WxInsertUserParam implements Serializable {
private String loginPassword; private String loginPassword;
@ApiModelProperty(value = "验证码") @ApiModelProperty(value = "验证码")
private String verifyCode; private String verifyCode;
@ApiModelProperty(value = "获取accessToken 来源 1表示网页应用 2表示公众号")
private Integer type;
} }
package com.hwstudio.antaile.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Author xh
* @Date 2020/9/24
* description:
*/
@Data
public class WxPayCreateOrderQureyParam implements Serializable {
@ApiModelProperty(value = "用户id")
private Long userId;
@ApiModelProperty(value = "支付描述",hidden = true)
private String body;
@ApiModelProperty(value = "订单号",required = true)
private String outTradeNo;
@ApiModelProperty(value = "支付金额 单位:分",required = true)
private BigDecimal totalFee;
@ApiModelProperty(value = "微信用户openId", hidden = true)
private String openId;
@ApiModelProperty(value = "ip地址", hidden = true)
private String remoteAdd;
}
...@@ -66,4 +66,8 @@ public class AtlUser implements Serializable{ ...@@ -66,4 +66,8 @@ public class AtlUser implements Serializable{
private String webappOpenId; private String webappOpenId;
@ApiModelProperty(value = "微信unionid") @ApiModelProperty(value = "微信unionid")
private String unionid; private String unionid;
@ApiModelProperty(value = "注册来源于时光纪ID, 0为其它 ,非0对应时光纪id")
private Long fromTimeid;
@ApiModelProperty(value = "推荐人ID(用于用户邀请注册使用)")
private Long fromUserid;
} }
\ No newline at end of file
...@@ -8,11 +8,19 @@ import java.util.List; ...@@ -8,11 +8,19 @@ import java.util.List;
public interface AtlTimeLikeMapper { public interface AtlTimeLikeMapper {
List<AtlTimeListDto> getMyLikeTimeList(@Param("userId")Long userId); List<AtlTimeListDto> getMyLikeTimeList(@Param("userId") Long userId);
AtlTimeLike getTimeLike(@Param("timeId")Long timeId, @Param("userId")Long userId); AtlTimeLike getTimeLike(@Param("timeId") Long timeId, @Param("userId") Long userId);
void updateUnsubscribe(@Param("id")Long id); void updateUnsubscribe(@Param("id") Long id);
void insert(AtlTimeLike atlTimeLike); void insert(AtlTimeLike atlTimeLike);
/**
* 查看用户喜欢的时光纪数量
*
* @param userId
* @return
*/
Long selectAtlTimeLikeCount(Long userId);
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.hwstudio.antaile.mapper; ...@@ -2,6 +2,7 @@ package com.hwstudio.antaile.mapper;
import com.hwstudio.antaile.dto.*; import com.hwstudio.antaile.dto.*;
import com.hwstudio.antaile.entity.AtlTime; import com.hwstudio.antaile.entity.AtlTime;
import com.hwstudio.antaile.queryparam.QueryAtlTimeCountParam;
import com.hwstudio.antaile.vo.AtlFineVo; import com.hwstudio.antaile.vo.AtlFineVo;
import com.hwstudio.antaile.vo.AtlTimeVo; import com.hwstudio.antaile.vo.AtlTimeVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -99,4 +100,19 @@ public interface AtlTimeMapper { ...@@ -99,4 +100,19 @@ public interface AtlTimeMapper {
* @return * @return
*/ */
List<OfficialWebsiteAtlTimeVO> selectRandomAtlTime(); List<OfficialWebsiteAtlTimeVO> selectRandomAtlTime();
/**
* 查询时光纪数量
*
* @param queryAtlTimeCountParam
* @return
*/
Long selectCountAtlTime(QueryAtlTimeCountParam queryAtlTimeCountParam);
/**
* 统计用户下时光纪所有的阅读量
* @param userId
* @return
*/
Long selectAtlTimeReadCountByUserId(Long userId);
} }
\ No newline at end of file
package com.hwstudio.antaile.mapper; package com.hwstudio.antaile.mapper;
import com.hwstudio.antaile.dto.AtlSearchDto;
import com.hwstudio.antaile.dto.AtlTimeMessageListDto; import com.hwstudio.antaile.dto.AtlTimeMessageListDto;
import com.hwstudio.antaile.entity.AtlTimeMessage; import com.hwstudio.antaile.entity.AtlTimeMessage;
import com.hwstudio.antaile.queryparam.QueryAtlTimeMessageParam;
import com.hwstudio.antaile.vo.AtlTimeMessageVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
public interface AtlTimeMessageMapper { public interface AtlTimeMessageMapper {
List<AtlTimeMessageListDto> getList(@Param("objId")Long objId, @Param("objType")int objType); List<AtlTimeMessageListDto> getList(@Param("objId") Long objId, @Param("objType") int objType);
void addMessage(AtlTimeMessage atlTimeMessage); void addMessage(AtlTimeMessage atlTimeMessage);
...@@ -17,7 +18,7 @@ public interface AtlTimeMessageMapper { ...@@ -17,7 +18,7 @@ public interface AtlTimeMessageMapper {
void delMessage(@Param("id") Long id); void delMessage(@Param("id") Long id);
List<AtlTimeMessageListDto> getUserMessageList(@Param("objId")Long objId, @Param("objType")int objType, @Param("toUserId") Long toUserId); List<AtlTimeMessageListDto> getUserMessageList(@Param("objId") Long objId, @Param("objType") int objType, @Param("toUserId") Long toUserId);
void reviewMessage(@Param("id") Long id, @Param("state") Integer state); void reviewMessage(@Param("id") Long id, @Param("state") Integer state);
...@@ -25,7 +26,15 @@ public interface AtlTimeMessageMapper { ...@@ -25,7 +26,15 @@ public interface AtlTimeMessageMapper {
Long getCountUnRead(@Param("userId") Long userId); Long getCountUnRead(@Param("userId") Long userId);
Long getCountUnReadByTimeId(@Param("objId")Long objId, @Param("objType")int objType); Long getCountUnReadByTimeId(@Param("objId") Long objId, @Param("objType") int objType);
List<Map<String,Object>> search(@Param("content") String content, @Param("objId") Long objId, @Param("objType") Integer objType); List<Map<String, Object>> search(@Param("content") String content, @Param("objId") Long objId, @Param("objType") Integer objType);
/**
* 根据条件查询留言信息
*
* @param queryAtlTimeMessageParam
* @return
*/
List<AtlTimeMessageVO> queryAtlTimeMessageList(QueryAtlTimeMessageParam queryAtlTimeMessageParam);
} }
\ No newline at end of file
...@@ -32,6 +32,8 @@ public interface AtlUserMapper { ...@@ -32,6 +32,8 @@ public interface AtlUserMapper {
AtlUser getByWebappOpenId(String getByWebappOpenId); AtlUser getByWebappOpenId(String getByWebappOpenId);
AtlUser getByUnionid(String unionid);
void updatePwd(@Param("pwd") String pwd, @Param("userId") Long userId); void updatePwd(@Param("pwd") String pwd, @Param("userId") Long userId);
void insert(AtlUser atlUser); void insert(AtlUser atlUser);
......
package com.hwstudio.antaile.mbg.mapper;
import com.hwstudio.antaile.mbg.po.SysAtlTimeArticle;
import com.hwstudio.antaile.mbg.po.SysAtlTimeArticleExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysAtlTimeArticleMapper {
long countByExample(SysAtlTimeArticleExample example);
int deleteByExample(SysAtlTimeArticleExample example);
int deleteByPrimaryKey(Long id);
int insert(SysAtlTimeArticle record);
int insertSelective(SysAtlTimeArticle record);
List<SysAtlTimeArticle> selectByExampleWithBLOBs(SysAtlTimeArticleExample example);
List<SysAtlTimeArticle> selectByExample(SysAtlTimeArticleExample example);
SysAtlTimeArticle selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") SysAtlTimeArticle record, @Param("example") SysAtlTimeArticleExample example);
int updateByExampleWithBLOBs(@Param("record") SysAtlTimeArticle record, @Param("example") SysAtlTimeArticleExample example);
int updateByExample(@Param("record") SysAtlTimeArticle record, @Param("example") SysAtlTimeArticleExample example);
int updateByPrimaryKeySelective(SysAtlTimeArticle record);
int updateByPrimaryKeyWithBLOBs(SysAtlTimeArticle record);
int updateByPrimaryKey(SysAtlTimeArticle record);
}
\ No newline at end of file
package com.hwstudio.antaile.mbg.mapper;
import com.hwstudio.antaile.mbg.po.SysAtlTimeMessage;
import com.hwstudio.antaile.mbg.po.SysAtlTimeMessageExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysAtlTimeMessageMapper {
long countByExample(SysAtlTimeMessageExample example);
int deleteByExample(SysAtlTimeMessageExample example);
int deleteByPrimaryKey(Long id);
int insert(SysAtlTimeMessage record);
int insertSelective(SysAtlTimeMessage record);
List<SysAtlTimeMessage> selectByExampleWithBLOBs(SysAtlTimeMessageExample example);
List<SysAtlTimeMessage> selectByExample(SysAtlTimeMessageExample example);
SysAtlTimeMessage selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") SysAtlTimeMessage record, @Param("example") SysAtlTimeMessageExample example);
int updateByExampleWithBLOBs(@Param("record") SysAtlTimeMessage record, @Param("example") SysAtlTimeMessageExample example);
int updateByExample(@Param("record") SysAtlTimeMessage record, @Param("example") SysAtlTimeMessageExample example);
int updateByPrimaryKeySelective(SysAtlTimeMessage record);
int updateByPrimaryKeyWithBLOBs(SysAtlTimeMessage record);
int updateByPrimaryKey(SysAtlTimeMessage record);
}
\ No newline at end of file
package com.hwstudio.antaile.mbg.mapper;
import com.hwstudio.antaile.mbg.po.SysMsgMain;
import com.hwstudio.antaile.mbg.po.SysMsgMainExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysMsgMainMapper {
long countByExample(SysMsgMainExample example);
int deleteByExample(SysMsgMainExample example);
int deleteByPrimaryKey(Long id);
int insert(SysMsgMain record);
int insertSelective(SysMsgMain record);
List<SysMsgMain> selectByExampleWithBLOBs(SysMsgMainExample example);
List<SysMsgMain> selectByExample(SysMsgMainExample example);
SysMsgMain selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") SysMsgMain record, @Param("example") SysMsgMainExample example);
int updateByExampleWithBLOBs(@Param("record") SysMsgMain record, @Param("example") SysMsgMainExample example);
int updateByExample(@Param("record") SysMsgMain record, @Param("example") SysMsgMainExample example);
int updateByPrimaryKeySelective(SysMsgMain record);
int updateByPrimaryKeyWithBLOBs(SysMsgMain record);
int updateByPrimaryKey(SysMsgMain record);
}
\ No newline at end of file
package com.hwstudio.antaile.mbg.po;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
public class SysAtlTimeArticle implements Serializable {
@ApiModelProperty(value = "主键")
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@ApiModelProperty(value = "时光纪id")
private Long timeId;
@ApiModelProperty(value = "类型 1-文章 2-图片 3-视频 4-音频")
private Integer type;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "作者")
private String author;
@ApiModelProperty(value = "标签")
private String label;
@ApiModelProperty(value = "隐私设置")
private Integer privacySetting;
@ApiModelProperty(value = "发生时间")
private Date occurTime;
@ApiModelProperty(value = "是否删除 0-否1-是")
private Integer delFlag;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createDate;
@ApiModelProperty(value = "修改时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateDate;
@ApiModelProperty(value = "用户id")
private Long userId;
@ApiModelProperty(value = "收藏次数")
private Integer collection;
@ApiModelProperty(value = "内容")
private String content;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getTimeId() {
return timeId;
}
public void setTimeId(Long timeId) {
this.timeId = timeId;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public Integer getPrivacySetting() {
return privacySetting;
}
public void setPrivacySetting(Integer privacySetting) {
this.privacySetting = privacySetting;
}
public Date getOccurTime() {
return occurTime;
}
public void setOccurTime(Date occurTime) {
this.occurTime = occurTime;
}
public Integer getDelFlag() {
return delFlag;
}
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Integer getCollection() {
return collection;
}
public void setCollection(Integer collection) {
this.collection = collection;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", timeId=").append(timeId);
sb.append(", type=").append(type);
sb.append(", title=").append(title);
sb.append(", author=").append(author);
sb.append(", label=").append(label);
sb.append(", privacySetting=").append(privacySetting);
sb.append(", occurTime=").append(occurTime);
sb.append(", delFlag=").append(delFlag);
sb.append(", remark=").append(remark);
sb.append(", createDate=").append(createDate);
sb.append(", updateDate=").append(updateDate);
sb.append(", userId=").append(userId);
sb.append(", collection=").append(collection);
sb.append(", content=").append(content);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.hwstudio.antaile.mbg.po;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
public class SysAtlTimeMessage implements Serializable {
@ApiModelProperty(value = "主键")
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@ApiModelProperty(value = "用户id")
private Long userid;
@ApiModelProperty(value = "是否删除 0-否 1-是")
private Integer delFlag;
@ApiModelProperty(value = "类型 1-时光纪 2-文章")
private Integer objType;
@ApiModelProperty(value = "关联id")
private Long objId;
@ApiModelProperty(value = "创建时间")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
@ApiModelProperty(value = "状态 0-未审核 1-审核通过 2-审核不通过")
private Integer state;
@ApiModelProperty(value = "时光纪关联用户id")
private Long touserid;
@ApiModelProperty(value = "0:未读 1:已读")
private String readFlag;
@ApiModelProperty(value = "内容")
private String content;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserid() {
return userid;
}
public void setUserid(Long userid) {
this.userid = userid;
}
public Integer getDelFlag() {
return delFlag;
}
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
public Integer getObjType() {
return objType;
}
public void setObjType(Integer objType) {
this.objType = objType;
}
public Long getObjId() {
return objId;
}
public void setObjId(Long objId) {
this.objId = objId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
public Long getTouserid() {
return touserid;
}
public void setTouserid(Long touserid) {
this.touserid = touserid;
}
public String getReadFlag() {
return readFlag;
}
public void setReadFlag(String readFlag) {
this.readFlag = readFlag;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userid=").append(userid);
sb.append(", delFlag=").append(delFlag);
sb.append(", objType=").append(objType);
sb.append(", objId=").append(objId);
sb.append(", createTime=").append(createTime);
sb.append(", state=").append(state);
sb.append(", touserid=").append(touserid);
sb.append(", readFlag=").append(readFlag);
sb.append(", content=").append(content);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.hwstudio.antaile.mbg.po;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.*;
import org.springframework.format.annotation.DateTimeFormat;
@Entity
public class SysMsgMain implements Serializable {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Long id;
@ApiModelProperty(value = "标题")
private String title;
@ApiModelProperty(value = "连接地址")
private String linkUrl;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
private Long createUserId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private Long updateUserId;
@ApiModelProperty(value = "类型 1-系统消息 2-提醒消息 3-社交消息 4-用户中心系统消息")
private Integer type;
@ApiModelProperty(value = "是否删除 0-否 1-是")
private String delFlag;
@ApiModelProperty(value = "内容")
private String content;
private static final long serialVersionUID = 1L;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getLinkUrl() {
return linkUrl;
}
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getCreateUserId() {
return createUserId;
}
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", title=").append(title);
sb.append(", linkUrl=").append(linkUrl);
sb.append(", createTime=").append(createTime);
sb.append(", createUserId=").append(createUserId);
sb.append(", updateTime=").append(updateTime);
sb.append(", updateUserId=").append(updateUserId);
sb.append(", type=").append(type);
sb.append(", delFlag=").append(delFlag);
sb.append(", content=").append(content);
sb.append(", serialVersionUID=").append(serialVersionUID);
sb.append("]");
return sb.toString();
}
}
\ No newline at end of file
package com.hwstudio.antaile.queryparam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Author xh
* @Date 2021/6/24
* description:
*/
@Data
public class QueryAtlTimeCountParam implements Serializable {
@ApiModelProperty(value = "用户id")
private Long userId;
@ApiModelProperty(value = "状态 0-删除 1-正常")
private Integer status;
}
package com.hwstudio.antaile.queryparam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Author xh
* @Date 2021/6/24
* description:
*/
@Data
public class QueryAtlTimeMessageParam implements Serializable {
@ApiModelProperty(value = "类型 1-时光纪 2-文章")
private Integer objType;
@ApiModelProperty(value = "关联类型的相关id")
private Long objId;
@ApiModelProperty(value = "时光纪关联用户id")
private Long toUserId;
}
package com.hwstudio.antaile.queryparam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Author xh
* @Date 2021/6/24
* description:
*/
@Data
public class QueryMsgMainParam implements Serializable {
@ApiModelProperty(value = "类型 1-系统消息 2-提醒消息 3-社交消息 4-用户中心系统消息")
private Integer type;
}
package com.hwstudio.antaile.queryparam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Author xh
* @Date 2021/6/25
* description:
*/
@Data
public class QueryReleaseArticleParam implements Serializable {
@ApiModelProperty(value = "传入json数据")
private String json;
}
package com.hwstudio.antaile.service;
import com.alibaba.fastjson.JSON;
import com.hwstudio.antaile.utils.JsonResult;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.input.SAXBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.xml.sax.InputSource;
import java.io.StringReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Author xh
* @Date 2021/6/22
* description:
*/
@Service
public class AtlNotifyService {
private static Logger logger = LoggerFactory.getLogger(AtlNotifyService.class);
/**
* 处理微信回调结果
*
* @param notifyXml
* @return
*/
@Transactional(rollbackFor = Exception.class)
public JsonResult dealWxpayNotify(String notifyXml) {
if (notifyXml.isEmpty()) {
return JsonResult.failed("回调结果为空");
}
logger.info("微信支付回调");
logger.info("notifyXml:{}", notifyXml);
//回调产生的参数
Map<String, String> data = parseXmlToList2(notifyXml);
logger.info("拿到的map为", JSON.toJSONString(data));
//微信创建统一订单时候产生的参数
// Map<String, String> attach = this.jsonStringToMap(data.get("attach"));
//获得订单号
String outTradeNo = data.get("out_trade_no");
String thirdOrderNo = data.get("transaction_id");
return JsonResult.success("回调成功",data);
}
/**
* 将返回的Xml转成map
*
* @param xml
* @return
*/
private Map parseXmlToList2(String xml) {
Map retMap = new HashMap();
try {
StringReader read = new StringReader(xml);
// 创建新的输入源SAX 解析器将使用 InputSource 对象来确定如何读取 XML 输入
InputSource source = new InputSource(read);
// 创建一个新的SAXBuilder
SAXBuilder sb = new SAXBuilder();
// 通过输入源构造一个Document
Document doc = (Document) sb.build(source);
Element root = doc.getRootElement();// 指向根节点
List<Element> es = root.getChildren();
if (es != null && es.size() != 0) {
for (Element element : es) {
retMap.put(element.getName(), element.getValue());
}
}
} catch (Exception e) {
e.printStackTrace();
}
return retMap;
}
}
...@@ -3,6 +3,7 @@ package com.hwstudio.antaile.service; ...@@ -3,6 +3,7 @@ package com.hwstudio.antaile.service;
import com.github.binarywang.java.emoji.EmojiConverter; import com.github.binarywang.java.emoji.EmojiConverter;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.hwstudio.antaile.dto.AtlSearchDto; import com.hwstudio.antaile.dto.AtlSearchDto;
...@@ -13,7 +14,13 @@ import com.hwstudio.antaile.mapper.AtlTimeArticleMapper; ...@@ -13,7 +14,13 @@ import com.hwstudio.antaile.mapper.AtlTimeArticleMapper;
import com.hwstudio.antaile.mapper.AtlTimeMapper; import com.hwstudio.antaile.mapper.AtlTimeMapper;
import com.hwstudio.antaile.mapper.AtlTimeMessageMapper; import com.hwstudio.antaile.mapper.AtlTimeMessageMapper;
import com.hwstudio.antaile.mapper.DictMapper; import com.hwstudio.antaile.mapper.DictMapper;
import com.hwstudio.antaile.mbg.mapper.SysAtlTimeMessageMapper;
import com.hwstudio.antaile.mbg.po.SysAtlTimeMessage;
import com.hwstudio.antaile.queryparam.QueryAtlTimeMessageParam;
import com.hwstudio.antaile.utils.CommonPage;
import com.hwstudio.antaile.utils.JsonResult; import com.hwstudio.antaile.utils.JsonResult;
import com.hwstudio.antaile.utils.Page;
import com.hwstudio.antaile.vo.AtlTimeMessageVO;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -38,6 +45,8 @@ public class AtlTimeMessageService { ...@@ -38,6 +45,8 @@ public class AtlTimeMessageService {
private AtlTimeMapper atlTimeMapper; private AtlTimeMapper atlTimeMapper;
@Resource @Resource
private AtlTimeArticleMapper atlTimeArticleMapper; private AtlTimeArticleMapper atlTimeArticleMapper;
@Resource
private SysAtlTimeMessageMapper sysAtlTimeMessageMapper;
private EmojiConverter emojiConverter = EmojiConverter.getInstance(); private EmojiConverter emojiConverter = EmojiConverter.getInstance();
...@@ -158,4 +167,45 @@ public class AtlTimeMessageService { ...@@ -158,4 +167,45 @@ public class AtlTimeMessageService {
atlTimeMessageMapper.updateReadFlag(userId); atlTimeMessageMapper.updateReadFlag(userId);
return JsonResult.success("更新阅读状态成功"); return JsonResult.success("更新阅读状态成功");
} }
/**
* 分页查询留言List 不分页不传递分页参数
*
* @param queryAtlTimeMessageParam
* @param page
* @return
*/
public CommonPage<AtlTimeMessageVO> queryAtlTimeMessageListByPage(QueryAtlTimeMessageParam queryAtlTimeMessageParam, Page page) {
if (page != null && page.getPageNum() != null && page.getPageSize() != null) {
PageHelper.startPage(page.getPageNum(), page.getPageSize());
}
List<AtlTimeMessageVO> atlTimeMessageVOList = this.atlTimeMessageMapper.queryAtlTimeMessageList(queryAtlTimeMessageParam);
//记录下 pagehelper第一次分页查询的 返回得总条数 等信息
PageInfo<AtlTimeMessageVO> pageInfo = new PageInfo<>(atlTimeMessageVOList);
//因为进行了第二次查询 所以pageHelp得分页总数得到了变化 导致不准确 因此我们需要手动校准一下
CommonPage<AtlTimeMessageVO> result = new CommonPage<AtlTimeMessageVO>();
result.setTotalPage(pageInfo.getPages());
result.setPageNum(pageInfo.getPageNum());
result.setPageSize(pageInfo.getPageSize());
result.setTotal(pageInfo.getTotal());
result.setList(atlTimeMessageVOList);
return result;
}
/**
* 根据id 修改一条安泰乐的留言数据
*
* @param sysAtlTimeMessage
* @return
*/
public JsonResult updateAtlTimeMessageById(SysAtlTimeMessage sysAtlTimeMessage) {
if(sysAtlTimeMessage.getId() == null ){
return JsonResult.failed("传入id为空");
}
this.sysAtlTimeMessageMapper.updateByPrimaryKeySelective(sysAtlTimeMessage);
return JsonResult.success("操作成功" );
}
} }
...@@ -10,6 +10,7 @@ import com.hwstudio.antaile.dto.*; ...@@ -10,6 +10,7 @@ import com.hwstudio.antaile.dto.*;
import com.hwstudio.antaile.entity.*; import com.hwstudio.antaile.entity.*;
import com.hwstudio.antaile.exception.BusinessException; import com.hwstudio.antaile.exception.BusinessException;
import com.hwstudio.antaile.mapper.*; import com.hwstudio.antaile.mapper.*;
import com.hwstudio.antaile.queryparam.QueryAtlTimeCountParam;
import com.hwstudio.antaile.utils.CommonPage; import com.hwstudio.antaile.utils.CommonPage;
import com.hwstudio.antaile.utils.JsonResult; import com.hwstudio.antaile.utils.JsonResult;
import com.hwstudio.antaile.vo.AtlFineVo; import com.hwstudio.antaile.vo.AtlFineVo;
...@@ -25,7 +26,6 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -25,7 +26,6 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* Created by LENOVO on 2019/5/27. * Created by LENOVO on 2019/5/27.
...@@ -61,7 +61,7 @@ public class AtlTimeService { ...@@ -61,7 +61,7 @@ public class AtlTimeService {
* @param atlTimeVo * @param atlTimeVo
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void addTime(AtlTimeVo atlTimeVo, Long userId) { public AtlTime addTime(AtlTimeVo atlTimeVo, Long userId) {
//判空 //判空
Preconditions.checkState(StringUtil.isNotEmpty(atlTimeVo.getName()), "时光纪名称不能为空"); Preconditions.checkState(StringUtil.isNotEmpty(atlTimeVo.getName()), "时光纪名称不能为空");
...@@ -114,7 +114,7 @@ public class AtlTimeService { ...@@ -114,7 +114,7 @@ public class AtlTimeService {
atlPrivateMapper.insert(atlPrivate); atlPrivateMapper.insert(atlPrivate);
} }
return atlTime;
} }
/** /**
...@@ -823,5 +823,25 @@ public class AtlTimeService { ...@@ -823,5 +823,25 @@ public class AtlTimeService {
return this.atlTimeMapper.selectRandomAtlTime(); return this.atlTimeMapper.selectRandomAtlTime();
} }
/**
* 查询我的待办相关时光纪数据
*
* @return
*/
public JsonResult selectAtlTimeCountMap(Long userId) {
if(userId == null){
return JsonResult.failed("传入userId为空");
}
Map<String,Object> map = new HashMap<>();
QueryAtlTimeCountParam queryAtlTimeCountParam = new QueryAtlTimeCountParam();
queryAtlTimeCountParam.setUserId(userId);
map.put("创建的纪念馆",this.atlTimeMapper.selectCountAtlTime(queryAtlTimeCountParam));
queryAtlTimeCountParam.setStatus(1);
map.put("管理的纪念馆",this.atlTimeMapper.selectCountAtlTime(queryAtlTimeCountParam) );
map.put("关注的纪念馆",this.atlTimeLikeMapper.selectAtlTimeLikeCount(userId) );
map.put("纪念馆访问人数",this.atlTimeMapper.selectAtlTimeReadCountByUserId(userId) );
return JsonResult.success("查询成功",map);
}
} }
package com.hwstudio.antaile.service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hwstudio.antaile.entity.MsgMain;
import com.hwstudio.antaile.mbg.mapper.SysMsgMainMapper;
import com.hwstudio.antaile.mbg.po.SysMsgMain;
import com.hwstudio.antaile.mbg.po.SysMsgMainExample;
import com.hwstudio.antaile.queryparam.QueryAtlTimeMessageParam;
import com.hwstudio.antaile.queryparam.QueryMsgMainParam;
import com.hwstudio.antaile.utils.CommonPage;
import com.hwstudio.antaile.utils.Page;
import com.hwstudio.antaile.vo.AtlTimeMessageVO;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author xh
* @Date 2021/6/24
* description:
*/
@Service
public class MsgMainService {
@Resource
private SysMsgMainMapper sysMsgMainMapper;
/**
* 分页查询系统消息List 不分页不传递分页参数
*
* @param queryMsgMainParam
* @param page
* @return
*/
public CommonPage<SysMsgMain> queryMsgMainListByPage(QueryMsgMainParam queryMsgMainParam, Page page) {
if (page != null && page.getPageNum() != null && page.getPageSize() != null) {
PageHelper.startPage(page.getPageNum(), page.getPageSize());
}
SysMsgMainExample example = new SysMsgMainExample();
SysMsgMainExample.Criteria criteria = example.createCriteria();
criteria.andDelFlagEqualTo("0");
if(queryMsgMainParam.getType() != null){
criteria.andTypeEqualTo(queryMsgMainParam.getType());
}
List<SysMsgMain> sysMsgMainList = this.sysMsgMainMapper.selectByExample(example);
//记录下 pagehelper第一次分页查询的 返回得总条数 等信息
PageInfo<SysMsgMain> pageInfo = new PageInfo<>(sysMsgMainList);
//因为进行了第二次查询 所以pageHelp得分页总数得到了变化 导致不准确 因此我们需要手动校准一下
CommonPage<SysMsgMain> result = new CommonPage<SysMsgMain>();
result.setTotalPage(pageInfo.getPages());
result.setPageNum(pageInfo.getPageNum());
result.setPageSize(pageInfo.getPageSize());
result.setTotal(pageInfo.getTotal());
result.setList(sysMsgMainList);
return result;
}
}
...@@ -25,7 +25,7 @@ public class RegisterService { ...@@ -25,7 +25,7 @@ public class RegisterService {
@Autowired @Autowired
private SmsMapper smsMapper; private SmsMapper smsMapper;
public void registerMobile(String mobile, String pwd, String verifyCode, String nickName) { public void registerMobile(String mobile, String pwd, String verifyCode, String nickName,Long fromTimeid,Long fromUserid) {
// if (!VerificationUtil.isMobile(mobile)) { // if (!VerificationUtil.isMobile(mobile)) {
// throw new BusinessException("手机号无效"); // throw new BusinessException("手机号无效");
// } // }
......
package com.hwstudio.antaile.utils;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 公共工具类
*
* @Author xh
* @Date 2021/6/22
* description:
*/
public class CommonUtils {
/**
* 生成订单号
*
* @return
*/
public static String generateOrderNo() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String date = sdf.format(new Date());
String timeStamp = System.currentTimeMillis() + "";
String random = Math.round((Math.random() + 1) * 1000) + "";
return date + timeStamp.substring(timeStamp.length() - 4) + random;
}
}
...@@ -12,7 +12,7 @@ import lombok.Data; ...@@ -12,7 +12,7 @@ import lombok.Data;
*/ */
@Data @Data
@ApiModel @ApiModel
public class JsonResult { public class JsonResult<T> {
@ApiModelProperty(name = "success", value = "是否正常通讯") @ApiModelProperty(name = "success", value = "是否正常通讯")
private Boolean success = Boolean.TRUE; private Boolean success = Boolean.TRUE;
@ApiModelProperty(name = "status", value = "状态码,200:OK,401:未登录,500:错误") @ApiModelProperty(name = "status", value = "状态码,200:OK,401:未登录,500:错误")
......
package com.hwstudio.antaile.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author xh
* @Date 2021/6/24
* description:
*/
@Data
public class AtlTimeMessageVO implements Serializable {
@ApiModelProperty(value = "留言id")
private Long id;
@ApiModelProperty(value = "留言内容")
private String content;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "类型 1-时光纪 2-文章")
private Integer objType;
@ApiModelProperty(value = "关联类型的相关id")
private Long objId;
@ApiModelProperty(value = "时光纪关联用户id")
private Long toUserId;
@ApiModelProperty(value = "状态 0-未审核 1-审核通过 2-审核不通过")
private Integer state;
@ApiModelProperty(value = "0:未读 1:已读")
private String readFlag;
@ApiModelProperty(value = "时光纪名称")
private String atlTimeName;
@ApiModelProperty(value = "评论用户头像")
private String avaterImageUrl;
@ApiModelProperty(value = "评论用户昵称")
private String nickName;
}
...@@ -70,11 +70,18 @@ spring: ...@@ -70,11 +70,18 @@ spring:
# 连接超时时间(毫秒) # 连接超时时间(毫秒)
timeout: 5000 timeout: 5000
wx: wx:
#此处为微信开放平台相关参数 #此处为微信开放平台----网页应用的配置相关参数
appid: wx27928349186b6267 appid: wx27928349186b6267
appSecret: dee9b11ee545bff614abc91ebb042127 appSecret: dee9b11ee545bff614abc91ebb042127
redirectUri: https://appapi.antaile.net/wx/returnQrcodeAndState redirectUri: https://appapi.antaile.net/wx/returnQrcodeAndState
#此处为微信公众号相关参数
officeAppid: wxbd6cf7b619de70d9
officeAppSecert: 79a5044ac7856522eacc9f824013febb
#微信支付回调地址
notifyUrl: http://appapi.antaile.net/wx/notify
#商户信息
mchId: 1312767401
mchKey: 1234567890ABCDEFGHIJabcdefghijkl
server: server:
port: 8088 port: 8088
......
...@@ -25,4 +25,11 @@ ...@@ -25,4 +25,11 @@
VALUES(#{timeId}, #{userId}, NOW()) VALUES(#{timeId}, #{userId}, NOW())
</insert> </insert>
<select id="selectAtlTimeLikeCount" parameterType="java.lang.Long" resultType="java.lang.Long">
select
count(*)
from atl_time_like
where user_id = #{userId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -286,5 +286,22 @@ ...@@ -286,5 +286,22 @@
LIMIT 3 LIMIT 3
</select> </select>
<select id="selectCountAtlTime" resultType="java.lang.Long" parameterType="com.hwstudio.antaile.queryparam.QueryAtlTimeCountParam" >
select
count(*)
from atl_time
where 1 = 1
<if test="userId != null">
and user_id = #{userId}
</if>
<if test=" status != null">
and status =#{status}
</if>
</select>
<select id="selectAtlTimeReadCountByUserId" parameterType="java.lang.Long" resultType="java.lang.Long" >
select IFNULL(sum(read_count),0) from atl_time
where user_id =#{userId}
and status = 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -109,4 +109,25 @@ ...@@ -109,4 +109,25 @@
</where> </where>
ORDER BY m.create_time DESC ORDER BY m.create_time DESC
</select> </select>
<select id="queryAtlTimeMessageList" parameterType="com.hwstudio.antaile.queryparam.QueryAtlTimeMessageParam" resultType="com.hwstudio.antaile.vo.AtlTimeMessageVO">
select
a.id,a.content,a.obj_type objType,a.obj_id objId,a.create_time createTime,a.state,a.toUserId,a.read_flag readFlag,
b.name atlTimeName,
c.avater_image_url avaterImageUrl,c.nick_name nickName
from atl_time_message a
left join atl_time b ON a.obj_id = b.id
left join atl_user c ON a.userId = c.id
where 1 = 1
<if test="objType != null">
and a.obj_type =#{objType}
</if>
<if test="objId != null">
and a.obj_id =#{objId}
</if>
<if test="toUserId != null">
and a.toUserId=#{toUserId}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -10,8 +10,22 @@ ...@@ -10,8 +10,22 @@
</select> </select>
<insert id="registerMobile" keyProperty="id" keyColumn="id" useGeneratedKeys="true"> <insert id="registerMobile" keyProperty="id" keyColumn="id" useGeneratedKeys="true">
INSERT INTO atl_user(mobile_phone, login_password , create_time, nick_name, clientId, is_sys_push, is_sc_push, is_rem_push) INSERT INTO atl_user(mobile_phone, login_password , create_time, nick_name, clientId, is_sys_push, is_sc_push, is_rem_push
VALUES(#{mobilePhone}, #{loginPassword}, NOW(), #{nickName}, #{clientId}, '0', '0', '0') <if test="fromTimeid != null">
,from_timeid
</if>
<if test="fromUserid != null">
,from_userid
</if>
)
VALUES(#{mobilePhone}, #{loginPassword}, NOW(), #{nickName}, #{clientId}, '0', '0', '0'
<if test="fromTimeid != null">
,#{fromTimeid}
</if>
<if test="fromUserid != null">
,#{fromUserid}
</if>
)
</insert> </insert>
<select id="getUserInfo" resultType="com.hwstudio.antaile.dto.AtlUserInfoDto"> <select id="getUserInfo" resultType="com.hwstudio.antaile.dto.AtlUserInfoDto">
...@@ -138,6 +152,10 @@ ...@@ -138,6 +152,10 @@
SELECT * FROM atl_user WHERE webapp_open_id = #{webappOpenId} SELECT * FROM atl_user WHERE webapp_open_id = #{webappOpenId}
</select> </select>
<select id="getByUnionid" resultType="com.hwstudio.antaile.entity.AtlUser" parameterType="java.lang.String">
SELECT * FROM atl_user WHERE unionid = #{unionid}
</select>
<update id="updatePwd"> <update id="updatePwd">
UPDATE atl_user SET UPDATE atl_user SET
login_password = #{pwd} login_password = #{pwd}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment