Commit a74438ca authored by codezwjava's avatar codezwjava

Merge remote-tracking branch 'origin/master'

parents 50951673 6724eb62
......@@ -21,15 +21,14 @@ public interface ShopZxMapper extends BaseMapper<shopZx> {
* @param
* @return 1
*/
int zxadd(@Param("zxUrl") String zxUrl,@Param("zxField") String zxField,@Param("zxAddress") String zxAddress,@Param("inviteCode") String inviteCode,@Param("zxDate") Long zxDate);
int zxadd(@Param("zxUrl") String zxUrl,@Param("zxField") String zxField,@Param("inviteCode") String inviteCode,@Param("zxDate") Long zxDate);
/**
* 用户头像上传
* @param zxUrl
* @param zxDate
* 用户头像上传并更新
* @param
* @return
*/
int zxadd1(@Param("zxUrl") String zxUrl ,@Param("zxDate") Long zxDate);
int zxadd1(@Param("headImage") String headImage,@Param("userId") String userId);
/**
* 查询资讯数据
......
......@@ -8,7 +8,6 @@
<result column="invite_code" property="inviteCode"/>
<result column="zx_to_examine" property="zxToExamine"/>
<result column="zx_field" property="zxField"/>
<result column="zx_address" property="zxAddress"/>
<result column="zx_date" property="zxDate"/>
</resultMap>
<sql id="table">
......@@ -25,7 +24,7 @@
</sql>
<sql id="vals">
#{zxUrl},#{zxField},#{zxAddress},#{inviteCode},#{zxDate}
#{zxUrl},#{zxField},#{inviteCode},#{zxDate}
</sql>
<sql id="updateCondition">
......@@ -43,14 +42,16 @@
</insert>
<!--用户头像插入-->
<insert id="zxadd1" parameterType="cn.wisenergy.model.app.shopZx">
insert into
<include refid="table"/>
zx_url,zx_date
value(
#{zxUrl},#{zxDate}
)
</insert>
<update id="zxadd1" parameterType="cn.wisenergy.model.app.User">
UPDATE
user_info
<set>
head_image=#{headImage}
</set>
<where>
user_id=#{userId}
</where>
</update>
<!--资讯内容倒叙查询-->
......
......@@ -48,6 +48,9 @@ public class zxUserDto {
@ApiModelProperty(name = "zx_likes", value = "获赞数")
private Integer zxLikes;
@ApiModelProperty(name = "liked_status", value = "点赞状态")
private Integer likedStatus;
/**
* 资讯文字输入字段
*/
......
......@@ -19,14 +19,14 @@ public interface UploadService {
* @param request
* @return
*/
Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String zxAddress,String inviteCode) throws Exception;
Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String inviteCode) throws Exception;
/**
* TODO 用户头像上传
*
* @return
*/
Map<String, Object> uploadImage(MultipartFile file) throws Exception;
Map<String, Object> uploadImage(MultipartFile file,String inviteCode) throws Exception;
/**
......@@ -34,7 +34,7 @@ public interface UploadService {
* @param file
* @return
*/
List imageUpload( MultipartFile[] file, String zxField, String zxAddress,String inviteCode);
List imageUpload( MultipartFile[] file, String zxField,String inviteCode);
......@@ -49,7 +49,7 @@ public interface UploadService {
* @param pageSize
* @return
*/
Map selectPage(Integer pageNum, Integer pageSize);
Map selectPage(Integer pageNum, Integer pageSize,String inviteCode);
/**
* TODO 资讯点赞
......
......@@ -56,7 +56,7 @@ public class UploadServiceImpl implements UploadService {
* 视频文件上传
*/
@Override
public Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String zxAddress,String inviteCode) throws Exception {
public Map<String, Object> uploadVideo(MultipartFile file,HttpServletRequest request,String zxField,String inviteCode) throws Exception {
Map<String, Object> resultMap=new HashMap<String, Object>();
/**
* http://路径 request.getScheme() + "://" + request.getServerName()
......@@ -100,7 +100,7 @@ public class UploadServiceImpl implements UploadService {
* 生成当前时间戳
*/
Long zxDate= System.currentTimeMillis();
shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, zxDate);
shopZxMapper.zxadd(zxUrl,zxField,inviteCode, zxDate);
return resultMap;
}
......@@ -108,7 +108,7 @@ public class UploadServiceImpl implements UploadService {
* 图片文件上传
*/
@Override
public Map<String, Object> uploadImage(MultipartFile file) throws Exception {
public Map<String, Object> uploadImage(MultipartFile file,String inviteCode) throws Exception {
Map<String, Object> resultMap=new HashMap<String, Object>();
/**
......@@ -137,6 +137,8 @@ public class UploadServiceImpl implements UploadService {
newFile.getParentFile().mkdirs();
}
User user=usersMapper.InvitedCode2(inviteCode);
String userId=user.getUserId();
//将内存中的数据写入磁盘
file.transferTo(newFile);
//图片上传保存url
......@@ -144,7 +146,7 @@ public class UploadServiceImpl implements UploadService {
resultMap.put("zxUrl", zxUrl);
resultMap.put("returnCode", 0);
shopZxMapper.zxadd1(zxUrl, zxDate);
shopZxMapper.zxadd1(zxUrl,userId);
return resultMap;
}
......@@ -152,12 +154,11 @@ public class UploadServiceImpl implements UploadService {
* 多图片
* @param files
* @param zxField
* @param zxAddress
* @param inviteCode
* @return
*/
@Override
public List imageUpload(MultipartFile[] files, String zxField, String zxAddress,String inviteCode) {
public List imageUpload(MultipartFile[] files, String zxField, String inviteCode) {
//获取上传图片数量,打印在控制台
System.out.println("上传图片数量" + files.length);
String zxUrl = new String();
......@@ -210,7 +211,7 @@ public class UploadServiceImpl implements UploadService {
* 生成当前时间戳
*/
Long zxDate= Long.valueOf(System.currentTimeMillis());
shopZxMapper.zxadd(zxUrl,zxField,zxAddress,inviteCode, zxDate);
shopZxMapper.zxadd(zxUrl,zxField,inviteCode, zxDate);
return root;
}
......@@ -273,14 +274,13 @@ public class UploadServiceImpl implements UploadService {
* 资讯文件展示
*/
@Override
public Map selectPage(Integer pageNum, Integer pageSize) {
public Map selectPage(Integer pageNum, Integer pageSize,String inviteCode) {
Map map = new HashMap();
pageNum=pageNum-1;
List<zxUserDto> shopZxList = shopZxMapper.selectPage(pageNum,pageSize);
for (zxUserDto shopZx : shopZxList) {
String[] zxUrl = shopZx.getZxUrl().split(",");
// List<String> strings = Arrays.asList(split);
ArrayList list =new ArrayList();
if (null != zxUrl){
for (String split:zxUrl) {
......@@ -290,9 +290,24 @@ public class UploadServiceImpl implements UploadService {
shopZx.setAskImgList(list);
}
}
shopZx.setUserId(shopZx.getUserId().replaceAll("(\\d{3})\\d{4}(\\d{4})","$1****$2"));
int likedId =shopZx.getZxid();
shopZx.setUserId(shopZx.getUserId().replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2"));
if(null!=inviteCode&&""!=inviteCode) {
//用户个人邀请码查询用户数据
User user=usersMapper.InvitedCode2(inviteCode);
String userLikeId=user.getUserId();
userLikes d = LikesMapper.selectlikes(userLikeId, likedId);
if (null == d) {
shopZx.setLikedStatus(0);
} else {
shopZx.setLikedStatus(1);
}
}
}
map.put("data",shopZxList);
return map;
......
......@@ -60,7 +60,7 @@ public class SmsController {
//生成随机数
String code= MathUtils.random();
//保存至Redis MINUTE_INT
redisUtils.set(key,code,Constants.Duration.TEN_HOURS_HOUR_INT);
redisUtils.set(key,code,Constants.Duration.MINUTE_INT);
boolean flag=smsUtils.sendMessage(phone,Constants.Sms.TemplateCode.LOGIN_SF_REGISTER,code);
return (flag? ResultUtils.returnSuccess():ResultUtils.returnFail());
......
......@@ -46,7 +46,6 @@ public class UploadController {
* @param file
* @param request
* @param zxField
* @param zxAddress
* @return
* @throws Exception
*/
......@@ -57,25 +56,22 @@ public class UploadController {
@ApiImplicitParam(name = "zxAddress", value = "资讯发布地址", dataType = "String"),
@ApiImplicitParam(name = "inviteCode", value = "用户本人邀请码(发布人)", required = true, dataType = "String")})
@RequestMapping(value = "/uploadVideo", method = RequestMethod.POST)
public Map<String, Object> uploadVideo(@RequestParam(value = "files")MultipartFile file, HttpServletRequest request, String zxField, String zxAddress,String inviteCode) throws Exception {
return uploadService.uploadVideo(file, request, zxField, zxAddress,inviteCode);
public Map<String, Object> uploadVideo(@RequestParam(value = "files")MultipartFile file, HttpServletRequest request, String zxField, String inviteCode) throws Exception {
return uploadService.uploadVideo(file, request, zxField,inviteCode);
}
/**
* TODO 用户头像上传
* TODO 用户头像上传/更新头像接口
*
* @param
* @return
* @throws Exception
*/
@ApiOperation(value = "用户头像上传接口", notes = "返回路径给前台", httpMethod = "POST", produces = "application/json; charset=UTF-8")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "单图片", dataType = "MultipartFile"),
@ApiImplicitParam(name = "inviteCode", value = "用户本人邀请码(发布人)", required = true, dataType = "String")})
@ApiImplicitParam(name = "file", value = "单图片", dataType = "MultipartFile")
@RequestMapping(value = "/uploadImage", method = RequestMethod.POST)
public Map<String, Object> uploadImage(@RequestParam(value = "files")MultipartFile file) throws Exception {
return uploadService.uploadImage(file);
public Map<String, Object> uploadImage(@RequestParam(value = "files")MultipartFile file,String inviteCode) throws Exception {
return uploadService.uploadImage(file,inviteCode);
}
......@@ -91,12 +87,11 @@ public class UploadController {
@ApiImplicitParams({
@ApiImplicitParam(name = "zxField", value = "资讯文字", dataType = "String"),
@ApiImplicitParam(name = "files", value = "多图片", paramType = "form", allowMultiple=true, dataType = "__file"),
@ApiImplicitParam(name = "zxAddress", value = "发表地址", dataType = "String"),
@ApiImplicitParam(name = "inviteCode", value = "用户本人邀请码(发布人)", required = true, dataType = "String")})
@RequestMapping(method = RequestMethod.POST, value = "/multipleImageUpload", headers = "content-type=multipart/form-data")
public List multipleImageUpload(@RequestParam(required=false,value = "files") MultipartFile[] files, String zxField, String zxAddress,String inviteCode) {
return uploadService.imageUpload(files, zxField, zxAddress,inviteCode);
public List multipleImageUpload(@RequestParam(required=false,value = "files") MultipartFile[] files, String zxField,String inviteCode) {
return uploadService.imageUpload(files, zxField,inviteCode);
}
......@@ -108,11 +103,12 @@ public class UploadController {
*/
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "从几开始", required = true,dataType = "integer"),
@ApiImplicitParam(name = "inviteCode", value = "用户本人邀请码(发布人)", required = false, dataType = "String"),
@ApiImplicitParam(name = "pageSize", value = "一页展示数量", required = true, dataType = "Integger")})
@RequestMapping(method = RequestMethod.GET, value = "/zxAll")
public Map selectPage(int pageNum, int pageSize){
public Map selectPage(int pageNum, int pageSize,String inviteCode){
return uploadService.selectPage(pageNum,pageSize);
return uploadService.selectPage(pageNum,pageSize,inviteCode);
}
/**
......
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