Commit 29da8e58 by XiaHou

云应用相关的业务代码

parent 7e87530e
...@@ -3,18 +3,15 @@ package com.hwstudio.antaile.controller; ...@@ -3,18 +3,15 @@ package com.hwstudio.antaile.controller;
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.entity.AtlUser; import com.hwstudio.antaile.entity.AtlUser;
import com.hwstudio.antaile.mbg.po.AtlTimeMenu;
import com.hwstudio.antaile.mbg.po.SysAtlTime; import com.hwstudio.antaile.mbg.po.SysAtlTime;
import com.hwstudio.antaile.queryparam.QueryAtlTimeByBlessIdAndIdxParam; import com.hwstudio.antaile.queryparam.QueryAtlTimeByBlessIdAndIdxParam;
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.RedisUtil;
import com.hwstudio.antaile.vo.*; import com.hwstudio.antaile.vo.*;
import io.swagger.annotations.*; import io.swagger.annotations.*;
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.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -607,4 +604,10 @@ public class AtlTimeController extends BaseController { ...@@ -607,4 +604,10 @@ public class AtlTimeController extends BaseController {
return this.atlTimeService.selectAtlTimeCreateDateById(timeId); return this.atlTimeService.selectAtlTimeCreateDateById(timeId);
} }
@ApiOperation("根据时光纪id 查询用户id")
@RequestMapping(value = "/selectTimeUserIdByTimeId", method = RequestMethod.GET)
public JsonResult selectTimeUserIdByTimeId(@ApiParam(value = "时光纪id", required = true) @RequestParam(value = "timeId", required = true) Long timeId) {
return JsonResult.success("操作成功", this.atlTimeService.selectTimeUserIdByTimeId(timeId));
}
} }
...@@ -3,6 +3,8 @@ package com.hwstudio.antaile.controller; ...@@ -3,6 +3,8 @@ package com.hwstudio.antaile.controller;
import com.hwstudio.antaile.dto.AtlUserInfoDto; import com.hwstudio.antaile.dto.AtlUserInfoDto;
import com.hwstudio.antaile.dto.BindingMobileDto; import com.hwstudio.antaile.dto.BindingMobileDto;
import com.hwstudio.antaile.dto.LoginUserDto; import com.hwstudio.antaile.dto.LoginUserDto;
import com.hwstudio.antaile.dto.RelationUserDTO;
import com.hwstudio.antaile.queryparam.QueryRelationUserParam;
import com.hwstudio.antaile.service.AtlUserService; import com.hwstudio.antaile.service.AtlUserService;
import com.hwstudio.antaile.utils.JsonResult; import com.hwstudio.antaile.utils.JsonResult;
import com.hwstudio.antaile.utils.RedisUtil; import com.hwstudio.antaile.utils.RedisUtil;
...@@ -15,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -15,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Objects; import java.util.Objects;
/** /**
...@@ -26,7 +29,7 @@ import java.util.Objects; ...@@ -26,7 +29,7 @@ import java.util.Objects;
@RestController @RestController
@RequestMapping(value = "/atlUser") @RequestMapping(value = "/atlUser")
@Api(tags = "用户相关接口") @Api(tags = "用户相关接口")
@CrossOrigin(origins = "*",maxAge = 3600) @CrossOrigin(origins = "*", maxAge = 3600)
public class AtlUserController extends BaseController { public class AtlUserController extends BaseController {
@Autowired @Autowired
...@@ -64,13 +67,13 @@ public class AtlUserController extends BaseController { ...@@ -64,13 +67,13 @@ public class AtlUserController extends BaseController {
@ApiOperation(value = "绑定手机", httpMethod = "POST", notes = "绑定手机") @ApiOperation(value = "绑定手机", httpMethod = "POST", notes = "绑定手机")
@ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = AtlUserInfoDto.class)) @ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = AtlUserInfoDto.class))
public JsonResult BindingMobile(BindingMobileDto bindingMobileDto, LoginUserVo loginUserVo) { public JsonResult BindingMobile(BindingMobileDto bindingMobileDto, LoginUserVo loginUserVo) {
return JsonResult.success("绑定手机号成功", atlUserService.bindingMobile(bindingMobileDto, loginUserVo)); return JsonResult.success("绑定手机号成功", atlUserService.bindingMobile(bindingMobileDto, loginUserVo));
} }
@RequestMapping(value = "BindingOffice") @RequestMapping(value = "BindingOffice")
@ApiOperation(value = "绑定公众号", httpMethod = "POST", notes = "绑定公众号") @ApiOperation(value = "绑定公众号", httpMethod = "POST", notes = "绑定公众号")
@ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = AtlUserInfoDto.class)) @ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = AtlUserInfoDto.class))
public JsonResult BindingOffice(LoginUserVo loginUserVo) throws Exception{ public JsonResult BindingOffice(LoginUserVo loginUserVo) throws Exception {
return atlUserService.bindingOffice(loginUserVo); return atlUserService.bindingOffice(loginUserVo);
} }
...@@ -80,14 +83,14 @@ public class AtlUserController extends BaseController { ...@@ -80,14 +83,14 @@ public class AtlUserController extends BaseController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "wxCode", value = "微信code", required = true, dataType = "string", paramType = "query"), @ApiImplicitParam(name = "wxCode", value = "微信code", required = true, dataType = "string", paramType = "query"),
}) })
public JsonResult bindingApplet(LoginUserVo loginUserVo) throws Exception{ public JsonResult bindingApplet(LoginUserVo loginUserVo) throws Exception {
return atlUserService.bindingApplet(loginUserVo); return atlUserService.bindingApplet(loginUserVo);
} }
@RequestMapping(value = "bindingAppletMobile") @RequestMapping(value = "bindingAppletMobile")
@ApiOperation(value = "小程序绑定手机", httpMethod = "POST", notes = "小程序绑定手机") @ApiOperation(value = "小程序绑定手机", httpMethod = "POST", notes = "小程序绑定手机")
@ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = AtlUserInfoDto.class)) @ApiResponses(@ApiResponse(code = 200, message = "请求成功", response = AtlUserInfoDto.class))
public JsonResult bindingAppletMobile(BindingMobileDto bindingMobileDto, LoginUserVo loginUserVo) throws Exception{ public JsonResult bindingAppletMobile(BindingMobileDto bindingMobileDto, LoginUserVo loginUserVo) throws Exception {
return atlUserService.bindingAppletMobile(bindingMobileDto, loginUserVo); return atlUserService.bindingAppletMobile(bindingMobileDto, loginUserVo);
} }
...@@ -163,7 +166,7 @@ public class AtlUserController extends BaseController { ...@@ -163,7 +166,7 @@ public class AtlUserController extends BaseController {
return JsonResult.notLogin(); return JsonResult.notLogin();
} }
LoginUserDto loginUserDto = atlUserService.bindWX(userId, loginUserVo); LoginUserDto loginUserDto = atlUserService.bindWX(userId, loginUserVo);
return JsonResult.success("绑定微信成功",loginUserDto); return JsonResult.success("绑定微信成功", loginUserDto);
} }
@RequestMapping(value = "isMyself") @RequestMapping(value = "isMyself")
...@@ -176,10 +179,10 @@ public class AtlUserController extends BaseController { ...@@ -176,10 +179,10 @@ public class AtlUserController extends BaseController {
}) })
public JsonResult isMyself(Long id, String type, Long userId) { public JsonResult isMyself(Long id, String type, Long userId) {
if(null == userId){ if (null == userId) {
userId = super.getUserId(); userId = super.getUserId();
if (Objects.isNull(userId)) { if (Objects.isNull(userId)) {
return JsonResult.success("请求成功",false); return JsonResult.success("请求成功", false);
} }
} }
return atlUserService.isMyself(type, id, userId); return atlUserService.isMyself(type, id, userId);
...@@ -251,5 +254,10 @@ public class AtlUserController extends BaseController { ...@@ -251,5 +254,10 @@ public class AtlUserController extends BaseController {
return atlUserService.deleteAddress(vo); return atlUserService.deleteAddress(vo);
} }
@ApiOperation("根据传入参数查询 用户List,不传分页参数不分页")
@RequestMapping(value = "/selectRelationUserListByOther", method = RequestMethod.GET)
public JsonResult<List<RelationUserDTO>> selectRelationUserListByOther(@ModelAttribute QueryRelationUserParam queryRelationUserParam) {
return JsonResult.success("查询成功", this.atlUserService.selectRelationUserListByOther(queryRelationUserParam));
}
} }
...@@ -63,7 +63,7 @@ public class AtlTimeOwnerDto { ...@@ -63,7 +63,7 @@ public class AtlTimeOwnerDto {
@ApiModelProperty(value="婚姻 1-未婚 2-已婚 3-离异") @ApiModelProperty(value="婚姻 1-未婚 2-已婚 3-离异")
private Integer emotionalState; private Integer emotionalState;
@ApiModelProperty(value="是否过世 0 过世 1 在世") @ApiModelProperty(value="是否过世 0 在世 1 过世")
private Integer livingState; private Integer livingState;
@ApiModelProperty(value="卒年开始") @ApiModelProperty(value="卒年开始")
......
...@@ -18,7 +18,7 @@ public class OfficialWebsiteAtlTimeParam implements Serializable { ...@@ -18,7 +18,7 @@ public class OfficialWebsiteAtlTimeParam implements Serializable {
private Integer isCommend; private Integer isCommend;
@ApiModelProperty(value = "是否发现页推荐 0-否 1-是") @ApiModelProperty(value = "是否发现页推荐 0-否 1-是")
private Integer isFindCommend; private Integer isFindCommend;
@ApiModelProperty(value = "是否过世 0 过世 1 在世") @ApiModelProperty(value = "是否过世 0 在世 1 过世")
private Integer livingState; private Integer livingState;
@ApiModelProperty(value = "分页对象,不传递不分页") @ApiModelProperty(value = "分页对象,不传递不分页")
private Page page; private Page page;
......
package com.hwstudio.antaile.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author xh
* @Date 2021/7/23
* description:
*/
@Data
public class RelationUserDTO implements Serializable {
@ApiModelProperty(value = "用户id")
private Long id;
@ApiModelProperty(value = "昵称")
private String nickName;
@ApiModelProperty(value = "头像")
private String avaterImageUrl;
@ApiModelProperty(value = "最后登录时间")
private Date loginDate;
@ApiModelProperty(value = "性别 1-男 2-女")
private Integer sex;
@ApiModelProperty(value = "关联时光纪id")
private Long fromTimeid;
@ApiModelProperty(value = "关联时光纪名称")
private String fromTimeName;
}
package com.hwstudio.antaile.mapper; package com.hwstudio.antaile.mapper;
import com.hwstudio.antaile.dto.AtlSearchDto; import com.hwstudio.antaile.dto.AtlSearchDto;
import com.hwstudio.antaile.dto.AtlTimeArticleDetailsDto;
import com.hwstudio.antaile.dto.AtlTimeArticleListDto; import com.hwstudio.antaile.dto.AtlTimeArticleListDto;
import com.hwstudio.antaile.entity.AtlTimeArticle; import com.hwstudio.antaile.entity.AtlTimeArticle;
import com.hwstudio.antaile.vo.AtlTimeArticleVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date; import java.util.Date;
...@@ -17,15 +15,15 @@ public interface AtlTimeArticleMapper { ...@@ -17,15 +15,15 @@ public interface AtlTimeArticleMapper {
void update(AtlTimeArticle atlTimeArticle); void update(AtlTimeArticle atlTimeArticle);
Integer getCount(@Param("id")Long id, @Param("type")int type); Integer getCount(@Param("id") Long id, @Param("type") int type);
List<Map<String, Object>> getArticelList(@Param("timeId")Long timeId, @Param("type")Integer type); List<Map<String, Object>> getArticelList(@Param("timeId") Long timeId, @Param("type") Integer type);
List<Map<String, Object>> getH5ArticelList(@Param("timeId")Long timeId, @Param("type")Integer type); List<Map<String, Object>> getH5ArticelList(@Param("timeId") Long timeId, @Param("type") Integer type);
Map<String, Object> getDetails(@Param("id")Long id); Map<String, Object> getDetails(@Param("id") Long id);
List<Map<String, Object>> getArticelTypeList(@Param("timeId")Long timeId, @Param("type")Integer type); List<Map<String, Object>> getArticelTypeList(@Param("timeId") Long timeId, @Param("type") Integer type);
void deleteArticle(@Param("id") Long id); void deleteArticle(@Param("id") Long id);
...@@ -33,26 +31,26 @@ public interface AtlTimeArticleMapper { ...@@ -33,26 +31,26 @@ public interface AtlTimeArticleMapper {
void deleteRealByTimeId(@Param("id") Long id); void deleteRealByTimeId(@Param("id") Long id);
AtlTimeArticle getById(@Param("id")Long id); AtlTimeArticle getById(@Param("id") Long id);
List<String> getMaterialByTimeId(@Param("id")Long id); List<String> getMaterialByTimeId(@Param("id") Long id);
List<String> getMaterialByUserId(@Param("userId")Long userId); List<String> getMaterialByUserId(@Param("userId") Long userId);
List<Map<String,Object>> search(AtlSearchDto atlSearchDto); List<Map<String, Object>> search(AtlSearchDto atlSearchDto);
Long getUserId(@Param("id") Long id); Long getUserId(@Param("id") Long id);
List<Map<String,Object>> findArticleLabelList(@Param("userId")Long userId); List<Map<String, Object>> findArticleLabelList(@Param("userId") Long userId);
void restoreArticle(@Param("id") Long id); void restoreArticle(@Param("id") Long id);
void restoreArticleByTimeId(@Param("id") Long id); void restoreArticleByTimeId(@Param("id") Long id);
List<Map<String,Object>> findArticlelListDel(@Param("userId")Long userId); List<Map<String, Object>> findArticlelListDel(@Param("userId") Long userId);
List<AtlTimeArticleListDto> findAllArticleListByDel(@Param("date")Date date); List<AtlTimeArticleListDto> findAllArticleListByDel(@Param("date") Date date);
void deleteRealBatch(@Param("list")List list); void deleteRealBatch(@Param("list") List list);
} }
\ No newline at end of file
...@@ -125,4 +125,12 @@ public interface AtlTimeMapper { ...@@ -125,4 +125,12 @@ public interface AtlTimeMapper {
* @return * @return
*/ */
AtlTimeDTO selectAtlTimeInfoByBlessIdAndIdx(@Param("blessId") Long blessId, @Param("blessIdx") Integer blessIdx); AtlTimeDTO selectAtlTimeInfoByBlessIdAndIdx(@Param("blessId") Long blessId, @Param("blessIdx") Integer blessIdx);
/**
* 根据时光纪id 查询用户id
*
* @param timeId
* @return
*/
Long selectTimeUserIdByTimeId(Long timeId);
} }
\ No newline at end of file
...@@ -2,8 +2,10 @@ package com.hwstudio.antaile.mapper; ...@@ -2,8 +2,10 @@ package com.hwstudio.antaile.mapper;
import com.hwstudio.antaile.dto.AtlUserInfoDto; import com.hwstudio.antaile.dto.AtlUserInfoDto;
import com.hwstudio.antaile.dto.AtlUserPhoneTypeDto; import com.hwstudio.antaile.dto.AtlUserPhoneTypeDto;
import com.hwstudio.antaile.dto.RelationUserDTO;
import com.hwstudio.antaile.entity.AtlUser; import com.hwstudio.antaile.entity.AtlUser;
import com.hwstudio.antaile.entity.AtlUserPhoneType; import com.hwstudio.antaile.entity.AtlUserPhoneType;
import com.hwstudio.antaile.queryparam.QueryRelationUserParam;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -67,4 +69,12 @@ public interface AtlUserMapper { ...@@ -67,4 +69,12 @@ public interface AtlUserMapper {
* @return * @return
*/ */
AtlUser selectOneUserByMobilePhone(String mobilePhone); AtlUser selectOneUserByMobilePhone(String mobilePhone);
/**
* 查询时光纪关联用户list
*
* @param queryRelationUserParam
* @return
*/
List<RelationUserDTO> selectRelationUserListByOther(QueryRelationUserParam queryRelationUserParam);
} }
\ No newline at end of file
package com.hwstudio.antaile.mbg.mapper;
import com.hwstudio.antaile.mbg.po.SysAtlTimeOwner;
import com.hwstudio.antaile.mbg.po.SysAtlTimeOwnerExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SysAtlTimeOwnerMapper {
long countByExample(SysAtlTimeOwnerExample example);
int deleteByExample(SysAtlTimeOwnerExample example);
int deleteByPrimaryKey(Long id);
int insert(SysAtlTimeOwner record);
int insertSelective(SysAtlTimeOwner record);
List<SysAtlTimeOwner> selectByExampleWithBLOBs(SysAtlTimeOwnerExample example);
List<SysAtlTimeOwner> selectByExample(SysAtlTimeOwnerExample example);
SysAtlTimeOwner selectByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") SysAtlTimeOwner record, @Param("example") SysAtlTimeOwnerExample example);
int updateByExampleWithBLOBs(@Param("record") SysAtlTimeOwner record, @Param("example") SysAtlTimeOwnerExample example);
int updateByExample(@Param("record") SysAtlTimeOwner record, @Param("example") SysAtlTimeOwnerExample example);
int updateByPrimaryKeySelective(SysAtlTimeOwner record);
int updateByPrimaryKeyWithBLOBs(SysAtlTimeOwner record);
int updateByPrimaryKey(SysAtlTimeOwner record);
}
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
package com.hwstudio.antaile.queryparam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @Author xh
* @Date 2021/7/23
* description:
*/
@Data
public class QueryRelationUserParam implements Serializable {
@ApiModelProperty(value = "注册来源于时光纪ID, 0为其它 ,非0对应时光纪id")
private Long fromTimeid;
@ApiModelProperty(value = "推荐人ID(用于用户邀请注册使用)")
private Long fromUserid;
}
...@@ -5,7 +5,10 @@ import com.github.binarywang.java.emoji.EmojiConverter; ...@@ -5,7 +5,10 @@ import com.github.binarywang.java.emoji.EmojiConverter;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.hwstudio.antaile.dto.*; import com.hwstudio.antaile.dto.*;
import com.hwstudio.antaile.entity.*; import com.hwstudio.antaile.entity.AtlPrivate;
import com.hwstudio.antaile.entity.AtlTimeArticle;
import com.hwstudio.antaile.entity.AtlTimeArticleFile;
import com.hwstudio.antaile.entity.AtlTimeArticleImage;
import com.hwstudio.antaile.mapper.*; import com.hwstudio.antaile.mapper.*;
import com.hwstudio.antaile.vo.AtlTimeArticleFileVo; import com.hwstudio.antaile.vo.AtlTimeArticleFileVo;
import com.vdurmont.emoji.EmojiParser; import com.vdurmont.emoji.EmojiParser;
...@@ -18,7 +21,10 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -18,7 +21,10 @@ 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.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @Name: * @Name:
...@@ -380,7 +386,7 @@ public class AtlTimeArticleServie { ...@@ -380,7 +386,7 @@ public class AtlTimeArticleServie {
} }
public Integer getArticleCountByTimeId(Long timeId) { public Integer getArticleCountByTimeId(Long timeId) {
List list = atlTimeArticleMapper.getArticelList(timeId,1); List list = atlTimeArticleMapper.getArticelList(timeId, 1);
return list.size(); return list.size();
} }
...@@ -405,8 +411,8 @@ public class AtlTimeArticleServie { ...@@ -405,8 +411,8 @@ public class AtlTimeArticleServie {
atlTimeArticleDetailsDto.setPrivacySetting(Integer.parseInt(map.get("privacySetting").toString())); atlTimeArticleDetailsDto.setPrivacySetting(Integer.parseInt(map.get("privacySetting").toString()));
atlTimeArticleDetailsDto.setType(Integer.parseInt(map.get("type").toString())); atlTimeArticleDetailsDto.setType(Integer.parseInt(map.get("type").toString()));
atlTimeArticleDetailsDto.setCreateDate(map.get("createDate").toString()); atlTimeArticleDetailsDto.setCreateDate(map.get("createDate").toString());
atlTimeArticleDetailsDto.setTimeName(map.get("timeName")+""); atlTimeArticleDetailsDto.setTimeName(map.get("timeName") + "");
atlTimeArticleDetailsDto.setTimeName(map.get("authorName")+""); atlTimeArticleDetailsDto.setTimeName(map.get("authorName") + "");
if (atlTimeArticleDetailsDto.getType() == 1) { if (atlTimeArticleDetailsDto.getType() == 1) {
atlTimeArticleDetailsDto.setAuthor(map.get("author").toString()); atlTimeArticleDetailsDto.setAuthor(map.get("author").toString());
atlTimeArticleDetailsDto.setOccurTime(map.get("occurTime").toString()); atlTimeArticleDetailsDto.setOccurTime(map.get("occurTime").toString());
...@@ -689,4 +695,5 @@ public class AtlTimeArticleServie { ...@@ -689,4 +695,5 @@ public class AtlTimeArticleServie {
} }
return list; return list;
} }
} }
...@@ -93,7 +93,10 @@ public class AtlTimeOwnerService { ...@@ -93,7 +93,10 @@ public class AtlTimeOwnerService {
} else { } else {
map.put("identity", "隐私"); map.put("identity", "隐私");
} }
boolean birthDate = (boolean) jsonObject.get("birthDate"); boolean birthDate = false;
if(jsonObject.get("birthDate") != null){
birthDate = (boolean)jsonObject.get("birthDate") ;
}
if (birthDate) { if (birthDate) {
map.put("birthDate", atlTimeOwnerDto.getBirthdate()); map.put("birthDate", atlTimeOwnerDto.getBirthdate());
} else { } else {
......
...@@ -11,6 +11,7 @@ import com.hwstudio.antaile.entity.*; ...@@ -11,6 +11,7 @@ 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.mbg.mapper.SysAtlTimeMapper; import com.hwstudio.antaile.mbg.mapper.SysAtlTimeMapper;
import com.hwstudio.antaile.mbg.mapper.SysAtlTimeOwnerMapper;
import com.hwstudio.antaile.mbg.po.SysAtlTime; import com.hwstudio.antaile.mbg.po.SysAtlTime;
import com.hwstudio.antaile.queryparam.QueryAtlTimeByBlessIdAndIdxParam; import com.hwstudio.antaile.queryparam.QueryAtlTimeByBlessIdAndIdxParam;
import com.hwstudio.antaile.queryparam.QueryAtlTimeCountParam; import com.hwstudio.antaile.queryparam.QueryAtlTimeCountParam;
...@@ -60,6 +61,8 @@ public class AtlTimeService { ...@@ -60,6 +61,8 @@ public class AtlTimeService {
private AtlTimeMessageMapper atlTimeMessageMapper; private AtlTimeMessageMapper atlTimeMessageMapper;
@Resource @Resource
private SysAtlTimeMapper sysAtlTimeMapper; private SysAtlTimeMapper sysAtlTimeMapper;
@Resource
private SysAtlTimeOwnerMapper sysAtlTimeOwnerMapper;
/** /**
* 新增时光纪 * 新增时光纪
...@@ -99,12 +102,18 @@ public class AtlTimeService { ...@@ -99,12 +102,18 @@ public class AtlTimeService {
} }
atlTimeMapper.insert(atlTime); atlTimeMapper.insert(atlTime);
//新增关于谁数据 //如果对象不为空普通插入 新增关于谁数据
AtlTimeOwner atlTimeOwner = new AtlTimeOwner(); if(atlTimeVo.getSysAtlTimeOwner() == null){
atlTimeOwner.setRealName(atlTime.getAboutName()); AtlTimeOwner atlTimeOwner = new AtlTimeOwner();
atlTimeOwner.setSourceFrom(0); atlTimeOwner.setRealName(atlTime.getAboutName());
atlTimeOwner.setTimeId(atlTime.getId()); atlTimeOwner.setSourceFrom(0);
atlTimeOwnerMapper.insert(atlTimeOwner); atlTimeOwner.setTimeId(atlTime.getId());
atlTimeOwnerMapper.insert(atlTimeOwner);
}else{
atlTimeVo.getSysAtlTimeOwner().setTimeId(atlTime.getId());
sysAtlTimeOwnerMapper.insertSelective(atlTimeVo.getSysAtlTimeOwner());
}
} }
//如果隐私设置为验证查看时 //如果隐私设置为验证查看时
...@@ -906,5 +915,16 @@ public class AtlTimeService { ...@@ -906,5 +915,16 @@ public class AtlTimeService {
return JsonResult.success("获取成功", dataMap); return JsonResult.success("获取成功", dataMap);
} }
/**
* 根据时光纪id 查询用户id
*
* @param timeId
* @return
*/
public Long selectTimeUserIdByTimeId(Long timeId) {
return this.atlTimeMapper.selectTimeUserIdByTimeId(timeId);
}
} }
...@@ -7,6 +7,7 @@ import com.hwstudio.antaile.dto.*; ...@@ -7,6 +7,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.QueryRelationUserParam;
import com.hwstudio.antaile.utils.JsonResult; import com.hwstudio.antaile.utils.JsonResult;
import com.hwstudio.antaile.utils.OpenIdUtil; import com.hwstudio.antaile.utils.OpenIdUtil;
import com.hwstudio.antaile.utils.RedisUtil; import com.hwstudio.antaile.utils.RedisUtil;
...@@ -208,7 +209,7 @@ public class AtlUserService { ...@@ -208,7 +209,7 @@ public class AtlUserService {
} }
//校验手机号是否已经存在过 //校验手机号是否已经存在过
AtlUser atlUser = this.atlUserMapper.selectOneUserByMobilePhone(verifyCodeLogin.getMobilePhone()); AtlUser atlUser = this.atlUserMapper.selectOneUserByMobilePhone(verifyCodeLogin.getMobilePhone());
if(atlUser == null){ if (atlUser == null) {
throw new BusinessException("不存在此手机号"); throw new BusinessException("不存在此手机号");
} }
//否则有查询到 就登录成功 //否则有查询到 就登录成功
...@@ -732,4 +733,14 @@ public class AtlUserService { ...@@ -732,4 +733,14 @@ public class AtlUserService {
return JsonResult.success(msg + "成功"); return JsonResult.success(msg + "成功");
} }
/**
* 查询时光纪关联用户list
*
* @param queryRelationUserParam
* @return
*/
public List<RelationUserDTO> selectRelationUserListByOther(QueryRelationUserParam queryRelationUserParam) {
return this.atlUserMapper.selectRelationUserListByOther(queryRelationUserParam);
}
} }
...@@ -51,6 +51,8 @@ public class RegisterService { ...@@ -51,6 +51,8 @@ public class RegisterService {
atlUser.setNickName(nickName); atlUser.setNickName(nickName);
atlUser.setMobilePhone(mobile); atlUser.setMobilePhone(mobile);
atlUser.setLoginPassword(pwd); atlUser.setLoginPassword(pwd);
atlUser.setFromTimeid(fromTimeid);
atlUser.setFromUserid(fromUserid);
atlUserMapper.registerMobile(atlUser); atlUserMapper.registerMobile(atlUser);
} }
} }
...@@ -11,10 +11,8 @@ import com.hwstudio.antaile.mapper.AtlUserMapper; ...@@ -11,10 +11,8 @@ import com.hwstudio.antaile.mapper.AtlUserMapper;
import com.hwstudio.antaile.mapper.SmsMapper; import com.hwstudio.antaile.mapper.SmsMapper;
import com.hwstudio.antaile.utils.AliCloudUtil; import com.hwstudio.antaile.utils.AliCloudUtil;
import com.hwstudio.antaile.utils.MomoUtils; import com.hwstudio.antaile.utils.MomoUtils;
import com.hwstudio.antaile.utils.VerificationUtil;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -39,6 +37,7 @@ public class SmsService { ...@@ -39,6 +37,7 @@ public class SmsService {
/** /**
* 功能描述: <br>短信发送 * 功能描述: <br>短信发送
* 〈〉 * 〈〉
*
* @since: 1.0.0 * @since: 1.0.0
* @Author:Momo * @Author:Momo
* @Date: 2019/5/26 12:41 * @Date: 2019/5/26 12:41
...@@ -62,27 +61,27 @@ public class SmsService { ...@@ -62,27 +61,27 @@ public class SmsService {
} }
String templateCode; String templateCode;
AtlUser atlUser = atlUserMapper.getByMobile(mobile); AtlUser atlUser = atlUserMapper.getByMobile(mobile);
Boolean isMatch = MomoUtils.phone(mobile); Boolean isMatch = MomoUtils.validTel(mobile);
switch (type){ switch (type) {
case Constants.SMS_TYPE_REGISTER: case Constants.SMS_TYPE_REGISTER:
if(atlUser != null){ if (atlUser != null) {
throw new BusinessException("该手机号已注册"); throw new BusinessException("该手机号已注册");
} }
if(isMatch){ if (isMatch) {
templateCode = Constants.SMS_TYPE_REGISTER_VALUE; templateCode = Constants.SMS_TYPE_REGISTER_VALUE;
}else{ } else {
templateCode = Constants.SMS_TYPE_REGISTER_VALUE_INTERNATIONAL; templateCode = Constants.SMS_TYPE_REGISTER_VALUE_INTERNATIONAL;
} }
break; break;
case Constants.SMS_TYPE_UPDATEPASSWORD: case Constants.SMS_TYPE_UPDATEPASSWORD:
if(atlUser == null){ if (atlUser == null) {
throw new BusinessException("该手机号未注册"); throw new BusinessException("该手机号未注册");
} }
if(isMatch){ if (isMatch) {
templateCode = Constants.SMS_TYPE_UPDATEPASSWORD_VALUE; templateCode = Constants.SMS_TYPE_UPDATEPASSWORD_VALUE;
}else{ } else {
templateCode = Constants.SMS_TYPE_UPDATEPASSWORD_VALUE_INTERNATIONAL; templateCode = Constants.SMS_TYPE_UPDATEPASSWORD_VALUE_INTERNATIONAL;
} }
...@@ -92,13 +91,13 @@ public class SmsService { ...@@ -92,13 +91,13 @@ public class SmsService {
throw new BusinessException("该手机号已被绑定"); throw new BusinessException("该手机号已被绑定");
}*/ }*/
templateCode = Constants.SMS_TYPE_BINDINGMOBILE_VALUE; templateCode = Constants.SMS_TYPE_BINDINGMOBILE_VALUE;
if(isMatch == false){ if (isMatch == false) {
templateCode = Constants.SMS_TYPE_BINDINGMOBILE_VALUE_INTERNATIONAL; templateCode = Constants.SMS_TYPE_BINDINGMOBILE_VALUE_INTERNATIONAL;
} }
break; break;
case Constants.SMS_TYPE_MOBILELOGIN: case Constants.SMS_TYPE_MOBILELOGIN:
templateCode = Constants.SMS_TYPE_MOBILELOGIN_VALUE; templateCode = Constants.SMS_TYPE_MOBILELOGIN_VALUE;
if(isMatch == false){ if (isMatch == false) {
templateCode = Constants.SMS_TYPE_MOBILELOGIN_VALUE_INTERNATIONAL; templateCode = Constants.SMS_TYPE_MOBILELOGIN_VALUE_INTERNATIONAL;
} }
break; break;
...@@ -107,9 +106,9 @@ public class SmsService { ...@@ -107,9 +106,9 @@ public class SmsService {
} }
} }
String verifyCode = RandomUtils.nextInt(100000, 1000000) + ""; String verifyCode = RandomUtils.nextInt(100000, 1000000) + "";
JSONObject jsonObject= new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("code", verifyCode); jsonObject.put("code", verifyCode);
System.out.println("----------------------------------手机发送的验证码为:"+verifyCode); System.out.println("----------------------------------手机发送的验证码为:" + verifyCode);
Sms sms = new Sms(); Sms sms = new Sms();
sms.setPhonenumber(mobile); sms.setPhonenumber(mobile);
sms.setVerifycode(verifyCode); sms.setVerifycode(verifyCode);
...@@ -120,13 +119,13 @@ public class SmsService { ...@@ -120,13 +119,13 @@ public class SmsService {
try { try {
CommonResponse response = AliCloudUtil.sendSms(mobile, templateCode, jsonObject); CommonResponse response = AliCloudUtil.sendSms(mobile, templateCode, jsonObject);
if(response == null){ if (response == null) {
throw new BusinessException("验证码发送失败"); throw new BusinessException("验证码发送失败");
} }
JSONObject json = JSONObject.fromObject(response.getData()); JSONObject json = JSONObject.fromObject(response.getData());
if("OK".equals(json.get("Code"))){ if ("OK".equals(json.get("Code"))) {
smsMapper.updateState(sms.getId(), 1); smsMapper.updateState(sms.getId(), 1);
}else{ } else {
smsMapper.updateState(sms.getId(), 2); smsMapper.updateState(sms.getId(), 2);
throw new BusinessException("验证码发送失败"); throw new BusinessException("验证码发送失败");
} }
......
...@@ -58,7 +58,7 @@ public class AliCloudUtil { ...@@ -58,7 +58,7 @@ public class AliCloudUtil {
*/ */
public static CommonResponse sendSms(String mobile, String templateCode, JSONObject json) throws ClientException { public static CommonResponse sendSms(String mobile, String templateCode, JSONObject json) throws ClientException {
DefaultProfile profile = DefaultProfile.getProfile("default", accessKeyId, accessKeySecret); DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret);
IAcsClient client = new DefaultAcsClient(profile); IAcsClient client = new DefaultAcsClient(profile);
CommonRequest request = new CommonRequest(); CommonRequest request = new CommonRequest();
......
...@@ -285,4 +285,18 @@ public class MomoUtils { ...@@ -285,4 +285,18 @@ public class MomoUtils {
boolean isMatch = m.matches(); boolean isMatch = m.matches();
return isMatch; return isMatch;
} }
/**
* 验证是否中国手机号
*
* @param tel
* @return
*/
public static boolean validTel(String tel) {
String regex = "^(0|86|17951)?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$";
boolean flag = tel.matches(regex);
return flag;
}
} }
...@@ -67,7 +67,7 @@ public class AtlTimeOwnerVo { ...@@ -67,7 +67,7 @@ public class AtlTimeOwnerVo {
@ApiModelProperty(value="婚姻 1-未婚 2-已婚 3-离异") @ApiModelProperty(value="婚姻 1-未婚 2-已婚 3-离异")
private Integer emotionalState; private Integer emotionalState;
@ApiModelProperty(value="是否过世 0 过世 1 在世") @ApiModelProperty(value="是否过世 0 在世 1 过世")
private Integer livingState; private Integer livingState;
@ApiModelProperty(value="卒年开始") @ApiModelProperty(value="卒年开始")
......
package com.hwstudio.antaile.vo; package com.hwstudio.antaile.vo;
import com.hwstudio.antaile.mbg.po.SysAtlTimeOwner;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -85,4 +86,6 @@ public class AtlTimeVo { ...@@ -85,4 +86,6 @@ public class AtlTimeVo {
private Integer blessIdx; private Integer blessIdx;
@ApiModelProperty(value = "oss配置时光纪相关的路径") @ApiModelProperty(value = "oss配置时光纪相关的路径")
private String ossCatalogue; private String ossCatalogue;
@ApiModelProperty(value = "时光纪关于谁对象")
private SysAtlTimeOwner sysAtlTimeOwner;
} }
...@@ -342,4 +342,8 @@ ...@@ -342,4 +342,8 @@
and a.bless_idx=#{blessIdx} and a.bless_idx=#{blessIdx}
and a.status = 1 and a.status = 1
</select> </select>
<select id="selectTimeUserIdByTimeId" parameterType="java.lang.Long" resultType="java.lang.Long">
select user_id from atl_time where id = #{id}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -401,4 +401,20 @@ ...@@ -401,4 +401,20 @@
SELECT * FROM atl_user WHERE mobile_phone=#{mobilePhone} SELECT * FROM atl_user WHERE mobile_phone=#{mobilePhone}
</select> </select>
<select id="selectRelationUserListByOther" parameterType="com.hwstudio.antaile.queryparam.QueryRelationUserParam" resultType="com.hwstudio.antaile.dto.RelationUserDTO">
select
a.id,a.nick_name nickName,a.sex,a.login_date loginDate,
a.avater_image_url avaterImageUrl,a.from_timeid fromTimeid,a.from_userid fromUserid,
b.name fromTimeName
from atl_user a
left join atl_time b ON a.from_timeid = b.id
where 1 = 1
<if test="fromTimeid != null">
and a.from_timeid =#{fromTimeid}
</if>
<if test="fromUserid != null">
and a.from_userid =#{fromUserid}
</if>
</select>
</mapper> </mapper>
\ No newline at end of file
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