diff --git a/businessservice/pom.xml b/businessservice/pom.xml index 285c039f3165573e74cd845991954789923b2a6a..71cb92f77770ac5ec202efdaa48021c0679f276f 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 efb5e15b5b0304680e5b9e0831464bc86322dff6..1a097888331c5cbef26fe7359a5e1bb16db3e90e 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 d59eda0e8984322bf63d2c745d941824ae6095e0..f5138fd14f7e8ca58d825632ded48e7910643776 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 0000000000000000000000000000000000000000..c27dd73a2aae0d0e1ab51b1d85d6e49c44e71620 --- /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 b2dcf6940adb2e73d431811886c79ea0a9162207..b7a9d357cc1bded858b9ea03103252f26274d9e5 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 f4d85decbecad9040f87dbf3ce4a160ab1fb4164..af7bf38e4943212a269f66ffb2392b4187a8b1a4 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 { /** * 服务对象 @@ -38,4 +40,34 @@ public class BusinessImageController { } + /** + * 图片上传或者修改 + * @param file 图片 + * @param userId 用户id + * @return + */ + @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 { + String url = new QiniuUploadUtil().upload(name, file.getBytes()); + businessImageService.uploadHead(url,userId); + return CommonResult.success("上传成功"); + } catch (IOException e) { + e.printStackTrace(); + return CommonResult.failed("上传失败"); + } + + } } \ No newline at end of file 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 1ea3ab4b1afb8808785038237c1a5921ba47e470..3a2a3709463a33708a4e8759decda2608f5e8aed 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,14 +2,12 @@ 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; 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; @@ -27,6 +25,7 @@ import java.util.List; */ @RestController @RequestMapping("businessInfo") +@Api(tags="商家信息管理接口") public class BusinessInfoController { /** * 服务对象 @@ -59,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){ @@ -80,6 +89,7 @@ public class BusinessInfoController { */ @PostMapping("/mailboxRegister") @ResponseBody + public CommonResult mailboxRegister(BusinessInfo user){ //1.搜索邮箱,邮箱不存在或邮箱状态不为0 boolean flag=businessInfoService.queryMailbox(user.getMailbox()); @@ -98,14 +108,27 @@ public class BusinessInfoController { } /** - * 手机号码注册,密码重置 + * 验证码发送 * @param phone 手机号码 - * @param resetCode 密码重置参数,1密码重置,0注册 + * @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("请输入手机号"); + } try { businessInfoService.phoneRegister(phone,resetCode); @@ -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,10 +253,13 @@ public class BusinessInfoController { * @return */ @GetMapping("/queruyPersonageInfo") + @ApiOperation(value = "查询个人信息") 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; @@ -216,8 +269,11 @@ public class BusinessInfoController { * @return */ @GetMapping("/orderSum") + @ApiOperation(value = "查询商家拥有的订单数") 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); @@ -230,8 +286,11 @@ public class BusinessInfoController { * @return */ @GetMapping("/bookOrederSum") + @ApiOperation(value = "查询商家拥有的预订单数") 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); @@ -244,9 +303,12 @@ public class BusinessInfoController { * @return */ @GetMapping("/queryByUserId") + @ApiOperation(value = "查询商家查询其个人信息") 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); @@ -254,13 +316,153 @@ 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(); - 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 + @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 { + 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()); + loginToken.setUsername(businessInfo.getName()); + return CommonResult.success("登录成功",loginToken); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(e.getMessage()); + } + } + + /** + * 查询收益 + * @param userId 根据用户id + * @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")){ + money="0"; + } + return money; + } + + /** + * 根据用户的id修改昵称 + * @param info 用户信息 + * @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("用户未登录"); + } + + 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 + @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("用户未登录"); + } + 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 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 380c4494375795c9397525f8212aba422f942d32..0000000000000000000000000000000000000000 --- 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 b48d98b7897bde2a203686fc8d06ffb75c87ad57..e9621c365bfa722e9133c1c188e9725bc5e1405c 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,18 @@ 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 io.swagger.annotations.*; +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; @@ -25,6 +26,7 @@ import java.util.UUID; */ @RestController @RequestMapping("ppPayservice") +@Api(tags="服务接口") public class PpPayserviceController { /** * 服务对象 @@ -32,6 +34,15 @@ public class PpPayserviceController { @Resource private PpPayserviceService ppPayserviceService; + @Resource + private HttpServletRequest request; + + @Resource + private RedisTemplate redisTemplate; + + @Resource + private ServiceImgService serviceImgService; + /** @@ -53,22 +64,155 @@ public class PpPayserviceController { */ @PostMapping("/addService") @ResponseBody + @ApiOperation(value = "商家发布服务") + + @ApiResponses(value = { + @ApiResponse(code = 200,message = "发布成功"), + @ApiResponse(code = 500,message = "发布失败") + }) 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.valueOf(o)); + img.setServiceid(insert.getId()); + list.add(img); + } + //使用foreach插入多条数据 + //redisTemplate.opsForHash().delete(userId+""); + serviceImgService.insertList(list); //返回添加的服务id - return CommonResult.success(insert.getId()); + return CommonResult.success("发布成功"); + } catch (Exception e){ + e.printStackTrace(); + return CommonResult.failed("发布失败"); + } + } + + /** + * 查询商家的所有收益 + * @param userId 商家id + * @return + */ + @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); + System.out.println(list); + return list; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + + } + + /** + * 查询商家发布的服务,并根据时间排序 + * @param userId 用户id + * @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){ + + + //查询总条数 + 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") + @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 { + //删除服务 + 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("上传失败"); + return CommonResult.failed("修改失败"); } + } + /** + * 根据服务的id查询服务的详细信息 + * @param id 服务id + * @return 服务详情 + */ + @GetMapping("/queryDetailsById") + @ApiOperation(value = "查询服务的详细信息") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "id",value = "用户id",required = true) + }) + 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 a6a5b7a5df95aaf3a4124f4141f3d63bb0664cc6..ee96b59243b8a3df9ef133ea278c018472c42157 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,12 +5,17 @@ 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.*; import org.springframework.web.multipart.MultipartFile; +import sun.misc.BASE64Decoder; import javax.annotation.Resource; import java.io.IOException; import java.util.UUID; +import java.util.concurrent.TimeUnit; /** * (ServiceImg)表控制层 @@ -20,6 +25,7 @@ import java.util.UUID; */ @RestController @RequestMapping("serviceImg") +@Api(tags="服务图片接口") public class ServiceImgController { /** * 服务对象 @@ -27,6 +33,9 @@ public class ServiceImgController { @Resource private ServiceImgService serviceImgService; + @Autowired + RedisTemplate redisTemplate; + /** * 通过主键查询单条数据 * @@ -38,27 +47,51 @@ public class ServiceImgController { return this.serviceImgService.queryById(id); } + + /** * 图片上传 - * @param file 图片 - * @param id 服务id + * @param imgBase * @return */ @PostMapping("/upload") - @ResponseBody - public CommonResult upload(MultipartFile file, Integer id){ - 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) { + @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(); + 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(); - return CommonResult.success("上传失败"); } + //添加图片url; + String name = UUID.randomUUID().toString().replace("_", ""); + try { + String upload = new QiniuUploadUtil().upload(name, b1); + System.out.println("uploaduploadupload"+upload); + redisTemplate.opsForHash().put(userId+"",UUID.randomUUID(),upload); + redisTemplate.expire(userId+"", 10, TimeUnit.MINUTES); //设置超时时间10秒 第三个参数控制时间单位,详情查看TimeUnit + } catch (Exception e) { + e.printStackTrace(); + } + 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 87a84ed38793b046e4092080b5aa2e7e7914d945..cbdc6d8bfe0f8fffc414fb8641b5629472060a03 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; @@ -14,7 +17,10 @@ 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.HashMap; import java.util.List; +import java.util.Map; /** * (ServiceOrder)表控制层 @@ -24,6 +30,7 @@ import java.util.List; */ @RestController @RequestMapping("serviceOrder") +@Api(tags="服务订单接口") public class ServiceOrderController { /** * 服务对象 @@ -31,6 +38,12 @@ public class ServiceOrderController { @Resource private ServiceOrderService serviceOrderService; + @Resource + private HttpServletRequest request; + + @Autowired + private RabbitTemplate rabbitTemplate; + /** * 通过主键查询单条数据 * @@ -43,11 +56,20 @@ public class ServiceOrderController { } /** - * 根据商家id和交易状态查询 + * 根据商家id和交易状态查询商家的订单 * @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){ limit=2; } @@ -55,7 +77,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); @@ -64,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(); @@ -85,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); } @@ -95,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()){ @@ -109,8 +167,14 @@ 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); } + + } \ 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 969c1a801953504d80f796ec76660c2f26ea1134..b59d235cf9789e47b423ba438d78f2c432ed6b60 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 1d68c1e945553865db1440510a6166e0008d4864..a893a59eb2c22a08cf0fa165caa849b2b9f5f1d6 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,38 @@ public interface PpPayserviceDao { */ int deleteById(Integer id); + /** + * 查询商家所有的收益 + * @param userId + * @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 f57e8ad7b5e531f9c5df8dd967fbb0cc10007872..ac3d1e12a588d5689ad8828221b1dc63501e06b5 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/Areainfo.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/Areainfo.java index c16730fb399a054dda6462d3a232f670400d1f7d..c7077d47e941cef770960bb92d3117c9d1792489 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 fca84fff450f02adb7447ab8bd3d4bd5bd10b83a..c1b7a638550bb78a906d6207ad1236c750948af1 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 6ec18f45700183d709b09b0a22249c30e7f98285..a9cec1d6a11f84d9ec33e571abac23881d9e78a9 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 3d3a7f2c76522c103b22206c6bd56e3d13a88ff5..eebaa9d2143ea2e413da40634e7086577159fe3b 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 new file mode 100644 index 0000000000000000000000000000000000000000..d1d6f5e4cf9d210af56471b587fe046849e3ac1b --- /dev/null +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EarnIng.java @@ -0,0 +1,50 @@ +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() { + 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/EvaluateService.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/EvaluateService.java index 79956605670c52815429af1c12d1b1bb063e13ec..33dddf7ff4b460ced7c1e01e49d0a899e71f5014 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 93481f5ae76e642c10239e452df16b3b2773b42f..a5b8537d404a7be7ae54e08c75f15e70437f1464 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 99127250100b96220a2b7f24cdf48f2fdc1ba8e5..50032c7dcec544571c5fbf7ba47b5a436b4588d6 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,19 +1,24 @@ 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; - public String getUrl() { return url; } 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 8edb7be6032a1ed64968ba2136873c823953b59b..3ea5dbde7b727f9505fc8dca2d2d2aa344081ac6 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 95a802d94ddcba3c5760f1f9997a24d30ef293d9..327ad8b508263dbd75ebcb9b6a6b82dd7643671e 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 new file mode 100644 index 0000000000000000000000000000000000000000..b58bb41cb98227b3cb1d09b16ba4e01922578858 --- /dev/null +++ b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/PageInfo.java @@ -0,0 +1,52 @@ +package com.team7.happycommunity.businessservice.entity; + +import io.swagger.annotations.ApiModel; +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 812da6c82da0458c631a72011ba492a8d32d9169..8917d1af3ad552e6210f3e28929e97e93f06b828 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,10 @@ package com.team7.happycommunity.businessservice.entity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import java.io.Serializable; +import java.util.List; /** * (PpPayservice)实体类 @@ -8,26 +12,85 @@ import java.io.Serializable; * @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() { + return businessInfo; + } + + public void setBusinessInfo(BusinessInfo businessInfo) { + this.businessInfo = businessInfo; + } + + public PpPayservice() { + } + @ApiModelProperty(value = "服务图片") + private List img; + @ApiModelProperty(value = "用户id") + 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; + } + + 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; + } + /** * 支付方式 */ @@ -37,6 +100,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/entity/ServiceImg.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/entity/ServiceImg.java index e97dcebefcd9a92f698ba9a7d6fe4d07c1818dc0..ccaefcd36d0bc22f3cb1b320a2ed4d1c045f81ae 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 b243a4719e3702fefce7dbf314a2a302642b6c0b..43e98b61ddfa5b21d203fb59f30a2aa8ae9dd1eb 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,50 @@ 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) { + 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 c1ceb70caa9f75a979d4f704f204f35cd426922a..f25abb1d7b28ea52c63579ec6f5091b76e0d20c9 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 0000000000000000000000000000000000000000..0ac39ad5feca5a96f89ddd3a78e06935222d429f --- /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(); + } + } + + +} 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 ef7d157a13fe11b3ef5c1901bbfd5c60cdd6341f..5ad920677ccde8780fa079d55f9304e08307f26a 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/BusinessInfoService.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/BusinessInfoService.java index bb5221e5d1727d441fbc53d8407cb3f2f97f6a2d..35a9153b4e76692623705eab5130f79a95c87159 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 4ab4075bb8a4e583cf73a4ce9c695b071e043787..82655e70bf9d6d87544ab8d3ac1264279acec52a 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,40 @@ public interface PpPayserviceService { */ boolean deleteById(Integer id); + /** + * 查询商家所有的收益 + * @param userId 用户id + * @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 6a4ee8d43be7183721cff9d3a482a0736930d39e..660f7897bbca3f7cc65dd1b69e2055c17839c68a 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 c55f17a1c0bb97a561104a267f654cff2627f52a..09671e677faf0c8e3523f41e531514a83545823c 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/BusinessInfoServiceImpl.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/service/impl/BusinessInfoServiceImpl.java index 425b1d296be3f727798ce6b30d08f460dd268a65..607314d2b76d3231718eb0f19e04e09c55f08580 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 b440379c779523730f34296d7f96f464aa9fad75..6f813d86bae2fa49e309e93ecc45767533937810 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,29 @@ 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); + } + + @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 212380815a22fe4dd87f98f1f25a3b6160250131..0bd8aac0d1c5e0dd5196baf36dc6874d232b0b69 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/java/com/team7/happycommunity/businessservice/util/MailUtils.java b/businessservice/src/main/java/com/team7/happycommunity/businessservice/util/MailUtils.java index cb265d2f17b11b803ded489dc98ebe21e7641f94..fa3ca309bdb85a7a8dc28a876760042af9631d8a 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邮箱可以使户端授权码,或者登录密码 /** * diff --git a/businessservice/src/main/resources/application.properties b/businessservice/src/main/resources/application.properties index ca703a44142111929e8d29aee614492f7271c989..ef671ab7cbd3c25b9213e2caaa7a0fd243ae4d0d 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 diff --git a/businessservice/src/main/resources/mapper/BusinessInfoDao.xml b/businessservice/src/main/resources/mapper/BusinessInfoDao.xml index ef32e2258fb7854359f5fdafac6c7583ee534d1b..eacc0cf6f58dcf31523abb70a205ed3b45b66abb 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} @@ -261,4 +263,13 @@ 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 a2094dcfaa4111325a8fbb3397b2044e5a82b779..2b539dfa9d9e0ac9ff93a22d0ab55e751b676e8a 100644 --- a/businessservice/src/main/resources/mapper/PpPayserviceDao.xml +++ b/businessservice/src/main/resources/mapper/PpPayserviceDao.xml @@ -14,12 +14,31 @@ + + + + + + + + + + + + + + + + + + + @@ -27,7 +46,7 @@ @@ -35,7 +54,7 @@ + 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 de4e53460672626a389446e7ee6215aa9b5fd609..c4c11aa34041b3efdf56aeeeadaa9ffc5235043d 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.id},#{rm.imgUrl}) + + (#{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 c51573be2343fb0826af36dfe676a7af5df67b7b..113cdc90ba065704c5be7412951203b653fbb7c0 100644 --- a/businessservice/src/main/resources/mapper/ServiceOrderDao.xml +++ b/businessservice/src/main/resources/mapper/ServiceOrderDao.xml @@ -96,11 +96,13 @@ diff --git a/communityservice/pom.xml b/communityservice/pom.xml index 2fb8b72b714e518890918324ec50e1d6fe8da9f2..8e45ebd330efe945de0dd1a31a0b215e49a92a6a 100644 --- a/communityservice/pom.xml +++ b/communityservice/pom.xml @@ -95,6 +95,23 @@ 1.2.62 + + + com.github.pagehelper + pagehelper-spring-boot-starter + 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 6c5880e62ad90a36fde3d49a99dd5d3723ec11bd..f5113044fc0ca22236a55cd9a7aeed017df70048 100644 --- a/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java +++ b/communityservice/src/main/java/com/woniu/CommunityserviceApplication.java @@ -3,11 +3,15 @@ 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; @SpringBootApplication @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 0000000000000000000000000000000000000000..ad7a80b1ba0ccac9c46b00f092998ab18c3187a2 --- /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 2473c05abfc0f67ac4333efcbf7a4deb86b2d729..5d5247c374956949d1b46ec5b61e6d75edeed673 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; @@ -53,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"); @@ -84,6 +86,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 +109,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 +142,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("成功"); } /** @@ -124,8 +157,49 @@ public class ActivityController { System.out.println(type+":"+page); //实例化实体类,适合前端需要的数据 List activityPosts = activityService.findByType(type,page); + System.out.println(activityPosts.size()); return CommonResult.success(activityPosts); } + /** + * 活动发起者退款或者移除用户,彻底删掉该用户 + * @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); + } + + @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/CommunityController.java b/communityservice/src/main/java/com/woniu/controller/CommunityController.java deleted file mode 100644 index 9b2e3bea33ac8eff3dce9809608f77c45ae0f9e4..0000000000000000000000000000000000000000 --- 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/DynamicController.java b/communityservice/src/main/java/com/woniu/controller/DynamicController.java index 0f2b8af94d765ebb49a6e62d0e838516da478155..1fdd31f807ffa94c57a70d6b88913989729013f3 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; @@ -32,6 +35,7 @@ public class DynamicController { @PostMapping("/upload") @ResponseBody public CommonResult upload(MultipartFile file){ + System.out.println("*********"); if(file==null){ return CommonResult.failed("请选择上传图片"); } @@ -76,11 +80,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/controller/NoticeController.java b/communityservice/src/main/java/com/woniu/controller/NoticeController.java new file mode 100644 index 0000000000000000000000000000000000000000..b75784cf4acd09d9b8afcbac8f3defe04d2c2529 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/controller/NoticeController.java @@ -0,0 +1,49 @@ +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; +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); + } +@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/ActivityMapper.java b/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java index d59e634181ff971ff6e0ad6e9877e945cd3db4d4..032adb8196b93004cbc733fe64cdc330a7bbd637 100644 --- a/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java +++ b/communityservice/src/main/java/com/woniu/dao/ActivityMapper.java @@ -21,6 +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 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 diff --git a/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java b/communityservice/src/main/java/com/woniu/dao/ActivityUserMapper.java index 0fa2602b1da0a5c05c076e2cee6d10f1f5075bde..cd591fb66da9abbe281478ba0dbf3049a761abc7 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,9 +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); + + @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 = "delete from community_activity_user where cau_activity_id = #{activityId} and cau_user_id = #{userId}") - void deleteById(Integer activityId, 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/AnnouncementMapper.java b/communityservice/src/main/java/com/woniu/dao/AnnouncementMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..6cf958b2d01de4d4196082f9e7f867d099cc9a71 --- /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/CommunityFavorMapper.java b/communityservice/src/main/java/com/woniu/dao/CommunityFavorMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..91b69101f0ac96050fc747938230f667912ad23e --- /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/CommunityOrderMapper.java b/communityservice/src/main/java/com/woniu/dao/CommunityOrderMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..0a8271ca418623e7ca8c8ef6cfc5e16688f1c96b --- /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/dao/DynamicCommentMapper.java b/communityservice/src/main/java/com/woniu/dao/DynamicCommentMapper.java index 8e7797444334604bffac43491770554a3d30e7d9..314fac5f2e80c6cf8cee512196e7c5ab46f7e90d 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 73444fcf7a87bf2ea4620635071aba9860dcf7c6..11eca153076a3d9f956fde5ca521d5accd3a6ff9 100644 --- a/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java +++ b/communityservice/src/main/java/com/woniu/dao/DynamicMapper.java @@ -1,7 +1,9 @@ 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; @@ -21,6 +23,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") - 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); + + @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") + 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 0000000000000000000000000000000000000000..d01bc1079c44254ce7c88985d720f3ca74280f0b --- /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 aacacd3fb701a9f0beac8804e8b71c8d86ce0855..a8bd71f7dc5e62bb214629506378806b733e4fab 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/DynamicCommentDto.java b/communityservice/src/main/java/com/woniu/dto/DynamicCommentDto.java new file mode 100644 index 0000000000000000000000000000000000000000..db7ea165540f360ea27142f3d2595860d88e7d51 --- /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 0000000000000000000000000000000000000000..e1458b55d7e36ec51d3cf01649b827bea9412f2c --- /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 e791e04f15f32860990ce53396b96661bb47f75a..7f1d46853907fd703884bf0655544fdde0427db9 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/dto/MyActivityPost.java b/communityservice/src/main/java/com/woniu/dto/MyActivityPost.java new file mode 100644 index 0000000000000000000000000000000000000000..dba333b207ef5f827c178cd1357a564e1405f450 --- /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/dto/NoticePost.java b/communityservice/src/main/java/com/woniu/dto/NoticePost.java new file mode 100644 index 0000000000000000000000000000000000000000..59ccaebba1f94e02968f30cbca758f3958fba59e --- /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/Activity.java b/communityservice/src/main/java/com/woniu/pojo/Activity.java index 183056fd827d295b31f448184d495b32f398dae5..60808ee9b6d28962992348e981275d59d648a823 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/pojo/ActivityUser.java b/communityservice/src/main/java/com/woniu/pojo/ActivityUser.java index 4c1ddd80fd3c07240ed1b2bc88c9176f31321572..013cf27a5b1765894a89e69971eb6f864218ab60 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/Announcement.java b/communityservice/src/main/java/com/woniu/pojo/Announcement.java new file mode 100644 index 0000000000000000000000000000000000000000..bd6c683befc69916ba13eaac1011f0a04cb4f416 --- /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 0000000000000000000000000000000000000000..2ef2472dcd4f5ddecf65d708bd92c22472ba9239 --- /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/pojo/CommunityFavor.java b/communityservice/src/main/java/com/woniu/pojo/CommunityFavor.java new file mode 100644 index 0000000000000000000000000000000000000000..53f8d7cf2e6014c508ef9dad911e484b102b7376 --- /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/CommunityOrder.java b/communityservice/src/main/java/com/woniu/pojo/CommunityOrder.java new file mode 100644 index 0000000000000000000000000000000000000000..c1d73b74f54d794fd4fafd2bc67f9a9f68249234 --- /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/pojo/Dynamic.java b/communityservice/src/main/java/com/woniu/pojo/Dynamic.java index 38b5f00498d20369e0a4ae675efb4ebb123e4b91..bdd31240b8d76a2db182ee214d16ba04b9bbfdfc 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 6baad41cfc6a9e3d076c4b3650a3191600fe9d08..597e5e2b8048dd2cbe9984749c7eef354f99dd09 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/ActivityService.java b/communityservice/src/main/java/com/woniu/service/ActivityService.java index 89e60c31969014e5d7415747cdc23ef728f559af..60fe8723bab50e23e893c2327df5b84b94da8137 100644 --- a/communityservice/src/main/java/com/woniu/service/ActivityService.java +++ b/communityservice/src/main/java/com/woniu/service/ActivityService.java @@ -2,6 +2,8 @@ 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; @@ -28,11 +30,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 +50,54 @@ 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); + + /** + * 查询所有活动 + * @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/DynamicService.java b/communityservice/src/main/java/com/woniu/service/DynamicService.java index 3ed59e05fa34cdcf977d290c7461b9d412875e34..f59201c1aa70d34326f3bcf7edd9a83b9e620d11 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/NoticeService.java b/communityservice/src/main/java/com/woniu/service/NoticeService.java new file mode 100644 index 0000000000000000000000000000000000000000..0a51d1163bda8d9faa7d6c879d13b67eeff97cc6 --- /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 b00423d740b43115ad12f8c70cb6677d99fe348d..36bfbfb8f54b6c64b6b76f412c6c1ec588b1336e 100644 --- a/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java +++ b/communityservice/src/main/java/com/woniu/service/impl/ActivityServiceImpl.java @@ -3,13 +3,18 @@ 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.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import java.text.ParseException; @@ -27,6 +32,9 @@ public class ActivityServiceImpl implements ActivityService { private ActivityMapper activityMapper; @Autowired private ActivityUserMapper activityUserMapper; + @Autowired + private CommunityOrderMapper communityOrderMapper; + /** * 投诉活动 * @param map 投诉数据 @@ -72,12 +80,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 @@ -89,8 +97,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 +106,30 @@ public class ActivityServiceImpl implements ActivityService { case 1:activityDetail.setStatus("进行中");break; case 2:activityDetail.setStatus("已结束"); } - //报名状态 - Integer userCount = activityUserMapper.selectByIdAndUserId(activityId,userId); + + //查出该用户报名情况,这里大多针对付费活动(涉及退款操作),免费活动取消报名即刻成功,会删掉改用户信息 + ActivityUser activityUser = activityUserMapper.selectByIdAndUserId(activityId,userId); + //对登录用户进行处理 cauSignStatus 0:申请报名,1:取消报名 2:取消中(退款),3:支付失败,需重新支付 if(activity.getCaStatus()==2){ - activityDetail.setSignUp("已结束"); - }else if(userCount!=null){ - activityDetail.setSignUp("取消报名"); - }else if(activity.getCaMaxPeopleCount()==activity.getCaPeopelCount()){ - activityDetail.setSignUp("已结束"); + 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.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; } @@ -116,9 +140,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); + return coNum; } /** @@ -128,7 +168,21 @@ public class ActivityServiceImpl implements ActivityService { */ @Override public void deleteById(Integer activityId, Integer userId) { - activityUserMapper.deleteById(activityId,userId); + //判断是否是付费活动 + 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); + } + } /** @@ -139,7 +193,81 @@ 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); + } + } + + @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); + } + + @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/service/impl/DynamicServiceImpl.java b/communityservice/src/main/java/com/woniu/service/impl/DynamicServiceImpl.java index 9e4f3f6587784db099bc4ae83313cd6d100b0e2c..13a89a1148bee8bac02ef0014dc0ac9c6dad7abb 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,120 @@ 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,10); + }else{ + dynamicPosts = dynamicMapper.selectByType(type,page,10); + } + + //新增评论数量信息 + 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/java/com/woniu/service/impl/NoticeServiceImpl.java b/communityservice/src/main/java/com/woniu/service/impl/NoticeServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..6bf9dfa9e7242d364c6be90cae8ab4cb7ab52754 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/service/impl/NoticeServiceImpl.java @@ -0,0 +1,27 @@ +package com.woniu.service.impl; + +import com.woniu.dao.AnnouncementMapper; +import com.woniu.dto.NoticePost; +import com.woniu.service.NoticeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class NoticeServiceImpl implements NoticeService { + + @Autowired + private AnnouncementMapper announcementMapper; + + /** + * 根据社区名查找所有公告 + * @param key key为""则查所有社区 + * @param page 查询开始页数,这里注意 0 1 所代表的是同一页,每页10条 + * @return + */ + @Override + public List selectByKey(String key, Integer page) { + return announcementMapper.selectByKey(key,page,10); + } +} 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 0000000000000000000000000000000000000000..a30250678b299c40718f09800272f95dbb86d5b2 --- /dev/null +++ b/communityservice/src/main/java/com/woniu/util/ActivityScheduler.java @@ -0,0 +1,47 @@ +package com.woniu.util; + +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; + +import java.util.Date; +import java.util.List; + +@Component +public class ActivityScheduler { + + @Autowired + private ActivityService activityService; + @Autowired + private RedisTemplate redisTemplate; + + /** + * 每隔1分钟更新一次活动状态 + */ + @Scheduled(cron = "0/30 * * * * ? ") + public void updateActivity(){ + List activities = activityService.selectAll("activityAll"); + System.out.println(activities.get(3).getCaStartTime()); + //获取现在时间 + Date nowTime = new Date(); + for(Activity activity:activities){ + //获取活动时间 + Date startTime = activity.getCaStartTime(); + Date endTime = activity.getCaEndTime(); + //判断,定时重置状态 + if(nowTime.before(endTime) && nowTime.after(startTime) && activity.getCaStatus()!=1){ + activity.setCaStatus(1); + activityService.updateActivity(activity,"activityAll"); +// redisTemplate.delete("activityAll"); + }else if(nowTime.after(endTime) && activity.getCaStatus()!=2){ + activity.setCaStatus(2); + activityService.updateActivity(activity,"activityAll"); +// redisTemplate.delete("activityAll"); + } + } + } + +} diff --git a/communityservice/src/main/resources/application.yml b/communityservice/src/main/resources/application.yml index 81f09239af47647b546938e423f63fe6fc6a8caf..62dbc15295b8a1ec77d275e156786f924b22e0bd 100644 --- a/communityservice/src/main/resources/application.yml +++ b/communityservice/src/main/resources/application.yml @@ -6,12 +6,17 @@ 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 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 c07c7659cd57c6a41b4e0eebf8ff6f9c8eebab59..2f4fc71cd5056eeb5f936296bf433ee073d51a8e 100644 --- a/communityservice/src/main/resources/generatorConfig.xml +++ b/communityservice/src/main/resources/generatorConfig.xml @@ -50,13 +50,44 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
- +
diff --git a/communityservice/src/main/resources/mapper/ActivityUserMapper.xml b/communityservice/src/main/resources/mapper/ActivityUserMapper.xml index 31e47e5ef4d000dda672aa870c2bbd48b328e3d2..7d5d0a78d5a78860bd7cf3c4f38d9be7db38cd91 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/AnnouncementMapper.xml b/communityservice/src/main/resources/mapper/AnnouncementMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..cc4df4d0ac197d16121aba05adba81fe58a3b0b0 --- /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/CommunityFavorMapper.xml b/communityservice/src/main/resources/mapper/CommunityFavorMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..a3c7183e1ed56ee50a7747f20f686f1bec667517 --- /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 diff --git a/communityservice/src/main/resources/mapper/CommunityOrderMapper.xml b/communityservice/src/main/resources/mapper/CommunityOrderMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..dab29be687da92ea541e06d377e16554598ad992 --- /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/communityservice/src/main/resources/mapper/areaInfoMapper.xml b/communityservice/src/main/resources/mapper/areaInfoMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..ca3ff2437ae15554f56894a472afa1e1fc2a34d3 --- /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 diff --git a/communityservice/src/test/java/com/woniu/communityservice/CommunityserviceApplicationTests.java b/communityservice/src/test/java/com/woniu/communityservice/CommunityserviceApplicationTests.java index 3397cbaeb4a456488bb9813276fbcb6db1450a21..2ff3c09877437c96ea3b1ba194d7dd6f1bd0afec 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/pom.xml b/gatway/pom.xml index 27ddc1e2d618828bf9123222adbac94fca8e5b0f..c8499df9f14c4da963a20521fe4c3c1a9a1cf1f9 100644 --- a/gatway/pom.xml +++ b/gatway/pom.xml @@ -97,6 +97,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 47313611463b1fd05db242779c99f3a9e634f308..0c1fbf8b989ad4ff44f9e51aaf7510fd0241160a 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 5b239cfba70dfa404af622e17a2f2b2be0ba88bf..0982a280427ec01824ecfec89b4a2d3dbe0bdcd7 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 d9ad6ade5984c6546200d6a85856c40f269ea56a..e4ac7a895c4ca98af77a8ed8dbb202a88ac85845 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 b430dad140c8abe0c0da0309b40f06c730c0383a..15a4c2b30d584260e6b452216f8cc0a00199364f 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/marketservice/pom.xml b/marketservice/pom.xml index 8e846582ea7b82775e3a607de0428c5af708a3f8..20aa33809ba9272c3581cb7e549528288ab91747 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 + 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 0a548b4533d7f3c04262d4fc15dd59fb86e3a659..498fabb969c39b765efcc764367ba78fc9b99f0e 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 0000000000000000000000000000000000000000..260143871fd8dd5de182e97a03ff57f7b736f2eb --- /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 f5fdb026848aef880886511519f21461586e5683..6646a6e89ded4f88fa997c09b5e7db34119b0da3 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 2e22651a07fd4ddf6521f0104ef0581ee6adff77..81ade288b7841d3aeeb4f561ba7852f31fe17d88 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/UsedProductConsigneeController.java b/marketservice/src/main/java/com/woniu/controller/UsedProductConsigneeController.java index 3ff12812fb9927afbe302e4d09e581807a4cd329..e6797ca415709d6f8ec7cb5569c1655dc0b00620 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/controller/UsedProductController.java b/marketservice/src/main/java/com/woniu/controller/UsedProductController.java index 2aac44dd008e295e9594085d98862523f379a19a..f8a7719122eaea5193ee6d987d6995fb49e88fc2 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 5ad639809177c4d498e98ca0ae150b4c297eb165..a779765a29a4d8c8a9b95d29da267783ffcc4100 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 e288192adadb44797705bf7d1b1c439dea0c6d73..9ccd164c955095f223d7ce1e06dce8f32e3db181 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/CommunityActivityUserDao.java b/marketservice/src/main/java/com/woniu/dao/CommunityActivityUserDao.java index 6a71808346599b03da93fa4e872fa5569b9ae37a..c2a3da340e44bd0591b1d809314b60d42429c21e 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 diff --git a/marketservice/src/main/java/com/woniu/dao/PersonImageDao.java b/marketservice/src/main/java/com/woniu/dao/PersonImageDao.java index a8bc9da1b1bdd78a4788eb1c2a180a3582178d4a..4c634ebe1fe160a25fa113e93ffe154d4321eb0a 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 6a4ee7ae2f43853fe7a84850e0dfaac80b650638..2036640d66a640c584f5e99748ef1bf8cfa74bd5 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 6b75accb4e0bf460cd8770fde3a5ac34959620a4..7e6a184d85644f17ccdbb067644c2fb126fea773 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 43168fb474736a7a67ffe4d2c44c791c2e2fae6e..ad0601253065eee47d053e0c289423e3e65f2def 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 932de87f4ef913eb666bae8dd8377fb0f6f158fb..395fb84036c74e2a5ac4bbd682b69a48f760c7f3 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 1a8cafff3e7c0884445aa892404cca84be866f1a..cd3a12e473d9a1bb0c053f1bc062df9d9a236030 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 b88a2c093c4ba05bc387210135f694e81ebe5c13..4ae85bef23f76f0268c407336086b10fd0d43a79 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 6ed897b50c85c073abe0eb3f8c3e94ef558bc75a..37c906952fa58b7627c094bb3f775e7519cba248 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 72a8163897cdcde8a06a4f5bdf2bac383d7350f2..3b8f3ffa6cd319a298039b6333e5293f8bf67b8c 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 c873323704044ccce451eeb35d3493a7acac3dff..9f19e00bf491e9f31dff37bfe131795308c07c65 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 30854aea6f60ccb8aa7b06ff7a5d3aeda1f0fd63..393514ce0763d24f852e400c385e33cbc23eaede 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"); } } diff --git a/parkservice/pom.xml b/parkservice/pom.xml index 9be673c210c550f02843b8df525e5bae7c3b0086..fca95c24510345c92dd81901b8319ecb31fefe32 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 5fb2668bfd3a90a7f669f9f4b2b7d6473d8a9351..05758f91c92dc2b160e2012f096fd2b850e74fb6 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 0000000000000000000000000000000000000000..cb397d1acefe3e9912bf18705e13eac92b5fb6bb --- /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 0000000000000000000000000000000000000000..8cfb173a581f284875216b035dc440d03b037a2f --- /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 0000000000000000000000000000000000000000..31d7f3837840958ab1eeeee50331c2e1f0fa81a1 --- /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 0000000000000000000000000000000000000000..d58b96ab5fe487cab0d98113f65d3078e08f6300 --- /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 0000000000000000000000000000000000000000..7f722d0744b2e538ba5ebcdd1f4de60d23627e5a --- /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 0000000000000000000000000000000000000000..c6b2bb5d32e5598aba5098b5c52ae6a5ce610971 --- /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 0000000000000000000000000000000000000000..6eff08e54c2d4cb97ddea100374b4dae3189e3b7 --- /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 0000000000000000000000000000000000000000..baff4f754343bcbf1fa585870a41ab11aa32ac2f --- /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 0000000000000000000000000000000000000000..42da2bff1c068358108bd59c3f6fcacce3ca3767 --- /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 0000000000000000000000000000000000000000..549f9aa4509c0400be1dfcee9b457bb3ab9bc9b6 --- /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 0000000000000000000000000000000000000000..e38d6df9d1ad8667c458b3553ae810b89c413e22 --- /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 0000000000000000000000000000000000000000..224ef329b41cca668d0bbebe1653c1bacf00d908 --- /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 0000000000000000000000000000000000000000..b5bafe265e0fcf6d30d6c2931ca83d31a08e8f86 --- /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 0000000000000000000000000000000000000000..7538bb6f4ca71f2aaf8b1ef21be2be21585696fe --- /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 0000000000000000000000000000000000000000..80976798f74f4e55a88b361e0d046bfb46814262 --- /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 0000000000000000000000000000000000000000..8c7951bc2664344cc01deeeeb1be18c10018aebe --- /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 0000000000000000000000000000000000000000..a0dbb00d9f418ffae3d6111dd129732e83123c2f --- /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 0000000000000000000000000000000000000000..abc901c75c74d3f11106d79a5923162d0466fb17 --- /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 0000000000000000000000000000000000000000..2a71cb86f74a34cebb2a31b677e54ab2262c170e --- /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 0000000000000000000000000000000000000000..75cd89c3df5ad01c6f535dff7191f26828979581 --- /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 0000000000000000000000000000000000000000..7153a1c2615b2a747372b36f7ac4289092f8c9ec --- /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 0000000000000000000000000000000000000000..63c0b55134717b708046f9ca24cfafe4d006e871 --- /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 0000000000000000000000000000000000000000..70d8aa1f1333e52509e2c4c04244845eebe75fd5 --- /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 0000000000000000000000000000000000000000..81163c2817fd801f8de97a79a1cd5c3bb931112d --- /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 0000000000000000000000000000000000000000..ac08e7613608812711b6b7b89bf8fdf9cd1b04ef --- /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 0000000000000000000000000000000000000000..a4e57f9ac116eb929c7eb8a750008515651fbf9b --- /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 0000000000000000000000000000000000000000..86ed79195261220fdf9115e94a5b3bbadf901a9d --- /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 0000000000000000000000000000000000000000..73409449696ef4f215757cf86ed6da69d1fb13ef --- /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 0000000000000000000000000000000000000000..49919aeaa7e592cbce0ee6bab05734ecc24e7ccb --- /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 0000000000000000000000000000000000000000..b95453ead2fbdc4266b522847009149cb6cb204f --- /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 0000000000000000000000000000000000000000..5b18122c6b2c409ca7c4d6ef9b347a5ff45f5e4b --- /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 0000000000000000000000000000000000000000..d3985a51f83c7eb0477f28acde2aa0a792e935cb --- /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 0000000000000000000000000000000000000000..5f442f545a70c62f1d988a5392e552adabe13056 --- /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/pccenter/src/main/resources/mapper/InformationMapper.xml b/parkservice/src/main/resources/mapper/PersonUserMapper.xml similarity index 31% rename from pccenter/src/main/resources/mapper/InformationMapper.xml rename to parkservice/src/main/resources/mapper/PersonUserMapper.xml index ec8f53a53d648b6e7496b57e1b3264a92a09211f..a12bb2a00428278dbf3bf47b893dacf4c445be8f 100644 --- a/pccenter/src/main/resources/mapper/InformationMapper.xml +++ b/parkservice/src/main/resources/mapper/PersonUserMapper.xml @@ -1,48 +1,59 @@ - - + + - + + + - - - - + + + + + + + - id, account, password, name, nickname, roletype, stage, phone, adress + id, id_number, cell_ph_number, password, name, sex, nickname, mailbox, plot_id, tag, + mailbox_status, code, password_salt, create_time - delete from pc_information + delete from person_user 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 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 pc_information + + insert into person_user id, - - account, + + id_number, + + + cell_ph_number, password, @@ -50,28 +61,43 @@ name, + + sex, + nickname, - - roletype, + + mailbox, + + + plot_id, + + + tag, - - stage, + + mailbox_status, - - phone, + + code, - - adress, + + password_salt, + + + create_time, #{id,jdbcType=INTEGER}, - - #{account,jdbcType=INTEGER}, + + #{idNumber,jdbcType=CHAR}, + + + #{cellPhNumber,jdbcType=CHAR}, #{password,jdbcType=VARCHAR}, @@ -79,28 +105,43 @@ #{name,jdbcType=VARCHAR}, + + #{sex,jdbcType=INTEGER}, + #{nickname,jdbcType=VARCHAR}, - - #{roletype,jdbcType=VARCHAR}, + + #{mailbox,jdbcType=VARCHAR}, + + + #{plotId,jdbcType=INTEGER}, - - #{stage,jdbcType=VARCHAR}, + + #{tag,jdbcType=VARCHAR}, - - #{phone,jdbcType=INTEGER}, + + #{mailboxStatus,jdbcType=INTEGER}, - - #{adress,jdbcType=VARCHAR}, + + #{code,jdbcType=VARCHAR}, + + + #{passwordSalt,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=TIMESTAMP}, - - update pc_information + + update person_user - - account = #{account,jdbcType=INTEGER}, + + id_number = #{idNumber,jdbcType=CHAR}, + + + cell_ph_number = #{cellPhNumber,jdbcType=CHAR}, password = #{password,jdbcType=VARCHAR}, @@ -108,34 +149,51 @@ name = #{name,jdbcType=VARCHAR}, + + sex = #{sex,jdbcType=INTEGER}, + nickname = #{nickname,jdbcType=VARCHAR}, - - roletype = #{roletype,jdbcType=VARCHAR}, + + mailbox = #{mailbox,jdbcType=VARCHAR}, + + + plot_id = #{plotId,jdbcType=INTEGER}, + + + tag = #{tag,jdbcType=VARCHAR}, + + + mailbox_status = #{mailboxStatus,jdbcType=INTEGER}, - - stage = #{stage,jdbcType=VARCHAR}, + + code = #{code,jdbcType=VARCHAR}, - - phone = #{phone,jdbcType=INTEGER}, + + password_salt = #{passwordSalt,jdbcType=VARCHAR}, - - adress = #{adress,jdbcType=VARCHAR}, + + create_time = #{createTime,jdbcType=TIMESTAMP}, where id = #{id,jdbcType=INTEGER} - - update pc_information - set account = #{account,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}, - roletype = #{roletype,jdbcType=VARCHAR}, - stage = #{stage,jdbcType=VARCHAR}, - phone = #{phone,jdbcType=INTEGER}, - adress = #{adress,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 6ec5f36f6e4f13d90f3b1ff248c11b21cc2c62cf..24f5b11b579771c0ed54e6f88e43df1d40f33112 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/payservice/.gitignore b/payservice/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..a2a3040aa86debfd8826d9c2b5c816314c17d9fe --- /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 0000000000000000000000000000000000000000..8e719deb290f3efceba4e982a1905700f5a107cd --- /dev/null +++ b/payservice/pom.xml @@ -0,0 +1,119 @@ + + + 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 + + + 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/PayserviceApplication.java b/payservice/src/main/java/com/woniu/PayserviceApplication.java new file mode 100644 index 0000000000000000000000000000000000000000..6091bca58867b2bec5d625e51590de07fae98357 --- /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 0000000000000000000000000000000000000000..38b58620810cc55f057f3600ba129249e4ba476d --- /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 0000000000000000000000000000000000000000..82d07a51ad729755771b920f421fd9b83b7ad4df --- /dev/null +++ b/payservice/src/main/java/com/woniu/controller/PayController.java @@ -0,0 +1,236 @@ +package com.woniu.controller; + +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.HttpServletRequest; +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,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); + response.getWriter().flush(); + response.getWriter().close(); + } catch (IOException e) { + 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 void notifyUrl(HttpServletRequest request, HttpServletResponse response){ + logger.info("notify"); + //获取支付宝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(requestParams,trade,response); + } + +// @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/CommunityActivityMapper.java b/payservice/src/main/java/com/woniu/dao/CommunityActivityMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..4c2752925d407cf2cdfc2b227a038c8802c3661c --- /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 0000000000000000000000000000000000000000..a8bf96f74d7f8999130e9ba22056b5958e5e9395 --- /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 new file mode 100644 index 0000000000000000000000000000000000000000..117426f417664128dc0f63da1a01e13e8395be01 --- /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 0000000000000000000000000000000000000000..f88f9ccf169e149a3f6b77e63f55213ab3719da7 --- /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/dao/ServiceOrderMapper.java b/payservice/src/main/java/com/woniu/dao/ServiceOrderMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..99ab9b2c3b73b7bdf2141474ad7c9f554f9988ce --- /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 0000000000000000000000000000000000000000..12b9e9f5ba33b9087567e3c17e51824eb28a646c --- /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 0000000000000000000000000000000000000000..c8180531f59154af737d0829503a29cd26d4c66e --- /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 0000000000000000000000000000000000000000..f88356ad9aed3f72a52831717aea7237c311e176 --- /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/CommunityOrder.java b/payservice/src/main/java/com/woniu/pojo/CommunityOrder.java new file mode 100644 index 0000000000000000000000000000000000000000..e958cc7586e7b1376694e96abbfb790252f921cd --- /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 0000000000000000000000000000000000000000..7c7a34cb61123e25af006298c6723655f3645a9a --- /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/pojo/ServiceOrder.java b/payservice/src/main/java/com/woniu/pojo/ServiceOrder.java new file mode 100644 index 0000000000000000000000000000000000000000..d802269c6a4cd8131c5d9a34c0d783a797b8a8bc --- /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 0000000000000000000000000000000000000000..88c42203774588bc097dccdb64bd9737e274f77a --- /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 new file mode 100644 index 0000000000000000000000000000000000000000..c72f5cee17549e1fbc3c3f711e7d5c89a649d08d --- /dev/null +++ b/payservice/src/main/java/com/woniu/service/PayService.java @@ -0,0 +1,34 @@ +package com.woniu.service; + +import javax.servlet.http.HttpServletResponse; +import java.util.Map; + +public interface PayService { + + /** + * 支付请求 + * @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 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 new file mode 100644 index 0000000000000000000000000000000000000000..852753ad3e4150d252ffcf14ac2ace841da37c62 --- /dev/null +++ b/payservice/src/main/java/com/woniu/service/impl/PayServiceImpl.java @@ -0,0 +1,277 @@ +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.*; +import com.woniu.pojo.*; +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 +public class PayServiceImpl implements PayService { + + Logger logger = LoggerFactory.getLogger("PayServiceImpl.class"); + + @Autowired + 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 map = new HashMap(); + 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",String.valueOf(money)); //订单金额 + map.put("product_code","FAST_INSTANT_TRADE_PAY"); //产品码,必填 + + //发送数据,先将数据转为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(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(); + } + System.out.println(response); + return response; + } + + @Override + 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); + 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")); + }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); + } + } + //支付表 + /** + * 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(); + String money = null; + + //根据订单编号查询订单信息,并封装 + AlipayTradeRefundModel model = new AlipayTradeRefundModel(); + switch (type){ + 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); + 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)); + 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/java/com/woniu/util/logFile.java b/payservice/src/main/java/com/woniu/util/logFile.java new file mode 100644 index 0000000000000000000000000000000000000000..d50d704a46cda6536580774a7c074f3a128ba4e6 --- /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 0000000000000000000000000000000000000000..a8ee6ec33ff02713673a63acca348fcc8d8a3442 --- /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/main/resources/generatorConfig.xml b/payservice/src/main/resources/generatorConfig.xml new file mode 100644 index 0000000000000000000000000000000000000000..0b0844e0fd646b7bf83f486e3b5b65d4efe7425d --- /dev/null +++ b/payservice/src/main/resources/generatorConfig.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+
\ No newline at end of file diff --git a/payservice/src/main/resources/mapper/CommunityActivityMapper.xml b/payservice/src/main/resources/mapper/CommunityActivityMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..c314bc55cb856e2749054c73907f0323bd514842 --- /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 0000000000000000000000000000000000000000..9bf0941abb4d0bb018766e04bc33bc5dbc264fba --- /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/CommunityOrderMapper.xml b/payservice/src/main/resources/mapper/CommunityOrderMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..dab29be687da92ea541e06d377e16554598ad992 --- /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 0000000000000000000000000000000000000000..4b88d1cff8fe7e47b608f1941fcaab151abcda3a --- /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/payservice/src/main/resources/mapper/ServiceOrderMapper.xml b/payservice/src/main/resources/mapper/ServiceOrderMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..09861376e63d2256adccf8b0e81d759cb48f50db --- /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 0000000000000000000000000000000000000000..db742c6b11dc5c76c18134d4a4d997010e8acebe --- /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 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 0000000000000000000000000000000000000000..cd18aef688591db4fd5146206f6de7673db07880 --- /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() { + } + +} diff --git a/pccenter/pom.xml b/pccenter/pom.xml index ac5365ac532ffeee974be4390e0df77c01285a86..7b74e38fcc9af60c4c94e3f2a4ac536ed8cc81ac 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 @@ -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,9 +149,6 @@ swagger-models 1.5.21 - - - diff --git a/pccenter/src/main/java/com/woniu/PccenterApplication.java b/pccenter/src/main/java/com/woniu/PccenterApplication.java index 8bf7ea7f8c770370ca8f92ebd3ebb2ed4bb95d7c..7c961e40d131263167e9ceebea544584c234ff60 100644 --- a/pccenter/src/main/java/com/woniu/PccenterApplication.java +++ b/pccenter/src/main/java/com/woniu/PccenterApplication.java @@ -3,9 +3,12 @@ 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(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 30c1bd02f86cff93f8a8f68c6aec655a60c99552..0fa4e6daa8dbcc7b7cac43575de6a7541e633b94 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; } - + //shiro核心控制器 @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,16 @@ public class ShiroConfig { map.put("/login","anon");//访问登录 map.put("/admin/subLogin","anon"); map.put("/src/**","anon"); - map.put("/**","authc"); + map.put("/logout","logout"); + 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; } - + // 盐值加密 @Bean public HashedCredentialsMatcher credentialsMatcher(){ HashedCredentialsMatcher credentialsMatcher = new HashedCredentialsMatcher(); @@ -56,17 +63,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 +83,7 @@ public class ShiroConfig { return rememberMeManager; } + //cookie设置 @Bean public SimpleCookie simpleCookie(){ SimpleCookie cookie = new SimpleCookie(); @@ -82,25 +92,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/Swagger2Config.java b/pccenter/src/main/java/com/woniu/config/Swagger2Config.java new file mode 100644 index 0000000000000000000000000000000000000000..66a5943f162ac6d500f61068bd841ba850dba231 --- /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/config/WebMvcConfig.java b/pccenter/src/main/java/com/woniu/config/WebMvcConfig.java index 84116161d1011c09be7c335a2400e3d244ff5179..6dd5d197d1814575b876175a572e942440b21600 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 0000000000000000000000000000000000000000..261607e5893b2cf1bbe798eef3145b5a7f80bccd --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/ActivityComplainController.java @@ -0,0 +1,116 @@ +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 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 java.util.List; + +@Controller +@RequestMapping("/ac_complain") +@Api(tags ="活动投诉") +public class ActivityComplainController { + + @Autowired + private ActivityComplainService acComplainService; + + /** + * 分页查询活动投诉的列表信息 + * @param currentPage + * @param pageSize + * @return + */ + @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; + 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") + @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"); + model.addObject("ActivityComplainDTO",activityComplainDTO); + return model; + } + + /** + * 投诉回复内容的添加 + * @param activityComplainDTO + * @return + */ + @PutMapping("/editComplain") + @ResponseBody + @ApiOperation(value = "投诉回复内容的添加") + @ApiImplicitParam(name = "activityComplainDTO",value = "回复内容") + 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 + @ApiOperation(value = "活动投诉页面搜索") + @ApiImplicitParams({ + @ApiImplicitParam(name = "nickName",value = "用户姓名"), + @ApiImplicitParam(name = "title",value = "活动标题") + }) + 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 0000000000000000000000000000000000000000..011de0a210040b49f6b97ce2a6e63165bbf55e46 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/ActivityController.java @@ -0,0 +1,121 @@ +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 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 java.util.Date; +import java.util.List; +@Controller +@RequestMapping("/activity") +@Api(tags = "活动审批模块") +public class ActivityController { + + @Autowired + private ActivityService activityService; + + /** + * 分页查询活动审批数据 + * @param currentPage + * @param pageSize + * @return + */ + @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; + 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") + @ApiOperation(value = "活动审批") + @ApiImplicitParam(name = "id",value = "活动编号id值",dataType = "Integer") + public CommonResult confirmPM(@PathVariable("id") Integer id){ + System.out.println("活动确认审核"+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 + @ApiOperation(value = "活动审批页面搜索") + @ApiImplicitParams({ + @ApiImplicitParam(name = "name",value = "用户名称"), + @ApiImplicitParam(name = "status",value = "审批状态",dataType = "Integer") + }) + 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 + @ApiOperation(value = "拒绝审批") + @ApiImplicitParam(name = "id",value = "活动编号id值",dataType = "Integer") + public CommonResult refuse(@PathVariable("id")Integer id){ + //获取当前时间 + Date examineTime=new Date(); + try { + activityService.refuse(id,examineTime); + 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 fe473380e90cd08d2f9f0910785481f7e6fda05f..f41970ed4755b1eed85ab0c9c7253b817b167906 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; @@ -14,6 +18,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,9 +31,9 @@ import java.util.Arrays; import java.util.List; - @Controller @RequestMapping("/admin") +@Api(tags = "管理员列表") public class AdminController { @Autowired @@ -46,6 +51,12 @@ 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; @@ -68,6 +79,7 @@ public class AdminController { * @param modelAndView * @return */ + @ApiOperation(value = "导航到添加管理员页面") @RequestMapping("/addAdmin") public ModelAndView addAdmin(ModelAndView modelAndView) { List roles = rolesService.findAll(); @@ -84,6 +96,9 @@ public class AdminController { */ @PostMapping("/saveAdmin") @ResponseBody + @RequiresPermissions("sys:admin:save") + @ApiOperation(value = "添加管理员") + @ApiImplicitParam(name = "admin",value = "前端获取添加管理员的信息",paramType = "form") public CommonResult saveAdmin(Admin admin) { //验证用户名是否重复 @@ -108,8 +123,10 @@ 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 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() { @@ -133,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"); @@ -150,6 +168,9 @@ 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) { @@ -173,6 +194,9 @@ 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); @@ -184,10 +208,19 @@ public class AdminController { } - //平台管理员登录 + /** + * 登录的验证 + * @param admin + * @return + */ + @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()); if (StringUtils.isEmpty(admin.getUsername())) { return CommonResult.failed("用户名不能为空"); } @@ -209,7 +242,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 0000000000000000000000000000000000000000..e7299463d2ddc1e7261237481dbb9f3cb522b217 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/ComplainController.java @@ -0,0 +1,119 @@ +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 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 + private ComplainService complainService; + + /** + * 分页查询投诉订单列表 + * @param currentPage + * @param pageSize + * @return + */ + @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; + 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 + @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); + ModelAndView model=new ModelAndView("sys/reply"); + model.addObject("complainDTO",complainDTO); + return model; + } + + /** + * 投诉回复内容的添加 + * @param complainDTO + * @return + */ + @PutMapping("/editComplain") + @ResponseBody + @RequiresPermissions("sys:pmc:reply") + @ApiOperation("投诉回复") + @ApiImplicitParam(name = "complainDTO",value = "回复内容",required = true) + public CommonResult addReply(ComplainDTO complainDTO){ + + try{ + complainService.addReply(complainDTO); + return CommonResult.success("回复上传成功"); + }catch (Exception e){ + e.printStackTrace(); + return CommonResult.failed("回复上传失败"); + } + + } + + /** + * 页面的查询功能 + * @param userName + * @param status + * @return + */ + @RequestMapping("/select") + @ResponseBody + @ApiOperation("页面查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "userName",value = "用户名称"), + @ApiImplicitParam(name = "status",value = "审批状态") + }) + public CommonResult select(String userName,Integer 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 0000000000000000000000000000000000000000..cd2d978121738ca13c6a7c12996f34a20c344bc1 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/DynamicCommentController.java @@ -0,0 +1,91 @@ +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 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 java.util.List; + +@Controller +@RequestMapping("/dynamic_comment") +@Api(tags ="活动评论") +public class DynamicCommentController { + @Autowired + private DynamicCommentService dc_Service; + + @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; + 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:delete") + @ApiOperation(value = "删除评论") + @ApiImplicitParam(name = "id",value = "活动评论列表id",dataType = "Integer") + public CommonResult delComment(@PathVariable("id")Integer id){ + try { + dc_Service.delComment(id); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("删除失败"); + } + 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){ + + 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 cf731af5b84fe0bfffab612b9005d082381cebe8..6e5c485287495508eb4a2b246509f218f117d4e1 100644 --- a/pccenter/src/main/java/com/woniu/controller/MenusController.java +++ b/pccenter/src/main/java/com/woniu/controller/MenusController.java @@ -8,7 +8,12 @@ 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; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; @@ -20,6 +25,7 @@ import java.util.Map; @Controller @RequestMapping("/menus") +@Api(tags ="菜单管理") public class MenusController { @Autowired @@ -31,11 +37,10 @@ public class MenusController { */ @RequestMapping("/getMenus") @ResponseBody + @ApiOperation(value = "加载主页菜单数据") 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; } @@ -46,6 +51,7 @@ public class MenusController { */ @RequestMapping("/loadTree") @ResponseBody + @ApiOperation(value = "加载树形菜单的数据") public String loadTree(){ List menus = menusService.findAll(); ObjectMapper mapper = new ObjectMapper(); @@ -66,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,8 +91,9 @@ public class MenusController { */ @GetMapping("/loadMenus") @ResponseBody + @RequiresPermissions("sys:menu:list") + @ApiOperation(value = "查询菜单列表的数据") public Map loadMenus(){ - //code =0 msg count data List menus = menusService.findAll(); Map result = new HashMap(); result.put("code","0"); @@ -100,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 +122,9 @@ 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)){ @@ -133,6 +146,9 @@ 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); @@ -152,20 +168,33 @@ public class MenusController { * @param menuId * @return */ - @RequestMapping("/updateMenu/{menuId}") + @RequestMapping("/editMenu/{menuId}") + @ApiOperation(value = "导航到编辑菜单页面") 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") + @ApiOperation(value = "菜单编辑") + @ApiImplicitParam(name = "menus",value = "修改菜单信息") + public CommonResult updateMenus(Menus menus){ + try { + menusService.updateMenus(menus); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("更新失败"); + } + return CommonResult.success("更新成功"); + } /** @@ -176,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 new file mode 100644 index 0000000000000000000000000000000000000000..83562b500de8f01e9b9104f0677d09bc7f45d7b7 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/MerchantController.java @@ -0,0 +1,122 @@ +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 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 java.util.Date; +import java.util.List; + +@Controller +@RequestMapping("/merchant") +@Api(tags ="商家管理") +public class MerchantController { + + @Autowired + private MerchantService merchantService; + + /** + * 分页查询商家列表 + * @param currentPage + * @param pageSize + * @return + */ + @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; + 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") + @ApiOperation(value = "商家审批") + @ApiImplicitParam(name = "id",value = "商家id值",dataType = "Integer") + 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 + @ApiOperation("页面查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "nickName",value = "用户名称"), + @ApiImplicitParam(name = "status",value = "审批状态") + }) + 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 + @ApiOperation(value = "拒绝审批") + @ApiImplicitParam(name = "id",value = "商家id值",dataType = "Integer") + 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 0000000000000000000000000000000000000000..4719f5a4feddc378f11e38550fabf31e7c94a4c6 --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/PropertyManageController.java @@ -0,0 +1,126 @@ +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 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 java.text.SimpleDateFormat; +import java.util.Date; +import java.util.List; + +@Controller +@RequestMapping("/pm") +@Api(tags = "物业审核") +public class PropertyManageController { + + @Autowired + private ProperManageService pmService; + + /** + * 分页查询物业管理列表 + * @param currentPage + * @param pageSize + * @return + */ + @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; + 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") + @ApiOperation(value = "物业审批") + @ApiImplicitParam(name = "id",value = "物业id值",dataType = "Integer") + 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 + @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); + info=new PageInfo(list); + return CommonResult.success(info); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed("查询失败"); + } + } + + /** + * 拒绝审批操作 + * @param id + * @return + */ + @PutMapping("/refuse/{id}") + @ResponseBody + @ApiOperation(value = "拒绝审批") + @ApiImplicitParam(name = "id",value = "商家列表id值",dataType = "Integer") + 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 568d8c19c2f99a393f48ffb0fcb72db0f7d6128b..64704349f8a6d558575cfebe68e05bc0f6b64249 100644 --- a/pccenter/src/main/java/com/woniu/controller/RolesController.java +++ b/pccenter/src/main/java/com/woniu/controller/RolesController.java @@ -5,8 +5,13 @@ 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; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @@ -19,6 +24,7 @@ import java.util.stream.Collectors; @Controller @RequestMapping("/roles") +@Api(tags = "角色管理") public class RolesController { @Autowired @@ -26,6 +32,12 @@ 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); @@ -42,6 +54,12 @@ 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()); @@ -74,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"); @@ -87,6 +107,12 @@ 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){ //检查更新的角色名称是否已经存 @@ -119,6 +145,9 @@ 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); @@ -139,6 +168,9 @@ 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 new file mode 100644 index 0000000000000000000000000000000000000000..299c340a5be57f54667efc85581879be044ef9bd --- /dev/null +++ b/pccenter/src/main/java/com/woniu/controller/ServiceCommentController.java @@ -0,0 +1,99 @@ +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 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 java.util.List; + +@Controller +@RequestMapping("/service_comment") +@Api(tags ="服务评论") +public class ServiceCommentController { + + @Autowired + private ServiceCommentService scService; + + /** + * 分页查询服务评论列表数据 + * @param currentPage + * @param pageSize + * @return + */ + @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; + 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") + @ApiOperation(value = "删除评论") + @ApiImplicitParam(name = "id",value = "服务评论列表id",dataType = "Integer") + 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 + @ApiOperation("页面查询") + @ApiImplicitParams({ + @ApiImplicitParam(name = "nickName",value = "用户名称"), + @ApiImplicitParam(name = "payName",value = "服务名称") + }) + public CommonResult select(String nickName,String 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 0000000000000000000000000000000000000000..f219e328ad907868143fc067ab143c7743ea8eb1 --- /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 0000000000000000000000000000000000000000..049eb3650c863604f664e91ae61cf82228f43141 --- /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 = #{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=#{id}") + void refuse(@Param("id") Integer id, @Param("operationTime") Date examineTime); +} 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 0000000000000000000000000000000000000000..dfbc6ab3946688446417bdfe8ab4cc9ff612590d --- /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 0000000000000000000000000000000000000000..e8ac1e6c21a0003ac011c5c6ac7c589f7d73e89f --- /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 41e2c3df2a224efbc6693275ff6eb021aea5f96f..0000000000000000000000000000000000000000 --- 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 e678973ec9e4d334d9367076522accbe5d56975e..285e4852357ae8874edae7ad4f8b2994234c40d3 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 0000000000000000000000000000000000000000..1ff38882720e42c6a85992459a966404e2237884 --- /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 0000000000000000000000000000000000000000..a9996d849effeb5e17b3c7a69e5469b00b661863 --- /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 4e2019538124a2dfdacbdc7681c1b0d9362518d3..aba8b1f13e73dbd81da7dec3d9a323aa02546308 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 0000000000000000000000000000000000000000..107c5dea3aced9e6838fe3431520a92f28a1314f --- /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 f9fbcb05b87dbcd11c3506fdf54fe1b26c06a894..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..3d5bb4f6e35a219b6725b4221af2b6ea4ba369fd --- /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 0000000000000000000000000000000000000000..3b67ea000de109eb2eeb2780bca609448a929ed1 --- /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 0000000000000000000000000000000000000000..273dd52ea5040d1901dede1704f3afef60ccb111 --- /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 0000000000000000000000000000000000000000..c6de36f8275a895948e411b1562c96261edf365b --- /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 0000000000000000000000000000000000000000..baaa0ac088cafecbed349f9a971cb7a93ad792f4 --- /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 0000000000000000000000000000000000000000..97b2b156a6ece9b523e4e756e2d6f875a2457cfd --- /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 0000000000000000000000000000000000000000..56fdf05974bfdeee2fb7f468872ab2ee4f42b925 --- /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 0000000000000000000000000000000000000000..ef7339f5d87fc376bef597d19f0a5e8241e8e184 --- /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/Admin.java b/pccenter/src/main/java/com/woniu/pojo/Admin.java index 2ad2fe50ed24c2c17a5d9dd3f428d662f079c5cd..fbe86bfc4471306d539f22852b1a28119ec4300c 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 { 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 2f1c550ed63f67536b3cad7dd41853ebc0927bd5..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..0a37b7fc29c58cc931dfc11ae2de187a2c5ba974 --- /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 da24ad7a323908d7300c5370080cacb698a004cc..06ab7a62d88d84ebb2e28bac8ba158fb75adfd78 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 73ad250df14b70561c34b2a273fd43a1f05cf8e3..0000000000000000000000000000000000000000 --- 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 ae780f7b8e22ccacbd4280e0f0fffd691c3da9ba..5df85c783ffcfa4ceab2f99d4bd8cd9f3f70c574 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 0000000000000000000000000000000000000000..dc5d4657edddf600c00267f99e504d45ec02718e --- /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 0000000000000000000000000000000000000000..001d4450737b2a4651e1467f3891f0c5d539aa78 --- /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 examineTime); +} 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 0000000000000000000000000000000000000000..3205a12eded8aa06951fca2c7b511cb76b9d6e83 --- /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 0000000000000000000000000000000000000000..12d62f715762eac046d7062b4effd5a376ad83e1 --- /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 91ae56a34fe9c948363402121826d831eeb606b3..2744df9157e193f557bf8a12e41aa56ba3543380 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 0000000000000000000000000000000000000000..17b933f891a53ede5e99b477a3feadba25298738 --- /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 0000000000000000000000000000000000000000..3247b0f8459d3caa0b7a2cc3d73f7ead76650666 --- /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 0000000000000000000000000000000000000000..077905cdb7922b4dcc263e0afb71c3682685306b --- /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 0000000000000000000000000000000000000000..91099c418efe4229f723405b7d6c90f38a110e29 --- /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 0000000000000000000000000000000000000000..fa79c868bb3928d7769ace7e1f221c5c7f56dd3f --- /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 examineTime) { + activityMapper.refuse(id,examineTime); + } +} 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 adb816342e42cfc0ae5032251879cbeb8ff91228..721aec81a9c17ec7775a3ccb17cecc68f54fc242 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 0000000000000000000000000000000000000000..3906d7aa7fcb7b8fddbb40082526492b067d0030 --- /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 0000000000000000000000000000000000000000..c50a94477ef4fb94afe6dcadd0514cda44aef162 --- /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 4e098f86f81e060fa58473e5fce400817459ce8d..ac5c69fc358ca4de81aec3057c3a5386513c94ef 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 0000000000000000000000000000000000000000..6206b699dba10e37109b705d8d45bfd4e547ec54 --- /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 0000000000000000000000000000000000000000..91fc171473fd3256b9c9a696470826a8882a62ed --- /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 0000000000000000000000000000000000000000..1e3a7c91f97efd02d284d81a3246fdebf3dc9d28 --- /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 2f77018e71769e6720f946bec164ef3612e7916b..5b1dc9b5a3cf846a20a6e2af796b35876b43a47c 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 2a08fdde051556eec363d275facfac95fa8bcc80..d6100193ad825d5c7f3220b7b7481eabf54c914b 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 0000000000000000000000000000000000000000..6c956fbdb200694e59385d6917441669d2655470 --- /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 c9e7f6ba35a18fbf43b8c0f9f66ce9e941598dc0..3d1808e0f4d96ef2f2b87e71ff05297af3c18b26 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 0000000000000000000000000000000000000000..0ecc93d3cd1db6aed5ee45683f1f3e724a9265b1 --- /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 0000000000000000000000000000000000000000..129244fcf32f252b973ebfb8740685c3eb2db956 --- /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/MerchantMapper.xml b/pccenter/src/main/resources/mapper/MerchantMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..d579a5429c30061c1f2ef1e310c3a995fbf04433 --- /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 0000000000000000000000000000000000000000..ba4f4d98f417151c5a41f98f516c456f872b9a21 --- /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 0000000000000000000000000000000000000000..501b9c52012dd5e18c98dbeaab6df1784f40353f --- /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 5249caf6da48f1f9cfcecf9c26f22e290a0df70b..0000000000000000000000000000000000000000 --- 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 0000000000000000000000000000000000000000..01661deb2aacd88268718fb173f2e7a7b6ed84db --- /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 4755c5ca57fdee95e59dbe62ebf12a951eeffbb1..28bfae4f10f4b41788dfc7ea4bd9112b9c822025 100644 --- a/pccenter/src/main/resources/templates/login.html +++ b/pccenter/src/main/resources/templates/login.html @@ -12,9 +12,14 @@
-
+ +
+
+ 账号登录 +
@@ -27,27 +32,15 @@
-
-
还没有账号?免费注册
-
@@ -69,10 +62,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 0000000000000000000000000000000000000000..7ab2277e071b978b02495985d25de100bee60a92 --- /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 0000000000000000000000000000000000000000..f583820b7a27a2113418bacd90db4f19d618f26f --- /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 0000000000000000000000000000000000000000..4abd18c30836d127eb7ca47bcaf9661ee95d7300 --- /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 ae108e75c4bb46fffc5d0ff6d430d166394fe51d..328f8787fbee18cb86491a919903f01047d4517d 100644 --- a/pccenter/src/main/resources/templates/sys/addAdmin.html +++ b/pccenter/src/main/resources/templates/sys/addAdmin.html @@ -40,7 +40,7 @@
- +
@@ -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 1d518486964bc83ee3bbf379ddf9054ff3409c0e..4c7a54d5211557459b552018d6484f40b5870a90 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', '500px'], + 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 0000000000000000000000000000000000000000..24714708abb6b8a6587ad05ce769ca774cf9ebbe --- /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 0000000000000000000000000000000000000000..9ad824aa01a414be6af08033462328498e0c6b73 --- /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 0000000000000000000000000000000000000000..47fc05fafebf118c4792d78d49431073e1a14ac7 --- /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 570fcac7668793ab364b251f3402b8fdf5e84cab..8a5799424cf1e1fe55a08bddc0d7e45f9bce5d58 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 47fcf32ef3ded84627953cd3b611c2aa3c531366..7aaa30a4c5b94f8970df4f29ff54e063cb86d894 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 95a1b818453a0d483e05df92c3034ae4edc2cd5f..a239710039d746ea6999d204116030bbc467f2aa 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 0000000000000000000000000000000000000000..54fb4f82022acbdf74fcb993d39de35d7384e841 --- /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 0000000000000000000000000000000000000000..4af99772c727f0730465a47bce1beb0164e6c9fb --- /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 0000000000000000000000000000000000000000..cd2cb47caef10ea776bd5129dba42b2284a7dda4 --- /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 895701e40e68564dfb9578e93815c28652c0f21d..a2d3567ebd6d0895990af67116e6cdccc63fea57 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 diff --git a/personcentor/pom.xml b/personcentor/pom.xml index ec5773ba862efc94e0ef74bc825fad025554d711..93355173e8a1c756fc1ae368d6eeac5c76cf62bb 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 0000000000000000000000000000000000000000..473e92b0245455ec1261ab6156cb73e01804a266 --- /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 87cfaf9239864487a6fc5b7f7ee319a714d9d0bc..0000000000000000000000000000000000000000 --- 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 01b46687c4d9fb6db7d05d6908833192876b53d8..0000000000000000000000000000000000000000 --- 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 dcffd6b892e052e7cb5a34ffb3ef509848e48d36..0000000000000000000000000000000000000000 --- 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 0681a593e83b08f4e823f470996fa8dbfc1818cc..0000000000000000000000000000000000000000 --- 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 e9052a6f8ec38c9cb9ee6f3cfed21426eb7c3053..0000000000000000000000000000000000000000 --- 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 a0bf18c467c982d77c62945e424209aa2067d0e2..0000000000000000000000000000000000000000 --- 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 429f030d5cdc13ee4077d7d7d95c91d731210519..0000000000000000000000000000000000000000 --- 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 954faa837087041ddca002578fea960a0704e704..0000000000000000000000000000000000000000 --- 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 6bfc5a07832954689a79f25674fd6c787a680150..f6f09fe89175b4d9e3f2ffc3217d087cf49b424e 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 @@ -1,12 +1,19 @@ package com.team7.happycommunity.personcentor.controller; +import com.team7.happycommunity.personcentor.common.CommonResult; import com.team7.happycommunity.personcentor.entity.CommunityDynamic; +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; import javax.annotation.Resource; +import java.util.Date; +import java.util.List; /** * (CommunityDynamic)表控制层 @@ -16,12 +23,15 @@ import javax.annotation.Resource; */ @RestController @RequestMapping("communityDynamic") +@Api(tags="社区动态接口") public class CommunityDynamicController { /** * 服务对象 */ @Resource private CommunityDynamicService communityDynamicService; + @Resource + private CommunityDynamicCommentService communityDynamicCommentService; /** * 通过主键查询单条数据 @@ -34,4 +44,76 @@ public class CommunityDynamicController { return this.communityDynamicService.queryById(id); } + /** + * 查询当前动态的所有评论 + * @param dynamicId 动态id + * @return 评论内容 + */ + @GetMapping("queryCommit") + @ApiOperation(value = "查询当前动态的所有评论") + @ApiImplicitParams(value = { + @ApiImplicitParam(name = "dynamicId",value = "动态id",required = true) + }) + public List queryCommit(Integer dynamicId){ + return communityDynamicService.queryCommit(dynamicId); + } + + /** + * 添加评论 + * @param dynamicId 动态id + * @param userId 评论用户的id + * @param cdcContent 评论内容 + * @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(); + comment.setCdcContent(cdcContent); + comment.setCdcDynamicId(dynamicId); + comment.setCdcUserId(userId); + comment.setCdcTime(new Date()); + communityDynamicCommentService.insert(comment); + return CommonResult.success(); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } + + /** + * 删除评论 + * @param id 评论的id + * @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); + return CommonResult.success(); + } catch (Exception e) { + e.printStackTrace(); + return CommonResult.failed(); + } + } } \ No newline at end of file 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 0bb033c0a0ce53a3d06d213203df6d0ce00cc9c5..21c02750b4a0290725ef26cc277255a40d7c6003 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 8e5e50ae60abb5755a630a512934df2cb40ff0e2..1f0f57f715daa0fb7418f625352365db3a9b027f 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){ @@ -259,8 +327,18 @@ public class PersonUserController { * @param password 新密码 * @return */ - @PostMapping(value="/resetPasswordBypassword",produces = "text/html;charset=UTF-8") + @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){ @@ -345,8 +428,22 @@ public class PersonUserController { return user; } + /** + * 上传头像 + * @param file + * @return + */ @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){ @@ -367,6 +464,12 @@ public class PersonUserController { return CommonResult.success("上传成功",map); } + + /** + * 测试专用 + * @param request + * @return + */ @RequestMapping("/test") @ResponseBody public String test(HttpServletRequest request){ diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/dao/CommunityDynamicDao.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/dao/CommunityDynamicDao.java index a4a971833e9460307554deb4361716081e6c0ef8..8576af26f7b54075744483ea4f58696d1d484229 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/dao/CommunityDynamicDao.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/dao/CommunityDynamicDao.java @@ -1,6 +1,7 @@ package com.team7.happycommunity.personcentor.dao; import com.team7.happycommunity.personcentor.entity.CommunityDynamic; +import com.team7.happycommunity.personcentor.entity.DynamicCommit; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -62,5 +63,10 @@ public interface CommunityDynamicDao { * @return 影响行数 */ int deleteById(Integer id); - + /** + * 查询当前动态的所有评论 + * @param dynamicId 动态id + * @return 评论内容 + */ + List queryCommit(Integer dynamicId); } \ No newline at end of file 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 49356f8a4bba89cb24426d54eb24d448ca4b62b7..d599d059589b168f3b757130efcc7b6d2877600c 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 71508a450a41cd3445f09c426246a0d8cea4bcc3..581aab9eed9ec03732c03a609bce2aa3f54be8bb 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 fd76b9bc18d38d8368b96b2d0263d5d78b58256a..23f916212169d4b6a84a810cef90a358801ad1e0 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 9f4bde478cdf5b72cfcb30093b149a46b98ad813..080101f7a6ba59ef19189074170b3b706960f379 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 bbcec491f790a265e49049d13d20c3c30d3f6658..58aac148a5e7f646ed12189eee234ed58b7f14ae 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 2d1fd4cb170de5c80a5b9e5810e71529288e6b77..5e34aef5dab795de384985c1df50c9f4feef4346 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 71199d8df38c57c01cac8f8cc8012b89d6bd9104..39e71c963124f3a9ea0dd70e63ae529e735482e4 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 daa6dec7bc4b262a819cf6c16df4caaf114f7a48..d02006ee468dc9f5aefcccebc7092d3bdaa7571d 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 fa4cbb88b85d17e75d8a8f0a1dace8b8b1de0331..526568fac48cee1dae16bd172720d3183e77a5dd 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() { @@ -54,4 +58,5 @@ public class Dynamic implements Serializable { public void setCommentName(String commentName) { this.commentName = commentName; } + } 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 new file mode 100644 index 0000000000000000000000000000000000000000..2864a00044300b96ddbd7bc38ca9dea3e9ebc4a9 --- /dev/null +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/entity/DynamicCommit.java @@ -0,0 +1,61 @@ +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() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + 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; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } +} 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 33d4b947739c8eddcf06de45305de42893a38923..da3ebac508291cf3b2fa1f62fbb1a15b6afff9cc 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 a5fc704de6cec2466cf5a1b526d617c295ae271d..0b14c5bc7062a7b6f6700758b1a7f688ad02fac8 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 e33f667ecb025c83e9fcac2e3337f3867f729f8f..477cb8879f8b096b3c3f680692eadf4030036faf 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 90988128e80cbe66c691193c096c63d79e4ccba8..0ba6096c2d99b0a9cd8bd21fb579925808b2ad72 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/CommunityDynamicService.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/service/CommunityDynamicService.java index ba35056652844ec2363078c762203bb29dcb1ae4..36175a1395665a18778e288d155dad800e7b144b 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/service/CommunityDynamicService.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/service/CommunityDynamicService.java @@ -1,6 +1,7 @@ package com.team7.happycommunity.personcentor.service; import com.team7.happycommunity.personcentor.entity.CommunityDynamic; +import com.team7.happycommunity.personcentor.entity.DynamicCommit; import java.util.List; @@ -52,5 +53,10 @@ public interface CommunityDynamicService { * @return 是否成功 */ boolean deleteById(Integer id); - + /** + * 查询当前动态的所有评论 + * @param dynamicId 动态id + * @return 评论内容 + */ + List queryCommit(Integer dynamicId); } \ No newline at end of file diff --git a/personcentor/src/main/java/com/team7/happycommunity/personcentor/service/impl/CommunityDynamicServiceImpl.java b/personcentor/src/main/java/com/team7/happycommunity/personcentor/service/impl/CommunityDynamicServiceImpl.java index 66c9420d131109fd0cafc2881bce847f9d59d337..78327552679f01fbbe5137a8b5f66ebfa988d163 100644 --- a/personcentor/src/main/java/com/team7/happycommunity/personcentor/service/impl/CommunityDynamicServiceImpl.java +++ b/personcentor/src/main/java/com/team7/happycommunity/personcentor/service/impl/CommunityDynamicServiceImpl.java @@ -2,6 +2,7 @@ package com.team7.happycommunity.personcentor.service.impl; import com.team7.happycommunity.personcentor.dao.CommunityDynamicDao; import com.team7.happycommunity.personcentor.entity.CommunityDynamic; +import com.team7.happycommunity.personcentor.entity.DynamicCommit; import com.team7.happycommunity.personcentor.service.CommunityDynamicService; import org.springframework.stereotype.Service; @@ -76,4 +77,10 @@ public class CommunityDynamicServiceImpl implements CommunityDynamicService { public boolean deleteById(Integer id) { return this.communityDynamicDao.deleteById(id) > 0; } + + @Override + public List queryCommit(Integer dynamicId){ + + return communityDynamicDao.queryCommit(dynamicId); + } } \ No newline at end of file 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 575ca81564f31736a1d115a3edf590519e4cd522..b4dade0ae8fa8096c360adb2584753a375679d7d 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 { @@ -273,7 +275,7 @@ public class PersonUserServiceImpl implements PersonUserService { PersonUser user = personUserDao.queryPersonInfoByName(name); if(user.getPassword().equals(Md5Util.encodeByMd5(oldPassword))){ //2.修改新密码 - personUserDao.updatePasswordByName( name,password); + personUserDao.updatePasswordByName( name,Md5Util.encodeByMd5(password)); }else{ throw new UpdatePasswordException("输入密码不正确"); } 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 d59c040a5c72976bb4753b91b9964219655fac15..cefd71f5d3048ac43c53779fee0da365540e3e39 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邮箱可以使户端授权码,或者登录密码 /** * diff --git a/personcentor/src/main/resources/application.properties b/personcentor/src/main/resources/application.properties index 3827360f14b311d5a6bc76a19193eb7398403fce..12805e99f86e5216356d68604c96f6cc59b0f044 100644 --- a/personcentor/src/main/resources/application.properties +++ b/personcentor/src/main/resources/application.properties @@ -1,7 +1,7 @@ -accessKeyId=LTAI4FikHBhJzcaPm22pWeGS -accessKeySecret=6Isjtn6eBPaas1NNBpfVczkAEY7BDB -smsCode=SMS_186615599 +accessKeyId= +accessKeySecret= +smsCode= param={"code":"[value]"} website=localhost -port=80 +port=9100 diff --git a/personcentor/src/main/resources/application.yml b/personcentor/src/main/resources/application.yml index fbcbf80bfae82349c504faec2115b11a2ee018b4..5aef428ea9faa0f77de3b2f65947a806550400ba 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 diff --git a/personcentor/src/main/resources/mapper/CommunityDynamicDao.xml b/personcentor/src/main/resources/mapper/CommunityDynamicDao.xml index efe247fc912ed6a25b8f50a5ee2c78337906b496..ebe0fe43f9503cec6cb8ceba8e9f436d5dd060e5 100644 --- a/personcentor/src/main/resources/mapper/CommunityDynamicDao.xml +++ b/personcentor/src/main/resources/mapper/CommunityDynamicDao.xml @@ -94,5 +94,8 @@ delete from happycommunity.community_dynamic where id = #{id} - + \ 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 95fd1fb9eee02b600431a97c6288c5d8c5641547..8564f060f1ae663b46e7155ed7b8750129856de7 100644 --- a/personcentor/src/main/resources/mapper/PersonUserDao.xml +++ b/personcentor/src/main/resources/mapper/PersonUserDao.xml @@ -187,26 +187,31 @@ UPDATE person_user set password=#{password} where name=#{name} 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 diff --git a/propertydemo/src/main/java/com/woniu/controller/PayCollectController.java b/propertydemo/src/main/java/com/woniu/controller/PayCollectController.java index 4cfabba35c883833b4c6839ffbeb1b26c252471b..f3870458bf7661797e5670e368721e63d836940b 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 89f2bafec510c841ef312e916bc3e11e1497e4e3..9a9b5194402362e8cddba0672bd9c990ca7c3487 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/controller/PayOrderController.java b/propertydemo/src/main/java/com/woniu/controller/PayOrderController.java index 1bce5d5ddc1810617d781d4edd2ea67c9f864668..82969b6bf0f9bbf2c11639e884515130caeb18b9 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 { diff --git a/propertydemo/src/main/java/com/woniu/dao/CollectServiceMapper.java b/propertydemo/src/main/java/com/woniu/dao/CollectServiceMapper.java index ca2ce9bc4a27fff80621000e8a247f2815b0691d..6649097ea94a8d588bdba7b96b598b226e9eed72 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 a89d10568143c8c4e1e6b169831bccb1684651d0..97bc415abd60476092fea47ae19640e785b08fa8 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 7bf582d5f4b7ad7b25eb08a7146c0ed400fd1fdd..ead93123dacb69df06c66c42fd8444150ee52d1e 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 be91b0b9462238a276cff8e92ea6fe4a1c7d4cae..b632c01604fbac92f49ec9c0b5311687c43f684e 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: diff --git a/propertydemo/src/test/java/com/woniu/propertydemo/PropertydemoApplicationTests.java b/propertydemo/src/test/java/com/woniu/propertydemo/PropertydemoApplicationTests.java index 358d6db27e00feecdc2170fff333690732af6fda..08dd37d1b61952ac39e34dec5e411fcbeaff0d3e 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 0cdbca7b4ff6ee7386a98d03dd9d22ae66f5bc79..c999e9db09eddf5baaf94369cf4824824f43c76b 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 5f20d219435a2619dd6606cb688a872e867afb0e..469c4f35eb3b5c3ec2e04e34e3ce0d7070304050 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 a6e8ccbef7183e2a9610d251308b3e9073dc4ae4..3f3aeff8c532754265dcbae6eb8695d47954f1ea 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 85b0a44effec6e08b0c594a4fef91de23f362d2a..152709fa9a3a6f1f11675dd9cfffba84bc55d064 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 128c2b6988dd49dcf7a10560e908e932380deec5..ef25754f1e1dc280549cc97fdd9b61852aa0e32d 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 9dc98c23c61a6dc79fca841797fd8a994581a15e..d6540bd0b669ba58741e276aba0fa6ee30b6a6eb 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