From 5d94f82ada2224eb2e8210dc56efef1b4118ce31 Mon Sep 17 00:00:00 2001 From: starlbb Date: Fri, 27 Mar 2020 23:14:10 +0800 Subject: [PATCH 01/27] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=A4=BE=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../woniu/controller/ActivityController.java | 1 + .../woniu/controller/DynamicController.java | 111 +++++++++++++++- .../java/com/woniu/dao/ActivityMapper.java | 3 + .../com/woniu/dao/CommunityFavorMapper.java | 32 +++++ .../com/woniu/dao/DynamicCommentMapper.java | 4 + .../java/com/woniu/dao/DynamicMapper.java | 15 ++- .../java/com/woniu/dto/DynamicCommentDto.java | 24 ++++ .../java/com/woniu/dto/DynamicDetail.java | 20 +++ .../main/java/com/woniu/dto/DynamicPost.java | 6 + .../java/com/woniu/pojo/CommunityFavor.java | 28 ++++ .../src/main/java/com/woniu/pojo/Dynamic.java | 1 + .../java/com/woniu/pojo/DynamicComment.java | 44 +------ .../com/woniu/service/DynamicService.java | 45 ++++++- .../service/impl/ActivityServiceImpl.java | 7 +- .../service/impl/DynamicServiceImpl.java | 123 +++++++++++++++++- .../src/main/resources/application.yml | 2 +- .../src/main/resources/generatorConfig.xml | 12 +- .../resources/mapper/CommunityFavorMapper.xml | 93 +++++++++++++ 18 files changed, 521 insertions(+), 50 deletions(-) create mode 100644 communityservice/src/main/java/com/woniu/dao/CommunityFavorMapper.java create mode 100644 communityservice/src/main/java/com/woniu/dto/DynamicCommentDto.java create mode 100644 communityservice/src/main/java/com/woniu/dto/DynamicDetail.java create mode 100644 communityservice/src/main/java/com/woniu/pojo/CommunityFavor.java create mode 100644 communityservice/src/main/resources/mapper/CommunityFavorMapper.xml diff --git a/communityservice/src/main/java/com/woniu/controller/ActivityController.java b/communityservice/src/main/java/com/woniu/controller/ActivityController.java index 2473c05..aebf4ea 100644 --- a/communityservice/src/main/java/com/woniu/controller/ActivityController.java +++ b/communityservice/src/main/java/com/woniu/controller/ActivityController.java @@ -124,6 +124,7 @@ public class ActivityController { System.out.println(type+":"+page); //实例化实体类,适合前端需要的数据 List activityPosts = activityService.findByType(type,page); + System.out.println(activityPosts.size()); return CommonResult.success(activityPosts); } diff --git a/communityservice/src/main/java/com/woniu/controller/DynamicController.java b/communityservice/src/main/java/com/woniu/controller/DynamicController.java index 0f2b8af..453fd02 100644 --- a/communityservice/src/main/java/com/woniu/controller/DynamicController.java +++ b/communityservice/src/main/java/com/woniu/controller/DynamicController.java @@ -1,7 +1,10 @@ package com.woniu.controller; import com.alibaba.fastjson.JSONArray; +import com.woniu.dto.DynamicCommentDto; +import com.woniu.dto.DynamicDetail; import com.woniu.dto.DynamicPost; +import com.woniu.pojo.CommunityFavor; import com.woniu.result.CommonResult; import com.woniu.service.DynamicService; import com.woniu.util.QiniuUploadUtil; @@ -76,11 +79,113 @@ public class DynamicController { */ @GetMapping("/list") @ResponseBody - public CommonResult list(Integer type,Integer page){ - System.out.println(type+":"+page); + public CommonResult list(Integer type,Integer page,Integer userId){ + System.out.println(type+":"+page+":"+userId); //获取动态信息,并封装成前端需要的数据类 - List dynamicPosts = dynamicService.findByType(type,page); + List dynamicPosts = dynamicService.findByType(type,page,userId); return CommonResult.success(dynamicPosts); } + /** + * 获取指定id的动态详情 + * @param dynamicId + * @return + */ + @GetMapping("/dynamicDetail") + @ResponseBody + public CommonResult dynamicDetail(Integer dynamicId){ + System.out.println(dynamicId); + //获取指定动态除评论之外的内容 + DynamicPost dynamicPost = dynamicService.findDynamicById(dynamicId); + //获取指定动态的评论 + List dynamicCommentDtos = dynamicService.findByComment(dynamicId); + //封装成前端需要的数据 + DynamicDetail dynamicDetail = new DynamicDetail(dynamicPost,dynamicCommentDtos); + return CommonResult.success(dynamicDetail); + } + + /** + * 获取指定动态的点赞人消息 + * @param dynamicId + * @return + */ + @GetMapping("/favor") + @ResponseBody + public CommonResult favor(Integer dynamicId){ + System.out.println(dynamicId); + List communityFavors = dynamicService.findFavorById(dynamicId); + return CommonResult.success(communityFavors); + } + + /** + * 对指定动态,保存该用户的点赞 + * @param dynamicId + * @param userId + * @return + */ + @PostMapping("/saveFavor") + @ResponseBody + public CommonResult saveFavor(Integer dynamicId,Integer userId){ + System.out.println(dynamicId+":"+userId); + try { + dynamicService.saveFavor(dynamicId,userId); + return CommonResult.success("点赞成功"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.success("内部错误"); + } + + } + /** + * 对指定动态,取消该用户的点赞 + * @param dynamicId + * @param userId + * @return + */ + @DeleteMapping("/deleteFavor") + @ResponseBody + public CommonResult deleteFavor(Integer dynamicId,Integer userId){ + System.out.println(dynamicId+":"+userId); + try { + dynamicService.deleteFavor(dynamicId,userId); + return CommonResult.success("取消点赞"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.success("内部错误"); + } + + } + + /** + * 获取指定动态的评论消息 + * @param dynamicId + * @return + */ + @GetMapping("/comment") + @ResponseBody + public CommonResult comment(Integer dynamicId){ + System.out.println(dynamicId); + List dynamicCommentDtos = dynamicService.findByComment(dynamicId); + return CommonResult.success(dynamicCommentDtos); + } + + @PostMapping("/saveComment") + @ResponseBody + public CommonResult saveComment(@RequestBody String my_comment){ + try { + //转化成真实的值 + String act = URLDecoder.decode(my_comment,"UTF-8"); + act = act.replace("comment=",""); + //将数据转为map + Map map = JSONArray.parseObject(act); + //添加评论到数据库 + dynamicService.saveComment(map); + return CommonResult.success("评论成功"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + return CommonResult.failed("评论失败"); + } + + } + } diff --git a/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java b/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java index d59e634..c56a02c 100644 --- a/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java +++ b/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java @@ -23,4 +23,7 @@ public interface ActivityMapper { @Select(value = "select ca.*,pi.url,pu.name from community_activity ca,person_image pi,person_user pu where ca.ca_user_id = pu.id and pu.id = pi.person_user_id and ca_type = #{type} order by id desc limit #{page},10") List selectByType(Integer type, Integer page); + + @Select(value = "select ca.*,pi.url,pu.name from community_activity ca,person_image pi,person_user pu where ca.ca_user_id = pu.id and pu.id = pi.person_user_id order by id desc limit #{page},10") + List selectByPage(Integer page); } \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/dao/CommunityFavorMapper.java b/communityservice/src/main/java/com/woniu/dao/CommunityFavorMapper.java new file mode 100644 index 0000000..91b6910 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/dao/CommunityFavorMapper.java @@ -0,0 +1,32 @@ +package com.woniu.dao; + +import com.woniu.pojo.CommunityFavor; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface CommunityFavorMapper { + int deleteByPrimaryKey(Integer id); + + int insert(CommunityFavor record); + + int insertSelective(CommunityFavor record); + + CommunityFavor selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(CommunityFavor record); + + int updateByPrimaryKey(CommunityFavor record); + + @Select(value = "select * from community_favor where cf_dynamic_id = #{dynamicId} order by cf_createTime desc limit 7") + List selectById(Integer dynamicId); + + @Select(value = "delete from community_favor where cf_dynamic_id=#{dynamicId} and cf_user_id=#{userId}") + void deleteFavorById(Integer dynamicId, Integer userId); + + @Select(value = "select cf_dynamic_id from community_favor where cf_user_id = #{userId} ") + List selectIdByUserId(Integer userId); + + @Select(value = "select count(id) from community_favor where cf_dynamic_id = #{id}") + Integer selectCountById(Integer id); +} \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/dao/DynamicCommentMapper.java b/communityservice/src/main/java/com/woniu/dao/DynamicCommentMapper.java index 8e77974..314fac5 100644 --- a/communityservice/src/main/java/com/woniu/dao/DynamicCommentMapper.java +++ b/communityservice/src/main/java/com/woniu/dao/DynamicCommentMapper.java @@ -1,6 +1,7 @@ package com.woniu.dao; import com.woniu.pojo.DynamicComment; +import org.apache.ibatis.annotations.Select; public interface DynamicCommentMapper { int deleteByPrimaryKey(Integer id); @@ -14,4 +15,7 @@ public interface DynamicCommentMapper { int updateByPrimaryKeySelective(DynamicComment record); int updateByPrimaryKey(DynamicComment record); + + @Select(value = "select count(id) from community_dynamic_comment where cdc_dynamic_id = #{id}") + Integer selectCountById(Integer id); } \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java b/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java index 73444fc..ac94952 100644 --- a/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java +++ b/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java @@ -1,5 +1,6 @@ package com.woniu.dao; +import com.woniu.dto.DynamicCommentDto; import com.woniu.dto.DynamicPost; import com.woniu.pojo.Dynamic; import org.apache.ibatis.annotations.Select; @@ -21,6 +22,18 @@ public interface DynamicMapper { int updateByPrimaryKey(Dynamic record); - @Select(value = "select cd.*,pi.url,pu.name from community_dynamic cd,person_image pi,person_user pu where cd.cd_user_id = pu.id and pu.id = pi.person_user_id and cd_type = #{type} order by id desc limit #{page},10") + @Select(value = "select cd.*,pi.url,pu.name from community_dynamic cd,person_image pi,person_user pu where cd.cd_user_id = pu.id and pu.id = pi.person_user_id and cd_type = #{type} order by cd_favor desc limit #{page},10") List selectByType(Integer type, Integer page); + + @Select(value = "select cdc.*,pu.name from community_dynamic_comment cdc,person_user pu where cdc.cdc_dynamic_id=#{dynamicId} and cdc.cdc_user_id = pu.id") + List selectById(Integer dynamicId); + + @Select(value = "select url from person_image where person_user_id = #{userId}") + String selectUserPicById(Integer userId); + + @Select(value = "select cd.*,pi.url,pu.name from community_dynamic cd,person_image pi,person_user pu where cd.cd_user_id = pu.id and pu.id = pi.person_user_id and cd.id = #{dynamicId}") + DynamicPost selectDynamicById(Integer dynamicId); + + @Select(value = "select cd.*,pi.url,pu.name from community_dynamic cd,person_image pi,person_user pu where cd.cd_user_id = pu.id and pu.id = pi.person_user_id order by cd_favor desc limit #{page},10") + List selectByPage(Integer page); } \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/dto/DynamicCommentDto.java b/communityservice/src/main/java/com/woniu/dto/DynamicCommentDto.java new file mode 100644 index 0000000..db7ea16 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/dto/DynamicCommentDto.java @@ -0,0 +1,24 @@ +package com.woniu.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class DynamicCommentDto implements Serializable { + + private Integer id; + + private Integer cdcDynamicId; + + private Integer cdcUserId; + + private Integer cdcOtherUserId; + + private String cdcContent; + + private Date cdcTime; + private String name; + private String OtherName; +} diff --git a/communityservice/src/main/java/com/woniu/dto/DynamicDetail.java b/communityservice/src/main/java/com/woniu/dto/DynamicDetail.java new file mode 100644 index 0000000..e1458b5 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/dto/DynamicDetail.java @@ -0,0 +1,20 @@ +package com.woniu.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class DynamicDetail implements Serializable { + private DynamicPost dynamicPost; + private List dynamicCommentDtos; + + public DynamicDetail() { + } + + public DynamicDetail(DynamicPost dynamicPost, List dynamicCommentDtos) { + this.dynamicPost = dynamicPost; + this.dynamicCommentDtos = dynamicCommentDtos; + } +} diff --git a/communityservice/src/main/java/com/woniu/dto/DynamicPost.java b/communityservice/src/main/java/com/woniu/dto/DynamicPost.java index e791e04..7f1d468 100644 --- a/communityservice/src/main/java/com/woniu/dto/DynamicPost.java +++ b/communityservice/src/main/java/com/woniu/dto/DynamicPost.java @@ -28,4 +28,10 @@ public class DynamicPost implements Serializable { private String url; private String name; + + private Integer commentCount; + + private Integer favorCount; + + private Integer favorStatus=0; } diff --git a/communityservice/src/main/java/com/woniu/pojo/CommunityFavor.java b/communityservice/src/main/java/com/woniu/pojo/CommunityFavor.java new file mode 100644 index 0000000..53f8d7c --- /dev/null +++ b/communityservice/src/main/java/com/woniu/pojo/CommunityFavor.java @@ -0,0 +1,28 @@ +package com.woniu.pojo; + +import lombok.Data; + +import java.util.Date; + +@Data +public class CommunityFavor { + private Integer id; + + private Integer cfDynamicId; + + private Integer cfUserId; + + private String cfUserPic; + + private Date cfCreatetime; + + public CommunityFavor() { + } + + public CommunityFavor(Integer cfDynamicId, Integer cfUserId, String cfUserPic, Date cfCreatetime) { + this.cfDynamicId = cfDynamicId; + this.cfUserId = cfUserId; + this.cfUserPic = cfUserPic; + this.cfCreatetime = cfCreatetime; + } +} \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/pojo/Dynamic.java b/communityservice/src/main/java/com/woniu/pojo/Dynamic.java index 38b5f00..bdd3124 100644 --- a/communityservice/src/main/java/com/woniu/pojo/Dynamic.java +++ b/communityservice/src/main/java/com/woniu/pojo/Dynamic.java @@ -20,6 +20,7 @@ public class Dynamic { private String cdContent; + public Dynamic() { } diff --git a/communityservice/src/main/java/com/woniu/pojo/DynamicComment.java b/communityservice/src/main/java/com/woniu/pojo/DynamicComment.java index 6baad41..597e5e2 100644 --- a/communityservice/src/main/java/com/woniu/pojo/DynamicComment.java +++ b/communityservice/src/main/java/com/woniu/pojo/DynamicComment.java @@ -1,7 +1,10 @@ package com.woniu.pojo; +import lombok.Data; + import java.util.Date; +@Data public class DynamicComment { private Integer id; @@ -15,51 +18,14 @@ public class DynamicComment { private Date cdcTime; - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; + public DynamicComment() { } - public Integer getCdcDynamicId() { - return cdcDynamicId; - } - - public void setCdcDynamicId(Integer cdcDynamicId) { + public DynamicComment(Integer cdcDynamicId, Integer cdcUserId, Integer cdcOtherUserId, String cdcContent, Date cdcTime) { this.cdcDynamicId = cdcDynamicId; - } - - public Integer getCdcUserId() { - return cdcUserId; - } - - public void setCdcUserId(Integer cdcUserId) { this.cdcUserId = cdcUserId; - } - - public Integer getCdcOtherUserId() { - return cdcOtherUserId; - } - - public void setCdcOtherUserId(Integer cdcOtherUserId) { this.cdcOtherUserId = cdcOtherUserId; - } - - public String getCdcContent() { - return cdcContent; - } - - public void setCdcContent(String cdcContent) { this.cdcContent = cdcContent; - } - - public Date getCdcTime() { - return cdcTime; - } - - public void setCdcTime(Date cdcTime) { this.cdcTime = cdcTime; } } \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/service/DynamicService.java b/communityservice/src/main/java/com/woniu/service/DynamicService.java index 3ed59e0..f59201c 100644 --- a/communityservice/src/main/java/com/woniu/service/DynamicService.java +++ b/communityservice/src/main/java/com/woniu/service/DynamicService.java @@ -1,6 +1,8 @@ package com.woniu.service; +import com.woniu.dto.DynamicCommentDto; import com.woniu.dto.DynamicPost; +import com.woniu.pojo.CommunityFavor; import java.util.List; import java.util.Map; @@ -19,5 +21,46 @@ public interface DynamicService { * @param page * @return */ - List findByType(Integer type, Integer page); + List findByType(Integer type, Integer page,Integer userId); + + /** + * 根据动态id获取动态的评论人信息 + * @param dynamicId + * @return + */ + List findByComment(Integer dynamicId); + + /** + * 根据动态id获取动态的点赞人信息 + * @param dynamicId + * @return + */ + List findFavorById(Integer dynamicId); + + /** + * 保存点赞信息 + * @param dynamicId + * @param userId + */ + void saveFavor(Integer dynamicId, Integer userId); + + /** + * 取消点赞信息 + * @param dynamicId + * @param userId + */ + void deleteFavor(Integer dynamicId, Integer userId); + + /** + * 添加评论信息到数据库 + * @param map + */ + void saveComment(Map map); + + /** + * 获取指定id的动态内容 + * @param dynamicId + * @return + */ + DynamicPost findDynamicById(Integer dynamicId); } diff --git a/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java b/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java index b00423d..7603320 100644 --- a/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java +++ b/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java @@ -139,7 +139,12 @@ public class ActivityServiceImpl implements ActivityService { */ @Override public List findByType(Integer type, Integer page) { - return activityMapper.selectByType(type,page); + //判断活动类型,0:全部 + if(type==0){ + return activityMapper.selectByPage(page); + }else{ + return activityMapper.selectByType(type,page); + } } } diff --git a/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java b/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java index 9e4f3f6..ada8610 100644 --- a/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java +++ b/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java @@ -1,8 +1,13 @@ package com.woniu.service.impl; +import com.woniu.dao.CommunityFavorMapper; +import com.woniu.dao.DynamicCommentMapper; import com.woniu.dao.DynamicMapper; +import com.woniu.dto.DynamicCommentDto; import com.woniu.dto.DynamicPost; +import com.woniu.pojo.CommunityFavor; import com.woniu.pojo.Dynamic; +import com.woniu.pojo.DynamicComment; import com.woniu.service.DynamicService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -16,6 +21,10 @@ public class DynamicServiceImpl implements DynamicService { @Autowired private DynamicMapper dynamicMapper; + @Autowired + private CommunityFavorMapper communityFavorMapper; + @Autowired + private DynamicCommentMapper dynamicCommentMapper; /** * 保存动态 @@ -40,7 +49,117 @@ public class DynamicServiceImpl implements DynamicService { * @return */ @Override - public List findByType(Integer type, Integer page) { - return dynamicMapper.selectByType(type,page); + public List findByType(Integer type, Integer page,Integer userId) { + //判断是否是查询全部类型,0:全部 + List dynamicPosts; + if(type == 0){ + dynamicPosts = dynamicMapper.selectByPage(page); + }else{ + dynamicPosts = dynamicMapper.selectByType(type,page); + } + + //新增评论数量信息 + for(int i=0;i list = communityFavorMapper.selectIdByUserId(userId); + //遍历加载的新动态 + for(int i=0;i findByComment(Integer dynamicId) { + List dynamicCommentDtos = dynamicMapper.selectById(dynamicId); + //查出是否是回复另一个人的评论 + for(int i=0;i findFavorById(Integer dynamicId) { + return communityFavorMapper.selectById(dynamicId); + } + + @Override + public void saveFavor(Integer dynamicId, Integer userId) { + //获取点赞人头像信息 + String picPath = dynamicMapper.selectUserPicById(userId); + //new一个新的点赞实体 + CommunityFavor communityFavor = new CommunityFavor(dynamicId,userId,picPath,new Date()); + communityFavorMapper.insertSelective(communityFavor); + } + + /** + * 取消点赞 + * @param dynamicId + * @param userId + */ + @Override + public void deleteFavor(Integer dynamicId, Integer userId) { + communityFavorMapper.deleteFavorById(dynamicId,userId); + } + + /** + * 保存评论 + * @param map + */ + @Override + public void saveComment(Map map) { + //获取必要信息 + Integer dynamicId = Integer.valueOf(map.get("dynamicId").toString()); + Integer userId = Integer.valueOf(map.get("userId").toString()); + Integer otherUserId = null; + //如果是对其他人的评论进行回复,则必须写入其他人的用户id + if(map.get("otherUserId")!=null){ + otherUserId = Integer.valueOf(map.get("otherUserId").toString()); + } + String content = String.valueOf(map.get("content")); + //新建一个评论实体 + DynamicComment dynamicComment = new DynamicComment(dynamicId,userId,otherUserId,content,new Date()); + dynamicCommentMapper.insertSelective(dynamicComment); + } + + /** + * 获取指定id 的动态信息 + * @param dynamicId + * @return + */ + @Override + public DynamicPost findDynamicById(Integer dynamicId) { + DynamicPost dynamicPost = dynamicMapper.selectDynamicById(dynamicId); + return dynamicPost; } + } diff --git a/communityservice/src/main/resources/application.yml b/communityservice/src/main/resources/application.yml index 81f0923..4c8e248 100644 --- a/communityservice/src/main/resources/application.yml +++ b/communityservice/src/main/resources/application.yml @@ -6,7 +6,7 @@ spring: driver-class-name: com.mysql.jdbc.Driver jackson: time-zone: GMT+8 - date-format: yyyy-MM-dd HH:mm:ss + date-format: yyyy-MM-dd HH:mm redis: host: localhost port: 6379 diff --git a/communityservice/src/main/resources/generatorConfig.xml b/communityservice/src/main/resources/generatorConfig.xml index c07c765..b3e0ea7 100644 --- a/communityservice/src/main/resources/generatorConfig.xml +++ b/communityservice/src/main/resources/generatorConfig.xml @@ -50,13 +50,21 @@ - + + + + + + + +
- +
diff --git a/communityservice/src/main/resources/mapper/CommunityFavorMapper.xml b/communityservice/src/main/resources/mapper/CommunityFavorMapper.xml new file mode 100644 index 0000000..a3c7183 --- /dev/null +++ b/communityservice/src/main/resources/mapper/CommunityFavorMapper.xml @@ -0,0 +1,93 @@ + + + + + + + + + + + + id, cf_dynamic_id, cf_user_id, cf_user_pic, cf_createTime + + + + delete from community_favor + where id = #{id,jdbcType=INTEGER} + + + insert into community_favor (id, cf_dynamic_id, cf_user_id, + cf_user_pic, cf_createTime) + values (#{id,jdbcType=INTEGER}, #{cfDynamicId,jdbcType=INTEGER}, #{cfUserId,jdbcType=INTEGER}, + #{cfUserPic,jdbcType=VARCHAR}, #{cfCreatetime,jdbcType=TIMESTAMP}) + + + insert into community_favor + + + id, + + + cf_dynamic_id, + + + cf_user_id, + + + cf_user_pic, + + + cf_createTime, + + + + + #{id,jdbcType=INTEGER}, + + + #{cfDynamicId,jdbcType=INTEGER}, + + + #{cfUserId,jdbcType=INTEGER}, + + + #{cfUserPic,jdbcType=VARCHAR}, + + + #{cfCreatetime,jdbcType=TIMESTAMP}, + + + + + update community_favor + + + cf_dynamic_id = #{cfDynamicId,jdbcType=INTEGER}, + + + cf_user_id = #{cfUserId,jdbcType=INTEGER}, + + + cf_user_pic = #{cfUserPic,jdbcType=VARCHAR}, + + + cf_createTime = #{cfCreatetime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + + update community_favor + set cf_dynamic_id = #{cfDynamicId,jdbcType=INTEGER}, + cf_user_id = #{cfUserId,jdbcType=INTEGER}, + cf_user_pic = #{cfUserPic,jdbcType=VARCHAR}, + cf_createTime = #{cfCreatetime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file -- Gitee From aeb88b92579024d25d388052fd21e7e60bbca968 Mon Sep 17 00:00:00 2001 From: starlbb Date: Mon, 30 Mar 2020 10:38:08 +0800 Subject: [PATCH 02/27] =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E5=99=A8=E5=AE=9A=E6=97=B6=E6=9B=B4=E6=96=B0=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/woniu/CommunityserviceApplication.java | 2 ++ .../src/main/java/com/woniu/dao/ActivityMapper.java | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java b/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java index 6c5880e..05cc610 100644 --- a/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java +++ b/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java @@ -4,10 +4,12 @@ import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; +import org.springframework.scheduling.annotation.EnableScheduling; @SpringBootApplication @MapperScan(value = "com.woniu.dao") @EnableEurekaClient //开启eureka客户端 +@EnableScheduling //开启定时器 public class CommunityserviceApplication { public static void main(String[] args) { diff --git a/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java b/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java index c56a02c..032adb8 100644 --- a/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java +++ b/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java @@ -21,9 +21,12 @@ public interface ActivityMapper { int updateByPrimaryKey(Activity record); - @Select(value = "select ca.*,pi.url,pu.name from community_activity ca,person_image pi,person_user pu where ca.ca_user_id = pu.id and pu.id = pi.person_user_id and ca_type = #{type} order by id desc limit #{page},10") + @Select(value = "select ca.*,pi.url,pu.name from community_activity ca,person_image pi,person_user pu where ca.ca_user_id = pu.id and pu.id = pi.person_user_id and ca_type = #{type} and ca_examine_status != 0 order by id desc limit #{page},10") List selectByType(Integer type, Integer page); - @Select(value = "select ca.*,pi.url,pu.name from community_activity ca,person_image pi,person_user pu where ca.ca_user_id = pu.id and pu.id = pi.person_user_id order by id desc limit #{page},10") + @Select(value = "select ca.*,pi.url,pu.name from community_activity ca,person_image pi,person_user pu where ca.ca_user_id = pu.id and pu.id = pi.person_user_id and ca_examine_status != 0 order by id desc limit #{page},10") List selectByPage(Integer page); + + @Select(value = "select * from community_activity where ca_examine_status != 0") + List selectAll(); } \ No newline at end of file -- Gitee From 98002d950f12dd09397f6979ef7930e8efc83f65 Mon Sep 17 00:00:00 2001 From: starlbb Date: Mon, 30 Mar 2020 10:38:45 +0800 Subject: [PATCH 03/27] =?UTF-8?q?=E5=BC=80=E5=90=AF=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E5=99=A8=E5=AE=9A=E6=97=B6=E6=9B=B4=E6=96=B0=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/woniu/util/ActivityScheduler.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 communityservice/src/main/java/com/woniu/util/ActivityScheduler.java diff --git a/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java b/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java new file mode 100644 index 0000000..7f58964 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java @@ -0,0 +1,47 @@ +package com.woniu.util; + +import com.woniu.dao.ActivityMapper; +import com.woniu.pojo.Activity; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.util.Calendar; +import java.util.Date; +import java.util.List; + +@Component +public class ActivityScheduler { + + @Autowired + private ActivityMapper activityMapper; + + /** + * 每隔1分钟更新一次活动状态 + */ + @Scheduled(cron = "0 0/1 * * * ? ") + public void updateActivity(){ + List activities = activityMapper.selectAll(); + //获取现在时间 + Date nowTime = new Date(); + for(Activity activity:activities){ + //获取活动时间 + Date startTime = activity.getCaStartTime(); + Date endTime = activity.getCaEndTime(); + //判断,定时重置状态 + if(nowTime.before(endTime) && nowTime.after(startTime)){ + activity.setCaStatus(1); + activityMapper.updateByPrimaryKeySelective(activity); + }else if(nowTime.after(endTime)){ + activity.setCaStatus(2); + activityMapper.updateByPrimaryKeySelective(activity); + } + } + } + + public static void main(String[] args) { + //获取现在时间 + Calendar now = Calendar.getInstance(); + System.out.println(now); + } +} -- Gitee From 499e174fb65e0e0f24a84323c2413da9dfb0807c Mon Sep 17 00:00:00 2001 From: starlbb Date: Mon, 30 Mar 2020 20:20:29 +0800 Subject: [PATCH 04/27] =?UTF-8?q?=E6=94=AF=E4=BB=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../woniu/controller/ActivityController.java | 5 + .../com/woniu/util/ActivityScheduler.java | 6 - payservice/.gitignore | 31 +++ payservice/pom.xml | 104 ++++++++ .../java/com/woniu/PayserviceApplication.java | 17 ++ .../java/com/woniu/config/AlipayConfig.java | 53 +++++ .../com/woniu/controller/PayController.java | 224 ++++++++++++++++++ .../java/com/woniu/service/PayService.java | 8 + .../woniu/service/impl/PayServiceImpl.java | 47 ++++ .../src/main/java/com/woniu/util/logFile.java | 30 +++ payservice/src/main/resources/application.yml | 24 ++ .../PayserviceApplicationTests.java | 13 + 12 files changed, 556 insertions(+), 6 deletions(-) create mode 100644 payservice/.gitignore create mode 100644 payservice/pom.xml create mode 100644 payservice/src/main/java/com/woniu/PayserviceApplication.java create mode 100644 payservice/src/main/java/com/woniu/config/AlipayConfig.java create mode 100644 payservice/src/main/java/com/woniu/controller/PayController.java create mode 100644 payservice/src/main/java/com/woniu/service/PayService.java create mode 100644 payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java create mode 100644 payservice/src/main/java/com/woniu/util/logFile.java create mode 100644 payservice/src/main/resources/application.yml create mode 100644 payservice/src/test/java/com/woniu/payservice/PayserviceApplicationTests.java diff --git a/communityservice/src/main/java/com/woniu/controller/ActivityController.java b/communityservice/src/main/java/com/woniu/controller/ActivityController.java index aebf4ea..3de01e0 100644 --- a/communityservice/src/main/java/com/woniu/controller/ActivityController.java +++ b/communityservice/src/main/java/com/woniu/controller/ActivityController.java @@ -18,6 +18,11 @@ import java.util.Map; @RequestMapping("/activity") public class ActivityController { + @GetMapping("/test") + @ResponseBody + public String test(){ + return "tttttt"; + } @Autowired private ActivityService activityService; diff --git a/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java b/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java index 7f58964..d50794d 100644 --- a/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java +++ b/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java @@ -6,7 +6,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; -import java.util.Calendar; import java.util.Date; import java.util.List; @@ -39,9 +38,4 @@ public class ActivityScheduler { } } - public static void main(String[] args) { - //获取现在时间 - Calendar now = Calendar.getInstance(); - System.out.println(now); - } } diff --git a/payservice/.gitignore b/payservice/.gitignore new file mode 100644 index 0000000..a2a3040 --- /dev/null +++ b/payservice/.gitignore @@ -0,0 +1,31 @@ +HELP.md +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/** +!**/src/test/** + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ + +### VS Code ### +.vscode/ diff --git a/payservice/pom.xml b/payservice/pom.xml new file mode 100644 index 0000000..1b454e2 --- /dev/null +++ b/payservice/pom.xml @@ -0,0 +1,104 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.2.5.RELEASE + + + com.woniu + payservice + 0.0.1-SNAPSHOT + payservice + Demo project for Spring Boot + + + 1.8 + Hoxton.SR3 + + + + + org.springframework.boot + spring-boot-starter-data-redis + + + org.springframework.boot + spring-boot-starter-web + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + 2.1.2 + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + + + + org.springframework.boot + spring-boot-devtools + runtime + true + + + mysql + mysql-connector-java + runtime + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + com.alibaba + fastjson + 1.2.7 + + + + + com.alipay.sdk + alipay-sdk-java + 4.9.79.ALL + + + + + + + org.springframework.cloud + spring-cloud-dependencies + ${spring-cloud.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + diff --git a/payservice/src/main/java/com/woniu/PayserviceApplication.java b/payservice/src/main/java/com/woniu/PayserviceApplication.java new file mode 100644 index 0000000..6091bca --- /dev/null +++ b/payservice/src/main/java/com/woniu/PayserviceApplication.java @@ -0,0 +1,17 @@ +package com.woniu; + +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; + +@SpringBootApplication +@MapperScan(value = "com.woniu.dao") +@EnableEurekaClient //开启eureka客户端 +public class PayserviceApplication { + + public static void main(String[] args) { + SpringApplication.run(PayserviceApplication.class, args); + } + +} diff --git a/payservice/src/main/java/com/woniu/config/AlipayConfig.java b/payservice/src/main/java/com/woniu/config/AlipayConfig.java new file mode 100644 index 0000000..38b5862 --- /dev/null +++ b/payservice/src/main/java/com/woniu/config/AlipayConfig.java @@ -0,0 +1,53 @@ +package com.woniu.config; + +import org.springframework.context.annotation.Configuration; + +import java.io.FileWriter; +import java.io.IOException; + +@Configuration +public class AlipayConfig { + // 商户appid 应用ID,您的APPID,收款账号既是您的APPID对应支付宝账号 + public static String app_id = "2016101700705048"; + // 私钥 pkcs8格式的 + public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC2zJChPT9IKXsyBySu0O2vCX+mtzeQCsNT5iFWz3wPJULsNt2ieL7P6wq1gNvCBbhsF/Qs1eUFNJ6un1f8YPJ5/NsPtKp6TyCtkOcoPr6ZHWAIFWgak+2paNLsU2Y0HHtTA1Zju9AbKrj4ZWQ9VxW8TJ/ld2PGQj6Y665kOKhFL+gHOurv1nMZHHwkpSYGY3mwC3W21DfafstIZip/othT+oYg3tH7rcf4Zz5Gj2ja1fkfq7lAYFLqvkTaMpT7Dc02xClYrTnmzZoGd6G0XL0/0cAvjUIyNc3MamjUwwX5lXEh2qaOY9PiuAMH4MYHe9CoC0HlfAg4I/TBkls0zkkPAgMBAAECggEAEM+RQXLLfgxqivhDNFx8b0t1VNSmpHWI7w9L45rjMtVfaS/GhCmMirx32KdIDnjONAqj5veovyjOqwp2YfxccEGDt9cKkoLyY2PfDkFu78/WxAeL8l3GTn0YYKluzb4MzV6SNEvSYJ02M4nHhSicFBwL3GN1ZoczEIckG41mVC5i07agVi+DU61czM4hSiqbmPUHRmG46FCShPZN83CvVgBqRe43gbyR2xuH2g3f6aZaBrdTPB0LGCOcL9TC8PkDrZqJsZ5STjUorLUqNdJ9gxRY330sMBhLGOeYsG0zXyeeVhJWcVH+UNbMf/gTHdJ0TYXcQmbxb0ZbL7u9o/K+wQKBgQDkqKa5kP+bcFy+4SabL6lb4aE4xnluUw9fWMrRWESdbcwApFoFMfw5l6tcR2KmzlLQZreApaJC1EKCXX920ft5fjkLNP6wHvsMBx8URb4xd0kXSg8k8jEljUASglf6n/3142Rg48vQgsiP6QEr8veVwwZ9Gj5O7ba3PXq27BAe4QKBgQDMqCCShR22Waw5B7v1OjWEkrXVqdhq5FnvoT8499p7Ag5l9HLmMLGH729tt2ce66rjL+m7U1RKOqSFunYXFAxPcnMbPpFyGWXzIyjbHtIN/TWfQu/VwJ0X/c79VbGFEdnZjYXWvB4ftom/tr3Uh+X2ABGQJ9RDlPALmnrkI1kV7wKBgQC/AktUFFYRqMkxAq/XTvcws8iTvuhNSsE6qteyDQQ0ZjXWC3TPhjPmgFY7Xb6BDTWMtWFw6+wh22I7uJLz1PE3SkOoovpmcVrRb1l8+82nULgT5l/EQzTe46G0VIHd8KybLPr7HQ9y/O1BmijKZ8p+pk3TT4rhMB5D7+2ExKmqwQKBgQCbnRtnTaCSDw1NL/xTMreO3p80n7jXTlq0Qr936b5O2flovL7BGTVkT0NDAbl/YWLG7J+kuG/XIVAH/wfb9HqHzlaH2MNvJrDGd22Rb5X43RfwyUzkE1lf7LV/G7GnpTMooNurs86T/pAvHhyphcvtiY/RNPfJi24a5JOc9OPAMQKBgG32emiBs8ROJrFNYOJ8vmkenW90sWhiwLr8yu5As8/Bp9z85wZjIM8VNoqASIC6qwzSxxy7ZhqNUFt1pv7M0dU77tSyEOoi5RWrehPd/H5tWxen9HCq3m9a4Ke9Dg9JsVGVeGomzoqLKKsxtMhHnGlyZTLMwzKQiCGSVQ2yig70"; + // 支付宝公钥 + public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAw0SZTMd+pWkcVDyF3z8uMfd+6BU5xQZCyyQS+7UMsNlIMGvgtcJ42vmLa2YuwxPdElW5zB9vVgYkp3jjtOZKM/WZ8JCFW4wof/gUgeVu7YvckoQjQV3tUUSvAJSJ4dtvZ6J6Psbsz1mUL80a0U4vybp9Tsw56Kdj/rRIFsMSZeimjHiXi4cF56PWZbZVf86s6LAIqJ6iA/nom7o53957XX+tEpk5FU/KbsoAXgxWCPEmBnEFkPniCiola9fz1FEbHd4dPuFsawxnx/OQ6bjBcKL1NbujtSQ072whV1B2oj05GECsvlzknu38jQaoVnFzh6qCiqjllzJXx1VJ7waRiwIDAQAB"; + //映射地址,根据需要修改 + public static String neturl = "http://rmkole.natapp1.cc"; + // 服务器异步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问 + public static String notify_url = neturl+"/pay/notifyUrl"; + // 页面跳转同步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问 商户可以自定义同步跳转地址 + public static String return_url = neturl+"/pay/returnUrl"; + + // 请求网关地址 + public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do"; + // 编码 + public static String charset = "utf-8"; + // 日志记录目录 + public static String log_path = "C:\\"; + // RSA2 + public static String sign_type = "RSA2"; + + /** + * 写日志,方便测试(看网站需求,也可以改成把记录存入数据库) + * @param sWord 要写入日志里的文本内容 + */ + public static void logResult(String sWord) { + FileWriter writer = null; + try { + writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt"); + writer.write(sWord); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (writer != null) { + try { + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } +} diff --git a/payservice/src/main/java/com/woniu/controller/PayController.java b/payservice/src/main/java/com/woniu/controller/PayController.java new file mode 100644 index 0000000..3bf978d --- /dev/null +++ b/payservice/src/main/java/com/woniu/controller/PayController.java @@ -0,0 +1,224 @@ +package com.woniu.controller; + +import com.alibaba.fastjson.JSON; +import com.woniu.service.PayService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + + +@Controller +@RequestMapping("/pay") +public class PayController { + + Logger logger = LoggerFactory.getLogger("PayServiceImpl.class"); + @Autowired + private PayService payService; + +// @RequestMapping("/pay") +// public void pay(HttpServletResponse response) throws UnsupportedEncodingException { +// +//// // 商户订单号,商户网站订单系统中唯一订单号,必填 +//// String out_trade_no = new String(request.getParameter("WIDout_trade_no").getBytes("ISO-8859-1"),"UTF-8"); +//// // 订单名称,必填 +//// String subject = new String(request.getParameter("WIDsubject").getBytes("ISO-8859-1"),"UTF-8"); +//// System.out.println(subject); +//// // 付款金额,必填 +//// String total_amount=new String(request.getParameter("WIDtotal_amount").getBytes("ISO-8859-1"),"UTF-8"); +//// // 商品描述,可空 +//// String body = new String(request.getParameter("WIDbody").getBytes("ISO-8859-1"),"UTF-8"); +// // 商户订单号,商户网站订单系统中唯一订单号,必填 +//// String out_trade_no = new String(map.get("WIDout_trade_no").toString()); +//// // 订单名称,必填 +//// String subject = new String(map.get("WIDsubject").toString()); +//// System.out.println(subject); +//// // 付款金额,必填 +//// String total_amount=new String(map.get("WIDtotal_amount").toString()); +//// // 商品描述,可空 +//// String body = new String(map.get("WIDbody").toString()); +//// System.out.println(no); +// String out_trade_no = new String("70501111111S001111119".getBytes("ISO-8859-1"),"utf-8"); +// // 订单名称,必填 +// String subject = new String("订单:"+out_trade_no); +// System.out.println(subject); +// // 付款金额,必填 +// String total_amount=new String("0.01".getBytes("ISO-8859-1"),"utf-8"); +// // 商品描述,可空 +// String body = new String("测试".getBytes("ISO-8859-1"),"utf-8"); +// // 超时时间 可空 +// String timeout_express="2m"; +// // 销售产品码 必填QUICK_WAP_WAY +// String product_code="FAST_INSTANT_TRADE_PAY"; +// /**********************/ +// // SDK 公共请求类,包含公共请求参数,以及封装了签名与验签,开发者无需关注签名与验签 +// //调用RSA签名方式 +// AlipayClient client = new DefaultAlipayClient(AlipayConfig.URL, AlipayConfig.APPID, AlipayConfig.RSA_PRIVATE_KEY, "json", AlipayConfig.CHARSET, AlipayConfig.ALIPAY_PUBLIC_KEY,AlipayConfig.SIGNTYPE); +// AlipayTradeWapPayRequest alipay_request=new AlipayTradeWapPayRequest(); +// // 设置异步通知地址 +// alipay_request.setNotifyUrl(AlipayConfig.notify_url); +// // 设置同步地址 +// alipay_request.setReturnUrl(AlipayConfig.return_url); +// +// alipay_request.setBizContent("{\"out_trade_no\":\""+ out_trade_no +"\"," +// + "\"total_amount\":\""+ total_amount +"\"," +// + "\"subject\":\""+ subject +"\"," +// + "\"time_express\":\""+ timeout_express +"\"," +// + "\"product_code\":\""+product_code+"\"}"); +// +// // 封装请求支付信息 +//// AlipayTradeWapPayModel model=new AlipayTradeWapPayModel(); +//// model.setOutTradeNo(out_trade_no); +//// model.setSubject(subject); +//// model.setTotalAmount(total_amount); +//// model.setBody(body); +////// model.setTimeoutExpress(timeout_express); +//// model.setProductCode(product_code); +//// alipay_request.setBizModel(model); +// +// +// // form表单生产 +// String form = ""; +// try { +// // 调用SDK生成表单 +// form = client.pageExecute(alipay_request).getBody(); +// response.setContentType("text/html;charset=utf-8"); +// response.getWriter().println(form);//直接将完整的表单html输出到页面 +//// response.getWriter().flush(); +//// response.getWriter().close(); +// System.out.println(form); +// System.out.println("iiiiiiiiiiiiiii"); +// } catch (Exception e) { +// e.printStackTrace(); +// System.out.println("kkkkkkkkkkkkkkkk"); +// } +// } +// @RequestMapping("/notifyUrl") +// public void notifyUrl(HttpServletRequest request,HttpServletResponse response){ +// System.out.println("异步通知成功消息"); +// //获取支付宝POST过来反馈信息 +// Map params = new HashMap(); +// Map requestParams = request.getParameterMap(); +// for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) { +// String name = (String) iter.next(); +// System.out.println(name); +// String[] values = (String[]) requestParams.get(name); +// String valueStr = ""; +// for (int i = 0; i < values.length; i++) { +// valueStr = (i == values.length - 1) ? valueStr + values[i] +// : valueStr + values[i] + ","; +// } +// System.out.println(name+":"+valueStr); +// //乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化 +// //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "gbk"); +// params.put(name, valueStr); +// } +// +// //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表(以上仅供参考)// +// //计算得出通知验证结果 +// //boolean AlipaySignature.rsaCheckV1(Map params, String publicKey, String charset, String sign_type) +// boolean verify_result = false; +// try { +// verify_result = AlipaySignature.rsaCheckV1(params, AlipayConfig.ALIPAY_PUBLIC_KEY, AlipayConfig.CHARSET, "RSA2"); +// System.out.println(verify_result); +// } catch (AlipayApiException e) { +// e.printStackTrace(); +// } +// +// if(verify_result){//验证成功 +// ////////////////////////////////////////////////////////////////////////////////////////// +// //请在这里加上商户的业务逻辑程序代码 +// try { +// //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表(以下仅供参考)// +// //商户订单号 +// String out_trade_no = new String(request.getParameter("out_trade_no").getBytes("ISO-8859-1"),"UTF-8"); +// //支付宝交易号 +// String trade_no = new String(request.getParameter("trade_no").getBytes("ISO-8859-1"),"UTF-8"); +// //交易状态 +// String trade_status = new String(request.getParameter("trade_status").getBytes("ISO-8859-1"),"UTF-8"); +// System.out.println(trade_status); +// if(trade_status.equals("TRADE_FINISHED")){ +// //判断该笔订单是否在商户网站中已经做过处理 +// //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 +// //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的 +// //如果有做过处理,不执行商户的业务程序 +// System.out.println("************************"); +// //注意: +// //如果签约的是可退款协议,退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知 +// //如果没有签约可退款协议,那么付款完成后,支付宝系统发送该交易状态通知。 +// } else if (trade_status.equals("TRADE_SUCCESS")){ +// //判断该笔订单是否在商户网站中已经做过处理 +// //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 +// //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的 +// //如果有做过处理,不执行商户的业务程序 +// System.out.println("-----------------------"); +// //注意: +// //如果签约的是可退款协议,那么付款完成后,支付宝系统发送该交易状态通知。 +// } +// } catch (UnsupportedEncodingException e) { +// e.printStackTrace(); +// } +// //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— +// +// //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— +//// out.clear(); +// try { +// response.getWriter().println("success"); //请不要修改或删除 +// } catch (IOException e) { +// e.printStackTrace(); +// } +// +// ////////////////////////////////////////////////////////////////////////////////////////// +// }else{//验证失败 +// try { +// response.getWriter().println("fail"); +// System.out.println("jjjjjjjjjjjjjjjjjjj"); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } +// } + + @GetMapping("/pay") + public void pay(String no, HttpServletResponse response){ + Map map = new HashMap(); + map.put("subject","这是一个订单测试"); + map.put("out_trade_no",no); + map.put("timeout_express","10m"); + map.put("total_amount","0.01"); + map.put("product_code","FAST_INSTANT_TRADE_PAY"); + System.out.println(JSON.toJSON(map)); + String form = payService.payInfo(map); + try { + response.setContentType("text/html;charset=utf-8"); + response.getWriter().write(form); + response.getWriter().flush(); + response.getWriter().close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @RequestMapping("/notifyUrl") + @ResponseBody + public String notifyUrl(){ + logger.info("notify"); + return "这是异步通知"; + } + + @RequestMapping("/returnUrl") + @ResponseBody + public String returnUrl(){ + //同步到达率低,可以做一些页面跳转 + logger.info("returnUrl"); + return "这是一个同步通知"; + } +} diff --git a/payservice/src/main/java/com/woniu/service/PayService.java b/payservice/src/main/java/com/woniu/service/PayService.java new file mode 100644 index 0000000..858f55a --- /dev/null +++ b/payservice/src/main/java/com/woniu/service/PayService.java @@ -0,0 +1,8 @@ +package com.woniu.service; + +import java.util.Map; + +public interface PayService { + + String payInfo(Map map); +} diff --git a/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java b/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java new file mode 100644 index 0000000..02ef7ce --- /dev/null +++ b/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java @@ -0,0 +1,47 @@ +package com.woniu.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alipay.api.AlipayApiException; +import com.alipay.api.DefaultAlipayClient; +import com.alipay.api.request.AlipayTradeWapPayRequest; +import com.woniu.config.AlipayConfig; +import com.woniu.service.PayService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import java.util.Map; + +@Service +public class PayServiceImpl implements PayService { + + Logger logger = LoggerFactory.getLogger("PayServiceImpl.class"); + + public String payInfo(Map map){ + //创建一个Client实例,其值在config中 + DefaultAlipayClient client = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, + "json", "utf8", AlipayConfig.alipay_public_key,AlipayConfig.sign_type); + //发送数据,先将数据转为request,最后通过client发出去,使用fastjson的toString方法 + //支付方式 +// AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();// APP支付 +// AlipayTradePagePayRequest request = new AlipayTradePagePayRequest(); // 网页支付 + AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); //移动h5 + + + //异步同步通知跳转url + request.setNotifyUrl(AlipayConfig.notify_url); + request.setReturnUrl(AlipayConfig.return_url); + + request.setBizContent(JSON.toJSONString(map)); + logger.info(JSON.toJSONString(map)); + String response = null; + try { + response = client.pageExecute(request).getBody(); + logger.info(response); + } catch (AlipayApiException e) { + e.printStackTrace(); + } + + return response; + } +} diff --git a/payservice/src/main/java/com/woniu/util/logFile.java b/payservice/src/main/java/com/woniu/util/logFile.java new file mode 100644 index 0000000..d50d704 --- /dev/null +++ b/payservice/src/main/java/com/woniu/util/logFile.java @@ -0,0 +1,30 @@ +package com.woniu.util; + +import com.woniu.config.AlipayConfig; + +import java.io.FileWriter; +import java.io.IOException; + +public class logFile { + /** + * 写日志,方便测试(看网站需求,也可以改成把记录存入数据库) + * @param sWord 要写入日志里的文本内容 + */ + public static void logResult(String sWord) { + FileWriter writer = null; + try { + writer = new FileWriter(AlipayConfig.log_path + "alipay_log_" + System.currentTimeMillis()+".txt"); + writer.write(sWord); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (writer != null) { + try { + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } +} diff --git a/payservice/src/main/resources/application.yml b/payservice/src/main/resources/application.yml new file mode 100644 index 0000000..a8ee6ec --- /dev/null +++ b/payservice/src/main/resources/application.yml @@ -0,0 +1,24 @@ +spring: + datasource: + password: 20200322 + username: develop + url: jdbc:mysql://106.12.148.100:3307/happycommunity?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8 + driver-class-name: com.mysql.jdbc.Driver + jackson: + time-zone: GMT+8 + date-format: yyyy-MM-dd HH:mm + redis: + host: localhost + port: 6379 + application: + name: pay +mybatis: + configuration: + map-underscore-to-camel-case: true + mapper-locations: classpath:mapper/*.xml +server: + port: 8012 +eureka: + client: + service-url: + defaultZone: http://localhost:8761/eureka \ No newline at end of file diff --git a/payservice/src/test/java/com/woniu/payservice/PayserviceApplicationTests.java b/payservice/src/test/java/com/woniu/payservice/PayserviceApplicationTests.java new file mode 100644 index 0000000..cd18aef --- /dev/null +++ b/payservice/src/test/java/com/woniu/payservice/PayserviceApplicationTests.java @@ -0,0 +1,13 @@ +package com.woniu.payservice; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +class PayserviceApplicationTests { + + @Test + void contextLoads() { + } + +} -- Gitee From 622b8897fddc6a075d38e9dc8c1cebe47aac8a72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B6=B5?= <496989943@qq.com> Date: Tue, 31 Mar 2020 02:34:44 +0800 Subject: [PATCH 05/27] =?UTF-8?q?=E3=80=90=E7=B1=BB=E5=9E=8B=E3=80=91?= =?UTF-8?q?=E6=96=B0=E5=8A=9F=E8=83=BD=20=E3=80=90=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E3=80=911.=E5=AE=8C=E6=88=90app=E9=A6=96=E9=A1=B5=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=EF=BC=9B2.=E5=AE=8C=E6=88=90=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5=EF=BC=9B3.=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=95=86=E5=93=81=E7=9A=84=E8=B4=AD=E4=B9=B0=E6=B5=81?= =?UTF-8?q?=E7=A8=8B=EF=BC=9B4.=E5=AE=8C=E6=88=90=E5=9C=B0=E5=9D=80?= =?UTF-8?q?=E7=9A=84=E9=80=89=E7=94=A8=EF=BC=9B5.=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E7=9A=84=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5?= =?UTF-8?q?=EF=BC=9B6.=E5=AE=8C=E6=88=90=E9=A1=B9=E7=9B=AE=E5=9F=BA?= =?UTF-8?q?=E6=9C=AC=E8=A6=81=E6=B1=82=20=E3=80=90=E7=A8=8B=E5=BA=8F?= =?UTF-8?q?=E3=80=91com.woniu.....?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gatway/src/main/resources/application.yml | 2 +- marketservice/pom.xml | 6 +- .../controller/AnnouncementController.java | 25 ++- .../CommunityActivityController.java | 22 ++- .../CommunityActivityUserController.java | 63 +++++++ .../PersonUserAddressController.java | 15 +- .../controller/PersonUserController.java | 76 ++++++++- .../UsedProductConsigneeController.java | 112 +++++++++++++ .../controller/UsedProductController.java | 56 ++++++- .../controller/UsedProductImgsController.java | 7 +- .../UsedProductOrderController.java | 157 ++++++++++++++++++ .../java/com/woniu/dao/AnnouncementDao.java | 4 + .../com/woniu/dao/CommunityActivityDao.java | 4 + .../woniu/dao/CommunityActivityUserDao.java | 69 ++++++++ .../java/com/woniu/dao/PersonImageDao.java | 3 + .../java/com/woniu/dao/PersonUserDao.java | 6 + .../woniu/dao/UsedProductConsigneeDao.java | 69 ++++++++ .../java/com/woniu/dao/UsedProductDao.java | 7 +- .../com/woniu/dao/UsedProductImgsDao.java | 2 +- .../com/woniu/dao/UsedProductOrderDao.java | 77 +++++++++ .../java/com/woniu/entity/Announcement.java | 15 +- .../woniu/entity/CommunityActivityUser.java | 49 ++++++ .../woniu/entity/UsedProductConsignee.java | 87 ++++++++++ .../com/woniu/entity/UsedProductOrder.java | 137 +++++++++++++++ .../woniu/service/AnnouncementService.java | 1 + .../service/CommunityActivityService.java | 1 + .../service/CommunityActivityUserService.java | 56 +++++++ .../com/woniu/service/PersonImageService.java | 3 + .../com/woniu/service/PersonUserService.java | 4 + .../service/UsedProductConsigneeService.java | 56 +++++++ .../service/UsedProductOrderService.java | 62 +++++++ .../com/woniu/service/UsedProductService.java | 6 + .../service/impl/AnnouncementServiceImpl.java | 5 + .../impl/CommunityActivityServiceImpl.java | 5 + .../CommunityActivityUserServiceImpl.java | 84 ++++++++++ .../service/impl/PersonImageServiceImpl.java | 6 + .../service/impl/PersonUserServiceImpl.java | 10 ++ .../impl/UsedProductConsigneeServiceImpl.java | 84 ++++++++++ .../impl/UsedProductOrderServiceImpl.java | 95 +++++++++++ .../service/impl/UsedProductServiceImpl.java | 11 ++ .../src/main/resources/application.yml | 6 +- .../mapper/CommunityActivityUserDao.xml | 70 ++++++++ .../main/resources/mapper/PersonImageDao.xml | 8 + .../mapper/UsedProductConsigneeDao.xml | 91 ++++++++++ .../main/resources/mapper/UsedProductDao.xml | 7 + .../resources/mapper/UsedProductOrderDao.xml | 112 +++++++++++++ .../woniu/MarketserviceApplicationTests.java | 5 + 47 files changed, 1826 insertions(+), 32 deletions(-) create mode 100644 marketservice/src/main/java/com/woniu/controller/CommunityActivityUserController.java create mode 100644 marketservice/src/main/java/com/woniu/controller/UsedProductConsigneeController.java create mode 100644 marketservice/src/main/java/com/woniu/controller/UsedProductOrderController.java create mode 100644 marketservice/src/main/java/com/woniu/dao/CommunityActivityUserDao.java create mode 100644 marketservice/src/main/java/com/woniu/dao/UsedProductConsigneeDao.java create mode 100644 marketservice/src/main/java/com/woniu/dao/UsedProductOrderDao.java create mode 100644 marketservice/src/main/java/com/woniu/entity/CommunityActivityUser.java create mode 100644 marketservice/src/main/java/com/woniu/entity/UsedProductConsignee.java create mode 100644 marketservice/src/main/java/com/woniu/entity/UsedProductOrder.java create mode 100644 marketservice/src/main/java/com/woniu/service/CommunityActivityUserService.java create mode 100644 marketservice/src/main/java/com/woniu/service/UsedProductConsigneeService.java create mode 100644 marketservice/src/main/java/com/woniu/service/UsedProductOrderService.java create mode 100644 marketservice/src/main/java/com/woniu/service/impl/CommunityActivityUserServiceImpl.java create mode 100644 marketservice/src/main/java/com/woniu/service/impl/UsedProductConsigneeServiceImpl.java create mode 100644 marketservice/src/main/java/com/woniu/service/impl/UsedProductOrderServiceImpl.java create mode 100644 marketservice/src/main/resources/mapper/CommunityActivityUserDao.xml create mode 100644 marketservice/src/main/resources/mapper/UsedProductConsigneeDao.xml create mode 100644 marketservice/src/main/resources/mapper/UsedProductOrderDao.xml diff --git a/gatway/src/main/resources/application.yml b/gatway/src/main/resources/application.yml index f1193bc..d9ad6ad 100644 --- a/gatway/src/main/resources/application.yml +++ b/gatway/src/main/resources/application.yml @@ -15,7 +15,7 @@ spring: eureka: client: service-url: - defaultZone: http://106.12.148.100:8081/registor-0.1/eureka + defaultZone: http://localhost:8761/eureka server: port: 9100 ribbon: diff --git a/marketservice/pom.xml b/marketservice/pom.xml index 10459a6..8e84658 100644 --- a/marketservice/pom.xml +++ b/marketservice/pom.xml @@ -52,9 +52,9 @@ - com.alibaba - fastjson - 1.2.3 + com.fasterxml.jackson.core + jackson-annotations + 2.9.10 diff --git a/marketservice/src/main/java/com/woniu/controller/AnnouncementController.java b/marketservice/src/main/java/com/woniu/controller/AnnouncementController.java index 551420e..b6466c9 100644 --- a/marketservice/src/main/java/com/woniu/controller/AnnouncementController.java +++ b/marketservice/src/main/java/com/woniu/controller/AnnouncementController.java @@ -1,10 +1,13 @@ package com.woniu.controller; +import com.woniu.common.CommonResult; import com.woniu.entity.Announcement; import com.woniu.service.AnnouncementService; +import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.List; /** * 小区物业公告信息(Announcement)表控制层 @@ -12,8 +15,8 @@ import javax.annotation.Resource; * @author makejava * @since 2020-03-29 21:50:50 */ -@RestController -@RequestMapping("announcement") +@Controller +@RequestMapping("/announcement") public class AnnouncementController { /** * 服务对象 @@ -21,6 +24,24 @@ public class AnnouncementController { @Resource private AnnouncementService announcementService; + /** + * 功能描述: 查询最后三条公告数据 + * @Param: [] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/30 0:15 + */ + @GetMapping("/findAll") + public @ResponseBody CommonResult findAll(){ + try { + List announcements = announcementService.findAllByThree(); + return CommonResult.success(announcements); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("查询失败"); + } + } + /** * 通过主键查询单条数据 * diff --git a/marketservice/src/main/java/com/woniu/controller/CommunityActivityController.java b/marketservice/src/main/java/com/woniu/controller/CommunityActivityController.java index 5bf598b..8ea2c3c 100644 --- a/marketservice/src/main/java/com/woniu/controller/CommunityActivityController.java +++ b/marketservice/src/main/java/com/woniu/controller/CommunityActivityController.java @@ -1,10 +1,12 @@ package com.woniu.controller; +import com.woniu.common.CommonResult; import com.woniu.entity.CommunityActivity; import com.woniu.service.CommunityActivityService; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.List; /** * (CommunityActivity)表控制层 @@ -13,7 +15,7 @@ import javax.annotation.Resource; * @since 2020-03-29 21:49:13 */ @RestController -@RequestMapping("communityActivity") +@RequestMapping("/communityActivity") public class CommunityActivityController { /** * 服务对象 @@ -21,6 +23,24 @@ public class CommunityActivityController { @Resource private CommunityActivityService communityActivityService; + /** + * 功能描述: 查询最火的三条活动(根据参与人数判断,并且不为已经结束的活动) + * @Param: [] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/30 0:59 + */ + @GetMapping("/selectActivity") + public CommonResult selectActivity(){ + try { + List activities = communityActivityService.selectActivity(); + return CommonResult.success(activities); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("查询活动失败"); + } + } + /** * 通过主键查询单条数据 * diff --git a/marketservice/src/main/java/com/woniu/controller/CommunityActivityUserController.java b/marketservice/src/main/java/com/woniu/controller/CommunityActivityUserController.java new file mode 100644 index 0000000..927028a --- /dev/null +++ b/marketservice/src/main/java/com/woniu/controller/CommunityActivityUserController.java @@ -0,0 +1,63 @@ +package com.woniu.controller; + +import com.woniu.common.CommonResult; +import com.woniu.entity.CommunityActivityUser; +import com.woniu.entity.PersonUser; +import com.woniu.service.CommunityActivityUserService; +import com.woniu.service.PersonUserService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; + +/** + * (CommunityActivityUser)表控制层 + * + * @author makejava + * @since 2020-03-30 02:11:07 + */ +@RestController +@RequestMapping("/communityActivityUser") +public class CommunityActivityUserController { + /** + * 服务对象 + */ + @Resource + private CommunityActivityUserService communityActivityUserService; + + @Resource + PersonUserService personUserService; + + /** + * 功能描述: 根据活动Id查询发起用户昵称 + * @Param: [id] 活动Id + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/30 2:13 + */ + @GetMapping("/findUserNameByActivity/{id}") + public CommonResult findUserNameByActivity(@PathVariable("id") Integer id){ + try { + //用户Id + Integer userId = communityActivityUserService.findUserNameByActivity(id); + //根据用户Id查询昵称 + PersonUser personUser = personUserService.queryById(userId); + return CommonResult.success(personUser.getNickname()); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("查询失败"); + } + + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("selectOne") + public CommunityActivityUser selectOne(Integer id) { + return this.communityActivityUserService.queryById(id); + } + +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/controller/PersonUserAddressController.java b/marketservice/src/main/java/com/woniu/controller/PersonUserAddressController.java index 44b3a4b..197e605 100644 --- a/marketservice/src/main/java/com/woniu/controller/PersonUserAddressController.java +++ b/marketservice/src/main/java/com/woniu/controller/PersonUserAddressController.java @@ -55,18 +55,11 @@ public class PersonUserAddressController { Integer userId = personUser.getId(); //根据用户Id查询详细地址 List address = personUserAddressService.findAllAddressByUserId(userId); - ArrayList areainfos = new ArrayList<>(); - for (PersonUserAddress addr:address) { - if (addr.getAreaId() != null){ - Areainfo areainfo = areainfoService.queryById(addr.getAreaId()); - areainfos.add(areainfo); - } - } - //把数据存入map中,传到前端 - Map map = new HashMap(); - map.put("personUser",personUser); + //根据用户Id查询用户信息 + PersonUser user = personUserService.queryById(userId); + Map map = new HashMap<>(); + map.put("user",user); map.put("address",address); - map.put("areainfos",areainfos); return CommonResult.success(map); } diff --git a/marketservice/src/main/java/com/woniu/controller/PersonUserController.java b/marketservice/src/main/java/com/woniu/controller/PersonUserController.java index 84b5c6a..f5fdb02 100644 --- a/marketservice/src/main/java/com/woniu/controller/PersonUserController.java +++ b/marketservice/src/main/java/com/woniu/controller/PersonUserController.java @@ -1,10 +1,15 @@ package com.woniu.controller; +import com.woniu.common.CommonResult; +import com.woniu.common.CookieUtil; +import com.woniu.entity.PersonImage; import com.woniu.entity.PersonUser; +import com.woniu.service.PersonImageService; import com.woniu.service.PersonUserService; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.*; /** * (PersonUser)表控制层 @@ -13,7 +18,7 @@ import javax.annotation.Resource; * @since 2020-03-24 19:04:31 */ @RestController -@RequestMapping("personUser") +@RequestMapping("/personUser") public class PersonUserController { /** * 服务对象 @@ -21,6 +26,75 @@ public class PersonUserController { @Resource private PersonUserService personUserService; + @Resource + PersonImageService personImageService; + + @Resource + CookieUtil cookieUtil; + + /** + * 功能描述: 查询当前用户所属小区的所有人的昵称以及头像url + * @Param: [] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/30 2:53 + */ + @GetMapping("/peopleNearby") + public CommonResult peopleNearby(){ + //当前登录用户名 +// String name = cookieUtil.getName(); + //查询当前用户所属小区 + String name = "admin"; + //当前用户信息 + PersonUser personUser = personUserService.findIdByName(name); + Integer plotId = personUserService.findPlotIdByUserId(personUser.getPlotId()); + //查询小区中的最后三个人 + List personUsers = personUserService.findPersonByPoltId(plotId); + ArrayList userId = new ArrayList<>(); + ArrayList nickNames = new ArrayList<>(); + for (PersonUser person:personUsers) { + userId.add(person.getId()); + nickNames.add(person.getNickname()); + } + //查询这三个人的头像 + List personImages = personImageService.findImgByListUserId(userId); + ArrayList images = new ArrayList<>(); + for (PersonImage pImage:personImages) { + images.add(pImage.getUrl()); + } + Map map = new HashMap<>(); + map.put("nickNames",nickNames); + map.put("images",images); + return CommonResult.success(map); + } + + /** + * 功能描述: 根据用户Id查询用户昵称 + * @Param: [] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/30 2:53 + */ + @GetMapping("/findCurrentUserName") + public CommonResult findCurrentUserName(){ + //当前登录用户名 +// String name = cookieUtil.getName(); +// if (name == null){ +// return CommonResult.success("未登录"); +// } + String name = "admin"; + //根据用户名查询用户昵称 + try { + String nickName = personUserService.findNickNameByName(name); + return CommonResult.success(nickName); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + + + } + /** * 通过主键查询单条数据 * diff --git a/marketservice/src/main/java/com/woniu/controller/UsedProductConsigneeController.java b/marketservice/src/main/java/com/woniu/controller/UsedProductConsigneeController.java new file mode 100644 index 0000000..3ff1281 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/controller/UsedProductConsigneeController.java @@ -0,0 +1,112 @@ +package com.woniu.controller; + +import com.woniu.common.CommonResult; +import com.woniu.entity.PersonUser; +import com.woniu.entity.UsedProductConsignee; +import com.woniu.service.PersonUserService; +import com.woniu.service.UsedProductConsigneeService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 二手市场收货信息表(UsedProductConsignee)表控制层 + * + * @author makejava + * @since 2020-03-30 22:08:16 + */ +@RestController +@RequestMapping("/usedProductConsignee") +public class UsedProductConsigneeController { + /** + * 服务对象 + */ + @Resource + private UsedProductConsigneeService usedProductConsigneeService; + + @Resource + PersonUserService personUserService; + + /** + * 功能描述: 根据收货Id查询收货信息 + * @Param: [consigneeId] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/30 22:57 + */ + @GetMapping("/findByConsigneeId/{consigneeId}") + public CommonResult findByConsigneeId(@PathVariable("consigneeId")Integer consigneeId){ + if (consigneeId != null){ + try { + UsedProductConsignee usedProductConsignee = usedProductConsigneeService.queryById(consigneeId); + return CommonResult.success("查询成功",usedProductConsignee); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("查询失败"); + } + } + return CommonResult.success(1); + } + + /** + * 功能描述: 根据当前用户查询收货信息 + * @Param: [] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/30 22:26 + */ + @GetMapping("/findAllByUserId") + public CommonResult findAllByUserId(){ + //获取当前登录的用户的用户名 +// String name = cookieUtil.getName(); + String name = "admin"; + //查询用户Id + PersonUser personUser = personUserService.findIdByName(name); + try { + List usedProductConsignees = usedProductConsigneeService.findAllByUserId(personUser.getId()); + return CommonResult.success("查询成功",usedProductConsignees); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("查询失败"); + } + + } + + /** + * 功能描述: 保存收货人信息 + * @Param: [usedProductConsignee] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/30 21:53 + */ + @PostMapping("/saveConsignee") + public CommonResult saveConsignee(UsedProductConsignee usedProductConsignee){ + //获取当前登录的用户的用户名 +// String name = cookieUtil.getName(); + String name = "admin"; + //查询用户Id + PersonUser personUser = personUserService.findIdByName(name); + usedProductConsignee.setUserId(personUser.getId()); + try { + UsedProductConsignee productConsignee = usedProductConsigneeService.insert(usedProductConsignee); + return CommonResult.success("保存成功",productConsignee.getId()); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.success("保存失败"); + } + + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("selectOne") + public UsedProductConsignee selectOne(Integer id) { + return this.usedProductConsigneeService.queryById(id); + } + +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/controller/UsedProductController.java b/marketservice/src/main/java/com/woniu/controller/UsedProductController.java index 8fa2e4e..2aac44d 100644 --- a/marketservice/src/main/java/com/woniu/controller/UsedProductController.java +++ b/marketservice/src/main/java/com/woniu/controller/UsedProductController.java @@ -1,6 +1,5 @@ package com.woniu.controller; -import com.alibaba.fastjson.JSONObject; import com.woniu.common.CommonResult; import com.woniu.common.CookieUtil; import com.woniu.common.QiniuUploadUtil; @@ -41,11 +40,55 @@ public class UsedProductController { @Resource UsedProductImgsService usedProductImgsService; + @Resource + UsedProductOrderService usedProductOrderService; + @Resource CookieUtil cookieUtil; private String imgUrl; + /** + * 功能描述: 查询未付款的商品 + * @Param: [] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/31 1:06 + */ + @GetMapping("/nopayProduct") + public @ResponseBody CommonResult nopayProduct(){ + //获取当前登录的用户的用户名 +// String name = cookieUtil.getName(); + String name = "admin"; + //查询用户Id + PersonUser personUser = personUserService.findIdByName(name); + //未付款 + Integer orderStatus = 0; + //二手市场商品 + Integer orderType = 1; + ArrayList productIdList = usedProductOrderService.findProductIdByPayStatus(personUser.getId(), orderStatus, orderType); + if (productIdList == null){ + return CommonResult.failed("当前暂无数据"); + } + //查询商品数据 + ArrayList usedProducts = new ArrayList<>(); + for (Integer id:productIdList) { + UsedProduct usedProduct = usedProductService.queryById(id); + usedProducts.add(usedProduct); + } + return CommonResult.success("查询成功",usedProducts); + + + + } + + /** + * 功能描述: 更新商品信息 + * @Param: [usedProduct] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/31 1:06 + */ @PutMapping("/updateProduct") public @ResponseBody CommonResult updateProduct(UsedProduct usedProduct){ try { @@ -357,7 +400,7 @@ public class UsedProductController { productImgs.setProductId(usedProduct1.getId()); usedProductImgsService.insert(productImgs); imgUrl = null; - return CommonResult.success("商品发布成功"); + return CommonResult.success(usedProduct1.getId()); } catch (Exception e) { e.printStackTrace(); return CommonResult.failed("商品发布失败"); @@ -416,12 +459,15 @@ public class UsedProductController { * @Author: yanghan * @Date: 2020/3/24 16:02 */ - @GetMapping("/findAreainfo/{userId}") - public @ResponseBody CommonResult findAreainfo(@PathVariable("userId") Integer userId){ + @GetMapping("/findAreainfo") + public @ResponseBody CommonResult findAreainfo(){ + String name = "admin"; + //查询用户Id + PersonUser personUser = personUserService.findIdByName(name); Areainfo areainfo = null; try { //根据用户Id查询所属小区 - Integer plotId = personUserService.findPlotIdByUserId(userId); + Integer plotId = personUserService.findPlotIdByUserId(personUser.getId()); //查询小区信息 areainfo = areainfoService.findAllByPlotId(plotId); // return CommonResult.success(areainfo); diff --git a/marketservice/src/main/java/com/woniu/controller/UsedProductImgsController.java b/marketservice/src/main/java/com/woniu/controller/UsedProductImgsController.java index 7dcc2b8..5ad6398 100644 --- a/marketservice/src/main/java/com/woniu/controller/UsedProductImgsController.java +++ b/marketservice/src/main/java/com/woniu/controller/UsedProductImgsController.java @@ -36,10 +36,13 @@ public class UsedProductImgsController { //根据商品类型查找商品 List usedProducts = usedProductService.findAllByTypeId(typeId); ArrayList imgsAll = new ArrayList<>(); - for (int i = 0 ; i < 3 ; i++){ - List imgs = usedProductImgsService.findImgsByProductId(usedProducts.get(i).getId()); + for (UsedProduct u:usedProducts) { + List imgs = usedProductImgsService.findImgsByProductId(u.getId()); imgsAll.add(imgs.get(0).getImgUrl()); } + + + return CommonResult.success(imgsAll); } diff --git a/marketservice/src/main/java/com/woniu/controller/UsedProductOrderController.java b/marketservice/src/main/java/com/woniu/controller/UsedProductOrderController.java new file mode 100644 index 0000000..e288192 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/controller/UsedProductOrderController.java @@ -0,0 +1,157 @@ +package com.woniu.controller; + +import ch.qos.logback.core.rolling.helper.IntegerTokenConverter; +import com.woniu.common.CommonResult; +import com.woniu.entity.PersonUser; +import com.woniu.entity.UsedProduct; +import com.woniu.entity.UsedProductOrder; +import com.woniu.service.PersonUserService; +import com.woniu.service.UsedProductOrderService; +import com.woniu.service.UsedProductService; +import org.apache.ibatis.annotations.Delete; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; + +/** + * 二手市场订单表(UsedProductOrder)表控制层 + * + * @author makejava + * @since 2020-03-30 22:08:16 + */ +@RestController +@RequestMapping("usedProductOrder") +public class UsedProductOrderController { + /** + * 服务对象 + */ + @Resource + private UsedProductOrderService usedProductOrderService; + + @Resource + PersonUserService personUserService; + + @Resource + UsedProductService usedProductService; + + @DeleteMapping("/deleteOrder/{productId}") + public CommonResult deleteOrder(@PathVariable("productId")Integer productId){ + //获取当前登录用户Id + //获取当前登录的用户的用户名 +// String name = cookieUtil.getName(); + String name = "admin"; + //查询用户Id + PersonUser personUser = personUserService.findIdByName(name); + Integer orderType = 1; + //删除订单 + try { + usedProductOrderService.deleteOrderByProductId(personUser.getId(),productId,orderType); + return CommonResult.success("删除未付款商品成功"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("删除失败"); + } + } + + /** + * 功能描述: 获取订单数据 + * @Param: [productId] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/31 0:54 + */ + @GetMapping("/findOrderByProductId/{productId}") + public CommonResult findOrderByProductId(@PathVariable("productId")Integer productId){ + //获取当前登录用户Id + //获取当前登录的用户的用户名 +// String name = cookieUtil.getName(); + String name = "admin"; + //查询用户Id + PersonUser personUser = personUserService.findIdByName(name); + //订单类型(0:服务,1:二手市场) + Integer i = 1; + //根据用户Id、商品Id、订单类型查询数据 + try { + UsedProductOrder order = usedProductOrderService.findOrderByProductId(personUser.getId(), productId, i); + return CommonResult.success("查询订单成功",order); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("查询失败"); + } + } + + /** + * 功能描述: 生成订单信息,保存到数据库 + * @Param: [productId] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/31 0:21 + */ + @PostMapping("/createOrder/{productId}") + public CommonResult createOrder(@PathVariable("productId")Integer productId){ + UsedProductOrder order = new UsedProductOrder(); + order.setProductId(productId); + //获取当前登录用户Id + //获取当前登录的用户的用户名 +// String name = cookieUtil.getName(); + String name = "admin"; + //查询用户Id + PersonUser personUser = personUserService.findIdByName(name); + //根据商品Id查询商品发布人的Id + Integer issueUserId = usedProductService.findUserIdByProductId(productId); + //判断当前登录用户是否购买商品用户 + if (issueUserId == personUser.getId()){ + return CommonResult.failed("不能购买自己发布的商品"); + } + //根据当前用户Id、商品Id查询当前用户是否有此订单 + UsedProductOrder order1 = usedProductOrderService.findOrderByProductId(personUser.getId(), productId, 1); + if (order1 == null){ + order.setUserId(personUser.getId()); + //设置为二手市场商品类型 + order.setProductOrderType(1); + //根据商品id查询商品信息 + UsedProduct usedProduct = usedProductService.queryById(productId); + //生成订单号 + String random = UUID.randomUUID().toString(); + String uuid = random.replaceAll("-", ""); + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + String date = sdf.format(new Date()); + String ordernumber = uuid+date; + order.setOrderNumber(ordernumber); + order.setOrderName("用户:"+personUser.getNickname()+"的"+usedProduct.getProductName()+"订单"); + order.setOrderMoney(usedProduct.getSsellingPrice()); + System.out.println(order.toString()); + //订单状态(0:未支付,1:已支付) + order.setOrderStatus(0); + //将数据添加到数据库中 + try { + usedProductOrderService.insert(order); + return CommonResult.success("生成订单成功"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("订单生成失败"); + } + } + return CommonResult.failed("当前商品已有未付款订单!"); + + + + + + } + + /** + * 通过主键查询单条数据 + * + * @param id 主键 + * @return 单条数据 + */ + @GetMapping("selectOne") + public UsedProductOrder selectOne(Integer id) { + return this.usedProductOrderService.queryById(id); + } + +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/dao/AnnouncementDao.java b/marketservice/src/main/java/com/woniu/dao/AnnouncementDao.java index 42d824c..72abc21 100644 --- a/marketservice/src/main/java/com/woniu/dao/AnnouncementDao.java +++ b/marketservice/src/main/java/com/woniu/dao/AnnouncementDao.java @@ -2,6 +2,8 @@ package com.woniu.dao; import com.woniu.entity.Announcement; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + import java.util.List; /** @@ -62,4 +64,6 @@ public interface AnnouncementDao { */ int deleteById(Integer id); + @Select("select * from announcement where status = 0 order by id desc limit 3") + List findAllByThree(); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/dao/CommunityActivityDao.java b/marketservice/src/main/java/com/woniu/dao/CommunityActivityDao.java index 78142f8..1c8f018 100644 --- a/marketservice/src/main/java/com/woniu/dao/CommunityActivityDao.java +++ b/marketservice/src/main/java/com/woniu/dao/CommunityActivityDao.java @@ -2,6 +2,8 @@ package com.woniu.dao; import com.woniu.entity.CommunityActivity; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + import java.util.List; /** @@ -62,4 +64,6 @@ public interface CommunityActivityDao { */ int deleteById(Integer id); + @Select("select * from community_activity where ca_status <> 2 order by ca_peopel_count desc limit 3") + List selectActivity(); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/dao/CommunityActivityUserDao.java b/marketservice/src/main/java/com/woniu/dao/CommunityActivityUserDao.java new file mode 100644 index 0000000..6a71808 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/dao/CommunityActivityUserDao.java @@ -0,0 +1,69 @@ +package com.woniu.dao; + +import com.woniu.entity.CommunityActivityUser; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * (CommunityActivityUser)表数据库访问层 + * + * @author makejava + * @since 2020-03-30 02:11:07 + */ +public interface CommunityActivityUserDao { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + CommunityActivityUser queryById(Integer id); + + /** + * 查询指定行数据 + * + * @param offset 查询起始位置 + * @param limit 查询条数 + * @return 对象列表 + */ + List queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit); + + + /** + * 通过实体作为筛选条件查询 + * + * @param communityActivityUser 实例对象 + * @return 对象列表 + */ + List queryAll(CommunityActivityUser communityActivityUser); + + /** + * 新增数据 + * + * @param communityActivityUser 实例对象 + * @return 影响行数 + */ + int insert(CommunityActivityUser communityActivityUser); + + /** + * 修改数据 + * + * @param communityActivityUser 实例对象 + * @return 影响行数 + */ + int update(CommunityActivityUser communityActivityUser); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + + @Select("select cau_user_id from community_activity_user where cau_activity_id = #{value}") + Integer findUserNameByActivity(Integer id); +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/dao/PersonImageDao.java b/marketservice/src/main/java/com/woniu/dao/PersonImageDao.java index 2de909a..a8bc9da 100644 --- a/marketservice/src/main/java/com/woniu/dao/PersonImageDao.java +++ b/marketservice/src/main/java/com/woniu/dao/PersonImageDao.java @@ -2,6 +2,8 @@ package com.woniu.dao; import com.woniu.entity.PersonImage; import org.apache.ibatis.annotations.Param; + +import java.util.ArrayList; import java.util.List; /** @@ -62,4 +64,5 @@ public interface PersonImageDao { */ int deleteById(Integer id); + List findImgByListUserId(ArrayList userId); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/dao/PersonUserDao.java b/marketservice/src/main/java/com/woniu/dao/PersonUserDao.java index 96e16e1..fc2ea5e 100644 --- a/marketservice/src/main/java/com/woniu/dao/PersonUserDao.java +++ b/marketservice/src/main/java/com/woniu/dao/PersonUserDao.java @@ -76,4 +76,10 @@ public interface PersonUserDao { @Select("select * from person_user where name = #{value}") PersonUser findIdByName(String name); + + @Select("select nickname from person_user where name = #{value}") + String findNickNameByName(String name); + + @Select("select id,nickname from person_user where plot_id = #{value} order by id desc limit 3") + List findPersonByPoltId(Integer plotId); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/dao/UsedProductConsigneeDao.java b/marketservice/src/main/java/com/woniu/dao/UsedProductConsigneeDao.java new file mode 100644 index 0000000..835965b --- /dev/null +++ b/marketservice/src/main/java/com/woniu/dao/UsedProductConsigneeDao.java @@ -0,0 +1,69 @@ +package com.woniu.dao; + +import com.woniu.entity.UsedProductConsignee; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +/** + * 二手市场收货信息表(UsedProductConsignee)表数据库访问层 + * + * @author makejava + * @since 2020-03-30 22:08:16 + */ +public interface UsedProductConsigneeDao { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + UsedProductConsignee queryById(Integer id); + + /** + * 查询指定行数据 + * + * @param offset 查询起始位置 + * @param limit 查询条数 + * @return 对象列表 + */ + List queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit); + + + /** + * 通过实体作为筛选条件查询 + * + * @param usedProductConsignee 实例对象 + * @return 对象列表 + */ + List queryAll(UsedProductConsignee usedProductConsignee); + + /** + * 新增数据 + * + * @param usedProductConsignee 实例对象 + * @return 影响行数 + */ + int insert(UsedProductConsignee usedProductConsignee); + + /** + * 修改数据 + * + * @param usedProductConsignee 实例对象 + * @return 影响行数 + */ + int update(UsedProductConsignee usedProductConsignee); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + + @Select("select * from used_product_consignee where user_id = #{value}") + List findAllByUserId(Integer id); +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/dao/UsedProductDao.java b/marketservice/src/main/java/com/woniu/dao/UsedProductDao.java index 4afc6c2..dcce517 100644 --- a/marketservice/src/main/java/com/woniu/dao/UsedProductDao.java +++ b/marketservice/src/main/java/com/woniu/dao/UsedProductDao.java @@ -3,7 +3,6 @@ package com.woniu.dao; import com.woniu.entity.UsedProduct; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; - import java.util.List; /** @@ -64,6 +63,8 @@ public interface UsedProductDao { */ int deleteById(Integer id); + List findAllByProductIdList(List productIdList); + @Select("select * from used_product where product_type_id = #{value} and status = 0 order by id desc") List findAllByTypeId(Integer typeId); @@ -78,4 +79,8 @@ public interface UsedProductDao { @Select("select * from used_product where user_id = #{value} and status = 1 order by id desc") List findTradeProductByUserId(Integer id); + + + @Select("select user_id from used_product where id = #{value}") + Integer findUserIdByProductId(Integer productId); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/dao/UsedProductImgsDao.java b/marketservice/src/main/java/com/woniu/dao/UsedProductImgsDao.java index 8c0ff0c..b18f472 100644 --- a/marketservice/src/main/java/com/woniu/dao/UsedProductImgsDao.java +++ b/marketservice/src/main/java/com/woniu/dao/UsedProductImgsDao.java @@ -65,7 +65,7 @@ public interface UsedProductImgsDao { */ int deleteById(Integer id); - @Select("select img_url from used_product_imgs where product_id = #{productId} order by id desc") + @Select("select img_url from used_product_imgs where product_id = #{productId} order by id desc limit 3") List findImgsByProductId(Integer productId); @Delete("delete from used_product_imgs where product_id = #{value}") diff --git a/marketservice/src/main/java/com/woniu/dao/UsedProductOrderDao.java b/marketservice/src/main/java/com/woniu/dao/UsedProductOrderDao.java new file mode 100644 index 0000000..6b75acc --- /dev/null +++ b/marketservice/src/main/java/com/woniu/dao/UsedProductOrderDao.java @@ -0,0 +1,77 @@ +package com.woniu.dao; + +import com.woniu.entity.UsedProductOrder; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.ArrayList; +import java.util.List; + +/** + * 二手市场订单表(UsedProductOrder)表数据库访问层 + * + * @author makejava + * @since 2020-03-30 22:08:16 + */ +public interface UsedProductOrderDao { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + UsedProductOrder queryById(Integer id); + + /** + * 查询指定行数据 + * + * @param offset 查询起始位置 + * @param limit 查询条数 + * @return 对象列表 + */ + List queryAllByLimit(@Param("offset") int offset, @Param("limit") int limit); + + + /** + * 通过实体作为筛选条件查询 + * + * @param usedProductOrder 实例对象 + * @return 对象列表 + */ + List queryAll(UsedProductOrder usedProductOrder); + + /** + * 新增数据 + * + * @param usedProductOrder 实例对象 + * @return 影响行数 + */ + int insert(UsedProductOrder usedProductOrder); + + /** + * 修改数据 + * + * @param usedProductOrder 实例对象 + * @return 影响行数 + */ + int update(UsedProductOrder usedProductOrder); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 影响行数 + */ + int deleteById(Integer id); + + @Select("select * from used_product_order where user_id = #{id} and product_id = #{productId} and product_order_type = #{i}") + UsedProductOrder findOrderByProductId(@Param("id") Integer id, @Param("productId") Integer productId,@Param("i") int i); + + @Select("select product_id from used_product_order where user_id = #{id} and order_status =#{orderStatus} and product_order_type = #{orderType}") + ArrayList findProductIdByPayStatus(@Param(("id")) Integer id, @Param("orderStatus") Integer orderStatus, @Param("orderType") Integer orderType); + + @Delete("delete from used_product_order where user_id = #{id} and product_id = #{productId} and product_order_type = #{orderType}") + void deleteOrderByProductId(@Param("id") Integer id,@Param("productId") Integer productId,@Param("orderType") Integer orderType); +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/entity/Announcement.java b/marketservice/src/main/java/com/woniu/entity/Announcement.java index 0c7e266..d2e710a 100644 --- a/marketservice/src/main/java/com/woniu/entity/Announcement.java +++ b/marketservice/src/main/java/com/woniu/entity/Announcement.java @@ -1,5 +1,7 @@ package com.woniu.entity; +import com.fasterxml.jackson.annotation.JsonFormat; + import java.util.Date; import java.io.Serializable; @@ -17,7 +19,7 @@ public class Announcement implements Serializable { private String context; private Integer areaId; - + private Date createTime; private String title; @@ -73,4 +75,15 @@ public class Announcement implements Serializable { this.status = status; } + @Override + public String toString() { + return "Announcement{" + + "id=" + id + + ", context='" + context + '\'' + + ", areaId=" + areaId + + ", createTime=" + createTime + + ", title='" + title + '\'' + + ", status=" + status + + '}'; + } } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/entity/CommunityActivityUser.java b/marketservice/src/main/java/com/woniu/entity/CommunityActivityUser.java new file mode 100644 index 0000000..f69bbf7 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/entity/CommunityActivityUser.java @@ -0,0 +1,49 @@ +package com.woniu.entity; + +import java.io.Serializable; + +/** + * (CommunityActivityUser)实体类 + * + * @author makejava + * @since 2020-03-30 02:11:07 + */ +public class CommunityActivityUser implements Serializable { + private static final long serialVersionUID = 255491499162122483L; + + private Integer id; + /** + * 活动id + */ + private Integer cauActivityId; + /** + * 用户id + */ + private Integer cauUserId; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCauActivityId() { + return cauActivityId; + } + + public void setCauActivityId(Integer cauActivityId) { + this.cauActivityId = cauActivityId; + } + + public Integer getCauUserId() { + return cauUserId; + } + + public void setCauUserId(Integer cauUserId) { + this.cauUserId = cauUserId; + } + +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/entity/UsedProductConsignee.java b/marketservice/src/main/java/com/woniu/entity/UsedProductConsignee.java new file mode 100644 index 0000000..954af69 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/entity/UsedProductConsignee.java @@ -0,0 +1,87 @@ +package com.woniu.entity; + +import java.io.Serializable; + +/** + * 二手市场收货信息表(UsedProductConsignee)实体类 + * + * @author makejava + * @since 2020-03-30 22:08:16 + */ +public class UsedProductConsignee implements Serializable { + private static final long serialVersionUID = -83926923373292910L; + /** + * 收获信息Id + */ + private Integer id; + /** + * 用户Id + */ + private Integer userId; + /** + * 收货人 + */ + private String consigneeUserName; + /** + * 收货地址 + */ + private String consigneeAddress; + /** + * 邮编 + */ + private String postcode; + /** + * 收货手机 + */ + private String consigneePhone; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public String getConsigneeUserName() { + return consigneeUserName; + } + + public void setConsigneeUserName(String consigneeUserName) { + this.consigneeUserName = consigneeUserName; + } + + public String getConsigneeAddress() { + return consigneeAddress; + } + + public void setConsigneeAddress(String consigneeAddress) { + this.consigneeAddress = consigneeAddress; + } + + public String getPostcode() { + return postcode; + } + + public void setPostcode(String postcode) { + this.postcode = postcode; + } + + public String getConsigneePhone() { + return consigneePhone; + } + + public void setConsigneePhone(String consigneePhone) { + this.consigneePhone = consigneePhone; + } + +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/entity/UsedProductOrder.java b/marketservice/src/main/java/com/woniu/entity/UsedProductOrder.java new file mode 100644 index 0000000..e501408 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/entity/UsedProductOrder.java @@ -0,0 +1,137 @@ +package com.woniu.entity; + +import java.io.Serializable; + +/** + * 二手市场订单表(UsedProductOrder)实体类 + * + * @author makejava + * @since 2020-03-30 22:08:16 + */ +public class UsedProductOrder implements Serializable { + private static final long serialVersionUID = 308594611617480411L; + /** + * 订单Id + */ + private Integer id; + /** + * 商品Id + */ + private Integer productId; + /** + * 订单类型 + */ + private Integer productOrderType; + /** + * 用户id + */ + private Integer userId; + /** + * 订单号 + */ + private String orderNumber; + /** + * 订单名称 + */ + private String orderName; + /** + * 订单金额 + */ + private Object orderMoney; + /** + * 订单状态 + */ + private Integer orderStatus; + /** + * 收货信息Id + */ + private Integer consigneeid; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getProductId() { + return productId; + } + + public void setProductId(Integer productId) { + this.productId = productId; + } + + public Integer getProductOrderType() { + return productOrderType; + } + + public void setProductOrderType(Integer productOrderType) { + this.productOrderType = productOrderType; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public String getOrderNumber() { + return orderNumber; + } + + public void setOrderNumber(String orderNumber) { + this.orderNumber = orderNumber; + } + + public String getOrderName() { + return orderName; + } + + public void setOrderName(String orderName) { + this.orderName = orderName; + } + + public Object getOrderMoney() { + return orderMoney; + } + + public void setOrderMoney(Object orderMoney) { + this.orderMoney = orderMoney; + } + + public Integer getOrderStatus() { + return orderStatus; + } + + public void setOrderStatus(Integer orderStatus) { + this.orderStatus = orderStatus; + } + + public Integer getConsigneeid() { + return consigneeid; + } + + public void setConsigneeid(Integer consigneeid) { + this.consigneeid = consigneeid; + } + + @Override + public String toString() { + return "UsedProductOrder{" + + "id=" + id + + ", productId=" + productId + + ", productOrderType=" + productOrderType + + ", userId=" + userId + + ", orderNumber='" + orderNumber + '\'' + + ", orderName='" + orderName + '\'' + + ", orderMoney=" + orderMoney + + ", orderStatus=" + orderStatus + + ", consigneeid=" + consigneeid + + '}'; + } +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/AnnouncementService.java b/marketservice/src/main/java/com/woniu/service/AnnouncementService.java index 14b4232..d7421c9 100644 --- a/marketservice/src/main/java/com/woniu/service/AnnouncementService.java +++ b/marketservice/src/main/java/com/woniu/service/AnnouncementService.java @@ -52,4 +52,5 @@ public interface AnnouncementService { */ boolean deleteById(Integer id); + List findAllByThree(); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/CommunityActivityService.java b/marketservice/src/main/java/com/woniu/service/CommunityActivityService.java index d1e5151..4655c0d 100644 --- a/marketservice/src/main/java/com/woniu/service/CommunityActivityService.java +++ b/marketservice/src/main/java/com/woniu/service/CommunityActivityService.java @@ -52,4 +52,5 @@ public interface CommunityActivityService { */ boolean deleteById(Integer id); + List selectActivity(); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/CommunityActivityUserService.java b/marketservice/src/main/java/com/woniu/service/CommunityActivityUserService.java new file mode 100644 index 0000000..819f877 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/service/CommunityActivityUserService.java @@ -0,0 +1,56 @@ +package com.woniu.service; + +import com.woniu.entity.CommunityActivityUser; +import java.util.List; + +/** + * (CommunityActivityUser)表服务接口 + * + * @author makejava + * @since 2020-03-30 02:11:07 + */ +public interface CommunityActivityUserService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + CommunityActivityUser queryById(Integer id); + + /** + * 查询多条数据 + * + * @param offset 查询起始位置 + * @param limit 查询条数 + * @return 对象列表 + */ + List queryAllByLimit(int offset, int limit); + + /** + * 新增数据 + * + * @param communityActivityUser 实例对象 + * @return 实例对象 + */ + CommunityActivityUser insert(CommunityActivityUser communityActivityUser); + + /** + * 修改数据 + * + * @param communityActivityUser 实例对象 + * @return 实例对象 + */ + CommunityActivityUser update(CommunityActivityUser communityActivityUser); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Integer id); + + Integer findUserNameByActivity(Integer id); +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/PersonImageService.java b/marketservice/src/main/java/com/woniu/service/PersonImageService.java index 8b5fb10..932de87 100644 --- a/marketservice/src/main/java/com/woniu/service/PersonImageService.java +++ b/marketservice/src/main/java/com/woniu/service/PersonImageService.java @@ -1,6 +1,8 @@ package com.woniu.service; import com.woniu.entity.PersonImage; + +import java.util.ArrayList; import java.util.List; /** @@ -52,4 +54,5 @@ public interface PersonImageService { */ boolean deleteById(Integer id); + List findImgByListUserId(ArrayList userId); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/PersonUserService.java b/marketservice/src/main/java/com/woniu/service/PersonUserService.java index 16c09e3..ba01aa0 100644 --- a/marketservice/src/main/java/com/woniu/service/PersonUserService.java +++ b/marketservice/src/main/java/com/woniu/service/PersonUserService.java @@ -55,4 +55,8 @@ public interface PersonUserService { Integer findPlotIdByUserId(Integer userId); PersonUser findIdByName(String name); + + String findNickNameByName(String name); + + List findPersonByPoltId(Integer plotId); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/UsedProductConsigneeService.java b/marketservice/src/main/java/com/woniu/service/UsedProductConsigneeService.java new file mode 100644 index 0000000..fd5a70c --- /dev/null +++ b/marketservice/src/main/java/com/woniu/service/UsedProductConsigneeService.java @@ -0,0 +1,56 @@ +package com.woniu.service; + +import com.woniu.entity.UsedProductConsignee; +import java.util.List; + +/** + * 二手市场收货信息表(UsedProductConsignee)表服务接口 + * + * @author makejava + * @since 2020-03-30 22:08:16 + */ +public interface UsedProductConsigneeService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + UsedProductConsignee queryById(Integer id); + + /** + * 查询多条数据 + * + * @param offset 查询起始位置 + * @param limit 查询条数 + * @return 对象列表 + */ + List queryAllByLimit(int offset, int limit); + + /** + * 新增数据 + * + * @param usedProductConsignee 实例对象 + * @return 实例对象 + */ + UsedProductConsignee insert(UsedProductConsignee usedProductConsignee); + + /** + * 修改数据 + * + * @param usedProductConsignee 实例对象 + * @return 实例对象 + */ + UsedProductConsignee update(UsedProductConsignee usedProductConsignee); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Integer id); + + List findAllByUserId(Integer id); +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/UsedProductOrderService.java b/marketservice/src/main/java/com/woniu/service/UsedProductOrderService.java new file mode 100644 index 0000000..b88a2c0 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/service/UsedProductOrderService.java @@ -0,0 +1,62 @@ +package com.woniu.service; + +import com.woniu.entity.UsedProductOrder; + +import java.util.ArrayList; +import java.util.List; + +/** + * 二手市场订单表(UsedProductOrder)表服务接口 + * + * @author makejava + * @since 2020-03-30 22:08:16 + */ +public interface UsedProductOrderService { + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + UsedProductOrder queryById(Integer id); + + /** + * 查询多条数据 + * + * @param offset 查询起始位置 + * @param limit 查询条数 + * @return 对象列表 + */ + List queryAllByLimit(int offset, int limit); + + /** + * 新增数据 + * + * @param usedProductOrder 实例对象 + * @return 实例对象 + */ + UsedProductOrder insert(UsedProductOrder usedProductOrder); + + /** + * 修改数据 + * + * @param usedProductOrder 实例对象 + * @return 实例对象 + */ + UsedProductOrder update(UsedProductOrder usedProductOrder); + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + boolean deleteById(Integer id); + + UsedProductOrder findOrderByProductId(Integer id, Integer productId, int i); + + ArrayList findProductIdByPayStatus(Integer id, Integer orderStatus, Integer orderType); + + void deleteOrderByProductId(Integer id, Integer productId, Integer orderType); +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/UsedProductService.java b/marketservice/src/main/java/com/woniu/service/UsedProductService.java index aaf97d2..dcc3645 100644 --- a/marketservice/src/main/java/com/woniu/service/UsedProductService.java +++ b/marketservice/src/main/java/com/woniu/service/UsedProductService.java @@ -1,6 +1,8 @@ package com.woniu.service; import com.woniu.entity.UsedProduct; + +import java.util.ArrayList; import java.util.List; /** @@ -61,4 +63,8 @@ public interface UsedProductService { List findSoldOutProductByUserId(Integer id); List findTradeProductByUserId(Integer id); + + List findAllByProductIdList(ArrayList productIdList); + + Integer findUserIdByProductId(Integer productId); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/impl/AnnouncementServiceImpl.java b/marketservice/src/main/java/com/woniu/service/impl/AnnouncementServiceImpl.java index 79d4fbc..bb114c0 100644 --- a/marketservice/src/main/java/com/woniu/service/impl/AnnouncementServiceImpl.java +++ b/marketservice/src/main/java/com/woniu/service/impl/AnnouncementServiceImpl.java @@ -76,4 +76,9 @@ public class AnnouncementServiceImpl implements AnnouncementService { public boolean deleteById(Integer id) { return this.announcementDao.deleteById(id) > 0; } + + @Override + public List findAllByThree() { + return announcementDao.findAllByThree(); + } } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/impl/CommunityActivityServiceImpl.java b/marketservice/src/main/java/com/woniu/service/impl/CommunityActivityServiceImpl.java index 3523b0f..4abd71b 100644 --- a/marketservice/src/main/java/com/woniu/service/impl/CommunityActivityServiceImpl.java +++ b/marketservice/src/main/java/com/woniu/service/impl/CommunityActivityServiceImpl.java @@ -76,4 +76,9 @@ public class CommunityActivityServiceImpl implements CommunityActivityService { public boolean deleteById(Integer id) { return this.communityActivityDao.deleteById(id) > 0; } + + @Override + public List selectActivity() { + return communityActivityDao.selectActivity(); + } } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/impl/CommunityActivityUserServiceImpl.java b/marketservice/src/main/java/com/woniu/service/impl/CommunityActivityUserServiceImpl.java new file mode 100644 index 0000000..5acad80 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/service/impl/CommunityActivityUserServiceImpl.java @@ -0,0 +1,84 @@ +package com.woniu.service.impl; + +import com.woniu.entity.CommunityActivityUser; +import com.woniu.dao.CommunityActivityUserDao; +import com.woniu.service.CommunityActivityUserService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * (CommunityActivityUser)表服务实现类 + * + * @author makejava + * @since 2020-03-30 02:11:07 + */ +@Service("communityActivityUserService") +public class CommunityActivityUserServiceImpl implements CommunityActivityUserService { + @Resource + private CommunityActivityUserDao communityActivityUserDao; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public CommunityActivityUser queryById(Integer id) { + return this.communityActivityUserDao.queryById(id); + } + + /** + * 查询多条数据 + * + * @param offset 查询起始位置 + * @param limit 查询条数 + * @return 对象列表 + */ + @Override + public List queryAllByLimit(int offset, int limit) { + return this.communityActivityUserDao.queryAllByLimit(offset, limit); + } + + /** + * 新增数据 + * + * @param communityActivityUser 实例对象 + * @return 实例对象 + */ + @Override + public CommunityActivityUser insert(CommunityActivityUser communityActivityUser) { + this.communityActivityUserDao.insert(communityActivityUser); + return communityActivityUser; + } + + /** + * 修改数据 + * + * @param communityActivityUser 实例对象 + * @return 实例对象 + */ + @Override + public CommunityActivityUser update(CommunityActivityUser communityActivityUser) { + this.communityActivityUserDao.update(communityActivityUser); + return this.queryById(communityActivityUser.getId()); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer id) { + return this.communityActivityUserDao.deleteById(id) > 0; + } + + @Override + public Integer findUserNameByActivity(Integer id) { + return communityActivityUserDao.findUserNameByActivity(id); + } +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/impl/PersonImageServiceImpl.java b/marketservice/src/main/java/com/woniu/service/impl/PersonImageServiceImpl.java index cf26414..6ed897b 100644 --- a/marketservice/src/main/java/com/woniu/service/impl/PersonImageServiceImpl.java +++ b/marketservice/src/main/java/com/woniu/service/impl/PersonImageServiceImpl.java @@ -6,6 +6,7 @@ import com.woniu.service.PersonImageService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** @@ -76,4 +77,9 @@ public class PersonImageServiceImpl implements PersonImageService { public boolean deleteById(Integer id) { return this.personImageDao.deleteById(id) > 0; } + + @Override + public List findImgByListUserId(ArrayList userId) { + return personImageDao.findImgByListUserId(userId); + } } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/impl/PersonUserServiceImpl.java b/marketservice/src/main/java/com/woniu/service/impl/PersonUserServiceImpl.java index fbbdca7..4a8c413 100644 --- a/marketservice/src/main/java/com/woniu/service/impl/PersonUserServiceImpl.java +++ b/marketservice/src/main/java/com/woniu/service/impl/PersonUserServiceImpl.java @@ -86,4 +86,14 @@ public class PersonUserServiceImpl implements PersonUserService { public PersonUser findIdByName(String name) { return personUserDao.findIdByName(name); } + + @Override + public String findNickNameByName(String name) { + return personUserDao.findNickNameByName(name); + } + + @Override + public List findPersonByPoltId(Integer plotId) { + return personUserDao.findPersonByPoltId(plotId); + } } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/impl/UsedProductConsigneeServiceImpl.java b/marketservice/src/main/java/com/woniu/service/impl/UsedProductConsigneeServiceImpl.java new file mode 100644 index 0000000..513edf7 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/service/impl/UsedProductConsigneeServiceImpl.java @@ -0,0 +1,84 @@ +package com.woniu.service.impl; + +import com.woniu.entity.UsedProductConsignee; +import com.woniu.dao.UsedProductConsigneeDao; +import com.woniu.service.UsedProductConsigneeService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +/** + * 二手市场收货信息表(UsedProductConsignee)表服务实现类 + * + * @author makejava + * @since 2020-03-30 22:08:16 + */ +@Service("usedProductConsigneeService") +public class UsedProductConsigneeServiceImpl implements UsedProductConsigneeService { + @Resource + private UsedProductConsigneeDao usedProductConsigneeDao; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public UsedProductConsignee queryById(Integer id) { + return this.usedProductConsigneeDao.queryById(id); + } + + /** + * 查询多条数据 + * + * @param offset 查询起始位置 + * @param limit 查询条数 + * @return 对象列表 + */ + @Override + public List queryAllByLimit(int offset, int limit) { + return this.usedProductConsigneeDao.queryAllByLimit(offset, limit); + } + + /** + * 新增数据 + * + * @param usedProductConsignee 实例对象 + * @return 实例对象 + */ + @Override + public UsedProductConsignee insert(UsedProductConsignee usedProductConsignee) { + this.usedProductConsigneeDao.insert(usedProductConsignee); + return usedProductConsignee; + } + + /** + * 修改数据 + * + * @param usedProductConsignee 实例对象 + * @return 实例对象 + */ + @Override + public UsedProductConsignee update(UsedProductConsignee usedProductConsignee) { + this.usedProductConsigneeDao.update(usedProductConsignee); + return this.queryById(usedProductConsignee.getId()); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer id) { + return this.usedProductConsigneeDao.deleteById(id) > 0; + } + + @Override + public List findAllByUserId(Integer id) { + return usedProductConsigneeDao.findAllByUserId(id); + } +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/impl/UsedProductOrderServiceImpl.java b/marketservice/src/main/java/com/woniu/service/impl/UsedProductOrderServiceImpl.java new file mode 100644 index 0000000..c873323 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/service/impl/UsedProductOrderServiceImpl.java @@ -0,0 +1,95 @@ +package com.woniu.service.impl; + +import com.woniu.entity.UsedProductOrder; +import com.woniu.dao.UsedProductOrderDao; +import com.woniu.service.UsedProductOrderService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; + +/** + * 二手市场订单表(UsedProductOrder)表服务实现类 + * + * @author makejava + * @since 2020-03-30 22:08:16 + */ +@Service("usedProductOrderService") +public class UsedProductOrderServiceImpl implements UsedProductOrderService { + @Resource + private UsedProductOrderDao usedProductOrderDao; + + /** + * 通过ID查询单条数据 + * + * @param id 主键 + * @return 实例对象 + */ + @Override + public UsedProductOrder queryById(Integer id) { + return this.usedProductOrderDao.queryById(id); + } + + /** + * 查询多条数据 + * + * @param offset 查询起始位置 + * @param limit 查询条数 + * @return 对象列表 + */ + @Override + public List queryAllByLimit(int offset, int limit) { + return this.usedProductOrderDao.queryAllByLimit(offset, limit); + } + + /** + * 新增数据 + * + * @param usedProductOrder 实例对象 + * @return 实例对象 + */ + @Override + public UsedProductOrder insert(UsedProductOrder usedProductOrder) { + this.usedProductOrderDao.insert(usedProductOrder); + return usedProductOrder; + } + + /** + * 修改数据 + * + * @param usedProductOrder 实例对象 + * @return 实例对象 + */ + @Override + public UsedProductOrder update(UsedProductOrder usedProductOrder) { + this.usedProductOrderDao.update(usedProductOrder); + return this.queryById(usedProductOrder.getId()); + } + + /** + * 通过主键删除数据 + * + * @param id 主键 + * @return 是否成功 + */ + @Override + public boolean deleteById(Integer id) { + return this.usedProductOrderDao.deleteById(id) > 0; + } + + @Override + public UsedProductOrder findOrderByProductId(Integer id, Integer productId, int i) { + return usedProductOrderDao.findOrderByProductId(id,productId,i); + } + + @Override + public ArrayList findProductIdByPayStatus(Integer id, Integer orderStatus, Integer orderType) { + return usedProductOrderDao.findProductIdByPayStatus(id,orderStatus,orderType); + } + + @Override + public void deleteOrderByProductId(Integer id, Integer productId, Integer orderType) { + usedProductOrderDao.deleteOrderByProductId(id,productId,orderType); + } +} \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/impl/UsedProductServiceImpl.java b/marketservice/src/main/java/com/woniu/service/impl/UsedProductServiceImpl.java index 215bfc4..40cf673 100644 --- a/marketservice/src/main/java/com/woniu/service/impl/UsedProductServiceImpl.java +++ b/marketservice/src/main/java/com/woniu/service/impl/UsedProductServiceImpl.java @@ -6,6 +6,7 @@ import com.woniu.service.UsedProductService; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.ArrayList; import java.util.List; /** @@ -101,4 +102,14 @@ public class UsedProductServiceImpl implements UsedProductService { public List findTradeProductByUserId(Integer id) { return usedProductDao.findTradeProductByUserId(id); } + + @Override + public List findAllByProductIdList(ArrayList productIdList) { + return usedProductDao.findAllByProductIdList(productIdList); + } + + @Override + public Integer findUserIdByProductId(Integer productId) { + return usedProductDao.findUserIdByProductId(productId); + } } \ No newline at end of file diff --git a/marketservice/src/main/resources/application.yml b/marketservice/src/main/resources/application.yml index 41a6aad..090639a 100644 --- a/marketservice/src/main/resources/application.yml +++ b/marketservice/src/main/resources/application.yml @@ -18,6 +18,9 @@ spring: sentinel: master: mysentinel1 nodes: 106.12.148.100:26380,106.12.148.100:26381,106.12.148.100:26382 + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 # redis: # password: Yh496989943 # jedis: @@ -28,9 +31,6 @@ spring: # sentinel: # master: mymaster # nodes: 47.99.241.119:26379,47.99.241.119:26380,47.99.241.119:26381 - jackson: - date-format: yyyy-MM-dd HH:mm:ss - time-zone: GMT+8 # rabbitmq: # host: 47.99.241.119 # port: 5672 diff --git a/marketservice/src/main/resources/mapper/CommunityActivityUserDao.xml b/marketservice/src/main/resources/mapper/CommunityActivityUserDao.xml new file mode 100644 index 0000000..d8befbf --- /dev/null +++ b/marketservice/src/main/resources/mapper/CommunityActivityUserDao.xml @@ -0,0 +1,70 @@ + + + + + + + + + + + + + + + + + + + + + + insert into happycommunity.community_activity_user(cau_activity_id, cau_user_id) + values (#{cauActivityId}, #{cauUserId}) + + + + + update happycommunity.community_activity_user + + + cau_activity_id = #{cauActivityId}, + + + cau_user_id = #{cauUserId}, + + + where id = #{id} + + + + + delete from happycommunity.community_activity_user where id = #{id} + + + \ No newline at end of file diff --git a/marketservice/src/main/resources/mapper/PersonImageDao.xml b/marketservice/src/main/resources/mapper/PersonImageDao.xml index 9ff9eff..7828e21 100644 --- a/marketservice/src/main/resources/mapper/PersonImageDao.xml +++ b/marketservice/src/main/resources/mapper/PersonImageDao.xml @@ -95,4 +95,12 @@ delete from happycommunity.person_image where id = #{id} + + + \ No newline at end of file diff --git a/marketservice/src/main/resources/mapper/UsedProductConsigneeDao.xml b/marketservice/src/main/resources/mapper/UsedProductConsigneeDao.xml new file mode 100644 index 0000000..4d43ce3 --- /dev/null +++ b/marketservice/src/main/resources/mapper/UsedProductConsigneeDao.xml @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + insert into happycommunity.used_product_consignee(user_id, consignee_user_name, consignee_address, postcode, consignee_phone) + values (#{userId}, #{consigneeUserName}, #{consigneeAddress}, #{postcode}, #{consigneePhone}) + + + + + update happycommunity.used_product_consignee + + + user_id = #{userId}, + + + consignee_user_name = #{consigneeUserName}, + + + consignee_address = #{consigneeAddress}, + + + postcode = #{postcode}, + + + consignee_phone = #{consigneePhone}, + + + where id = #{id} + + + + + delete from happycommunity.used_product_consignee where id = #{id} + + + \ No newline at end of file diff --git a/marketservice/src/main/resources/mapper/UsedProductDao.xml b/marketservice/src/main/resources/mapper/UsedProductDao.xml index ac57501..a96d2e0 100644 --- a/marketservice/src/main/resources/mapper/UsedProductDao.xml +++ b/marketservice/src/main/resources/mapper/UsedProductDao.xml @@ -151,4 +151,11 @@ delete from happycommunity.used_product where id = #{id} + + \ No newline at end of file diff --git a/marketservice/src/main/resources/mapper/UsedProductOrderDao.xml b/marketservice/src/main/resources/mapper/UsedProductOrderDao.xml new file mode 100644 index 0000000..4903164 --- /dev/null +++ b/marketservice/src/main/resources/mapper/UsedProductOrderDao.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into happycommunity.used_product_order(product_id, product_order_type, user_id, order_number, order_name, order_money, order_status, consigneeId) + values (#{productId}, #{productOrderType}, #{userId}, #{orderNumber}, #{orderName}, #{orderMoney}, #{orderStatus}, #{consigneeid}) + + + + + update happycommunity.used_product_order + + + product_id = #{productId}, + + + product_order_type = #{productOrderType}, + + + user_id = #{userId}, + + + order_number = #{orderNumber}, + + + order_name = #{orderName}, + + + order_money = #{orderMoney}, + + + order_status = #{orderStatus}, + + + consigneeId = #{consigneeid}, + + + where id = #{id} + + + + + delete from happycommunity.used_product_order where id = #{id} + + + \ No newline at end of file diff --git a/marketservice/src/test/java/com/woniu/MarketserviceApplicationTests.java b/marketservice/src/test/java/com/woniu/MarketserviceApplicationTests.java index 38ba493..30854ae 100644 --- a/marketservice/src/test/java/com/woniu/MarketserviceApplicationTests.java +++ b/marketservice/src/test/java/com/woniu/MarketserviceApplicationTests.java @@ -3,11 +3,16 @@ package com.woniu; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.UUID; + @SpringBootTest class MarketserviceApplicationTests { @Test void contextLoads() { + } } -- Gitee From d5d4e458b4b11892a15fcb1a0b39e2b7f421fa88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=B4=8B?= <2870485806@qq.com> Date: Tue, 31 Mar 2020 21:29:41 +0800 Subject: [PATCH 06/27] =?UTF-8?q?=E5=95=86=E5=AE=B6=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BusinessInfoController.java | 62 ++++++++++++++-- .../controller/PpPayserviceController.java | 50 +++++++++++-- .../controller/ServiceImgController.java | 74 +++++++++++++++---- .../controller/ServiceOrderController.java | 10 ++- .../businessservice/dao/BusinessInfoDao.java | 13 ++++ .../businessservice/dao/PpPayserviceDao.java | 7 ++ .../businessservice/entity/EarnIng.java | 43 +++++++++++ .../businessservice/entity/MyCenter.java | 1 - .../businessservice/entity/PpPayservice.java | 25 +++++++ .../businessservice/entity/ServiceOrder.java | 26 +++++++ .../businessservice/mq/PhoneCode.java | 2 +- .../service/BusinessInfoService.java | 15 +++- .../service/PpPayserviceService.java | 7 ++ .../service/impl/BusinessInfoServiceImpl.java | 10 +++ .../service/impl/PpPayserviceServiceImpl.java | 6 ++ .../main/resources/mapper/BusinessInfoDao.xml | 8 ++ .../main/resources/mapper/PpPayserviceDao.xml | 13 ++++ .../main/resources/mapper/ServiceImgDao.xml | 2 +- 18 files changed, 342 insertions(+), 32 deletions(-) create mode 100644 businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EarnIng.java diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java index 1ea3ab4..594cdaa 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java @@ -100,7 +100,7 @@ public class BusinessInfoController { /** * 手机号码注册,密码重置 * @param phone 手机号码 - * @param resetCode 密码重置参数,1密码重置,0注册 + * @param resetCode 密码重置参数,1密码重置,短信登录,0注册 * @return */ @PostMapping("/phoneRegister") @@ -204,9 +204,11 @@ public class BusinessInfoController { */ @GetMapping("/queruyPersonageInfo") public MyCenter queruyPersonageInfo(){ - MyCenter myCenter=businessInfoService.queruyPersonageInfo(1); + String userId = request.getHeader("userId"); + Integer value = Integer.valueOf(userId); + MyCenter myCenter=businessInfoService.queruyPersonageInfo(value); if (myCenter==null){ - myCenter=businessInfoService.queruyPersonageInfo2(1); + myCenter=businessInfoService.queruyPersonageInfo2(value); } return myCenter; @@ -217,7 +219,9 @@ public class BusinessInfoController { */ @GetMapping("/orderSum") public MyCenter orderSum(){ - MyCenter myCenter=businessInfoService.queruyOrderSum(1); + String userId = request.getHeader("userId"); + Integer value = Integer.valueOf(userId); + MyCenter myCenter=businessInfoService.queruyOrderSum(value); if (myCenter==null){ myCenter=new MyCenter(); myCenter.setOrderSum(0); @@ -231,7 +235,9 @@ public class BusinessInfoController { */ @GetMapping("/bookOrederSum") public MyCenter bookOrederSum(){ - MyCenter myCenter=businessInfoService.bookOrederSum(1,0); + String userId = request.getHeader("userId"); + Integer value = Integer.valueOf(userId); + MyCenter myCenter=businessInfoService.bookOrederSum(value,0); if (myCenter==null){ myCenter=new MyCenter(); myCenter.setBookOrederSum(0); @@ -245,8 +251,10 @@ public class BusinessInfoController { */ @GetMapping("/queryByUserId") public BusinessInfoAreainfo queryByUserId(){ + String userId = request.getHeader("userId"); + Integer value = Integer.valueOf(userId); BusinessInfoAreainfo infoareainfo=new BusinessInfoAreainfo(); - BusinessInfo businessInfo=businessInfoService.queryById(1); + BusinessInfo businessInfo=businessInfoService.queryById(value); Areainfo areainfo=areainfoService.queryById(businessInfo.getPlotId()); infoareainfo.setBusinessInfo(businessInfo); infoareainfo.setAreainfo(areainfo); @@ -255,12 +263,52 @@ public class BusinessInfoController { @GetMapping("/noteSubLogin") public BusinessInfoAreainfo noteSubLogin(String phone){ + String userId = request.getHeader("userId"); + Integer value = Integer.valueOf(userId); BusinessInfoAreainfo infoareainfo=new BusinessInfoAreainfo(); - BusinessInfo businessInfo=businessInfoService.queryById(1); + BusinessInfo businessInfo=businessInfoService.queryById(value); Areainfo areainfo=areainfoService.queryById(businessInfo.getPlotId()); infoareainfo.setBusinessInfo(businessInfo); infoareainfo.setAreainfo(areainfo); return infoareainfo; } + + /** + * 短信登录 + * @param phone 电话号码 + * @param code 验证码 + * @return + */ + @PostMapping("/noteLogn") + @ResponseBody + public CommonResult noteLogn(String phone,String code){ + + try { + businessInfoService.codeCheck(code,phone); + BusinessInfo businessInfo= businessInfoService.queryByPhone(phone); + System.out.println("businessInfo"+businessInfo); + LoginToken loginToken=new LoginToken(); + loginToken.setUserId(businessInfo.getId()); + loginToken.setUsername(businessInfo.getName()); + return CommonResult.success("登录成功",loginToken); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(e.getMessage()); + } + } + + /** + * 查询收益 + * @param userId 根据用户id + * @return + */ + @GetMapping("/queryIncome") + public String queryIncome(Integer userId){ + String money=businessInfoService.queryIncome(userId); + if(money==null||money.equals("0")){ + money="0"; + } + return money; + } } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java index b48d98b..c044fdd 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java @@ -1,17 +1,17 @@ package com.team7.happycommunity.businessservice.controller; import com.team7.happycommunity.businessservice.common.CommonResult; -import com.team7.happycommunity.businessservice.entity.ImgUrlService; -import com.team7.happycommunity.businessservice.entity.PpPayservice; -import com.team7.happycommunity.businessservice.entity.ServiceImg; +import com.team7.happycommunity.businessservice.entity.*; import com.team7.happycommunity.businessservice.service.PpPayserviceService; import com.team7.happycommunity.businessservice.service.ServiceImgService; import com.team7.happycommunity.businessservice.util.QiniuUploadUtil; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import sun.misc.BASE64Decoder; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.io.IOException; import java.util.ArrayList; import java.util.List; @@ -32,7 +32,14 @@ public class PpPayserviceController { @Resource private PpPayserviceService ppPayserviceService; + @Resource + private HttpServletRequest request; + + @Resource + private RedisTemplate redisTemplate; + @Resource + private ServiceImgService serviceImgService; /** * 通过主键查询单条数据 @@ -55,20 +62,51 @@ public class PpPayserviceController { @ResponseBody public CommonResult addService(PpPayservice ppPayservice){ + + String userId = request.getHeader("userId"); try { //存储登录的商家id - ppPayservice.setShopid(1); + ppPayservice.setShopid(Integer.valueOf(userId)); //存储服务类型 ppPayservice.setServiceType(0); //保存服务 PpPayservice insert = ppPayserviceService.insert(ppPayservice); + + List hashList = redisTemplate.opsForHash().values(userId+""); + ArrayList list=new ArrayList(); + ServiceImg img=new ServiceImg(); + for (Object o : hashList) { + System.out.println(o); + img.setImg((String)o); + img.setServiceid(insert.getId()); + list.add(img); + } + //使用foreach插入多条数据 + serviceImgService.insertList(list); //返回添加的服务id - return CommonResult.success(insert.getId()); + return CommonResult.success("发布成功"); } catch (Exception e) { e.printStackTrace(); - return CommonResult.failed("上传失败"); + return CommonResult.failed("发布失败"); } } + /** + * 查询商家的所有收益 + * @param userId 商家id + * @return + */ + @RequestMapping("/queryEarnByUserId") + @ResponseBody + public List queryEarnByUserId(Integer userId){ + try { + List list=ppPayserviceService.queryEarnByUserId(userId); + System.out.println(list); + return list; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java index a6a5b7a..cb64f88 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java @@ -5,8 +5,11 @@ import com.team7.happycommunity.businessservice.entity.BusinessImage; import com.team7.happycommunity.businessservice.entity.ServiceImg; import com.team7.happycommunity.businessservice.service.ServiceImgService; import com.team7.happycommunity.businessservice.util.QiniuUploadUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import sun.misc.BASE64Decoder; import javax.annotation.Resource; import java.io.IOException; @@ -27,6 +30,9 @@ public class ServiceImgController { @Resource private ServiceImgService serviceImgService; + @Autowired + RedisTemplate redisTemplate; + /** * 通过主键查询单条数据 * @@ -38,27 +44,67 @@ public class ServiceImgController { return this.serviceImgService.queryById(id); } +// /** +// * 图片上传 +// * @param file 图片 +// * @param id 服务id +// * @return +// */ +// @PostMapping("/upload") +// @ResponseBody +// public CommonResult upload(MultipartFile file, Integer id,Integer userId){ +// String name= UUID.randomUUID().toString().replace("_",""); +// try { +// String url = new QiniuUploadUtil().upload(name, file.getBytes()); +//// ServiceImg image=new ServiceImg(); +//// image.setServiceid(id); +//// image.setImg(url); +// redisTemplate.opsForHash().put(userId,url,"1"); +// // serviceImgService.insert(image); +// return CommonResult.success("上传成功"); +// } catch (IOException e) { +// e.printStackTrace(); +// return CommonResult.success("上传失败"); +// } +// +// } + /** * 图片上传 - * @param file 图片 - * @param id 服务id + * @param imgBase * @return */ @PostMapping("/upload") - @ResponseBody - public CommonResult upload(MultipartFile file, Integer id){ - String name= UUID.randomUUID().toString().replace("_",""); + public CommonResult upload(String imgBase,Integer userId){ + byte[] b1 = null; + BASE64Decoder decoder = new BASE64Decoder(); + try{ + if (imgBase.indexOf("data:image/jpeg;base64,") != -1) { + b1 = decoder.decodeBuffer(imgBase.replaceAll("data:image/jpeg;base64,", "")); + } else { + if (imgBase.indexOf("data:image/png;base64,") != -1) { + b1 = decoder.decodeBuffer(imgBase.replaceAll("data:image/png;base64,", "")); + } else { + b1 = decoder.decodeBuffer(imgBase.replaceAll("data:image/jpg;base64,", "")); + } + } + for (int i = 0; i < b1.length; ++i) { + if (b1[i] < 0) {// 调整异常数据 + b1[i] += 256; + } + } + }catch(Exception e){ + e.printStackTrace(); + } + //添加图片url; + String name = UUID.randomUUID().toString().replace("_", ""); try { - String url = new QiniuUploadUtil().upload(name, file.getBytes()); - ServiceImg image=new ServiceImg(); - image.setServiceid(id); - image.setImg(url); - serviceImgService.insert(image); - return CommonResult.success("上传成功"); - } catch (IOException e) { + String upload = new QiniuUploadUtil().upload(name, b1); + System.out.println("uploaduploadupload"+upload); + redisTemplate.opsForHash().put(userId+"","1",upload); + } catch (Exception e) { e.printStackTrace(); - return CommonResult.success("上传失败"); } - + return CommonResult.success("1"); } } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java index 87a84ed..653c57f 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; import java.util.List; /** @@ -31,6 +32,9 @@ public class ServiceOrderController { @Resource private ServiceOrderService serviceOrderService; + @Resource + private HttpServletRequest request; + /** * 通过主键查询单条数据 * @@ -48,6 +52,8 @@ public class ServiceOrderController { */ @GetMapping("/queryOrderByUserIdAndStatus") public PageInfo queryOrderByUserIdAndStatus(Integer status,Integer limit,Integer page){ + String userId = request.getHeader("userId"); + if (limit==null){ limit=2; } @@ -55,7 +61,7 @@ public class ServiceOrderController { page=1; } PageHelper.startPage(page,limit); - List list = serviceOrderService.queryOrderByUserIdAndStatus(1, status); + List list = serviceOrderService.queryOrderByUserIdAndStatus(Integer.valueOf(userId), status); PageInfo pageInfo=new PageInfo(list); @@ -113,4 +119,6 @@ public class ServiceOrderController { return serviceOrderService.evaluate(orderId); } + + } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/BusinessInfoDao.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/BusinessInfoDao.java index 969c1a8..b59d235 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/BusinessInfoDao.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/BusinessInfoDao.java @@ -116,4 +116,17 @@ public interface BusinessInfoDao { * @param user */ void updateByCellPhNumber(BusinessInfo user); + + /** + * 通过电话号码查询用户信息 + * @param phone + * @return + */ + BusinessInfo queryByPhone(@Param("cellPhNumber") String phone); + /** + * 查询收益 + * @param userId 根据用户id + * @return + */ + String queryIncome(Integer userId); } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/PpPayserviceDao.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/PpPayserviceDao.java index 1d68c1e..cc12805 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/PpPayserviceDao.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/PpPayserviceDao.java @@ -1,5 +1,6 @@ package com.team7.happycommunity.businessservice.dao; +import com.team7.happycommunity.businessservice.entity.EarnIng; import com.team7.happycommunity.businessservice.entity.PpPayservice; import org.apache.ibatis.annotations.Param; @@ -63,4 +64,10 @@ public interface PpPayserviceDao { */ int deleteById(Integer id); + /** + * 查询商家所有的收益 + * @param userId + * @return + */ + List queryEarnByUserId(Integer userId); } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EarnIng.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EarnIng.java new file mode 100644 index 0000000..4951c08 --- /dev/null +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EarnIng.java @@ -0,0 +1,43 @@ +package com.team7.happycommunity.businessservice.entity; + +import java.io.Serializable; +import java.util.Date; + +public class EarnIng implements Serializable { + private String payprice; + private String payname; + private Integer serviceid ; + private Date endtime; + + public String getPayprice() { + return payprice; + } + + public void setPayprice(String payprice) { + this.payprice = payprice; + } + + public String getPayname() { + return payname; + } + + public void setPayname(String payname) { + this.payname = payname; + } + + public Integer getServiceid() { + return serviceid; + } + + public void setServiceid(Integer serviceid) { + this.serviceid = serviceid; + } + + public Date getEndtime() { + return endtime; + } + + public void setEndtime(Date endtime) { + this.endtime = endtime; + } +} diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/MyCenter.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/MyCenter.java index 9912725..c8f1557 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/MyCenter.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/MyCenter.java @@ -13,7 +13,6 @@ public class MyCenter implements Serializable { private Integer bookOrederSum; - public String getUrl() { return url; } diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java index 812da6c..568e183 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java @@ -28,6 +28,31 @@ public class PpPayservice implements Serializable { private String icon; private Integer serviceType; + + private ServiceOrder serviceOrder; + + private Integer userId;//用户id + + public static long getSerialVersionUID() { + return serialVersionUID; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public ServiceOrder getServiceOrder() { + return serviceOrder; + } + + public void setServiceOrder(ServiceOrder serviceOrder) { + this.serviceOrder = serviceOrder; + } + /** * 支付方式 */ diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceOrder.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceOrder.java index b243a47..c1ea714 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceOrder.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceOrder.java @@ -26,6 +26,32 @@ public class ServiceOrder implements Serializable { private String ordernumber; + private PpPayservice ppPayservice; + + public ServiceOrder(Integer id, Integer serviceid, Integer userid, Date starttime, Date endtime, Integer status, String ordernumber) { + this.id = id; + this.serviceid = serviceid; + this.userid = userid; + this.starttime = starttime; + this.endtime = endtime; + this.status = status; + this.ordernumber = ordernumber; + } + + public ServiceOrder() { + } + + public static long getSerialVersionUID() { + return serialVersionUID; + } + + public PpPayservice getPpPayservice() { + return ppPayservice; + } + + public void setPpPayservice(PpPayservice ppPayservice) { + this.ppPayservice = ppPayservice; + } public Integer getId() { return id; diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java index c1ceb70..a350cc7 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java @@ -33,7 +33,7 @@ public class PhoneCode { String phone = (String) msg.get("phone"); String code = (String)msg.get("code"); //调用阿里云地址,发送短信 - //sendSms.sms(phone,smsCode,param.replace("[value]",code)); + sendSms.sms(phone,smsCode,param.replace("[value]",code)); //签收 Long tag=(Long)headers.get(AmqpHeaders.DELIVERY_TAG); try { diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/BusinessInfoService.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/BusinessInfoService.java index bb5221e..35a9153 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/BusinessInfoService.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/BusinessInfoService.java @@ -75,7 +75,7 @@ public interface BusinessInfoService { /** * 手机号码注册,密码重置 * @param phone 手机号码 - * @param resetCode 密码重置参数,1密码重置,0注册 + * @param resetCode 密码重置参数,1密码重置,短信登录,0注册 * @return */ void phoneRegister(String phone, String resetCode); @@ -130,4 +130,17 @@ public interface BusinessInfoService { * @param user */ void updateByCellPhNumber(BusinessInfo user); + + /** + * 通过电话号码查询用户信息 + * @param phone + * @return + */ + BusinessInfo queryByPhone(String phone); + /** + * 查询收益 + * @param userId 根据用户id + * @return + */ + String queryIncome(Integer userId); } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/PpPayserviceService.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/PpPayserviceService.java index 4ab4075..add6033 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/PpPayserviceService.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/PpPayserviceService.java @@ -1,5 +1,6 @@ package com.team7.happycommunity.businessservice.service; +import com.team7.happycommunity.businessservice.entity.EarnIng; import com.team7.happycommunity.businessservice.entity.PpPayservice; import java.util.List; @@ -53,4 +54,10 @@ public interface PpPayserviceService { */ boolean deleteById(Integer id); + /** + * 查询商家所有的收益 + * @param userId 用户id + * @return + */ + List queryEarnByUserId(Integer userId); } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/BusinessInfoServiceImpl.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/BusinessInfoServiceImpl.java index 425b1d2..607314d 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/BusinessInfoServiceImpl.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/BusinessInfoServiceImpl.java @@ -252,4 +252,14 @@ public class BusinessInfoServiceImpl implements BusinessInfoService { businessInfoDao.updateByCellPhNumber(user); } + @Override + public BusinessInfo queryByPhone(String phone){ + return businessInfoDao.queryByPhone(phone); + } + + @Override + public String queryIncome(Integer userId){ + return businessInfoDao.queryIncome(userId); + } + } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/PpPayserviceServiceImpl.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/PpPayserviceServiceImpl.java index b440379..7c18af7 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/PpPayserviceServiceImpl.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/PpPayserviceServiceImpl.java @@ -1,6 +1,7 @@ package com.team7.happycommunity.businessservice.service.impl; import com.team7.happycommunity.businessservice.dao.PpPayserviceDao; +import com.team7.happycommunity.businessservice.entity.EarnIng; import com.team7.happycommunity.businessservice.entity.PpPayservice; import com.team7.happycommunity.businessservice.service.PpPayserviceService; import org.springframework.stereotype.Service; @@ -76,4 +77,9 @@ public class PpPayserviceServiceImpl implements PpPayserviceService { public boolean deleteById(Integer id) { return this.ppPayserviceDao.deleteById(id) > 0; } + + @Override + public List queryEarnByUserId(Integer userId){ + return ppPayserviceDao.queryEarnByUserId(userId); + } } \ No newline at end of file diff --git a/businessservice/src/main/resources/mapper/BusinessInfoDao.xml b/businessservice/src/main/resources/mapper/BusinessInfoDao.xml index ef32e22..e98787a 100644 --- a/businessservice/src/main/resources/mapper/BusinessInfoDao.xml +++ b/businessservice/src/main/resources/mapper/BusinessInfoDao.xml @@ -261,4 +261,12 @@ where cell_ph_number = #{cellPhNumber} + + + + \ No newline at end of file diff --git a/businessservice/src/main/resources/mapper/PpPayserviceDao.xml b/businessservice/src/main/resources/mapper/PpPayserviceDao.xml index a2094dc..48c76e3 100644 --- a/businessservice/src/main/resources/mapper/PpPayserviceDao.xml +++ b/businessservice/src/main/resources/mapper/PpPayserviceDao.xml @@ -14,6 +14,16 @@ + + + + + + + + + + @@ -123,4 +133,7 @@ delete from happycommunity.pp_payservice where id = #{id} + \ No newline at end of file diff --git a/businessservice/src/main/resources/mapper/ServiceImgDao.xml b/businessservice/src/main/resources/mapper/ServiceImgDao.xml index de4e534..4cb6d36 100644 --- a/businessservice/src/main/resources/mapper/ServiceImgDao.xml +++ b/businessservice/src/main/resources/mapper/ServiceImgDao.xml @@ -69,7 +69,7 @@ insert into happycommunity.service_img(serviceid, img) VALUES - (#{rm.id},#{rm.imgUrl}) + (#{rm.serviceid},#{rm.img}) -- Gitee From fc57efbe9e8aaf41d109bdac33b8fd135b309b9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=B4=8B?= <2870485806@qq.com> Date: Thu, 2 Apr 2020 14:11:48 +0800 Subject: [PATCH 07/27] =?UTF-8?q?=E5=95=86=E5=AE=B6=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BusinessImageController.java | 20 +++++ .../controller/PpPayserviceController.java | 78 ++++++++++++++++++- .../controller/ServiceImgController.java | 30 ++----- .../controller/ServiceOrderController.java | 2 +- .../businessservice/dao/PpPayserviceDao.java | 28 +++++++ .../businessservice/dao/ServiceImgDao.java | 6 ++ .../businessservice/entity/PageInfo.java | 51 ++++++++++++ .../businessservice/entity/PpPayservice.java | 42 +++++++++- .../businessservice/mq/PhoneCode.java | 2 +- .../service/BusinessImageService.java | 6 ++ .../service/PpPayserviceService.java | 30 +++++++ .../service/ServiceImgService.java | 8 ++ .../impl/BusinessImageServiceImpl.java | 21 +++++ .../service/impl/PpPayserviceServiceImpl.java | 20 +++++ .../service/impl/ServiceImgServiceImpl.java | 7 ++ .../main/resources/mapper/BusinessInfoDao.xml | 9 ++- .../main/resources/mapper/PpPayserviceDao.xml | 37 +++++++-- .../main/resources/mapper/ServiceImgDao.xml | 5 +- .../main/resources/mapper/ServiceOrderDao.xml | 6 +- 19 files changed, 366 insertions(+), 42 deletions(-) create mode 100644 businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PageInfo.java diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessImageController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessImageController.java index f4d85de..8a1c420 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessImageController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessImageController.java @@ -38,4 +38,24 @@ public class BusinessImageController { } + /** + * 图片上传或者修改 + * @param file 图片 + * @param userId 用户id + * @return + */ + @PostMapping("/uploadHead") + @ResponseBody + public CommonResult uploadHead(MultipartFile file,Integer userId){ + String name= UUID.randomUUID().toString().replace("_",""); + try { + String url = new QiniuUploadUtil().upload(name, file.getBytes()); + businessImageService.uploadHead(url,userId); + return CommonResult.success("上传成功"); + } catch (IOException e) { + e.printStackTrace(); + return CommonResult.success("上传失败"); + } + + } } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java index c044fdd..aaa4780 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java @@ -41,6 +41,8 @@ public class PpPayserviceController { @Resource private ServiceImgService serviceImgService; + + /** * 通过主键查询单条数据 * @@ -77,15 +79,16 @@ public class PpPayserviceController { ServiceImg img=new ServiceImg(); for (Object o : hashList) { System.out.println(o); - img.setImg((String)o); + img.setImg(String.valueOf(o)); img.setServiceid(insert.getId()); list.add(img); } //使用foreach插入多条数据 + //redisTemplate.opsForHash().delete(userId+""); serviceImgService.insertList(list); //返回添加的服务id return CommonResult.success("发布成功"); - } catch (Exception e) { + } catch (Exception e){ e.printStackTrace(); return CommonResult.failed("发布失败"); } @@ -109,4 +112,75 @@ public class PpPayserviceController { } } + + /** + * 查询商家发布的服务,并根据时间排序 + * @param userId 用户id + * @return + */ + @GetMapping("/queryServicedByUserId") + public PageInfo> queryServicedByUserId(Integer userId, Integer page, Integer limit){ + + + //查询总条数 + Integer count=ppPayserviceService.queryCountByUserId(userId); + if (page==null||page.equals("")||page<=0){ + page=1; + } + if(page>count/limit){ + page =(int)Math.ceil(count /Double.valueOf(limit)) ; + } + if (limit==null||limit.equals("")){ + limit=3; + } + Integer start=(page-1)*limit; + + List list=ppPayserviceService.queryServicedByUserId(start,limit,userId); + PageInfo> info=new PageInfo>(list); + info.setLimit(limit); + info.setPage(page); + info.setCount(count); + return info; + } + + /** + * 修改服务状态或删除服务 + * @param status 服务状态,当传输值为2时,删除服务 + * @param id 服务的id + * @return + */ + @GetMapping("/alterStatus") + public CommonResult alterStatus(Integer status,Integer id){ + try { + //删除服务 + if(status==2){ + ppPayserviceService.deleteById(id); + //根据服务的id删除服务的图片 + serviceImgService.deleteByServiceId(id); + } + if(status==0||status==1){ + //修改服务的状态 + ppPayserviceService.updateStatusById(status,id); + } + return CommonResult.success("修改成功"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("修改失败"); + } + + } + + /** + * 根据服务的id查询服务的详细信息 + * @param id 服务id + * @return 服务详情 + */ + @GetMapping("/queryDetailsById") + public PpPayservice queryDetailsById(Integer id){ + return ppPayserviceService.queryDetailsById(id); + } + + public static void main(String[] args) { + System.out.println(Math.ceil(10/Double.valueOf(3))); + } } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java index cb64f88..0fdbfca 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java @@ -14,6 +14,7 @@ import sun.misc.BASE64Decoder; import javax.annotation.Resource; import java.io.IOException; import java.util.UUID; +import java.util.concurrent.TimeUnit; /** * (ServiceImg)表控制层 @@ -44,30 +45,7 @@ public class ServiceImgController { return this.serviceImgService.queryById(id); } -// /** -// * 图片上传 -// * @param file 图片 -// * @param id 服务id -// * @return -// */ -// @PostMapping("/upload") -// @ResponseBody -// public CommonResult upload(MultipartFile file, Integer id,Integer userId){ -// String name= UUID.randomUUID().toString().replace("_",""); -// try { -// String url = new QiniuUploadUtil().upload(name, file.getBytes()); -//// ServiceImg image=new ServiceImg(); -//// image.setServiceid(id); -//// image.setImg(url); -// redisTemplate.opsForHash().put(userId,url,"1"); -// // serviceImgService.insert(image); -// return CommonResult.success("上传成功"); -// } catch (IOException e) { -// e.printStackTrace(); -// return CommonResult.success("上传失败"); -// } -// -// } + /** * 图片上传 @@ -101,7 +79,9 @@ public class ServiceImgController { try { String upload = new QiniuUploadUtil().upload(name, b1); System.out.println("uploaduploadupload"+upload); - redisTemplate.opsForHash().put(userId+"","1",upload); + redisTemplate.opsForHash().put(userId+"",UUID.randomUUID(),upload); + redisTemplate.expire(userId+"", 10, TimeUnit.MINUTES); //设置超时时间10秒 第三个参数控制时间单位,详情查看TimeUnit + } catch (Exception e) { e.printStackTrace(); } diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java index 653c57f..6248263 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java @@ -47,7 +47,7 @@ public class ServiceOrderController { } /** - * 根据商家id和交易状态查询 + * 根据商家id和交易状态查询商家的订单 * @return */ @GetMapping("/queryOrderByUserIdAndStatus") diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/PpPayserviceDao.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/PpPayserviceDao.java index cc12805..a893a59 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/PpPayserviceDao.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/PpPayserviceDao.java @@ -70,4 +70,32 @@ public interface PpPayserviceDao { * @return */ List queryEarnByUserId(Integer userId); + /** + * 根据用户查询商家已发布的服务 + * + * @param start 开始查询的条数 + * @param limit 查几条 + * @param userId 用户id + * @return + */ + List queryServicedByUserId(@Param("start") Integer start, @Param("limit")Integer limit, @Param("userId")Integer userId); + /** + * 根据服务的id修改服务的状态 + * @param status 修改后的服务状态 + * @param id 服务的id + */ + void updateStatusById(@Param("status") Integer status, @Param("id")Integer id); + /** + * 根据服务的id查询服务的详细信息 + * @param id 服务id + * @return 服务详情 + */ + PpPayservice queryDetailsById(Integer id); + + /** + * 根据用户的id,查询发布的总条数 + * @param userId + * @return + */ + Integer queryCountByUserId(Integer userId); } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/ServiceImgDao.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/ServiceImgDao.java index f57e8ad..ac3d1e1 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/ServiceImgDao.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/dao/ServiceImgDao.java @@ -69,4 +69,10 @@ public interface ServiceImgDao { * */ void insertList( List list); + /** + * 删除服务id对应的图片 + * @param id + */ + void deleteByServiceId(Integer id); + } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PageInfo.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PageInfo.java new file mode 100644 index 0000000..3e7de59 --- /dev/null +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PageInfo.java @@ -0,0 +1,51 @@ +package com.team7.happycommunity.businessservice.entity; + +import org.springframework.data.relational.core.sql.In; + +import java.io.Serializable; + +public class PageInfo implements Serializable { + + private T list; + private Integer page; + + private Integer limit; + + private Integer count;//总条数 + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + + public PageInfo(T list) { + this.list = list; + } + + public T getList() { + return list; + } + + public void setList(T list) { + this.list = list; + } + + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public Integer getLimit() { + return limit; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } +} diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java index 568e183..e7e4500 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java @@ -1,6 +1,7 @@ package com.team7.happycommunity.businessservice.entity; import java.io.Serializable; +import java.util.List; /** * (PpPayservice)实体类 @@ -10,7 +11,7 @@ import java.io.Serializable; */ public class PpPayservice implements Serializable { private static final long serialVersionUID = -99092034779783807L; - + private ServiceOrder serviceOrder; private Integer id; private Integer propertyid; @@ -28,8 +29,20 @@ public class PpPayservice implements Serializable { private String icon; private Integer serviceType; + private BusinessInfo businessInfo; - private ServiceOrder serviceOrder; + public BusinessInfo getBusinessInfo() { + return businessInfo; + } + + public void setBusinessInfo(BusinessInfo businessInfo) { + this.businessInfo = businessInfo; + } + + public PpPayservice() { + } + + private List img; private Integer userId;//用户id @@ -53,6 +66,24 @@ public class PpPayservice implements Serializable { this.serviceOrder = serviceOrder; } + public PpPayservice(ServiceOrder serviceOrder, Integer id, Integer propertyid, Integer shopid, String payname, String payprice, String paytime, Integer status, String icon, Integer serviceType, BusinessInfo businessInfo, List img, Integer userId, Integer payway, String servicecontext) { + this.serviceOrder = serviceOrder; + this.id = id; + this.propertyid = propertyid; + this.shopid = shopid; + this.payname = payname; + this.payprice = payprice; + this.paytime = paytime; + this.status = status; + this.icon = icon; + this.serviceType = serviceType; + this.businessInfo = businessInfo; + this.img = img; + this.userId = userId; + this.payway = payway; + this.servicecontext = servicecontext; + } + /** * 支付方式 */ @@ -62,6 +93,13 @@ public class PpPayservice implements Serializable { */ private String servicecontext; + public List getImg() { + return img; + } + + public void setImg(List img) { + this.img = img; + } public Integer getId() { return id; diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java index a350cc7..624b04b 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java @@ -33,7 +33,7 @@ public class PhoneCode { String phone = (String) msg.get("phone"); String code = (String)msg.get("code"); //调用阿里云地址,发送短信 - sendSms.sms(phone,smsCode,param.replace("[value]",code)); + // sendSms.sms(phone,smsCode,param.replace("[value]",code)); //签收 Long tag=(Long)headers.get(AmqpHeaders.DELIVERY_TAG); try { diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/BusinessImageService.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/BusinessImageService.java index ef7d157..5ad9206 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/BusinessImageService.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/BusinessImageService.java @@ -52,4 +52,10 @@ public interface BusinessImageService { */ boolean deleteById(Integer id); + /** + * 上传用户头像或者修改用户头像 + * @param url 链接 + * @param userId 用户的id + */ + void uploadHead(String url, Integer userId); } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/PpPayserviceService.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/PpPayserviceService.java index add6033..82655e7 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/PpPayserviceService.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/PpPayserviceService.java @@ -60,4 +60,34 @@ public interface PpPayserviceService { * @return */ List queryEarnByUserId(Integer userId); + + /** + * 根据用户查询商家已发布的服务 + * + * @param start 开始查询的条数 + * @param limit 查几条 + * @param userId 用户id + * @return + */ + List queryServicedByUserId(Integer start, Integer limit, Integer userId); + + /** + * 根据服务的id修改服务的状态 + * @param status 修改后的服务状态 + * @param id 服务的id + */ + void updateStatusById(Integer status, Integer id); + /** + * 根据服务的id查询服务的详细信息 + * @param id 服务id + * @return 服务详情 + */ + PpPayservice queryDetailsById(Integer id); + + /** + * 根据用户的id,查询发布的总条数 + * @param userId + * @return + */ + Integer queryCountByUserId(Integer userId); } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/ServiceImgService.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/ServiceImgService.java index 6a4ee8d..660f789 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/ServiceImgService.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/ServiceImgService.java @@ -60,4 +60,12 @@ public interface ServiceImgService { * */ void insertList(List list); + + /** + * 删除服务id对应的图片 + * @param id + */ + void deleteByServiceId(Integer id); + + } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/BusinessImageServiceImpl.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/BusinessImageServiceImpl.java index c55f17a..09671e6 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/BusinessImageServiceImpl.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/BusinessImageServiceImpl.java @@ -2,6 +2,7 @@ package com.team7.happycommunity.businessservice.service.impl; import com.team7.happycommunity.businessservice.entity.BusinessImage; import com.team7.happycommunity.businessservice.dao.BusinessImageDao; +import com.team7.happycommunity.businessservice.entity.ServiceImg; import com.team7.happycommunity.businessservice.service.BusinessImageService; import org.springframework.stereotype.Service; @@ -76,4 +77,24 @@ public class BusinessImageServiceImpl implements BusinessImageService { public boolean deleteById(Integer id) { return this.businessImageDao.deleteById(id) > 0; } + + @Override + public void uploadHead(String url, Integer userId){ + //查询该用户是否有头像 + //1.用户没有头像,插入数据 + BusinessImage img=new BusinessImage(); + img.setBusinessInfoId(userId); + img.setType(0); + List businessImages = businessImageDao.queryAll(img); + if(businessImages==null||businessImages.size()==0){ + //上传头像 + img.setUrl(url); + businessImageDao.insert(img); + return; + } + //2.用户已有头像,修改数据 + img.setUrl(url); + img.setId(businessImages.get(0).getId()); + businessImageDao.update(img); + } } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/PpPayserviceServiceImpl.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/PpPayserviceServiceImpl.java index 7c18af7..6f813d8 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/PpPayserviceServiceImpl.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/PpPayserviceServiceImpl.java @@ -82,4 +82,24 @@ public class PpPayserviceServiceImpl implements PpPayserviceService { public List queryEarnByUserId(Integer userId){ return ppPayserviceDao.queryEarnByUserId(userId); } + + @Override + public List queryServicedByUserId(Integer start, Integer limit, Integer userId){ + return ppPayserviceDao.queryServicedByUserId(start,limit,userId); + } + + @Override + public void updateStatusById(Integer status, Integer id){ + ppPayserviceDao.updateStatusById(status,id); + } + + @Override + public PpPayservice queryDetailsById(Integer id){ + return ppPayserviceDao.queryDetailsById(id); + } + + @Override + public Integer queryCountByUserId(Integer userId){ + return ppPayserviceDao.queryCountByUserId(userId); + } } \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/ServiceImgServiceImpl.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/ServiceImgServiceImpl.java index 2123808..0bd8aac 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/ServiceImgServiceImpl.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/ServiceImgServiceImpl.java @@ -82,4 +82,11 @@ public class ServiceImgServiceImpl implements ServiceImgService { this.serviceImgDao.insertList(list); } + @Override + public void deleteByServiceId(Integer id){ + this.serviceImgDao.deleteByServiceId(id); + } + + + } \ No newline at end of file diff --git a/businessservice/src/main/resources/mapper/BusinessInfoDao.xml b/businessservice/src/main/resources/mapper/BusinessInfoDao.xml index e98787a..eacc0cf 100644 --- a/businessservice/src/main/resources/mapper/BusinessInfoDao.xml +++ b/businessservice/src/main/resources/mapper/BusinessInfoDao.xml @@ -200,11 +200,13 @@ SELECT `name`from business_info WHERE business_info.id=#{userId} @@ -267,6 +269,7 @@ \ No newline at end of file diff --git a/businessservice/src/main/resources/mapper/PpPayserviceDao.xml b/businessservice/src/main/resources/mapper/PpPayserviceDao.xml index 48c76e3..2b539df 100644 --- a/businessservice/src/main/resources/mapper/PpPayserviceDao.xml +++ b/businessservice/src/main/resources/mapper/PpPayserviceDao.xml @@ -15,7 +15,7 @@ - + @@ -23,13 +23,22 @@ + + + + + + + + + @@ -37,7 +46,7 @@ @@ -45,7 +54,7 @@ - SELECT endtime,serviceid,payname,payprice from service_order,pp_payservice,business_info WHERE pp_payservice.shopid=business_info.id and pp_payservice.id=service_order.serviceid and service_order.status=2 and business_info.id=#{userId} + SELECT endtime,serviceid,payname,payprice from service_order LEFT JOIN pp_payservice on pp_payservice.id=service_order.serviceid + where pp_payservice.shopid=#{userId} and service_order.status=2 + + + + + UPDATE pp_payservice set status=#{status} where id=#{id} + + + + + \ No newline at end of file diff --git a/businessservice/src/main/resources/mapper/ServiceImgDao.xml b/businessservice/src/main/resources/mapper/ServiceImgDao.xml index 4cb6d36..c4c11aa 100644 --- a/businessservice/src/main/resources/mapper/ServiceImgDao.xml +++ b/businessservice/src/main/resources/mapper/ServiceImgDao.xml @@ -68,9 +68,12 @@ insert into happycommunity.service_img(serviceid, img) VALUES - + (#{rm.serviceid},#{rm.img}) + + delete from happycommunity.service_img where serviceid = #{id} + \ No newline at end of file diff --git a/businessservice/src/main/resources/mapper/ServiceOrderDao.xml b/businessservice/src/main/resources/mapper/ServiceOrderDao.xml index c51573b..113cdc9 100644 --- a/businessservice/src/main/resources/mapper/ServiceOrderDao.xml +++ b/businessservice/src/main/resources/mapper/ServiceOrderDao.xml @@ -96,11 +96,13 @@ -- Gitee From 184cbe23c222c3ed6142d63e121ac02f182857e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B6=B5?= <496989943@qq.com> Date: Fri, 3 Apr 2020 03:19:48 +0800 Subject: [PATCH 08/27] =?UTF-8?q?=E3=80=90=E7=B1=BB=E5=9E=8B=E3=80=91?= =?UTF-8?q?=E6=96=B0=E5=8A=9F=E8=83=BD=20=E3=80=90=E6=8F=8F=E8=BF=B0?= =?UTF-8?q?=E3=80=911.=E8=AE=A2=E5=8D=95=E5=88=97=E8=A1=A8=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=EF=BC=9B2.=E5=AE=8C=E6=88=90=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=AF=B9=E5=95=86=E5=93=81=E7=9A=84=E8=AF=84=E4=BB=B7=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=EF=BC=9B3.=E5=AE=8C=E6=88=90=E5=AF=B9=E8=B4=AD?= =?UTF-8?q?=E4=B9=B0=E5=95=86=E5=93=81=E7=9A=84=E8=AF=84=E4=BB=B7=E7=AD=89?= =?UTF-8?q?=20=E3=80=90=E7=A8=8B=E5=BA=8F=E3=80=91com.woniu.....?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- marketservice/pom.xml | 23 +++- .../com/woniu/MarketserviceApplication.java | 2 + .../java/com/woniu/config/RedisConfig.java | 42 ++++++++ .../controller/PersonUserController.java | 32 +++++- .../UsedProductCommentController.java | 102 ++++++++++++++++++ .../controller/UsedProductController.java | 56 ++++++++-- .../controller/UsedProductImgsController.java | 2 +- .../UsedProductOrderController.java | 33 ++++++ .../java/com/woniu/dao/PersonImageDao.java | 4 + .../com/woniu/dao/UsedProductCommentDao.java | 10 ++ .../com/woniu/dao/UsedProductOrderDao.java | 3 + .../com/woniu/entity/UsedProductComment.java | 25 +++++ .../com/woniu/service/PersonImageService.java | 2 + .../service/UsedProductCommentService.java | 5 + .../service/UsedProductOrderService.java | 2 + .../service/impl/PersonImageServiceImpl.java | 5 + .../impl/UsedProductCommentServiceImpl.java | 15 +++ .../impl/UsedProductOrderServiceImpl.java | 5 + .../woniu/MarketserviceApplicationTests.java | 7 +- 19 files changed, 363 insertions(+), 12 deletions(-) create mode 100644 marketservice/src/main/java/com/woniu/config/RedisConfig.java diff --git a/marketservice/pom.xml b/marketservice/pom.xml index 8e84658..d39a1e5 100644 --- a/marketservice/pom.xml +++ b/marketservice/pom.xml @@ -28,29 +28,45 @@ org.springframework.boot spring-boot-starter-data-redis + + + org.springframework.boot + spring-boot-starter-cache + 2.2.5.RELEASE + + + + com.fasterxml.jackson.core + jackson-databind + 2.10.2 + + org.springframework.boot spring-boot-starter-thymeleaf + org.springframework.boot spring-boot-starter-web + org.mybatis.spring.boot mybatis-spring-boot-starter 2.1.2 + org.springframework.cloud spring-cloud-starter-netflix-eureka-client + org.springframework.cloud spring-cloud-starter-netflix-zuul - com.fasterxml.jackson.core jackson-annotations @@ -63,16 +79,19 @@ runtime true + mysql mysql-connector-java - 5.1.48 + 5.1.47 + org.projectlombok lombok true + org.springframework.boot spring-boot-starter-test diff --git a/marketservice/src/main/java/com/woniu/MarketserviceApplication.java b/marketservice/src/main/java/com/woniu/MarketserviceApplication.java index 0a548b4..498fabb 100644 --- a/marketservice/src/main/java/com/woniu/MarketserviceApplication.java +++ b/marketservice/src/main/java/com/woniu/MarketserviceApplication.java @@ -3,11 +3,13 @@ package com.woniu; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication @MapperScan("com.woniu.dao") @EnableEurekaClient +@EnableCaching //开启声明式缓存 public class MarketserviceApplication { public static void main(String[] args) { diff --git a/marketservice/src/main/java/com/woniu/config/RedisConfig.java b/marketservice/src/main/java/com/woniu/config/RedisConfig.java new file mode 100644 index 0000000..2601438 --- /dev/null +++ b/marketservice/src/main/java/com/woniu/config/RedisConfig.java @@ -0,0 +1,42 @@ +package com.woniu.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.RedisSerializationContext; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +/** + * @ClassName: RedisConfig + * @Description: Redis配置类 + * @Author: Yanghan + * @Date: 2020/4/3 0:06 + */ +@Configuration +public class RedisConfig { + + @Bean + public RedisCacheConfiguration redisCacheConfiguration(){ + RedisCacheConfiguration configuration = RedisCacheConfiguration.defaultCacheConfig(); + configuration = configuration.serializeKeysWith(RedisSerializationContext + .SerializationPair.fromSerializer(new StringRedisSerializer())) + .serializeValuesWith(RedisSerializationContext + .SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer())); + return configuration; + } + + @Bean + public RedisTemplate redisTemplate(RedisConnectionFactory factory){ + RedisTemplate r = new RedisTemplate(); + r.setConnectionFactory(factory); + r.setHashValueSerializer(new GenericJackson2JsonRedisSerializer()); + r.setHashKeySerializer(new StringRedisSerializer()); + r.setValueSerializer(new GenericJackson2JsonRedisSerializer()); + r.setKeySerializer(new StringRedisSerializer()); + return r; + } + +} diff --git a/marketservice/src/main/java/com/woniu/controller/PersonUserController.java b/marketservice/src/main/java/com/woniu/controller/PersonUserController.java index f5fdb02..6646a6e 100644 --- a/marketservice/src/main/java/com/woniu/controller/PersonUserController.java +++ b/marketservice/src/main/java/com/woniu/controller/PersonUserController.java @@ -6,6 +6,7 @@ import com.woniu.entity.PersonImage; import com.woniu.entity.PersonUser; import com.woniu.service.PersonImageService; import com.woniu.service.PersonUserService; +import com.woniu.service.UsedProductCommentService; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -29,9 +30,38 @@ public class PersonUserController { @Resource PersonImageService personImageService; + @Resource + UsedProductCommentService usedProductCommentService; + @Resource CookieUtil cookieUtil; + /** + * 功能描述: 根据商品Id查询当前商品评论用户的所有信息 + * @Param: [] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/4/3 2:32 + */ + @GetMapping("/findByUserId/{productId}") + public CommonResult findByUserId(@PathVariable("productId")Integer productId){ + try { + Integer userId = usedProductCommentService.findUserIdByProductId(productId); + //根据userId查询其所有信息,以及头像图片 + PersonUser personUser = personUserService.queryById(userId); + String url = personImageService.findAllByUserId(userId); + Map map = new HashMap<>(); + map.put("user",personUser); + map.put("url",url); + return CommonResult.success("查询成功",map); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("查询失败"); + } + + + } + /** * 功能描述: 查询当前用户所属小区的所有人的昵称以及头像url * @Param: [] @@ -101,7 +131,7 @@ public class PersonUserController { * @param id 主键 * @return 单条数据 */ - @GetMapping("selectOne") + @GetMapping("/selectOne") public PersonUser selectOne(Integer id) { return this.personUserService.queryById(id); } diff --git a/marketservice/src/main/java/com/woniu/controller/UsedProductCommentController.java b/marketservice/src/main/java/com/woniu/controller/UsedProductCommentController.java index 2e22651..81ade28 100644 --- a/marketservice/src/main/java/com/woniu/controller/UsedProductCommentController.java +++ b/marketservice/src/main/java/com/woniu/controller/UsedProductCommentController.java @@ -1,11 +1,16 @@ package com.woniu.controller; +import com.woniu.common.CommonResult; +import com.woniu.entity.PersonUser; import com.woniu.entity.UsedProductComment; +import com.woniu.service.PersonUserService; import com.woniu.service.UsedProductCommentService; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.Date; +import java.util.List; /** * 商品评价表(UsedProductComment)表控制层 @@ -22,6 +27,103 @@ public class UsedProductCommentController { @Resource private UsedProductCommentService usedProductCommentService; + @Resource + PersonUserService personUserService; + + /** + * 功能描述: 根据商品Id查询所有评论 + * @Param: [productId] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/4/3 2:15 + */ + @GetMapping("/findAllByProductId/{productId}") + public @ResponseBody CommonResult findAllByProductId(@PathVariable("productId")Integer productId){ + try { + List usedProductComments = usedProductCommentService.findAllByProductId(productId); + return CommonResult.success("查询成功",usedProductComments); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("查询失败"); + } + } + + /** + * 功能描述: 根据商品Id查询商品是否有评论 + * @Param: [productId] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/4/3 2:14 + */ + @GetMapping("/selectOrderByProductId/{productId}") + public @ResponseBody CommonResult selectOrderByProductId(@PathVariable("productId")Integer productId){ + List usedProductComments = null; + try { + usedProductComments = usedProductCommentService.findAllByProductId(productId); + //当前商品有评论就是0,没评论就是1 + if (usedProductComments.size()>0){ + return CommonResult.success("0"); + }else { + return CommonResult.success("1"); + } + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("0"); + } + + } + + /** + * 功能描述: 查询当前订单评论是否有值 + * @Param: [orderId] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/4/2 19:57 + */ + @GetMapping("/selectOrderByNull/{orderId}") + public @ResponseBody CommonResult selectOrderByNull(@PathVariable("orderId")Integer orderId){ + List usedProductComments = null; + try { + usedProductComments = usedProductCommentService.findAllByOrderId(orderId); + //当前商品有评论就是0,没评论就是1 + if (usedProductComments.size()>0){ + return CommonResult.success("0"); + }else { + return CommonResult.success("1"); + } + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("0"); + } + + } + + /** + * 功能描述: 保存评论 + * @Param: [usedProductComment] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/4/2 19:56 + */ + @PostMapping("/saveComment") + public @ResponseBody CommonResult saveComment(UsedProductComment usedProductComment){ + //获取当前登录的用户的用户名 +// String name = cookieUtil.getName(); + String name = "admin"; + //查询用户Id + PersonUser personUser = personUserService.findIdByName(name); + usedProductComment.setCommentTime(new Date()); + usedProductComment.setUserId(personUser.getId()); + //保存到数据库 + try { + usedProductCommentService.insert(usedProductComment); + return CommonResult.success("评价成功"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("评价失败"); + } + } + /** * 通过主键查询单条数据 * diff --git a/marketservice/src/main/java/com/woniu/controller/UsedProductController.java b/marketservice/src/main/java/com/woniu/controller/UsedProductController.java index 2aac44d..f8a7719 100644 --- a/marketservice/src/main/java/com/woniu/controller/UsedProductController.java +++ b/marketservice/src/main/java/com/woniu/controller/UsedProductController.java @@ -5,6 +5,8 @@ import com.woniu.common.CookieUtil; import com.woniu.common.QiniuUploadUtil; import com.woniu.entity.*; import com.woniu.service.*; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -46,7 +48,40 @@ public class UsedProductController { @Resource CookieUtil cookieUtil; - private String imgUrl; + @Autowired + RedisTemplate redisTemplate; + + + /** + * 功能描述: 查询已付款的商品 + * @Param: [] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/4/2 17:37 + */ + @GetMapping("/yespayProduct") + public @ResponseBody CommonResult yespayProduct(){ + //获取当前登录的用户的用户名 +// String name = cookieUtil.getName(); + String name = "admin"; + //查询用户Id + PersonUser personUser = personUserService.findIdByName(name); + //已付款(未付款 0 ,已付款 1) + Integer orderStatus = 1; + //二手市场商品 + Integer orderType = 1; + ArrayList productIdList = usedProductOrderService.findProductIdByPayStatus(personUser.getId(), orderStatus, orderType); + if (productIdList == null){ + return CommonResult.failed("当前暂无数据"); + } + //查询商品数据 + ArrayList usedProducts = new ArrayList<>(); + for (Integer id:productIdList) { + UsedProduct usedProduct = usedProductService.queryById(id); + usedProducts.add(usedProduct); + } + return CommonResult.success("查询成功",usedProducts); + } /** * 功能描述: 查询未付款的商品 @@ -91,15 +126,18 @@ public class UsedProductController { */ @PutMapping("/updateProduct") public @ResponseBody CommonResult updateProduct(UsedProduct usedProduct){ + //获取当前登录的用户的用户名 +// String name = cookieUtil.getName(); + String name = "admin"; try { usedProduct.setLastTime(new Date()); usedProductService.update(usedProduct); //将图片链接保存到图片表中,商品id UsedProductImgs productImgs = new UsedProductImgs(); - productImgs.setImgUrl(imgUrl); + productImgs.setImgUrl((String) redisTemplate.opsForValue().get(name+"img")); productImgs.setProductId(usedProduct.getId()); usedProductImgsService.insert(productImgs); - imgUrl = null; + redisTemplate.delete(name+"img"); return CommonResult.success("更新成功"); } catch (Exception e) { e.printStackTrace(); @@ -330,7 +368,6 @@ public class UsedProductController { */ @PostMapping("/upload") public @ResponseBody CommonResult upload(String imgBase){ - imgUrl = null; byte[] b1 = null; BASE64Decoder decoder = new BASE64Decoder(); try{ @@ -353,10 +390,15 @@ public class UsedProductController { } //添加图片url; String name = UUID.randomUUID().toString().replace("_", ""); + //获取当前登录的用户的用户名 +// String name = cookieUtil.getName(); + String userName = "admin"; try { - imgUrl = new QiniuUploadUtil().upload(name, b1); + String imgUrl = new QiniuUploadUtil().upload(name, b1); //图片链接else System.out.println(imgUrl); + //将图片链接存入redis中 + redisTemplate.opsForValue().set(userName+"img",imgUrl); return CommonResult.success("1"); } catch (Exception e) { e.printStackTrace(); @@ -396,10 +438,10 @@ public class UsedProductController { UsedProduct usedProduct1 = usedProductService.insert(usedProduct); //将图片链接保存到图片表中,商品id UsedProductImgs productImgs = new UsedProductImgs(); - productImgs.setImgUrl(imgUrl); + productImgs.setImgUrl((String) redisTemplate.opsForValue().get(name+"img")); productImgs.setProductId(usedProduct1.getId()); usedProductImgsService.insert(productImgs); - imgUrl = null; + redisTemplate.delete(name+"img"); return CommonResult.success(usedProduct1.getId()); } catch (Exception e) { e.printStackTrace(); diff --git a/marketservice/src/main/java/com/woniu/controller/UsedProductImgsController.java b/marketservice/src/main/java/com/woniu/controller/UsedProductImgsController.java index 5ad6398..a779765 100644 --- a/marketservice/src/main/java/com/woniu/controller/UsedProductImgsController.java +++ b/marketservice/src/main/java/com/woniu/controller/UsedProductImgsController.java @@ -59,7 +59,7 @@ public class UsedProductImgsController { List imgs = usedProductImgsService.findImgsByProductId(productId); UsedProductImgs img = null; if (imgs.size()>0){ - img = imgs.get(imgs.size()-1); + img = imgs.get(0); return CommonResult.success(img); }else { return CommonResult.failed("失败"); diff --git a/marketservice/src/main/java/com/woniu/controller/UsedProductOrderController.java b/marketservice/src/main/java/com/woniu/controller/UsedProductOrderController.java index e288192..9ccd164 100644 --- a/marketservice/src/main/java/com/woniu/controller/UsedProductOrderController.java +++ b/marketservice/src/main/java/com/woniu/controller/UsedProductOrderController.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.List; import java.util.UUID; /** @@ -37,6 +38,38 @@ public class UsedProductOrderController { @Resource UsedProductService usedProductService; + /** + * 功能描述: 查询当前用户的所有订单 + * @Param: [] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/4/2 17:11 + */ + @GetMapping("/findAllOrder") + public CommonResult findAllOrder(){ + //获取当前登录用户Id + //获取当前登录的用户的用户名 +// String name = cookieUtil.getName(); + String name = "admin"; + //查询用户Id + PersonUser personUser = personUserService.findIdByName(name); + try { + List orderList = usedProductOrderService.findOrderByUserId(personUser.getId()); + return CommonResult.success("查询成功",orderList); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("查询失败"); + } + + } + + /** + * 功能描述: 删除订单 + * @Param: [productId] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/3/31 9:58 + */ @DeleteMapping("/deleteOrder/{productId}") public CommonResult deleteOrder(@PathVariable("productId")Integer productId){ //获取当前登录用户Id diff --git a/marketservice/src/main/java/com/woniu/dao/PersonImageDao.java b/marketservice/src/main/java/com/woniu/dao/PersonImageDao.java index a8bc9da..4c634eb 100644 --- a/marketservice/src/main/java/com/woniu/dao/PersonImageDao.java +++ b/marketservice/src/main/java/com/woniu/dao/PersonImageDao.java @@ -2,6 +2,7 @@ package com.woniu.dao; import com.woniu.entity.PersonImage; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import java.util.ArrayList; import java.util.List; @@ -65,4 +66,7 @@ public interface PersonImageDao { int deleteById(Integer id); List findImgByListUserId(ArrayList userId); + + @Select("select url from person_image where person_user_id = #{value}") + String findAllByUserId(Integer userId); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/dao/UsedProductCommentDao.java b/marketservice/src/main/java/com/woniu/dao/UsedProductCommentDao.java index 6a4ee7a..2036640 100644 --- a/marketservice/src/main/java/com/woniu/dao/UsedProductCommentDao.java +++ b/marketservice/src/main/java/com/woniu/dao/UsedProductCommentDao.java @@ -2,6 +2,8 @@ package com.woniu.dao; import com.woniu.entity.UsedProductComment; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + import java.util.List; /** @@ -62,4 +64,12 @@ public interface UsedProductCommentDao { */ int deleteById(Integer id); + @Select("select * from used_product_comment where order_id = #{value}") + List findAllByOrderId(Integer orderId); + + @Select("select * from used_product_comment where product_id = #{value}") + List findAllByProductId(Integer productId); + + @Select("select distinct user_id from used_product_comment where product_id = #{value}") + Integer findUserIdByProductId(Integer productId); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/dao/UsedProductOrderDao.java b/marketservice/src/main/java/com/woniu/dao/UsedProductOrderDao.java index 6b75acc..7e6a184 100644 --- a/marketservice/src/main/java/com/woniu/dao/UsedProductOrderDao.java +++ b/marketservice/src/main/java/com/woniu/dao/UsedProductOrderDao.java @@ -74,4 +74,7 @@ public interface UsedProductOrderDao { @Delete("delete from used_product_order where user_id = #{id} and product_id = #{productId} and product_order_type = #{orderType}") void deleteOrderByProductId(@Param("id") Integer id,@Param("productId") Integer productId,@Param("orderType") Integer orderType); + + @Select("select * from used_product_order where user_id = #{value}") + List findOrderByUserId(Integer id); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/entity/UsedProductComment.java b/marketservice/src/main/java/com/woniu/entity/UsedProductComment.java index 43168fb..ad06012 100644 --- a/marketservice/src/main/java/com/woniu/entity/UsedProductComment.java +++ b/marketservice/src/main/java/com/woniu/entity/UsedProductComment.java @@ -40,6 +40,18 @@ public class UsedProductComment implements Serializable { */ private Integer number; + /** + * 订单Id + */ + private Integer orderId; + + public Integer getOrderId() { + return orderId; + } + + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } public Integer getId() { return id; @@ -97,4 +109,17 @@ public class UsedProductComment implements Serializable { this.number = number; } + @Override + public String toString() { + return "UsedProductComment{" + + "id=" + id + + ", productId=" + productId + + ", userId=" + userId + + ", comment='" + comment + '\'' + + ", commentTime=" + commentTime + + ", start=" + start + + ", number=" + number + + ", orderId=" + orderId + + '}'; + } } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/PersonImageService.java b/marketservice/src/main/java/com/woniu/service/PersonImageService.java index 932de87..395fb84 100644 --- a/marketservice/src/main/java/com/woniu/service/PersonImageService.java +++ b/marketservice/src/main/java/com/woniu/service/PersonImageService.java @@ -55,4 +55,6 @@ public interface PersonImageService { boolean deleteById(Integer id); List findImgByListUserId(ArrayList userId); + + String findAllByUserId(Integer userId); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/UsedProductCommentService.java b/marketservice/src/main/java/com/woniu/service/UsedProductCommentService.java index 1a8caff..cd3a12e 100644 --- a/marketservice/src/main/java/com/woniu/service/UsedProductCommentService.java +++ b/marketservice/src/main/java/com/woniu/service/UsedProductCommentService.java @@ -52,4 +52,9 @@ public interface UsedProductCommentService { */ boolean deleteById(Integer id); + List findAllByOrderId(Integer orderId); + + List findAllByProductId(Integer productId); + + Integer findUserIdByProductId(Integer productId); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/UsedProductOrderService.java b/marketservice/src/main/java/com/woniu/service/UsedProductOrderService.java index b88a2c0..4ae85be 100644 --- a/marketservice/src/main/java/com/woniu/service/UsedProductOrderService.java +++ b/marketservice/src/main/java/com/woniu/service/UsedProductOrderService.java @@ -59,4 +59,6 @@ public interface UsedProductOrderService { ArrayList findProductIdByPayStatus(Integer id, Integer orderStatus, Integer orderType); void deleteOrderByProductId(Integer id, Integer productId, Integer orderType); + + List findOrderByUserId(Integer id); } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/impl/PersonImageServiceImpl.java b/marketservice/src/main/java/com/woniu/service/impl/PersonImageServiceImpl.java index 6ed897b..37c9069 100644 --- a/marketservice/src/main/java/com/woniu/service/impl/PersonImageServiceImpl.java +++ b/marketservice/src/main/java/com/woniu/service/impl/PersonImageServiceImpl.java @@ -82,4 +82,9 @@ public class PersonImageServiceImpl implements PersonImageService { public List findImgByListUserId(ArrayList userId) { return personImageDao.findImgByListUserId(userId); } + + @Override + public String findAllByUserId(Integer userId) { + return personImageDao.findAllByUserId(userId); + } } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/impl/UsedProductCommentServiceImpl.java b/marketservice/src/main/java/com/woniu/service/impl/UsedProductCommentServiceImpl.java index 72a8163..3b8f3ff 100644 --- a/marketservice/src/main/java/com/woniu/service/impl/UsedProductCommentServiceImpl.java +++ b/marketservice/src/main/java/com/woniu/service/impl/UsedProductCommentServiceImpl.java @@ -76,4 +76,19 @@ public class UsedProductCommentServiceImpl implements UsedProductCommentService public boolean deleteById(Integer id) { return this.usedProductCommentDao.deleteById(id) > 0; } + + @Override + public List findAllByOrderId(Integer orderId) { + return usedProductCommentDao.findAllByOrderId(orderId); + } + + @Override + public List findAllByProductId(Integer productId) { + return usedProductCommentDao.findAllByProductId(productId); + } + + @Override + public Integer findUserIdByProductId(Integer productId) { + return usedProductCommentDao.findUserIdByProductId(productId); + } } \ No newline at end of file diff --git a/marketservice/src/main/java/com/woniu/service/impl/UsedProductOrderServiceImpl.java b/marketservice/src/main/java/com/woniu/service/impl/UsedProductOrderServiceImpl.java index c873323..9f19e00 100644 --- a/marketservice/src/main/java/com/woniu/service/impl/UsedProductOrderServiceImpl.java +++ b/marketservice/src/main/java/com/woniu/service/impl/UsedProductOrderServiceImpl.java @@ -92,4 +92,9 @@ public class UsedProductOrderServiceImpl implements UsedProductOrderService { public void deleteOrderByProductId(Integer id, Integer productId, Integer orderType) { usedProductOrderDao.deleteOrderByProductId(id,productId,orderType); } + + @Override + public List findOrderByUserId(Integer id) { + return usedProductOrderDao.findOrderByUserId(id); + } } \ No newline at end of file diff --git a/marketservice/src/test/java/com/woniu/MarketserviceApplicationTests.java b/marketservice/src/test/java/com/woniu/MarketserviceApplicationTests.java index 30854ae..393514c 100644 --- a/marketservice/src/test/java/com/woniu/MarketserviceApplicationTests.java +++ b/marketservice/src/test/java/com/woniu/MarketserviceApplicationTests.java @@ -1,7 +1,9 @@ package com.woniu; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.data.redis.core.RedisTemplate; import java.text.SimpleDateFormat; import java.util.Date; @@ -10,9 +12,12 @@ import java.util.UUID; @SpringBootTest class MarketserviceApplicationTests { + @Autowired + RedisTemplate redisTemplate; + @Test void contextLoads() { - + redisTemplate.delete("test"); } } -- Gitee From 9e685b8973f7459bc93f9ddb4d8f013e268e4874 Mon Sep 17 00:00:00 2001 From: starlbb Date: Fri, 3 Apr 2020 19:32:58 +0800 Subject: [PATCH 09/27] =?UTF-8?q?=E7=A4=BE=E5=8C=BA=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=AE=8C=E5=96=84=EF=BC=8C=E6=94=AF=E4=BB=98=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- communityservice/pom.xml | 7 + .../woniu/controller/ActivityController.java | 5 - .../woniu/controller/CommunityController.java | 11 -- .../woniu/controller/NoticeController.java | 35 ++++ .../com/woniu/dao/ActivityUserMapper.java | 3 + .../com/woniu/dao/AnnouncementMapper.java | 25 +++ .../java/com/woniu/dao/DynamicMapper.java | 9 +- .../java/com/woniu/dao/areaInfoMapper.java | 17 ++ .../main/java/com/woniu/dto/ActivityPost.java | 22 ++- .../main/java/com/woniu/dto/NoticePost.java | 26 +++ .../java/com/woniu/pojo/Announcement.java | 20 ++ .../main/java/com/woniu/pojo/AreaInfo.java | 15 ++ .../java/com/woniu/service/NoticeService.java | 15 ++ .../service/impl/ActivityServiceImpl.java | 34 +++- .../service/impl/DynamicServiceImpl.java | 21 ++- .../woniu/service/impl/NoticeServiceImpl.java | 27 +++ .../src/main/resources/application.yml | 5 + .../src/main/resources/generatorConfig.xml | 19 +- .../CommunityserviceApplicationTests.java | 21 +++ gatway/src/main/resources/application.yml | 2 +- payservice/pom.xml | 15 ++ .../com/woniu/controller/PayController.java | 50 +++-- .../com/woniu/dao/CommunityOrderMapper.java | 21 +++ .../com/woniu/dao/CommunityPayMapper.java | 23 +++ .../java/com/woniu/pojo/CommunityOrder.java | 115 ++++++++++++ .../java/com/woniu/pojo/CommunityPay.java | 105 +++++++++++ .../java/com/woniu/service/PayService.java | 28 ++- .../woniu/service/impl/PayServiceImpl.java | 177 +++++++++++++++++- .../src/main/resources/generatorConfig.xml | 80 ++++++++ .../resources/mapper/CommunityOrderMapper.xml | 164 ++++++++++++++++ .../resources/mapper/CommunityPayMapper.xml | 172 +++++++++++++++++ .../src/main/resources/application.yml | 6 +- 32 files changed, 1222 insertions(+), 73 deletions(-) delete mode 100644 communityservice/src/main/java/com/woniu/controller/CommunityController.java create mode 100644 communityservice/src/main/java/com/woniu/controller/NoticeController.java create mode 100644 communityservice/src/main/java/com/woniu/dao/AnnouncementMapper.java create mode 100644 communityservice/src/main/java/com/woniu/dao/areaInfoMapper.java create mode 100644 communityservice/src/main/java/com/woniu/dto/NoticePost.java create mode 100644 communityservice/src/main/java/com/woniu/pojo/Announcement.java create mode 100644 communityservice/src/main/java/com/woniu/pojo/AreaInfo.java create mode 100644 communityservice/src/main/java/com/woniu/service/NoticeService.java create mode 100644 communityservice/src/main/java/com/woniu/service/impl/NoticeServiceImpl.java create mode 100644 payservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java create mode 100644 payservice/src/main/java/com/woniu/dao/CommunityPayMapper.java create mode 100644 payservice/src/main/java/com/woniu/pojo/CommunityOrder.java create mode 100644 payservice/src/main/java/com/woniu/pojo/CommunityPay.java create mode 100644 payservice/src/main/resources/generatorConfig.xml create mode 100644 payservice/src/main/resources/mapper/CommunityOrderMapper.xml create mode 100644 payservice/src/main/resources/mapper/CommunityPayMapper.xml diff --git a/communityservice/pom.xml b/communityservice/pom.xml index 2fb8b72..343ebc6 100644 --- a/communityservice/pom.xml +++ b/communityservice/pom.xml @@ -95,6 +95,13 @@ 1.2.62 + + + com.github.pagehelper + pagehelper-spring-boot-starter + 1.2.10 + + diff --git a/communityservice/src/main/java/com/woniu/controller/ActivityController.java b/communityservice/src/main/java/com/woniu/controller/ActivityController.java index 3de01e0..aebf4ea 100644 --- a/communityservice/src/main/java/com/woniu/controller/ActivityController.java +++ b/communityservice/src/main/java/com/woniu/controller/ActivityController.java @@ -18,11 +18,6 @@ import java.util.Map; @RequestMapping("/activity") public class ActivityController { - @GetMapping("/test") - @ResponseBody - public String test(){ - return "tttttt"; - } @Autowired private ActivityService activityService; diff --git a/communityservice/src/main/java/com/woniu/controller/CommunityController.java b/communityservice/src/main/java/com/woniu/controller/CommunityController.java deleted file mode 100644 index 9b2e3be..0000000 --- a/communityservice/src/main/java/com/woniu/controller/CommunityController.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.woniu.controller; - -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; - -@Controller -@RequestMapping("/community") -public class CommunityController { - - -} diff --git a/communityservice/src/main/java/com/woniu/controller/NoticeController.java b/communityservice/src/main/java/com/woniu/controller/NoticeController.java new file mode 100644 index 0000000..39bdcbf --- /dev/null +++ b/communityservice/src/main/java/com/woniu/controller/NoticeController.java @@ -0,0 +1,35 @@ +package com.woniu.controller; + +import com.woniu.dto.NoticePost; +import com.woniu.result.CommonResult; +import com.woniu.service.NoticeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +@Controller +@RequestMapping("/notice") +public class NoticeController { + + @Autowired + private NoticeService noticeService; + + /** + * 查询社区公告 + * @param key 社区名关键字 + * @param page 当前页,即第几次加载,每次加载10条数据 + * @return + */ + @GetMapping("/list") + @ResponseBody + public CommonResult list(String key,Integer page){ + System.out.println(key+":"+page); + List noticePosts = noticeService.selectByKey(key,page); + System.out.println(noticePosts.size()); + return CommonResult.success(noticePosts); + } +} diff --git a/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java b/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java index 0fa2602..74d1729 100644 --- a/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java +++ b/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java @@ -22,4 +22,7 @@ public interface ActivityUserMapper { @Select(value = "delete from community_activity_user where cau_activity_id = #{activityId} and cau_user_id = #{userId}") void deleteById(Integer activityId, Integer userId); + + @Select(value = "select name from person_user where id = #{userId}") + String selectNameById(Integer userId); } \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/dao/AnnouncementMapper.java b/communityservice/src/main/java/com/woniu/dao/AnnouncementMapper.java new file mode 100644 index 0000000..6cf958b --- /dev/null +++ b/communityservice/src/main/java/com/woniu/dao/AnnouncementMapper.java @@ -0,0 +1,25 @@ +package com.woniu.dao; + +import com.woniu.dto.NoticePost; +import com.woniu.pojo.Announcement; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface AnnouncementMapper { + int deleteByPrimaryKey(Integer id); + + int insert(Announcement record); + + int insertSelective(Announcement record); + + Announcement selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(Announcement record); + + int updateByPrimaryKey(Announcement record); + + @Select(value = "select * from announcement am,areainfo ai where am.area_id = ai.id and ai.area_name like concat('%',#{key},'%') order by create_time desc") + List selectByKey(@Param("key") String key, @Param("currentPage") Integer page, @Param("pageSize") Integer num); +} \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java b/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java index ac94952..11eca15 100644 --- a/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java +++ b/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java @@ -3,6 +3,7 @@ package com.woniu.dao; import com.woniu.dto.DynamicCommentDto; import com.woniu.dto.DynamicPost; import com.woniu.pojo.Dynamic; +import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import java.util.List; @@ -22,8 +23,8 @@ public interface DynamicMapper { int updateByPrimaryKey(Dynamic record); - @Select(value = "select cd.*,pi.url,pu.name from community_dynamic cd,person_image pi,person_user pu where cd.cd_user_id = pu.id and pu.id = pi.person_user_id and cd_type = #{type} order by cd_favor desc limit #{page},10") - List selectByType(Integer type, Integer page); + @Select(value = "select cd.*,pi.url,pu.name from community_dynamic cd,person_image pi,person_user pu where cd.cd_user_id = pu.id and pu.id = pi.person_user_id and cd_type = #{type} order by cd_favor desc") + List selectByType(Integer type, @Param("currentPage") Integer page, @Param("pageSize") Integer num); @Select(value = "select cdc.*,pu.name from community_dynamic_comment cdc,person_user pu where cdc.cdc_dynamic_id=#{dynamicId} and cdc.cdc_user_id = pu.id") List selectById(Integer dynamicId); @@ -34,6 +35,6 @@ public interface DynamicMapper { @Select(value = "select cd.*,pi.url,pu.name from community_dynamic cd,person_image pi,person_user pu where cd.cd_user_id = pu.id and pu.id = pi.person_user_id and cd.id = #{dynamicId}") DynamicPost selectDynamicById(Integer dynamicId); - @Select(value = "select cd.*,pi.url,pu.name from community_dynamic cd,person_image pi,person_user pu where cd.cd_user_id = pu.id and pu.id = pi.person_user_id order by cd_favor desc limit #{page},10") - List selectByPage(Integer page); + @Select(value = "select cd.*,pi.url,pu.name from community_dynamic cd,person_image pi,person_user pu where cd.cd_user_id = pu.id and pu.id = pi.person_user_id order by cd_favor desc") + List selectByPage(@Param("currentPage") Integer page, @Param("pageSize") Integer num); } \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/dao/areaInfoMapper.java b/communityservice/src/main/java/com/woniu/dao/areaInfoMapper.java new file mode 100644 index 0000000..d01bc10 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/dao/areaInfoMapper.java @@ -0,0 +1,17 @@ +package com.woniu.dao; + +import com.woniu.pojo.AreaInfo; + +public interface areaInfoMapper { + int deleteByPrimaryKey(Integer id); + + int insert(AreaInfo record); + + int insertSelective(AreaInfo record); + + AreaInfo selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(AreaInfo record); + + int updateByPrimaryKey(AreaInfo record); +} \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/dto/ActivityPost.java b/communityservice/src/main/java/com/woniu/dto/ActivityPost.java index aacacd3..a8bd71f 100644 --- a/communityservice/src/main/java/com/woniu/dto/ActivityPost.java +++ b/communityservice/src/main/java/com/woniu/dto/ActivityPost.java @@ -10,19 +10,29 @@ public class ActivityPost implements Serializable { private Integer id; - private Integer caUserId; +// private Integer caUserId; private String caTitle; - private Date caStartTime; - - private Date caEndTime; +// private Date caStartTime; +// +// private Date caEndTime; private Date caCreateTime; - private String caContent; +// private String caContent; - private String url; +// private String url; private String name; + + private String caPicPath; + + private Integer caStatus; + + private Double caMoney; + + private Integer caPeopelCount; + + private Integer caMaxPeopleCount; } diff --git a/communityservice/src/main/java/com/woniu/dto/NoticePost.java b/communityservice/src/main/java/com/woniu/dto/NoticePost.java new file mode 100644 index 0000000..59ccaeb --- /dev/null +++ b/communityservice/src/main/java/com/woniu/dto/NoticePost.java @@ -0,0 +1,26 @@ +package com.woniu.dto; + +import lombok.Data; + +import java.util.Date; + +@Data +public class NoticePost { + private String areaName; + + private Date createTime; + + private String title; + + private String context; + + public NoticePost() { + } + + public NoticePost(String areaName, Date createTime, String title, String context) { + this.areaName = areaName; + this.createTime = createTime; + this.title = title; + this.context = context; + } +} diff --git a/communityservice/src/main/java/com/woniu/pojo/Announcement.java b/communityservice/src/main/java/com/woniu/pojo/Announcement.java new file mode 100644 index 0000000..bd6c683 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/pojo/Announcement.java @@ -0,0 +1,20 @@ +package com.woniu.pojo; + +import lombok.Data; + +import java.util.Date; + +@Data +public class Announcement { + private Integer id; + + private String context; + + private Integer areaId; + + private Date createTime; + + private String title; + + private Integer status; +} \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/pojo/AreaInfo.java b/communityservice/src/main/java/com/woniu/pojo/AreaInfo.java new file mode 100644 index 0000000..2ef2472 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/pojo/AreaInfo.java @@ -0,0 +1,15 @@ +package com.woniu.pojo; + +import lombok.Data; + +@Data +public class AreaInfo { + private Integer id; + + private String areaName; + + private String areaAddress; + + private String detail1; + +} \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/service/NoticeService.java b/communityservice/src/main/java/com/woniu/service/NoticeService.java new file mode 100644 index 0000000..0a51d11 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/service/NoticeService.java @@ -0,0 +1,15 @@ +package com.woniu.service; + +import com.woniu.dto.NoticePost; + +import java.util.List; + +public interface NoticeService { + /** + * 根据社区名查找社区公告,为空则查所有公告 + * @param key + * @param page + * @return + */ + List selectByKey(String key, Integer page); +} diff --git a/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java b/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java index 7603320..94b9640 100644 --- a/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java +++ b/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java @@ -89,8 +89,8 @@ public class ActivityServiceImpl implements ActivityService { //活动信息 Activity activity = activityMapper.selectByPrimaryKey(activityId); activityDetail.setActivity(activity); - //用户信息,这里调用其他服务,暂时先用固定的值替代 - String userName = "张三"; + //活动发布用户名字 + String userName = activityUserMapper.selectNameById(activity.getCaUserId()); activityDetail.setUserName(userName); //处理状态 switch (activity.getCaStatus()){ @@ -98,14 +98,19 @@ public class ActivityServiceImpl implements ActivityService { case 1:activityDetail.setStatus("进行中");break; case 2:activityDetail.setStatus("已结束"); } - //报名状态 - Integer userCount = activityUserMapper.selectByIdAndUserId(activityId,userId); - if(activity.getCaStatus()==2){ - activityDetail.setSignUp("已结束"); - }else if(userCount!=null){ - activityDetail.setSignUp("取消报名"); - }else if(activity.getCaMaxPeopleCount()==activity.getCaPeopelCount()){ - activityDetail.setSignUp("已结束"); + //如果用户没登录,则显示初始值,即 立即报名 + if(userId!=null){ + //报名状态 + Integer userCount = activityUserMapper.selectByIdAndUserId(activityId,userId); + if(activity.getCaStatus()==2){ + activityDetail.setSignUp("已结束"); + }else if(userCount!=null && activity.getCaStatus()==0){ + activityDetail.setSignUp("取消报名"); + }else if(userCount!=null && activity.getCaStatus()==1){ + activityDetail.setSignUp("已报名"); + } else if(activity.getCaMaxPeopleCount()==activity.getCaPeopelCount()){ + activityDetail.setSignUp("已结束"); + } } return activityDetail; } @@ -117,8 +122,13 @@ public class ActivityServiceImpl implements ActivityService { */ @Override public void saveSignUp(Integer activityId, Integer userId) { + //新增报名用户数据 ActivityUser activityUser = new ActivityUser(activityId,userId); activityUserMapper.insertSelective(activityUser); + //活动人数+1 + Activity activity = activityMapper.selectByPrimaryKey(activityId); + activity.setCaPeopelCount(activity.getCaPeopelCount()+1); + activityMapper.updateByPrimaryKeySelective(activity); } /** @@ -129,6 +139,10 @@ public class ActivityServiceImpl implements ActivityService { @Override public void deleteById(Integer activityId, Integer userId) { activityUserMapper.deleteById(activityId,userId); + //活动人数-1 + Activity activity = activityMapper.selectByPrimaryKey(activityId); + activity.setCaPeopelCount(activity.getCaPeopelCount()-1); + activityMapper.updateByPrimaryKeySelective(activity); } /** diff --git a/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java b/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java index ada8610..13a89a1 100644 --- a/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java +++ b/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java @@ -53,9 +53,9 @@ public class DynamicServiceImpl implements DynamicService { //判断是否是查询全部类型,0:全部 List dynamicPosts; if(type == 0){ - dynamicPosts = dynamicMapper.selectByPage(page); + dynamicPosts = dynamicMapper.selectByPage(page,10); }else{ - dynamicPosts = dynamicMapper.selectByType(type,page); + dynamicPosts = dynamicMapper.selectByType(type,page,10); } //新增评论数量信息 @@ -66,13 +66,16 @@ public class DynamicServiceImpl implements DynamicService { for(int i=0;i list = communityFavorMapper.selectIdByUserId(userId); - //遍历加载的新动态 - for(int i=0;i list = communityFavorMapper.selectIdByUserId(userId); + //遍历加载的新动态 + for(int i=0;i selectByKey(String key, Integer page) { + return announcementMapper.selectByKey(key,page,10); + } +} diff --git a/communityservice/src/main/resources/application.yml b/communityservice/src/main/resources/application.yml index 4c8e248..62dbc15 100644 --- a/communityservice/src/main/resources/application.yml +++ b/communityservice/src/main/resources/application.yml @@ -12,6 +12,11 @@ spring: port: 6379 application: name: community +pagehelper: + params: pageNum=currentPage,pageSize=pageSize + reasonable: false #是否启动参数合理话,即pageNum<0 或者>max 时,自动变为1和最后一页,不启用则返回空数据,因为前端采用流加载,所以不启用更好 + support-methods-arguments: true #用于从对象中根据属性名取值 + helper-dialect: mysql mybatis: configuration: map-underscore-to-camel-case: true diff --git a/communityservice/src/main/resources/generatorConfig.xml b/communityservice/src/main/resources/generatorConfig.xml index b3e0ea7..a5e0f89 100644 --- a/communityservice/src/main/resources/generatorConfig.xml +++ b/communityservice/src/main/resources/generatorConfig.xml @@ -58,13 +58,28 @@ - + + + + + + + +
+ +
+ -
diff --git a/communityservice/src/test/java/com/woniu/communityservice/CommunityserviceApplicationTests.java b/communityservice/src/test/java/com/woniu/communityservice/CommunityserviceApplicationTests.java index 3397cba..2ff3c09 100644 --- a/communityservice/src/test/java/com/woniu/communityservice/CommunityserviceApplicationTests.java +++ b/communityservice/src/test/java/com/woniu/communityservice/CommunityserviceApplicationTests.java @@ -1,13 +1,34 @@ package com.woniu.communityservice; +import com.woniu.dao.AnnouncementMapper; +import com.woniu.dto.NoticePost; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import java.util.List; + @SpringBootTest class CommunityserviceApplicationTests { + @Autowired + private AnnouncementMapper announcementMapper; @Test void contextLoads() { + System.out.println("****"); + } + + @Test + public void test1(){ + System.out.println("****"); + } + @Test + void testPageAndLike(){ + List noticePosts = announcementMapper.selectByKey("",2,15); + System.out.println(noticePosts.size()); + for (NoticePost np:noticePosts){ + System.out.println(np); + } } } diff --git a/gatway/src/main/resources/application.yml b/gatway/src/main/resources/application.yml index d9ad6ad..e4ac7a8 100644 --- a/gatway/src/main/resources/application.yml +++ b/gatway/src/main/resources/application.yml @@ -34,7 +34,7 @@ my: AA#$%()(#*!()!KL<>?N<:{LWPW auth_verify: duration: - 3600 + 3600000 propertymanagement: name: propertymanagement \ No newline at end of file diff --git a/payservice/pom.xml b/payservice/pom.xml index 1b454e2..8e719de 100644 --- a/payservice/pom.xml +++ b/payservice/pom.xml @@ -98,6 +98,21 @@ org.springframework.boot spring-boot-maven-plugin + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.7 + + ${basedir}/src/main/resources/generatorConfig.xml + + + + mysql + mysql-connector-java + 5.1.47 + + + diff --git a/payservice/src/main/java/com/woniu/controller/PayController.java b/payservice/src/main/java/com/woniu/controller/PayController.java index 3bf978d..28e1b46 100644 --- a/payservice/src/main/java/com/woniu/controller/PayController.java +++ b/payservice/src/main/java/com/woniu/controller/PayController.java @@ -1,6 +1,5 @@ package com.woniu.controller; -import com.alibaba.fastjson.JSON; import com.woniu.service.PayService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -10,6 +9,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; +import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.HashMap; @@ -24,6 +24,8 @@ public class PayController { @Autowired private PayService payService; + + // @RequestMapping("/pay") // public void pay(HttpServletResponse response) throws UnsupportedEncodingException { // @@ -188,15 +190,9 @@ public class PayController { // } @GetMapping("/pay") - public void pay(String no, HttpServletResponse response){ - Map map = new HashMap(); - map.put("subject","这是一个订单测试"); - map.put("out_trade_no",no); - map.put("timeout_express","10m"); - map.put("total_amount","0.01"); - map.put("product_code","FAST_INSTANT_TRADE_PAY"); - System.out.println(JSON.toJSON(map)); - String form = payService.payInfo(map); + public void pay(String no,String url,Integer type, HttpServletResponse response){ + //初始化支付信息并连接支付接口 + String form = payService.payInfo(no,url,type); try { response.setContentType("text/html;charset=utf-8"); response.getWriter().write(form); @@ -206,19 +202,35 @@ public class PayController { e.printStackTrace(); } } + @GetMapping("/refund") + @ResponseBody + public String refund(String no,Integer type) { + //初始化退款信息并连接退款接口 + String form = payService.refund(no,type); + System.out.println(form); + return form; + } @RequestMapping("/notifyUrl") @ResponseBody - public String notifyUrl(){ + public void notifyUrl(HttpServletRequest request, HttpServletResponse response){ logger.info("notify"); - return "这是异步通知"; + //获取支付宝POST过来反馈信息 + Map params = new HashMap(); + Map requestParams = request.getParameterMap(); + Map trade = new HashMap(); + trade.put("out_trade_no",request.getParameter("out_trade_no")); + trade.put("trade_no",request.getParameter("trade_no")); + trade.put("trade_status",request.getParameter("trade_status")); + payService.delNotifyUrl(params,requestParams,trade,response); } - @RequestMapping("/returnUrl") - @ResponseBody - public String returnUrl(){ - //同步到达率低,可以做一些页面跳转 - logger.info("returnUrl"); - return "这是一个同步通知"; - } +// @RequestMapping("/returnUrl") +// public void returnUrl(HttpServletRequest request,HttpServletResponse response) throws IOException { +// //同步到达率低,可以做一些页面跳转 +// logger.info("returnUrl"); +// Map requestParams = request.getParameterMap(); +// System.out.println(requestParams.get("qu")); +//// response.sendRedirect("http://www.baidu.com"); +// } } diff --git a/payservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java b/payservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java new file mode 100644 index 0000000..845e5dc --- /dev/null +++ b/payservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java @@ -0,0 +1,21 @@ +package com.woniu.dao; + +import com.woniu.pojo.CommunityOrder; +import org.apache.ibatis.annotations.Select; + +public interface CommunityOrderMapper { + int deleteByPrimaryKey(Integer id); + + int insert(CommunityOrder record); + + int insertSelective(CommunityOrder record); + + CommunityOrder selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(CommunityOrder record); + + int updateByPrimaryKey(CommunityOrder record); + + @Select(value = "select * from community_order where co_num = #{no}") + CommunityOrder selectByNo(String no); +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/dao/CommunityPayMapper.java b/payservice/src/main/java/com/woniu/dao/CommunityPayMapper.java new file mode 100644 index 0000000..f88f9cc --- /dev/null +++ b/payservice/src/main/java/com/woniu/dao/CommunityPayMapper.java @@ -0,0 +1,23 @@ +package com.woniu.dao; + +import com.woniu.pojo.CommunityPay; +import org.apache.ibatis.annotations.Select; + +public interface CommunityPayMapper { + int deleteByPrimaryKey(Integer id); + + int insert(CommunityPay record); + + int insertSelective(CommunityPay record); + + CommunityPay selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(CommunityPay record); + + int updateByPrimaryKeyWithBLOBs(CommunityPay record); + + int updateByPrimaryKey(CommunityPay record); + + @Select(value = "select * from community_pay where cp_order_num = #{no}") + CommunityPay selectByNo(String no); +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/pojo/CommunityOrder.java b/payservice/src/main/java/com/woniu/pojo/CommunityOrder.java new file mode 100644 index 0000000..e958cc7 --- /dev/null +++ b/payservice/src/main/java/com/woniu/pojo/CommunityOrder.java @@ -0,0 +1,115 @@ +package com.woniu.pojo; + +import java.util.Date; + +public class CommunityOrder { + private Integer id; + + private Integer coUserId; + + private String coNum; + + private Double coMoney; + + private Integer coStatus; + + private String coReceiveName; + + private String coNote; + + private Integer coType; + + private Date coCreateTime; + + private String coName; + + private Integer coActivityId; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCoUserId() { + return coUserId; + } + + public void setCoUserId(Integer coUserId) { + this.coUserId = coUserId; + } + + public String getCoNum() { + return coNum; + } + + public void setCoNum(String coNum) { + this.coNum = coNum; + } + + public Double getCoMoney() { + return coMoney; + } + + public void setCoMoney(Double coMoney) { + this.coMoney = coMoney; + } + + public Integer getCoStatus() { + return coStatus; + } + + public void setCoStatus(Integer coStatus) { + this.coStatus = coStatus; + } + + public String getCoReceiveName() { + return coReceiveName; + } + + public void setCoReceiveName(String coReceiveName) { + this.coReceiveName = coReceiveName; + } + + public String getCoNote() { + return coNote; + } + + public void setCoNote(String coNote) { + this.coNote = coNote; + } + + public Integer getCoType() { + return coType; + } + + public void setCoType(Integer coType) { + this.coType = coType; + } + + public Date getCoCreateTime() { + return coCreateTime; + } + + public void setCoCreateTime(Date coCreateTime) { + this.coCreateTime = coCreateTime; + } + + public String getCoName() { + return coName; + } + + public void setCoName(String coName) { + this.coName = coName; + } + + public Integer getCoActivityId() { + return coActivityId; + } + + public void setCoActivityId(Integer coActivityId) { + this.coActivityId = coActivityId; + } +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/pojo/CommunityPay.java b/payservice/src/main/java/com/woniu/pojo/CommunityPay.java new file mode 100644 index 0000000..7c7a34c --- /dev/null +++ b/payservice/src/main/java/com/woniu/pojo/CommunityPay.java @@ -0,0 +1,105 @@ +package com.woniu.pojo; + +import java.util.Date; + +public class CommunityPay { + private Integer id; + + private Integer cpUserId; + + private String cpOrderNum; + + private Double cpMoney; + + private String cpProductNote; + + private String cpNum; + + private String cpPayeeName; + + private String cpPayeeAccount; + + private Date cpCreateTime; + + private String cpNote; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCpUserId() { + return cpUserId; + } + + public void setCpUserId(Integer cpUserId) { + this.cpUserId = cpUserId; + } + + public String getCpOrderNum() { + return cpOrderNum; + } + + public void setCpOrderNum(String cpOrderNum) { + this.cpOrderNum = cpOrderNum; + } + + public Double getCpMoney() { + return cpMoney; + } + + public void setCpMoney(Double cpMoney) { + this.cpMoney = cpMoney; + } + + public String getCpProductNote() { + return cpProductNote; + } + + public void setCpProductNote(String cpProductNote) { + this.cpProductNote = cpProductNote; + } + + public String getCpNum() { + return cpNum; + } + + public void setCpNum(String cpNum) { + this.cpNum = cpNum; + } + + public String getCpPayeeName() { + return cpPayeeName; + } + + public void setCpPayeeName(String cpPayeeName) { + this.cpPayeeName = cpPayeeName; + } + + public String getCpPayeeAccount() { + return cpPayeeAccount; + } + + public void setCpPayeeAccount(String cpPayeeAccount) { + this.cpPayeeAccount = cpPayeeAccount; + } + + public Date getCpCreateTime() { + return cpCreateTime; + } + + public void setCpCreateTime(Date cpCreateTime) { + this.cpCreateTime = cpCreateTime; + } + + public String getCpNote() { + return cpNote; + } + + public void setCpNote(String cpNote) { + this.cpNote = cpNote; + } +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/service/PayService.java b/payservice/src/main/java/com/woniu/service/PayService.java index 858f55a..06617bc 100644 --- a/payservice/src/main/java/com/woniu/service/PayService.java +++ b/payservice/src/main/java/com/woniu/service/PayService.java @@ -1,8 +1,34 @@ package com.woniu.service; +import javax.servlet.http.HttpServletResponse; import java.util.Map; public interface PayService { - String payInfo(Map map); + /** + * 支付请求 + * @param no 订单号 + * @param url 跳转url + * @param type 订单类型 + * @return + */ + String payInfo(String no,String url,Integer type); + + /** + * 异步处理支付结果 + * @param params + * @param requestParams + * @param trade + * @param response + */ + void delNotifyUrl(Map params, Map requestParams, Map trade, HttpServletResponse response); + + /** + * 处理退款请求 + * @param no + * @param url + * @param type + * @return + */ + String refund(String no, Integer type); } diff --git a/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java b/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java index 02ef7ce..1e0a49f 100644 --- a/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java +++ b/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java @@ -2,14 +2,27 @@ package com.woniu.service.impl; import com.alibaba.fastjson.JSON; import com.alipay.api.AlipayApiException; +import com.alipay.api.AlipayClient; import com.alipay.api.DefaultAlipayClient; +import com.alipay.api.domain.AlipayTradeRefundModel; +import com.alipay.api.internal.util.AlipaySignature; +import com.alipay.api.request.AlipayTradeRefundRequest; import com.alipay.api.request.AlipayTradeWapPayRequest; import com.woniu.config.AlipayConfig; +import com.woniu.dao.CommunityOrderMapper; +import com.woniu.dao.CommunityPayMapper; +import com.woniu.pojo.CommunityOrder; +import com.woniu.pojo.CommunityPay; import com.woniu.service.PayService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.HashMap; +import java.util.Iterator; import java.util.Map; @Service @@ -17,10 +30,25 @@ public class PayServiceImpl implements PayService { Logger logger = LoggerFactory.getLogger("PayServiceImpl.class"); - public String payInfo(Map map){ + @Autowired + private CommunityOrderMapper communityOrderMapper; + @Autowired + private CommunityPayMapper communityPayMapper; + + public String payInfo(String no,String url,Integer type){ //创建一个Client实例,其值在config中 DefaultAlipayClient client = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, "json", "utf8", AlipayConfig.alipay_public_key,AlipayConfig.sign_type); + + //根据订单编号获取订单信息,并封装到map中 + CommunityOrder communityOrder = communityOrderMapper.selectByNo(no); + Map map = new HashMap(); + map.put("subject",communityOrder.getCoName()); //订单名 + map.put("out_trade_no",no); //订单编号 + map.put("timeout_express","10m"); //订单超时时间10分钟 + map.put("total_amount",communityOrder.getCoMoney()); //订单金额 + map.put("product_code","FAST_INSTANT_TRADE_PAY"); //产品码,必填 + //发送数据,先将数据转为request,最后通过client发出去,使用fastjson的toString方法 //支付方式 // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();// APP支付 @@ -30,7 +58,8 @@ public class PayServiceImpl implements PayService { //异步同步通知跳转url request.setNotifyUrl(AlipayConfig.notify_url); - request.setReturnUrl(AlipayConfig.return_url); + //支付完成后跳转的地址,通过前端传递 + request.setReturnUrl(url); request.setBizContent(JSON.toJSONString(map)); logger.info(JSON.toJSONString(map)); @@ -41,7 +70,151 @@ public class PayServiceImpl implements PayService { } catch (AlipayApiException e) { e.printStackTrace(); } + return response; + } + + @Override + public void delNotifyUrl(Map params, Map requestParams, Map trade, HttpServletResponse response) { + for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) { + String name = (String) iter.next(); + String[] values = (String[]) requestParams.get(name); + String valueStr = ""; + for (int i = 0; i < values.length; i++) { + valueStr = (i == values.length - 1) ? valueStr + values[i] + : valueStr + values[i] + ","; + } + System.out.println(name+" : "+valueStr); + //乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化 + //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "gbk"); + params.put(name, valueStr); + } + + //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表(以上仅供参考)// + //计算得出通知验证结果 + //boolean AlipaySignature.rsaCheckV1(Map params, String publicKey, String charset, String sign_type) + boolean verify_result = false; + try { + verify_result = AlipaySignature.rsaCheckV1(params, AlipayConfig.alipay_public_key, AlipayConfig.charset, "RSA2"); + } catch (AlipayApiException e) { + e.printStackTrace(); + } + + if(verify_result){//验证成功 + ////////////////////////////////////////////////////////////////////////////////////////// + //请在这里加上商户的业务逻辑程序代码 + + //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表(以下仅供参考)// + //商户订单号 + String out_trade_no = trade.get("out_trade_no").toString(); + //支付宝交易号 + String trade_no = trade.get("trade_no").toString(); + //交易状态 + String trade_status = trade.get("trade_status").toString(); + if(trade_status.equals("TRADE_FINISHED")){ + //判断该笔订单是否在商户网站中已经做过处理 + //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 + //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的 + //如果有做过处理,不执行商户的业务程序 + System.out.println("************************"); + //注意: + //如果签约的是可退款协议,退款日期超过可退款期限后(如三个月可退款),支付宝系统发送该交易状态通知 + //如果没有签约可退款协议,那么付款完成后,支付宝系统发送该交易状态通知。 + } else if (trade_status.equals("TRADE_SUCCESS")){ + //判断该笔订单是否在商户网站中已经做过处理 + //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序 + //请务必判断请求时的total_fee、seller_id与通知时获取的total_fee、seller_id为一致的 + //如果有做过处理,不执行商户的业务程序 + if(params.get("out_biz_no")!=null){ + System.out.println("这是退款"); + System.out.println(params.get("return_url")); + try { + System.out.println("这是固定跳转"); + response.sendRedirect("http://127.0.0.1:8020/TESTPOST/activity_detail.html?id=5"); + } catch (IOException e) { + e.printStackTrace(); + } + }else{ + System.out.println(params.get("return_url")); + System.out.println("这是支付"); + } +// CommunityOrder communityOrder = communityOrderMapper.selectByNo(out_trade_no); +// communityOrder.setCoStatus(1); +// communityOrderMapper.updateByPrimaryKeySelective(communityOrder); + //支付表 + /** + * seller_email + * total_amount + * out_trade_no + * trade_no + * seller_id + * gmt_create 创建时间 + * subject 商品名字 + * buyer_id + * buyer_logon_id + */ + //注意: + //如果签约的是可退款协议,那么付款完成后,支付宝系统发送该交易状态通知。 + } + + //——请根据您的业务逻辑来编写程序(以下代码仅作参考)—— + //——请根据您的业务逻辑来编写程序(以上代码仅作参考)—— +// out.clear(); + try { + response.getWriter().println("success"); //请不要修改或删除 + } catch (IOException e) { + e.printStackTrace(); + } + + ////////////////////////////////////////////////////////////////////////////////////////// + }else{//验证失败 + try { + response.getWriter().println("fail"); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + @Override + public String refund(String no, Integer type) { + //创建一个Client实例,其值在config中 + AlipayClient client = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, + "json", "utf8", AlipayConfig.alipay_public_key,AlipayConfig.sign_type); + + //创建api对应的request类 + AlipayTradeRefundRequest request = new AlipayTradeRefundRequest(); + + //定义一个map封装数据 + Map map = new HashMap(); + //根据订单编号查询订单信息,并封装 + AlipayTradeRefundModel model = new AlipayTradeRefundModel(); + switch (type){ + case 0:break; + case 1:break; + case 2: + CommunityPay communityPay = communityPayMapper.selectByNo(no); + model.setRefundAmount("0.02"); + model.setOutTradeNo(no); + model.setOutRequestNo("HZ01RF001"); + model.setRefundReason("121425不想要了"); +// map.put("out_trade_no",no); +// map.put("trade_no",communityPay.getCpNum()); +// map.put("out_request_no","HZ01RF001"); +// map.put("refund_amount",0.03); + break; + } +// request.setBizContent(JSON.toJSONString(map)); + request.setBizModel(model); + logger.info(String.valueOf(model)); + String response = null; + try { +// response = client.pageExecute(request).getBody(); + response = client.execute(request).getBody(); + logger.info(response); + } catch (AlipayApiException e) { + e.printStackTrace(); + } return response; } } diff --git a/payservice/src/main/resources/generatorConfig.xml b/payservice/src/main/resources/generatorConfig.xml new file mode 100644 index 0000000..df49a0a --- /dev/null +++ b/payservice/src/main/resources/generatorConfig.xml @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + +
+
\ No newline at end of file diff --git a/payservice/src/main/resources/mapper/CommunityOrderMapper.xml b/payservice/src/main/resources/mapper/CommunityOrderMapper.xml new file mode 100644 index 0000000..dab29be --- /dev/null +++ b/payservice/src/main/resources/mapper/CommunityOrderMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + id, co_user_id, co_num, co_money, co_status, co_receive_name, co_note, co_type, co_create_time, + co_name, co_activity_id + + + + delete from community_order + where id = #{id,jdbcType=INTEGER} + + + insert into community_order (id, co_user_id, co_num, + co_money, co_status, co_receive_name, + co_note, co_type, co_create_time, + co_name, co_activity_id) + values (#{id,jdbcType=INTEGER}, #{coUserId,jdbcType=INTEGER}, #{coNum,jdbcType=VARCHAR}, + #{coMoney,jdbcType=DOUBLE}, #{coStatus,jdbcType=INTEGER}, #{coReceiveName,jdbcType=VARCHAR}, + #{coNote,jdbcType=VARCHAR}, #{coType,jdbcType=INTEGER}, #{coCreateTime,jdbcType=TIMESTAMP}, + #{coName,jdbcType=VARCHAR}, #{coActivityId,jdbcType=INTEGER}) + + + insert into community_order + + + id, + + + co_user_id, + + + co_num, + + + co_money, + + + co_status, + + + co_receive_name, + + + co_note, + + + co_type, + + + co_create_time, + + + co_name, + + + co_activity_id, + + + + + #{id,jdbcType=INTEGER}, + + + #{coUserId,jdbcType=INTEGER}, + + + #{coNum,jdbcType=VARCHAR}, + + + #{coMoney,jdbcType=DOUBLE}, + + + #{coStatus,jdbcType=INTEGER}, + + + #{coReceiveName,jdbcType=VARCHAR}, + + + #{coNote,jdbcType=VARCHAR}, + + + #{coType,jdbcType=INTEGER}, + + + #{coCreateTime,jdbcType=TIMESTAMP}, + + + #{coName,jdbcType=VARCHAR}, + + + #{coActivityId,jdbcType=INTEGER}, + + + + + update community_order + + + co_user_id = #{coUserId,jdbcType=INTEGER}, + + + co_num = #{coNum,jdbcType=VARCHAR}, + + + co_money = #{coMoney,jdbcType=DOUBLE}, + + + co_status = #{coStatus,jdbcType=INTEGER}, + + + co_receive_name = #{coReceiveName,jdbcType=VARCHAR}, + + + co_note = #{coNote,jdbcType=VARCHAR}, + + + co_type = #{coType,jdbcType=INTEGER}, + + + co_create_time = #{coCreateTime,jdbcType=TIMESTAMP}, + + + co_name = #{coName,jdbcType=VARCHAR}, + + + co_activity_id = #{coActivityId,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update community_order + set co_user_id = #{coUserId,jdbcType=INTEGER}, + co_num = #{coNum,jdbcType=VARCHAR}, + co_money = #{coMoney,jdbcType=DOUBLE}, + co_status = #{coStatus,jdbcType=INTEGER}, + co_receive_name = #{coReceiveName,jdbcType=VARCHAR}, + co_note = #{coNote,jdbcType=VARCHAR}, + co_type = #{coType,jdbcType=INTEGER}, + co_create_time = #{coCreateTime,jdbcType=TIMESTAMP}, + co_name = #{coName,jdbcType=VARCHAR}, + co_activity_id = #{coActivityId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/payservice/src/main/resources/mapper/CommunityPayMapper.xml b/payservice/src/main/resources/mapper/CommunityPayMapper.xml new file mode 100644 index 0000000..4b88d1c --- /dev/null +++ b/payservice/src/main/resources/mapper/CommunityPayMapper.xml @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + id, cp_user_id, cp_order_num, cp_money, cp_product_note, cp_num, cp_payee_name, cp_payee_account, + cp_create_time + + + cp_note + + + + delete from community_pay + where id = #{id,jdbcType=INTEGER} + + + insert into community_pay (id, cp_user_id, cp_order_num, + cp_money, cp_product_note, cp_num, + cp_payee_name, cp_payee_account, cp_create_time, + cp_note) + values (#{id,jdbcType=INTEGER}, #{cpUserId,jdbcType=INTEGER}, #{cpOrderNum,jdbcType=VARCHAR}, + #{cpMoney,jdbcType=DOUBLE}, #{cpProductNote,jdbcType=VARCHAR}, #{cpNum,jdbcType=VARCHAR}, + #{cpPayeeName,jdbcType=VARCHAR}, #{cpPayeeAccount,jdbcType=VARCHAR}, #{cpCreateTime,jdbcType=TIMESTAMP}, + #{cpNote,jdbcType=LONGVARCHAR}) + + + insert into community_pay + + + id, + + + cp_user_id, + + + cp_order_num, + + + cp_money, + + + cp_product_note, + + + cp_num, + + + cp_payee_name, + + + cp_payee_account, + + + cp_create_time, + + + cp_note, + + + + + #{id,jdbcType=INTEGER}, + + + #{cpUserId,jdbcType=INTEGER}, + + + #{cpOrderNum,jdbcType=VARCHAR}, + + + #{cpMoney,jdbcType=DOUBLE}, + + + #{cpProductNote,jdbcType=VARCHAR}, + + + #{cpNum,jdbcType=VARCHAR}, + + + #{cpPayeeName,jdbcType=VARCHAR}, + + + #{cpPayeeAccount,jdbcType=VARCHAR}, + + + #{cpCreateTime,jdbcType=TIMESTAMP}, + + + #{cpNote,jdbcType=LONGVARCHAR}, + + + + + update community_pay + + + cp_user_id = #{cpUserId,jdbcType=INTEGER}, + + + cp_order_num = #{cpOrderNum,jdbcType=VARCHAR}, + + + cp_money = #{cpMoney,jdbcType=DOUBLE}, + + + cp_product_note = #{cpProductNote,jdbcType=VARCHAR}, + + + cp_num = #{cpNum,jdbcType=VARCHAR}, + + + cp_payee_name = #{cpPayeeName,jdbcType=VARCHAR}, + + + cp_payee_account = #{cpPayeeAccount,jdbcType=VARCHAR}, + + + cp_create_time = #{cpCreateTime,jdbcType=TIMESTAMP}, + + + cp_note = #{cpNote,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update community_pay + set cp_user_id = #{cpUserId,jdbcType=INTEGER}, + cp_order_num = #{cpOrderNum,jdbcType=VARCHAR}, + cp_money = #{cpMoney,jdbcType=DOUBLE}, + cp_product_note = #{cpProductNote,jdbcType=VARCHAR}, + cp_num = #{cpNum,jdbcType=VARCHAR}, + cp_payee_name = #{cpPayeeName,jdbcType=VARCHAR}, + cp_payee_account = #{cpPayeeAccount,jdbcType=VARCHAR}, + cp_create_time = #{cpCreateTime,jdbcType=TIMESTAMP}, + cp_note = #{cpNote,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=INTEGER} + + + update community_pay + set cp_user_id = #{cpUserId,jdbcType=INTEGER}, + cp_order_num = #{cpOrderNum,jdbcType=VARCHAR}, + cp_money = #{cpMoney,jdbcType=DOUBLE}, + cp_product_note = #{cpProductNote,jdbcType=VARCHAR}, + cp_num = #{cpNum,jdbcType=VARCHAR}, + cp_payee_name = #{cpPayeeName,jdbcType=VARCHAR}, + cp_payee_account = #{cpPayeeAccount,jdbcType=VARCHAR}, + cp_create_time = #{cpCreateTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/personcentor/src/main/resources/application.yml b/personcentor/src/main/resources/application.yml index fbcbf80..5aef428 100644 --- a/personcentor/src/main/resources/application.yml +++ b/personcentor/src/main/resources/application.yml @@ -15,10 +15,10 @@ spring: port: 6379 rabbitmq: port: 5672 - username: admin + username: t1 password: 123 - virtual-host: /myhost - host: 192.168.43.112 + virtual-host: /boothost + host: 192.168.190.128 listener: simple: acknowledge-mode: manual -- Gitee From 1ae509fc30c6a5ac5d9ad5171b198662c145799a Mon Sep 17 00:00:00 2001 From: starlbb Date: Fri, 3 Apr 2020 19:33:35 +0800 Subject: [PATCH 10/27] 1 --- .../resources/mapper/AnnouncementMapper.xml | 106 ++++++++++++++++++ .../main/resources/mapper/areaInfoMapper.xml | 82 ++++++++++++++ 2 files changed, 188 insertions(+) create mode 100644 communityservice/src/main/resources/mapper/AnnouncementMapper.xml create mode 100644 communityservice/src/main/resources/mapper/areaInfoMapper.xml diff --git a/communityservice/src/main/resources/mapper/AnnouncementMapper.xml b/communityservice/src/main/resources/mapper/AnnouncementMapper.xml new file mode 100644 index 0000000..cc4df4d --- /dev/null +++ b/communityservice/src/main/resources/mapper/AnnouncementMapper.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + id, context, area_id, create_time, title, status + + + + delete from announcement + where id = #{id,jdbcType=INTEGER} + + + insert into announcement (id, context, area_id, + create_time, title, status + ) + values (#{id,jdbcType=INTEGER}, #{context,jdbcType=VARCHAR}, #{areaId,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}, #{title,jdbcType=VARCHAR}, #{status,jdbcType=INTEGER} + ) + + + insert into announcement + + + id, + + + context, + + + area_id, + + + create_time, + + + title, + + + status, + + + + + #{id,jdbcType=INTEGER}, + + + #{context,jdbcType=VARCHAR}, + + + #{areaId,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{title,jdbcType=VARCHAR}, + + + #{status,jdbcType=INTEGER}, + + + + + update announcement + + + context = #{context,jdbcType=VARCHAR}, + + + area_id = #{areaId,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + title = #{title,jdbcType=VARCHAR}, + + + status = #{status,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update announcement + set context = #{context,jdbcType=VARCHAR}, + area_id = #{areaId,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + title = #{title,jdbcType=VARCHAR}, + status = #{status,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/communityservice/src/main/resources/mapper/areaInfoMapper.xml b/communityservice/src/main/resources/mapper/areaInfoMapper.xml new file mode 100644 index 0000000..ca3ff24 --- /dev/null +++ b/communityservice/src/main/resources/mapper/areaInfoMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + id, area_name, area_address, detail1 + + + + delete from areainfo + where id = #{id,jdbcType=INTEGER} + + + insert into areainfo (id, area_name, area_address, + detail1) + values (#{id,jdbcType=INTEGER}, #{areaName,jdbcType=VARCHAR}, #{areaAddress,jdbcType=VARCHAR}, + #{detail1,jdbcType=VARCHAR}) + + + insert into areainfo + + + id, + + + area_name, + + + area_address, + + + detail1, + + + + + #{id,jdbcType=INTEGER}, + + + #{areaName,jdbcType=VARCHAR}, + + + #{areaAddress,jdbcType=VARCHAR}, + + + #{detail1,jdbcType=VARCHAR}, + + + + + update areainfo + + + area_name = #{areaName,jdbcType=VARCHAR}, + + + area_address = #{areaAddress,jdbcType=VARCHAR}, + + + detail1 = #{detail1,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update areainfo + set area_name = #{areaName,jdbcType=VARCHAR}, + area_address = #{areaAddress,jdbcType=VARCHAR}, + detail1 = #{detail1,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file -- Gitee From 4c8cd8f0acdcde7a7533bbd0502797a2e71d7701 Mon Sep 17 00:00:00 2001 From: starlbb Date: Mon, 6 Apr 2020 23:28:23 +0800 Subject: [PATCH 11/27] =?UTF-8?q?=E6=95=B4=E5=90=88=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=92=8C=E5=85=B6=E4=BB=96=E8=AE=A2=E5=8D=95=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../woniu/controller/ActivityController.java | 70 +++++- .../woniu/controller/NoticeController.java | 14 ++ .../com/woniu/dao/ActivityUserMapper.java | 15 +- .../com/woniu/dao/CommunityOrderMapper.java | 23 ++ .../java/com/woniu/dto/MyActivityPost.java | 16 ++ .../java/com/woniu/pojo/ActivityUser.java | 5 +- .../java/com/woniu/pojo/CommunityOrder.java | 43 ++++ .../com/woniu/service/ActivityService.java | 36 ++- .../service/impl/ActivityServiceImpl.java | 141 +++++++++-- .../src/main/resources/generatorConfig.xml | 26 +- .../resources/mapper/ActivityUserMapper.xml | 9 + .../resources/mapper/CommunityOrderMapper.xml | 164 ++++++++++++ .../com/woniu/controller/PayController.java | 2 +- .../woniu/dao/CommunityActivityMapper.java | 19 ++ .../dao/CommunityActivityUserMapper.java | 21 ++ .../com/woniu/dao/CommunityOrderMapper.java | 2 +- .../com/woniu/dao/ServiceOrderMapper.java | 21 ++ .../com/woniu/dao/UsedProductOrderMapper.java | 21 ++ .../com/woniu/pojo/CommunityActivity.java | 155 ++++++++++++ .../com/woniu/pojo/CommunityActivityUser.java | 23 ++ .../java/com/woniu/pojo/ServiceOrder.java | 115 +++++++++ .../java/com/woniu/pojo/UsedProductOrder.java | 93 +++++++ .../java/com/woniu/service/PayService.java | 2 +- .../woniu/service/impl/PayServiceImpl.java | 106 ++++++-- .../src/main/resources/generatorConfig.xml | 37 ++- .../mapper/CommunityActivityMapper.xml | 237 ++++++++++++++++++ .../mapper/CommunityActivityUserMapper.xml | 82 ++++++ .../resources/mapper/ServiceOrderMapper.xml | 164 ++++++++++++ .../mapper/UsedProductOrderMapper.xml | 142 +++++++++++ 29 files changed, 1727 insertions(+), 77 deletions(-) create mode 100644 communityservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java create mode 100644 communityservice/src/main/java/com/woniu/dto/MyActivityPost.java create mode 100644 communityservice/src/main/java/com/woniu/pojo/CommunityOrder.java create mode 100644 communityservice/src/main/resources/mapper/CommunityOrderMapper.xml create mode 100644 payservice/src/main/java/com/woniu/dao/CommunityActivityMapper.java create mode 100644 payservice/src/main/java/com/woniu/dao/CommunityActivityUserMapper.java create mode 100644 payservice/src/main/java/com/woniu/dao/ServiceOrderMapper.java create mode 100644 payservice/src/main/java/com/woniu/dao/UsedProductOrderMapper.java create mode 100644 payservice/src/main/java/com/woniu/pojo/CommunityActivity.java create mode 100644 payservice/src/main/java/com/woniu/pojo/CommunityActivityUser.java create mode 100644 payservice/src/main/java/com/woniu/pojo/ServiceOrder.java create mode 100644 payservice/src/main/java/com/woniu/pojo/UsedProductOrder.java create mode 100644 payservice/src/main/resources/mapper/CommunityActivityMapper.xml create mode 100644 payservice/src/main/resources/mapper/CommunityActivityUserMapper.xml create mode 100644 payservice/src/main/resources/mapper/ServiceOrderMapper.xml create mode 100644 payservice/src/main/resources/mapper/UsedProductOrderMapper.xml diff --git a/communityservice/src/main/java/com/woniu/controller/ActivityController.java b/communityservice/src/main/java/com/woniu/controller/ActivityController.java index aebf4ea..4a56222 100644 --- a/communityservice/src/main/java/com/woniu/controller/ActivityController.java +++ b/communityservice/src/main/java/com/woniu/controller/ActivityController.java @@ -3,6 +3,7 @@ package com.woniu.controller; import com.alibaba.fastjson.JSONArray; import com.woniu.dto.ActivityDetail; import com.woniu.dto.ActivityPost; +import com.woniu.dto.MyActivityPost; import com.woniu.result.CommonResult; import com.woniu.service.ActivityService; import org.springframework.beans.factory.annotation.Autowired; @@ -84,6 +85,19 @@ public class ActivityController { return CommonResult.success(activityDetail); } + /** + * 获取指定活动id的所有活动人 + * @param activityId + * @return + */ + @GetMapping("/myactivity") + @ResponseBody + public CommonResult myactivity(Integer activityId){ + System.out.println(activityId); + List activityUsers = activityService.findUserById(activityId); + return CommonResult.success(activityUsers); + } + /** * 保存指定用户到活动报名表 * @param activityId @@ -94,8 +108,26 @@ public class ActivityController { @ResponseBody public CommonResult signUp(Integer activityId,Integer userId){ System.out.println(activityId+":"+userId); - activityService.saveSignUp(activityId,userId); - return CommonResult.success("报名成功"); + String coNum = activityService.saveSignUp(activityId,userId); + return CommonResult.success(coNum); + } + + /** + * 更改申请活动的用户状态为已参加活动 + * @param activityId + * @param userId + * @return + */ + @PutMapping("/updateSignUp") + @ResponseBody + public CommonResult updateSignUp(Integer activityId,Integer userId){ + System.out.println(activityId+":"+userId); + int count = activityService.updateSignUp(activityId,userId); + if (count>0){ + return CommonResult.success("已添加该用户"); + }else{ + return CommonResult.failed("添加失败"); + } } /** @@ -109,7 +141,7 @@ public class ActivityController { public CommonResult noSignUp(Integer activityId,Integer userId){ System.out.println(activityId+":"+userId); activityService.deleteById(activityId,userId); - return CommonResult.success("取消成功"); + return CommonResult.success("成功"); } /** @@ -129,4 +161,36 @@ public class ActivityController { } + /** + * 活动发起者退款或者移除用户,彻底删掉该用户 + * @param activityId + * @param userId + * @return + */ + @DeleteMapping("/removeUser") + @ResponseBody + public CommonResult removeUser(Integer activityId,Integer userId){ + System.out.println(activityId+":"+userId); + int count = activityService.deleteByActivityIdAndUserId(activityId,userId); + if (count>0){ + return CommonResult.success("已移除该用户"); + }else{ + return CommonResult.failed("移除失败"); + } + } + + /** + * 根据用户id和活动id查找订单编号 + * @param activityId + * @param userId + * @return + */ + @GetMapping("/getCoNum") + @ResponseBody + public CommonResult getCoNum(Integer activityId,Integer userId){ + System.out.println(activityId+":"+userId); + String coNum = activityService.findCoNum(activityId,userId); + return CommonResult.success(coNum); + } + } diff --git a/communityservice/src/main/java/com/woniu/controller/NoticeController.java b/communityservice/src/main/java/com/woniu/controller/NoticeController.java index 39bdcbf..b75784c 100644 --- a/communityservice/src/main/java/com/woniu/controller/NoticeController.java +++ b/communityservice/src/main/java/com/woniu/controller/NoticeController.java @@ -1,6 +1,8 @@ package com.woniu.controller; +import com.woniu.dao.AnnouncementMapper; import com.woniu.dto.NoticePost; +import com.woniu.pojo.Announcement; import com.woniu.result.CommonResult; import com.woniu.service.NoticeService; import org.springframework.beans.factory.annotation.Autowired; @@ -32,4 +34,16 @@ public class NoticeController { System.out.println(noticePosts.size()); return CommonResult.success(noticePosts); } +@Autowired +private AnnouncementMapper announcementMapper; + @GetMapping("/test") + @ResponseBody + public String test(String testText){ + System.out.println(testText); + Announcement announcement = new Announcement(); + announcement.setId(16); + announcement.setContext(testText); + announcementMapper.insertSelective(announcement); + return announcementMapper.selectByPrimaryKey(announcement.getId()).getContext(); + } } diff --git a/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java b/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java index 74d1729..cd591fb 100644 --- a/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java +++ b/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java @@ -1,8 +1,12 @@ package com.woniu.dao; +import com.woniu.dto.MyActivityPost; import com.woniu.pojo.ActivityUser; +import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Select; +import java.util.List; + public interface ActivityUserMapper { int deleteByPrimaryKey(Integer id); @@ -17,12 +21,15 @@ public interface ActivityUserMapper { int updateByPrimaryKey(ActivityUser record); - @Select(value = "select cau_user_id from community_activity_user where cau_activity_id = #{activityId} and cau_user_id = #{userId}") - Integer selectByIdAndUserId(Integer activityId, Integer userId); + @Select(value = "select * from community_activity_user where cau_activity_id = #{activityId} and cau_user_id = #{userId}") + ActivityUser selectByIdAndUserId(Integer activityId, Integer userId); - @Select(value = "delete from community_activity_user where cau_activity_id = #{activityId} and cau_user_id = #{userId}") - void deleteById(Integer activityId, Integer userId); + @Delete(value = "delete from community_activity_user where cau_activity_id = #{activityId} and cau_user_id = #{userId}") + int deleteById(Integer activityId, Integer userId); @Select(value = "select name from person_user where id = #{userId}") String selectNameById(Integer userId); + + @Select(value = "select cau.*,pu.name from community_activity_user cau,person_user pu where cau.cau_activity_id = #{activityId} and cau.cau_user_id = pu.id and cau.cau_sign_status<3 order by cau.cau_sign_status asc") + List selectByActivityId(Integer activityId); } \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java b/communityservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java new file mode 100644 index 0000000..0a8271c --- /dev/null +++ b/communityservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java @@ -0,0 +1,23 @@ +package com.woniu.dao; + +import com.woniu.pojo.CommunityOrder; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface CommunityOrderMapper { + int deleteByPrimaryKey(Integer id); + + int insert(CommunityOrder record); + + int insertSelective(CommunityOrder record); + + CommunityOrder selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(CommunityOrder record); + + int updateByPrimaryKey(CommunityOrder record); + + @Select(value = "select co_num from community_order where co_activity_id=#{activityId} and co_user_id=#{userId} order by id desc") + List selectById(Integer activityId, Integer userId); +} \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/dto/MyActivityPost.java b/communityservice/src/main/java/com/woniu/dto/MyActivityPost.java new file mode 100644 index 0000000..dba333b --- /dev/null +++ b/communityservice/src/main/java/com/woniu/dto/MyActivityPost.java @@ -0,0 +1,16 @@ +package com.woniu.dto; + +import lombok.Data; + +@Data +public class MyActivityPost { + + private Integer cauUserId; + + private Integer cauSignStatus; + + private String name; + + private String signUp = "批准"; + +} diff --git a/communityservice/src/main/java/com/woniu/pojo/ActivityUser.java b/communityservice/src/main/java/com/woniu/pojo/ActivityUser.java index 4c1ddd8..013cf27 100644 --- a/communityservice/src/main/java/com/woniu/pojo/ActivityUser.java +++ b/communityservice/src/main/java/com/woniu/pojo/ActivityUser.java @@ -10,11 +10,14 @@ public class ActivityUser { private Integer cauUserId; + private Integer cauSignStatus; + public ActivityUser() { } - public ActivityUser(Integer cauActivityId, Integer cauUserId) { + public ActivityUser(Integer cauActivityId, Integer cauUserId,Integer cauSignStatus) { this.cauActivityId = cauActivityId; this.cauUserId = cauUserId; + this.cauSignStatus = cauSignStatus; } } \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/pojo/CommunityOrder.java b/communityservice/src/main/java/com/woniu/pojo/CommunityOrder.java new file mode 100644 index 0000000..c1d73b7 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/pojo/CommunityOrder.java @@ -0,0 +1,43 @@ +package com.woniu.pojo; + +import lombok.Data; + +import java.util.Date; + +@Data +public class CommunityOrder { + private Integer id; + + private Integer coUserId; + + private String coNum; + + private Double coMoney; + + private Integer coStatus; + + private String coReceiveName; + + private String coNote; + + private Integer coType; + + private Date coCreateTime; + + private String coName; + + private Integer coActivityId; + + public CommunityOrder() { + } + + public CommunityOrder(Integer coUserId, String coNum, Double coMoney, Integer coStatus, Date coCreateTime, String coName, Integer coActivityId) { + this.coUserId = coUserId; + this.coNum = coNum; + this.coMoney = coMoney; + this.coStatus = coStatus; + this.coCreateTime = coCreateTime; + this.coName = coName; + this.coActivityId = coActivityId; + } +} \ No newline at end of file diff --git a/communityservice/src/main/java/com/woniu/service/ActivityService.java b/communityservice/src/main/java/com/woniu/service/ActivityService.java index 89e60c3..f2e823a 100644 --- a/communityservice/src/main/java/com/woniu/service/ActivityService.java +++ b/communityservice/src/main/java/com/woniu/service/ActivityService.java @@ -2,6 +2,7 @@ package com.woniu.service; import com.woniu.dto.ActivityDetail; import com.woniu.dto.ActivityPost; +import com.woniu.dto.MyActivityPost; import java.util.List; import java.util.Map; @@ -28,11 +29,11 @@ public interface ActivityService { ActivityDetail findActivity(Integer activityId, Integer userId); /** - * 保存报名活动,用户id到报名表 + * 保存报名活动,用户id到报名表,如果付费,则返回订单编号 * @param activityId * @param userId */ - void saveSignUp(Integer activityId, Integer userId); + String saveSignUp(Integer activityId, Integer userId); /** * 取消指定用户的指定活动报名 @@ -48,4 +49,35 @@ public interface ActivityService { * @return */ List findByType(Integer type, Integer page); + + /** + * 获取指定活动id的参与人 + * @param activityId + * @return + */ + List findUserById(Integer activityId); + + /** + * 更新用户活动状态 + * @param activityId + * @param userId + * @return + */ + int updateSignUp(Integer activityId, Integer userId); + + /** + * 删除用户活动 + * @param activityId + * @param userId + * @return + */ + int deleteByActivityIdAndUserId(Integer activityId, Integer userId); + + /** + * 根据用户id和活动id查找订单编号 + * @param activityId + * @param userId + * @return + */ + String findCoNum(Integer activityId, Integer userId); } diff --git a/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java b/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java index 94b9640..5958feb 100644 --- a/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java +++ b/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java @@ -3,11 +3,14 @@ package com.woniu.service.impl; import com.woniu.dao.ActivityComplaintMapper; import com.woniu.dao.ActivityMapper; import com.woniu.dao.ActivityUserMapper; +import com.woniu.dao.CommunityOrderMapper; import com.woniu.dto.ActivityDetail; import com.woniu.dto.ActivityPost; +import com.woniu.dto.MyActivityPost; import com.woniu.pojo.Activity; import com.woniu.pojo.ActivityComplaint; import com.woniu.pojo.ActivityUser; +import com.woniu.pojo.CommunityOrder; import com.woniu.service.ActivityService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -27,6 +30,9 @@ public class ActivityServiceImpl implements ActivityService { private ActivityMapper activityMapper; @Autowired private ActivityUserMapper activityUserMapper; + @Autowired + private CommunityOrderMapper communityOrderMapper; + /** * 投诉活动 * @param map 投诉数据 @@ -72,12 +78,12 @@ public class ActivityServiceImpl implements ActivityService { Integer activityId = activityMapper.insertSelective(activity); System.out.println(activity.getId()); //保存当前发布人到活动用户中间表中,即报名表 - ActivityUser activityUser = new ActivityUser(activity.getId(),userId); - activityUserMapper.insertSelective(activityUser); +// ActivityUser activityUser = new ActivityUser(activity.getId(),userId); +// activityUserMapper.insertSelective(activityUser); } /** - * 查找指定id的活动,同时判断用户是否报名,并封装成前端需要的数据 + * 查找指定id的活动,同时判断用户类型,并封装成前端需要的数据 * @param activityId * @param userId * @return @@ -98,19 +104,30 @@ public class ActivityServiceImpl implements ActivityService { case 1:activityDetail.setStatus("进行中");break; case 2:activityDetail.setStatus("已结束"); } - //如果用户没登录,则显示初始值,即 立即报名 - if(userId!=null){ - //报名状态 - Integer userCount = activityUserMapper.selectByIdAndUserId(activityId,userId); - if(activity.getCaStatus()==2){ - activityDetail.setSignUp("已结束"); - }else if(userCount!=null && activity.getCaStatus()==0){ - activityDetail.setSignUp("取消报名"); - }else if(userCount!=null && activity.getCaStatus()==1){ + + //查出该用户报名情况,这里大多针对付费活动(涉及退款操作),免费活动取消报名即刻成功,会删掉改用户信息 + ActivityUser activityUser = activityUserMapper.selectByIdAndUserId(activityId,userId); + //对登录用户进行处理 cauSignStatus 0:申请报名,1:取消报名 2:取消中(退款),3:支付失败,需重新支付 + if(activity.getCaStatus()==2){ + activityDetail.setSignUp("活动已结束"); + }else if(userId==activity.getCaUserId()){ + //如果登录用户就是活动发布者 + activityDetail.setSignUp("报名详情"); + } else if(userId!=null && activityUser!=null){ + if((activity.getCaStatus()==1 || activity.getCaStatus()==0) && activityUser.getCauSignStatus()==0){ + activityDetail.setSignUp("申请中"); + }else if (activity.getCaStatus()==1 && activityUser.getCauSignStatus()==1){ activityDetail.setSignUp("已报名"); - } else if(activity.getCaMaxPeopleCount()==activity.getCaPeopelCount()){ - activityDetail.setSignUp("已结束"); + }else if(activity.getCaStatus()==0 && activityUser.getCauSignStatus()==1){ + activityDetail.setSignUp("取消报名"); + }else if(activity.getCaStatus()==0 && activityUser.getCauSignStatus()==2){ + activityDetail.setSignUp("取消中"); + }else if(activityUser.getCauSignStatus()==3){ + activityDetail.setSignUp("重新支付"); } + }else if(userId!=null && activityUser==null && activity.getCaPeopelCount()==activity.getCaMaxPeopleCount()){ + //用户未报名,活动未结束,但是报名人数已满 + activityDetail.setSignUp("报名已结束"); } return activityDetail; } @@ -121,14 +138,25 @@ public class ActivityServiceImpl implements ActivityService { * @param userId */ @Override - public void saveSignUp(Integer activityId, Integer userId) { - //新增报名用户数据 - ActivityUser activityUser = new ActivityUser(activityId,userId); + public String saveSignUp(Integer activityId, Integer userId) { + //保存订单号 + String coNum = ""; + Integer status = 0; + //新增报名用户数据,判断是否是付费活动,0:免费,3:付费,付费需要创建订单 + Activity activity = activityMapper.selectByPrimaryKey(activityId); + if(activity.getCaMoney()>0){ + //创建一个订单 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); + String num = simpleDateFormat.format(new Date())+"4"+userId; //自定义订单编号,时间+类型+用户id + CommunityOrder order = new CommunityOrder(userId,num,activity.getCaMoney(),0,new Date(),"活动订单",activityId); + communityOrderMapper.insertSelective(order); + coNum = num; + status = 3; + } + //添加活动用户 + ActivityUser activityUser = new ActivityUser(activityId,userId,status); activityUserMapper.insertSelective(activityUser); - //活动人数+1 - Activity activity = activityMapper.selectByPrimaryKey(activityId); - activity.setCaPeopelCount(activity.getCaPeopelCount()+1); - activityMapper.updateByPrimaryKeySelective(activity); + return coNum; } /** @@ -138,11 +166,21 @@ public class ActivityServiceImpl implements ActivityService { */ @Override public void deleteById(Integer activityId, Integer userId) { - activityUserMapper.deleteById(activityId,userId); - //活动人数-1 - Activity activity = activityMapper.selectByPrimaryKey(activityId); - activity.setCaPeopelCount(activity.getCaPeopelCount()-1); - activityMapper.updateByPrimaryKeySelective(activity); + //判断是否是付费活动 + Activity activity = activityMapper.selectByPrimaryKey(activityId); + //免费活动,直接取消,并删除该用户数据 + if(activity.getCaMoney()==0){ + activityUserMapper.deleteById(activityId,userId); + //活动人数-1 + activity.setCaPeopelCount(activity.getCaPeopelCount()-1); + activityMapper.updateByPrimaryKeySelective(activity); + }else{ + ActivityUser activityUser = activityUserMapper.selectByIdAndUserId(activityId,userId); + //设置报名状态为2,即申请退款 + activityUser.setCauSignStatus(2); + activityUserMapper.updateByPrimaryKeySelective(activityUser); + } + } /** @@ -161,4 +199,55 @@ public class ActivityServiceImpl implements ActivityService { } } + @Override + public List findUserById(Integer activityId) { + List myActivityPosts = activityUserMapper.selectByActivityId(activityId); + for(MyActivityPost my:myActivityPosts){ + if(my.getCauSignStatus()==1){ + my.setSignUp("移除"); + }else if(my.getCauSignStatus()==2){ + my.setSignUp("退款"); + } + } + return myActivityPosts; + } + + @Override + public int updateSignUp(Integer activityId, Integer userId) { + ActivityUser activityUser = activityUserMapper.selectByIdAndUserId(activityId,userId); + activityUser.setCauSignStatus(1); + activityUserMapper.updateByPrimaryKeySelective(activityUser); + //同时活动人数+1 + Activity activity = activityMapper.selectByPrimaryKey(activityId); + activity.setCaPeopelCount(activity.getCaPeopelCount()+1); + activityMapper.updateByPrimaryKeySelective(activity); + + return activityUserMapper.updateByPrimaryKeySelective(activityUser); + } + + @Override + public int deleteByActivityIdAndUserId(Integer activityId, Integer userId) { + //删除指定活动指定用户 + int count = activityUserMapper.deleteById(activityId,userId); + if(count>0){ + //同时活动人数-1 + Activity activity = activityMapper.selectByPrimaryKey(activityId); + activity.setCaPeopelCount(activity.getCaPeopelCount()-1); + activityMapper.updateByPrimaryKeySelective(activity); + } + return count; + } + + /** + * 根据用户id和活动id查找订单编号 + * @param activityId + * @param userId + * @return + */ + @Override + public String findCoNum(Integer activityId, Integer userId) { + //返回最新的一个订单号给前端,这里是id倒序查询的 + return communityOrderMapper.selectById(activityId,userId).get(0); + } + } diff --git a/communityservice/src/main/resources/generatorConfig.xml b/communityservice/src/main/resources/generatorConfig.xml index a5e0f89..2f4fc71 100644 --- a/communityservice/src/main/resources/generatorConfig.xml +++ b/communityservice/src/main/resources/generatorConfig.xml @@ -66,20 +66,28 @@ - - -
- + + + + + + + + + + + + + + +
+
diff --git a/communityservice/src/main/resources/mapper/ActivityUserMapper.xml b/communityservice/src/main/resources/mapper/ActivityUserMapper.xml index 31e47e5..7d5d0a7 100644 --- a/communityservice/src/main/resources/mapper/ActivityUserMapper.xml +++ b/communityservice/src/main/resources/mapper/ActivityUserMapper.xml @@ -37,6 +37,9 @@ cau_user_id, + + cau_sign_status, + @@ -48,6 +51,9 @@ #{cauUserId,jdbcType=INTEGER}, + + #{cauSignStatus,jdbcType=INTEGER}, + @@ -59,6 +65,9 @@ cau_user_id = #{cauUserId,jdbcType=INTEGER}, + + cau_sign_status = #{cauSignStatus,jdbcType=INTEGER}, + where id = #{id,jdbcType=INTEGER} diff --git a/communityservice/src/main/resources/mapper/CommunityOrderMapper.xml b/communityservice/src/main/resources/mapper/CommunityOrderMapper.xml new file mode 100644 index 0000000..dab29be --- /dev/null +++ b/communityservice/src/main/resources/mapper/CommunityOrderMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + id, co_user_id, co_num, co_money, co_status, co_receive_name, co_note, co_type, co_create_time, + co_name, co_activity_id + + + + delete from community_order + where id = #{id,jdbcType=INTEGER} + + + insert into community_order (id, co_user_id, co_num, + co_money, co_status, co_receive_name, + co_note, co_type, co_create_time, + co_name, co_activity_id) + values (#{id,jdbcType=INTEGER}, #{coUserId,jdbcType=INTEGER}, #{coNum,jdbcType=VARCHAR}, + #{coMoney,jdbcType=DOUBLE}, #{coStatus,jdbcType=INTEGER}, #{coReceiveName,jdbcType=VARCHAR}, + #{coNote,jdbcType=VARCHAR}, #{coType,jdbcType=INTEGER}, #{coCreateTime,jdbcType=TIMESTAMP}, + #{coName,jdbcType=VARCHAR}, #{coActivityId,jdbcType=INTEGER}) + + + insert into community_order + + + id, + + + co_user_id, + + + co_num, + + + co_money, + + + co_status, + + + co_receive_name, + + + co_note, + + + co_type, + + + co_create_time, + + + co_name, + + + co_activity_id, + + + + + #{id,jdbcType=INTEGER}, + + + #{coUserId,jdbcType=INTEGER}, + + + #{coNum,jdbcType=VARCHAR}, + + + #{coMoney,jdbcType=DOUBLE}, + + + #{coStatus,jdbcType=INTEGER}, + + + #{coReceiveName,jdbcType=VARCHAR}, + + + #{coNote,jdbcType=VARCHAR}, + + + #{coType,jdbcType=INTEGER}, + + + #{coCreateTime,jdbcType=TIMESTAMP}, + + + #{coName,jdbcType=VARCHAR}, + + + #{coActivityId,jdbcType=INTEGER}, + + + + + update community_order + + + co_user_id = #{coUserId,jdbcType=INTEGER}, + + + co_num = #{coNum,jdbcType=VARCHAR}, + + + co_money = #{coMoney,jdbcType=DOUBLE}, + + + co_status = #{coStatus,jdbcType=INTEGER}, + + + co_receive_name = #{coReceiveName,jdbcType=VARCHAR}, + + + co_note = #{coNote,jdbcType=VARCHAR}, + + + co_type = #{coType,jdbcType=INTEGER}, + + + co_create_time = #{coCreateTime,jdbcType=TIMESTAMP}, + + + co_name = #{coName,jdbcType=VARCHAR}, + + + co_activity_id = #{coActivityId,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update community_order + set co_user_id = #{coUserId,jdbcType=INTEGER}, + co_num = #{coNum,jdbcType=VARCHAR}, + co_money = #{coMoney,jdbcType=DOUBLE}, + co_status = #{coStatus,jdbcType=INTEGER}, + co_receive_name = #{coReceiveName,jdbcType=VARCHAR}, + co_note = #{coNote,jdbcType=VARCHAR}, + co_type = #{coType,jdbcType=INTEGER}, + co_create_time = #{coCreateTime,jdbcType=TIMESTAMP}, + co_name = #{coName,jdbcType=VARCHAR}, + co_activity_id = #{coActivityId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/controller/PayController.java b/payservice/src/main/java/com/woniu/controller/PayController.java index 28e1b46..82d07a5 100644 --- a/payservice/src/main/java/com/woniu/controller/PayController.java +++ b/payservice/src/main/java/com/woniu/controller/PayController.java @@ -222,7 +222,7 @@ public class PayController { trade.put("out_trade_no",request.getParameter("out_trade_no")); trade.put("trade_no",request.getParameter("trade_no")); trade.put("trade_status",request.getParameter("trade_status")); - payService.delNotifyUrl(params,requestParams,trade,response); + payService.delNotifyUrl(requestParams,trade,response); } // @RequestMapping("/returnUrl") diff --git a/payservice/src/main/java/com/woniu/dao/CommunityActivityMapper.java b/payservice/src/main/java/com/woniu/dao/CommunityActivityMapper.java new file mode 100644 index 0000000..4c27529 --- /dev/null +++ b/payservice/src/main/java/com/woniu/dao/CommunityActivityMapper.java @@ -0,0 +1,19 @@ +package com.woniu.dao; + +import com.woniu.pojo.CommunityActivity; + +public interface CommunityActivityMapper { + int deleteByPrimaryKey(Integer id); + + int insert(CommunityActivity record); + + int insertSelective(CommunityActivity record); + + CommunityActivity selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(CommunityActivity record); + + int updateByPrimaryKeyWithBLOBs(CommunityActivity record); + + int updateByPrimaryKey(CommunityActivity record); +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/dao/CommunityActivityUserMapper.java b/payservice/src/main/java/com/woniu/dao/CommunityActivityUserMapper.java new file mode 100644 index 0000000..a8bf96f --- /dev/null +++ b/payservice/src/main/java/com/woniu/dao/CommunityActivityUserMapper.java @@ -0,0 +1,21 @@ +package com.woniu.dao; + +import com.woniu.pojo.CommunityActivityUser; +import org.apache.ibatis.annotations.Select; + +public interface CommunityActivityUserMapper { + int deleteByPrimaryKey(Integer id); + + int insert(CommunityActivityUser record); + + int insertSelective(CommunityActivityUser record); + + CommunityActivityUser selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(CommunityActivityUser record); + + int updateByPrimaryKey(CommunityActivityUser record); + + @Select(value = "select * from community_activity_user where cau_activity_id=#{coActivityId} and cau_user_id=#{coUserId}") + CommunityActivityUser selectById(Integer coActivityId, Integer coUserId); +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java b/payservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java index 845e5dc..117426f 100644 --- a/payservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java +++ b/payservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java @@ -16,6 +16,6 @@ public interface CommunityOrderMapper { int updateByPrimaryKey(CommunityOrder record); - @Select(value = "select * from community_order where co_num = #{no}") + @Select(value = "select * from community_order where co_num=#{no}") CommunityOrder selectByNo(String no); } \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/dao/ServiceOrderMapper.java b/payservice/src/main/java/com/woniu/dao/ServiceOrderMapper.java new file mode 100644 index 0000000..99ab9b2 --- /dev/null +++ b/payservice/src/main/java/com/woniu/dao/ServiceOrderMapper.java @@ -0,0 +1,21 @@ +package com.woniu.dao; + +import com.woniu.pojo.ServiceOrder; +import org.apache.ibatis.annotations.Select; + +public interface ServiceOrderMapper { + int deleteByPrimaryKey(Integer id); + + int insert(ServiceOrder record); + + int insertSelective(ServiceOrder record); + + ServiceOrder selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(ServiceOrder record); + + int updateByPrimaryKey(ServiceOrder record); + + @Select(value = "select * from service_order where ordernumber=#{no}") + ServiceOrder selectByNo(String no); +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/dao/UsedProductOrderMapper.java b/payservice/src/main/java/com/woniu/dao/UsedProductOrderMapper.java new file mode 100644 index 0000000..12b9e9f --- /dev/null +++ b/payservice/src/main/java/com/woniu/dao/UsedProductOrderMapper.java @@ -0,0 +1,21 @@ +package com.woniu.dao; + +import com.woniu.pojo.UsedProductOrder; +import org.apache.ibatis.annotations.Select; + +public interface UsedProductOrderMapper { + int deleteByPrimaryKey(Integer id); + + int insert(UsedProductOrder record); + + int insertSelective(UsedProductOrder record); + + UsedProductOrder selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(UsedProductOrder record); + + int updateByPrimaryKey(UsedProductOrder record); + + @Select(value = "select * from used_product_order where order_number=#{no}") + UsedProductOrder selectByNo(String no); +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/pojo/CommunityActivity.java b/payservice/src/main/java/com/woniu/pojo/CommunityActivity.java new file mode 100644 index 0000000..c818053 --- /dev/null +++ b/payservice/src/main/java/com/woniu/pojo/CommunityActivity.java @@ -0,0 +1,155 @@ +package com.woniu.pojo; + +import java.util.Date; + +public class CommunityActivity { + private Integer id; + + private Integer caUserId; + + private Integer caType; + + private String caTitle; + + private String caContent; + + private Date caStartTime; + + private Date caEndTime; + + private Integer caStatus; + + private Double caMoney; + + private Integer caPeopelCount; + + private Integer caMaxPeopleCount; + + private Date caCreateTime; + + private Integer caExamineStatus; + + private Date caExaminetime; + + private String caPicPath; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getCaUserId() { + return caUserId; + } + + public void setCaUserId(Integer caUserId) { + this.caUserId = caUserId; + } + + public Integer getCaType() { + return caType; + } + + public void setCaType(Integer caType) { + this.caType = caType; + } + + public String getCaTitle() { + return caTitle; + } + + public void setCaTitle(String caTitle) { + this.caTitle = caTitle; + } + + public String getCaContent() { + return caContent; + } + + public void setCaContent(String caContent) { + this.caContent = caContent; + } + + public Date getCaStartTime() { + return caStartTime; + } + + public void setCaStartTime(Date caStartTime) { + this.caStartTime = caStartTime; + } + + public Date getCaEndTime() { + return caEndTime; + } + + public void setCaEndTime(Date caEndTime) { + this.caEndTime = caEndTime; + } + + public Integer getCaStatus() { + return caStatus; + } + + public void setCaStatus(Integer caStatus) { + this.caStatus = caStatus; + } + + public Double getCaMoney() { + return caMoney; + } + + public void setCaMoney(Double caMoney) { + this.caMoney = caMoney; + } + + public Integer getCaPeopelCount() { + return caPeopelCount; + } + + public void setCaPeopelCount(Integer caPeopelCount) { + this.caPeopelCount = caPeopelCount; + } + + public Integer getCaMaxPeopleCount() { + return caMaxPeopleCount; + } + + public void setCaMaxPeopleCount(Integer caMaxPeopleCount) { + this.caMaxPeopleCount = caMaxPeopleCount; + } + + public Date getCaCreateTime() { + return caCreateTime; + } + + public void setCaCreateTime(Date caCreateTime) { + this.caCreateTime = caCreateTime; + } + + public Integer getCaExamineStatus() { + return caExamineStatus; + } + + public void setCaExamineStatus(Integer caExamineStatus) { + this.caExamineStatus = caExamineStatus; + } + + public Date getCaExaminetime() { + return caExaminetime; + } + + public void setCaExaminetime(Date caExaminetime) { + this.caExaminetime = caExaminetime; + } + + public String getCaPicPath() { + return caPicPath; + } + + public void setCaPicPath(String caPicPath) { + this.caPicPath = caPicPath; + } +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/pojo/CommunityActivityUser.java b/payservice/src/main/java/com/woniu/pojo/CommunityActivityUser.java new file mode 100644 index 0000000..f88356a --- /dev/null +++ b/payservice/src/main/java/com/woniu/pojo/CommunityActivityUser.java @@ -0,0 +1,23 @@ +package com.woniu.pojo; + +import lombok.Data; + +@Data +public class CommunityActivityUser { + private Integer id; + + private Integer cauActivityId; + + private Integer cauUserId; + + private Integer cauSignStatus; + + public CommunityActivityUser() { + } + + public CommunityActivityUser(Integer cauActivityId, Integer cauUserId, Integer cauSignStatus) { + this.cauActivityId = cauActivityId; + this.cauUserId = cauUserId; + this.cauSignStatus = cauSignStatus; + } +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/pojo/ServiceOrder.java b/payservice/src/main/java/com/woniu/pojo/ServiceOrder.java new file mode 100644 index 0000000..d802269 --- /dev/null +++ b/payservice/src/main/java/com/woniu/pojo/ServiceOrder.java @@ -0,0 +1,115 @@ +package com.woniu.pojo; + +import java.util.Date; + +public class ServiceOrder { + private Integer id; + + private Integer serviceid; + + private Integer userid; + + private Date starttime; + + private Date endtime; + + private Integer status; + + private String ordernumber; + + private String ordername; + + private Integer ordertype; + + private Integer orderPrice; + + private Integer stopPrice; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getServiceid() { + return serviceid; + } + + public void setServiceid(Integer serviceid) { + this.serviceid = serviceid; + } + + public Integer getUserid() { + return userid; + } + + public void setUserid(Integer userid) { + this.userid = userid; + } + + public Date getStarttime() { + return starttime; + } + + public void setStarttime(Date starttime) { + this.starttime = starttime; + } + + public Date getEndtime() { + return endtime; + } + + public void setEndtime(Date endtime) { + this.endtime = endtime; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getOrdernumber() { + return ordernumber; + } + + public void setOrdernumber(String ordernumber) { + this.ordernumber = ordernumber; + } + + public String getOrdername() { + return ordername; + } + + public void setOrdername(String ordername) { + this.ordername = ordername; + } + + public Integer getOrdertype() { + return ordertype; + } + + public void setOrdertype(Integer ordertype) { + this.ordertype = ordertype; + } + + public Integer getOrderPrice() { + return orderPrice; + } + + public void setOrderPrice(Integer orderPrice) { + this.orderPrice = orderPrice; + } + + public Integer getStopPrice() { + return stopPrice; + } + + public void setStopPrice(Integer stopPrice) { + this.stopPrice = stopPrice; + } +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/pojo/UsedProductOrder.java b/payservice/src/main/java/com/woniu/pojo/UsedProductOrder.java new file mode 100644 index 0000000..88c4220 --- /dev/null +++ b/payservice/src/main/java/com/woniu/pojo/UsedProductOrder.java @@ -0,0 +1,93 @@ +package com.woniu.pojo; + +public class UsedProductOrder { + private Integer id; + + private Integer productId; + + private Integer productOrderType; + + private Integer userId; + + private String orderNumber; + + private String orderName; + + private Double orderMoney; + + private Integer orderStatus; + + private Integer consigneeid; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getProductId() { + return productId; + } + + public void setProductId(Integer productId) { + this.productId = productId; + } + + public Integer getProductOrderType() { + return productOrderType; + } + + public void setProductOrderType(Integer productOrderType) { + this.productOrderType = productOrderType; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public String getOrderNumber() { + return orderNumber; + } + + public void setOrderNumber(String orderNumber) { + this.orderNumber = orderNumber; + } + + public String getOrderName() { + return orderName; + } + + public void setOrderName(String orderName) { + this.orderName = orderName; + } + + public Double getOrderMoney() { + return orderMoney; + } + + public void setOrderMoney(Double orderMoney) { + this.orderMoney = orderMoney; + } + + public Integer getOrderStatus() { + return orderStatus; + } + + public void setOrderStatus(Integer orderStatus) { + this.orderStatus = orderStatus; + } + + public Integer getConsigneeid() { + return consigneeid; + } + + public void setConsigneeid(Integer consigneeid) { + this.consigneeid = consigneeid; + } +} \ No newline at end of file diff --git a/payservice/src/main/java/com/woniu/service/PayService.java b/payservice/src/main/java/com/woniu/service/PayService.java index 06617bc..c72f5ce 100644 --- a/payservice/src/main/java/com/woniu/service/PayService.java +++ b/payservice/src/main/java/com/woniu/service/PayService.java @@ -21,7 +21,7 @@ public interface PayService { * @param trade * @param response */ - void delNotifyUrl(Map params, Map requestParams, Map trade, HttpServletResponse response); + void delNotifyUrl(Map requestParams, Map trade, HttpServletResponse response); /** * 处理退款请求 diff --git a/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java b/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java index 1e0a49f..5e15c3e 100644 --- a/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java +++ b/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java @@ -9,10 +9,8 @@ import com.alipay.api.internal.util.AlipaySignature; import com.alipay.api.request.AlipayTradeRefundRequest; import com.alipay.api.request.AlipayTradeWapPayRequest; import com.woniu.config.AlipayConfig; -import com.woniu.dao.CommunityOrderMapper; -import com.woniu.dao.CommunityPayMapper; -import com.woniu.pojo.CommunityOrder; -import com.woniu.pojo.CommunityPay; +import com.woniu.dao.*; +import com.woniu.pojo.*; import com.woniu.service.PayService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,19 +32,48 @@ public class PayServiceImpl implements PayService { private CommunityOrderMapper communityOrderMapper; @Autowired private CommunityPayMapper communityPayMapper; + @Autowired + private ServiceOrderMapper serviceOrderMapper; + @Autowired + private UsedProductOrderMapper usedProductOrderMapper; + @Autowired + private CommunityActivityMapper communityActivityMapper; + @Autowired + private CommunityActivityUserMapper communityActivityUserMapper; public String payInfo(String no,String url,Integer type){ //创建一个Client实例,其值在config中 DefaultAlipayClient client = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, "json", "utf8", AlipayConfig.alipay_public_key,AlipayConfig.sign_type); - //根据订单编号获取订单信息,并封装到map中 - CommunityOrder communityOrder = communityOrderMapper.selectByNo(no); + //封装订单信息 Map map = new HashMap(); - map.put("subject",communityOrder.getCoName()); //订单名 + String subject = null; + double money = 0; + + //判断是哪一张订单 + switch (type){ + case 0: + ServiceOrder serviceOrder = serviceOrderMapper.selectByNo(no); + subject = "服务订单"; + money = serviceOrder.getOrderPrice(); + break; + case 1: + UsedProductOrder usedProductOrder = usedProductOrderMapper.selectByNo(no); + subject = "商品订单"; + money = usedProductOrder.getOrderMoney(); + break; + case 2: + //社区活动订单,并封装到map中 + CommunityOrder communityOrder = communityOrderMapper.selectByNo(no); + subject = "活动订单"; + money = communityOrder.getCoMoney(); + break; + } + map.put("subject",subject); //订单名 map.put("out_trade_no",no); //订单编号 map.put("timeout_express","10m"); //订单超时时间10分钟 - map.put("total_amount",communityOrder.getCoMoney()); //订单金额 + map.put("total_amount",String.valueOf(money)); //订单金额 map.put("product_code","FAST_INSTANT_TRADE_PAY"); //产品码,必填 //发送数据,先将数据转为request,最后通过client发出去,使用fastjson的toString方法 @@ -74,7 +101,8 @@ public class PayServiceImpl implements PayService { } @Override - public void delNotifyUrl(Map params, Map requestParams, Map trade, HttpServletResponse response) { + public void delNotifyUrl(Map requestParams, Map trade, HttpServletResponse response) { + Map params = new HashMap(); for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) { String name = (String) iter.next(); String[] values = (String[]) requestParams.get(name); @@ -127,19 +155,37 @@ public class PayServiceImpl implements PayService { if(params.get("out_biz_no")!=null){ System.out.println("这是退款"); System.out.println(params.get("return_url")); - try { - System.out.println("这是固定跳转"); - response.sendRedirect("http://127.0.0.1:8020/TESTPOST/activity_detail.html?id=5"); - } catch (IOException e) { - e.printStackTrace(); - } }else{ System.out.println(params.get("return_url")); System.out.println("这是支付"); + if(params.get("subject").equals("活动订单")){ + System.out.println("活动订单"); + //更改活动订单状态 + CommunityOrder communityOrder = communityOrderMapper.selectByNo(params.get("out_trade_no").toString()); + communityOrder.setCoStatus(1); + communityOrderMapper.updateByPrimaryKeySelective(communityOrder); + //增加活动人数,新增活动用户信息 + CommunityActivity communityActivity = communityActivityMapper.selectByPrimaryKey(communityOrder.getCoActivityId()); + communityActivity.setCaPeopelCount(communityActivity.getCaPeopelCount()+1); + communityActivityMapper.updateByPrimaryKeySelective(communityActivity); + //更新用户报名状态 + CommunityActivityUser communityActivityUser = communityActivityUserMapper.selectById(communityOrder.getCoActivityId(),communityOrder.getCoUserId()); + communityActivityUser.setCauSignStatus(1); + communityActivityUserMapper.updateByPrimaryKeySelective(communityActivityUser); + }else if(params.get("subject").equals("服务订单")){ + System.out.println("服务订单"); + //更改订单状态 + ServiceOrder serviceOrder = serviceOrderMapper.selectByNo(params.get("out_trade_no").toString()); + serviceOrder.setStatus(0); + serviceOrderMapper.updateByPrimaryKeySelective(serviceOrder); + }else{ + System.out.println("商品订单"); + //更改商品订单状态 + UsedProductOrder usedProductOrder = usedProductOrderMapper.selectByNo(params.get("out_trade_no").toString()); + usedProductOrder.setOrderStatus(1); + usedProductOrderMapper.updateByPrimaryKeySelective(usedProductOrder); + } } -// CommunityOrder communityOrder = communityOrderMapper.selectByNo(out_trade_no); -// communityOrder.setCoStatus(1); -// communityOrderMapper.updateByPrimaryKeySelective(communityOrder); //支付表 /** * seller_email @@ -187,23 +233,33 @@ public class PayServiceImpl implements PayService { //定义一个map封装数据 Map map = new HashMap(); + String money = null; + //根据订单编号查询订单信息,并封装 AlipayTradeRefundModel model = new AlipayTradeRefundModel(); switch (type){ - case 0:break; - case 1:break; + case 0: + ServiceOrder serviceOrder = serviceOrderMapper.selectByNo(no); + money = String.valueOf(serviceOrder.getOrderPrice()-serviceOrder.getStopPrice()); + break; + case 1: + UsedProductOrder usedProductOrder = usedProductOrderMapper.selectByNo(no); + money = String.valueOf(usedProductOrder.getOrderMoney()); + break; case 2: - CommunityPay communityPay = communityPayMapper.selectByNo(no); - model.setRefundAmount("0.02"); - model.setOutTradeNo(no); - model.setOutRequestNo("HZ01RF001"); - model.setRefundReason("121425不想要了"); + //CommunityPay communityPay = communityPayMapper.selectByNo(no); + CommunityOrder communityOrder = communityOrderMapper.selectByNo(no); + money = String.valueOf(communityOrder.getCoMoney()); // map.put("out_trade_no",no); // map.put("trade_no",communityPay.getCpNum()); // map.put("out_request_no","HZ01RF001"); // map.put("refund_amount",0.03); break; } + model.setRefundAmount(money); + model.setOutTradeNo(no); + model.setOutRequestNo("HZ01RF001"); + model.setRefundReason("121425不想要了"); // request.setBizContent(JSON.toJSONString(map)); request.setBizModel(model); logger.info(String.valueOf(model)); diff --git a/payservice/src/main/resources/generatorConfig.xml b/payservice/src/main/resources/generatorConfig.xml index df49a0a..0b0844e 100644 --- a/payservice/src/main/resources/generatorConfig.xml +++ b/payservice/src/main/resources/generatorConfig.xml @@ -58,21 +58,50 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- +
- + - diff --git a/payservice/src/main/resources/mapper/CommunityActivityMapper.xml b/payservice/src/main/resources/mapper/CommunityActivityMapper.xml new file mode 100644 index 0000000..c314bc5 --- /dev/null +++ b/payservice/src/main/resources/mapper/CommunityActivityMapper.xml @@ -0,0 +1,237 @@ + + + + + + + + + + + + + + + + + + + + + + + + id, ca_user_id, ca_type, ca_title, ca_content, ca_start_time, ca_end_time, ca_status, + ca_money, ca_peopel_count, ca_max_people_count, ca_create_time, ca_examine_status, + ca_examinetime + + + ca_pic_path + + + + delete from community_activity + where id = #{id,jdbcType=INTEGER} + + + insert into community_activity (id, ca_user_id, ca_type, + ca_title, ca_content, ca_start_time, + ca_end_time, ca_status, ca_money, + ca_peopel_count, ca_max_people_count, ca_create_time, + ca_examine_status, ca_examinetime, ca_pic_path + ) + values (#{id,jdbcType=INTEGER}, #{caUserId,jdbcType=INTEGER}, #{caType,jdbcType=INTEGER}, + #{caTitle,jdbcType=VARCHAR}, #{caContent,jdbcType=VARCHAR}, #{caStartTime,jdbcType=TIMESTAMP}, + #{caEndTime,jdbcType=TIMESTAMP}, #{caStatus,jdbcType=INTEGER}, #{caMoney,jdbcType=DOUBLE}, + #{caPeopelCount,jdbcType=INTEGER}, #{caMaxPeopleCount,jdbcType=INTEGER}, #{caCreateTime,jdbcType=TIMESTAMP}, + #{caExamineStatus,jdbcType=INTEGER}, #{caExaminetime,jdbcType=DATE}, #{caPicPath,jdbcType=LONGVARCHAR} + ) + + + insert into community_activity + + + id, + + + ca_user_id, + + + ca_type, + + + ca_title, + + + ca_content, + + + ca_start_time, + + + ca_end_time, + + + ca_status, + + + ca_money, + + + ca_peopel_count, + + + ca_max_people_count, + + + ca_create_time, + + + ca_examine_status, + + + ca_examinetime, + + + ca_pic_path, + + + + + #{id,jdbcType=INTEGER}, + + + #{caUserId,jdbcType=INTEGER}, + + + #{caType,jdbcType=INTEGER}, + + + #{caTitle,jdbcType=VARCHAR}, + + + #{caContent,jdbcType=VARCHAR}, + + + #{caStartTime,jdbcType=TIMESTAMP}, + + + #{caEndTime,jdbcType=TIMESTAMP}, + + + #{caStatus,jdbcType=INTEGER}, + + + #{caMoney,jdbcType=DOUBLE}, + + + #{caPeopelCount,jdbcType=INTEGER}, + + + #{caMaxPeopleCount,jdbcType=INTEGER}, + + + #{caCreateTime,jdbcType=TIMESTAMP}, + + + #{caExamineStatus,jdbcType=INTEGER}, + + + #{caExaminetime,jdbcType=DATE}, + + + #{caPicPath,jdbcType=LONGVARCHAR}, + + + + + update community_activity + + + ca_user_id = #{caUserId,jdbcType=INTEGER}, + + + ca_type = #{caType,jdbcType=INTEGER}, + + + ca_title = #{caTitle,jdbcType=VARCHAR}, + + + ca_content = #{caContent,jdbcType=VARCHAR}, + + + ca_start_time = #{caStartTime,jdbcType=TIMESTAMP}, + + + ca_end_time = #{caEndTime,jdbcType=TIMESTAMP}, + + + ca_status = #{caStatus,jdbcType=INTEGER}, + + + ca_money = #{caMoney,jdbcType=DOUBLE}, + + + ca_peopel_count = #{caPeopelCount,jdbcType=INTEGER}, + + + ca_max_people_count = #{caMaxPeopleCount,jdbcType=INTEGER}, + + + ca_create_time = #{caCreateTime,jdbcType=TIMESTAMP}, + + + ca_examine_status = #{caExamineStatus,jdbcType=INTEGER}, + + + ca_examinetime = #{caExaminetime,jdbcType=DATE}, + + + ca_pic_path = #{caPicPath,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update community_activity + set ca_user_id = #{caUserId,jdbcType=INTEGER}, + ca_type = #{caType,jdbcType=INTEGER}, + ca_title = #{caTitle,jdbcType=VARCHAR}, + ca_content = #{caContent,jdbcType=VARCHAR}, + ca_start_time = #{caStartTime,jdbcType=TIMESTAMP}, + ca_end_time = #{caEndTime,jdbcType=TIMESTAMP}, + ca_status = #{caStatus,jdbcType=INTEGER}, + ca_money = #{caMoney,jdbcType=DOUBLE}, + ca_peopel_count = #{caPeopelCount,jdbcType=INTEGER}, + ca_max_people_count = #{caMaxPeopleCount,jdbcType=INTEGER}, + ca_create_time = #{caCreateTime,jdbcType=TIMESTAMP}, + ca_examine_status = #{caExamineStatus,jdbcType=INTEGER}, + ca_examinetime = #{caExaminetime,jdbcType=DATE}, + ca_pic_path = #{caPicPath,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=INTEGER} + + + update community_activity + set ca_user_id = #{caUserId,jdbcType=INTEGER}, + ca_type = #{caType,jdbcType=INTEGER}, + ca_title = #{caTitle,jdbcType=VARCHAR}, + ca_content = #{caContent,jdbcType=VARCHAR}, + ca_start_time = #{caStartTime,jdbcType=TIMESTAMP}, + ca_end_time = #{caEndTime,jdbcType=TIMESTAMP}, + ca_status = #{caStatus,jdbcType=INTEGER}, + ca_money = #{caMoney,jdbcType=DOUBLE}, + ca_peopel_count = #{caPeopelCount,jdbcType=INTEGER}, + ca_max_people_count = #{caMaxPeopleCount,jdbcType=INTEGER}, + ca_create_time = #{caCreateTime,jdbcType=TIMESTAMP}, + ca_examine_status = #{caExamineStatus,jdbcType=INTEGER}, + ca_examinetime = #{caExaminetime,jdbcType=DATE} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/payservice/src/main/resources/mapper/CommunityActivityUserMapper.xml b/payservice/src/main/resources/mapper/CommunityActivityUserMapper.xml new file mode 100644 index 0000000..9bf0941 --- /dev/null +++ b/payservice/src/main/resources/mapper/CommunityActivityUserMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + id, cau_activity_id, cau_user_id, cau_sign_status + + + + delete from community_activity_user + where id = #{id,jdbcType=INTEGER} + + + insert into community_activity_user (id, cau_activity_id, cau_user_id, + cau_sign_status) + values (#{id,jdbcType=INTEGER}, #{cauActivityId,jdbcType=INTEGER}, #{cauUserId,jdbcType=INTEGER}, + #{cauSignStatus,jdbcType=INTEGER}) + + + insert into community_activity_user + + + id, + + + cau_activity_id, + + + cau_user_id, + + + cau_sign_status, + + + + + #{id,jdbcType=INTEGER}, + + + #{cauActivityId,jdbcType=INTEGER}, + + + #{cauUserId,jdbcType=INTEGER}, + + + #{cauSignStatus,jdbcType=INTEGER}, + + + + + update community_activity_user + + + cau_activity_id = #{cauActivityId,jdbcType=INTEGER}, + + + cau_user_id = #{cauUserId,jdbcType=INTEGER}, + + + cau_sign_status = #{cauSignStatus,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update community_activity_user + set cau_activity_id = #{cauActivityId,jdbcType=INTEGER}, + cau_user_id = #{cauUserId,jdbcType=INTEGER}, + cau_sign_status = #{cauSignStatus,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/payservice/src/main/resources/mapper/ServiceOrderMapper.xml b/payservice/src/main/resources/mapper/ServiceOrderMapper.xml new file mode 100644 index 0000000..0986137 --- /dev/null +++ b/payservice/src/main/resources/mapper/ServiceOrderMapper.xml @@ -0,0 +1,164 @@ + + + + + + + + + + + + + + + + + + id, serviceid, userid, starttime, endtime, status, ordernumber, ordername, ordertype, + order_price, stop_price + + + + delete from service_order + where id = #{id,jdbcType=INTEGER} + + + insert into service_order (id, serviceid, userid, + starttime, endtime, status, + ordernumber, ordername, ordertype, + order_price, stop_price) + values (#{id,jdbcType=INTEGER}, #{serviceid,jdbcType=INTEGER}, #{userid,jdbcType=INTEGER}, + #{starttime,jdbcType=TIMESTAMP}, #{endtime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, + #{ordernumber,jdbcType=VARCHAR}, #{ordername,jdbcType=VARCHAR}, #{ordertype,jdbcType=INTEGER}, + #{orderPrice,jdbcType=INTEGER}, #{stopPrice,jdbcType=INTEGER}) + + + insert into service_order + + + id, + + + serviceid, + + + userid, + + + starttime, + + + endtime, + + + status, + + + ordernumber, + + + ordername, + + + ordertype, + + + order_price, + + + stop_price, + + + + + #{id,jdbcType=INTEGER}, + + + #{serviceid,jdbcType=INTEGER}, + + + #{userid,jdbcType=INTEGER}, + + + #{starttime,jdbcType=TIMESTAMP}, + + + #{endtime,jdbcType=TIMESTAMP}, + + + #{status,jdbcType=INTEGER}, + + + #{ordernumber,jdbcType=VARCHAR}, + + + #{ordername,jdbcType=VARCHAR}, + + + #{ordertype,jdbcType=INTEGER}, + + + #{orderPrice,jdbcType=INTEGER}, + + + #{stopPrice,jdbcType=INTEGER}, + + + + + update service_order + + + serviceid = #{serviceid,jdbcType=INTEGER}, + + + userid = #{userid,jdbcType=INTEGER}, + + + starttime = #{starttime,jdbcType=TIMESTAMP}, + + + endtime = #{endtime,jdbcType=TIMESTAMP}, + + + status = #{status,jdbcType=INTEGER}, + + + ordernumber = #{ordernumber,jdbcType=VARCHAR}, + + + ordername = #{ordername,jdbcType=VARCHAR}, + + + ordertype = #{ordertype,jdbcType=INTEGER}, + + + order_price = #{orderPrice,jdbcType=INTEGER}, + + + stop_price = #{stopPrice,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update service_order + set serviceid = #{serviceid,jdbcType=INTEGER}, + userid = #{userid,jdbcType=INTEGER}, + starttime = #{starttime,jdbcType=TIMESTAMP}, + endtime = #{endtime,jdbcType=TIMESTAMP}, + status = #{status,jdbcType=INTEGER}, + ordernumber = #{ordernumber,jdbcType=VARCHAR}, + ordername = #{ordername,jdbcType=VARCHAR}, + ordertype = #{ordertype,jdbcType=INTEGER}, + order_price = #{orderPrice,jdbcType=INTEGER}, + stop_price = #{stopPrice,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/payservice/src/main/resources/mapper/UsedProductOrderMapper.xml b/payservice/src/main/resources/mapper/UsedProductOrderMapper.xml new file mode 100644 index 0000000..db742c6 --- /dev/null +++ b/payservice/src/main/resources/mapper/UsedProductOrderMapper.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + id, product_id, product_order_type, user_id, order_number, order_name, order_money, + order_status, consigneeId + + + + delete from used_product_order + where id = #{id,jdbcType=INTEGER} + + + insert into used_product_order (id, product_id, product_order_type, + user_id, order_number, order_name, + order_money, order_status, consigneeId + ) + values (#{id,jdbcType=INTEGER}, #{productId,jdbcType=INTEGER}, #{productOrderType,jdbcType=INTEGER}, + #{userId,jdbcType=INTEGER}, #{orderNumber,jdbcType=VARCHAR}, #{orderName,jdbcType=VARCHAR}, + #{orderMoney,jdbcType=DOUBLE}, #{orderStatus,jdbcType=INTEGER}, #{consigneeid,jdbcType=INTEGER} + ) + + + insert into used_product_order + + + id, + + + product_id, + + + product_order_type, + + + user_id, + + + order_number, + + + order_name, + + + order_money, + + + order_status, + + + consigneeId, + + + + + #{id,jdbcType=INTEGER}, + + + #{productId,jdbcType=INTEGER}, + + + #{productOrderType,jdbcType=INTEGER}, + + + #{userId,jdbcType=INTEGER}, + + + #{orderNumber,jdbcType=VARCHAR}, + + + #{orderName,jdbcType=VARCHAR}, + + + #{orderMoney,jdbcType=DOUBLE}, + + + #{orderStatus,jdbcType=INTEGER}, + + + #{consigneeid,jdbcType=INTEGER}, + + + + + update used_product_order + + + product_id = #{productId,jdbcType=INTEGER}, + + + product_order_type = #{productOrderType,jdbcType=INTEGER}, + + + user_id = #{userId,jdbcType=INTEGER}, + + + order_number = #{orderNumber,jdbcType=VARCHAR}, + + + order_name = #{orderName,jdbcType=VARCHAR}, + + + order_money = #{orderMoney,jdbcType=DOUBLE}, + + + order_status = #{orderStatus,jdbcType=INTEGER}, + + + consigneeId = #{consigneeid,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update used_product_order + set product_id = #{productId,jdbcType=INTEGER}, + product_order_type = #{productOrderType,jdbcType=INTEGER}, + user_id = #{userId,jdbcType=INTEGER}, + order_number = #{orderNumber,jdbcType=VARCHAR}, + order_name = #{orderName,jdbcType=VARCHAR}, + order_money = #{orderMoney,jdbcType=DOUBLE}, + order_status = #{orderStatus,jdbcType=INTEGER}, + consigneeId = #{consigneeid,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file -- Gitee From bf3462efc7d94934553020659aa72c67fc0848fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=B4=8B?= <2870485806@qq.com> Date: Tue, 7 Apr 2020 09:40:29 +0800 Subject: [PATCH 12/27] =?UTF-8?q?=E5=95=86=E5=AE=B6=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BusinessInfoController.java | 73 ++++++++++++++++++- 1 file changed, 69 insertions(+), 4 deletions(-) diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java index 594cdaa..f6fd710 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java @@ -2,10 +2,7 @@ package com.team7.happycommunity.businessservice.controller; import com.team7.happycommunity.businessservice.common.CommonResult; import com.team7.happycommunity.businessservice.common.LoginToken; -import com.team7.happycommunity.businessservice.entity.Areainfo; -import com.team7.happycommunity.businessservice.entity.BusinessInfo; -import com.team7.happycommunity.businessservice.entity.BusinessInfoAreainfo; -import com.team7.happycommunity.businessservice.entity.MyCenter; +import com.team7.happycommunity.businessservice.entity.*; import com.team7.happycommunity.businessservice.exception.LoginException; import com.team7.happycommunity.businessservice.exception.MailboxStatusException; import com.team7.happycommunity.businessservice.service.AreainfoService; @@ -106,6 +103,9 @@ public class BusinessInfoController { @PostMapping("/phoneRegister") @ResponseBody public CommonResult phoneRegister(String phone,String resetCode){ + if (phone==null||phone.equals("")){ + return CommonResult.failed("请输入手机号"); + } try { businessInfoService.phoneRegister(phone,resetCode); @@ -287,6 +287,9 @@ public class BusinessInfoController { try { businessInfoService.codeCheck(code,phone); BusinessInfo businessInfo= businessInfoService.queryByPhone(phone); + if(businessInfo==null){ + return CommonResult.failed("账号未注册,请先注册"); + } System.out.println("businessInfo"+businessInfo); LoginToken loginToken=new LoginToken(); loginToken.setUserId(businessInfo.getId()); @@ -311,4 +314,66 @@ public class BusinessInfoController { } return money; } + + /** + * 根据用户的id修改昵称 + * @param info 用户信息 + * @return + */ + @RequestMapping("/alterUserInfo") + public CommonResult alterUserInfo(BusinessInfo info,String areaAddress){ + if(info.getId()==null){ + return CommonResult.failed("用户未登录"); + } + + try { + businessInfoService.update(info); + if(areaAddress!=null&&!areaAddress.equals("")){ + BusinessInfo info1 = businessInfoService.queryById(info.getId()); + if(info1.getPlotId()!=null&&!info1.getPlotId().equals("")){ + Areainfo areainfo=new Areainfo(); + areainfo.setAreaAddress(areaAddress); + areainfo.setId(info1.getId()); + //修改数据 + areainfoService.update(areainfo); + }else{ + //插入一条新数据 + Areainfo areainfo=new Areainfo(); + areainfo.setAreaAddress(areaAddress); + areainfoService.insert(areainfo); + } + } + return CommonResult.success("修改成功"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("修改成功"); + } + } + + + /** + * 修改手机号 + * @param phone 电话号码 + * @param code 验证码 + * @param userId 用户id + * @return + */ + @PostMapping("/alterPhone") + @ResponseBody + public CommonResult alterPhone(String phone,String code,Integer userId){ + if(userId==null||userId.equals("")){ + return CommonResult.failed("用户未登录"); + } + try { + businessInfoService.codeCheck(code,phone); + BusinessInfo info=new BusinessInfo(); + info.setCellPhNumber(phone); + info.setId(userId); + businessInfoService.update(info); + return CommonResult.success("修改成功"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(e.getMessage()); + } + } } \ No newline at end of file -- Gitee From 155211ad11bb3798f1809d5b52a8f8af830b8fbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B6=B5?= <496989943@qq.com> Date: Tue, 7 Apr 2020 09:40:55 +0800 Subject: [PATCH 13/27] =?UTF-8?q?=E3=80=90=E7=B1=BB=E5=9E=8B=E3=80=91?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG=20=E3=80=90=E6=8F=8F=E8=BF=B0=E3=80=911?= =?UTF-8?q?=E3=80=81=E4=BF=AE=E5=A4=8D=E5=B7=B2=E7=9F=A5=E7=9A=84Bug=20?= =?UTF-8?q?=E3=80=90=E7=A8=8B=E5=BA=8F=E3=80=91com.woniu.....?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- marketservice/pom.xml | 2 +- .../UsedProductConsigneeController.java | 36 +++++++++++++++++++ .../woniu/dao/CommunityActivityUserDao.java | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/marketservice/pom.xml b/marketservice/pom.xml index d39a1e5..20aa338 100644 --- a/marketservice/pom.xml +++ b/marketservice/pom.xml @@ -83,7 +83,7 @@ mysql mysql-connector-java - 5.1.47 + 5.1.48 diff --git a/marketservice/src/main/java/com/woniu/controller/UsedProductConsigneeController.java b/marketservice/src/main/java/com/woniu/controller/UsedProductConsigneeController.java index 3ff1281..e6797ca 100644 --- a/marketservice/src/main/java/com/woniu/controller/UsedProductConsigneeController.java +++ b/marketservice/src/main/java/com/woniu/controller/UsedProductConsigneeController.java @@ -28,6 +28,42 @@ public class UsedProductConsigneeController { @Resource PersonUserService personUserService; + /** + * 功能描述: 修改地址信息 + * @Param: [usedProductConsignee] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/4/7 3:03 + */ + @PutMapping("/updateAddr") + public CommonResult updateAddr(UsedProductConsignee usedProductConsignee){ + try { + usedProductConsigneeService.update(usedProductConsignee); + return CommonResult.success("修改成功"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("修改失败"); + } + } + + /** + * 功能描述: 根据地址Id删除当前地址 + * @Param: [addrId] + * @Return: com.woniu.common.CommonResult + * @Author: yanghan + * @Date: 2020/4/7 2:36 + */ + @DeleteMapping("/delAddrById/{addrId}") + public CommonResult delAddrById(@PathVariable("addrId")Integer addrId){ + try { + usedProductConsigneeService.deleteById(addrId); + return CommonResult.success("删除地址成功"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("删除地址失败"); + } + } + /** * 功能描述: 根据收货Id查询收货信息 * @Param: [consigneeId] diff --git a/marketservice/src/main/java/com/woniu/dao/CommunityActivityUserDao.java b/marketservice/src/main/java/com/woniu/dao/CommunityActivityUserDao.java index 6a71808..c2a3da3 100644 --- a/marketservice/src/main/java/com/woniu/dao/CommunityActivityUserDao.java +++ b/marketservice/src/main/java/com/woniu/dao/CommunityActivityUserDao.java @@ -64,6 +64,6 @@ public interface CommunityActivityUserDao { */ int deleteById(Integer id); - @Select("select cau_user_id from community_activity_user where cau_activity_id = #{value}") + @Select("select ca_user_id from community_activity where id = #{value}") Integer findUserNameByActivity(Integer id); } \ No newline at end of file -- Gitee From bd5db854a57c5940030e8976027ae503833e3157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E7=BA=AF?= <340251836@qq.com> Date: Tue, 7 Apr 2020 09:41:13 +0800 Subject: [PATCH 14/27] =?UTF-8?q?[ljw]=202020/03/31=20ljw=20=E4=BE=BF?= =?UTF-8?q?=E6=B0=91=E6=9C=8D=E5=8A=A1=E6=A8=A1=E5=9D=97=20[=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=86=85=E5=AE=B9]=20=E8=BF=9B=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gatway/pom.xml | 14 ++ .../gatway/filter/PropertyLoginFilter.java | 2 +- .../gatway/filter/PropertySecurityFilter.java | 22 +- gatway/src/main/resources/application.yml | 2 +- .../gatway/GatwayApplicationTests.java | 10 + parkservice/pom.xml | 17 ++ .../parkservice/ParkserviceApplication.java | 4 + .../parkservice/common/CommonResult.java | 105 +++++++++ .../parkservice/common/ResultUtil.java | 32 +++ .../controller/AreaController.java | 27 +++ .../controller/ParkingApplyController.java | 27 +++ .../controller/ParkingInfoController.java | 28 +++ .../ParkingRentRecordsController.java | 47 +++++ .../parkservice/dao/AreaInfoMapper.java | 23 ++ .../dao/OwnerParkingApplyMapper.java | 17 ++ .../parkservice/dao/ParkingInfoMapper.java | 23 ++ .../dao/ParkingRentRecordsMapper.java | 32 +++ .../parkservice/dao/PersonUserMapper.java | 21 ++ .../parkservice/dto/AddParkingApply.java | 26 +++ .../parkservice/dto/MyParkingRecordsDTO.java | 22 ++ .../parkservice/dto/ParkingRentDTO.java | 21 ++ .../parkservice/dto/ParkingRentDateDTO.java | 13 ++ .../parkservice/pojo/AreaInfo.java | 48 +++++ .../parkservice/pojo/OwnerParkingApply.java | 28 +++ .../parkservice/pojo/ParkingInfo.java | 109 ++++++++++ .../parkservice/pojo/ParkingRentRecords.java | 26 +++ .../parkservice/pojo/PersonUser.java | 37 ++++ .../parkservice/service/AreaInfoService.java | 9 + .../service/ParkingApplyService.java | 9 + .../service/ParkingInfoService.java | 9 + .../service/ParkingRentRecordsService.java | 17 ++ .../service/impl/AreaInfoServiceImpl.java | 21 ++ .../service/impl/ParkingApplyServiceImpl.java | 39 ++++ .../service/impl/ParkingInfoServiceImpl.java | 21 ++ .../impl/ParkingRentRecordsServiceImpl.java | 65 ++++++ .../src/main/resources/generatorConfig.xml | 57 +++++ .../main/resources/mapper/AreaInfoMapper.xml | 82 ++++++++ .../mapper/OwnerParkingApplyMapper.xml | 142 +++++++++++++ .../resources/mapper/ParkingInfoMapper.xml | 153 ++++++++++++++ .../mapper/ParkingRentRecordsMapper.xml | 124 +++++++++++ .../resources/mapper/PersonUserMapper.xml | 199 ++++++++++++++++++ .../ParkserviceApplicationTests.java | 13 ++ .../PropertydemoApplicationTests.java | 2 +- .../dao/ParkingInfoMapper.java | 2 +- .../pojo/OwnerParkingApply.java | 2 + .../propertymanagement/pojo/ParkingInfo.java | 15 +- .../propertymanagement/pojo/PpPayservice.java | 23 ++ .../impl/OwnerParkingApplyServiceImpl.java | 2 +- .../mapper/OwnerParkingApplyMapper.xml | 3 +- 49 files changed, 1779 insertions(+), 13 deletions(-) create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/common/CommonResult.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/common/ResultUtil.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/AreaController.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingApplyController.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingInfoController.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingRentRecordsController.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/AreaInfoMapper.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/OwnerParkingApplyMapper.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingInfoMapper.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingRentRecordsMapper.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/PersonUserMapper.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/AddParkingApply.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/MyParkingRecordsDTO.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDTO.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDateDTO.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/AreaInfo.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/OwnerParkingApply.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingInfo.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingRentRecords.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/PersonUser.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/AreaInfoService.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingApplyService.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingInfoService.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingRentRecordsService.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/AreaInfoServiceImpl.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingApplyServiceImpl.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingInfoServiceImpl.java create mode 100644 parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingRentRecordsServiceImpl.java create mode 100644 parkservice/src/main/resources/generatorConfig.xml create mode 100644 parkservice/src/main/resources/mapper/AreaInfoMapper.xml create mode 100644 parkservice/src/main/resources/mapper/OwnerParkingApplyMapper.xml create mode 100644 parkservice/src/main/resources/mapper/ParkingInfoMapper.xml create mode 100644 parkservice/src/main/resources/mapper/ParkingRentRecordsMapper.xml create mode 100644 parkservice/src/main/resources/mapper/PersonUserMapper.xml diff --git a/gatway/pom.xml b/gatway/pom.xml index f6d909d..8e4d930 100644 --- a/gatway/pom.xml +++ b/gatway/pom.xml @@ -72,6 +72,20 @@ org.springframework.boot spring-boot-maven-plugin + + + + + + + + + + + + + + diff --git a/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertyLoginFilter.java b/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertyLoginFilter.java index 4731361..0c1fbf8 100644 --- a/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertyLoginFilter.java +++ b/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertyLoginFilter.java @@ -31,7 +31,7 @@ public class PropertyLoginFilter extends ZuulFilter { JWTUtils jwtUtils; @Value("${my.auth_verify.duration}") - Integer duration; + Long duration; @Value("${my.propertymanagement.name}") String applicationName; diff --git a/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertySecurityFilter.java b/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertySecurityFilter.java index 5b239cf..0982a28 100644 --- a/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertySecurityFilter.java +++ b/gatway/src/main/java/com/team7/happycommunity/gatway/filter/PropertySecurityFilter.java @@ -13,6 +13,9 @@ import org.springframework.stereotype.Component; import org.springframework.util.ReflectionUtils; import sun.misc.Request; +import java.util.ArrayList; +import java.util.List; + @Component public class PropertySecurityFilter extends ZuulFilter { @@ -41,10 +44,15 @@ public class PropertySecurityFilter extends ZuulFilter { */ @Override public boolean shouldFilter() { -// System.out.println(RequestContext.getCurrentContext().getRequest().getRequestURI()); + List list_url = new ArrayList(); + list_url.add("/propertymanagement/user/test2"); + list_url.add("/propertymanagement/area/getone"); +// list_url.add("/propertymanagement/propertyservice"); // 测试 路径 - if (RequestContext.getCurrentContext().getRequest().getRequestURI().contains("/propertymanagement/user/test2")){ - return true; + for(String url: list_url){ + if (RequestContext.getCurrentContext().getRequest().getRequestURI().contains(url)){ + return true; + } } return false; } @@ -52,19 +60,21 @@ public class PropertySecurityFilter extends ZuulFilter { @Override - public Object run() throws ZuulException { + public Object run(){ RequestContext requestContext = RequestContext.getCurrentContext(); // 获取 用户名信息 String username = requestContext.getRequest().getHeader("username"); String token = requestContext.getRequest().getHeader("token"); + System.out.println(token); + System.out.println(username); // 解密 token 信息 String result_name = jwtUtils.unsign(token,String.class); - if(!result_name.equals(username)){ + if(result_name == null || !result_name.equals(username)){ // 认证失败拒绝访问 requestContext.setSendZuulResponse(false); requestContext.setResponseStatusCode(200); - JSONObject jsonObject = (JSONObject) JSONObject.toJSON(CommonResult.failed("登录失败")); + JSONObject jsonObject = (JSONObject) JSONObject.toJSON(CommonResult.failed("abs")); requestContext.setResponseBody(jsonObject.toJSONString()); } return null; diff --git a/gatway/src/main/resources/application.yml b/gatway/src/main/resources/application.yml index f1193bc..1e860ae 100644 --- a/gatway/src/main/resources/application.yml +++ b/gatway/src/main/resources/application.yml @@ -34,7 +34,7 @@ my: AA#$%()(#*!()!KL<>?N<:{LWPW auth_verify: duration: - 3600 + 3600000 propertymanagement: name: propertymanagement \ No newline at end of file diff --git a/gatway/src/test/java/com/team7/happycommunity/gatway/GatwayApplicationTests.java b/gatway/src/test/java/com/team7/happycommunity/gatway/GatwayApplicationTests.java index b430dad..15a4c2b 100644 --- a/gatway/src/test/java/com/team7/happycommunity/gatway/GatwayApplicationTests.java +++ b/gatway/src/test/java/com/team7/happycommunity/gatway/GatwayApplicationTests.java @@ -1,13 +1,23 @@ package com.team7.happycommunity.gatway; +import com.team7.happycommunity.gatway.utils.JWTUtils; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class GatwayApplicationTests { + @Autowired + JWTUtils jwtUtils; + + private String myusername = "hc123123"; + @Test void contextLoads() { + + String result = jwtUtils.unsign("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE1ODUyMDYxMTQxMjEsInBheWxvYWQiOiJcInJvb3RcIiJ9.IQBCozSDN5in4IXXjP_4othnoUzNsfFhabgBRTkQNMk", String.class); + System.out.println(result); } } diff --git a/parkservice/pom.xml b/parkservice/pom.xml index 9be673c..fca95c2 100644 --- a/parkservice/pom.xml +++ b/parkservice/pom.xml @@ -98,6 +98,23 @@ + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.3.7 + + ${basedir}/src/main/resources/generatorConfig.xml + + + + mysql + mysql-connector-java + 5.1.47 + + + + org.springframework.boot spring-boot-maven-plugin diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/ParkserviceApplication.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/ParkserviceApplication.java index 5fb2668..05758f9 100644 --- a/parkservice/src/main/java/com/team7/happycommunity/parkservice/ParkserviceApplication.java +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/ParkserviceApplication.java @@ -1,9 +1,13 @@ package com.team7.happycommunity.parkservice; +import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication +@MapperScan(value = {"com.team7.happycommunity.parkservice.dao"}) +@EnableEurekaClient public class ParkserviceApplication { public static void main(String[] args) { diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/CommonResult.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/CommonResult.java new file mode 100644 index 0000000..cb397d1 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/CommonResult.java @@ -0,0 +1,105 @@ +package com.team7.happycommunity.parkservice.common; + +import java.io.Serializable; + +public class CommonResult implements Serializable { + //状态码 + private Long code; + //提示消息 + private String message; + //响应数据 + private T data; + + public CommonResult(){} + public CommonResult(Long code, String message){ + this.code = code; + this.message = message; + } + + public CommonResult(Long code , String message, T data){ + this.code = code; + this.message = message; + this.data = data; + } + + /** + * 响应成功的结果 + * @return 状态码 200 + */ + public static CommonResult success(){ + return new CommonResult(ResultUtil.SUCCESS.getCode(),ResultUtil.SUCCESS.getMessage()); + } + + public static CommonResult success(String message){ + return new CommonResult(ResultUtil.SUCCESS.getCode(),message); + } + + public static CommonResult success(T data){ + return new CommonResult(ResultUtil.SUCCESS.getCode(),ResultUtil.SUCCESS.getMessage(),data); + } + public static CommonResult success(String message,T data){ + return new CommonResult(ResultUtil.SUCCESS.getCode(),message,data); + } + + /** + * 响应失败 + * @return 状态码500 + */ + public static CommonResult failed(){ + return new CommonResult(ResultUtil.FAILED.getCode(),ResultUtil.FAILED.getMessage()); + } + + public static CommonResult failed(String message){ + return new CommonResult(ResultUtil.FAILED.getCode(),message); + } + /** + * 参数验证失败 + * @return 状态码 400 + */ + public static CommonResult valetateFailed(){ + return new CommonResult(ResultUtil.VALIDATE_FAILED.getCode(),ResultUtil.VALIDATE_FAILED.getMessage()); + } + public static CommonResult valetateFailed(String msg){ + return new CommonResult(ResultUtil.VALIDATE_FAILED.getCode(),msg); + } + + /** + * 未认证 + * @return 状态码401 + */ + public static CommonResult unathorizedFailed(){ + return new CommonResult(ResultUtil.UNAUTORIED.getCode(), ResultUtil.UNAUTORIED.getMessage()); + } + + /** + * 未授权 + * @return 状态码403 + */ + public static CommonResult forbiddenFailed(){ + return new CommonResult(ResultUtil.FORBIDDEN.getCode(),ResultUtil.FORBIDDEN.getMessage()); + } + + public Long getCode() { + return code; + } + + public void setCode(Long code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/ResultUtil.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/ResultUtil.java new file mode 100644 index 0000000..8cfb173 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/common/ResultUtil.java @@ -0,0 +1,32 @@ +package com.team7.happycommunity.parkservice.common; + +public enum ResultUtil { + SUCCESS(200L,"操作成功"), + FAILED(500L,"操作失败"), + VALIDATE_FAILED(400L,"参数验证失败"), + UNAUTORIED(401L,"未认证或token过期"), + FORBIDDEN(403L,"未授权"); + private Long code; + private String message; + + private ResultUtil(Long code,String message){ + this.code = code; + this.message = message; + } + + public Long getCode() { + return code; + } + + public void setCode(Long code) { + this.code = code; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/AreaController.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/AreaController.java new file mode 100644 index 0000000..31d7f38 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/AreaController.java @@ -0,0 +1,27 @@ +package com.team7.happycommunity.parkservice.controller; + +import com.team7.happycommunity.parkservice.common.CommonResult; +import com.team7.happycommunity.parkservice.pojo.AreaInfo; +import com.team7.happycommunity.parkservice.service.AreaInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/area") +public class AreaController { + + @Autowired + AreaInfoService areaInfoService; + + @GetMapping("/getall") + @ResponseBody + public CommonResult getAll(){ + List list_areainfo = areaInfoService.selectAll(); + return CommonResult.success(list_areainfo); + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingApplyController.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingApplyController.java new file mode 100644 index 0000000..d58b96a --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingApplyController.java @@ -0,0 +1,27 @@ +package com.team7.happycommunity.parkservice.controller; + +import com.team7.happycommunity.parkservice.common.CommonResult; +import com.team7.happycommunity.parkservice.dto.AddParkingApply; +import com.team7.happycommunity.parkservice.service.ParkingApplyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +@Controller +@RequestMapping("/parkingapply") +public class ParkingApplyController { + + @Autowired + ParkingApplyService parkingApplyService; + + @PostMapping("/add") + @ResponseBody + public CommonResult getResult(@RequestBody AddParkingApply addParkingApply){ + System.out.println("123"); + int i = parkingApplyService.add(addParkingApply); + return i==0?CommonResult.failed():CommonResult.success(); + } + +// @Post() + +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingInfoController.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingInfoController.java new file mode 100644 index 0000000..7f722d0 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingInfoController.java @@ -0,0 +1,28 @@ +package com.team7.happycommunity.parkservice.controller; + +import com.team7.happycommunity.parkservice.common.CommonResult; +import com.team7.happycommunity.parkservice.pojo.ParkingInfo; +import com.team7.happycommunity.parkservice.service.ParkingInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.List; + +@Controller +@RequestMapping("/parkinginfo") +public class ParkingInfoController { + + @Autowired + ParkingInfoService parkingInfoService; + + @GetMapping("/mlist") + @ResponseBody + public CommonResult mlist(@RequestParam(defaultValue = "2") int areaid){ + List list = parkingInfoService.getMList(areaid); + return CommonResult.success(list); + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingRentRecordsController.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingRentRecordsController.java new file mode 100644 index 0000000..c6b2bb5 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/controller/ParkingRentRecordsController.java @@ -0,0 +1,47 @@ +package com.team7.happycommunity.parkservice.controller; + +import com.team7.happycommunity.parkservice.common.CommonResult; +import com.team7.happycommunity.parkservice.dao.ParkingRentRecordsMapper; +import com.team7.happycommunity.parkservice.dto.MyParkingRecordsDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDateDTO; +import com.team7.happycommunity.parkservice.service.ParkingRentRecordsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Controller +@RequestMapping("/parkingrent") +public class ParkingRentRecordsController { + + + @Autowired + ParkingRentRecordsService parkingRentRecordsService; + + // 获取当前车位所有出租信息 + @GetMapping("/rlist") + @ResponseBody + public CommonResult getRecerdsList(Integer id){ + List list = parkingRentRecordsService.getRecords(id); + return CommonResult.success(list); + } + + // 获取自己的租用车位信息 + @GetMapping("/mylist") + @ResponseBody + public CommonResult getMyRecordsList(String username){ + List list = parkingRentRecordsService.getMyRecords(username); + return CommonResult.success(list); + } + + + @PostMapping("/add") + @ResponseBody + public CommonResult add(@RequestBody ParkingRentDTO parkingRentDTO){ + int i = parkingRentRecordsService.add(parkingRentDTO); + return i == 0?CommonResult.failed():CommonResult.success(); + } + +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/AreaInfoMapper.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/AreaInfoMapper.java new file mode 100644 index 0000000..6eff08e --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/AreaInfoMapper.java @@ -0,0 +1,23 @@ +package com.team7.happycommunity.parkservice.dao; + +import com.team7.happycommunity.parkservice.pojo.AreaInfo; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface AreaInfoMapper { + int deleteByPrimaryKey(Integer id); + + int insert(AreaInfo record); + + int insertSelective(AreaInfo record); + + AreaInfo selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(AreaInfo record); + + int updateByPrimaryKey(AreaInfo record); + + @Select("select * from areainfo") + List selectAll(); +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/OwnerParkingApplyMapper.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/OwnerParkingApplyMapper.java new file mode 100644 index 0000000..baff4f7 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/OwnerParkingApplyMapper.java @@ -0,0 +1,17 @@ +package com.team7.happycommunity.parkservice.dao; + +import com.team7.happycommunity.parkservice.pojo.OwnerParkingApply; + +public interface OwnerParkingApplyMapper { + int deleteByPrimaryKey(Integer id); + + int insert(OwnerParkingApply record); + + int insertSelective(OwnerParkingApply record); + + OwnerParkingApply selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(OwnerParkingApply record); + + int updateByPrimaryKey(OwnerParkingApply record); +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingInfoMapper.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingInfoMapper.java new file mode 100644 index 0000000..42da2bf --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingInfoMapper.java @@ -0,0 +1,23 @@ +package com.team7.happycommunity.parkservice.dao; + +import com.team7.happycommunity.parkservice.pojo.ParkingInfo; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface ParkingInfoMapper { + int deleteByPrimaryKey(Integer id); + + int insert(ParkingInfo record); + + int insertSelective(ParkingInfo record); + + ParkingInfo selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(ParkingInfo record); + + int updateByPrimaryKey(ParkingInfo record); + + @Select("select * from parking_info where community_id = #{areaid} and status = 0") + List selectByAreaId(Integer areaid); +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingRentRecordsMapper.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingRentRecordsMapper.java new file mode 100644 index 0000000..549f9aa --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/ParkingRentRecordsMapper.java @@ -0,0 +1,32 @@ +package com.team7.happycommunity.parkservice.dao; + +import com.team7.happycommunity.parkservice.dto.MyParkingRecordsDTO; +import com.team7.happycommunity.parkservice.pojo.ParkingRentRecords; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface ParkingRentRecordsMapper { + int deleteByPrimaryKey(Integer id); + + int insert(ParkingRentRecords record); + + int insertSelective(ParkingRentRecords record); + + ParkingRentRecords selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(ParkingRentRecords record); + + int updateByPrimaryKey(ParkingRentRecords record); + + @Select("select * from parking_rent_records where parking_info_id = #{id}") + List selectByParkingInfoId(Integer id); + + + @Select("select r.begin_time beginTime, r.end_time endTime, r.carid carId, " + + " a.area_name areaName,p.parking_number parkingNumber,p.cost_per_day costPerDay from parking_rent_records r left join " + + "parking_info p on p.id = r.parking_info_id " + + "left join areainfo a on a.id = p.community_id " + + "where r.user_id = #{id}") + List selectByUserId(Integer id); +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/PersonUserMapper.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/PersonUserMapper.java new file mode 100644 index 0000000..e38d6df --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dao/PersonUserMapper.java @@ -0,0 +1,21 @@ +package com.team7.happycommunity.parkservice.dao; + +import com.team7.happycommunity.parkservice.pojo.PersonUser; +import org.apache.ibatis.annotations.Select; + +public interface PersonUserMapper { + int deleteByPrimaryKey(Integer id); + + int insert(PersonUser record); + + int insertSelective(PersonUser record); + + PersonUser selectByPrimaryKey(Integer id); + + int updateByPrimaryKeySelective(PersonUser record); + + int updateByPrimaryKey(PersonUser record); + + @Select("select * from person_user where name = #{usernmae}") + PersonUser selectByUsername(String userName); +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/AddParkingApply.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/AddParkingApply.java new file mode 100644 index 0000000..224ef32 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/AddParkingApply.java @@ -0,0 +1,26 @@ +package com.team7.happycommunity.parkservice.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class AddParkingApply implements Serializable { + + private String userName; + + private Integer areaid; + + private String parkingNumber; + + private String parkingInfos; + + private Integer costPerDay; + + private Date beginTime; + + private Date endTime; + + +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/MyParkingRecordsDTO.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/MyParkingRecordsDTO.java new file mode 100644 index 0000000..b5bafe2 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/MyParkingRecordsDTO.java @@ -0,0 +1,22 @@ +package com.team7.happycommunity.parkservice.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class MyParkingRecordsDTO implements Serializable { + + private String parkingNumber; + + private Integer costPerDay; + + private String beginTime; + + private String endTime; + + private String carid; + + private String areaName; +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDTO.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDTO.java new file mode 100644 index 0000000..7538bb6 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDTO.java @@ -0,0 +1,21 @@ +package com.team7.happycommunity.parkservice.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class ParkingRentDTO implements Serializable { + + private String userName; + + private Integer parkingInfoId; + + private Date beginTime; + + private Date endTime; + + private String carId; + +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDateDTO.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDateDTO.java new file mode 100644 index 0000000..8097679 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/dto/ParkingRentDateDTO.java @@ -0,0 +1,13 @@ +package com.team7.happycommunity.parkservice.dto; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class ParkingRentDateDTO implements Serializable { + + private String beginT; + + private String endT; +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/AreaInfo.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/AreaInfo.java new file mode 100644 index 0000000..8c7951b --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/AreaInfo.java @@ -0,0 +1,48 @@ +package com.team7.happycommunity.parkservice.pojo; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class AreaInfo implements Serializable { + private Integer id; + + private String areaName; + + private String areaAddress; + + private String detail1; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getAreaAddress() { + return areaAddress; + } + + public void setAreaAddress(String areaAddress) { + this.areaAddress = areaAddress; + } + + public String getDetail1() { + return detail1; + } + + public void setDetail1(String detail1) { + this.detail1 = detail1; + } +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/OwnerParkingApply.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/OwnerParkingApply.java new file mode 100644 index 0000000..a0dbb00 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/OwnerParkingApply.java @@ -0,0 +1,28 @@ +package com.team7.happycommunity.parkservice.pojo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class OwnerParkingApply implements Serializable { + private Integer id; + + private Integer ownerId; + + private String parkingCode; + + private String parkingInfo; + + private Date beginTime; + + private Date endTime; + + private Integer communityId; + + private Integer status; + + private Integer costPerDay; + +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingInfo.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingInfo.java new file mode 100644 index 0000000..abc901c --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingInfo.java @@ -0,0 +1,109 @@ +package com.team7.happycommunity.parkservice.pojo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class ParkingInfo implements Serializable { + private Integer id; + + private Date beginTime; + + private Date endTime; + + private String parkingNumber; + + private String parkingInfos; + + private Integer costPerDay; + + private Integer communityId; + + private Integer ownerId; + + private Integer type; + + private Integer status; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Date getBeginTime() { + return beginTime; + } + + public void setBeginTime(Date beginTime) { + this.beginTime = beginTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public String getParkingNumber() { + return parkingNumber; + } + + public void setParkingNumber(String parkingNumber) { + this.parkingNumber = parkingNumber; + } + + public String getParkingInfos() { + return parkingInfos; + } + + public void setParkingInfos(String parkingInfos) { + this.parkingInfos = parkingInfos; + } + + public Integer getCostPerDay() { + return costPerDay; + } + + public void setCostPerDay(Integer costPerDay) { + this.costPerDay = costPerDay; + } + + public Integer getCommunityId() { + return communityId; + } + + public void setCommunityId(Integer communityId) { + this.communityId = communityId; + } + + public Integer getOwnerId() { + return ownerId; + } + + public void setOwnerId(Integer ownerId) { + this.ownerId = ownerId; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingRentRecords.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingRentRecords.java new file mode 100644 index 0000000..2a71cb8 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/ParkingRentRecords.java @@ -0,0 +1,26 @@ +package com.team7.happycommunity.parkservice.pojo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class ParkingRentRecords implements Serializable { + private Integer id; + + private String carid; + + private Date beginTime; + + private Date endTime; + + private Integer parkingInfoId; + + private Integer orderId; + + private Integer userId; + + private Integer status; + +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/PersonUser.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/PersonUser.java new file mode 100644 index 0000000..75cd89c --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/pojo/PersonUser.java @@ -0,0 +1,37 @@ +package com.team7.happycommunity.parkservice.pojo; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +@Data +public class PersonUser implements Serializable { + private Integer id; + + private String idNumber; + + private String cellPhNumber; + + private String password; + + private String name; + + private Integer sex; + + private String nickname; + + private String mailbox; + + private Integer plotId; + + private String tag; + + private Integer mailboxStatus; + + private String code; + + private String passwordSalt; + + private Date createTime; +} \ No newline at end of file diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/AreaInfoService.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/AreaInfoService.java new file mode 100644 index 0000000..7153a1c --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/AreaInfoService.java @@ -0,0 +1,9 @@ +package com.team7.happycommunity.parkservice.service; + +import com.team7.happycommunity.parkservice.pojo.AreaInfo; + +import java.util.List; + +public interface AreaInfoService { + List selectAll(); +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingApplyService.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingApplyService.java new file mode 100644 index 0000000..63c0b55 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingApplyService.java @@ -0,0 +1,9 @@ +package com.team7.happycommunity.parkservice.service; + +import com.team7.happycommunity.parkservice.dto.AddParkingApply; +import org.springframework.stereotype.Service; + + +public interface ParkingApplyService { + int add(AddParkingApply addParkingApply); +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingInfoService.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingInfoService.java new file mode 100644 index 0000000..70d8aa1 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingInfoService.java @@ -0,0 +1,9 @@ +package com.team7.happycommunity.parkservice.service; + +import com.team7.happycommunity.parkservice.pojo.ParkingInfo; + +import java.util.List; + +public interface ParkingInfoService { + List getMList(int areaid); +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingRentRecordsService.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingRentRecordsService.java new file mode 100644 index 0000000..81163c2 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/ParkingRentRecordsService.java @@ -0,0 +1,17 @@ +package com.team7.happycommunity.parkservice.service; + +import com.team7.happycommunity.parkservice.dto.MyParkingRecordsDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDateDTO; + +import java.util.List; + +public interface ParkingRentRecordsService { + + + List getRecords(Integer id); + + int add(ParkingRentDTO parkingRentDTO); + + List getMyRecords(String username); +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/AreaInfoServiceImpl.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/AreaInfoServiceImpl.java new file mode 100644 index 0000000..ac08e76 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/AreaInfoServiceImpl.java @@ -0,0 +1,21 @@ +package com.team7.happycommunity.parkservice.service.impl; + +import com.team7.happycommunity.parkservice.dao.AreaInfoMapper; +import com.team7.happycommunity.parkservice.pojo.AreaInfo; +import com.team7.happycommunity.parkservice.service.AreaInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class AreaInfoServiceImpl implements AreaInfoService { + + @Autowired + AreaInfoMapper areaInfoMapper; + + @Override + public List selectAll() { + return areaInfoMapper.selectAll(); + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingApplyServiceImpl.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingApplyServiceImpl.java new file mode 100644 index 0000000..a4e57f9 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingApplyServiceImpl.java @@ -0,0 +1,39 @@ +package com.team7.happycommunity.parkservice.service.impl; + +import com.team7.happycommunity.parkservice.dao.OwnerParkingApplyMapper; +import com.team7.happycommunity.parkservice.dao.ParkingInfoMapper; +import com.team7.happycommunity.parkservice.dao.PersonUserMapper; +import com.team7.happycommunity.parkservice.dto.AddParkingApply; +import com.team7.happycommunity.parkservice.pojo.OwnerParkingApply; +import com.team7.happycommunity.parkservice.pojo.ParkingInfo; +import com.team7.happycommunity.parkservice.pojo.PersonUser; +import com.team7.happycommunity.parkservice.service.ParkingApplyService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +@Service +public class ParkingApplyServiceImpl implements ParkingApplyService { + + @Autowired + OwnerParkingApplyMapper ownerParkingApplyMapper; + + @Autowired + PersonUserMapper personUserMapper; + + @Override + public int add(AddParkingApply addParkingApply) { + // 获取personUser的用户id + PersonUser personUser = personUserMapper.selectByUsername(addParkingApply.getUserName()); + // 存入 + OwnerParkingApply ownerParkingApply = new OwnerParkingApply(); + ownerParkingApply.setOwnerId(personUser.getId()); + ownerParkingApply.setBeginTime(addParkingApply.getBeginTime()); + ownerParkingApply.setEndTime(addParkingApply.getEndTime()); + ownerParkingApply.setCommunityId(addParkingApply.getAreaid()); + ownerParkingApply.setCostPerDay(addParkingApply.getCostPerDay()); + ownerParkingApply.setParkingCode(addParkingApply.getParkingNumber()); + ownerParkingApply.setParkingInfo(addParkingApply.getParkingInfos()); + ownerParkingApply.setStatus(0);// 未审核状态 + return ownerParkingApplyMapper.insertSelective(ownerParkingApply); + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingInfoServiceImpl.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingInfoServiceImpl.java new file mode 100644 index 0000000..86ed791 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingInfoServiceImpl.java @@ -0,0 +1,21 @@ +package com.team7.happycommunity.parkservice.service.impl; + +import com.team7.happycommunity.parkservice.dao.ParkingInfoMapper; +import com.team7.happycommunity.parkservice.pojo.ParkingInfo; +import com.team7.happycommunity.parkservice.service.ParkingInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ParkingInfoServiceImpl implements ParkingInfoService { + + @Autowired + ParkingInfoMapper parkingInfoMapper; + + @Override + public List getMList(int areaid) { + return parkingInfoMapper.selectByAreaId(areaid); + } +} diff --git a/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingRentRecordsServiceImpl.java b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingRentRecordsServiceImpl.java new file mode 100644 index 0000000..7340944 --- /dev/null +++ b/parkservice/src/main/java/com/team7/happycommunity/parkservice/service/impl/ParkingRentRecordsServiceImpl.java @@ -0,0 +1,65 @@ +package com.team7.happycommunity.parkservice.service.impl; + +import com.team7.happycommunity.parkservice.dao.ParkingRentRecordsMapper; +import com.team7.happycommunity.parkservice.dao.PersonUserMapper; +import com.team7.happycommunity.parkservice.dto.MyParkingRecordsDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDTO; +import com.team7.happycommunity.parkservice.dto.ParkingRentDateDTO; +import com.team7.happycommunity.parkservice.pojo.ParkingRentRecords; +import com.team7.happycommunity.parkservice.pojo.PersonUser; +import com.team7.happycommunity.parkservice.service.ParkingRentRecordsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.Serializable; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +@Service +public class ParkingRentRecordsServiceImpl implements ParkingRentRecordsService { + + @Autowired + ParkingRentRecordsMapper parkingRentRecordsMapper; + + @Autowired + PersonUserMapper personUserMapper; + + @Override + public List getRecords(Integer id) { + List list = parkingRentRecordsMapper.selectByParkingInfoId(id); + List list_re = new ArrayList<>(); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + for(int i = 0; i < list.size() ; i ++){ + ParkingRentDateDTO parkingRentDateDTO = new ParkingRentDateDTO(); + parkingRentDateDTO.setBeginT(simpleDateFormat.format(list.get(i).getBeginTime())); + parkingRentDateDTO.setEndT(simpleDateFormat.format(list.get(i).getEndTime())); + list_re.add(parkingRentDateDTO); + } + return list_re; + } + + @Override + public int add(ParkingRentDTO parkingRentDTO) { + PersonUser personUser = personUserMapper.selectByUsername(parkingRentDTO.getUserName()); + + ParkingRentRecords parkingRentRecords = new ParkingRentRecords(); + parkingRentRecords.setBeginTime(parkingRentDTO.getBeginTime()); + parkingRentRecords.setEndTime(parkingRentDTO.getEndTime()); + parkingRentRecords.setCarid(parkingRentDTO.getCarId()); + parkingRentRecords.setStatus(0); + parkingRentRecords.setParkingInfoId(parkingRentDTO.getParkingInfoId()); + parkingRentRecords.setUserId(personUser.getId()); + return parkingRentRecordsMapper.insertSelective(parkingRentRecords); + +// return 0; + } + + @Override + public List getMyRecords(String username) { + PersonUser personUser = personUserMapper.selectByUsername(username); + List list = parkingRentRecordsMapper.selectByUserId(personUser.getId()); + return list; + } +} diff --git a/parkservice/src/main/resources/generatorConfig.xml b/parkservice/src/main/resources/generatorConfig.xml new file mode 100644 index 0000000..49919ae --- /dev/null +++ b/parkservice/src/main/resources/generatorConfig.xml @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+ +
+ +
+
+
\ No newline at end of file diff --git a/parkservice/src/main/resources/mapper/AreaInfoMapper.xml b/parkservice/src/main/resources/mapper/AreaInfoMapper.xml new file mode 100644 index 0000000..b95453e --- /dev/null +++ b/parkservice/src/main/resources/mapper/AreaInfoMapper.xml @@ -0,0 +1,82 @@ + + + + + + + + + + + id, area_name, area_address, detail1 + + + + delete from areainfo + where id = #{id,jdbcType=INTEGER} + + + insert into areainfo (id, area_name, area_address, + detail1) + values (#{id,jdbcType=INTEGER}, #{areaName,jdbcType=VARCHAR}, #{areaAddress,jdbcType=VARCHAR}, + #{detail1,jdbcType=VARCHAR}) + + + insert into areainfo + + + id, + + + area_name, + + + area_address, + + + detail1, + + + + + #{id,jdbcType=INTEGER}, + + + #{areaName,jdbcType=VARCHAR}, + + + #{areaAddress,jdbcType=VARCHAR}, + + + #{detail1,jdbcType=VARCHAR}, + + + + + update areainfo + + + area_name = #{areaName,jdbcType=VARCHAR}, + + + area_address = #{areaAddress,jdbcType=VARCHAR}, + + + detail1 = #{detail1,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=INTEGER} + + + update areainfo + set area_name = #{areaName,jdbcType=VARCHAR}, + area_address = #{areaAddress,jdbcType=VARCHAR}, + detail1 = #{detail1,jdbcType=VARCHAR} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/parkservice/src/main/resources/mapper/OwnerParkingApplyMapper.xml b/parkservice/src/main/resources/mapper/OwnerParkingApplyMapper.xml new file mode 100644 index 0000000..5b18122 --- /dev/null +++ b/parkservice/src/main/resources/mapper/OwnerParkingApplyMapper.xml @@ -0,0 +1,142 @@ + + + + + + + + + + + + + + + + id, owner_id, parking_code, parking_info, begin_time, end_time, community_id, status, + cost_per_day + + + + delete from owner_parking_apply + where id = #{id,jdbcType=INTEGER} + + + insert into owner_parking_apply (id, owner_id, parking_code, + parking_info, begin_time, end_time, + community_id, status, cost_per_day + ) + values (#{id,jdbcType=INTEGER}, #{ownerId,jdbcType=INTEGER}, #{parkingCode,jdbcType=VARCHAR}, + #{parkingInfo,jdbcType=VARCHAR}, #{beginTime,jdbcType=DATE}, #{endTime,jdbcType=DATE}, + #{communityId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{costPerDay,jdbcType=INTEGER} + ) + + + insert into owner_parking_apply + + + id, + + + owner_id, + + + parking_code, + + + parking_info, + + + begin_time, + + + end_time, + + + community_id, + + + status, + + + cost_per_day, + + + + + #{id,jdbcType=INTEGER}, + + + #{ownerId,jdbcType=INTEGER}, + + + #{parkingCode,jdbcType=VARCHAR}, + + + #{parkingInfo,jdbcType=VARCHAR}, + + + #{beginTime,jdbcType=DATE}, + + + #{endTime,jdbcType=DATE}, + + + #{communityId,jdbcType=INTEGER}, + + + #{status,jdbcType=INTEGER}, + + + #{costPerDay,jdbcType=INTEGER}, + + + + + update owner_parking_apply + + + owner_id = #{ownerId,jdbcType=INTEGER}, + + + parking_code = #{parkingCode,jdbcType=VARCHAR}, + + + parking_info = #{parkingInfo,jdbcType=VARCHAR}, + + + begin_time = #{beginTime,jdbcType=DATE}, + + + end_time = #{endTime,jdbcType=DATE}, + + + community_id = #{communityId,jdbcType=INTEGER}, + + + status = #{status,jdbcType=INTEGER}, + + + cost_per_day = #{costPerDay,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update owner_parking_apply + set owner_id = #{ownerId,jdbcType=INTEGER}, + parking_code = #{parkingCode,jdbcType=VARCHAR}, + parking_info = #{parkingInfo,jdbcType=VARCHAR}, + begin_time = #{beginTime,jdbcType=DATE}, + end_time = #{endTime,jdbcType=DATE}, + community_id = #{communityId,jdbcType=INTEGER}, + status = #{status,jdbcType=INTEGER}, + cost_per_day = #{costPerDay,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/parkservice/src/main/resources/mapper/ParkingInfoMapper.xml b/parkservice/src/main/resources/mapper/ParkingInfoMapper.xml new file mode 100644 index 0000000..d3985a5 --- /dev/null +++ b/parkservice/src/main/resources/mapper/ParkingInfoMapper.xml @@ -0,0 +1,153 @@ + + + + + + + + + + + + + + + + + id, begin_time, end_time, parking_number, parking_infos, cost_per_day, community_id, + owner_id, type, status + + + + delete from parking_info + where id = #{id,jdbcType=INTEGER} + + + insert into parking_info (id, begin_time, end_time, + parking_number, parking_infos, cost_per_day, + community_id, owner_id, type, + status) + values (#{id,jdbcType=INTEGER}, #{beginTime,jdbcType=DATE}, #{endTime,jdbcType=DATE}, + #{parkingNumber,jdbcType=VARCHAR}, #{parkingInfos,jdbcType=VARCHAR}, #{costPerDay,jdbcType=INTEGER}, + #{communityId,jdbcType=INTEGER}, #{ownerId,jdbcType=INTEGER}, #{type,jdbcType=INTEGER}, + #{status,jdbcType=INTEGER}) + + + insert into parking_info + + + id, + + + begin_time, + + + end_time, + + + parking_number, + + + parking_infos, + + + cost_per_day, + + + community_id, + + + owner_id, + + + type, + + + status, + + + + + #{id,jdbcType=INTEGER}, + + + #{beginTime,jdbcType=DATE}, + + + #{endTime,jdbcType=DATE}, + + + #{parkingNumber,jdbcType=VARCHAR}, + + + #{parkingInfos,jdbcType=VARCHAR}, + + + #{costPerDay,jdbcType=INTEGER}, + + + #{communityId,jdbcType=INTEGER}, + + + #{ownerId,jdbcType=INTEGER}, + + + #{type,jdbcType=INTEGER}, + + + #{status,jdbcType=INTEGER}, + + + + + update parking_info + + + begin_time = #{beginTime,jdbcType=DATE}, + + + end_time = #{endTime,jdbcType=DATE}, + + + parking_number = #{parkingNumber,jdbcType=VARCHAR}, + + + parking_infos = #{parkingInfos,jdbcType=VARCHAR}, + + + cost_per_day = #{costPerDay,jdbcType=INTEGER}, + + + community_id = #{communityId,jdbcType=INTEGER}, + + + owner_id = #{ownerId,jdbcType=INTEGER}, + + + type = #{type,jdbcType=INTEGER}, + + + status = #{status,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update parking_info + set begin_time = #{beginTime,jdbcType=DATE}, + end_time = #{endTime,jdbcType=DATE}, + parking_number = #{parkingNumber,jdbcType=VARCHAR}, + parking_infos = #{parkingInfos,jdbcType=VARCHAR}, + cost_per_day = #{costPerDay,jdbcType=INTEGER}, + community_id = #{communityId,jdbcType=INTEGER}, + owner_id = #{ownerId,jdbcType=INTEGER}, + type = #{type,jdbcType=INTEGER}, + status = #{status,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/parkservice/src/main/resources/mapper/ParkingRentRecordsMapper.xml b/parkservice/src/main/resources/mapper/ParkingRentRecordsMapper.xml new file mode 100644 index 0000000..5f442f5 --- /dev/null +++ b/parkservice/src/main/resources/mapper/ParkingRentRecordsMapper.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + id, carid, begin_time, end_time, parking_info_id, order_id, user_id, status + + + + delete from parking_rent_records + where id = #{id,jdbcType=INTEGER} + + + insert into parking_rent_records (id, carid, begin_time, + end_time, parking_info_id, order_id, + user_id) + values (#{id,jdbcType=INTEGER}, #{carid,jdbcType=VARCHAR}, #{beginTime,jdbcType=DATE}, + #{endTime,jdbcType=DATE}, #{parkingInfoId,jdbcType=INTEGER}, #{orderId,jdbcType=INTEGER}, + #{userId,jdbcType=INTEGER}) + + + insert into parking_rent_records + + + id, + + + carid, + + + begin_time, + + + end_time, + + + parking_info_id, + + + order_id, + + + user_id, + + + status, + + + + + #{id,jdbcType=INTEGER}, + + + #{carid,jdbcType=VARCHAR}, + + + #{beginTime,jdbcType=DATE}, + + + #{endTime,jdbcType=DATE}, + + + #{parkingInfoId,jdbcType=INTEGER}, + + + #{orderId,jdbcType=INTEGER}, + + + #{userId,jdbcType=INTEGER}, + + + #{status,jdbcType=INTEGER}, + + + + + update parking_rent_records + + + carid = #{carid,jdbcType=VARCHAR}, + + + begin_time = #{beginTime,jdbcType=DATE}, + + + end_time = #{endTime,jdbcType=DATE}, + + + parking_info_id = #{parkingInfoId,jdbcType=INTEGER}, + + + order_id = #{orderId,jdbcType=INTEGER}, + + + user_id = #{userId,jdbcType=INTEGER}, + + + where id = #{id,jdbcType=INTEGER} + + + update parking_rent_records + set carid = #{carid,jdbcType=VARCHAR}, + begin_time = #{beginTime,jdbcType=DATE}, + end_time = #{endTime,jdbcType=DATE}, + parking_info_id = #{parkingInfoId,jdbcType=INTEGER}, + order_id = #{orderId,jdbcType=INTEGER}, + user_id = #{userId,jdbcType=INTEGER} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/parkservice/src/main/resources/mapper/PersonUserMapper.xml b/parkservice/src/main/resources/mapper/PersonUserMapper.xml new file mode 100644 index 0000000..a12bb2a --- /dev/null +++ b/parkservice/src/main/resources/mapper/PersonUserMapper.xml @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + id, id_number, cell_ph_number, password, name, sex, nickname, mailbox, plot_id, tag, + mailbox_status, code, password_salt, create_time + + + + delete from person_user + where id = #{id,jdbcType=INTEGER} + + + insert into person_user (id, id_number, cell_ph_number, + password, name, sex, + nickname, mailbox, plot_id, + tag, mailbox_status, code, + password_salt, create_time) + values (#{id,jdbcType=INTEGER}, #{idNumber,jdbcType=CHAR}, #{cellPhNumber,jdbcType=CHAR}, + #{password,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, + #{nickname,jdbcType=VARCHAR}, #{mailbox,jdbcType=VARCHAR}, #{plotId,jdbcType=INTEGER}, + #{tag,jdbcType=VARCHAR}, #{mailboxStatus,jdbcType=INTEGER}, #{code,jdbcType=VARCHAR}, + #{passwordSalt,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}) + + + insert into person_user + + + id, + + + id_number, + + + cell_ph_number, + + + password, + + + name, + + + sex, + + + nickname, + + + mailbox, + + + plot_id, + + + tag, + + + mailbox_status, + + + code, + + + password_salt, + + + create_time, + + + + + #{id,jdbcType=INTEGER}, + + + #{idNumber,jdbcType=CHAR}, + + + #{cellPhNumber,jdbcType=CHAR}, + + + #{password,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{sex,jdbcType=INTEGER}, + + + #{nickname,jdbcType=VARCHAR}, + + + #{mailbox,jdbcType=VARCHAR}, + + + #{plotId,jdbcType=INTEGER}, + + + #{tag,jdbcType=VARCHAR}, + + + #{mailboxStatus,jdbcType=INTEGER}, + + + #{code,jdbcType=VARCHAR}, + + + #{passwordSalt,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + + + update person_user + + + id_number = #{idNumber,jdbcType=CHAR}, + + + cell_ph_number = #{cellPhNumber,jdbcType=CHAR}, + + + password = #{password,jdbcType=VARCHAR}, + + + name = #{name,jdbcType=VARCHAR}, + + + sex = #{sex,jdbcType=INTEGER}, + + + nickname = #{nickname,jdbcType=VARCHAR}, + + + mailbox = #{mailbox,jdbcType=VARCHAR}, + + + plot_id = #{plotId,jdbcType=INTEGER}, + + + tag = #{tag,jdbcType=VARCHAR}, + + + mailbox_status = #{mailboxStatus,jdbcType=INTEGER}, + + + code = #{code,jdbcType=VARCHAR}, + + + password_salt = #{passwordSalt,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + where id = #{id,jdbcType=INTEGER} + + + update person_user + set id_number = #{idNumber,jdbcType=CHAR}, + cell_ph_number = #{cellPhNumber,jdbcType=CHAR}, + password = #{password,jdbcType=VARCHAR}, + name = #{name,jdbcType=VARCHAR}, + sex = #{sex,jdbcType=INTEGER}, + nickname = #{nickname,jdbcType=VARCHAR}, + mailbox = #{mailbox,jdbcType=VARCHAR}, + plot_id = #{plotId,jdbcType=INTEGER}, + tag = #{tag,jdbcType=VARCHAR}, + mailbox_status = #{mailboxStatus,jdbcType=INTEGER}, + code = #{code,jdbcType=VARCHAR}, + password_salt = #{passwordSalt,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=INTEGER} + + \ No newline at end of file diff --git a/parkservice/src/test/java/com/team7/happycommunity/parkservice/ParkserviceApplicationTests.java b/parkservice/src/test/java/com/team7/happycommunity/parkservice/ParkserviceApplicationTests.java index 6ec5f36..24f5b11 100644 --- a/parkservice/src/test/java/com/team7/happycommunity/parkservice/ParkserviceApplicationTests.java +++ b/parkservice/src/test/java/com/team7/happycommunity/parkservice/ParkserviceApplicationTests.java @@ -1,13 +1,26 @@ package com.team7.happycommunity.parkservice; +import com.team7.happycommunity.parkservice.dao.ParkingRentRecordsMapper; +import com.team7.happycommunity.parkservice.service.ParkingRentRecordsService; import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import java.util.List; + @SpringBootTest class ParkserviceApplicationTests { + @Autowired + ParkingRentRecordsService parkingRentRecordsService; + + @Autowired + ParkingRentRecordsMapper parkingRentRecordsMapper; + @Test void contextLoads() { + List list = parkingRentRecordsMapper.selectByUserId(4); + System.out.println(list.toString()); } } diff --git a/propertydemo/src/test/java/com/woniu/propertydemo/PropertydemoApplicationTests.java b/propertydemo/src/test/java/com/woniu/propertydemo/PropertydemoApplicationTests.java index 358d6db..08dd37d 100644 --- a/propertydemo/src/test/java/com/woniu/propertydemo/PropertydemoApplicationTests.java +++ b/propertydemo/src/test/java/com/woniu/propertydemo/PropertydemoApplicationTests.java @@ -7,7 +7,7 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootTest @EnableEurekaClient //启动Eureka客户端 class PropertydemoApplicationTests { - + @Test void contextLoads() { } diff --git a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/dao/ParkingInfoMapper.java b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/dao/ParkingInfoMapper.java index 0cdbca7..c999e9d 100644 --- a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/dao/ParkingInfoMapper.java +++ b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/dao/ParkingInfoMapper.java @@ -19,7 +19,7 @@ public interface ParkingInfoMapper { int updateByPrimaryKey(ParkingInfo record); - @Select("select * from parking_info where community_id = #{areaid} and status = 0") + @Select("select parking_info.*,areainfo.area_name area_name from parking_info left join areainfo on areainfo.id = parking_info.community_id where parking_info.community_id = #{areaid} and parking_info.status = 0") List selectByPageAndareaId(@Param("currentPage")Integer currentPage, @Param("pageSize") Integer pageSize, @Param("areaid") Integer areaid); diff --git a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/OwnerParkingApply.java b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/OwnerParkingApply.java index 5f20d21..469c4f3 100644 --- a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/OwnerParkingApply.java +++ b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/OwnerParkingApply.java @@ -26,4 +26,6 @@ public class OwnerParkingApply implements Serializable { private String name; private String cellphone; + + private Integer costPerDay; } \ No newline at end of file diff --git a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/ParkingInfo.java b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/ParkingInfo.java index a6e8ccb..3f3aeff 100644 --- a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/ParkingInfo.java +++ b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/ParkingInfo.java @@ -22,8 +22,21 @@ public class ParkingInfo implements Serializable { private Integer communityId; private Integer ownerId; - + // 0 小区 1 业主委托 private Integer type; private Integer status; + + private String areaName; + + private String typeStr; + + public void setType(Integer type){ + this.type = type; + if (type == 0){ + typeStr = "小区车位"; + }else{ + typeStr = "业主车位"; + } + } } \ No newline at end of file diff --git a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/PpPayservice.java b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/PpPayservice.java index 85b0a44..152709f 100644 --- a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/PpPayservice.java +++ b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/pojo/PpPayservice.java @@ -27,4 +27,27 @@ public class PpPayservice implements Serializable { private Integer payway; private String servicecontext; + + // 衍生属性 支付方式 + private String paywayStr; + // 衍生属性 服务类型 + private String serviceTypeStr; + + public void setServiceType(Integer serviceType){ + this.serviceType = serviceType; + if(serviceType !=null && serviceType == 0){ + serviceTypeStr = "商家服务"; + }else{ + serviceTypeStr = "物业服务"; + } + } + + public void setPayway(Integer payway){ + this.payway = payway; + if(payway == 0){ + paywayStr = "线上"; + }else{ + paywayStr = "线下"; + } + } } \ No newline at end of file diff --git a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/service/impl/OwnerParkingApplyServiceImpl.java b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/service/impl/OwnerParkingApplyServiceImpl.java index 128c2b6..ef25754 100644 --- a/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/service/impl/OwnerParkingApplyServiceImpl.java +++ b/propertymanagement/src/main/java/com/team7/happycommunity/propertymanagement/service/impl/OwnerParkingApplyServiceImpl.java @@ -55,7 +55,7 @@ public class OwnerParkingApplyServiceImpl implements OwnerParkingApplyService { parkingInfo.setCommunityId(ownerParkingApplyold.getCommunityId()); parkingInfo.setBeginTime(ownerParkingApplyold.getBeginTime()); parkingInfo.setEndTime(ownerParkingApplyold.getEndTime()); - parkingInfo.setCostPerDay(10); + parkingInfo.setCostPerDay(ownerParkingApplyold.getCostPerDay()); parkingInfo.setParkingNumber(ownerParkingApplyold.getParkingCode()); parkingInfo.setParkingInfos(ownerParkingApplyold.getParkingInfo()); parkingInfoMapper.insertSelective(parkingInfo); diff --git a/propertymanagement/src/main/resources/mapper/OwnerParkingApplyMapper.xml b/propertymanagement/src/main/resources/mapper/OwnerParkingApplyMapper.xml index 9dc98c2..d6540bd 100644 --- a/propertymanagement/src/main/resources/mapper/OwnerParkingApplyMapper.xml +++ b/propertymanagement/src/main/resources/mapper/OwnerParkingApplyMapper.xml @@ -9,9 +9,10 @@ + - id, owner_id, parking_code, parking_info, begin_time, end_time, community_id + id, owner_id, parking_code, parking_info, begin_time, end_time, community_id, cost_per_day +SELECT community_dynamic_comment.id,cdc_content,cdc_time,`name`,url from community_dynamic_comment +LEFT JOIN person_user ON cdc_user_id=person_user.id LEFT JOIN person_image on person_user_id=person_user.id WHERE state=1 and cdc_dynamic_id=#{dynamicId} + \ No newline at end of file diff --git a/personcentor/src/main/resources/mapper/PersonUserDao.xml b/personcentor/src/main/resources/mapper/PersonUserDao.xml index 95fd1fb..d306ecf 100644 --- a/personcentor/src/main/resources/mapper/PersonUserDao.xml +++ b/personcentor/src/main/resources/mapper/PersonUserDao.xml @@ -187,23 +187,25 @@ UPDATE person_user set password=#{password} where name=#{name}
-- Gitee From c989c3d008a084869fb7328d1e8f0f3d996a3bb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=BD=B3=E4=BC=9F?= <1103390584@qq.com> Date: Tue, 7 Apr 2020 10:15:47 +0800 Subject: [PATCH 16/27] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/woniu/controller/PayOrderController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/propertydemo/src/main/java/com/woniu/controller/PayOrderController.java b/propertydemo/src/main/java/com/woniu/controller/PayOrderController.java index 1bce5d5..82969b6 100644 --- a/propertydemo/src/main/java/com/woniu/controller/PayOrderController.java +++ b/propertydemo/src/main/java/com/woniu/controller/PayOrderController.java @@ -71,7 +71,7 @@ public class PayOrderController { serviceOrder.setStarttime(start); serviceOrder.setEndtime(end); serviceOrder.setOrdernumber(ordernumber); - serviceOrder.setStatus(0); + serviceOrder.setStatus(6); serviceOrder.setOrdername(payname); serviceOrder.setOrdertype(0); try { -- Gitee From ffc306c53a5fe6b8306109aaf40b8c0998ca6a4e Mon Sep 17 00:00:00 2001 From: jingkang <1248303996@qq.com> Date: Tue, 7 Apr 2020 11:36:15 +0800 Subject: [PATCH 17/27] =?UTF-8?q?PC=E5=B9=B3=E5=8F=B0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pccenter/pom.xml | 13 +- .../java/com/woniu/PccenterApplication.java | 1 + .../java/com/woniu/config/ShiroConfig.java | 42 +-- .../java/com/woniu/config/WebMvcConfig.java | 9 +- .../ActivityComplainController.java | 97 +++++ .../woniu/controller/ActivityController.java | 101 ++++++ .../com/woniu/controller/AdminController.java | 18 +- .../woniu/controller/ComplainController.java | 101 ++++++ .../controller/DynamicCommentController.java | 69 ++++ .../com/woniu/controller/MenusController.java | 29 +- .../woniu/controller/MerchantController.java | 103 ++++++ .../controller/PropertyManageController.java | 108 ++++++ .../com/woniu/controller/RolesController.java | 6 + .../controller/ServiceCommentController.java | 83 +++++ .../com/woniu/dao/ActivityComplainMapper.java | 24 ++ .../java/com/woniu/dao/ActivityMapper.java | 24 ++ .../java/com/woniu/dao/ComplainMapper.java | 38 ++ .../com/woniu/dao/DynamicCommentMapper.java | 19 + .../java/com/woniu/dao/InformationMapper.java | 17 - .../main/java/com/woniu/dao/MenusMapper.java | 5 + .../java/com/woniu/dao/MerchantMapper.java | 24 ++ .../com/woniu/dao/PropertyManageMapper.java | 23 ++ .../main/java/com/woniu/dao/RolesMapper.java | 2 +- .../com/woniu/dao/ServiceCommentMapper.java | 20 ++ .../main/java/com/woniu/dao/UsersMapper.java | 17 - .../com/woniu/dto/ActivityComplainDTO.java | 89 +++++ .../main/java/com/woniu/dto/ActivityDTO.java | 96 +++++ .../main/java/com/woniu/dto/ComplainDTO.java | 89 +++++ .../java/com/woniu/dto/DynamicCommentDTO.java | 79 +++++ .../main/java/com/woniu/dto/MerchantDTO.java | 88 +++++ .../java/com/woniu/dto/ServiceCommentDTO.java | 70 ++++ .../exception/GlobalExceptionHandler.java | 60 ++++ .../com/woniu/exception/LoginException.java | 22 ++ .../main/java/com/woniu/pojo/Information.java | 93 ----- .../java/com/woniu/pojo/PropertyManage.java | 95 +++++ .../java/com/woniu/pojo/RolesMenusKey.java | 2 +- .../src/main/java/com/woniu/pojo/Users.java | 93 ----- .../java/com/woniu/realm/CustomRealm.java | 2 +- .../service/ActivityComplainService.java | 15 + .../com/woniu/service/ActivityService.java | 16 + .../com/woniu/service/ComplainService.java | 15 + .../woniu/service/DynamicCommentService.java | 13 + .../java/com/woniu/service/MenusService.java | 4 + .../com/woniu/service/MerchantService.java | 16 + .../woniu/service/ProperManageService.java | 17 + .../woniu/service/ServiceCommentService.java | 15 + .../impl/ActivityComplainServiceImpl.java | 41 +++ .../service/impl/ActivityServiceImpl.java | 40 +++ .../woniu/service/impl/AdminServiceImpl.java | 8 + .../service/impl/ComplainServiceImpl.java | 41 +++ .../impl/DynamicCommentServiceImpl.java | 32 ++ .../woniu/service/impl/MenusServiceImpl.java | 11 + .../service/impl/MerchantServiceImpl.java | 40 +++ .../impl/PropertyManageServiceImpl.java | 42 +++ .../impl/ServiceCommentServiceImpl.java | 32 ++ pccenter/src/main/resources/application.yml | 12 +- .../src/main/resources/generatorConfig.xml | 18 +- .../mapper/ActivityComplainMapper.xml | 17 + .../main/resources/mapper/ActivityMapper.xml | 18 + .../src/main/resources/mapper/AdminMapper.xml | 2 +- .../main/resources/mapper/ComplainMapper.xml | 20 ++ .../resources/mapper/DynamicCommentMapper.xml | 18 + .../resources/mapper/InformationMapper.xml | 141 -------- .../main/resources/mapper/MerchantMapper.xml | 19 + .../resources/mapper/PropertyManageMapper.xml | 22 ++ .../resources/mapper/ServiceCommentMapper.xml | 18 + .../src/main/resources/mapper/UsersMapper.xml | 141 -------- .../src/main/resources/templates/403.html | 152 ++++++++ .../src/main/resources/templates/login.html | 15 +- .../templates/sys/ac_complainList.html | 155 ++++++++ .../resources/templates/sys/ac_reply.html | 55 +++ .../resources/templates/sys/activityList.html | 196 +++++++++++ .../resources/templates/sys/addAdmin.html | 3 +- .../resources/templates/sys/adminList.html | 331 +++++++++--------- .../resources/templates/sys/complainList.html | 161 +++++++++ .../templates/sys/dynamic_commentList.html | 163 +++++++++ .../resources/templates/sys/editMenu.html | 99 ++++++ .../resources/templates/sys/editRole.html | 1 - .../main/resources/templates/sys/index.html | 8 +- .../resources/templates/sys/menuList.html | 42 ++- .../resources/templates/sys/merchantList.html | 187 ++++++++++ .../main/resources/templates/sys/pmList.html | 188 ++++++++++ .../main/resources/templates/sys/reply.html | 56 +++ .../resources/templates/sys/roleList.html | 25 +- .../templates/sys/service_commentList.html | 140 ++++++++ 85 files changed, 3922 insertions(+), 770 deletions(-) create mode 100644 pccenter/src/main/java/com/woniu/controller/ActivityComplainController.java create mode 100644 pccenter/src/main/java/com/woniu/controller/ActivityController.java create mode 100644 pccenter/src/main/java/com/woniu/controller/ComplainController.java create mode 100644 pccenter/src/main/java/com/woniu/controller/DynamicCommentController.java create mode 100644 pccenter/src/main/java/com/woniu/controller/MerchantController.java create mode 100644 pccenter/src/main/java/com/woniu/controller/PropertyManageController.java create mode 100644 pccenter/src/main/java/com/woniu/controller/ServiceCommentController.java create mode 100644 pccenter/src/main/java/com/woniu/dao/ActivityComplainMapper.java create mode 100644 pccenter/src/main/java/com/woniu/dao/ActivityMapper.java create mode 100644 pccenter/src/main/java/com/woniu/dao/ComplainMapper.java create mode 100644 pccenter/src/main/java/com/woniu/dao/DynamicCommentMapper.java delete mode 100644 pccenter/src/main/java/com/woniu/dao/InformationMapper.java create mode 100644 pccenter/src/main/java/com/woniu/dao/MerchantMapper.java create mode 100644 pccenter/src/main/java/com/woniu/dao/PropertyManageMapper.java create mode 100644 pccenter/src/main/java/com/woniu/dao/ServiceCommentMapper.java delete mode 100644 pccenter/src/main/java/com/woniu/dao/UsersMapper.java create mode 100644 pccenter/src/main/java/com/woniu/dto/ActivityComplainDTO.java create mode 100644 pccenter/src/main/java/com/woniu/dto/ActivityDTO.java create mode 100644 pccenter/src/main/java/com/woniu/dto/ComplainDTO.java create mode 100644 pccenter/src/main/java/com/woniu/dto/DynamicCommentDTO.java create mode 100644 pccenter/src/main/java/com/woniu/dto/MerchantDTO.java create mode 100644 pccenter/src/main/java/com/woniu/dto/ServiceCommentDTO.java create mode 100644 pccenter/src/main/java/com/woniu/exception/GlobalExceptionHandler.java create mode 100644 pccenter/src/main/java/com/woniu/exception/LoginException.java delete mode 100644 pccenter/src/main/java/com/woniu/pojo/Information.java create mode 100644 pccenter/src/main/java/com/woniu/pojo/PropertyManage.java delete mode 100644 pccenter/src/main/java/com/woniu/pojo/Users.java create mode 100644 pccenter/src/main/java/com/woniu/service/ActivityComplainService.java create mode 100644 pccenter/src/main/java/com/woniu/service/ActivityService.java create mode 100644 pccenter/src/main/java/com/woniu/service/ComplainService.java create mode 100644 pccenter/src/main/java/com/woniu/service/DynamicCommentService.java create mode 100644 pccenter/src/main/java/com/woniu/service/MerchantService.java create mode 100644 pccenter/src/main/java/com/woniu/service/ProperManageService.java create mode 100644 pccenter/src/main/java/com/woniu/service/ServiceCommentService.java create mode 100644 pccenter/src/main/java/com/woniu/service/impl/ActivityComplainServiceImpl.java create mode 100644 pccenter/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java create mode 100644 pccenter/src/main/java/com/woniu/service/impl/ComplainServiceImpl.java create mode 100644 pccenter/src/main/java/com/woniu/service/impl/DynamicCommentServiceImpl.java create mode 100644 pccenter/src/main/java/com/woniu/service/impl/MerchantServiceImpl.java create mode 100644 pccenter/src/main/java/com/woniu/service/impl/PropertyManageServiceImpl.java create mode 100644 pccenter/src/main/java/com/woniu/service/impl/ServiceCommentServiceImpl.java create mode 100644 pccenter/src/main/resources/mapper/ActivityComplainMapper.xml create mode 100644 pccenter/src/main/resources/mapper/ActivityMapper.xml create mode 100644 pccenter/src/main/resources/mapper/ComplainMapper.xml create mode 100644 pccenter/src/main/resources/mapper/DynamicCommentMapper.xml delete mode 100644 pccenter/src/main/resources/mapper/InformationMapper.xml create mode 100644 pccenter/src/main/resources/mapper/MerchantMapper.xml create mode 100644 pccenter/src/main/resources/mapper/PropertyManageMapper.xml create mode 100644 pccenter/src/main/resources/mapper/ServiceCommentMapper.xml delete mode 100644 pccenter/src/main/resources/mapper/UsersMapper.xml create mode 100644 pccenter/src/main/resources/templates/403.html create mode 100644 pccenter/src/main/resources/templates/sys/ac_complainList.html create mode 100644 pccenter/src/main/resources/templates/sys/ac_reply.html create mode 100644 pccenter/src/main/resources/templates/sys/activityList.html create mode 100644 pccenter/src/main/resources/templates/sys/complainList.html create mode 100644 pccenter/src/main/resources/templates/sys/dynamic_commentList.html create mode 100644 pccenter/src/main/resources/templates/sys/editMenu.html create mode 100644 pccenter/src/main/resources/templates/sys/merchantList.html create mode 100644 pccenter/src/main/resources/templates/sys/pmList.html create mode 100644 pccenter/src/main/resources/templates/sys/reply.html create mode 100644 pccenter/src/main/resources/templates/sys/service_commentList.html diff --git a/pccenter/pom.xml b/pccenter/pom.xml index ac5365a..c0d7080 100644 --- a/pccenter/pom.xml +++ b/pccenter/pom.xml @@ -9,9 +9,9 @@ com.woniu - rbacdemo + pccenter 0.0.1-SNAPSHOT - rbacdemo + pccenter Demo project for Spring Boot @@ -122,8 +122,15 @@ 1.5.21 + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + - + + org.springframework.cloud + spring-cloud-starter-netflix-zuul + diff --git a/pccenter/src/main/java/com/woniu/PccenterApplication.java b/pccenter/src/main/java/com/woniu/PccenterApplication.java index 8bf7ea7..56afdaf 100644 --- a/pccenter/src/main/java/com/woniu/PccenterApplication.java +++ b/pccenter/src/main/java/com/woniu/PccenterApplication.java @@ -3,6 +3,7 @@ package com.woniu; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cache.annotation.EnableCaching; @SpringBootApplication @MapperScan(value = "com.woniu.dao") diff --git a/pccenter/src/main/java/com/woniu/config/ShiroConfig.java b/pccenter/src/main/java/com/woniu/config/ShiroConfig.java index 30c1bd0..401acde 100644 --- a/pccenter/src/main/java/com/woniu/config/ShiroConfig.java +++ b/pccenter/src/main/java/com/woniu/config/ShiroConfig.java @@ -8,6 +8,7 @@ import org.apache.shiro.spring.web.ShiroFilterFactoryBean; import org.apache.shiro.web.mgt.CookieRememberMeManager; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import org.apache.shiro.web.servlet.SimpleCookie; +import org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -18,6 +19,7 @@ import java.util.Map; @Configuration public class ShiroConfig { + //自定义域 @Bean public CustomRealm customRealm(HashedCredentialsMatcher credentialsMatcher,MemoryConstrainedCacheManager cacheManager){ CustomRealm customRealm = new CustomRealm(); @@ -25,7 +27,7 @@ public class ShiroConfig { customRealm.setCacheManager(cacheManager); return customRealm; } - + // @Bean public DefaultWebSecurityManager securityManager(CustomRealm customRealm,CookieRememberMeManager rememberMeManager){ DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); @@ -33,7 +35,7 @@ public class ShiroConfig { securityManager.setRememberMeManager(rememberMeManager); return securityManager; } - + //过滤器 @Bean public ShiroFilterFactoryBean shiroFilterFactoryBean(DefaultWebSecurityManager securityManager){ ShiroFilterFactoryBean filterFactoryBean = new ShiroFilterFactoryBean(); @@ -44,11 +46,12 @@ public class ShiroConfig { map.put("/login","anon");//访问登录 map.put("/admin/subLogin","anon"); map.put("/src/**","anon"); + map.put("/logout","logout"); map.put("/**","authc"); filterFactoryBean.setFilterChainDefinitionMap(map); return filterFactoryBean; } - + // 盐值加密 @Bean public HashedCredentialsMatcher credentialsMatcher(){ HashedCredentialsMatcher credentialsMatcher = new HashedCredentialsMatcher(); @@ -56,17 +59,19 @@ public class ShiroConfig { credentialsMatcher.setHashIterations(1024); return credentialsMatcher; } - + //缓存管理 @Bean public MemoryConstrainedCacheManager cacheManager(){ return new MemoryConstrainedCacheManager(); } - @Bean //thymeleaf整合shiro;支持 shiro标签 + //thymeleaf整合shiro;支持 shiro标签 + @Bean public ShiroDialect shiroDialect(){ return new ShiroDialect(); } + //记住我管理器 @Bean public CookieRememberMeManager rememberMeManager(SimpleCookie cookie){ CookieRememberMeManager rememberMeManager = new CookieRememberMeManager(); @@ -74,6 +79,7 @@ public class ShiroConfig { return rememberMeManager; } + //cookie设置 @Bean public SimpleCookie simpleCookie(){ SimpleCookie cookie = new SimpleCookie(); @@ -82,25 +88,13 @@ public class ShiroConfig { return cookie; } - - - - - - - - - - - - - - - - - - - + //解决shiro 整合 spring aop 的时候,访问资源404的问题 + @Bean + public DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator(){ + DefaultAdvisorAutoProxyCreator defaultAdvisorAutoProxyCreator = new DefaultAdvisorAutoProxyCreator(); + defaultAdvisorAutoProxyCreator.setUsePrefix(true); + return defaultAdvisorAutoProxyCreator; + } } diff --git a/pccenter/src/main/java/com/woniu/config/WebMvcConfig.java b/pccenter/src/main/java/com/woniu/config/WebMvcConfig.java index 8411616..6dd5d19 100644 --- a/pccenter/src/main/java/com/woniu/config/WebMvcConfig.java +++ b/pccenter/src/main/java/com/woniu/config/WebMvcConfig.java @@ -16,6 +16,13 @@ public class WebMvcConfig implements WebMvcConfigurer { registry.addViewController("sys/roleList").setViewName("/sys/roleList"); registry.addViewController("sys/addRole").setViewName("/sys/addRole"); registry.addViewController("sys/menuList").setViewName("/sys/menuList"); - registry.addViewController("sys/editMenu").setViewName("/sys/editList"); + registry.addViewController("sys/pmList").setViewName("/sys/pmList"); + registry.addViewController("sys/complainList").setViewName("/sys/complainList"); + registry.addViewController("sys/merchantList").setViewName("/sys/merchantList"); + registry.addViewController("sys/activityList").setViewName("/sys/activityList"); + registry.addViewController("sys/ac_complainList").setViewName("/sys/ac_complainList"); + registry.addViewController("sys/service_commentList").setViewName("/sys/service_commentList"); + registry.addViewController("sys/dynamic_commentList").setViewName("/sys/dynamic_commentList"); + registry.addViewController("403").setViewName("/403"); } } diff --git a/pccenter/src/main/java/com/woniu/controller/ActivityComplainController.java b/pccenter/src/main/java/com/woniu/controller/ActivityComplainController.java new file mode 100644 index 0000000..f0a5a5f --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/ActivityComplainController.java @@ -0,0 +1,97 @@ +package com.woniu.controller; + +import com.github.pagehelper.PageInfo; +import com.woniu.common.CommonResult; +import com.woniu.dto.ActivityComplainDTO; +import com.woniu.service.ActivityComplainService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import java.util.List; + +@Controller +@RequestMapping("/ac_complain") +public class ActivityComplainController { + + @Autowired + private ActivityComplainService acComplainService; + + /** + * 分页查询活动投诉的列表信息 + * @param currentPage + * @param pageSize + * @return + */ + @RequestMapping("list") + @ResponseBody + @RequiresPermissions("sys:acc:list") + public CommonResult list(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, + @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ + PageInfo info=null; + try { + List list=acComplainService.findByPage(currentPage,pageSize); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } + /** + * 导航到回复投诉的页面 + * @param id + * @return + */ + @RequestMapping("/reply/{id}") + @ResponseBody + @RequiresPermissions("sys:acc:reply") + public ModelAndView reply(@PathVariable("id")Integer id){ + ActivityComplainDTO activityComplainDTO=acComplainService.findById(id); + ModelAndView model=new ModelAndView("sys/ac_reply"); + model.addObject("ActivityComplainDTO",activityComplainDTO); + return model; + } + + /** + * 投诉回复内容的添加 + * @param activityComplainDTO + * @return + */ + @PutMapping("/editComplain") + @ResponseBody + public CommonResult addReply(ActivityComplainDTO activityComplainDTO){ + try { + acComplainService.addReply(activityComplainDTO); + return CommonResult.success("回复上传成功!"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("回复上传失败!"); + } + + } + + /** + * 搜索功能 + * @param nickName + * @param title + * @return + */ + @RequestMapping("/select") + @ResponseBody + public CommonResult select(String nickName,String title){ + PageInfo info=null; + try { + List list=acComplainService.select(nickName,title); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + + } + +} diff --git a/pccenter/src/main/java/com/woniu/controller/ActivityController.java b/pccenter/src/main/java/com/woniu/controller/ActivityController.java new file mode 100644 index 0000000..b55dc5d --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/ActivityController.java @@ -0,0 +1,101 @@ +package com.woniu.controller; + +import com.github.pagehelper.PageInfo; +import com.woniu.common.CommonResult; +import com.woniu.dto.ActivityDTO; +import com.woniu.service.ActivityService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.Date; +import java.util.List; +@Controller +@RequestMapping("/activity") +public class ActivityController { + + @Autowired + private ActivityService activityService; + + /** + * 分页查询活动审批数据 + * @param currentPage + * @param pageSize + * @return + */ + @RequestMapping("/list") + @ResponseBody + @RequiresPermissions("sys:al:list") + public CommonResult pmList(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, + @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ + PageInfo info = null; + try { + List list=activityService.findListByPage(currentPage,pageSize); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + + } + + /** + * 修改审批状态 + * @param id + * @return + */ + @PutMapping("/confirm/{id}") + @ResponseBody + @RequiresPermissions("sys:al:examine") + public CommonResult confirmPM(@PathVariable("id") Integer id){ + Date examineTime=new Date(); + try { + activityService.editStatusById(id,examineTime); + } catch (Exception e) { + e.printStackTrace(); + CommonResult.failed("审批失败"); + } + return CommonResult.success("审批成功"); + } + + /** + * 页面查询功能 + * @param name + * @param status + * @return + */ + @RequestMapping("/select") + @ResponseBody + public CommonResult select(String name,Integer status){ + PageInfo info=null; + try { + List list=activityService.select(name,status); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } + + /** + * 拒绝审批操作 + * @param id + * @return + */ + @RequestMapping("/refuse/{id}") + @ResponseBody + public CommonResult refuse(@PathVariable("id")Integer id){ + //获取当前时间 + Date operationTime=new Date(); + try { + activityService.refuse(id,operationTime); + return CommonResult.success("操作成功!"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("操作失败!"); + } + } +} diff --git a/pccenter/src/main/java/com/woniu/controller/AdminController.java b/pccenter/src/main/java/com/woniu/controller/AdminController.java index fe47338..e1c98c4 100644 --- a/pccenter/src/main/java/com/woniu/controller/AdminController.java +++ b/pccenter/src/main/java/com/woniu/controller/AdminController.java @@ -14,6 +14,7 @@ import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.IncorrectCredentialsException; import org.apache.shiro.authc.UnknownAccountException; import org.apache.shiro.authc.UsernamePasswordToken; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.subject.Subject; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -26,7 +27,6 @@ import java.util.Arrays; import java.util.List; - @Controller @RequestMapping("/admin") public class AdminController { @@ -46,6 +46,7 @@ public class AdminController { */ @RequestMapping("/list") @ResponseBody + @RequiresPermissions("sys:admin:list") public CommonResult list(@RequestParam(value = "page", defaultValue = "1", required = false) Integer currentPage, @RequestParam(value = "limit", defaultValue = "10", required = false) Integer pageSize) { PageInfo info = null; @@ -84,6 +85,7 @@ public class AdminController { */ @PostMapping("/saveAdmin") @ResponseBody + @RequiresPermissions("sys:admin:save") public CommonResult saveAdmin(Admin admin) { //验证用户名是否重复 @@ -108,8 +110,8 @@ public class AdminController { */ @DeleteMapping("/delAdmin/{keys}") @ResponseBody + @RequiresPermissions("sys:admin:delete") public CommonResult delAdmin(@PathVariable("keys") String keys) { - //List list = Arrays.stream(keys.split(",")).map(s->Long.parseLong(s)).collect(Collectors.toList()); List keysStringList = Arrays.asList(keys.split(",")); List list = new ArrayList<>(); CollectionUtils.collect(keysStringList, new Transformer() { @@ -150,6 +152,7 @@ public class AdminController { */ @PutMapping("/updateAdmin") @ResponseBody + @RequiresPermissions("sys:admin:update") public CommonResult updateAdmin(Admin admin) { Admin dbAdmin = adminService.checkName(admin); if (dbAdmin != null) { @@ -173,6 +176,7 @@ public class AdminController { */ @DeleteMapping("/deleteAdmin/{id}") @ResponseBody + @RequiresPermissions("sys:admin:delete") public CommonResult deleteAdmin(@PathVariable("id") Integer id) { try { adminService.deleteById(id); @@ -184,10 +188,17 @@ public class AdminController { } - //平台管理员登录 + /** + * 登录的验证 + * @param admin + * @return + */ + @PostMapping("/subLogin") @ResponseBody public CommonResult subLogin(Admin admin) { + System.out.println("传入的账号:"+admin.getUsername()); + System.out.println("传入的密码:"+admin.getPassword()); if (StringUtils.isEmpty(admin.getUsername())) { return CommonResult.failed("用户名不能为空"); } @@ -209,7 +220,6 @@ public class AdminController { return CommonResult.failed("认证失败"); } return CommonResult.success("登录成功"); - } diff --git a/pccenter/src/main/java/com/woniu/controller/ComplainController.java b/pccenter/src/main/java/com/woniu/controller/ComplainController.java new file mode 100644 index 0000000..78d932a --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/ComplainController.java @@ -0,0 +1,101 @@ +package com.woniu.controller; + +import com.github.pagehelper.PageInfo; +import com.woniu.common.CommonResult; +import com.woniu.dto.ComplainDTO; +import com.woniu.service.ComplainService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import java.util.List; + +@Controller +@RequestMapping("/complain") +public class ComplainController { + + @Autowired + private ComplainService complainService; + + /** + * 分页查询投诉订单列表 + * @param currentPage + * @param pageSize + * @return + */ + @RequestMapping("/list") + @ResponseBody + @RequiresPermissions("sys:pmc:list") + public CommonResult list(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, + @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ + PageInfo info=null; + try { + List list=complainService.findByPage(currentPage,pageSize); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } + + /** + * 导航到回复投诉的页面 + * @param id + * @return + */ + @RequestMapping("/reply/{id}") + @ResponseBody + public ModelAndView reply(@PathVariable("id")Integer id){ + System.out.println("传入的id值为:"+id); + ComplainDTO complainDTO=complainService.findById(id); + ModelAndView model=new ModelAndView("sys/reply"); + model.addObject("complainDTO",complainDTO); + return model; + } + + /** + * 投诉回复内容的添加 + * @param complainDTO + * @return + */ + @PutMapping("/editComplain") + @ResponseBody + @RequiresPermissions("sys:pmc:reply") + public CommonResult addReply(ComplainDTO complainDTO){ + System.out.println("回复投诉传入的id值:"+complainDTO.getId()); + System.out.println("回复的内容:"+complainDTO.getContext()); + try{ + complainService.addReply(complainDTO); + return CommonResult.success("回复上传成功"); + }catch (Exception e){ + e.printStackTrace(); + return CommonResult.failed("回复上传失败"); + } + + } + + /** + * 页面的查询功能 + * @param userName + * @param status + * @return + */ + @RequestMapping("/select") + @ResponseBody + public CommonResult select(String userName,Integer status){ + System.out.println("传入的userName:"+userName); + System.out.println("传入的Status:"+status); + PageInfo info=null; + try { + List list=complainService.select(userName,status); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } +} diff --git a/pccenter/src/main/java/com/woniu/controller/DynamicCommentController.java b/pccenter/src/main/java/com/woniu/controller/DynamicCommentController.java new file mode 100644 index 0000000..10dda96 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/DynamicCommentController.java @@ -0,0 +1,69 @@ +package com.woniu.controller; + +import com.github.pagehelper.PageInfo; +import com.woniu.common.CommonResult; +import com.woniu.dto.DynamicCommentDTO; +import com.woniu.service.DynamicCommentService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Controller +@RequestMapping("/dynamic_comment") +public class DynamicCommentController { + @Autowired + private DynamicCommentService dc_Service; + + @RequestMapping("/list") + @ResponseBody + @RequiresPermissions("sys:dc:list") + public CommonResult list(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, + @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ + PageInfo info=null; + try { + List list=dc_Service.findByPage(currentPage,pageSize); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } + + /** + * 删除评论 + * @param id + * @return + */ + @DeleteMapping("/delComment/{id}") + @ResponseBody + @RequiresPermissions("sys:dc:update") + public CommonResult delComment(@PathVariable("id")Integer id){ + try { + dc_Service.delComment(id); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("删除失败"); + } + return CommonResult.success("删除成功!"); + } + + @RequestMapping("/select") + @ResponseBody + public CommonResult select(String nickName,Integer dynamicType){ + System.out.println("nickName:"+nickName); + System.out.println("dynamicType:"+dynamicType); + PageInfo info=null; + try { + List list=dc_Service.select(nickName,dynamicType); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } +} diff --git a/pccenter/src/main/java/com/woniu/controller/MenusController.java b/pccenter/src/main/java/com/woniu/controller/MenusController.java index cf731af..26a38be 100644 --- a/pccenter/src/main/java/com/woniu/controller/MenusController.java +++ b/pccenter/src/main/java/com/woniu/controller/MenusController.java @@ -9,6 +9,7 @@ import com.woniu.pojo.Admin; import com.woniu.pojo.Menus; import com.woniu.service.MenusService; import org.apache.shiro.SecurityUtils; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -34,8 +35,6 @@ public class MenusController { public List getMenus(){ //根据当前登录用户的角色来获取该用户能够访问哪些资源 Admin admin = (Admin) SecurityUtils.getSubject().getPrincipal(); - System.out.println(admin.getRoleId()); - System.out.println(admin.getUsername()); List list = menusService.findMenusByRoles(admin.getRoleId()); return list; } @@ -83,8 +82,8 @@ public class MenusController { */ @GetMapping("/loadMenus") @ResponseBody + @RequiresPermissions("sys:menu:list") public Map loadMenus(){ - //code =0 msg count data List menus = menusService.findAll(); Map result = new HashMap(); result.put("code","0"); @@ -112,6 +111,7 @@ public class MenusController { */ @PostMapping("/saveMenu") @ResponseBody + @RequiresPermissions("sys:menu:save") public CommonResult saveMenu(Menus menus){ //验证同级目录下的菜单节点名称不能重复 if(menusService.checkMenuName(menus)){ @@ -133,6 +133,7 @@ public class MenusController { */ @DeleteMapping("/del/{id}") @ResponseBody + @RequiresPermissions("sys:menu:delete") public CommonResult del(@PathVariable("id") Integer mid){ try { menusService.delMenus(mid); @@ -152,20 +153,30 @@ public class MenusController { * @param menuId * @return */ - @RequestMapping("/updateMenu/{menuId}") + @RequestMapping("/editMenu/{menuId}") public String updateMenu(Model model,@PathVariable("menuId") Integer menuId){ - model.addAttribute("menuId",menuId);//修改菜单的id值 - return "/sys/editMenu"; + //查询该menuId下的数据 + Menus menus=menusService.findByMenuId(menuId); + model.addAttribute("menus",menus);//查询到的menu表数据存入model + return "sys/editMenu"; } /** * 菜单编辑 * @return */ - @PutMapping("/updateMenus") + @PutMapping("/editMenu") @ResponseBody - public CommonResult updateMenus(){ - return null; + @RequiresPermissions("sys:menu:update") + public CommonResult updateMenus(Menus menus){ + try { + menusService.updateMenus(menus); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("更新失败"); + } + return CommonResult.success("更新成功"); + } /** diff --git a/pccenter/src/main/java/com/woniu/controller/MerchantController.java b/pccenter/src/main/java/com/woniu/controller/MerchantController.java new file mode 100644 index 0000000..f591193 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/MerchantController.java @@ -0,0 +1,103 @@ +package com.woniu.controller; + +import com.github.pagehelper.PageInfo; +import com.woniu.common.CommonResult; +import com.woniu.dto.MerchantDTO; +import com.woniu.service.MerchantService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + + +import java.util.Date; +import java.util.List; + +@Controller +@RequestMapping("/merchant") +public class MerchantController { + + @Autowired + private MerchantService merchantService; + + /** + * 分页查询商家列表 + * @param currentPage + * @param pageSize + * @return + */ + @RequestMapping("/list") + @ResponseBody + @RequiresPermissions("sys:ml:list") + public CommonResult list(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, + @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ + PageInfo info=null; + try { + List list=merchantService.findByPage(currentPage,pageSize); + System.out.println("查询到的列表数据条数:"+list.size()); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } + + /** + * 修改商家审核状态 + * @param id + * @return + */ + @PutMapping("/confirm/{id}") + @ResponseBody + @RequiresPermissions("sys:ml:examine") + private CommonResult confirmPM(@PathVariable("id") Integer id){ + //获取当前操作的时间 + Date examineTime=new Date(); + try { + merchantService.editStatusById(id,examineTime); + } catch (Exception e) { + e.printStackTrace(); + CommonResult.failed("审批失败"); + } + return CommonResult.success("审批成功"); + } + + /** + * 页面搜索功能 + * @param nickName + * @param status + * @return + */ + @RequestMapping("/select") + @ResponseBody + public CommonResult select(String nickName,Integer status){ + PageInfo info=null; + try { + List list= merchantService.select(nickName,status); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } + + /** + * 拒绝审批操作 + * @param id + * @return + */ + @RequestMapping("/refuse/{id}") + @ResponseBody + public CommonResult refuse(@PathVariable("id")Integer id){ + Date refuseTime=new Date(); + try { + merchantService.refuse(id,refuseTime); + return CommonResult.success("操作成功!"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("操作失败!"); + } + } +} diff --git a/pccenter/src/main/java/com/woniu/controller/PropertyManageController.java b/pccenter/src/main/java/com/woniu/controller/PropertyManageController.java new file mode 100644 index 0000000..9ea489a --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/PropertyManageController.java @@ -0,0 +1,108 @@ +package com.woniu.controller; + +import com.github.pagehelper.PageInfo; +import com.woniu.common.CommonResult; +import com.woniu.dto.MerchantDTO; +import com.woniu.pojo.PropertyManage; +import com.woniu.service.ProperManageService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +@Controller +@RequestMapping("/pm") +public class PropertyManageController { + + @Autowired + private ProperManageService pmService; + + /** + * 分页查询物业管理列表 + * @param currentPage + * @param pageSize + * @return + */ + @RequestMapping("/list") + @ResponseBody + @RequiresPermissions("sys:pm:list") + public CommonResult pmList(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, + @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ + PageInfo info = null; + try { + List list=pmService.findListByPage(currentPage,pageSize); + System.out.println("查询到的列表数据条数:"+list.size()); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + + } + + /** + * 审批操作 + * @param id + * @return + */ + @PutMapping("/confirm/{id}") + @ResponseBody + @RequiresPermissions("sys:pm:examine") + public CommonResult confirmPM(@PathVariable("id") Integer id){ + //获取当前时间 + Date passTime=new Date(); + try { + pmService.editStatusById(id,passTime); + } catch (Exception e) { + e.printStackTrace(); + CommonResult.failed("审批失败"); + } + return CommonResult.success("审批成功"); + } + + /** + * 页面搜索功能 + * @param userName + * @param status + * @return + */ + @RequestMapping("/select") + @ResponseBody + public CommonResult select(String userName,Integer status){ + PageInfo info=null; + try { + List list=pmService.findList(userName,status); + System.out.println("查询到的列表数据条数:"+list.size()); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("查询失败"); + } + } + + /** + * 拒绝审批操作 + * @param id + * @return + */ + @PutMapping("/refuse/{id}") + @ResponseBody + public CommonResult refuse(@PathVariable("id")Integer id){ + //获取当前时间 + Date refuseTime=new Date(); + try { + pmService.refuse(id,refuseTime); + return CommonResult.success("执行成功!"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("执行失败!"); + } + } + +} diff --git a/pccenter/src/main/java/com/woniu/controller/RolesController.java b/pccenter/src/main/java/com/woniu/controller/RolesController.java index 568d8c1..b0089c7 100644 --- a/pccenter/src/main/java/com/woniu/controller/RolesController.java +++ b/pccenter/src/main/java/com/woniu/controller/RolesController.java @@ -7,6 +7,7 @@ import com.woniu.pojo.Roles; import com.woniu.service.RolesService; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.Transformer; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @@ -26,6 +27,7 @@ public class RolesController { @RequestMapping("/list") @ResponseBody + @RequiresPermissions("sys:role:list") public CommonResult list(@RequestParam(value="page",defaultValue = "1",required = false)Integer currentPage, @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ List roles = rolesService.findByPage(currentPage,pageSize); @@ -42,6 +44,7 @@ public class RolesController { */ @PostMapping("/saveRole") @ResponseBody + @RequiresPermissions("sys:role:save") public CommonResult saveRole(Roles roles,String menuId){ //检查角色的名称不能重复 Roles result = rolesService.findByRoleName(roles.getRoleName()); @@ -87,6 +90,7 @@ public class RolesController { */ @PutMapping("/updateRole") @ResponseBody + @RequiresPermissions("sys:role:update") public CommonResult updateRole(Roles roles,String menuId){ //检查更新的角色名称是否已经存 @@ -119,6 +123,7 @@ public class RolesController { */ @DeleteMapping("/del/{id}") @ResponseBody + @RequiresPermissions("sys:role:delete") public CommonResult del(@PathVariable("id")Integer roleId){ try { rolesService.delRole(roleId); @@ -139,6 +144,7 @@ public class RolesController { */ @DeleteMapping("/batchDel/{keys}") @ResponseBody + @RequiresPermissions("sys:role:delete") public CommonResult batchDel(@PathVariable("keys")String keys){ //List rolesId =Arrays.stream(keys.split(",")).map(s->Long.parseLong(s)).collect(Collectors.toList()); List keysStringList = Arrays.asList(keys.split(",")); diff --git a/pccenter/src/main/java/com/woniu/controller/ServiceCommentController.java b/pccenter/src/main/java/com/woniu/controller/ServiceCommentController.java new file mode 100644 index 0000000..241e081 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/ServiceCommentController.java @@ -0,0 +1,83 @@ +package com.woniu.controller; + +import com.github.pagehelper.PageInfo; +import com.woniu.common.CommonResult; +import com.woniu.dto.ServiceCommentDTO; +import com.woniu.service.ServiceCommentService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +@Controller +@RequestMapping("/service_comment") +@RequiresPermissions("sys:sc:list") +public class ServiceCommentController { + + @Autowired + private ServiceCommentService scService; + + /** + * 分页查询服务评论列表数据 + * @param currentPage + * @param pageSize + * @return + */ + @RequestMapping("/list") + @ResponseBody + public CommonResult list(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, + @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ + PageInfo info=null; + try { + List list=scService.findByPage(currentPage,pageSize); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } + + /** + * 删除评论 + * @param id + * @return + */ + @DeleteMapping("/delComment/{id}") + @ResponseBody + @RequiresPermissions("sys:sc:delete") + public CommonResult delComment(@PathVariable("id")Integer id){ + try { + scService.delComment(id); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("删除失败!"); + } + return CommonResult.success("删除成功!"); + } + + /** + * 查询功能 + * @param nickName + * @param payName + * @return + */ + @RequestMapping("/select") + @ResponseBody + public CommonResult select(String nickName,String payName){ + System.out.println("nickName:"+nickName); + System.out.println("payName:"+payName); + PageInfo info=null; + try { + List list=scService.select(nickName,payName); + System.out.println("controller中list的条数:"+list.size()); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } +} diff --git a/pccenter/src/main/java/com/woniu/dao/ActivityComplainMapper.java b/pccenter/src/main/java/com/woniu/dao/ActivityComplainMapper.java new file mode 100644 index 0000000..f219e32 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dao/ActivityComplainMapper.java @@ -0,0 +1,24 @@ +package com.woniu.dao; + +import com.woniu.dto.ActivityComplainDTO; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; + +import java.util.Date; +import java.util.List; + +public interface ActivityComplainMapper { + + @Select("select cac.id,pu.nickname nickName,pu.sex,pu.mailbox mailBox,ca.ca_title title,ca.ca_create_time createTime,cac.cac_reason reason,cac.cac_examine_status `status`,cac.cac_reply context " + + "from person_user pu INNER JOIN community_activity_complaint cac ON pu.id=cac.cac_user_id INNER JOIN community_activity ca ON ca.id=cac.cac_activity_id order by cac.id desc ") + List findByPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize); + + @Select("select cac.id,cac.cac_reason reason,cac.cac_examine_status `status` from community_activity_complaint cac where id=#{value}") + ActivityComplainDTO findById(Integer id); + + @Update("update community_activity_complaint set cac_reply=#{context},cac_examine_status = 1,cac_replyTime = #{replyTime} where id=#{id}") + void addReply(@Param("id") Integer id, @Param("context") String context, @Param("replyTime") Date replyTime); + + List select(@Param("nickName") String nickName,@Param("title") String title); +} diff --git a/pccenter/src/main/java/com/woniu/dao/ActivityMapper.java b/pccenter/src/main/java/com/woniu/dao/ActivityMapper.java new file mode 100644 index 0000000..32b13b7 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dao/ActivityMapper.java @@ -0,0 +1,24 @@ +package com.woniu.dao; + +import com.woniu.dto.ActivityDTO; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; + +import java.util.Date; +import java.util.List; + +public interface ActivityMapper { + + @Select("select ca.id,ca.ca_type type,ca.ca_examineTime operationTime,ca.ca_title title,ca.ca_content content,ca.ca_money money,ca.ca_peopel_count number,ca.ca_create_time createTime,ca.ca_examine_status status,pu.nickname name from " + + "person_user pu inner join community_activity ca on pu.id=ca.ca_user_id order by ca.id desc") + List findByPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize); + + @Update("update community_activity set ca_examine_status = 1,ca_examineTime = #{operationTime} where id=#{value}") + void editStatusById(@Param("id") Integer id,@Param("examineTime") Date examineTime); + + List select(@Param("name") String name, @Param("status") Integer status); + + @Update("update community_activity set ca_examine_status = 2,ca_examineTime = #{operationTime} where id=#{value}") + void refuse(@Param("id") Integer id, @Param("operationTime") Date operationTime); +} diff --git a/pccenter/src/main/java/com/woniu/dao/ComplainMapper.java b/pccenter/src/main/java/com/woniu/dao/ComplainMapper.java new file mode 100644 index 0000000..dfbc6ab --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dao/ComplainMapper.java @@ -0,0 +1,38 @@ +package com.woniu.dao; + +import com.woniu.dto.ComplainDTO; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; + +import java.util.List; + +public interface ComplainMapper { + + @Select("SELECT ss.id,ss.statecontext reason,ss.`status`,ss.reply_context context,so.starttime startTime,so.id orderId,\n" + + "pu.nickname nickName,pu.mailbox mailBox,pu.sex FROM state_service ss LEFT JOIN service_order so ON ss.serviceid=so.id\n" + + "INNER JOIN person_user pu ON pu.id=so.userid order by ss.id desc") + List findByPage(@Param("currentPage")Integer currentPage,@Param("pageSize")Integer pageSize); + + @Update("update state_service set status=1,reply_context=#{context} where id=#{id}") + void addReply(@Param("id") Integer id, @Param("context") String context); + + @Select("select * from state_service where id=#{value}") + ComplainDTO findById(Integer id); + + /*@Select("")*/ + List select(@Param("userName") String userName,@Param("status") Integer status); +} diff --git a/pccenter/src/main/java/com/woniu/dao/DynamicCommentMapper.java b/pccenter/src/main/java/com/woniu/dao/DynamicCommentMapper.java new file mode 100644 index 0000000..e8ac1e6 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dao/DynamicCommentMapper.java @@ -0,0 +1,19 @@ +package com.woniu.dao; + +import com.woniu.dto.DynamicCommentDTO; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; + +public interface DynamicCommentMapper { + + @Select("select pu.nickname nickName,cdc.id,cd.cd_type dynamicType,cd.cd_favor favor,cd.cd_content dynamicContent,cd.cd_time issueTime,cdc.cdc_content `comment`,cdc.cdc_time commentTime from person_user pu INNER JOIN community_dynamic_comment cdc ON pu.id = cdc.cdc_user_id INNER JOIN community_dynamic cd ON cdc.cdc_dynamic_id=cd.id order by cdc.id desc") + List findByPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize); + + @Delete("delete from community_dynamic_comment where id = #{value}") + void delComment(Integer id); + + List select(@Param("nickName") String nickName,@Param("dynamicType") Integer dynamicType); +} diff --git a/pccenter/src/main/java/com/woniu/dao/InformationMapper.java b/pccenter/src/main/java/com/woniu/dao/InformationMapper.java deleted file mode 100644 index 41e2c3d..0000000 --- a/pccenter/src/main/java/com/woniu/dao/InformationMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.woniu.dao; - -import com.woniu.pojo.Information; - -public interface InformationMapper { - int deleteByPrimaryKey(Integer id); - - int insert(Information record); - - int insertSelective(Information record); - - Information selectByPrimaryKey(Integer id); - - int updateByPrimaryKeySelective(Information record); - - int updateByPrimaryKey(Information record); -} \ No newline at end of file diff --git a/pccenter/src/main/java/com/woniu/dao/MenusMapper.java b/pccenter/src/main/java/com/woniu/dao/MenusMapper.java index e678973..285e485 100644 --- a/pccenter/src/main/java/com/woniu/dao/MenusMapper.java +++ b/pccenter/src/main/java/com/woniu/dao/MenusMapper.java @@ -19,6 +19,7 @@ public interface MenusMapper { int updateByPrimaryKeySelective(Menus record); int updateByPrimaryKey(Menus record); + @Select("select perms from pc_menus m left join pc_roles_menus rm on m.menu_id = rm.menu_id left join " + "pc_roles r on rm.role_id = r.role_id where r.role_id = #{value}") List findPermsByRoles(Integer roleId); @@ -38,4 +39,8 @@ public interface MenusMapper { @Update("update pc_menus set sorting = #{sorting} where menu_id = #{menuId}") void updateSorting(@Param("menuId") Integer menuId, @Param("sorting") Integer sorting); + + @Select("select * from pc_menus where menu_id=#{value}") + Menus findByMenuId(Integer menuId); + } \ No newline at end of file diff --git a/pccenter/src/main/java/com/woniu/dao/MerchantMapper.java b/pccenter/src/main/java/com/woniu/dao/MerchantMapper.java new file mode 100644 index 0000000..1ff3888 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dao/MerchantMapper.java @@ -0,0 +1,24 @@ +package com.woniu.dao; + +import com.woniu.dto.MerchantDTO; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.annotations.Update; + +import java.util.Date; +import java.util.List; + +public interface MerchantMapper { + + @Select("select ai.area_name areaName,bi.id,bi.nickname nickName,bi.operationTime operationTime,bi.mailbox mailBox,create_time createTime" + + ",bi.address,bi.introduce,bi.status from areainfo ai inner join business_info bi on ai.id=bi.plot_id order by bi.id desc") + List findByPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize); + + @Update("update business_info set status=1,operationTime=#{examineTime} where id=#{id}") + void editStatusById(@Param("id") Integer id, @Param("examineTime") Date examineTime); + + List select(@Param("nickName") String nickName, @Param("status") Integer status); + + @Update("update business_info set status=2,operationTime=#{refuseTime} where id=#{id}") + void refuse(@Param("id") Integer id, @Param("refuseTime") Date refuseTime); +} diff --git a/pccenter/src/main/java/com/woniu/dao/PropertyManageMapper.java b/pccenter/src/main/java/com/woniu/dao/PropertyManageMapper.java new file mode 100644 index 0000000..a9996d8 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dao/PropertyManageMapper.java @@ -0,0 +1,23 @@ +package com.woniu.dao; + +import com.woniu.pojo.PropertyManage; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Update; + + +import java.util.Date; +import java.util.List; + +public interface PropertyManageMapper { + + List findByPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize); + + @Update("update property_manage set status = 1,pass_time=#{passTime} where id=#{id}") + void editStatusById(@Param("id") Integer id, @Param("passTime") Date passTime); + + + List findList(@Param("userName") String userName,@Param("status") Integer status); + + @Update("update property_manage set status = 2 ,pass_time=#{refuseTime}where id=#{id}") + void refuse(@Param("id") Integer id,@Param("refuseTime") Date refuseTime); +} diff --git a/pccenter/src/main/java/com/woniu/dao/RolesMapper.java b/pccenter/src/main/java/com/woniu/dao/RolesMapper.java index 4e20195..aba8b1f 100644 --- a/pccenter/src/main/java/com/woniu/dao/RolesMapper.java +++ b/pccenter/src/main/java/com/woniu/dao/RolesMapper.java @@ -23,7 +23,7 @@ public interface RolesMapper { @Select("select * from pc_roles") List selectAll(); - @Select("select * from pc_roles") + @Select("select * from pc_roles order by pc_roles.role_id desc") List selectByPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize); @Select("select * from pc_roles where role_name = #{roleName}") diff --git a/pccenter/src/main/java/com/woniu/dao/ServiceCommentMapper.java b/pccenter/src/main/java/com/woniu/dao/ServiceCommentMapper.java new file mode 100644 index 0000000..107c5de --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dao/ServiceCommentMapper.java @@ -0,0 +1,20 @@ +package com.woniu.dao; + +import com.woniu.dto.ServiceCommentDTO; +import org.apache.ibatis.annotations.Delete; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + + +import java.util.List; + +public interface ServiceCommentMapper { + + @Select("select pu.mailbox mailBox,pu.nickname nickName,es.id,es.evalute,pp.payname payName,pp.payprice payPrice,pp.servicecontext context from person_user pu INNER JOIN evaluate_service es ON pu.id = es.userid INNER JOIN pp_payservice pp ON pp.id=es.serviceid order by es.id desc") + List findByPage(@Param("currentPage") Integer currentPage,@Param("pageSize") Integer pageSize); + + @Delete("delete from evaluate_service where id = #{value}") + void delComment(Integer id); + + List select(@Param("nickName") String nickName, @Param("payName") String payName); +} diff --git a/pccenter/src/main/java/com/woniu/dao/UsersMapper.java b/pccenter/src/main/java/com/woniu/dao/UsersMapper.java deleted file mode 100644 index f9fbcb0..0000000 --- a/pccenter/src/main/java/com/woniu/dao/UsersMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.woniu.dao; - -import com.woniu.pojo.Users; - -public interface UsersMapper { - int deleteByPrimaryKey(Integer uid); - - int insert(Users record); - - int insertSelective(Users record); - - Users selectByPrimaryKey(Integer uid); - - int updateByPrimaryKeySelective(Users record); - - int updateByPrimaryKey(Users record); -} \ No newline at end of file diff --git a/pccenter/src/main/java/com/woniu/dto/ActivityComplainDTO.java b/pccenter/src/main/java/com/woniu/dto/ActivityComplainDTO.java new file mode 100644 index 0000000..3d5bb4f --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dto/ActivityComplainDTO.java @@ -0,0 +1,89 @@ +package com.woniu.dto; + +import java.io.Serializable; +import java.util.Date; + +public class ActivityComplainDTO implements Serializable { + private Integer id; + private String nickName; + private String sex; + private String mailBox; + private String title; + private Date createTime; + private String reason; + private Integer status; + private String context; + + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getMailBox() { + return mailBox; + } + + public void setMailBox(String mailBox) { + this.mailBox = mailBox; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getContext() { + return context; + } + + public void setContext(String context) { + this.context = context; + } +} diff --git a/pccenter/src/main/java/com/woniu/dto/ActivityDTO.java b/pccenter/src/main/java/com/woniu/dto/ActivityDTO.java new file mode 100644 index 0000000..3b67ea0 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dto/ActivityDTO.java @@ -0,0 +1,96 @@ +package com.woniu.dto; + +import java.io.Serializable; +import java.util.Date; + +public class ActivityDTO implements Serializable { + private Integer id; + private String name; + private Integer type; + private String title; + private String content; + private Integer number; + private Date createTime; + private Integer status; + private Double money; + private Date operationTime; + + public Date getOperationTime() { + return operationTime; + } + + public void setOperationTime(Date operationTime) { + this.operationTime = operationTime; + } + public Double getMoney() { + return money; + } + + public void setMoney(Double money) { + this.money = money; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + 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 getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } +} diff --git a/pccenter/src/main/java/com/woniu/dto/ComplainDTO.java b/pccenter/src/main/java/com/woniu/dto/ComplainDTO.java new file mode 100644 index 0000000..273dd52 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dto/ComplainDTO.java @@ -0,0 +1,89 @@ +package com.woniu.dto; + +import java.io.Serializable; +import java.util.Date; + +public class ComplainDTO implements Serializable { + private Integer id; + private String nickName; + private String sex; + private String mailBox; + private Integer orderId; + private Date startTime; + private String reason; + private Integer status; + //private Date passTime; + private String context; + + public String getContext() { + return context; + } + + public void setContext(String context) { + this.context = context; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getMailBox() { + return mailBox; + } + + public void setMailBox(String mailBox) { + this.mailBox = mailBox; + } + + public Integer getOrderId() { + return orderId; + } + + public void setOrderId(Integer orderId) { + this.orderId = orderId; + } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public String getReason() { + return reason; + } + + public void setReason(String reason) { + this.reason = reason; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } +} diff --git a/pccenter/src/main/java/com/woniu/dto/DynamicCommentDTO.java b/pccenter/src/main/java/com/woniu/dto/DynamicCommentDTO.java new file mode 100644 index 0000000..c6de36f --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dto/DynamicCommentDTO.java @@ -0,0 +1,79 @@ +package com.woniu.dto; + +import java.io.Serializable; +import java.util.Date; + +public class DynamicCommentDTO implements Serializable { + private Integer id; + private String nickName; + private Integer dynamicType; + private String dynamicContent; + private Integer favor; + private Date issueTime; + private String comment; + private Date commentTime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public Integer getDynamicType() { + return dynamicType; + } + + public void setDynamicType(Integer dynamicType) { + this.dynamicType = dynamicType; + } + + public String getDynamicContent() { + return dynamicContent; + } + + public void setDynamicContent(String dynamicContent) { + this.dynamicContent = dynamicContent; + } + + public Integer getFavor() { + return favor; + } + + public void setFavor(Integer favor) { + this.favor = favor; + } + + public Date getIssueTime() { + return issueTime; + } + + public void setIssueTime(Date issueTime) { + this.issueTime = issueTime; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public Date getCommentTime() { + return commentTime; + } + + public void setCommentTime(Date commentTime) { + this.commentTime = commentTime; + } +} diff --git a/pccenter/src/main/java/com/woniu/dto/MerchantDTO.java b/pccenter/src/main/java/com/woniu/dto/MerchantDTO.java new file mode 100644 index 0000000..baaa0ac --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dto/MerchantDTO.java @@ -0,0 +1,88 @@ +package com.woniu.dto; + +import java.io.Serializable; +import java.util.Date; + +public class MerchantDTO implements Serializable{ + private Integer id; + private String nickName; + private String areaName; + private String mailBox; + private Date createTime; + private String address; + private String introduce; + private Integer status; + private Date operationTime; + + public Date getOperationTime() { + return operationTime; + } + + public void setOperationTime(Date operationTime) { + this.operationTime = operationTime; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + } + + public String getMailBox() { + return mailBox; + } + + public void setMailBox(String mailBox) { + this.mailBox = mailBox; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public String getAddress() { + return address; + } + + public void setAddress(String adress) { + this.address = adress; + } + + public String getIntroduce() { + return introduce; + } + + public void setIntroduce(String introduce) { + this.introduce = introduce; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } +} diff --git a/pccenter/src/main/java/com/woniu/dto/ServiceCommentDTO.java b/pccenter/src/main/java/com/woniu/dto/ServiceCommentDTO.java new file mode 100644 index 0000000..97b2b15 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/dto/ServiceCommentDTO.java @@ -0,0 +1,70 @@ +package com.woniu.dto; + +import java.io.Serializable; + + +public class ServiceCommentDTO implements Serializable { + private Integer id; + private String nickName; + private String payName; + private String evalute; + private String mailBox; + private Integer payPrice; + private String context; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getPayName() { + return payName; + } + + public void setPayName(String payName) { + this.payName = payName; + } + + public String getEvalute() { + return evalute; + } + + public void setEvalute(String evalute) { + this.evalute = evalute; + } + + public String getMailBox() { + return mailBox; + } + + public void setMailBox(String mailBox) { + this.mailBox = mailBox; + } + + public Integer getPayPrice() { + return payPrice; + } + + public void setPayPrice(Integer payPrice) { + this.payPrice = payPrice; + } + + public String getContext() { + return context; + } + + public void setContext(String context) { + this.context = context; + } +} diff --git a/pccenter/src/main/java/com/woniu/exception/GlobalExceptionHandler.java b/pccenter/src/main/java/com/woniu/exception/GlobalExceptionHandler.java new file mode 100644 index 0000000..56fdf05 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/exception/GlobalExceptionHandler.java @@ -0,0 +1,60 @@ +package com.woniu.exception; + +import com.woniu.common.CommonResult; +import org.apache.shiro.authz.UnauthorizedException; +import org.springframework.validation.BindException; +import org.springframework.validation.BindingResult; +import org.springframework.validation.FieldError; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +import java.util.List; + +@ControllerAdvice +public class GlobalExceptionHandler { + + @ExceptionHandler(UnauthorizedException.class) + public String unauthorizedExceptionHandler(UnauthorizedException e){ + e.printStackTrace(); + return "/403";//跳转到 403.html + } + + + @ExceptionHandler(HttpRequestMethodNotSupportedException.class) + @ResponseBody + public String httpRequestMethodNotSupportedExceptionHandler(HttpRequestMethodNotSupportedException e){ + e.printStackTrace(); + return "访问方式不支持"; + } + + + /*@ExceptionHandler(LoginException.class) + @ResponseBody + public CommonResult loginExceptionHandler(LoginException e){ + return CommonResult.failed(e.getMessage()); + }*/ + + /* @ExceptionHandler(BindException.class) + @ResponseBody + public CommonResult bindExceionHandler(BindException e){ + e.printStackTrace(); + BindingResult result = e.getBindingResult();//BindingResult对象存放了Spring校验抛出的异常 + List list = result.getFieldErrors(); + for (FieldError fieldError : list) { + String msg = fieldError.getDefaultMessage(); + return CommonResult.valetateFailed(msg); + } + return CommonResult.valetateFailed(); + }*/ + + @ExceptionHandler(Exception.class) + @ResponseBody + public CommonResult exceptionHandler(Exception e){ + e.printStackTrace(); + System.out.println(e.getClass().getName()); + return CommonResult.failed("网络异常"); + } +} diff --git a/pccenter/src/main/java/com/woniu/exception/LoginException.java b/pccenter/src/main/java/com/woniu/exception/LoginException.java new file mode 100644 index 0000000..ef7339f --- /dev/null +++ b/pccenter/src/main/java/com/woniu/exception/LoginException.java @@ -0,0 +1,22 @@ +package com.woniu.exception; + +public class LoginException extends RuntimeException{ + public LoginException() { + } + + public LoginException(String message) { + super(message); + } + + public LoginException(String message, Throwable cause) { + super(message, cause); + } + + public LoginException(Throwable cause) { + super(cause); + } + + public LoginException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { + super(message, cause, enableSuppression, writableStackTrace); + } +} diff --git a/pccenter/src/main/java/com/woniu/pojo/Information.java b/pccenter/src/main/java/com/woniu/pojo/Information.java deleted file mode 100644 index 2f1c550..0000000 --- a/pccenter/src/main/java/com/woniu/pojo/Information.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.woniu.pojo; - -public class Information { - private Integer id; - - private Integer account; - - private String password; - - private String name; - - private String nickname; - - private String roletype; - - private String stage; - - private Integer phone; - - private String adress; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getAccount() { - return account; - } - - public void setAccount(Integer account) { - this.account = account; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getNickname() { - return nickname; - } - - public void setNickname(String nickname) { - this.nickname = nickname; - } - - public String getRoletype() { - return roletype; - } - - public void setRoletype(String roletype) { - this.roletype = roletype; - } - - public String getStage() { - return stage; - } - - public void setStage(String stage) { - this.stage = stage; - } - - public Integer getPhone() { - return phone; - } - - public void setPhone(Integer phone) { - this.phone = phone; - } - - public String getAdress() { - return adress; - } - - public void setAdress(String adress) { - this.adress = adress; - } -} \ No newline at end of file diff --git a/pccenter/src/main/java/com/woniu/pojo/PropertyManage.java b/pccenter/src/main/java/com/woniu/pojo/PropertyManage.java new file mode 100644 index 0000000..0a37b7f --- /dev/null +++ b/pccenter/src/main/java/com/woniu/pojo/PropertyManage.java @@ -0,0 +1,95 @@ +package com.woniu.pojo; + +import java.util.Date; + +public class PropertyManage { + private Integer id; + + private Integer villageId; + + private String userName; + + private String saltValue; + + private String phone; + + private Integer status; + + private Date createTime; + + private Date passTime; + + /* private String areaName; + + public String getAreaName() { + return areaName; + } + + public void setAreaName(String areaName) { + this.areaName = areaName; + }*/ + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getVillageId() { + return villageId; + } + + public void setVillageId(Integer villageId) { + this.villageId = villageId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getSaltValue() { + return saltValue; + } + + public void setSaltValue(String saltValue) { + this.saltValue = saltValue; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public Date getCreateTime() { + return createTime; + } + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + public Date getPassTime() { + return passTime; + } + + public void setPassTime(Date passTime) { + this.passTime = passTime; + } +} diff --git a/pccenter/src/main/java/com/woniu/pojo/RolesMenusKey.java b/pccenter/src/main/java/com/woniu/pojo/RolesMenusKey.java index da24ad7..06ab7a6 100644 --- a/pccenter/src/main/java/com/woniu/pojo/RolesMenusKey.java +++ b/pccenter/src/main/java/com/woniu/pojo/RolesMenusKey.java @@ -4,7 +4,7 @@ import java.io.Serializable; import lombok.Data; /** - * tb_roles_menus + * pc_roles_menus * @author */ @Data diff --git a/pccenter/src/main/java/com/woniu/pojo/Users.java b/pccenter/src/main/java/com/woniu/pojo/Users.java deleted file mode 100644 index 73ad250..0000000 --- a/pccenter/src/main/java/com/woniu/pojo/Users.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.woniu.pojo; - -public class Users { - private Integer uid; - - private Integer account; - - private String name; - - private String password; - - private Integer phone; - - private String adress; - - private String status; - - private String nickname; - - private String roleType; - - public Integer getUid() { - return uid; - } - - public void setUid(Integer uid) { - this.uid = uid; - } - - public Integer getAccount() { - return account; - } - - public void setAccount(Integer account) { - this.account = account; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public Integer getPhone() { - return phone; - } - - public void setPhone(Integer phone) { - this.phone = phone; - } - - public String getAdress() { - return adress; - } - - public void setAdress(String adress) { - this.adress = adress; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getNickname() { - return nickname; - } - - public void setNickname(String nickname) { - this.nickname = nickname; - } - - public String getRoleType() { - return roleType; - } - - public void setRoleType(String roleType) { - this.roleType = roleType; - } -} \ No newline at end of file diff --git a/pccenter/src/main/java/com/woniu/realm/CustomRealm.java b/pccenter/src/main/java/com/woniu/realm/CustomRealm.java index ae780f7..5df85c7 100644 --- a/pccenter/src/main/java/com/woniu/realm/CustomRealm.java +++ b/pccenter/src/main/java/com/woniu/realm/CustomRealm.java @@ -47,7 +47,7 @@ public class CustomRealm extends AuthorizingRealm { throw new UnknownAccountException("账号不存在"); } SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(admin,admin.getPassword(),ByteSource.Util.bytes(admin.getSalt()),super.getName()); - //info.setCredentialsSalt(ByteSource.Util.bytes(admin.getSalt())); + info.setCredentialsSalt(ByteSource.Util.bytes(admin.getSalt())); return info; } } diff --git a/pccenter/src/main/java/com/woniu/service/ActivityComplainService.java b/pccenter/src/main/java/com/woniu/service/ActivityComplainService.java new file mode 100644 index 0000000..dc5d465 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/ActivityComplainService.java @@ -0,0 +1,15 @@ +package com.woniu.service; + +import com.woniu.dto.ActivityComplainDTO; + +import java.util.List; + +public interface ActivityComplainService { + List findByPage(Integer currentPage, Integer pageSize); + + ActivityComplainDTO findById(Integer id); + + void addReply(ActivityComplainDTO activityComplainDTO); + + List select(String nickName, String title); +} diff --git a/pccenter/src/main/java/com/woniu/service/ActivityService.java b/pccenter/src/main/java/com/woniu/service/ActivityService.java new file mode 100644 index 0000000..466e268 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/ActivityService.java @@ -0,0 +1,16 @@ +package com.woniu.service; + +import com.woniu.dto.ActivityDTO; + +import java.util.Date; +import java.util.List; + +public interface ActivityService { + List findListByPage(Integer currentPage, Integer pageSize); + + void editStatusById(Integer id,Date examineTime); + + List select(String name, Integer status); + + void refuse(Integer id, Date operationTime); +} diff --git a/pccenter/src/main/java/com/woniu/service/ComplainService.java b/pccenter/src/main/java/com/woniu/service/ComplainService.java new file mode 100644 index 0000000..3205a12 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/ComplainService.java @@ -0,0 +1,15 @@ +package com.woniu.service; + +import com.woniu.dto.ComplainDTO; + +import java.util.List; + +public interface ComplainService { + List findByPage(Integer currentPage, Integer pageSize); + + void addReply(ComplainDTO complainDTO); + + ComplainDTO findById(Integer id); + + List select(String userName, Integer status); +} diff --git a/pccenter/src/main/java/com/woniu/service/DynamicCommentService.java b/pccenter/src/main/java/com/woniu/service/DynamicCommentService.java new file mode 100644 index 0000000..12d62f7 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/DynamicCommentService.java @@ -0,0 +1,13 @@ +package com.woniu.service; + +import com.woniu.dto.DynamicCommentDTO; + +import java.util.List; + +public interface DynamicCommentService { + List findByPage(Integer currentPage, Integer pageSize); + + void delComment(Integer id); + + List select(String nickName,Integer dynamicType); +} diff --git a/pccenter/src/main/java/com/woniu/service/MenusService.java b/pccenter/src/main/java/com/woniu/service/MenusService.java index 91ae56a..2744df9 100644 --- a/pccenter/src/main/java/com/woniu/service/MenusService.java +++ b/pccenter/src/main/java/com/woniu/service/MenusService.java @@ -19,4 +19,8 @@ public interface MenusService { void delMenus(Integer mid); void updateMenusSorting(Integer menuId, Integer parseLong); + + Menus findByMenuId(Integer menuId); + + void updateMenus(Menus menus); } diff --git a/pccenter/src/main/java/com/woniu/service/MerchantService.java b/pccenter/src/main/java/com/woniu/service/MerchantService.java new file mode 100644 index 0000000..17b933f --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/MerchantService.java @@ -0,0 +1,16 @@ +package com.woniu.service; + +import com.woniu.dto.MerchantDTO; + +import java.util.Date; +import java.util.List; + +public interface MerchantService { + List findByPage(Integer currentPage, Integer pageSize); + + void editStatusById(Integer id,Date examineTime); + + List select(String nickName, Integer status); + + void refuse(Integer id, Date refuseTime); +} diff --git a/pccenter/src/main/java/com/woniu/service/ProperManageService.java b/pccenter/src/main/java/com/woniu/service/ProperManageService.java new file mode 100644 index 0000000..3247b0f --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/ProperManageService.java @@ -0,0 +1,17 @@ +package com.woniu.service; + +import com.woniu.pojo.PropertyManage; + +import java.util.Date; +import java.util.List; + +public interface ProperManageService { + List findListByPage(Integer currentPage, Integer pageSize); + + + void editStatusById(Integer id, Date passTime); + + List findList(String userName, Integer status); + + void refuse(Integer id, Date refuseTime); +} diff --git a/pccenter/src/main/java/com/woniu/service/ServiceCommentService.java b/pccenter/src/main/java/com/woniu/service/ServiceCommentService.java new file mode 100644 index 0000000..077905c --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/ServiceCommentService.java @@ -0,0 +1,15 @@ +package com.woniu.service; + +import com.woniu.dto.ServiceCommentDTO; + +import java.util.List; + +public interface ServiceCommentService { + + + List findByPage(Integer currentPage, Integer pageSize); + + void delComment(Integer id); + + List select(String nickName, String payName); +} diff --git a/pccenter/src/main/java/com/woniu/service/impl/ActivityComplainServiceImpl.java b/pccenter/src/main/java/com/woniu/service/impl/ActivityComplainServiceImpl.java new file mode 100644 index 0000000..91099c4 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/impl/ActivityComplainServiceImpl.java @@ -0,0 +1,41 @@ +package com.woniu.service.impl; + +import com.woniu.dao.ActivityComplainMapper; +import com.woniu.dto.ActivityComplainDTO; +import com.woniu.service.ActivityComplainService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +public class ActivityComplainServiceImpl implements ActivityComplainService { + + @Autowired + private ActivityComplainMapper acComplainMapper; + @Override + public List findByPage(Integer currentPage, Integer pageSize) { + List list = acComplainMapper.findByPage(currentPage,pageSize); + return list; + } + + @Override + public ActivityComplainDTO findById(Integer id) { + return acComplainMapper.findById(id); + } + + @Override + public void addReply(ActivityComplainDTO activityComplainDTO) { + String context=activityComplainDTO.getContext(); + Integer id=activityComplainDTO.getId(); + Date replyTime=new Date(); + acComplainMapper.addReply(id,context,replyTime); + } + + @Override + public List select(String nickName, String title) { + List list=acComplainMapper.select(nickName,title); + return list; + } +} diff --git a/pccenter/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java b/pccenter/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java new file mode 100644 index 0000000..9d4a0a2 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java @@ -0,0 +1,40 @@ +package com.woniu.service.impl; + +import com.woniu.dao.ActivityMapper; +import com.woniu.dto.ActivityDTO; +import com.woniu.pojo.PropertyManage; +import com.woniu.service.ActivityService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +public class ActivityServiceImpl implements ActivityService { + + @Autowired + private ActivityMapper activityMapper; + + @Override + public List findListByPage(Integer currentPage, Integer pageSize) { + List list=activityMapper.findByPage(currentPage,pageSize); + return list; + } + + @Override + public void editStatusById(Integer id,Date examineTime) { + activityMapper.editStatusById(id,examineTime); + } + + @Override + public List select(String name, Integer status) { + List list=activityMapper.select(name,status); + return list; + } + + @Override + public void refuse(Integer id, Date operationTime) { + activityMapper.refuse(id,operationTime); + } +} diff --git a/pccenter/src/main/java/com/woniu/service/impl/AdminServiceImpl.java b/pccenter/src/main/java/com/woniu/service/impl/AdminServiceImpl.java index adb8163..721aec8 100644 --- a/pccenter/src/main/java/com/woniu/service/impl/AdminServiceImpl.java +++ b/pccenter/src/main/java/com/woniu/service/impl/AdminServiceImpl.java @@ -3,10 +3,12 @@ package com.woniu.service.impl; import com.woniu.dao.AdminMapper; import com.woniu.pojo.Admin; import com.woniu.service.AdminService; +import org.apache.shiro.crypto.hash.Md5Hash; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; +import java.util.UUID; @Service public class AdminServiceImpl implements AdminService { @@ -22,6 +24,12 @@ public class AdminServiceImpl implements AdminService { @Override public void saveAdmin(Admin admin) { + //密码加密 + String salt = UUID.randomUUID().toString(); + System.out.println(salt); + admin.setSalt(salt); + Md5Hash hash = new Md5Hash(admin.getPassword(),salt,1024); + admin.setPassword(hash.toString());//加密后的密码 adminMapper.insertSelective(admin); } diff --git a/pccenter/src/main/java/com/woniu/service/impl/ComplainServiceImpl.java b/pccenter/src/main/java/com/woniu/service/impl/ComplainServiceImpl.java new file mode 100644 index 0000000..3906d7a --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/impl/ComplainServiceImpl.java @@ -0,0 +1,41 @@ +package com.woniu.service.impl; + +import com.woniu.dao.ComplainMapper; +import com.woniu.dto.ComplainDTO; +import com.woniu.service.ComplainService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ComplainServiceImpl implements ComplainService { + + @Autowired + private ComplainMapper complainMapper; + + @Override + public List findByPage(Integer currentPage, Integer pageSize) { + List list=complainMapper.findByPage(currentPage,pageSize); + return list; + } + + @Override + public void addReply(ComplainDTO complainDTO) { + String context=complainDTO.getContext(); + Integer id=complainDTO.getId(); + complainMapper.addReply(id,context); + } + + @Override + public ComplainDTO findById(Integer id) { + ComplainDTO complainDTO= complainMapper.findById(id); + return complainDTO; + } + + @Override + public List select(String userName, Integer status) { + List list=complainMapper.select(userName,status); + return list; + } +} diff --git a/pccenter/src/main/java/com/woniu/service/impl/DynamicCommentServiceImpl.java b/pccenter/src/main/java/com/woniu/service/impl/DynamicCommentServiceImpl.java new file mode 100644 index 0000000..c50a944 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/impl/DynamicCommentServiceImpl.java @@ -0,0 +1,32 @@ +package com.woniu.service.impl; + +import com.woniu.dao.DynamicCommentMapper; +import com.woniu.dto.DynamicCommentDTO; +import com.woniu.service.DynamicCommentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +public class DynamicCommentServiceImpl implements DynamicCommentService { + + @Autowired + private DynamicCommentMapper dc_mapper; + + @Override + public List findByPage(Integer currentPage, Integer pageSize) { + List list = dc_mapper.findByPage(currentPage,pageSize); + return list; + } + + @Override + public void delComment(Integer id) { + dc_mapper.delComment(id); + } + + @Override + public List select(String nickName,Integer dynamicType) { + List list=dc_mapper.select(nickName,dynamicType); + return list; + } +} diff --git a/pccenter/src/main/java/com/woniu/service/impl/MenusServiceImpl.java b/pccenter/src/main/java/com/woniu/service/impl/MenusServiceImpl.java index 4e098f8..ac5c69f 100644 --- a/pccenter/src/main/java/com/woniu/service/impl/MenusServiceImpl.java +++ b/pccenter/src/main/java/com/woniu/service/impl/MenusServiceImpl.java @@ -117,4 +117,15 @@ public class MenusServiceImpl implements MenusService { menusMapper.updateSorting(menuId,sorting); } + @Override + public Menus findByMenuId(Integer menuId) { + return menusMapper.findByMenuId(menuId); + } + + @Override + public void updateMenus(Menus menus) { + menus.setSpread("false"); + menusMapper.updateByPrimaryKey(menus); + } + } diff --git a/pccenter/src/main/java/com/woniu/service/impl/MerchantServiceImpl.java b/pccenter/src/main/java/com/woniu/service/impl/MerchantServiceImpl.java new file mode 100644 index 0000000..6206b69 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/impl/MerchantServiceImpl.java @@ -0,0 +1,40 @@ +package com.woniu.service.impl; + +import com.woniu.dao.MerchantMapper; +import com.woniu.dto.MerchantDTO; +import com.woniu.service.MerchantService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +public class MerchantServiceImpl implements MerchantService { + + @Autowired + private MerchantMapper merchantMapper; + + @Override + public List findByPage(Integer currentPage, Integer pageSize) { + List list=merchantMapper.findByPage(currentPage,pageSize); + return list; + } + + @Override + public void editStatusById(Integer id, Date examineTime) { + merchantMapper.editStatusById(id,examineTime); + } + + @Override + public List select(String nickName, Integer status) { + List list=merchantMapper.select(nickName,status); + return list; + } + + @Override + public void refuse(Integer id, Date refuseTime) { + merchantMapper.refuse(id,refuseTime); + + } +} diff --git a/pccenter/src/main/java/com/woniu/service/impl/PropertyManageServiceImpl.java b/pccenter/src/main/java/com/woniu/service/impl/PropertyManageServiceImpl.java new file mode 100644 index 0000000..91fc171 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/impl/PropertyManageServiceImpl.java @@ -0,0 +1,42 @@ +package com.woniu.service.impl; + +import com.woniu.dao.PropertyManageMapper; +import com.woniu.pojo.PropertyManage; +import com.woniu.service.ProperManageService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +import java.util.Date; +import java.util.List; + +@Service +public class PropertyManageServiceImpl implements ProperManageService { + + @Autowired + private PropertyManageMapper pmMapper; + + @Override + public List findListByPage(Integer currentPage, Integer pageSize) { + List list=pmMapper.findByPage(currentPage,pageSize); + return list; + } + + @Override + public void editStatusById(Integer id, Date passTime) { + pmMapper.editStatusById(id,passTime); + } + + @Override + public List findList(String userName, Integer status) { + List list=pmMapper.findList(userName,status); + return list; + } + + @Override + public void refuse(Integer id, Date refuseTime) { + pmMapper.refuse(id,refuseTime); + } + + +} diff --git a/pccenter/src/main/java/com/woniu/service/impl/ServiceCommentServiceImpl.java b/pccenter/src/main/java/com/woniu/service/impl/ServiceCommentServiceImpl.java new file mode 100644 index 0000000..1e3a7c9 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/service/impl/ServiceCommentServiceImpl.java @@ -0,0 +1,32 @@ +package com.woniu.service.impl; + +import com.woniu.dao.ServiceCommentMapper; +import com.woniu.dto.ServiceCommentDTO; +import com.woniu.service.ServiceCommentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +public class ServiceCommentServiceImpl implements ServiceCommentService { + + @Autowired + private ServiceCommentMapper scMapper; + @Override + public List findByPage(Integer currentPage, Integer pageSize) { + List list=scMapper.findByPage(currentPage,pageSize); + return list; + } + + @Override + public void delComment(Integer id) { + scMapper.delComment(id); + } + + @Override + public List select(String nickName, String payName) { + List list=scMapper.select(nickName,payName); + //System.out.println(list.size()); + return list; + } +} diff --git a/pccenter/src/main/resources/application.yml b/pccenter/src/main/resources/application.yml index 2f77018..5b1dc9b 100644 --- a/pccenter/src/main/resources/application.yml +++ b/pccenter/src/main/resources/application.yml @@ -1,8 +1,10 @@ spring: + application: + name: pccenter datasource: - username: root - password: root - url: jdbc:mysql://localhost:3306/pccenter?serverTimezone=GMT%2B8 + username: develop + password: 20200322 + url: jdbc:mysql://106.12.148.100:3307/happycommunity?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8 driver-class-name: com.mysql.jdbc.Driver druid: filters: stat,wall,logback @@ -29,3 +31,7 @@ pagehelper: logging: level: com.woniu.dao: debug +eureka: + client: + service-url: + defaultZone: http://localhost:8761/eureka diff --git a/pccenter/src/main/resources/generatorConfig.xml b/pccenter/src/main/resources/generatorConfig.xml index 2a08fdd..d610019 100644 --- a/pccenter/src/main/resources/generatorConfig.xml +++ b/pccenter/src/main/resources/generatorConfig.xml @@ -9,8 +9,8 @@ - + @@ -24,7 +24,7 @@ domainObjectName实体类的名称 enableCountByExample 接口中是否生成对应的方法 --> - -
- -
- --> +
+ + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/mapper/ActivityMapper.xml b/pccenter/src/main/resources/mapper/ActivityMapper.xml new file mode 100644 index 0000000..a537259 --- /dev/null +++ b/pccenter/src/main/resources/mapper/ActivityMapper.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/mapper/AdminMapper.xml b/pccenter/src/main/resources/mapper/AdminMapper.xml index c9e7f6b..3d1808e 100644 --- a/pccenter/src/main/resources/mapper/AdminMapper.xml +++ b/pccenter/src/main/resources/mapper/AdminMapper.xml @@ -162,7 +162,7 @@ diff --git a/pccenter/src/main/resources/mapper/ComplainMapper.xml b/pccenter/src/main/resources/mapper/ComplainMapper.xml new file mode 100644 index 0000000..0ecc93d --- /dev/null +++ b/pccenter/src/main/resources/mapper/ComplainMapper.xml @@ -0,0 +1,20 @@ + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/mapper/DynamicCommentMapper.xml b/pccenter/src/main/resources/mapper/DynamicCommentMapper.xml new file mode 100644 index 0000000..129244f --- /dev/null +++ b/pccenter/src/main/resources/mapper/DynamicCommentMapper.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/mapper/InformationMapper.xml b/pccenter/src/main/resources/mapper/InformationMapper.xml deleted file mode 100644 index ec8f53a..0000000 --- a/pccenter/src/main/resources/mapper/InformationMapper.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - id, account, password, name, nickname, roletype, stage, phone, adress - - - - delete from pc_information - where id = #{id,jdbcType=INTEGER} - - - insert into pc_information (id, account, password, - name, nickname, roletype, - stage, phone, adress - ) - values (#{id,jdbcType=INTEGER}, #{account,jdbcType=INTEGER}, #{password,jdbcType=VARCHAR}, - #{name,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR}, #{roletype,jdbcType=VARCHAR}, - #{stage,jdbcType=VARCHAR}, #{phone,jdbcType=INTEGER}, #{adress,jdbcType=VARCHAR} - ) - - - insert into pc_information - - - id, - - - account, - - - password, - - - name, - - - nickname, - - - roletype, - - - stage, - - - phone, - - - adress, - - - - - #{id,jdbcType=INTEGER}, - - - #{account,jdbcType=INTEGER}, - - - #{password,jdbcType=VARCHAR}, - - - #{name,jdbcType=VARCHAR}, - - - #{nickname,jdbcType=VARCHAR}, - - - #{roletype,jdbcType=VARCHAR}, - - - #{stage,jdbcType=VARCHAR}, - - - #{phone,jdbcType=INTEGER}, - - - #{adress,jdbcType=VARCHAR}, - - - - - update pc_information - - - account = #{account,jdbcType=INTEGER}, - - - password = #{password,jdbcType=VARCHAR}, - - - name = #{name,jdbcType=VARCHAR}, - - - nickname = #{nickname,jdbcType=VARCHAR}, - - - roletype = #{roletype,jdbcType=VARCHAR}, - - - stage = #{stage,jdbcType=VARCHAR}, - - - phone = #{phone,jdbcType=INTEGER}, - - - adress = #{adress,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=INTEGER} - - - update pc_information - set account = #{account,jdbcType=INTEGER}, - password = #{password,jdbcType=VARCHAR}, - name = #{name,jdbcType=VARCHAR}, - nickname = #{nickname,jdbcType=VARCHAR}, - roletype = #{roletype,jdbcType=VARCHAR}, - stage = #{stage,jdbcType=VARCHAR}, - phone = #{phone,jdbcType=INTEGER}, - adress = #{adress,jdbcType=VARCHAR} - where id = #{id,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/pccenter/src/main/resources/mapper/MerchantMapper.xml b/pccenter/src/main/resources/mapper/MerchantMapper.xml new file mode 100644 index 0000000..d579a54 --- /dev/null +++ b/pccenter/src/main/resources/mapper/MerchantMapper.xml @@ -0,0 +1,19 @@ + + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/mapper/PropertyManageMapper.xml b/pccenter/src/main/resources/mapper/PropertyManageMapper.xml new file mode 100644 index 0000000..a97f838 --- /dev/null +++ b/pccenter/src/main/resources/mapper/PropertyManageMapper.xml @@ -0,0 +1,22 @@ + + + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/mapper/ServiceCommentMapper.xml b/pccenter/src/main/resources/mapper/ServiceCommentMapper.xml new file mode 100644 index 0000000..501b9c5 --- /dev/null +++ b/pccenter/src/main/resources/mapper/ServiceCommentMapper.xml @@ -0,0 +1,18 @@ + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/mapper/UsersMapper.xml b/pccenter/src/main/resources/mapper/UsersMapper.xml deleted file mode 100644 index 5249caf..0000000 --- a/pccenter/src/main/resources/mapper/UsersMapper.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - uid, account, name, password, phone, adress, status, nickname, role_type - - - - delete from pc_users - where uid = #{uid,jdbcType=INTEGER} - - - insert into pc_users (uid, account, name, - password, phone, adress, - status, nickname, role_type - ) - values (#{uid,jdbcType=INTEGER}, #{account,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, - #{password,jdbcType=VARCHAR}, #{phone,jdbcType=INTEGER}, #{adress,jdbcType=VARCHAR}, - #{status,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR}, #{roleType,jdbcType=VARCHAR} - ) - - - insert into pc_users - - - uid, - - - account, - - - name, - - - password, - - - phone, - - - adress, - - - status, - - - nickname, - - - role_type, - - - - - #{uid,jdbcType=INTEGER}, - - - #{account,jdbcType=INTEGER}, - - - #{name,jdbcType=VARCHAR}, - - - #{password,jdbcType=VARCHAR}, - - - #{phone,jdbcType=INTEGER}, - - - #{adress,jdbcType=VARCHAR}, - - - #{status,jdbcType=VARCHAR}, - - - #{nickname,jdbcType=VARCHAR}, - - - #{roleType,jdbcType=VARCHAR}, - - - - - update pc_users - - - account = #{account,jdbcType=INTEGER}, - - - name = #{name,jdbcType=VARCHAR}, - - - password = #{password,jdbcType=VARCHAR}, - - - phone = #{phone,jdbcType=INTEGER}, - - - adress = #{adress,jdbcType=VARCHAR}, - - - status = #{status,jdbcType=VARCHAR}, - - - nickname = #{nickname,jdbcType=VARCHAR}, - - - role_type = #{roleType,jdbcType=VARCHAR}, - - - where uid = #{uid,jdbcType=INTEGER} - - - update pc_users - set account = #{account,jdbcType=INTEGER}, - name = #{name,jdbcType=VARCHAR}, - password = #{password,jdbcType=VARCHAR}, - phone = #{phone,jdbcType=INTEGER}, - adress = #{adress,jdbcType=VARCHAR}, - status = #{status,jdbcType=VARCHAR}, - nickname = #{nickname,jdbcType=VARCHAR}, - role_type = #{roleType,jdbcType=VARCHAR} - where uid = #{uid,jdbcType=INTEGER} - - \ No newline at end of file diff --git a/pccenter/src/main/resources/templates/403.html b/pccenter/src/main/resources/templates/403.html new file mode 100644 index 0000000..01661de --- /dev/null +++ b/pccenter/src/main/resources/templates/403.html @@ -0,0 +1,152 @@ + + + + +403禁止页面模板 + + + + + +

403

+

> ERROR CODE: "HTTP 403 Forbidden"

+

> ERROR DESCRIPTION: "Access Denied. You Do Not Have The Permission To Access This Page On This Server"

+

> ERROR POSSIBLY CAUSED BY: [execute access forbidden, read access forbidden, write access forbidden, ssl required, ssl 128 required, ip address rejected, client certificate required, site access denied, too many users, invalid configuration, password change, mapper denied access, client certificate revoked, directory listing denied, client access licenses exceeded, client certificate is untrusted or invalid, client certificate has expired or is not yet valid, passport logon failed, source access denied, infinite depth is denied, too many requests from the same client ip...]

+

> SOME PAGES ON THIS SERVER THAT YOU DO HAVE PERMISSION TO ACCESS: [Home Page, About Us, Contact Us, Blog...]

> HAVE A NICE DAY SIR AXLEROD :-)

+
+ + + + + + diff --git a/pccenter/src/main/resources/templates/login.html b/pccenter/src/main/resources/templates/login.html index 4755c5c..8d21cff 100644 --- a/pccenter/src/main/resources/templates/login.html +++ b/pccenter/src/main/resources/templates/login.html @@ -27,27 +27,15 @@ -
-
还没有账号?免费注册
- @@ -69,10 +57,11 @@ if(result.code == 200){ location.href = "/sys/index"; }else{ - layer.msg('登录失败',{icon:5}); + layer.msg(result.message,{icon:5}); } } }); + return false; }) }) diff --git a/pccenter/src/main/resources/templates/sys/ac_complainList.html b/pccenter/src/main/resources/templates/sys/ac_complainList.html new file mode 100644 index 0000000..7ab2277 --- /dev/null +++ b/pccenter/src/main/resources/templates/sys/ac_complainList.html @@ -0,0 +1,155 @@ + + + + + 活动投诉列表 + + + +
+
+
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+ + +
+ +
+ +
+
+
+
+ + + + + + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/templates/sys/ac_reply.html b/pccenter/src/main/resources/templates/sys/ac_reply.html new file mode 100644 index 0000000..a8706f5 --- /dev/null +++ b/pccenter/src/main/resources/templates/sys/ac_reply.html @@ -0,0 +1,55 @@ + + + + + Title + + + +
+ +
+ +
+ +
+
+
+
+ +
+
+
+ + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/templates/sys/activityList.html b/pccenter/src/main/resources/templates/sys/activityList.html new file mode 100644 index 0000000..59e33f4 --- /dev/null +++ b/pccenter/src/main/resources/templates/sys/activityList.html @@ -0,0 +1,196 @@ + + + + + 社区活动审核 + + + +
+
+
+
+
+
+ +
+ +
+
+
+ + +
+ +
+
+
+
+ +
+ +
+ + +
+ +
+
+
+
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/templates/sys/addAdmin.html b/pccenter/src/main/resources/templates/sys/addAdmin.html index ae108e7..99bb10a 100644 --- a/pccenter/src/main/resources/templates/sys/addAdmin.html +++ b/pccenter/src/main/resources/templates/sys/addAdmin.html @@ -104,8 +104,7 @@ //参数data就是表单中的数据 form.on('submit(addAdmin)',function (data) { - //data.field;//当前容器的全部表单字段,名值对形式:{name: value} - + $.ajax({ url:'/admin/saveAdmin', data:data.field, diff --git a/pccenter/src/main/resources/templates/sys/adminList.html b/pccenter/src/main/resources/templates/sys/adminList.html index 1d51848..825cd29 100644 --- a/pccenter/src/main/resources/templates/sys/adminList.html +++ b/pccenter/src/main/resources/templates/sys/adminList.html @@ -1,210 +1,201 @@ - + - Title + 管理员列表 -
+
- - - - - - - - - - - - - - - - + //监听行工具事件 + //注:tool 是工具条事件名,test 是 table 原始容器的属性 lay-filter="对应的值" + //obj.data //获得当前行数据 + //var layEvent = obj.event; //获得 lay-event 对应的值 + table.on('tool(test)', function (obj) { + var event = obj.event; + var data = obj.data; + if (event === 'edit') { //执行编辑 + layer.open({ + type: 2, + title: '编辑管理员', + area: ['400px', '5000px'], + content: '/admin/editAdmin/' + data.id + }); + } else if (event === 'del') {//执行删除 + var adminId = $("#adminId").val(); + if (data.roleName == "超级管理员") { + layer.msg('超级管理员不能删除'); + return; + } + if (data.id == adminId) { + layer.msg('不能删除自己'); + return; + } + layer.confirm('确认删除', function (index) { + $.ajax({ + url: '/admin/deleteAdmin/' + data.id, + type: 'delete', + dataType: 'json', + success: function (result) { + if (result.code == 200) { + layer.msg("删除成功", {icon: 1}); + location.reload(); + } else { + layer.msg("删除失败", {icon: 5}); + } + } + }) + layer.close(index); + }) + } + }) + + + }); + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/templates/sys/complainList.html b/pccenter/src/main/resources/templates/sys/complainList.html new file mode 100644 index 0000000..7c02c80 --- /dev/null +++ b/pccenter/src/main/resources/templates/sys/complainList.html @@ -0,0 +1,161 @@ + + + + + 物业投诉列表 + + + +
+
+
+
+
+
+ +
+ +
+
+
+ + +
+ +
+
+
+
+ +
+ +
+ + +
+ +
+
+ +
+
+ +
+
+
+ + + + + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/templates/sys/dynamic_commentList.html b/pccenter/src/main/resources/templates/sys/dynamic_commentList.html new file mode 100644 index 0000000..9ad824a --- /dev/null +++ b/pccenter/src/main/resources/templates/sys/dynamic_commentList.html @@ -0,0 +1,163 @@ + + + + + 活动评论列表 + + + +
+
+
+
+
+
+ +
+ +
+
+
+ + +
+ +
+
+
+
+ +
+ +
+ + +
+ +
+
+
+
+
+
+
+ + + + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/templates/sys/editMenu.html b/pccenter/src/main/resources/templates/sys/editMenu.html new file mode 100644 index 0000000..47fc05f --- /dev/null +++ b/pccenter/src/main/resources/templates/sys/editMenu.html @@ -0,0 +1,99 @@ + + + + + 编辑菜单 + + + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/templates/sys/editRole.html b/pccenter/src/main/resources/templates/sys/editRole.html index 570fcac..8a57994 100644 --- a/pccenter/src/main/resources/templates/sys/editRole.html +++ b/pccenter/src/main/resources/templates/sys/editRole.html @@ -33,7 +33,6 @@
-
diff --git a/pccenter/src/main/resources/templates/sys/index.html b/pccenter/src/main/resources/templates/sys/index.html index 47fcf32..7aaa30a 100644 --- a/pccenter/src/main/resources/templates/sys/index.html +++ b/pccenter/src/main/resources/templates/sys/index.html @@ -1,5 +1,5 @@ - + 后台首页 @@ -24,19 +24,19 @@ 修改密码
  • - 退出 + 退出
  • - +
    个人资料
    修改密码
    -
    退出
    +
    退出
  • diff --git a/pccenter/src/main/resources/templates/sys/menuList.html b/pccenter/src/main/resources/templates/sys/menuList.html index 95a1b81..a239710 100644 --- a/pccenter/src/main/resources/templates/sys/menuList.html +++ b/pccenter/src/main/resources/templates/sys/menuList.html @@ -1,5 +1,5 @@ - + 菜单列表 @@ -8,9 +8,12 @@
    - - - + + + + + +
    @@ -58,9 +61,6 @@ {title:'排序',field:'sorting',event:'sorting',style:'cursor:pointer'} ] ] - }) - $("#editMenu").click(function () { - }) //添加菜单 $("#addMenu").click(function () { @@ -82,10 +82,34 @@ layer.open({ type:2, title:'添加菜单', - area:['500px','600px'], + area:['400px','400px'], content:'/menus/addMenu/'+parentId }) }) + //编辑菜单 + $("#editMenu").click(function () { + var checkStatus = treeGrid.checkStatus('treeTable'); + var data = checkStatus.data;//获取选中行的数据 + if(data.length>1){ + layer.msg('只能选择一条数据',{icon:5}); + return ; + } + var menuId; + + if(data != ''){ + //获取当前行的节点菜单的Id + menuId = data[0].menuId; + } + //如果没有勾选复选框,默认id的值为0;即是根节点。 + //parentId = parentId==undefined?0:parentId; + + layer.open({ + type:2, + title:'编辑菜单', + area:['400px','400px'], + content:'/menus/editMenu/'+menuId + }) + }) //排序:监听行工具事件 tool() treeGrid.on("tool(treeTable)",function (row) { if(row.event === 'sorting'){ @@ -118,7 +142,7 @@ }) } }) - + //删除菜单 $("#delMenu").click(function () { var checkStatus = treeGrid.checkStatus('treeTable'); diff --git a/pccenter/src/main/resources/templates/sys/merchantList.html b/pccenter/src/main/resources/templates/sys/merchantList.html new file mode 100644 index 0000000..c21d63b --- /dev/null +++ b/pccenter/src/main/resources/templates/sys/merchantList.html @@ -0,0 +1,187 @@ + + + + + 商家注册列表 + + + +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + + +
    + +
    +
    +
    +
    + +
    + +
    + + +
    + +
    +
    + +
    +
    +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/templates/sys/pmList.html b/pccenter/src/main/resources/templates/sys/pmList.html new file mode 100644 index 0000000..6e4aaf1 --- /dev/null +++ b/pccenter/src/main/resources/templates/sys/pmList.html @@ -0,0 +1,188 @@ + + + + + 物业审核 + + + +
    +
    +
    +
    +
    +
    + +
    + +
    +
    +
    + + +
    + +
    +
    +
    +
    + +
    + +
    + + +
    + +
    +
    + +
    +
    + +
    +
    +
    + + + + + + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/templates/sys/reply.html b/pccenter/src/main/resources/templates/sys/reply.html new file mode 100644 index 0000000..dae2c28 --- /dev/null +++ b/pccenter/src/main/resources/templates/sys/reply.html @@ -0,0 +1,56 @@ + + + + + Title + + + +
    + +
    + +
    + +
    +
    +
    +
    + + +
    +
    +
    + + + + + \ No newline at end of file diff --git a/pccenter/src/main/resources/templates/sys/roleList.html b/pccenter/src/main/resources/templates/sys/roleList.html index 895701e..a2d3567 100644 --- a/pccenter/src/main/resources/templates/sys/roleList.html +++ b/pccenter/src/main/resources/templates/sys/roleList.html @@ -1,5 +1,5 @@ - + 角色列表 @@ -7,19 +7,29 @@
    + + + + + + + \ No newline at end of file -- Gitee From 61bb82f9e77e45fc0cccf747cf1cc727d5452a31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=BD=B3=E4=BC=9F?= <1103390584@qq.com> Date: Tue, 7 Apr 2020 22:55:39 +0800 Subject: [PATCH 18/27] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/woniu/controller/PayCollectController.java | 5 +++-- .../java/com/woniu/controller/PayController.java | 12 ++++++------ .../java/com/woniu/dao/CollectServiceMapper.java | 2 ++ .../java/com/woniu/dao/PropertyPaydtoMapper.java | 2 +- .../com/woniu/service/ServiceCollectService.java | 2 +- propertydemo/src/main/resources/application.yml | 2 +- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/propertydemo/src/main/java/com/woniu/controller/PayCollectController.java b/propertydemo/src/main/java/com/woniu/controller/PayCollectController.java index 4cfabba..f387045 100644 --- a/propertydemo/src/main/java/com/woniu/controller/PayCollectController.java +++ b/propertydemo/src/main/java/com/woniu/controller/PayCollectController.java @@ -20,9 +20,10 @@ public class PayCollectController { private ServiceCollectService serviceCollectService; //加载收藏服务列表 - @GetMapping("/selectCollectservice/{userid}") - public @ResponseBody CommonResult collectServicelist(@PathVariable("userid") Integer userid) + @GetMapping("/selectCollectservice") + public @ResponseBody CommonResult collectServicelist() { + Integer userid=1; try { List collects=serviceCollectService.selectCollectService(userid); return CommonResult.success(collects); diff --git a/propertydemo/src/main/java/com/woniu/controller/PayController.java b/propertydemo/src/main/java/com/woniu/controller/PayController.java index 89f2baf..9a9b519 100644 --- a/propertydemo/src/main/java/com/woniu/controller/PayController.java +++ b/propertydemo/src/main/java/com/woniu/controller/PayController.java @@ -69,7 +69,7 @@ public class PayController { } //收藏服务 - @PostMapping("/collectservice") + @RequestMapping("/collectservice") @ResponseBody public CommonResult collectService(CollectService collectService){ collectService.setUserid(1); @@ -87,14 +87,14 @@ public class PayController { } //删除收藏服务 - @PostMapping("/deleteCollectservice") + @RequestMapping("/deleteCollectservice") @ResponseBody - public CommonResult deletecollectService(CollectService collectService) + public CommonResult deletecollectService(Integer serviceid) { - System.out.println(collectService.getServiceid()); - collectService.setUserid(1); + System.out.println(serviceid); + Integer userid=1; try { - serviceCollectService.deleteCollectService(collectService.getServiceid(),collectService.getUserid()); + serviceCollectService.deleteCollectService(serviceid,userid); return CommonResult.success("删除成功"); } catch (Exception e) { e.printStackTrace(); diff --git a/propertydemo/src/main/java/com/woniu/dao/CollectServiceMapper.java b/propertydemo/src/main/java/com/woniu/dao/CollectServiceMapper.java index ca2ce9b..6649097 100644 --- a/propertydemo/src/main/java/com/woniu/dao/CollectServiceMapper.java +++ b/propertydemo/src/main/java/com/woniu/dao/CollectServiceMapper.java @@ -1,6 +1,7 @@ package com.woniu.dao; import com.woniu.pojo.CollectService; +import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Select; public interface CollectServiceMapper { @@ -16,6 +17,7 @@ public interface CollectServiceMapper { int updateByPrimaryKey(CollectService record); + @Delete("delete from collect_service where serviceid=#{serviceid} and userid=#{userid}") void deleteByuserIdAndServiceId(Integer serviceid,Integer userid); @Select("select serviceid from collect_service where userid=#{value}") diff --git a/propertydemo/src/main/java/com/woniu/dao/PropertyPaydtoMapper.java b/propertydemo/src/main/java/com/woniu/dao/PropertyPaydtoMapper.java index a89d105..97bc415 100644 --- a/propertydemo/src/main/java/com/woniu/dao/PropertyPaydtoMapper.java +++ b/propertydemo/src/main/java/com/woniu/dao/PropertyPaydtoMapper.java @@ -14,6 +14,6 @@ public interface PropertyPaydtoMapper { @Select("select pp.payname,pp.payprice,pp.paytime,pp.icon,pp.id,bi.nickname from pp_payservice pp,business_info bi where pp.shopid=bi.id and pp.service_type=0 and pp.shopid=#{value}") List selectByShopId(Integer ShopId); - @Select("select pp.payname,pp.payprice,pp.paytime,pp.icon,pm.username,pp.id from pp_payservice pp,property_manage pm,collect_service cs where pp.propertyid=pm.id and cs.serviceid=pp.id and cs.userid=#{value}") + @Select("select pp.payname,pp.payprice,pp.paytime,pp.icon,pp.id from pp_payservice pp,collect_service cs where cs.serviceid=pp.id and cs.userid=#{value}") List selectcollectPayByUserId(Integer userid); } diff --git a/propertydemo/src/main/java/com/woniu/service/ServiceCollectService.java b/propertydemo/src/main/java/com/woniu/service/ServiceCollectService.java index 7bf582d..ead9312 100644 --- a/propertydemo/src/main/java/com/woniu/service/ServiceCollectService.java +++ b/propertydemo/src/main/java/com/woniu/service/ServiceCollectService.java @@ -11,7 +11,7 @@ public interface ServiceCollectService { List selectCollectService(Integer userid); - void deleteCollectService(Integer serviceid,Integer userid); + void deleteCollectService(Integer userid,Integer serviceid); Integer selectserviceidByuserid(Integer userid); } diff --git a/propertydemo/src/main/resources/application.yml b/propertydemo/src/main/resources/application.yml index be91b0b..b632c01 100644 --- a/propertydemo/src/main/resources/application.yml +++ b/propertydemo/src/main/resources/application.yml @@ -17,7 +17,7 @@ spring: eureka: client: service-url: - defaultZone: http://106.12.148.100:8081/registor-0.1/eureka + defaultZone: http://localhost:8761/eureka mybatis: mapper-locations: classpath:mapper/*.xml configuration: -- Gitee From 7ced510f4371979b73c5fe378c254d8bb10e55bd Mon Sep 17 00:00:00 2001 From: jingkang <1248303996@qq.com> Date: Wed, 8 Apr 2020 11:32:06 +0800 Subject: [PATCH 19/27] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=B8=9A=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pccenter/src/main/java/com/woniu/config/ShiroConfig.java | 2 +- .../java/com/woniu/controller/ActivityController.java | 5 +++-- pccenter/src/main/java/com/woniu/dao/ActivityMapper.java | 8 ++++---- .../src/main/java/com/woniu/service/ActivityService.java | 2 +- .../java/com/woniu/service/impl/ActivityServiceImpl.java | 4 ++-- pccenter/src/main/resources/mapper/ActivityMapper.xml | 2 +- .../src/main/resources/mapper/PropertyManageMapper.xml | 4 ++-- pccenter/src/main/resources/templates/login.html | 9 +++++++-- pccenter/src/main/resources/templates/sys/ac_reply.html | 2 +- .../src/main/resources/templates/sys/activityList.html | 8 ++++---- pccenter/src/main/resources/templates/sys/addAdmin.html | 2 +- pccenter/src/main/resources/templates/sys/adminList.html | 2 +- .../src/main/resources/templates/sys/complainList.html | 2 +- .../src/main/resources/templates/sys/merchantList.html | 2 +- pccenter/src/main/resources/templates/sys/pmList.html | 2 +- pccenter/src/main/resources/templates/sys/reply.html | 2 +- 16 files changed, 32 insertions(+), 26 deletions(-) diff --git a/pccenter/src/main/java/com/woniu/config/ShiroConfig.java b/pccenter/src/main/java/com/woniu/config/ShiroConfig.java index 401acde..e40264f 100644 --- a/pccenter/src/main/java/com/woniu/config/ShiroConfig.java +++ b/pccenter/src/main/java/com/woniu/config/ShiroConfig.java @@ -27,7 +27,7 @@ public class ShiroConfig { customRealm.setCacheManager(cacheManager); return customRealm; } - // + //shiro核心控制器 @Bean public DefaultWebSecurityManager securityManager(CustomRealm customRealm,CookieRememberMeManager rememberMeManager){ DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(); diff --git a/pccenter/src/main/java/com/woniu/controller/ActivityController.java b/pccenter/src/main/java/com/woniu/controller/ActivityController.java index b55dc5d..fc5f701 100644 --- a/pccenter/src/main/java/com/woniu/controller/ActivityController.java +++ b/pccenter/src/main/java/com/woniu/controller/ActivityController.java @@ -50,6 +50,7 @@ public class ActivityController { @ResponseBody @RequiresPermissions("sys:al:examine") public CommonResult confirmPM(@PathVariable("id") Integer id){ + System.out.println("活动确认审核"+id); Date examineTime=new Date(); try { activityService.editStatusById(id,examineTime); @@ -89,9 +90,9 @@ public class ActivityController { @ResponseBody public CommonResult refuse(@PathVariable("id")Integer id){ //获取当前时间 - Date operationTime=new Date(); + Date examineTime=new Date(); try { - activityService.refuse(id,operationTime); + activityService.refuse(id,examineTime); return CommonResult.success("操作成功!"); } catch (Exception e) { e.printStackTrace(); diff --git a/pccenter/src/main/java/com/woniu/dao/ActivityMapper.java b/pccenter/src/main/java/com/woniu/dao/ActivityMapper.java index 32b13b7..049eb36 100644 --- a/pccenter/src/main/java/com/woniu/dao/ActivityMapper.java +++ b/pccenter/src/main/java/com/woniu/dao/ActivityMapper.java @@ -10,15 +10,15 @@ import java.util.List; public interface ActivityMapper { - @Select("select ca.id,ca.ca_type type,ca.ca_examineTime operationTime,ca.ca_title title,ca.ca_content content,ca.ca_money money,ca.ca_peopel_count number,ca.ca_create_time createTime,ca.ca_examine_status status,pu.nickname name from " + + @Select("select ca.id,ca.ca_type type,ca.ca_examinetime operationTime,ca.ca_title title,ca.ca_content content,ca.ca_money money,ca.ca_peopel_count number,ca.ca_create_time createTime,ca.ca_examine_status status,pu.nickname name from " + "person_user pu inner join community_activity ca on pu.id=ca.ca_user_id order by ca.id desc") List findByPage(@Param("currentPage") Integer currentPage, @Param("pageSize") Integer pageSize); - @Update("update community_activity set ca_examine_status = 1,ca_examineTime = #{operationTime} where id=#{value}") + @Update("update community_activity set ca_examine_status = 1,ca_examinetime = #{examineTime} where id=#{id}") void editStatusById(@Param("id") Integer id,@Param("examineTime") Date examineTime); List select(@Param("name") String name, @Param("status") Integer status); - @Update("update community_activity set ca_examine_status = 2,ca_examineTime = #{operationTime} where id=#{value}") - void refuse(@Param("id") Integer id, @Param("operationTime") Date operationTime); + @Update("update community_activity set ca_examine_status = 2,ca_examinetime = #{operationTime} where id=#{id}") + void refuse(@Param("id") Integer id, @Param("operationTime") Date examineTime); } diff --git a/pccenter/src/main/java/com/woniu/service/ActivityService.java b/pccenter/src/main/java/com/woniu/service/ActivityService.java index 466e268..001d445 100644 --- a/pccenter/src/main/java/com/woniu/service/ActivityService.java +++ b/pccenter/src/main/java/com/woniu/service/ActivityService.java @@ -12,5 +12,5 @@ public interface ActivityService { List select(String name, Integer status); - void refuse(Integer id, Date operationTime); + void refuse(Integer id, Date examineTime); } diff --git a/pccenter/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java b/pccenter/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java index 9d4a0a2..fa79c86 100644 --- a/pccenter/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java +++ b/pccenter/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java @@ -34,7 +34,7 @@ public class ActivityServiceImpl implements ActivityService { } @Override - public void refuse(Integer id, Date operationTime) { - activityMapper.refuse(id,operationTime); + public void refuse(Integer id, Date examineTime) { + activityMapper.refuse(id,examineTime); } } diff --git a/pccenter/src/main/resources/mapper/ActivityMapper.xml b/pccenter/src/main/resources/mapper/ActivityMapper.xml index a537259..6c956fb 100644 --- a/pccenter/src/main/resources/mapper/ActivityMapper.xml +++ b/pccenter/src/main/resources/mapper/ActivityMapper.xml @@ -3,7 +3,7 @@ - select manage.id,manage.username userName,manage.phone phone,manage.status,manage.create_time createTime,manage.pass_time passTime,af.area_name areaName from property_manage manage left join areainfo af on manage.village_id=af.id order by manage.id desc + select manage.id,manage.username userName,manage.phone phone,manage.status,manage.create_time createTime,manage.pass_time passTime,af.area_name areaName from property_manage manage inner join areainfo af on manage.village_id=af.id order by manage.id desc
    - +
    diff --git a/pccenter/src/main/resources/templates/sys/activityList.html b/pccenter/src/main/resources/templates/sys/activityList.html index 59e33f4..4abd18c 100644 --- a/pccenter/src/main/resources/templates/sys/activityList.html +++ b/pccenter/src/main/resources/templates/sys/activityList.html @@ -12,7 +12,7 @@
    - +
    @@ -87,14 +87,14 @@ {type: 'checkbox'}, {title: '编号ID', field: 'id', width: 80}, {title: '用户名称', field: 'name', width: 120}, - {title: '活动类型', field: 'type', width: 120, templet: '#typeEdit'}, + {title: '活动类型', field: 'type', width: 100, templet: '#typeEdit'}, {title: '活动标题', field: 'title', width: 120}, {title: '活动内容', field: 'content', width: 120}, - {title: '参与人数', field: 'number', width: 120}, + {title: '参与人数', field: 'number', width: 100}, {title: '创建时间', field: 'createTime', width: 120}, {title: '操作时间', field: 'operationTime', width: 120}, {title: '审批状态', field: 'status', templet: '#statusEdit', width: 120}, - {title: '操作', templet: '#barEdit', width: 170} + {title: '操作', templet: '#barEdit', width: 180} ] ], parseData: function (result) { diff --git a/pccenter/src/main/resources/templates/sys/addAdmin.html b/pccenter/src/main/resources/templates/sys/addAdmin.html index 99bb10a..328f878 100644 --- a/pccenter/src/main/resources/templates/sys/addAdmin.html +++ b/pccenter/src/main/resources/templates/sys/addAdmin.html @@ -40,7 +40,7 @@
    - +
    diff --git a/pccenter/src/main/resources/templates/sys/adminList.html b/pccenter/src/main/resources/templates/sys/adminList.html index 825cd29..4c7a54d 100644 --- a/pccenter/src/main/resources/templates/sys/adminList.html +++ b/pccenter/src/main/resources/templates/sys/adminList.html @@ -143,7 +143,7 @@ layer.open({ type: 2, title: '编辑管理员', - area: ['400px', '5000px'], + area: ['400px', '500px'], content: '/admin/editAdmin/' + data.id }); } else if (event === 'del') {//执行删除 diff --git a/pccenter/src/main/resources/templates/sys/complainList.html b/pccenter/src/main/resources/templates/sys/complainList.html index 7c02c80..2471470 100644 --- a/pccenter/src/main/resources/templates/sys/complainList.html +++ b/pccenter/src/main/resources/templates/sys/complainList.html @@ -107,7 +107,7 @@ layer.open({ type: 2, title: '投诉回复', - area: ['400px', '400px'], + area: ['350px', '350px'], content: '/complain/reply/' + data.id }); } diff --git a/pccenter/src/main/resources/templates/sys/merchantList.html b/pccenter/src/main/resources/templates/sys/merchantList.html index c21d63b..54fb4f8 100644 --- a/pccenter/src/main/resources/templates/sys/merchantList.html +++ b/pccenter/src/main/resources/templates/sys/merchantList.html @@ -83,7 +83,7 @@ {title: '商家介绍', field: 'introduce', width: 120}, {title: '审批状态', field: 'status', templet: '#statusEdit', width: 120}, {title: '操作时间', field: 'operationTime', width: 120}, - {title: '操作', templet: '#barEdit', width: 170} + {title: '操作', templet: '#barEdit', width: 180} ] ], parseData: function (result) { diff --git a/pccenter/src/main/resources/templates/sys/pmList.html b/pccenter/src/main/resources/templates/sys/pmList.html index 6e4aaf1..4af9977 100644 --- a/pccenter/src/main/resources/templates/sys/pmList.html +++ b/pccenter/src/main/resources/templates/sys/pmList.html @@ -100,7 +100,7 @@ {title: '审批状态', field: 'status', templet: '#statusEdit', width: 150}, {title: '创建时间', field: 'createTime', width: 150}, {title: '操作时间', field: 'passTime', width: 150}, - {title: '操作', templet: '#barEdit'} + {title: '操作', templet: '#barEdit', width: 180} ] ], parseData: function (result) { diff --git a/pccenter/src/main/resources/templates/sys/reply.html b/pccenter/src/main/resources/templates/sys/reply.html index dae2c28..cd2cb47 100644 --- a/pccenter/src/main/resources/templates/sys/reply.html +++ b/pccenter/src/main/resources/templates/sys/reply.html @@ -9,7 +9,7 @@
    - +
    -- Gitee From 8419b86ec129f1fe4d0b17660bf2bd9868b55aa0 Mon Sep 17 00:00:00 2001 From: starlbb Date: Thu, 9 Apr 2020 15:24:34 +0800 Subject: [PATCH 20/27] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- communityservice/pom.xml | 10 ++++++ .../woniu/CommunityserviceApplication.java | 2 ++ .../java/com/woniu/config/RedisConfig.java | 34 +++++++++++++++++++ .../woniu/controller/ActivityController.java | 9 +++++ .../woniu/controller/DynamicController.java | 1 + .../main/java/com/woniu/pojo/Activity.java | 3 +- .../com/woniu/service/ActivityService.java | 20 +++++++++++ .../service/impl/ActivityServiceImpl.java | 20 +++++++++++ .../com/woniu/util/ActivityScheduler.java | 22 +++++++----- .../woniu/service/impl/PayServiceImpl.java | 3 +- 10 files changed, 114 insertions(+), 10 deletions(-) create mode 100644 communityservice/src/main/java/com/woniu/config/RedisConfig.java diff --git a/communityservice/pom.xml b/communityservice/pom.xml index 343ebc6..8e45ebd 100644 --- a/communityservice/pom.xml +++ b/communityservice/pom.xml @@ -102,6 +102,16 @@ 1.2.10 + + + + + + + org.springframework.boot + spring-boot-starter-data-redis + + diff --git a/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java b/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java index 05cc610..f511304 100644 --- a/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java +++ b/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java @@ -3,6 +3,7 @@ package com.woniu; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cache.annotation.EnableCaching; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.scheduling.annotation.EnableScheduling; @@ -10,6 +11,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; @MapperScan(value = "com.woniu.dao") @EnableEurekaClient //开启eureka客户端 @EnableScheduling //开启定时器 +@EnableCaching //开启缓存 public class CommunityserviceApplication { public static void main(String[] args) { diff --git a/communityservice/src/main/java/com/woniu/config/RedisConfig.java b/communityservice/src/main/java/com/woniu/config/RedisConfig.java new file mode 100644 index 0000000..ad7a80b --- /dev/null +++ b/communityservice/src/main/java/com/woniu/config/RedisConfig.java @@ -0,0 +1,34 @@ +package com.woniu.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.RedisSerializationContext; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +@Configuration +public class RedisConfig { + @Bean + public RedisCacheConfiguration redisCacheConfiguration(){ + RedisCacheConfiguration configuration = RedisCacheConfiguration.defaultCacheConfig(); + configuration = configuration.serializeKeysWith(RedisSerializationContext + .SerializationPair.fromSerializer(new StringRedisSerializer())) + .serializeValuesWith(RedisSerializationContext + .SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer())); + return configuration; + } + + @Bean + public RedisTemplate redisTemplate(RedisConnectionFactory factory){ + RedisTemplate r = new RedisTemplate(); + r.setConnectionFactory(factory); + r.setHashValueSerializer(new GenericJackson2JsonRedisSerializer()); + r.setHashKeySerializer(new StringRedisSerializer()); + r.setValueSerializer(new GenericJackson2JsonRedisSerializer()); + r.setKeySerializer(new StringRedisSerializer()); + return r; + } +} diff --git a/communityservice/src/main/java/com/woniu/controller/ActivityController.java b/communityservice/src/main/java/com/woniu/controller/ActivityController.java index 4a56222..5d5247c 100644 --- a/communityservice/src/main/java/com/woniu/controller/ActivityController.java +++ b/communityservice/src/main/java/com/woniu/controller/ActivityController.java @@ -54,6 +54,7 @@ public class ActivityController { @RequestMapping("/activitySave") @ResponseBody public CommonResult ActivitySave(@RequestBody String activity){ + System.out.println("*******--------"); try { //转化成真实的值 String act = URLDecoder.decode(activity,"UTF-8"); @@ -193,4 +194,12 @@ public class ActivityController { return CommonResult.success(coNum); } + @GetMapping("/getContent") + @ResponseBody + public CommonResult getContent(Integer activityId){ + System.out.println(activityId); + String content = activityService.selectContent(activityId); + return CommonResult.success(content); + } + } diff --git a/communityservice/src/main/java/com/woniu/controller/DynamicController.java b/communityservice/src/main/java/com/woniu/controller/DynamicController.java index 453fd02..1fdd31f 100644 --- a/communityservice/src/main/java/com/woniu/controller/DynamicController.java +++ b/communityservice/src/main/java/com/woniu/controller/DynamicController.java @@ -35,6 +35,7 @@ public class DynamicController { @PostMapping("/upload") @ResponseBody public CommonResult upload(MultipartFile file){ + System.out.println("*********"); if(file==null){ return CommonResult.failed("请选择上传图片"); } diff --git a/communityservice/src/main/java/com/woniu/pojo/Activity.java b/communityservice/src/main/java/com/woniu/pojo/Activity.java index 183056f..60808ee 100644 --- a/communityservice/src/main/java/com/woniu/pojo/Activity.java +++ b/communityservice/src/main/java/com/woniu/pojo/Activity.java @@ -2,10 +2,11 @@ package com.woniu.pojo; import lombok.Data; +import java.io.Serializable; import java.util.Date; @Data -public class Activity { +public class Activity implements Serializable { private Integer id; private Integer caUserId; diff --git a/communityservice/src/main/java/com/woniu/service/ActivityService.java b/communityservice/src/main/java/com/woniu/service/ActivityService.java index f2e823a..60fe872 100644 --- a/communityservice/src/main/java/com/woniu/service/ActivityService.java +++ b/communityservice/src/main/java/com/woniu/service/ActivityService.java @@ -3,6 +3,7 @@ package com.woniu.service; import com.woniu.dto.ActivityDetail; import com.woniu.dto.ActivityPost; import com.woniu.dto.MyActivityPost; +import com.woniu.pojo.Activity; import java.util.List; import java.util.Map; @@ -80,4 +81,23 @@ public interface ActivityService { * @return */ String findCoNum(Integer activityId, Integer userId); + + /** + * 查询所有活动 + * @return + */ + List selectAll(String act); + + /** + * 更新活动状态 + * @param activity + */ + void updateActivity(Activity activity,String act); + + /** + * 查找活动内容 + * @param activityId + * @return + */ + String selectContent(Integer activityId); } diff --git a/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java b/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java index 5958feb..36bfbfb 100644 --- a/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java +++ b/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java @@ -13,6 +13,8 @@ import com.woniu.pojo.ActivityUser; import com.woniu.pojo.CommunityOrder; import com.woniu.service.ActivityService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import java.text.ParseException; @@ -250,4 +252,22 @@ public class ActivityServiceImpl implements ActivityService { return communityOrderMapper.selectById(activityId,userId).get(0); } + @Override + @Cacheable(value = "activitys",key = "#act") + public List selectAll(String act) { + System.out.println("查询数据库"); + return activityMapper.selectAll(); + } + + @Override + @CacheEvict(value = "activitys",key = "#act") + public void updateActivity(Activity activity,String act) { + activityMapper.updateByPrimaryKeySelective(activity); + } + + @Override + public String selectContent(Integer activityId) { + return activityMapper.selectByPrimaryKey(activityId).getCaContent(); + } + } diff --git a/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java b/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java index d50794d..a302506 100644 --- a/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java +++ b/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java @@ -1,8 +1,9 @@ package com.woniu.util; -import com.woniu.dao.ActivityMapper; import com.woniu.pojo.Activity; +import com.woniu.service.ActivityService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -13,14 +14,17 @@ import java.util.List; public class ActivityScheduler { @Autowired - private ActivityMapper activityMapper; + private ActivityService activityService; + @Autowired + private RedisTemplate redisTemplate; /** * 每隔1分钟更新一次活动状态 */ - @Scheduled(cron = "0 0/1 * * * ? ") + @Scheduled(cron = "0/30 * * * * ? ") public void updateActivity(){ - List activities = activityMapper.selectAll(); + List activities = activityService.selectAll("activityAll"); + System.out.println(activities.get(3).getCaStartTime()); //获取现在时间 Date nowTime = new Date(); for(Activity activity:activities){ @@ -28,12 +32,14 @@ public class ActivityScheduler { Date startTime = activity.getCaStartTime(); Date endTime = activity.getCaEndTime(); //判断,定时重置状态 - if(nowTime.before(endTime) && nowTime.after(startTime)){ + if(nowTime.before(endTime) && nowTime.after(startTime) && activity.getCaStatus()!=1){ activity.setCaStatus(1); - activityMapper.updateByPrimaryKeySelective(activity); - }else if(nowTime.after(endTime)){ + activityService.updateActivity(activity,"activityAll"); +// redisTemplate.delete("activityAll"); + }else if(nowTime.after(endTime) && activity.getCaStatus()!=2){ activity.setCaStatus(2); - activityMapper.updateByPrimaryKeySelective(activity); + activityService.updateActivity(activity,"activityAll"); +// redisTemplate.delete("activityAll"); } } } diff --git a/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java b/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java index 5e15c3e..852753a 100644 --- a/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java +++ b/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java @@ -80,7 +80,7 @@ public class PayServiceImpl implements PayService { //支付方式 // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();// APP支付 // AlipayTradePagePayRequest request = new AlipayTradePagePayRequest(); // 网页支付 - AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); //移动h5 + AlipayTradeWapPayRequest request = new AlipayTradeWapPayRequest(); //移动h5 //异步同步通知跳转url @@ -97,6 +97,7 @@ public class PayServiceImpl implements PayService { } catch (AlipayApiException e) { e.printStackTrace(); } + System.out.println(response); return response; } -- Gitee From eecbdd0789ed19177fd8a46acfde3b6684a96859 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=B4=8B?= <2870485806@qq.com> Date: Fri, 10 Apr 2020 14:24:05 +0800 Subject: [PATCH 21/27] =?UTF-8?q?=E5=95=86=E5=AE=B6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- businessservice/pom.xml | 32 +++++- .../BusinessserviceApplication.java | 2 + .../config/RabbitMQConfig.java | 18 ++++ .../config/Swagger2Config.java | 18 ++++ .../controller/AreainfoController.java | 6 ++ .../controller/BusinessImageController.java | 14 ++- .../controller/BusinessInfoController.java | 99 ++++++++++++++++++- .../controller/EvaluateServiceController.java | 37 ------- .../controller/PpPayserviceController.java | 32 ++++++ .../controller/ServiceImgController.java | 7 ++ .../controller/ServiceOrderController.java | 60 ++++++++++- .../businessservice/entity/Areainfo.java | 12 ++- .../businessservice/entity/BusinessImage.java | 12 ++- .../businessservice/entity/BusinessInfo.java | 43 ++++---- .../entity/BusinessInfoAreainfo.java | 8 +- .../businessservice/entity/EarnIng.java | 9 +- .../entity/EvaluateService.java | 10 +- .../businessservice/entity/ImgUrlService.java | 8 +- .../businessservice/entity/MyCenter.java | 10 +- .../businessservice/entity/OrderClassify.java | 13 ++- .../businessservice/entity/OrderDetails.java | 11 ++- .../businessservice/entity/PageInfo.java | 1 + .../businessservice/entity/PpPayservice.java | 27 +++-- .../businessservice/entity/ServiceImg.java | 10 +- .../businessservice/entity/ServiceOrder.java | 20 ++-- .../businessservice/mq/PhoneCode.java | 2 +- .../businessservice/mq/RefundCode.java | 44 +++++++++ 27 files changed, 456 insertions(+), 109 deletions(-) create mode 100644 businessservice/src/main/java/com/team7/happycommunity/businessservice/config/Swagger2Config.java delete mode 100644 businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/EvaluateServiceController.java create mode 100644 businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/RefundCode.java diff --git a/businessservice/pom.xml b/businessservice/pom.xml index 285c039..71cb92f 100644 --- a/businessservice/pom.xml +++ b/businessservice/pom.xml @@ -19,6 +19,36 @@ + + io.springfox + springfox-swagger2 + 2.9.2 + + + io.swagger + swagger-annotations + + + io.swagger + swagger-models + + + + + io.springfox + springfox-swagger-ui + 2.9.2 + + + io.swagger + swagger-annotations + 1.5.21 + + + io.swagger + swagger-models + 1.5.21 + com.github.pagehelper pagehelper-spring-boot-starter @@ -88,6 +118,7 @@ org.springframework.boot spring-boot-starter-data-redis + @@ -139,7 +170,6 @@ spring-session-data-redis 2.2.2.RELEASE - diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/BusinessserviceApplication.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/BusinessserviceApplication.java index efb5e15..1a09788 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/BusinessserviceApplication.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/BusinessserviceApplication.java @@ -15,12 +15,14 @@ import org.springframework.data.redis.serializer.RedisSerializationContext; import org.springframework.data.redis.serializer.StringRedisSerializer; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession; +import springfox.documentation.swagger2.annotations.EnableSwagger2; @SpringBootApplication @MapperScan("com.team7.happycommunity.businessservice.dao") @EnableCaching//开启声明式缓存 @EnableRedisHttpSession @EnableEurekaClient + public class BusinessserviceApplication { public static void main(String[] args) { diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/config/RabbitMQConfig.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/config/RabbitMQConfig.java index d59eda0..f5138fd 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/config/RabbitMQConfig.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/config/RabbitMQConfig.java @@ -41,4 +41,22 @@ public class RabbitMQConfig { public Binding queueBingToExchangeDead(){ return BindingBuilder.bind(DeadQueue()).to(topicDeadExchange()).with("phone.code.dead"); } + + /** + * 对款订单的 + * @return + */ + @Bean + public Queue queue2(){ + + return new Queue("refund_code_queue",true,false,false); + } + @Bean + public TopicExchange topicExchange2(){ + return new TopicExchange("refund_code_exchange"); + } + @Bean + public Binding queueBingToExchange2(){ + return BindingBuilder.bind(queue2()).to(topicExchange2()).with("refund.#"); + } } diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/config/Swagger2Config.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/config/Swagger2Config.java new file mode 100644 index 0000000..c27dd73 --- /dev/null +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/config/Swagger2Config.java @@ -0,0 +1,18 @@ +package com.team7.happycommunity.businessservice.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@EnableSwagger2 +@Configuration +public class Swagger2Config { + + @Bean + public Docket decket(){ + return new Docket(DocumentationType.SWAGGER_2); + } + +} diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/AreainfoController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/AreainfoController.java index b2dcf69..b7a9d35 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/AreainfoController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/AreainfoController.java @@ -2,6 +2,7 @@ package com.team7.happycommunity.businessservice.controller; import com.team7.happycommunity.businessservice.entity.Areainfo; import com.team7.happycommunity.businessservice.service.AreainfoService; +import io.swagger.annotations.*; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -16,6 +17,7 @@ import javax.annotation.Resource; */ @RestController @RequestMapping("areainfo") +@Api(tags="小区信息管理接口") public class AreainfoController { /** * 服务对象 @@ -30,6 +32,10 @@ public class AreainfoController { * @return 单条数据 */ @GetMapping("selectOne") + @ApiOperation(value = "查询小区信息") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "id",value = "用户id",required = true), + }) public Areainfo selectOne(Integer id) { return this.areainfoService.queryById(id); } diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessImageController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessImageController.java index 8a1c420..af7bf38 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessImageController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessImageController.java @@ -4,6 +4,7 @@ import com.team7.happycommunity.businessservice.common.CommonResult; import com.team7.happycommunity.businessservice.entity.BusinessImage; import com.team7.happycommunity.businessservice.service.BusinessImageService; import com.team7.happycommunity.businessservice.util.QiniuUploadUtil; +import io.swagger.annotations.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -19,6 +20,7 @@ import java.util.UUID; */ @RestController @RequestMapping("businessImage") +@Api(tags="商家图片管理接口") public class BusinessImageController { /** * 服务对象 @@ -46,6 +48,16 @@ public class BusinessImageController { */ @PostMapping("/uploadHead") @ResponseBody + @ApiOperation(value = "图片上传或者修改",notes = "前端要提交的参数名称:file图片,userId是用户id") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "file",value = "图片",required = true), + @ApiImplicitParam(name = "userId",value = "用户id",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "上传成功"), + @ApiResponse(code = 500,message = "上传失败") + }) public CommonResult uploadHead(MultipartFile file,Integer userId){ String name= UUID.randomUUID().toString().replace("_",""); try { @@ -54,7 +66,7 @@ public class BusinessImageController { return CommonResult.success("上传成功"); } catch (IOException e) { e.printStackTrace(); - return CommonResult.success("上传失败"); + return CommonResult.failed("上传失败"); } } diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java index f6fd710..3a2a370 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/BusinessInfoController.java @@ -7,6 +7,7 @@ import com.team7.happycommunity.businessservice.exception.LoginException; import com.team7.happycommunity.businessservice.exception.MailboxStatusException; import com.team7.happycommunity.businessservice.service.AreainfoService; import com.team7.happycommunity.businessservice.service.BusinessInfoService; +import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -24,6 +25,7 @@ import java.util.List; */ @RestController @RequestMapping("businessInfo") +@Api(tags="商家信息管理接口") public class BusinessInfoController { /** * 服务对象 @@ -56,6 +58,16 @@ public class BusinessInfoController { */ @RequestMapping("/subLogin") @ResponseBody + @ApiOperation(value = "用户登录",notes = "前端要提交的参数名称:text登录的手机号或者邮箱,password是用户密码") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "text",value = "登录的手机号或者邮箱",required = true), + @ApiImplicitParam(name = "password",value = "密码",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "登录成功"), + @ApiResponse(code = 500,message = "登录失败") + }) public CommonResult login(String text, String password) throws Exception { if(text==null||password==null){ @@ -77,6 +89,7 @@ public class BusinessInfoController { */ @PostMapping("/mailboxRegister") @ResponseBody + public CommonResult mailboxRegister(BusinessInfo user){ //1.搜索邮箱,邮箱不存在或邮箱状态不为0 boolean flag=businessInfoService.queryMailbox(user.getMailbox()); @@ -95,13 +108,23 @@ public class BusinessInfoController { } /** - * 手机号码注册,密码重置 + * 验证码发送 * @param phone 手机号码 * @param resetCode 密码重置参数,1密码重置,短信登录,0注册 * @return */ @PostMapping("/phoneRegister") @ResponseBody + @ApiOperation(value = "验证码发送",notes = "前端要提交的参数名称:phone是手机号码,resetCode是密码重置参数,1密码重置,短信登录,0注册") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "phone",value = "手机号码",required = true), + @ApiImplicitParam(name = "resetCode",value = "密码重置参数,1密码重置,短信登录,0注册",required = false) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "验证码发送成功"), + @ApiResponse(code = 500,message = "验证码发送失败") + }) public CommonResult phoneRegister(String phone,String resetCode){ if (phone==null||phone.equals("")){ return CommonResult.failed("请输入手机号"); @@ -124,7 +147,18 @@ public class BusinessInfoController { */ @PostMapping("/codeCheck") @ResponseBody - public CommonResult codeCheck(String phone,String code,String password,String name){ + @ApiOperation(value = "验证码校正",notes = "前端要提交的参数名称:phone是手机号码,code是验证码,password是用户密码") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "phone",value = "手机号码",required = true), + @ApiImplicitParam(name = "code",value = "验证码",required = true), + @ApiImplicitParam(name = "password",value = "密码",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "注册成功"), + @ApiResponse(code = 500,message = "注册失败") + }) + public CommonResult codeCheck(String phone,String code,String password){ try { businessInfoService.codeCheck(code,phone); BusinessInfo info=new BusinessInfo(); @@ -147,13 +181,18 @@ public class BusinessInfoController { */ @PostMapping("/addInfo") @ResponseBody + @ApiOperation(value = "添加个人信息",notes = "前端要提交的参数名称:user 是用户信息") + @ApiResponses(value = { + @ApiResponse(code = 200,message = "添加成功"), + @ApiResponse(code = 500,message = "添加失败") + }) public CommonResult addInfo(@RequestBody BusinessInfo user){ try { businessInfoService.updateByCellPhNumber(user); return CommonResult.success(); } catch (Exception e) { e.printStackTrace(); - return CommonResult.failed("注册失败,请联系管理员"); + return CommonResult.failed("添加失败,请联系管理员"); } } /** @@ -163,6 +202,7 @@ public class BusinessInfoController { */ @GetMapping("/activate") @ResponseBody + public ModelAndView activate(String code){ //激活邮箱 ModelAndView mv=new ModelAndView(); @@ -185,6 +225,16 @@ public class BusinessInfoController { * @return */ @PostMapping("/resetPassword") + @ApiOperation(value = "密码修改") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "cellPhNumber",value = "手机号码",required = true), + @ApiImplicitParam(name = "password",value = "新密码",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "修改成功"), + @ApiResponse(code = 500,message = "修改失败") + }) public CommonResult resetPasswordByPhone(String cellPhNumber,String password){ if (password==null){ return CommonResult.failed("密码不能为空"); @@ -203,6 +253,7 @@ public class BusinessInfoController { * @return */ @GetMapping("/queruyPersonageInfo") + @ApiOperation(value = "查询个人信息") public MyCenter queruyPersonageInfo(){ String userId = request.getHeader("userId"); Integer value = Integer.valueOf(userId); @@ -218,6 +269,7 @@ public class BusinessInfoController { * @return */ @GetMapping("/orderSum") + @ApiOperation(value = "查询商家拥有的订单数") public MyCenter orderSum(){ String userId = request.getHeader("userId"); Integer value = Integer.valueOf(userId); @@ -234,6 +286,7 @@ public class BusinessInfoController { * @return */ @GetMapping("/bookOrederSum") + @ApiOperation(value = "查询商家拥有的预订单数") public MyCenter bookOrederSum(){ String userId = request.getHeader("userId"); Integer value = Integer.valueOf(userId); @@ -250,6 +303,7 @@ public class BusinessInfoController { * @return */ @GetMapping("/queryByUserId") + @ApiOperation(value = "查询商家查询其个人信息") public BusinessInfoAreainfo queryByUserId(){ String userId = request.getHeader("userId"); Integer value = Integer.valueOf(userId); @@ -262,7 +316,8 @@ public class BusinessInfoController { } @GetMapping("/noteSubLogin") - public BusinessInfoAreainfo noteSubLogin(String phone){ + @ApiOperation(value = "查询商家个人信息") + public BusinessInfoAreainfo noteSubLogin( ){ String userId = request.getHeader("userId"); Integer value = Integer.valueOf(userId); BusinessInfoAreainfo infoareainfo=new BusinessInfoAreainfo(); @@ -282,6 +337,16 @@ public class BusinessInfoController { */ @PostMapping("/noteLogn") @ResponseBody + @ApiOperation(value = "短信登录") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "phone",value = "电话号码",required = true), + @ApiImplicitParam(name = "code",value = "验证码",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "登录成功"), + @ApiResponse(code = 500,message = "登录失败") + }) public CommonResult noteLogn(String phone,String code){ try { @@ -307,6 +372,10 @@ public class BusinessInfoController { * @return */ @GetMapping("/queryIncome") + @ApiOperation(value = "查询收益") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "userId",value = "用户id",required = true), + }) public String queryIncome(Integer userId){ String money=businessInfoService.queryIncome(userId); if(money==null||money.equals("0")){ @@ -321,6 +390,15 @@ public class BusinessInfoController { * @return */ @RequestMapping("/alterUserInfo") + @ApiOperation(value = "根据用户的id修改昵称") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "areaAddress",value = "小区地址",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "修改成功"), + @ApiResponse(code = 500,message = "修改失败") + }) public CommonResult alterUserInfo(BusinessInfo info,String areaAddress){ if(info.getId()==null){ return CommonResult.failed("用户未登录"); @@ -346,7 +424,7 @@ public class BusinessInfoController { return CommonResult.success("修改成功"); } catch (Exception e) { e.printStackTrace(); - return CommonResult.failed("修改成功"); + return CommonResult.failed("修改失败"); } } @@ -360,6 +438,17 @@ public class BusinessInfoController { */ @PostMapping("/alterPhone") @ResponseBody + @ApiOperation(value = "修改手机号") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "phone",value = "手机号码",required = true), + @ApiImplicitParam(name = "code",value = "验证码",required = true), + @ApiImplicitParam(name = "userId",value = "用户id",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "修改成功"), + @ApiResponse(code = 500,message = "修改失败") + }) public CommonResult alterPhone(String phone,String code,Integer userId){ if(userId==null||userId.equals("")){ return CommonResult.failed("用户未登录"); diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/EvaluateServiceController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/EvaluateServiceController.java deleted file mode 100644 index 380c449..0000000 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/EvaluateServiceController.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.team7.happycommunity.businessservice.controller; - -import com.team7.happycommunity.businessservice.entity.EvaluateService; -import com.team7.happycommunity.businessservice.service.EvaluateServiceService; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -/** - * (EvaluateService)表控制层 - * - * @author makejava - * @since 2020-03-28 10:41:54 - */ -@RestController -@RequestMapping("evaluateService") -public class EvaluateServiceController { - /** - * 服务对象 - */ - @Resource - private EvaluateServiceService evaluateServiceService; - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectOne") - public EvaluateService selectOne(Integer id) { - return this.evaluateServiceService.queryById(id); - } - -} \ No newline at end of file diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java index aaa4780..e9621c3 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/PpPayserviceController.java @@ -5,6 +5,7 @@ import com.team7.happycommunity.businessservice.entity.*; import com.team7.happycommunity.businessservice.service.PpPayserviceService; import com.team7.happycommunity.businessservice.service.ServiceImgService; import com.team7.happycommunity.businessservice.util.QiniuUploadUtil; +import io.swagger.annotations.*; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -25,6 +26,7 @@ import java.util.UUID; */ @RestController @RequestMapping("ppPayservice") +@Api(tags="服务接口") public class PpPayserviceController { /** * 服务对象 @@ -62,6 +64,12 @@ public class PpPayserviceController { */ @PostMapping("/addService") @ResponseBody + @ApiOperation(value = "商家发布服务") + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "发布成功"), + @ApiResponse(code = 500,message = "发布失败") + }) public CommonResult addService(PpPayservice ppPayservice){ @@ -101,6 +109,11 @@ public class PpPayserviceController { */ @RequestMapping("/queryEarnByUserId") @ResponseBody + @ApiOperation(value = "查询商家的所有收益") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "userId",value = "商家id",required = true), + }) + public List queryEarnByUserId(Integer userId){ try { List list=ppPayserviceService.queryEarnByUserId(userId); @@ -119,6 +132,11 @@ public class PpPayserviceController { * @return */ @GetMapping("/queryServicedByUserId") + @ApiOperation(value = "查询商家发布的服务") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "page",value = "页数",required = true), + @ApiImplicitParam(name = "limit",value = "每页条数",required = true) + }) public PageInfo> queryServicedByUserId(Integer userId, Integer page, Integer limit){ @@ -150,6 +168,16 @@ public class PpPayserviceController { * @return */ @GetMapping("/alterStatus") + @ApiOperation(value = "修改服务状态或删除服务") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "status",value = "登录的手机号或者邮箱",required = true), + @ApiImplicitParam(name = "id",value = "用户id",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "修改成功"), + @ApiResponse(code = 500,message = "修改失败") + }) public CommonResult alterStatus(Integer status,Integer id){ try { //删除服务 @@ -176,6 +204,10 @@ public class PpPayserviceController { * @return 服务详情 */ @GetMapping("/queryDetailsById") + @ApiOperation(value = "查询服务的详细信息") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "id",value = "用户id",required = true) + }) public PpPayservice queryDetailsById(Integer id){ return ppPayserviceService.queryDetailsById(id); } diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java index 0fdbfca..ee96b59 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceImgController.java @@ -5,6 +5,7 @@ import com.team7.happycommunity.businessservice.entity.BusinessImage; import com.team7.happycommunity.businessservice.entity.ServiceImg; import com.team7.happycommunity.businessservice.service.ServiceImgService; import com.team7.happycommunity.businessservice.util.QiniuUploadUtil; +import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.web.bind.annotation.*; @@ -24,6 +25,7 @@ import java.util.concurrent.TimeUnit; */ @RestController @RequestMapping("serviceImg") +@Api(tags="服务图片接口") public class ServiceImgController { /** * 服务对象 @@ -53,6 +55,11 @@ public class ServiceImgController { * @return */ @PostMapping("/upload") + @ApiOperation(value = "图片上传") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "imgBase",value = "图片",required = true), + @ApiImplicitParam(name = "userId",value = "用户id",required = true) + }) public CommonResult upload(String imgBase,Integer userId){ byte[] b1 = null; BASE64Decoder decoder = new BASE64Decoder(); diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java index 6248263..cbdc6d8 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/controller/ServiceOrderController.java @@ -7,6 +7,9 @@ import com.team7.happycommunity.businessservice.entity.OrderClassify; import com.team7.happycommunity.businessservice.entity.OrderDetails; import com.team7.happycommunity.businessservice.entity.ServiceOrder; import com.team7.happycommunity.businessservice.service.ServiceOrderService; +import io.swagger.annotations.*; +import org.springframework.amqp.rabbit.core.RabbitTemplate; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.relational.core.sql.In; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -15,7 +18,9 @@ import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * (ServiceOrder)表控制层 @@ -25,6 +30,7 @@ import java.util.List; */ @RestController @RequestMapping("serviceOrder") +@Api(tags="服务订单接口") public class ServiceOrderController { /** * 服务对象 @@ -35,6 +41,9 @@ public class ServiceOrderController { @Resource private HttpServletRequest request; + @Autowired + private RabbitTemplate rabbitTemplate; + /** * 通过主键查询单条数据 * @@ -51,7 +60,14 @@ public class ServiceOrderController { * @return */ @GetMapping("/queryOrderByUserIdAndStatus") + @ApiOperation(value = "查询商家的订单") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "status",value = "订单状态",required = true), + @ApiImplicitParam(name = "limit",value = "条数",required = false), + @ApiImplicitParam(name = "page",value = "页数",required = false) + }) public PageInfo queryOrderByUserIdAndStatus(Integer status,Integer limit,Integer page){ + System.out.println("statusstatusstatusstatus"+status); String userId = request.getHeader("userId"); if (limit==null){ @@ -70,12 +86,40 @@ public class ServiceOrderController { /** * 根据订单的id和订单状态修改订单状态 - * @param status - * @param id + * @param status 订单状态 + * @param id 订单的id * @return */ @GetMapping("/alertStatus") + @ApiOperation(value = "根据订单的id和订单状态修改订单状态") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "status",value = "修改后的订单状态",required = true), + @ApiImplicitParam(name = "id",value = "订单的id",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "修改成功"), + @ApiResponse(code = 500,message = "修改失败") + }) public CommonResult alertStatus(Integer status,Integer id){ + //订单退款修改状态流程 + if (status==1){ + try { + Map map=new HashMap(); + map.put("id",id); + map.put("status",status); + //完成相应退款 + + rabbitTemplate.convertAndSend("refund_code_exchange","refund."+id, map); + System.out.println("退款完成"); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + + return CommonResult.success(); + } + //其他流程 try { serviceOrderService.updateById(id,status); return CommonResult.success(); @@ -91,6 +135,10 @@ public class ServiceOrderController { * @return */ @GetMapping("/queryOrder") + @ApiOperation(value = "查询订单详情") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "orderId",value = "订单id",required = true) + }) public OrderDetails queryOrder(Integer orderId){ return serviceOrderService.queryOrder(orderId); } @@ -101,6 +149,10 @@ public class ServiceOrderController { * @return */ @GetMapping("/queryImage") + @ApiOperation(value = "查询服务的图片") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "orderId",value = "订单id",required = true) + }) public OrderDetails queryImage(Integer orderId){ List orderDetails=serviceOrderService.queryImage(orderId); if(orderDetails.isEmpty()){ @@ -115,6 +167,10 @@ public class ServiceOrderController { * @return */ @GetMapping("/evaluate") + @ApiOperation(value = "查询服务的评论") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "orderId",value = "订单id",required = true) + }) public List evaluate(Integer orderId){ return serviceOrderService.evaluate(orderId); diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/Areainfo.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/Areainfo.java index c16730f..c7077d4 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/Areainfo.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/Areainfo.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.businessservice.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** @@ -8,15 +11,16 @@ import java.io.Serializable; * @author makejava * @since 2020-03-27 14:24:46 */ +@ApiModel(value = "小区信息表") public class Areainfo implements Serializable { private static final long serialVersionUID = -86983646885762501L; - + @ApiModelProperty(value = "id") private Integer id; - + @ApiModelProperty(value = "小区名称") private String areaName; - + @ApiModelProperty(value = "小区地址") private String areaAddress; - + @ApiModelProperty(value = "详细信息") private String detail1; diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessImage.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessImage.java index fca84ff..c1b7a63 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessImage.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessImage.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.businessservice.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** @@ -8,15 +11,16 @@ import java.io.Serializable; * @author makejava * @since 2020-03-25 20:07:28 */ +@ApiModel(value = "商家图片实体类") public class BusinessImage implements Serializable { private static final long serialVersionUID = 797230701489261839L; - + @ApiModelProperty(value = "id") private Integer id; - + @ApiModelProperty(value = "商家id") private Integer businessInfoId; - + @ApiModelProperty(value = "商家url") private String url; - + @ApiModelProperty(value = "图片类型") private Integer type; diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessInfo.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessInfo.java index 6ec18f4..a9cec1d 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessInfo.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessInfo.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.businessservice.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.util.Date; import java.io.Serializable; @@ -9,47 +12,51 @@ import java.io.Serializable; * @author makejava * @since 2020-03-25 20:07:24 */ +@ApiModel(value = "商家信息实体类") public class BusinessInfo implements Serializable { private static final long serialVersionUID = -76729269658911894L; - + + @ApiModelProperty(value = "id") private Integer id; - + + @ApiModelProperty(value = "身份证") private String idNumber; - + @ApiModelProperty(value = "手机号") private String cellPhNumber; - + @ApiModelProperty(value = "密码") private String password; - + @ApiModelProperty(value = "姓名") private String name; - + @ApiModelProperty(value = "性别") private Integer sex; - + @ApiModelProperty(value = "昵称") private String nickname; - + @ApiModelProperty(value = "邮箱") private String mailbox; - + @ApiModelProperty(value = "小区id") private Integer plotId; - + @ApiModelProperty(value = "标签") private String tag; - + @ApiModelProperty(value = "邮箱状态") private Integer mailboxStatus; - + @ApiModelProperty(value = "邮箱的令牌") private String code; - + @ApiModelProperty(value = "盐") private String passwordSalt; - + @ApiModelProperty(value = "账户创建时间") private Date createTime; - + @ApiModelProperty(value = "是否认证") private String authentication; - + @ApiModelProperty(value = "申请认证时间") private Date authTime; /** * 账号状态 0 未通过审核 1通过审核 */ + @ApiModelProperty(value = "账号状态") private Integer status; - + @ApiModelProperty(value = "商家地址") private String address; - + @ApiModelProperty(value = "商家介绍") private String introduce; diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessInfoAreainfo.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessInfoAreainfo.java index 3d3a7f2..eebaa9d 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessInfoAreainfo.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/BusinessInfoAreainfo.java @@ -1,10 +1,14 @@ package com.team7.happycommunity.businessservice.entity; -import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +@ApiModel(value = "商家信息地址实体类") public class BusinessInfoAreainfo implements Serializable{ - + @ApiModelProperty(value = "商家信息") private BusinessInfo businessInfo; + @ApiModelProperty(value = "商家地址信息") private Areainfo areainfo; public BusinessInfo getBusinessInfo() { diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EarnIng.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EarnIng.java index 4951c08..d1d6f5e 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EarnIng.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EarnIng.java @@ -1,12 +1,19 @@ package com.team7.happycommunity.businessservice.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.Date; - +@ApiModel(value = "商家收益实体类") public class EarnIng implements Serializable { + @ApiModelProperty(value = "价格") private String payprice; + @ApiModelProperty(value = "服务名称") private String payname; + @ApiModelProperty(value = "服务id") private Integer serviceid ; + @ApiModelProperty(value = "服务时间") private Date endtime; public String getPayprice() { diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EvaluateService.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EvaluateService.java index 7995660..33dddf7 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EvaluateService.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EvaluateService.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.businessservice.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** @@ -8,13 +11,14 @@ import java.io.Serializable; * @author makejava * @since 2020-03-28 10:41:54 */ +@ApiModel(value = "服务评价实体类") public class EvaluateService implements Serializable { private static final long serialVersionUID = -67118356778642889L; - + @ApiModelProperty(value = "id") private Integer id; - + @ApiModelProperty(value = "服务id") private Integer serviceid; - + @ApiModelProperty(value = "评价内容") private String evalute; /** * 评论用户 diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ImgUrlService.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ImgUrlService.java index 93481f5..a5b8537 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ImgUrlService.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ImgUrlService.java @@ -1,10 +1,14 @@ package com.team7.happycommunity.businessservice.entity; -import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +@ApiModel(value = "图片实体类") public class ImgUrlService implements Serializable { - + @ApiModelProperty(value = "图片链接") private String imgUrl; + @ApiModelProperty(value = "id") private Integer id; public String getImgUrl() { diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/MyCenter.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/MyCenter.java index c8f1557..50032c7 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/MyCenter.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/MyCenter.java @@ -1,15 +1,21 @@ package com.team7.happycommunity.businessservice.entity; -import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +@ApiModel(value = "个人中心实体类") public class MyCenter implements Serializable { - + @ApiModelProperty(value = "图片链接") private String url; + @ApiModelProperty(value = "信息") private String name; //订单数 + @ApiModelProperty(value = "订单数") private Integer orderSum; //预约数 + @ApiModelProperty(value = "bookOrederSum") private Integer bookOrederSum; diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/OrderClassify.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/OrderClassify.java index 8edb7be..3ea5dbd 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/OrderClassify.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/OrderClassify.java @@ -1,16 +1,23 @@ package com.team7.happycommunity.businessservice.entity; -import java.io.Serializable; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.Serializable; +@ApiModel(value = "订单分类实体类") public class OrderClassify implements Serializable { - + @ApiModelProperty(value = "订单号") private String ordernumber; + @ApiModelProperty(value = "订单图片") private String img; + @ApiModelProperty(value = "订单名称") private String payname; + @ApiModelProperty(value = "订单价格") private String payprice; - + @ApiModelProperty(value = "订单状态") private Integer status; //订单id + @ApiModelProperty(value = "订单id") private Integer id; public String getOrdernumber() { diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/OrderDetails.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/OrderDetails.java index 95a802d..327ad8b 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/OrderDetails.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/OrderDetails.java @@ -1,15 +1,22 @@ package com.team7.happycommunity.businessservice.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.Date; - +@ApiModel(value = "订单详细信息实体类") public class OrderDetails implements Serializable { - + @ApiModelProperty(value = "订单状态") private Integer status; + @ApiModelProperty(value = "订单下单时间") private Date starttime; + @ApiModelProperty(value = "订单支付时间") private Date endtime; + @ApiModelProperty(value = "订单号") private String ordernumber; //订单id + @ApiModelProperty(value = "订单id") private Integer id; private String name; diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PageInfo.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PageInfo.java index 3e7de59..b58bb41 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PageInfo.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PageInfo.java @@ -1,5 +1,6 @@ package com.team7.happycommunity.businessservice.entity; +import io.swagger.annotations.ApiModel; import org.springframework.data.relational.core.sql.In; import java.io.Serializable; diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java index e7e4500..8917d1a 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PpPayservice.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.businessservice.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.List; @@ -9,26 +12,30 @@ import java.util.List; * @author makejava * @since 2020-03-26 21:40:52 */ +@ApiModel(value = "服务实体类") public class PpPayservice implements Serializable { private static final long serialVersionUID = -99092034779783807L; + @ApiModelProperty(value = "服务订单") private ServiceOrder serviceOrder; + @ApiModelProperty(value = "id") private Integer id; - + @ApiModelProperty(value = "物业id") private Integer propertyid; - + @ApiModelProperty(value = "商家id") private Integer shopid; - + @ApiModelProperty(value = "服务名称") private String payname; - + @ApiModelProperty(value = "服务金额") private String payprice; - + @ApiModelProperty(value = "服务时间") private String paytime; - + @ApiModelProperty(value = "服务状态") private Integer status; - + private String icon; - + @ApiModelProperty(value = "服务类型") private Integer serviceType; + @ApiModelProperty(value = "商家信息") private BusinessInfo businessInfo; public BusinessInfo getBusinessInfo() { @@ -41,9 +48,9 @@ public class PpPayservice implements Serializable { public PpPayservice() { } - + @ApiModelProperty(value = "服务图片") private List img; - + @ApiModelProperty(value = "用户id") private Integer userId;//用户id public static long getSerialVersionUID() { diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceImg.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceImg.java index e97dceb..ccaefcd 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceImg.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceImg.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.businessservice.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** @@ -8,13 +11,14 @@ import java.io.Serializable; * @author makejava * @since 2020-03-26 21:40:52 */ +@ApiModel(value = "服务图片信息实体类") public class ServiceImg implements Serializable { private static final long serialVersionUID = -11738348509337658L; - + @ApiModelProperty(value = "id") private Integer id; - + @ApiModelProperty(value = "服务id") private Integer serviceid; - + @ApiModelProperty(value = "图片链接") private String img; diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceOrder.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceOrder.java index c1ea714..43e98b6 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceOrder.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceOrder.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.businessservice.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.Date; @@ -9,23 +12,24 @@ import java.util.Date; * @author makejava * @since 2020-03-28 10:41:54 */ +@ApiModel(value = "服务订单实体类") public class ServiceOrder implements Serializable { private static final long serialVersionUID = -86406737992191330L; - + @ApiModelProperty(value = "id") private Integer id; - + @ApiModelProperty(value = "服务id") private Integer serviceid; - + @ApiModelProperty(value = "被服务者id") private Integer userid; - + @ApiModelProperty(value = "开始时间") private Date starttime; - + @ApiModelProperty(value = "结束时间") private Date endtime; - + @ApiModelProperty(value = "订单状态") private Integer status; - + @ApiModelProperty(value = "订单号") private String ordernumber; - + @ApiModelProperty(value = "服务") private PpPayservice ppPayservice; public ServiceOrder(Integer id, Integer serviceid, Integer userid, Date starttime, Date endtime, Integer status, String ordernumber) { diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java index 624b04b..f25abb1 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/PhoneCode.java @@ -33,7 +33,7 @@ public class PhoneCode { String phone = (String) msg.get("phone"); String code = (String)msg.get("code"); //调用阿里云地址,发送短信 - // sendSms.sms(phone,smsCode,param.replace("[value]",code)); + sendSms.sms(phone,smsCode,param.replace("[value]",code)); //签收 Long tag=(Long)headers.get(AmqpHeaders.DELIVERY_TAG); try { diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/RefundCode.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/RefundCode.java new file mode 100644 index 0000000..0ac39ad --- /dev/null +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/mq/RefundCode.java @@ -0,0 +1,44 @@ +package com.team7.happycommunity.businessservice.mq; + +import com.rabbitmq.client.Channel; +import com.team7.happycommunity.businessservice.service.ServiceOrderService; +import com.team7.happycommunity.businessservice.util.SendSms; +import org.springframework.amqp.rabbit.annotation.RabbitHandler; +import org.springframework.amqp.rabbit.annotation.RabbitListener; +import org.springframework.amqp.support.AmqpHeaders; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.messaging.handler.annotation.Headers; +import org.springframework.messaging.handler.annotation.Payload; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.Map; + +@Service +public class RefundCode { + + @Resource + private ServiceOrderService serviceOrderService; + + + @RabbitHandler + @RabbitListener(queues = "refund_code_queue") + public void processPay(@Payload Map msg, Channel channel, @Headers Map headers){ + Integer id = (Integer) msg.get("id"); + Integer status = (Integer)msg.get("status"); + //修改状态 + serviceOrderService.updateById(id,status); + //签收 + Long tag=(Long)headers.get(AmqpHeaders.DELIVERY_TAG); + try { + channel.basicAck(tag,false); + } catch (IOException e) { + e.printStackTrace(); + } + } + + +} -- Gitee From 7ea519f912689eede8392d39b5c2a233cad63f99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=B4=8B?= <2870485806@qq.com> Date: Fri, 10 Apr 2020 14:24:49 +0800 Subject: [PATCH 22/27] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- personcentor/pom.xml | 31 +++++ .../personcentor/config/Swagger2Config.java | 18 +++ .../controller/AreainfoController.java | 35 ------ .../controller/BusinessImageController.java | 35 ------ .../controller/BusinessInfoController.java | 35 ------ .../CommunityActivityComplaintController.java | 37 ------ .../CommunityActivityController.java | 37 ------ .../CommunityActivityUserController.java | 37 ------ .../controller/CommunityChatController.java | 36 ------ .../CommunityDynamicCommentController.java | 37 ------ .../CommunityDynamicController.java | 26 +++++ .../PersonCollectUserController.java | 2 + .../controller/PersonUserController.java | 108 ++++++++++++++++-- .../personcentor/dao/PersonUserDao.java | 6 + .../personcentor/entity/Areainfo.java | 13 ++- .../entity/CommunityActivity.java | 17 +++ .../entity/CommunityActivityComplaint.java | 11 +- .../entity/CommunityActivityUser.java | 8 +- .../personcentor/entity/CommunityChat.java | 3 + .../personcentor/entity/CommunityDynamic.java | 11 ++ .../entity/CommunityDynamicComment.java | 13 ++- .../personcentor/entity/Dynamic.java | 10 +- .../personcentor/entity/DynamicCommit.java | 9 +- .../entity/MyPublishAcitivity.java | 15 ++- .../entity/PersonCollectUser.java | 14 ++- .../personcentor/entity/PersonImage.java | 18 +-- .../personcentor/entity/PersonUser.java | 38 +++--- .../service/impl/PersonUserServiceImpl.java | 10 +- .../src/main/resources/application.properties | 2 +- .../main/resources/mapper/PersonUserDao.xml | 3 + 30 files changed, 326 insertions(+), 349 deletions(-) create mode 100644 personcentor/src/main/java/com/team7/happycommunity/personcentor/config/Swagger2Config.java delete mode 100644 personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/AreainfoController.java delete mode 100644 personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/BusinessImageController.java delete mode 100644 personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/BusinessInfoController.java delete mode 100644 personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityComplaintController.java delete mode 100644 personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityController.java delete mode 100644 personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityUserController.java delete mode 100644 personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityChatController.java delete mode 100644 personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityDynamicCommentController.java diff --git a/personcentor/pom.xml b/personcentor/pom.xml index ec5773b..9335517 100644 --- a/personcentor/pom.xml +++ b/personcentor/pom.xml @@ -29,6 +29,7 @@ java-jwt 2.2.0 + com.google.code.gson gson @@ -139,6 +140,36 @@ biz.aQute.bndlib 3.2.0 + + io.springfox + springfox-swagger2 + 2.9.2 + + + io.swagger + swagger-annotations + + + io.swagger + swagger-models + + + + + io.springfox + springfox-swagger-ui + 2.9.2 + + + io.swagger + swagger-annotations + 1.5.21 + + + io.swagger + swagger-models + 1.5.21 + diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/config/Swagger2Config.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/config/Swagger2Config.java new file mode 100644 index 0000000..473e92b --- /dev/null +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/config/Swagger2Config.java @@ -0,0 +1,18 @@ +package com.team7.happycommunity.personcentor.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Configuration +//@EnableSwagger2//启动 +public class Swagger2Config { + + @Bean + public Docket decket(){ + return new Docket(DocumentationType.SWAGGER_2); + } + +} diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/AreainfoController.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/AreainfoController.java deleted file mode 100644 index 87cfaf9..0000000 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/AreainfoController.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.team7.happycommunity.personcentor.controller; - -import com.team7.happycommunity.personcentor.entity.Areainfo; -import com.team7.happycommunity.personcentor.service.AreainfoService; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; - -/** - * 小区信息表(Areainfo)表控制层 - * - * @author makejava - * @since 2020-03-23 14:46:47 - */ -@RestController -@RequestMapping("areainfo") -public class AreainfoController { - /** - * 服务对象 - */ - @Resource - private AreainfoService areainfoService; - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectOne") - public Areainfo selectOne(Integer id) { - return this.areainfoService.queryById(id); - } - -} \ No newline at end of file diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/BusinessImageController.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/BusinessImageController.java deleted file mode 100644 index 01b4668..0000000 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/BusinessImageController.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.team7.happycommunity.personcentor.controller; - -import com.team7.happycommunity.personcentor.entity.BusinessImage; -import com.team7.happycommunity.personcentor.service.BusinessImageService; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; - -/** - * (BusinessImage)表控制层 - * - * @author makejava - * @since 2020-03-22 21:19:30 - */ -@RestController -@RequestMapping("businessImage") -public class BusinessImageController { - /** - * 服务对象 - */ - @Resource - private BusinessImageService businessImageService; - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectOne") - public BusinessImage selectOne(Integer id) { - return this.businessImageService.queryById(id); - } - -} \ No newline at end of file diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/BusinessInfoController.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/BusinessInfoController.java deleted file mode 100644 index dcffd6b..0000000 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/BusinessInfoController.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.team7.happycommunity.personcentor.controller; - -import com.team7.happycommunity.personcentor.entity.BusinessInfo; -import com.team7.happycommunity.personcentor.service.BusinessInfoService; -import org.springframework.web.bind.annotation.*; - -import javax.annotation.Resource; - -/** - * (BusinessInfo)表控制层 - * - * @author makejava - * @since 2020-03-22 21:19:30 - */ -@RestController -@RequestMapping("businessInfo") -public class BusinessInfoController { - /** - * 服务对象 - */ - @Resource - private BusinessInfoService businessInfoService; - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectOne") - public BusinessInfo selectOne(Integer id) { - return this.businessInfoService.queryById(id); - } - -} \ No newline at end of file diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityComplaintController.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityComplaintController.java deleted file mode 100644 index 0681a59..0000000 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityComplaintController.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.team7.happycommunity.personcentor.controller; - -import com.team7.happycommunity.personcentor.entity.CommunityActivityComplaint; -import com.team7.happycommunity.personcentor.service.CommunityActivityComplaintService; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -/** - * (CommunityActivityComplaint)表控制层 - * - * @author makejava - * @since 2020-03-25 11:18:29 - */ -@RestController -@RequestMapping("communityActivityComplaint") -public class CommunityActivityComplaintController { - /** - * 服务对象 - */ - @Resource - private CommunityActivityComplaintService communityActivityComplaintService; - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectOne") - public CommunityActivityComplaint selectOne(Integer id) { - return this.communityActivityComplaintService.queryById(id); - } - -} \ No newline at end of file diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityController.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityController.java deleted file mode 100644 index e9052a6..0000000 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityController.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.team7.happycommunity.personcentor.controller; - -import com.team7.happycommunity.personcentor.entity.CommunityActivity; -import com.team7.happycommunity.personcentor.service.CommunityActivityService; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -/** - * (CommunityActivity)表控制层 - * - * @author makejava - * @since 2020-03-25 11:18:29 - */ -@RestController -@RequestMapping("communityActivity") -public class CommunityActivityController { - /** - * 服务对象 - */ - @Resource - private CommunityActivityService communityActivityService; - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectOne") - public CommunityActivity selectOne(Integer id) { - return this.communityActivityService.queryById(id); - } - -} \ No newline at end of file diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityUserController.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityUserController.java deleted file mode 100644 index a0bf18c..0000000 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityActivityUserController.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.team7.happycommunity.personcentor.controller; - -import com.team7.happycommunity.personcentor.entity.CommunityActivityUser; -import com.team7.happycommunity.personcentor.service.CommunityActivityUserService; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -/** - * (CommunityActivityUser)表控制层 - * - * @author makejava - * @since 2020-03-25 11:18:29 - */ -@RestController -@RequestMapping("communityActivityUser") -public class CommunityActivityUserController { - /** - * 服务对象 - */ - @Resource - private CommunityActivityUserService communityActivityUserService; - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectOne") - public CommunityActivityUser selectOne(Integer id) { - return this.communityActivityUserService.queryById(id); - } - -} \ No newline at end of file diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityChatController.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityChatController.java deleted file mode 100644 index 429f030..0000000 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityChatController.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.team7.happycommunity.personcentor.controller; -import com.team7.happycommunity.personcentor.entity.CommunityChat; -import com.team7.happycommunity.personcentor.service.CommunityChatService; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -/** - * (CommunityChat)表控制层 - * - * @author makejava - * @since 2020-03-24 16:58:04 - */ -@RestController -@RequestMapping("communityChat") -public class CommunityChatController { - /** - * 服务对象 - */ - @Resource - private CommunityChatService communityChatService; - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectOne") - public CommunityChat selectOne(Integer id) { - return this.communityChatService.queryById(id); - } - -} \ No newline at end of file diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityDynamicCommentController.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityDynamicCommentController.java deleted file mode 100644 index 954faa8..0000000 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityDynamicCommentController.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.team7.happycommunity.personcentor.controller; - -import com.team7.happycommunity.personcentor.entity.CommunityDynamicComment; -import com.team7.happycommunity.personcentor.service.CommunityDynamicCommentService; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; - -/** - * (CommunityDynamicComment)表控制层 - * - * @author makejava - * @since 2020-03-24 17:26:32 - */ -@RestController -@RequestMapping("communityDynamicComment") -public class CommunityDynamicCommentController { - /** - * 服务对象 - */ - @Resource - private CommunityDynamicCommentService communityDynamicCommentService; - - /** - * 通过主键查询单条数据 - * - * @param id 主键 - * @return 单条数据 - */ - @GetMapping("selectOne") - public CommunityDynamicComment selectOne(Integer id) { - return this.communityDynamicCommentService.queryById(id); - } - -} \ No newline at end of file diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityDynamicController.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityDynamicController.java index b042f4f..f6f09fe 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityDynamicController.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/CommunityDynamicController.java @@ -6,6 +6,7 @@ import com.team7.happycommunity.personcentor.entity.CommunityDynamicComment; import com.team7.happycommunity.personcentor.entity.DynamicCommit; import com.team7.happycommunity.personcentor.service.CommunityDynamicCommentService; import com.team7.happycommunity.personcentor.service.CommunityDynamicService; +import io.swagger.annotations.*; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -22,6 +23,7 @@ import java.util.List; */ @RestController @RequestMapping("communityDynamic") +@Api(tags="社区动态接口") public class CommunityDynamicController { /** * 服务对象 @@ -48,6 +50,10 @@ public class CommunityDynamicController { * @return 评论内容 */ @GetMapping("queryCommit") + @ApiOperation(value = "查询当前动态的所有评论") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "dynamicId",value = "动态id",required = true) + }) public List queryCommit(Integer dynamicId){ return communityDynamicService.queryCommit(dynamicId); } @@ -60,6 +66,17 @@ public class CommunityDynamicController { * @return */ @GetMapping("addCommit") + @ApiOperation(value = "添加评论") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "dynamicId",value = "动态id",required = true), + @ApiImplicitParam(name = "userId",value = "评论用户的id",required = true), + @ApiImplicitParam(name = "userId",value = "评论内容",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "评论成功"), + @ApiResponse(code = 500,message = "评论失败") + }) public CommonResult addCommit(Integer dynamicId,Integer userId,String cdcContent){ try { CommunityDynamicComment comment=new CommunityDynamicComment(); @@ -81,6 +98,15 @@ public class CommunityDynamicController { * @return */ @GetMapping("deleteCommit") + @ApiOperation(value = "删除评论") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "id",value = "评论id",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "删除成功"), + @ApiResponse(code = 500,message = "删除失败") + }) public CommonResult deleteCommit(Integer id){ try { communityDynamicCommentService.deleteById(id); diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/PersonCollectUserController.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/PersonCollectUserController.java index 0bb033c..21c0275 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/PersonCollectUserController.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/PersonCollectUserController.java @@ -2,6 +2,7 @@ package com.team7.happycommunity.personcentor.controller; import com.team7.happycommunity.personcentor.entity.PersonCollectUser; import com.team7.happycommunity.personcentor.service.PersonCollectUserService; +import io.swagger.annotations.Api; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -14,6 +15,7 @@ import javax.annotation.Resource; */ @RestController @RequestMapping("personCollectUser") + public class PersonCollectUserController { /** * 服务对象 diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/PersonUserController.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/PersonUserController.java index 05c541a..1f0f57f 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/PersonUserController.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/controller/PersonUserController.java @@ -11,6 +11,7 @@ import com.team7.happycommunity.personcentor.exception.MailboxStatusException; import com.team7.happycommunity.personcentor.service.PersonUserService; import com.team7.happycommunity.personcentor.util.CookieUtils; import com.team7.happycommunity.personcentor.util.QiniuUploadUtil; +import io.swagger.annotations.*; import org.apache.catalina.User; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; @@ -35,6 +36,7 @@ import java.util.concurrent.locks.ReentrantLock; */ @RestController @RequestMapping("personUser") +@Api(tags="用户接口") public class PersonUserController { /** * 服务对象 @@ -72,6 +74,16 @@ public class PersonUserController { */ @RequestMapping("/subLogin") @ResponseBody + @ApiOperation(value = "登录") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "text",value = "登录的手机号或者邮箱",required = true), + @ApiImplicitParam(name = "password",value = "密码",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "登录成功"), + @ApiResponse(code = 500,message = "登录失败") + }) public CommonResult login(String text, String password) throws Exception { PersonUser user =null; if(text==null||password==null){ @@ -90,12 +102,17 @@ public class PersonUserController { } /** - * 邮箱注册 + * 发送邮件 * @param user * @return */ @PostMapping("/mailboxRegister") @ResponseBody + @ApiOperation(value = "发送邮件") + @ApiResponses(value = { + @ApiResponse(code = 200,message = "邮件发送成功"), + @ApiResponse(code = 500,message = "邮件发送失败") + }) public CommonResult mailboxRegister(PersonUser user){ //1.搜索邮箱,邮箱不存在或邮箱状态不为0 boolean flag=personUserService.queryMailbox(user.getMailbox()); @@ -114,13 +131,23 @@ public class PersonUserController { } /** - * 手机号码注册,密码重置 + * 发送验证码 * @param phone 手机号码 * @param resetCode 密码重置参数,1密码重置,0注册 * @return */ @PostMapping("/phoneRegister") @ResponseBody + @ApiOperation(value = "发送验证码") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "phone",value = "手机号码",required = true), + @ApiImplicitParam(name = "resetCode",value = "密码重置参数,1密码重置,0注册",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "验证码发送成功"), + @ApiResponse(code = 500,message = "验证码发送失败") + }) public CommonResult phoneRegister(String phone,String resetCode){ try { @@ -140,6 +167,16 @@ public class PersonUserController { */ @PostMapping("/codeCheck") @ResponseBody + @ApiOperation(value = "验证码校正") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "phone",value = "手机号码",required = true), + @ApiImplicitParam(name = "code",value = "验证码",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "校正成功"), + @ApiResponse(code = 500,message = "校正失败") + }) public CommonResult codeCheck(String phone,String code){ try { personUserService.codeCheck(code,phone); @@ -157,6 +194,11 @@ public class PersonUserController { */ @PostMapping("/addInfo") @ResponseBody + @ApiOperation(value = "添加个人信息") + @ApiResponses(value = { + @ApiResponse(code = 200,message = "添加成功"), + @ApiResponse(code = 500,message = "添加失败") + }) public CommonResult addInfo(PersonUser user){ if(user.getPassword()==null){ return CommonResult.failed("注册失败,密码不能为空"); @@ -166,7 +208,7 @@ public class PersonUserController { return CommonResult.success(); } catch (Exception e) { e.printStackTrace(); - return CommonResult.failed("注册失败,请联系管理员"); + return CommonResult.failed(e.getMessage()); } } /** @@ -176,19 +218,30 @@ public class PersonUserController { */ @GetMapping("/activate") @ResponseBody - public ModelAndView activate(String code){ + @ApiOperation(value = "修改邮箱状态") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "code",value = "邮箱的令牌") + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "激活成功"), + @ApiResponse(code = 500,message = "激活失败") + }) + public CommonResult activate(String code){ //激活邮箱 ModelAndView mv=new ModelAndView(); try { personUserService.updateMailboxStatus(code); mv.setViewName("mailboxRegisterMessage"); - return mv; + return CommonResult.success("激活成功"); }catch (MailboxStatusException e){ e.printStackTrace(); + return CommonResult.failed(e.getMessage()); }catch (Exception e) { e.printStackTrace(); + return CommonResult.failed(e.getMessage()); } - return null; + } /** @@ -198,6 +251,15 @@ public class PersonUserController { * @return */ @PostMapping("/resetPassword") + @ApiOperation(value = "密码修改") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "cellPhNumber",value = "手机号"), + @ApiImplicitParam(name = "password",value = "新密码") + }) + @ApiResponses(value = { + @ApiResponse(code = 200,message = "修改成功"), + @ApiResponse(code = 500,message = "修改失败") + }) public CommonResult resetPasswordByPhone(String cellPhNumber,String password){ if (password==null){ return CommonResult.failed("密码不能为空"); @@ -213,12 +275,13 @@ public class PersonUserController { /** * 个人中心,账户管理 - * @param userId 用户id + * @param * @return */ @GetMapping("/personCenter") @ResponseBody - public CommonResult personCenter(Integer userId){ + @ApiOperation(value = "个人中心,账户管理") + public CommonResult personCenter(){ String name = request.getHeader("userName"); if(name==null){ return CommonResult.failed("未登录"); @@ -233,6 +296,11 @@ public class PersonUserController { */ @GetMapping("/exit") @ResponseBody + @ApiOperation(value = "退出登录") + @ApiResponses(value = { + @ApiResponse(code = 200,message = "退出成功"), + @ApiResponse(code = 500,message = "退出失败") + }) public CommonResult exit(){ String name = request.getHeader("userName"); if(name==null){ @@ -261,6 +329,16 @@ public class PersonUserController { */ @PostMapping(value="/resetPasswordBypassword") @ResponseBody + @ApiOperation(value = "密码修改") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "oldPassword",value = "旧密码",required = true), + @ApiImplicitParam(name = "password",value = "新密码",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "修改成功"), + @ApiResponse(code = 500,message = "修改失败") + }) public CommonResult resetPasswordBypassword(String oldPassword,String password){ if (password==null||password.equals("")||oldPassword==null||oldPassword.equals("")){ return CommonResult.failed("密码不能为空"); @@ -283,6 +361,7 @@ public class PersonUserController { * @return */ @GetMapping("/dynamic") + @ApiOperation(value = "帖子动态") public List dynamic(){ String name = request.getHeader("userName"); if(name==null){ @@ -297,6 +376,7 @@ public class PersonUserController { * @return */ @GetMapping("/myPublishAcitivity") + @ApiOperation(value = "我发布的活动") public List myPublishAcitivity(){ String name = request.getHeader("userName"); if(name==null){ @@ -312,6 +392,7 @@ public class PersonUserController { * @return */ @GetMapping("/acitivityDetail") + public List acitivityDetail(String acid){ return null; @@ -322,6 +403,7 @@ public class PersonUserController { * @return */ @GetMapping("/myJoinAcitivity") + @ApiOperation(value = "我参加的活动") public List myJoinAcitivity(){ String name = request.getHeader("userName"); if(name==null){ @@ -336,6 +418,7 @@ public class PersonUserController { * @return */ @GetMapping("/myAttentionDynamic") + @ApiOperation(value = "我收藏的帖子") public List myAttentionDynamic(){ String userName = request.getHeader("userName"); if(userName==null){ @@ -352,6 +435,15 @@ public class PersonUserController { */ @ResponseBody @PostMapping("/uploadHeadImage") + @ApiOperation(value = "上传头像") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "file",value = "图片",required = true) + }) + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "上传成功"), + @ApiResponse(code = 500,message = "上传失败") + }) public CommonResult uploadHeadImage(MultipartFile file){ String userName = request.getHeader("userName"); if(userName==null){ diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/dao/PersonUserDao.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/dao/PersonUserDao.java index 49356f8..d599d05 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/dao/PersonUserDao.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/dao/PersonUserDao.java @@ -131,4 +131,10 @@ public interface PersonUserDao { * @param imgurl 头像的url */ void updateHeadImage(@Param("id")Integer id, @Param("imgurl")String imgurl); + + /** + * 根据邮箱删除数据 + * @param mailbox + */ + void deleteByMailbox(String mailbox); } \ No newline at end of file diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/Areainfo.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/Areainfo.java index 71508a4..581aab9 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/Areainfo.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/Areainfo.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** @@ -8,15 +11,17 @@ import java.io.Serializable; * @author makejava * @since 2020-03-23 14:46:47 */ +@ApiModel(value = "小区信息表") public class Areainfo implements Serializable { private static final long serialVersionUID = 893984337762180737L; - + + @ApiModelProperty(value = "id") private Integer id; - + @ApiModelProperty(value = "小区名称") private String areaName; - + @ApiModelProperty(value = "小区地址") private String areaAddress; - + @ApiModelProperty(value = "详细信息") private String detail1; diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivity.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivity.java index fd76b9b..23f9162 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivity.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivity.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.Date; @@ -9,59 +12,73 @@ import java.util.Date; * @author makejava * @since 2020-03-25 11:18:29 */ +@ApiModel(value = "社区动态") public class CommunityActivity implements Serializable { private static final long serialVersionUID = -32549005841184090L; /** * 动态id */ + @ApiModelProperty(value = "id") private Integer id; /** * 发布者id */ + @ApiModelProperty(value = "发布者id") private Integer caUserId; /** * 活动图片id */ + @ApiModelProperty(value = "活动图片id") private String caPicPath; /** * 活动类型 */ + @ApiModelProperty(value = "活动类型") private Integer caType; /** * 活动标题 */ + @ApiModelProperty(value = "活动标题") private String caTitle; /** * 活动内容 */ + @ApiModelProperty(value = "活动内容") private String caContent; /** * 发起时间 */ + @ApiModelProperty(value = "发起时间") private Date caStartTime; /** * 结束时间 */ + @ApiModelProperty(value = "结束时间") private Date caEndTime; /** * 活动状态 */ + @ApiModelProperty(value = "活动状态") private Integer caStatus; /** * 消费金额 */ + @ApiModelProperty(value = "消费金额") private Object caMoney; /** * 参与人数 */ + @ApiModelProperty(value = "参与人数") private Integer caPeopelCount; /** * 最大参与人数 */ + @ApiModelProperty(value = "最大参与人数") private Integer caMaxPeopleCount; /** * 创建时间 */ + @ApiModelProperty(value = "创建时间") private Date caCreateTime; diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivityComplaint.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivityComplaint.java index 9f4bde4..080101f 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivityComplaint.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivityComplaint.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.Date; @@ -9,29 +12,35 @@ import java.util.Date; * @author makejava * @since 2020-03-25 11:18:29 */ +@ApiModel(value = "社区动态投诉实体类") public class CommunityActivityComplaint implements Serializable { private static final long serialVersionUID = -35019715504984022L; - + @ApiModelProperty(value = "id") private Integer id; /** * 投诉用户 id */ + @ApiModelProperty(value = "投诉用户 id") private Integer cacUserId; /** * 投诉活动 id */ + @ApiModelProperty(value = "投诉活动 id") private Integer cacActivityId; /** * 投诉理由 */ + @ApiModelProperty(value = "投诉理由") private String cacReason; /** * 图片证据id */ + @ApiModelProperty(value = "图片证据id") private String cacPic; /** * 投诉时间(创建时间) */ + @ApiModelProperty(value = "投诉时间(创建时间)") private Date ccTime; diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivityUser.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivityUser.java index bbcec49..58aac14 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivityUser.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityActivityUser.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; /** @@ -8,17 +11,20 @@ import java.io.Serializable; * @author makejava * @since 2020-03-25 11:18:29 */ +@ApiModel(value = "社区活动用户实体类") public class CommunityActivityUser implements Serializable { private static final long serialVersionUID = 649975225445944595L; - + @ApiModelProperty(value = "id") private Integer id; /** * 活动id */ + @ApiModelProperty(value = "活动id") private Integer cauActivityId; /** * 用户id */ + @ApiModelProperty(value = "用户id") private Integer cauUserId; diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityChat.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityChat.java index 2d1fd4c..5e34aef 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityChat.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityChat.java @@ -1,5 +1,7 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; + import java.io.Serializable; import java.util.Date; @@ -9,6 +11,7 @@ import java.util.Date; * @author makejava * @since 2020-03-24 16:58:02 */ +@ApiModel(value = "社区动态投诉实体类") public class CommunityChat implements Serializable { private static final long serialVersionUID = -63416663913483268L; diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityDynamic.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityDynamic.java index 71199d8..39e71c9 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityDynamic.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityDynamic.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.Date; import java.util.List; @@ -10,35 +13,43 @@ import java.util.List; * @author makejava * @since 2020-03-24 17:26:32 */ +@ApiModel(value = "社区动态实体类") public class CommunityDynamic implements Serializable { private static final long serialVersionUID = 744418746282083773L; /** * 动态id */ + @ApiModelProperty(value = "动态id") private Integer id; /** * 发布者id */ + @ApiModelProperty(value = "发布者id") private Integer cdUserId; /** * 动态图片id */ + @ApiModelProperty(value = "动态图片id") private String cdPicPath; /** * 动态类型 */ + @ApiModelProperty(value = "动态类型") private Integer cdType; /** * 动态内容 */ + @ApiModelProperty(value = "动态内容") private String cdContent; /** * 获赞数量 */ + @ApiModelProperty(value = "获赞数量") private Integer cdFavor; /** * 发布时间(创建时间) */ + @ApiModelProperty(value = "发布时间") private Date cdTime; private List communityDynamicComment; diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityDynamicComment.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityDynamicComment.java index daa6dec..d02006e 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityDynamicComment.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/CommunityDynamicComment.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.Date; import java.util.List; @@ -10,31 +13,37 @@ import java.util.List; * @author makejava * @since 2020-03-24 17:26:32 */ +@ApiModel(value = "动态评论实体类") public class CommunityDynamicComment implements Serializable { private static final long serialVersionUID = 256951165143287277L; - + @ApiModelProperty(value = "id") private Integer id; /** * 动态id */ + @ApiModelProperty(value = "动态id") private Integer cdcDynamicId; /** * 评论者id */ + @ApiModelProperty(value = "评论者id") private Integer cdcUserId; /** * 其他评论者id,针对评论的评论 */ + @ApiModelProperty(value = "其他评论者id,针对评论的评论") private Integer cdcOtherUserId; /** * 评论内容 */ + @ApiModelProperty(value = "评论内容") private String cdcContent; /** * 评论时间(创建时间) */ + @ApiModelProperty(value = "评论时间") private Date cdcTime; - + @ApiModelProperty(value = "用户") private List personUser; public List getPersonUser() { diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/Dynamic.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/Dynamic.java index 2087dff..526568f 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/Dynamic.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/Dynamic.java @@ -1,16 +1,20 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.springframework.data.relational.core.sql.In; import java.io.Serializable; import java.util.Date; - +@ApiModel(value = "社区动态实体类") public class Dynamic implements Serializable { - + @ApiModelProperty(value = "图片链接") private String url; + @ApiModelProperty(value = "图片主题") private String title; + @ApiModelProperty(value = "发布时间") private Date timee; - + @ApiModelProperty(value = "动态id") private Integer dynamicId; public Integer getDynamicId() { diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/DynamicCommit.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/DynamicCommit.java index 1c83942..2864a00 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/DynamicCommit.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/DynamicCommit.java @@ -1,15 +1,22 @@ package com.team7.happycommunity.personcentor.entity; import aQute.bnd.service.repository.SearchableRepository; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import java.util.Date; - +@ApiModel(value = "社区动态评论实体类") public class DynamicCommit implements Serializable { + @ApiModelProperty(value = "评论id") private Integer id;//评论id + @ApiModelProperty(value = "评论内容") private String cdcContent; + @ApiModelProperty(value = "评论时间") private Date cdcTime; + @ApiModelProperty(value = "评论姓名") private String name; + @ApiModelProperty(value = "用户头像") private String url; public Integer getId() { diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/MyPublishAcitivity.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/MyPublishAcitivity.java index 33d4b94..da3ebac 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/MyPublishAcitivity.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/MyPublishAcitivity.java @@ -1,18 +1,21 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; import java.util.Date; - +@ApiModel(value = "发表活动实体类") public class MyPublishAcitivity implements Serializable { - + @ApiModelProperty(value = "活动id") private String acId;//活动id - + @ApiModelProperty(value = "个人头像") private String url;//个人头像 - + @ApiModelProperty(value = "个人别称") private String nickname;//个人别称 - + @ApiModelProperty(value = "活动主题") private String CaTitle;//活动主题 - + @ApiModelProperty(value = "活动创建时间") private Date caCreateTime;//活动创建时间 diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonCollectUser.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonCollectUser.java index a5fc704..0b14c5b 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonCollectUser.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonCollectUser.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.util.Date; import java.io.Serializable; @@ -9,17 +12,18 @@ import java.io.Serializable; * @author makejava * @since 2020-03-22 21:19:30 */ +@ApiModel(value = "用户收藏实体类") public class PersonCollectUser implements Serializable { private static final long serialVersionUID = 828483762597894081L; - + @ApiModelProperty(value = "收藏用户id") private Integer collectUserId; - + @ApiModelProperty(value = "评论用户id") private Integer concernedUserId; - + @ApiModelProperty(value = "关注用户id") private Integer focusedUserId; - + @ApiModelProperty(value = "评论id") private Integer dynamicId; - + @ApiModelProperty(value = "关注时间") private Date attentTmie; diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonImage.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonImage.java index e33f667..477cb88 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonImage.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonImage.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.util.Date; import java.io.Serializable; @@ -9,21 +12,22 @@ import java.io.Serializable; * @author makejava * @since 2020-03-22 21:19:30 */ +@ApiModel(value = "图片实体类") public class PersonImage implements Serializable { private static final long serialVersionUID = 651560723597011661L; - + @ApiModelProperty(value = "id") private Integer id; - + @ApiModelProperty(value = "小区id(小区图片)") private Integer personPlotId; - + @ApiModelProperty(value = "住宅表的id(住宅id)") private Integer personHomeId; - + @ApiModelProperty(value = "用户表的id") private Integer personUserId; - + @ApiModelProperty(value = "(0-用户空间图片,1-用户头像)") private Integer state; - + @ApiModelProperty(value = "上传时间") private Date time; - + @ApiModelProperty(value = "图片链接") private String url; diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonUser.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonUser.java index 9098812..0ba6096 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonUser.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/PersonUser.java @@ -1,5 +1,8 @@ package com.team7.happycommunity.personcentor.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.util.Date; import java.io.Serializable; import java.util.List; @@ -10,41 +13,42 @@ import java.util.List; * @author makejava * @since 2020-03-20 19:21:36 */ +@ApiModel(value = "用户实体类") public class PersonUser implements Serializable { private static final long serialVersionUID = 156440124825734371L; - + @ApiModelProperty(value = "id") private Integer id; - + @ApiModelProperty(value = "身份证") private String idNumber; - + @ApiModelProperty(value = "手机号") private String cellPhNumber; - + @ApiModelProperty(value = "密码") private String password; - + @ApiModelProperty(value = "姓名") private String name; - + @ApiModelProperty(value = "性别") private Integer sex; - + @ApiModelProperty(value = "昵称") private String nickname; - + @ApiModelProperty(value = "邮箱") private String mailbox; - + @ApiModelProperty(value = "小区id") private Integer plotId; - + @ApiModelProperty(value = "标签") private String tag; - + @ApiModelProperty(value = "邮箱状态") private Integer mailboxStatus; - + @ApiModelProperty(value = "邮箱的令牌") private String code; - + @ApiModelProperty(value = "盐") private String passwordSalt; - + @ApiModelProperty(value = "账户创建时间") private Date createTime; - + @ApiModelProperty(value = "小区实体类") private Areainfo areainfo; - + @ApiModelProperty(value = "用户图片实体类") private List personImage; - + @ApiModelProperty(value = "动态评论实体类") private List communityDynamic; diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/service/impl/PersonUserServiceImpl.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/service/impl/PersonUserServiceImpl.java index 965e969..b4dade0 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/service/impl/PersonUserServiceImpl.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/service/impl/PersonUserServiceImpl.java @@ -96,13 +96,13 @@ public class PersonUserServiceImpl implements PersonUserService { throw new RegisterException("姓名已存在"); } PersonUser user2=new PersonUser(); - user.setNickname(personUser.getNickname()); + user2.setNickname(personUser.getNickname()); List personUsers2 = personUserDao.queryAll(user2); if(personUsers2!=null&&personUsers2.size()>0){ throw new RegisterException("昵称已存在"); } PersonUser user3=new PersonUser(); - user.setMailbox(personUser.getMailbox()); + user3.setMailbox(personUser.getMailbox()); List personUsers3 = personUserDao.queryAll(user3); if(personUsers3!=null&&personUsers3.size()>0){ throw new RegisterException("邮箱已存在"); @@ -143,18 +143,20 @@ public class PersonUserServiceImpl implements PersonUserService { public boolean queryMailbox(String mailbox) { PersonUser user = personUserDao.queryByMailbox(mailbox); if(user==null||user.getMailboxStatus()!=0){ + if(user!=null&&user.getMailboxStatus()!=0){ + personUserDao.deleteByMailbox(mailbox); + } return true; } return false; } - @Override public void register(PersonUser user) { // 发送邮件,存储邮箱,并将mailbox_status状态改为1,并随机生成一个code邮箱令牌,并存储到数据库,密码加密 //1.生成一个UUID数字 String code = UUID.randomUUID().toString().replace("_",""); user.setCode(code); - String content="点击激活"; + String content="点击激活"; MailUtils.sendMail(user.getMailbox(),content,"幸福小区邀请您注册,请点击链接"); //2.进行密码加密 try { diff --git a/personcentor/src/main/resources/application.properties b/personcentor/src/main/resources/application.properties index 3827360..99e9038 100644 --- a/personcentor/src/main/resources/application.properties +++ b/personcentor/src/main/resources/application.properties @@ -3,5 +3,5 @@ accessKeySecret=6Isjtn6eBPaas1NNBpfVczkAEY7BDB smsCode=SMS_186615599 param={"code":"[value]"} website=localhost -port=80 +port=9100 diff --git a/personcentor/src/main/resources/mapper/PersonUserDao.xml b/personcentor/src/main/resources/mapper/PersonUserDao.xml index d306ecf..8564f06 100644 --- a/personcentor/src/main/resources/mapper/PersonUserDao.xml +++ b/personcentor/src/main/resources/mapper/PersonUserDao.xml @@ -211,4 +211,7 @@ LEFT JOIN person_user ON person_collect_user.focused_user_id=person_user.id WHER update person_image set url=#{imgurl} where person_image.person_user_id=#{id} and state=1 + + delete from happycommunity.person_user where mailbox = #{mailbox} + \ No newline at end of file -- Gitee From d034b1070f16cf0ff5308a2f603e8d1890466ead Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=B4=8B?= <5607798+zhuayng@user.noreply.gitee.com> Date: Fri, 10 Apr 2020 14:31:32 +0800 Subject: [PATCH 23/27] update businessservice/src/main/resources/application.properties. --- businessservice/src/main/resources/application.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/businessservice/src/main/resources/application.properties b/businessservice/src/main/resources/application.properties index ca703a4..ef671ab 100644 --- a/businessservice/src/main/resources/application.properties +++ b/businessservice/src/main/resources/application.properties @@ -1,6 +1,6 @@ -accessKeyId=LTAI4FikHBhJzcaPm22pWeGS -accessKeySecret=6Isjtn6eBPaas1NNBpfVczkAEY7BDB -smsCode=SMS_186615599 +accessKeyId= +accessKeySecret= +smsCode= param={"code":"[value]"} website=localhost port=80 \ No newline at end of file -- Gitee From b2b265d61aae271296911381d6f34a9e666b9e5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=B4=8B?= <5607798+zhuayng@user.noreply.gitee.com> Date: Fri, 10 Apr 2020 14:32:27 +0800 Subject: [PATCH 24/27] update businessservice/src/main/java/com/team7/happycommunity/businessservice/util/MailUtils.java. --- .../team7/happycommunity/businessservice/util/MailUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/businessservice/src/main/java/com/team7/happycommunity/businessservice/util/MailUtils.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/util/MailUtils.java index cb265d2..fa3ca30 100644 --- a/businessservice/src/main/java/com/team7/happycommunity/businessservice/util/MailUtils.java +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/util/MailUtils.java @@ -9,9 +9,9 @@ import java.util.Properties; * 发邮件工具类 */ public final class MailUtils { - private static final String USER = "2870485806@qq.com"; // 发件人称号,同邮箱地址 + private static final String USER = ""; // 发件人称号,同邮箱地址 //使用POP3/SMTP服务的授权码 - private static final String PASSWORD = "ubtdveqxwecsdcjg"; // 如果是qq邮箱可以使户端授权码,或者登录密码 + private static final String PASSWORD = ""; // 如果是qq邮箱可以使户端授权码,或者登录密码 /** * -- Gitee From 67296817d71e38f9d48de3760d71b19a93bd3f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=B4=8B?= <5607798+zhuayng@user.noreply.gitee.com> Date: Fri, 10 Apr 2020 14:33:12 +0800 Subject: [PATCH 25/27] update personcentor/src/main/resources/application.properties. --- personcentor/src/main/resources/application.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/personcentor/src/main/resources/application.properties b/personcentor/src/main/resources/application.properties index 99e9038..12805e9 100644 --- a/personcentor/src/main/resources/application.properties +++ b/personcentor/src/main/resources/application.properties @@ -1,6 +1,6 @@ -accessKeyId=LTAI4FikHBhJzcaPm22pWeGS -accessKeySecret=6Isjtn6eBPaas1NNBpfVczkAEY7BDB -smsCode=SMS_186615599 +accessKeyId= +accessKeySecret= +smsCode= param={"code":"[value]"} website=localhost port=9100 -- Gitee From b2e4230aec9e97a2e7942cf82640afd996da9729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E6=B4=8B?= <5607798+zhuayng@user.noreply.gitee.com> Date: Fri, 10 Apr 2020 14:33:48 +0800 Subject: [PATCH 26/27] update personcentor/src/main/java/com/team7/happycommunity/personcentor/util/MailUtils.java. --- .../com/team7/happycommunity/personcentor/util/MailUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/util/MailUtils.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/util/MailUtils.java index d59c040..cefd71f 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/util/MailUtils.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/util/MailUtils.java @@ -9,9 +9,9 @@ import java.util.Properties; * 发邮件工具类 */ public final class MailUtils { - private static final String USER = "2870485806@qq.com"; // 发件人称号,同邮箱地址 + private static final String USER = ""; // 发件人称号,同邮箱地址 //使用POP3/SMTP服务的授权码 - private static final String PASSWORD = "ubtdveqxwecsdcjg"; // 如果是qq邮箱可以使户端授权码,或者登录密码 + private static final String PASSWORD = ""; // 如果是qq邮箱可以使户端授权码,或者登录密码 /** * -- Gitee From 97bbd04a461ae25aefb384fd0da92e54315391e7 Mon Sep 17 00:00:00 2001 From: jingkang <1248303996@qq.com> Date: Fri, 10 Apr 2020 14:54:56 +0800 Subject: [PATCH 27/27] =?UTF-8?q?pc=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pccenter/pom.xml | 40 ++++++++--- .../java/com/woniu/PccenterApplication.java | 2 + .../java/com/woniu/config/ShiroConfig.java | 6 +- .../java/com/woniu/config/Swagger2Config.java | 67 +++++++++++++++++++ .../ActivityComplainController.java | 19 ++++++ .../woniu/controller/ActivityController.java | 19 ++++++ .../com/woniu/controller/AdminController.java | 22 ++++++ .../woniu/controller/ComplainController.java | 26 +++++-- .../controller/DynamicCommentController.java | 28 +++++++- .../com/woniu/controller/MenusController.java | 23 +++++++ .../woniu/controller/MerchantController.java | 19 ++++++ .../controller/PropertyManageController.java | 20 +++++- .../com/woniu/controller/RolesController.java | 26 +++++++ .../controller/ServiceCommentController.java | 22 +++++- .../src/main/java/com/woniu/pojo/Admin.java | 2 + 15 files changed, 318 insertions(+), 23 deletions(-) create mode 100644 pccenter/src/main/java/com/woniu/config/Swagger2Config.java diff --git a/pccenter/pom.xml b/pccenter/pom.xml index c0d7080..7b74e38 100644 --- a/pccenter/pom.xml +++ b/pccenter/pom.xml @@ -105,12 +105,40 @@ + + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + 2.2.2.RELEASE + + + + org.springframework.cloud + spring-cloud-starter-netflix-zuul + 2.2.2.RELEASE + + + + io.springfox + springfox-swagger2 + 2.9.2 + + + io.swagger + swagger-annotations + + + io.swagger + swagger-models + + + io.springfox springfox-swagger-ui 2.9.2 - io.swagger swagger-annotations @@ -121,16 +149,6 @@ swagger-models 1.5.21 - - - org.springframework.cloud - spring-cloud-starter-netflix-eureka-client - - - - org.springframework.cloud - spring-cloud-starter-netflix-zuul - diff --git a/pccenter/src/main/java/com/woniu/PccenterApplication.java b/pccenter/src/main/java/com/woniu/PccenterApplication.java index 56afdaf..7c961e4 100644 --- a/pccenter/src/main/java/com/woniu/PccenterApplication.java +++ b/pccenter/src/main/java/com/woniu/PccenterApplication.java @@ -4,9 +4,11 @@ import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cloud.netflix.eureka.EnableEurekaClient; @SpringBootApplication @MapperScan(value = "com.woniu.dao") +@EnableEurekaClient public class PccenterApplication { public static void main(String[] args) { diff --git a/pccenter/src/main/java/com/woniu/config/ShiroConfig.java b/pccenter/src/main/java/com/woniu/config/ShiroConfig.java index e40264f..0fa4e6d 100644 --- a/pccenter/src/main/java/com/woniu/config/ShiroConfig.java +++ b/pccenter/src/main/java/com/woniu/config/ShiroConfig.java @@ -47,7 +47,11 @@ public class ShiroConfig { map.put("/admin/subLogin","anon"); map.put("/src/**","anon"); map.put("/logout","logout"); - map.put("/**","authc"); + map.put("/swagger-ui.html**", "anon"); + map.put("/v2/api-docs", "anon"); + map.put("/swagger-resources/**", "anon"); + map.put("/webjars/**", "anon"); + //map.put("/**","authc"); filterFactoryBean.setFilterChainDefinitionMap(map); return filterFactoryBean; } diff --git a/pccenter/src/main/java/com/woniu/config/Swagger2Config.java b/pccenter/src/main/java/com/woniu/config/Swagger2Config.java new file mode 100644 index 0000000..66a5943 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/config/Swagger2Config.java @@ -0,0 +1,67 @@ +package com.woniu.config; + +import io.swagger.annotations.Api; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.PathSelectors; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +@Configuration +@EnableSwagger2 +public class Swagger2Config extends WebMvcConfigurationSupport { + + @Bean + public Docket createRestApi(){ + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo()) + .select() + //为当前包下controller生成API文档 +// .apis(RequestHandlerSelectors.basePackage("com.troila")) + //为有@Api注解的Controller生成API文档 +// .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) + //为有@ApiOperation注解的方法生成API文档 +// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) + //为任何接口生成API文档 + .apis(RequestHandlerSelectors.any()) + .paths(PathSelectors.any()) + .build(); + //添加登录认证 + /*.securitySchemes(securitySchemes()) + .securityContexts(securityContexts());*/ + } + + private ApiInfo apiInfo() { + Contact contact = new Contact("yunqing", "", "yunqing****@gmail.com"); + return new ApiInfoBuilder() + .title("SwaggerUI演示") + .description("接口文档,描述词省略200字") + .contact(contact) + .version("1.0") + .build(); + } + + /** + * 配置swagger2的静态资源路径 + * @param registry + */ + @Override + protected void addResourceHandlers(ResourceHandlerRegistry registry) { + // 解决静态资源无法访问 + registry.addResourceHandler("/**") + .addResourceLocations("classpath:/static/"); + // 解决swagger无法访问 + registry.addResourceHandler("/swagger-ui.html") + .addResourceLocations("classpath:/META-INF/resources/"); + // 解决swagger的js文件无法访问 + registry.addResourceHandler("/webjars/**") + .addResourceLocations("classpath:/META-INF/resources/webjars/"); + } +} diff --git a/pccenter/src/main/java/com/woniu/controller/ActivityComplainController.java b/pccenter/src/main/java/com/woniu/controller/ActivityComplainController.java index f0a5a5f..261607e 100644 --- a/pccenter/src/main/java/com/woniu/controller/ActivityComplainController.java +++ b/pccenter/src/main/java/com/woniu/controller/ActivityComplainController.java @@ -4,6 +4,10 @@ import com.github.pagehelper.PageInfo; import com.woniu.common.CommonResult; import com.woniu.dto.ActivityComplainDTO; import com.woniu.service.ActivityComplainService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -14,6 +18,7 @@ import java.util.List; @Controller @RequestMapping("/ac_complain") +@Api(tags ="活动投诉") public class ActivityComplainController { @Autowired @@ -28,6 +33,11 @@ public class ActivityComplainController { @RequestMapping("list") @ResponseBody @RequiresPermissions("sys:acc:list") + @ApiOperation(value = "活动投诉列表分页查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "currentPage",value = "当前页数",defaultValue = "1"), + @ApiImplicitParam(name = "pageSize",value = "每页数据条数",defaultValue = "5") + }) public CommonResult list(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ PageInfo info=null; @@ -48,6 +58,8 @@ public class ActivityComplainController { @RequestMapping("/reply/{id}") @ResponseBody @RequiresPermissions("sys:acc:reply") + @ApiOperation(value = "导航到回复投诉的页面") + @ApiImplicitParam(name = "id",value = "投诉列表ID",dataType = "Integer") public ModelAndView reply(@PathVariable("id")Integer id){ ActivityComplainDTO activityComplainDTO=acComplainService.findById(id); ModelAndView model=new ModelAndView("sys/ac_reply"); @@ -62,6 +74,8 @@ public class ActivityComplainController { */ @PutMapping("/editComplain") @ResponseBody + @ApiOperation(value = "投诉回复内容的添加") + @ApiImplicitParam(name = "activityComplainDTO",value = "回复内容") public CommonResult addReply(ActivityComplainDTO activityComplainDTO){ try { acComplainService.addReply(activityComplainDTO); @@ -81,6 +95,11 @@ public class ActivityComplainController { */ @RequestMapping("/select") @ResponseBody + @ApiOperation(value = "活动投诉页面搜索") + @ApiImplicitParams({ + @ApiImplicitParam(name = "nickName",value = "用户姓名"), + @ApiImplicitParam(name = "title",value = "活动标题") + }) public CommonResult select(String nickName,String title){ PageInfo info=null; try { diff --git a/pccenter/src/main/java/com/woniu/controller/ActivityController.java b/pccenter/src/main/java/com/woniu/controller/ActivityController.java index fc5f701..011de0a 100644 --- a/pccenter/src/main/java/com/woniu/controller/ActivityController.java +++ b/pccenter/src/main/java/com/woniu/controller/ActivityController.java @@ -4,6 +4,10 @@ import com.github.pagehelper.PageInfo; import com.woniu.common.CommonResult; import com.woniu.dto.ActivityDTO; import com.woniu.service.ActivityService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -13,6 +17,7 @@ import java.util.Date; import java.util.List; @Controller @RequestMapping("/activity") +@Api(tags = "活动审批模块") public class ActivityController { @Autowired @@ -27,6 +32,11 @@ public class ActivityController { @RequestMapping("/list") @ResponseBody @RequiresPermissions("sys:al:list") + @ApiOperation(value = "活动审批分页查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "currentPage",value = "当前页数",defaultValue = "1"), + @ApiImplicitParam(name = "pageSize",value = "每页数据条数",defaultValue = "5") + }) public CommonResult pmList(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ PageInfo info = null; @@ -49,6 +59,8 @@ public class ActivityController { @PutMapping("/confirm/{id}") @ResponseBody @RequiresPermissions("sys:al:examine") + @ApiOperation(value = "活动审批") + @ApiImplicitParam(name = "id",value = "活动编号id值",dataType = "Integer") public CommonResult confirmPM(@PathVariable("id") Integer id){ System.out.println("活动确认审核"+id); Date examineTime=new Date(); @@ -69,6 +81,11 @@ public class ActivityController { */ @RequestMapping("/select") @ResponseBody + @ApiOperation(value = "活动审批页面搜索") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name",value = "用户名称"), + @ApiImplicitParam(name = "status",value = "审批状态",dataType = "Integer") + }) public CommonResult select(String name,Integer status){ PageInfo info=null; try { @@ -88,6 +105,8 @@ public class ActivityController { */ @RequestMapping("/refuse/{id}") @ResponseBody + @ApiOperation(value = "拒绝审批") + @ApiImplicitParam(name = "id",value = "活动编号id值",dataType = "Integer") public CommonResult refuse(@PathVariable("id")Integer id){ //获取当前时间 Date examineTime=new Date(); diff --git a/pccenter/src/main/java/com/woniu/controller/AdminController.java b/pccenter/src/main/java/com/woniu/controller/AdminController.java index e1c98c4..f41970e 100644 --- a/pccenter/src/main/java/com/woniu/controller/AdminController.java +++ b/pccenter/src/main/java/com/woniu/controller/AdminController.java @@ -7,6 +7,10 @@ import com.woniu.pojo.Admin; import com.woniu.pojo.Roles; import com.woniu.service.AdminService; import com.woniu.service.RolesService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.Transformer; import org.apache.shiro.SecurityUtils; @@ -29,6 +33,7 @@ import java.util.List; @Controller @RequestMapping("/admin") +@Api(tags = "管理员列表") public class AdminController { @Autowired @@ -47,6 +52,11 @@ public class AdminController { @RequestMapping("/list") @ResponseBody @RequiresPermissions("sys:admin:list") + @ApiOperation(value = "管理员列表分页展示数据") + @ApiImplicitParams({ + @ApiImplicitParam(name = "currentPage",value = "当前页数",defaultValue = "1"), + @ApiImplicitParam(name = "pageSize",value = "页面数据条数",defaultValue = "5") + }) public CommonResult list(@RequestParam(value = "page", defaultValue = "1", required = false) Integer currentPage, @RequestParam(value = "limit", defaultValue = "10", required = false) Integer pageSize) { PageInfo info = null; @@ -69,6 +79,7 @@ public class AdminController { * @param modelAndView * @return */ + @ApiOperation(value = "导航到添加管理员页面") @RequestMapping("/addAdmin") public ModelAndView addAdmin(ModelAndView modelAndView) { List roles = rolesService.findAll(); @@ -86,6 +97,8 @@ public class AdminController { @PostMapping("/saveAdmin") @ResponseBody @RequiresPermissions("sys:admin:save") + @ApiOperation(value = "添加管理员") + @ApiImplicitParam(name = "admin",value = "前端获取添加管理员的信息",paramType = "form") public CommonResult saveAdmin(Admin admin) { //验证用户名是否重复 @@ -111,6 +124,8 @@ public class AdminController { @DeleteMapping("/delAdmin/{keys}") @ResponseBody @RequiresPermissions("sys:admin:delete") + @ApiOperation(value = "批量删除管理员") + @ApiImplicitParam(name = "keys",value = "管理员id值的字符串",required = true) public CommonResult delAdmin(@PathVariable("keys") String keys) { List keysStringList = Arrays.asList(keys.split(",")); List list = new ArrayList<>(); @@ -135,6 +150,7 @@ public class AdminController { * @return */ @RequestMapping("/editAdmin/{id}") + @ApiOperation(value = "导航到编辑页面") public ModelAndView editAdmin(@PathVariable("id") Integer id) { Admin admin = adminService.findById(id); ModelAndView modelAndView = new ModelAndView("/sys/editAdmin"); @@ -153,6 +169,8 @@ public class AdminController { @PutMapping("/updateAdmin") @ResponseBody @RequiresPermissions("sys:admin:update") + @ApiOperation(value ="更新管理员" ) + @ApiImplicitParam(name = "admin",value = "传入修改管理员信息的值",paramType = "form") public CommonResult updateAdmin(Admin admin) { Admin dbAdmin = adminService.checkName(admin); if (dbAdmin != null) { @@ -177,6 +195,8 @@ public class AdminController { @DeleteMapping("/deleteAdmin/{id}") @ResponseBody @RequiresPermissions("sys:admin:delete") + @ApiOperation(value = "删除管理员") + @ApiImplicitParam(name = "id",value = "管理员ID值",dataType = "Integer") public CommonResult deleteAdmin(@PathVariable("id") Integer id) { try { adminService.deleteById(id); @@ -196,6 +216,8 @@ public class AdminController { @PostMapping("/subLogin") @ResponseBody + @ApiOperation(value = "后台管理员的登录验证") + @ApiImplicitParam(name = "admin",value = "账号与密码",required = true) public CommonResult subLogin(Admin admin) { System.out.println("传入的账号:"+admin.getUsername()); System.out.println("传入的密码:"+admin.getPassword()); diff --git a/pccenter/src/main/java/com/woniu/controller/ComplainController.java b/pccenter/src/main/java/com/woniu/controller/ComplainController.java index 78d932a..e729946 100644 --- a/pccenter/src/main/java/com/woniu/controller/ComplainController.java +++ b/pccenter/src/main/java/com/woniu/controller/ComplainController.java @@ -4,16 +4,22 @@ import com.github.pagehelper.PageInfo; import com.woniu.common.CommonResult; import com.woniu.dto.ComplainDTO; import com.woniu.service.ComplainService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; +import javax.naming.Name; import java.util.List; @Controller @RequestMapping("/complain") +@Api(tags = "物业投诉模块") public class ComplainController { @Autowired @@ -28,6 +34,11 @@ public class ComplainController { @RequestMapping("/list") @ResponseBody @RequiresPermissions("sys:pmc:list") + @ApiOperation(value = "分页查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "currentPage",value = "当前页数",defaultValue = "1"), + @ApiImplicitParam(name = "pageSize",value = "页面数据条数",defaultValue = "5") + }) public CommonResult list(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ PageInfo info=null; @@ -48,6 +59,8 @@ public class ComplainController { */ @RequestMapping("/reply/{id}") @ResponseBody + @ApiOperation(value = "导航到回复投诉的页面") + @ApiImplicitParam(name = "id",value = "列表id",dataType = "Integer") public ModelAndView reply(@PathVariable("id")Integer id){ System.out.println("传入的id值为:"+id); ComplainDTO complainDTO=complainService.findById(id); @@ -64,9 +77,10 @@ public class ComplainController { @PutMapping("/editComplain") @ResponseBody @RequiresPermissions("sys:pmc:reply") + @ApiOperation("投诉回复") + @ApiImplicitParam(name = "complainDTO",value = "回复内容",required = true) public CommonResult addReply(ComplainDTO complainDTO){ - System.out.println("回复投诉传入的id值:"+complainDTO.getId()); - System.out.println("回复的内容:"+complainDTO.getContext()); + try{ complainService.addReply(complainDTO); return CommonResult.success("回复上传成功"); @@ -85,9 +99,13 @@ public class ComplainController { */ @RequestMapping("/select") @ResponseBody + @ApiOperation("页面查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "userName",value = "用户名称"), + @ApiImplicitParam(name = "status",value = "审批状态") + }) public CommonResult select(String userName,Integer status){ - System.out.println("传入的userName:"+userName); - System.out.println("传入的Status:"+status); + PageInfo info=null; try { List list=complainService.select(userName,status); diff --git a/pccenter/src/main/java/com/woniu/controller/DynamicCommentController.java b/pccenter/src/main/java/com/woniu/controller/DynamicCommentController.java index 10dda96..cd2d978 100644 --- a/pccenter/src/main/java/com/woniu/controller/DynamicCommentController.java +++ b/pccenter/src/main/java/com/woniu/controller/DynamicCommentController.java @@ -4,6 +4,10 @@ import com.github.pagehelper.PageInfo; import com.woniu.common.CommonResult; import com.woniu.dto.DynamicCommentDTO; import com.woniu.service.DynamicCommentService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -13,6 +17,7 @@ import java.util.List; @Controller @RequestMapping("/dynamic_comment") +@Api(tags ="活动评论") public class DynamicCommentController { @Autowired private DynamicCommentService dc_Service; @@ -20,6 +25,11 @@ public class DynamicCommentController { @RequestMapping("/list") @ResponseBody @RequiresPermissions("sys:dc:list") + @ApiOperation(value = "分页查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "currentPage",value = "当前页数",defaultValue = "1"), + @ApiImplicitParam(name = "pageSize",value = "页面数据条数",defaultValue = "5") + }) public CommonResult list(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ PageInfo info=null; @@ -40,7 +50,9 @@ public class DynamicCommentController { */ @DeleteMapping("/delComment/{id}") @ResponseBody - @RequiresPermissions("sys:dc:update") + @RequiresPermissions("sys:dc:delete") + @ApiOperation(value = "删除评论") + @ApiImplicitParam(name = "id",value = "活动评论列表id",dataType = "Integer") public CommonResult delComment(@PathVariable("id")Integer id){ try { dc_Service.delComment(id); @@ -51,11 +63,21 @@ public class DynamicCommentController { return CommonResult.success("删除成功!"); } + /** + * 页面搜索 + * @param nickName + * @param dynamicType + * @return + */ @RequestMapping("/select") @ResponseBody + @ApiOperation("页面查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "nickName",value = "用户名称"), + @ApiImplicitParam(name = "dynamicType",value = "活动类型") + }) public CommonResult select(String nickName,Integer dynamicType){ - System.out.println("nickName:"+nickName); - System.out.println("dynamicType:"+dynamicType); + PageInfo info=null; try { List list=dc_Service.select(nickName,dynamicType); diff --git a/pccenter/src/main/java/com/woniu/controller/MenusController.java b/pccenter/src/main/java/com/woniu/controller/MenusController.java index 26a38be..6e5c485 100644 --- a/pccenter/src/main/java/com/woniu/controller/MenusController.java +++ b/pccenter/src/main/java/com/woniu/controller/MenusController.java @@ -8,6 +8,10 @@ import com.woniu.exception.MenuServiceException; import com.woniu.pojo.Admin; import com.woniu.pojo.Menus; import com.woniu.service.MenusService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.SecurityUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -21,6 +25,7 @@ import java.util.Map; @Controller @RequestMapping("/menus") +@Api(tags ="菜单管理") public class MenusController { @Autowired @@ -32,6 +37,7 @@ public class MenusController { */ @RequestMapping("/getMenus") @ResponseBody + @ApiOperation(value = "加载主页菜单数据") public List getMenus(){ //根据当前登录用户的角色来获取该用户能够访问哪些资源 Admin admin = (Admin) SecurityUtils.getSubject().getPrincipal(); @@ -45,6 +51,7 @@ public class MenusController { */ @RequestMapping("/loadTree") @ResponseBody + @ApiOperation(value = "加载树形菜单的数据") public String loadTree(){ List menus = menusService.findAll(); ObjectMapper mapper = new ObjectMapper(); @@ -65,6 +72,8 @@ public class MenusController { */ @RequestMapping("/loadCheckTree/{roleId}") @ResponseBody + @ApiOperation(value = "根据角色id查询菜单数据") + @ApiImplicitParam(name = "id",value = "角色ID值",dataType = "Integer") public String loadCheckTree(@PathVariable("roleId")Integer id){ List list = menusService.findCheckMenusByRoleId(id); ObjectMapper mapper = new ObjectMapper(); @@ -83,6 +92,7 @@ public class MenusController { @GetMapping("/loadMenus") @ResponseBody @RequiresPermissions("sys:menu:list") + @ApiOperation(value = "查询菜单列表的数据") public Map loadMenus(){ List menus = menusService.findAll(); Map result = new HashMap(); @@ -99,6 +109,7 @@ public class MenusController { * @return */ @RequestMapping("/addMenu/{parentId}") + @ApiOperation(value = "导航到添加菜单的页面") public String addMenu(Model model,@PathVariable("parentId") Long parentId){ model.addAttribute("parentId",parentId);//添加菜单节点的父Id return "/sys/addMenu"; @@ -112,6 +123,8 @@ public class MenusController { @PostMapping("/saveMenu") @ResponseBody @RequiresPermissions("sys:menu:save") + @ApiOperation(value = "添加菜单") + @ApiImplicitParam(name = "menus",value = "添加菜单信息") public CommonResult saveMenu(Menus menus){ //验证同级目录下的菜单节点名称不能重复 if(menusService.checkMenuName(menus)){ @@ -134,6 +147,8 @@ public class MenusController { @DeleteMapping("/del/{id}") @ResponseBody @RequiresPermissions("sys:menu:delete") + @ApiOperation(value = "删除菜单") + @ApiImplicitParam(name = "id",value = "菜单列表id",dataType = "Integer") public CommonResult del(@PathVariable("id") Integer mid){ try { menusService.delMenus(mid); @@ -154,6 +169,7 @@ public class MenusController { * @return */ @RequestMapping("/editMenu/{menuId}") + @ApiOperation(value = "导航到编辑菜单页面") public String updateMenu(Model model,@PathVariable("menuId") Integer menuId){ //查询该menuId下的数据 Menus menus=menusService.findByMenuId(menuId); @@ -168,6 +184,8 @@ public class MenusController { @PutMapping("/editMenu") @ResponseBody @RequiresPermissions("sys:menu:update") + @ApiOperation(value = "菜单编辑") + @ApiImplicitParam(name = "menus",value = "修改菜单信息") public CommonResult updateMenus(Menus menus){ try { menusService.updateMenus(menus); @@ -187,6 +205,11 @@ public class MenusController { */ @PutMapping("/updateMenusSorting") @ResponseBody + @ApiOperation(value = "菜单排序") + @ApiImplicitParams({ + @ApiImplicitParam(name = "menuId",value = "菜单ID",dataType = "Integer"), + @ApiImplicitParam(name = "sorting",value = "排序数值") + }) public CommonResult updateMenusSorting(Integer menuId, String sorting){ try { Integer.parseInt(sorting); diff --git a/pccenter/src/main/java/com/woniu/controller/MerchantController.java b/pccenter/src/main/java/com/woniu/controller/MerchantController.java index f591193..83562b5 100644 --- a/pccenter/src/main/java/com/woniu/controller/MerchantController.java +++ b/pccenter/src/main/java/com/woniu/controller/MerchantController.java @@ -4,6 +4,10 @@ import com.github.pagehelper.PageInfo; import com.woniu.common.CommonResult; import com.woniu.dto.MerchantDTO; import com.woniu.service.MerchantService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -15,6 +19,7 @@ import java.util.List; @Controller @RequestMapping("/merchant") +@Api(tags ="商家管理") public class MerchantController { @Autowired @@ -29,6 +34,11 @@ public class MerchantController { @RequestMapping("/list") @ResponseBody @RequiresPermissions("sys:ml:list") + @ApiOperation(value = "分页查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "currentPage",value = "当前页数",defaultValue = "1"), + @ApiImplicitParam(name = "pageSize",value = "页面数据条数",defaultValue = "5") + }) public CommonResult list(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ PageInfo info=null; @@ -51,6 +61,8 @@ public class MerchantController { @PutMapping("/confirm/{id}") @ResponseBody @RequiresPermissions("sys:ml:examine") + @ApiOperation(value = "商家审批") + @ApiImplicitParam(name = "id",value = "商家id值",dataType = "Integer") private CommonResult confirmPM(@PathVariable("id") Integer id){ //获取当前操作的时间 Date examineTime=new Date(); @@ -71,6 +83,11 @@ public class MerchantController { */ @RequestMapping("/select") @ResponseBody + @ApiOperation("页面查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "nickName",value = "用户名称"), + @ApiImplicitParam(name = "status",value = "审批状态") + }) public CommonResult select(String nickName,Integer status){ PageInfo info=null; try { @@ -90,6 +107,8 @@ public class MerchantController { */ @RequestMapping("/refuse/{id}") @ResponseBody + @ApiOperation(value = "拒绝审批") + @ApiImplicitParam(name = "id",value = "商家id值",dataType = "Integer") public CommonResult refuse(@PathVariable("id")Integer id){ Date refuseTime=new Date(); try { diff --git a/pccenter/src/main/java/com/woniu/controller/PropertyManageController.java b/pccenter/src/main/java/com/woniu/controller/PropertyManageController.java index 9ea489a..4719f5a 100644 --- a/pccenter/src/main/java/com/woniu/controller/PropertyManageController.java +++ b/pccenter/src/main/java/com/woniu/controller/PropertyManageController.java @@ -5,6 +5,10 @@ import com.woniu.common.CommonResult; import com.woniu.dto.MerchantDTO; import com.woniu.pojo.PropertyManage; import com.woniu.service.ProperManageService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -16,6 +20,7 @@ import java.util.List; @Controller @RequestMapping("/pm") +@Api(tags = "物业审核") public class PropertyManageController { @Autowired @@ -30,6 +35,11 @@ public class PropertyManageController { @RequestMapping("/list") @ResponseBody @RequiresPermissions("sys:pm:list") + @ApiOperation(value = "分页查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "currentPage",value = "当前页数",defaultValue = "1"), + @ApiImplicitParam(name = "pageSize",value = "页面数据条数",defaultValue = "5") + }) public CommonResult pmList(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ PageInfo info = null; @@ -53,6 +63,8 @@ public class PropertyManageController { @PutMapping("/confirm/{id}") @ResponseBody @RequiresPermissions("sys:pm:examine") + @ApiOperation(value = "物业审批") + @ApiImplicitParam(name = "id",value = "物业id值",dataType = "Integer") public CommonResult confirmPM(@PathVariable("id") Integer id){ //获取当前时间 Date passTime=new Date(); @@ -73,11 +85,15 @@ public class PropertyManageController { */ @RequestMapping("/select") @ResponseBody + @ApiOperation(value = "物业审批页面搜索") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name",value = "用户名称"), + @ApiImplicitParam(name = "status",value = "审批状态",dataType = "Integer") + }) public CommonResult select(String userName,Integer status){ PageInfo info=null; try { List list=pmService.findList(userName,status); - System.out.println("查询到的列表数据条数:"+list.size()); info=new PageInfo(list); return CommonResult.success(info); } catch (Exception e) { @@ -93,6 +109,8 @@ public class PropertyManageController { */ @PutMapping("/refuse/{id}") @ResponseBody + @ApiOperation(value = "拒绝审批") + @ApiImplicitParam(name = "id",value = "商家列表id值",dataType = "Integer") public CommonResult refuse(@PathVariable("id")Integer id){ //获取当前时间 Date refuseTime=new Date(); diff --git a/pccenter/src/main/java/com/woniu/controller/RolesController.java b/pccenter/src/main/java/com/woniu/controller/RolesController.java index b0089c7..6470434 100644 --- a/pccenter/src/main/java/com/woniu/controller/RolesController.java +++ b/pccenter/src/main/java/com/woniu/controller/RolesController.java @@ -5,6 +5,10 @@ import com.woniu.common.CommonResult; import com.woniu.exception.RoleServiceException; import com.woniu.pojo.Roles; import com.woniu.service.RolesService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.Transformer; import org.apache.shiro.authz.annotation.RequiresPermissions; @@ -20,6 +24,7 @@ import java.util.stream.Collectors; @Controller @RequestMapping("/roles") +@Api(tags = "角色管理") public class RolesController { @Autowired @@ -28,6 +33,11 @@ public class RolesController { @RequestMapping("/list") @ResponseBody @RequiresPermissions("sys:role:list") + @ApiOperation(value = "分页查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "currentPage",value = "当前页数",defaultValue = "1"), + @ApiImplicitParam(name = "pageSize",value = "每页数据条数",defaultValue = "5") + }) public CommonResult list(@RequestParam(value="page",defaultValue = "1",required = false)Integer currentPage, @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ List roles = rolesService.findByPage(currentPage,pageSize); @@ -45,6 +55,11 @@ public class RolesController { @PostMapping("/saveRole") @ResponseBody @RequiresPermissions("sys:role:save") + @ApiOperation(value = "添加角色并授权") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roles",value = "角色信息"), + @ApiImplicitParam(name = "menuId",value = "菜单ID",dataType = "Integer") + }) public CommonResult saveRole(Roles roles,String menuId){ //检查角色的名称不能重复 Roles result = rolesService.findByRoleName(roles.getRoleName()); @@ -77,6 +92,8 @@ public class RolesController { * @return */ @GetMapping("/editRole/{id}") + @ApiOperation(value = "导航到编辑页面") + @ApiImplicitParam(name = "id",value = "角色ID",dataType = "Integer") public ModelAndView editRole(@PathVariable("id")Integer id){ Roles roles = rolesService.findById(id); ModelAndView modelAndView = new ModelAndView("/sys/editRole"); @@ -91,6 +108,11 @@ public class RolesController { @PutMapping("/updateRole") @ResponseBody @RequiresPermissions("sys:role:update") + @ApiOperation(value = "编辑角色") + @ApiImplicitParams({ + @ApiImplicitParam(name = "roles",value = "编辑后的角色信息"), + @ApiImplicitParam(name = "menuId",value = "菜单ID",dataType = "Integer") + }) public CommonResult updateRole(Roles roles,String menuId){ //检查更新的角色名称是否已经存 @@ -124,6 +146,8 @@ public class RolesController { @DeleteMapping("/del/{id}") @ResponseBody @RequiresPermissions("sys:role:delete") + @ApiOperation(value = "删除角色") + @ApiImplicitParam(name = "id",value = "角色ID",dataType = "Integer") public CommonResult del(@PathVariable("id")Integer roleId){ try { rolesService.delRole(roleId); @@ -145,6 +169,8 @@ public class RolesController { @DeleteMapping("/batchDel/{keys}") @ResponseBody @RequiresPermissions("sys:role:delete") + @ApiOperation(value = "批量删除角色") + @ApiImplicitParam(name = "keys",value ="角色ID字符串" ) public CommonResult batchDel(@PathVariable("keys")String keys){ //List rolesId =Arrays.stream(keys.split(",")).map(s->Long.parseLong(s)).collect(Collectors.toList()); List keysStringList = Arrays.asList(keys.split(",")); diff --git a/pccenter/src/main/java/com/woniu/controller/ServiceCommentController.java b/pccenter/src/main/java/com/woniu/controller/ServiceCommentController.java index 241e081..299c340 100644 --- a/pccenter/src/main/java/com/woniu/controller/ServiceCommentController.java +++ b/pccenter/src/main/java/com/woniu/controller/ServiceCommentController.java @@ -4,6 +4,10 @@ import com.github.pagehelper.PageInfo; import com.woniu.common.CommonResult; import com.woniu.dto.ServiceCommentDTO; import com.woniu.service.ServiceCommentService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -13,7 +17,7 @@ import java.util.List; @Controller @RequestMapping("/service_comment") -@RequiresPermissions("sys:sc:list") +@Api(tags ="服务评论") public class ServiceCommentController { @Autowired @@ -27,6 +31,12 @@ public class ServiceCommentController { */ @RequestMapping("/list") @ResponseBody + @RequiresPermissions("sys:sc:list") + @ApiOperation(value = "分页查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "currentPage",value = "当前页数",defaultValue = "1"), + @ApiImplicitParam(name = "pageSize",value = "页面数据条数",defaultValue = "5") + }) public CommonResult list(@RequestParam(value = "page",defaultValue = "1",required = false)Integer currentPage, @RequestParam(value = "limit",defaultValue = "5",required = false)Integer pageSize){ PageInfo info=null; @@ -48,6 +58,8 @@ public class ServiceCommentController { @DeleteMapping("/delComment/{id}") @ResponseBody @RequiresPermissions("sys:sc:delete") + @ApiOperation(value = "删除评论") + @ApiImplicitParam(name = "id",value = "服务评论列表id",dataType = "Integer") public CommonResult delComment(@PathVariable("id")Integer id){ try { scService.delComment(id); @@ -66,9 +78,13 @@ public class ServiceCommentController { */ @RequestMapping("/select") @ResponseBody + @ApiOperation("页面查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "nickName",value = "用户名称"), + @ApiImplicitParam(name = "payName",value = "服务名称") + }) public CommonResult select(String nickName,String payName){ - System.out.println("nickName:"+nickName); - System.out.println("payName:"+payName); + PageInfo info=null; try { List list=scService.select(nickName,payName); diff --git a/pccenter/src/main/java/com/woniu/pojo/Admin.java b/pccenter/src/main/java/com/woniu/pojo/Admin.java index 2ad2fe5..fbe86bf 100644 --- a/pccenter/src/main/java/com/woniu/pojo/Admin.java +++ b/pccenter/src/main/java/com/woniu/pojo/Admin.java @@ -1,5 +1,7 @@ package com.woniu.pojo; +import io.swagger.annotations.ApiModel; + import java.util.Date; public class Admin { -- Gitee