| @ -0,0 +1,91 @@ | |||
| package com.ruoyi.applet.contoller; | |||
| import com.ruoyi.applet.pojo.dto.ApiQueryIIdDTO; | |||
| import com.ruoyi.applet.utils.conf.AppletUtil; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | |||
| import com.ruoyi.model.domain.*; | |||
| import com.ruoyi.model.service.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import java.util.List; | |||
| @Api(description = "伴宠师-工作台外部") | |||
| @RestController | |||
| @RequestMapping("/applet/workIn") | |||
| public class ApiAppletHhrWorkInController extends BaseController { | |||
| @Autowired | |||
| private IIndexconfigIconService indexconfigIconService; | |||
| @Autowired | |||
| private IIndexconfigService indexConfigService; | |||
| @Autowired | |||
| private IAppUsersService appUsersService; | |||
| @Autowired | |||
| private IIndexPartnerConfigService iIndexPartnerConfigService; | |||
| //1.查询轮播图接口 | |||
| @Autowired | |||
| private IAppBannerService iAppBannerService; | |||
| @ApiOperation("轮播图列表") | |||
| @GetMapping("/bannerList") | |||
| public AjaxResult bannerList(){ | |||
| List<AppBanner> bannerList = iAppBannerService.getBannerList(); | |||
| return AjaxResult.success("轮播图列表",bannerList); | |||
| } | |||
| @ApiOperation("未加入的工作台图标配置查询") | |||
| @GetMapping("/indexConfigIco") | |||
| public AjaxResult getIndexConfigIcon(){ | |||
| List<IndexconfigIcon> indexconfigIconByIdentity = indexconfigIconService.getIndexconfigIconByIdentity(); | |||
| return AjaxResult.success(indexconfigIconByIdentity); | |||
| } | |||
| @ApiOperation("已加入的工作台图标配置查询") | |||
| @GetMapping("/indexConfig") | |||
| public TableDataInfo getIndexConfig(){ | |||
| return getDataTable(indexConfigService.getIndexconfigList()); | |||
| } | |||
| @ApiOperation("查询加入合伙人提示配置列表") | |||
| @GetMapping("/list") | |||
| public TableDataInfo list(){ | |||
| List<IndexPartnerConfig> indexPartnerConfigList = iIndexPartnerConfigService.getIndexPartnerConfigList(); | |||
| return getDataTable(indexPartnerConfigList); | |||
| } | |||
| @ApiOperation("申请加入合伙人-需要token") | |||
| @PostMapping("/joinHh") | |||
| public AjaxResult joinHh(@RequestBody ApiQueryIIdDTO dto){ | |||
| // AppUsers localAppletUser = AppletUtil.getLocalAppletUser(); | |||
| AppUsers localAppletUser = new AppUsers(); | |||
| localAppletUser.setUserId(dto.getAppUserId()); | |||
| localAppletUser.setUserHh(1); | |||
| appUsersService.updateAppUsers(localAppletUser); | |||
| return AjaxResult.success("申请成功合伙人"); | |||
| } | |||
| @ApiOperation("申请加入伴宠师-需要token") | |||
| @PostMapping("/joiBcs") | |||
| public AjaxResult joiBcs(@RequestBody ApiQueryIIdDTO dto){ | |||
| // AppUsers localAppletUser = AppletUtil.getLocalAppletUser(); | |||
| AppUsers localAppletUser = new AppUsers(); | |||
| localAppletUser.setUserId(dto.getAppUserId()); | |||
| localAppletUser.setUserBcs(1); | |||
| appUsersService.updateAppUsers(localAppletUser); | |||
| return AjaxResult.success("申请成功伴宠师"); | |||
| } | |||
| } | |||
| @ -0,0 +1,70 @@ | |||
| package com.ruoyi.applet.contoller; | |||
| import com.ruoyi.applet.pojo.dto.ApiQueryIIdDTO; | |||
| import com.ruoyi.applet.pojo.dto.ApiQueryIIdMyUserDTO; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import com.ruoyi.model.service.IAApiAppletHhrWorkOutService; | |||
| import com.ruoyi.model.service.IAApiAppletLoginService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Pageable; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.annotation.Resource; | |||
| @Api(description = "伴宠师-合伙人工作台内部流程") | |||
| @RestController | |||
| @RequestMapping("/applet/workOut") | |||
| public class ApiAppletHhrWorkOutController { | |||
| //伴宠师-登录相关问题 | |||
| @Resource | |||
| private IAApiAppletHhrWorkOutService apiAppletHhrWorkOutService; | |||
| //合伙人工作台 - 绑定用户基础信息 | |||
| @ApiOperation("合伙人工作台 - 绑定用户基础信息") | |||
| @GetMapping("/hhrInfo/{appUserId}") | |||
| public AjaxResult HhrInfo(@PathVariable("appUserId") Long appUserId){ | |||
| return apiAppletHhrWorkOutService.HhrInfo(appUserId); | |||
| } | |||
| //合伙人工作台 - 绑定二维码 | |||
| @ApiOperation("合伙人工作台 - 绑定二维码") | |||
| @GetMapping("/hhrCode/{appUserId}") | |||
| public AjaxResult HhrCode(@PathVariable("appUserId") Long appUserId){ | |||
| return apiAppletHhrWorkOutService.HhrCode(appUserId); | |||
| } | |||
| //合伙人工作台 - 我的用户列表 0 未下单 1已下单 | |||
| @ApiOperation("合伙人工作台 - 我的用户列表 0 未下单 1已下单") | |||
| @PostMapping("/hhrMyUserList") | |||
| public AjaxResult HhrMyUserList(@RequestBody ApiQueryIIdMyUserDTO dto, Pageable page){ | |||
| return apiAppletHhrWorkOutService.HhrMyUserList(dto.getAppUserId(),dto.getState(),page); | |||
| } | |||
| //合伙人工作台 - 根据用户标识查询用户下单详细信息 | |||
| @ApiOperation("合伙人工作台 - 根据用户标识查询用户下单详细信息") | |||
| @GetMapping("/hhrMyUserGetById/{appUserId}") | |||
| public AjaxResult HhrMyUserGetById(@PathVariable("appUserId") Long appUserId){ | |||
| return apiAppletHhrWorkOutService.HhrMyUserGetById(appUserId); | |||
| } | |||
| } | |||
| @ -0,0 +1,28 @@ | |||
| package com.ruoyi.applet.contoller; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PathVariable; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @Api(description = "伴宠师-我的流程") | |||
| @RestController | |||
| @RequestMapping("/applet/info") | |||
| public class ApiAppletInfoController { | |||
| } | |||
| @ -0,0 +1,53 @@ | |||
| package com.ruoyi.applet.contoller; | |||
| import com.ruoyi.applet.pojo.dto.ApiAppletLoginDTO; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import com.ruoyi.model.service.IAApiAppletLoginService; | |||
| import com.ruoyi.model.service.IAddValueServiceService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| @Api(description = "伴宠师-登录流程") | |||
| @RestController | |||
| @RequestMapping("/applet/login") | |||
| public class ApiAppletLoginController { | |||
| //伴宠师-登录相关问题 | |||
| @Autowired | |||
| private IAApiAppletLoginService apiAppletLoginService; | |||
| //伴宠师-微信授权登录 | |||
| @ApiOperation("伴宠师-微信授权登录") | |||
| @PostMapping("/wechatLogin") | |||
| public AjaxResult wechatLogin(@RequestBody ApiAppletLoginDTO params){ | |||
| return apiAppletLoginService.wechatLogin(params); | |||
| } | |||
| //伴宠师-获取手机号码 | |||
| @ApiOperation("伴宠师-获取手机号码") | |||
| @PostMapping("/bindPhone") | |||
| public AjaxResult bindPhone(@RequestBody ApiAppletLoginDTO params){ | |||
| return apiAppletLoginService.bindPhone(params); | |||
| } | |||
| //伴宠师-登录页基础信息 | |||
| @ApiOperation("伴宠师-登录页基础信息") | |||
| @GetMapping("/loginConf") | |||
| public AjaxResult loginConf(){ | |||
| return apiAppletLoginService.loginConf(); | |||
| } | |||
| //伴宠师-获取用户基本能信息 | |||
| @ApiOperation("伴宠师-获取用户基本能信息") | |||
| @GetMapping("/getAppletUserInfo/{appUserId}") | |||
| public AjaxResult getAppletUserInfo(@PathVariable("appUserId") Long appUserId){ | |||
| return apiAppletLoginService.getAppletUserInfo(appUserId); | |||
| } | |||
| } | |||
| @ -0,0 +1,59 @@ | |||
| package com.ruoyi.applet.contoller; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | |||
| import com.ruoyi.model.domain.AppTransactionDetails; | |||
| import com.ruoyi.model.service.*; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.*; | |||
| import javax.annotation.Resource; | |||
| import java.math.BigDecimal; | |||
| @Api(description = "伴宠师-钱包相关接口") | |||
| @RestController | |||
| @RequestMapping("/applet/wallet") | |||
| public class ApiAppletWalletController extends BaseController { | |||
| //钱包 | |||
| @Autowired | |||
| private IAppWalletService appWalletService; | |||
| //钱包提现配置 | |||
| @Autowired | |||
| private IAppWithdrawalConfigService appWithdrawalConfigService; | |||
| @Autowired | |||
| private IAppTransactionDetailsService appTransactionDetailsService; | |||
| @Autowired | |||
| private ITransactionDetailsService transactionDetailsService; | |||
| @ApiOperation("交易明细记录列表-这里还要改成带分页的") | |||
| @GetMapping("/getTransactionDetailsList/{transactionType}") | |||
| public TableDataInfo getTransactionDetailsList(@PathVariable Long transactionType){ | |||
| return getDataTable(transactionDetailsService.getTransactionDetailsList(transactionType)); | |||
| } | |||
| @ApiOperation("交易明细记录") | |||
| @GetMapping("/getTransactionDetails/{id}") | |||
| public TableDataInfo getAppTransactionDetailsByWid(@PathVariable Long id){ | |||
| return getDataTable(appTransactionDetailsService.getAppTransactionDetailsByWid(id)); | |||
| } | |||
| //伴宠师-用户提现 | |||
| @ApiOperation("伴宠师-用户提现") | |||
| @PostMapping("/saveMoney") | |||
| public AjaxResult saveMoney(@PathVariable BigDecimal money){ | |||
| AppTransactionDetails appTransactionDetails = new AppTransactionDetails(); | |||
| appTransactionDetails.setDetailsName("提现测试"); | |||
| appTransactionDetails.setDetailsPrice(100L); | |||
| appTransactionDetailsService.insertAppTransactionDetails(appTransactionDetails); | |||
| return AjaxResult.success("提现成功"); | |||
| } | |||
| } | |||
| @ -1,29 +1,29 @@ | |||
| package com.ruoyi.applet.contoller; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | |||
| import com.ruoyi.model.domain.AppBanner; | |||
| import com.ruoyi.model.service.IAppBannerService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| 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.RestController; | |||
| import java.util.List; | |||
| @Api(description = "轮播图") | |||
| @RestController | |||
| @RequestMapping("/applet/banner") | |||
| public class AppletBannerController extends BaseController { | |||
| //1.查询轮播图接口 | |||
| @Autowired | |||
| private IAppBannerService iAppBannerService; | |||
| @ApiOperation("轮播图列表") | |||
| @GetMapping("/list") | |||
| public TableDataInfo list(){ | |||
| return getDataTable(iAppBannerService.getBannerList()); | |||
| } | |||
| } | |||
| //package com.ruoyi.applet.contoller; | |||
| // | |||
| //import com.ruoyi.common.core.controller.BaseController; | |||
| //import com.ruoyi.common.core.page.TableDataInfo; | |||
| //import com.ruoyi.model.domain.AppBanner; | |||
| //import com.ruoyi.model.service.IAppBannerService; | |||
| //import io.swagger.annotations.Api; | |||
| //import io.swagger.annotations.ApiOperation; | |||
| //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.RestController; | |||
| // | |||
| //import java.util.List; | |||
| // | |||
| //@Api(description = "伴宠师-轮播图") | |||
| //@RestController | |||
| //@RequestMapping("/applet/banner") | |||
| //public class AppletBannerController extends BaseController { | |||
| //// //1.查询轮播图接口 | |||
| //// @Autowired | |||
| //// private IAppBannerService iAppBannerService; | |||
| //// | |||
| //// @ApiOperation("轮播图列表") | |||
| //// @GetMapping("/list") | |||
| //// public TableDataInfo list(){ | |||
| //// return getDataTable(iAppBannerService.getBannerList()); | |||
| //// } | |||
| //} | |||
| @ -1,43 +0,0 @@ | |||
| package com.ruoyi.applet.contoller; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | |||
| import com.ruoyi.model.domain.Indexconfig; | |||
| import com.ruoyi.model.domain.IndexconfigIcon; | |||
| import com.ruoyi.model.service.IIndexconfigIconService; | |||
| import com.ruoyi.model.service.IIndexconfigService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PathVariable; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.List; | |||
| @Api(description = "工作台图标") | |||
| @RestController | |||
| @RequestMapping("/applet/indexIcon") | |||
| public class AppletIndexIconController extends BaseController { | |||
| @Autowired | |||
| private IIndexconfigIconService indexconfigIconService; | |||
| @Autowired | |||
| private IIndexconfigService indexConfigService; | |||
| @ApiOperation("未加入的工作台图标配置查询") | |||
| @GetMapping("/indexConfigIcon/{identity}") | |||
| public AjaxResult getIndexConfigIcon(@PathVariable Long identity){ | |||
| IndexconfigIcon indexconfigIconByIdentity = indexconfigIconService.getIndexconfigIconByIdentity(identity); | |||
| return AjaxResult.success(indexconfigIconByIdentity); | |||
| } | |||
| @ApiOperation("已加入的工作台图标配置查询") | |||
| @GetMapping("/indexConfig/{indexType}") | |||
| public TableDataInfo getIndexConfig(@PathVariable Long indexType){ | |||
| return getDataTable(indexConfigService.getIndexconfigList(indexType)); | |||
| } | |||
| } | |||
| @ -1,30 +1,25 @@ | |||
| package com.ruoyi.applet.contoller; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | |||
| import com.ruoyi.model.domain.IndexPartnerConfig; | |||
| import com.ruoyi.model.service.IIndexPartnerConfigService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| 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.RestController; | |||
| import java.util.List; | |||
| @Api(description = "加入合伙人提示配置") | |||
| @RestController | |||
| @RequestMapping("/applet/indexPartnerConfig") | |||
| public class AppletIndexPartnerConfigController extends BaseController { | |||
| @Autowired | |||
| private IIndexPartnerConfigService iIndexPartnerConfigService; | |||
| @ApiOperation("查询加入合伙人提示配置列表") | |||
| @GetMapping("/list") | |||
| public TableDataInfo list(){ | |||
| List<IndexPartnerConfig> indexPartnerConfigList = iIndexPartnerConfigService.getIndexPartnerConfigList(); | |||
| return getDataTable(indexPartnerConfigList); | |||
| } | |||
| } | |||
| //package com.ruoyi.applet.contoller; | |||
| // | |||
| //import com.ruoyi.common.core.controller.BaseController; | |||
| //import com.ruoyi.common.core.page.TableDataInfo; | |||
| //import com.ruoyi.model.domain.IndexPartnerConfig; | |||
| //import com.ruoyi.model.service.IIndexPartnerConfigService; | |||
| //import io.swagger.annotations.Api; | |||
| //import io.swagger.annotations.ApiOperation; | |||
| //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.RestController; | |||
| // | |||
| //import java.util.List; | |||
| // | |||
| //@Api(description = "伴宠师-合伙人已绑定工作台") | |||
| //@RestController | |||
| //@RequestMapping("/applet/hhr") | |||
| //public class AppletIndexPartnerConfigController extends BaseController { | |||
| // | |||
| // | |||
| // | |||
| // | |||
| // | |||
| //} | |||
| @ -1,39 +0,0 @@ | |||
| package com.ruoyi.applet.contoller; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.beans.BeanUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.data.domain.Page; | |||
| import org.springframework.data.domain.PageImpl; | |||
| import org.springframework.data.domain.Pageable; | |||
| import org.springframework.http.ResponseEntity; | |||
| import org.springframework.web.bind.annotation.PostMapping; | |||
| import org.springframework.web.bind.annotation.RequestBody; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Api(description = "伴宠师登录") | |||
| @RestController | |||
| @RequestMapping("/applet/login") | |||
| public class AppletLoginController { | |||
| // @Autowired | |||
| //1.微信授权登录接口 | |||
| //2.获取微信手机号接口 | |||
| //3.获取用户协议和隐私政策(用一个config拉取) | |||
| // @Aonymous | |||
| // @ApiOperation("登录接口") | |||
| // @PostMapping("/login") | |||
| // public ResponseEntity login(@RequestBody AppletLoginRequest appletLoginRequest){ | |||
| // Map<String,Object> hashMap = new HashMap(); | |||
| // hashMap.put("userInfo",appletLoginRequest); | |||
| // hashMap.put("token",123); | |||
| // return ResponseEntity.ok(hashMap); | |||
| // } | |||
| } | |||
| @ -1,59 +0,0 @@ | |||
| package com.ruoyi.applet.contoller; | |||
| import com.ruoyi.common.core.controller.BaseController; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import com.ruoyi.common.core.page.TableDataInfo; | |||
| import com.ruoyi.model.service.IAppTransactionDetailsService; | |||
| import com.ruoyi.model.service.IAppWalletService; | |||
| import com.ruoyi.model.service.IAppWithdrawalConfigService; | |||
| import com.ruoyi.model.service.ITransactionDetailsService; | |||
| import io.swagger.annotations.Api; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.web.bind.annotation.GetMapping; | |||
| import org.springframework.web.bind.annotation.PathVariable; | |||
| import org.springframework.web.bind.annotation.RequestMapping; | |||
| import org.springframework.web.bind.annotation.RestController; | |||
| @Api(description = "钱包") | |||
| @RestController | |||
| @RequestMapping("/applet/wallet") | |||
| public class AppletWalletController extends BaseController { | |||
| //钱包 | |||
| @Autowired | |||
| private IAppWalletService appWalletService; | |||
| //钱包提现配置 | |||
| @Autowired | |||
| private IAppWithdrawalConfigService appWithdrawalConfigService; | |||
| @Autowired | |||
| private IAppTransactionDetailsService appTransactionDetailsService; | |||
| @ApiOperation("钱包列表") | |||
| @GetMapping("/getWalletList/{userId}") | |||
| public TableDataInfo getAppWalletByUserId(@PathVariable Long userId){ | |||
| return getDataTable(appWalletService.getAppWalletByUserId(userId)); | |||
| } | |||
| @Autowired | |||
| private ITransactionDetailsService transactionDetailsService; | |||
| @ApiOperation("交易明细记录列表") | |||
| @GetMapping("/getTransactionDetailsList") | |||
| public TableDataInfo getTransactionDetailsList(){ | |||
| return getDataTable(transactionDetailsService.getTransactionDetailsList()); | |||
| } | |||
| @ApiOperation("钱包提现规则") | |||
| @GetMapping("/getAppWithdrawal") | |||
| public AjaxResult getAppWithdrawalConfig(){ | |||
| return AjaxResult.success(appWithdrawalConfigService.getAppWithdrawalConfig()); | |||
| } | |||
| @ApiOperation("交易明细记录") | |||
| @GetMapping("/getTransactionDetails/{wid}") | |||
| public TableDataInfo getAppTransactionDetailsByWid(@PathVariable Long wid){ | |||
| return getDataTable(appTransactionDetailsService.getAppTransactionDetailsByWid(wid)); | |||
| } | |||
| } | |||
| @ -0,0 +1,27 @@ | |||
| package com.ruoyi.applet.pojo.dto; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| @Data | |||
| public class ApiAppletLoginDTO { | |||
| /** | |||
| * 参数信息 | |||
| */ | |||
| @ApiModelProperty(value = "参数信息") | |||
| private String code; | |||
| /** | |||
| * 用户唯一标识 | |||
| */ | |||
| @ApiModelProperty(value = "用户唯一标识") | |||
| private String openid; | |||
| /** | |||
| * 邀请者标识 | |||
| */ | |||
| @ApiModelProperty(value = "邀请者销售标识") | |||
| private String shareId; | |||
| } | |||
| @ -0,0 +1,14 @@ | |||
| package com.ruoyi.applet.pojo.dto; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| @Data | |||
| public class ApiQueryIIdDTO { | |||
| /** | |||
| * 用户标识 | |||
| */ | |||
| @ApiModelProperty(value = "用户标识") | |||
| private Long appUserId; | |||
| } | |||
| @ -0,0 +1,21 @@ | |||
| package com.ruoyi.applet.pojo.dto; | |||
| import io.swagger.annotations.ApiModelProperty; | |||
| import lombok.Data; | |||
| @Data | |||
| public class ApiQueryIIdMyUserDTO { | |||
| /** | |||
| * 用户标识 | |||
| */ | |||
| @ApiModelProperty(value = "用户标识") | |||
| private Long appUserId; | |||
| /** | |||
| * 状态0未下单1已下单 | |||
| */ | |||
| @ApiModelProperty(value = "状态0未下单1已下单") | |||
| private Integer state; | |||
| } | |||
| @ -0,0 +1,15 @@ | |||
| package com.ruoyi.applet.utils.conf; | |||
| import com.ruoyi.common.constant.Constants; | |||
| import com.ruoyi.framework.config.LocalDataUtil; | |||
| import com.ruoyi.model.domain.AppUsers; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class AppletUtil { | |||
| public static AppUsers getLocalAppletUser() { | |||
| AppUsers user = (AppUsers) LocalDataUtil.getVar(Constants.LOGIN_APPLET_TOKEN_KEY); | |||
| return user; | |||
| } | |||
| } | |||
| @ -0,0 +1,33 @@ | |||
| package com.ruoyi.applet.utils.wechat; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import org.apache.http.HttpEntity; | |||
| import org.apache.http.client.methods.CloseableHttpResponse; | |||
| import org.apache.http.client.methods.HttpGet; | |||
| import org.apache.http.impl.client.CloseableHttpClient; | |||
| import org.apache.http.impl.client.HttpClients; | |||
| import org.apache.http.util.EntityUtils; | |||
| import org.springframework.stereotype.Component; | |||
| @Component | |||
| public class WechatHttpConf { | |||
| public JSONObject getJSONObject(String url){ | |||
| String jsonObjectStr = null; | |||
| try { | |||
| CloseableHttpClient client = null; | |||
| CloseableHttpResponse response = null; | |||
| HttpGet httpGet = new HttpGet(url); | |||
| client = HttpClients.createDefault(); | |||
| response = client.execute(httpGet); | |||
| HttpEntity entity = response.getEntity(); | |||
| jsonObjectStr = EntityUtils.toString(entity); | |||
| } catch (Exception e) { | |||
| throw new RuntimeException("服务繁忙,稍后再试"); | |||
| } | |||
| JSONObject jsonObject = JSONObject.parseObject(jsonObjectStr); | |||
| return jsonObject; | |||
| } | |||
| } | |||
| @ -0,0 +1,25 @@ | |||
| package com.ruoyi.model.service; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import org.springframework.data.domain.Pageable; | |||
| public interface IAApiAppletHhrWorkOutService { | |||
| //合伙人工作台 - 绑定用户基础信息 | |||
| AjaxResult HhrInfo(Long appUserId); | |||
| //合伙人工作台 - 绑定二维码 | |||
| AjaxResult HhrCode(Long appUserId); | |||
| //合伙人工作台 - 我的用户列表 0 未下单 1已下单 | |||
| AjaxResult HhrMyUserList(Long appUserId,Integer state, Pageable page); | |||
| //合伙人工作台 - 根据用户标识查询用户下单详细信息 | |||
| AjaxResult HhrMyUserGetById(Long appUserId); | |||
| } | |||
| @ -0,0 +1,23 @@ | |||
| package com.ruoyi.model.service; | |||
| import com.ruoyi.applet.pojo.dto.ApiAppletLoginDTO; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import org.springframework.http.ResponseEntity; | |||
| import org.springframework.web.bind.annotation.PathVariable; | |||
| public interface IAApiAppletLoginService { | |||
| //伴宠师-微信授权登录 | |||
| AjaxResult wechatLogin(ApiAppletLoginDTO params); | |||
| //伴宠师-获取手机号码 | |||
| AjaxResult bindPhone(ApiAppletLoginDTO params); | |||
| //伴宠师-登录页基础信息 | |||
| AjaxResult loginConf(); | |||
| //伴宠师-获取用户基本能信息 | |||
| AjaxResult getAppletUserInfo(Long appUserId); | |||
| } | |||
| @ -0,0 +1,4 @@ | |||
| package com.ruoyi.model.service; | |||
| public interface IApiAppletInfoService { | |||
| } | |||
| @ -0,0 +1,135 @@ | |||
| package com.ruoyi.model.service.impl; | |||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
| import com.ruoyi.applet.utils.conf.AppletUtil; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import com.ruoyi.framework.web.service.TokenService; | |||
| import com.ruoyi.model.domain.AppUsers; | |||
| import com.ruoyi.model.service.IAApiAppletHhrWorkOutService; | |||
| import com.ruoyi.model.service.IAppUsersService; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.springframework.data.domain.PageImpl; | |||
| import org.springframework.data.domain.Pageable; | |||
| import org.springframework.http.ResponseEntity; | |||
| import org.springframework.stereotype.Service; | |||
| import javax.annotation.Resource; | |||
| import java.util.Date; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| @Slf4j | |||
| @Service | |||
| public class AApiAppletHhrWorkOutServiceImpl implements IAApiAppletHhrWorkOutService { | |||
| @Resource | |||
| private IAppUsersService appUsersService; | |||
| @Resource | |||
| private TokenService tokenService; | |||
| //合伙人工作台 - 绑定用户基础信息 | |||
| @Override | |||
| public AjaxResult HhrInfo(Long appUserId){ | |||
| // AppUsers localAppletUser = AppletUtil.getLocalAppletUser(); | |||
| AppUsers localAppletUser = new AppUsers(); | |||
| localAppletUser.setUserId(appUserId); | |||
| AppUsers appUsers = appUsersService.selectAppUsersByUserId(localAppletUser.getUserId()); | |||
| Map<String,Object> map = new HashMap<>(); | |||
| map.put("info",appUsers); //用户信息 | |||
| map.put("partner_level","初级合伙人"); //合伙人等级 | |||
| map.put("partner_day","138天"); //合伙人加入天数 | |||
| map.put("partner_new_num","25"); //合伙人当前合伙人比例 | |||
| map.put("partner_upgrade_num","30"); //合伙人晋级之后的合伙人比例 | |||
| map.put("user_code","jsk66623"); //邀请码 | |||
| map.put("user_code_bj","https://image.hhlm1688.com/img/work/log/indexInfo/11.png"); //邀请码背景图 | |||
| map.put("user_code_fx","https://image.hhlm1688.com/img/work/log/indexInfo/11.png"); //分享海报背景图 | |||
| map.put("user_code_url","https://image.hhlm1688.com/img/work/log/indexInfo/11.png"); //分销链接背景图 | |||
| map.put("register_users","100"); //当月注册用户 | |||
| map.put("order_users","200"); //当月下单用户 | |||
| map.put("use_users","200"); //当月有效用户 | |||
| map.put("order_users_money","288.98"); //本月订单金额 | |||
| map.put("use_users_money","288.98"); //本月有效订单金额 | |||
| map.put("register_users_sum","999"); //累积注册用户 | |||
| map.put("order_users_sum","998"); //累积下单用户 | |||
| map.put("use_users_sum","999"); //累积有效用户 | |||
| map.put("order_users_sum_money","288.98"); //累积订单金额 | |||
| map.put("use_users_sum_money","288.98"); //累积有效订单金额 | |||
| map.put("money","998.98"); //钱包金额 | |||
| map.put("new_money","288.98"); //本月分成 | |||
| map.put("old_money","288.98"); //累积分成 | |||
| map.put("upgrade_register_num","5"); //距离下一个等级需要注册多少人 | |||
| map.put("upgrade_order_num","20"); //距离下一个等级需要下单人数 | |||
| map.put("upgrade_image","https://image.hhlm1688.com/img/work/log/indexInfo/11.png"); //背景图 | |||
| map.put("upgrade_details","合伙人权益说明:富文本"); //合伙人权益说明:富文本 | |||
| map.put("user_details","*累计报酬:当该用户订单完成时,才会纳入报酬计算:这是一个富文本"); //我的用户说明 | |||
| map.put("level_details","累积数据:即注册至今的累计数据:这是一个富文本"); //我的等级说明 | |||
| map.put("withdrawal_details","提现说明:这是一个富文本提现说明:这是一个富文本提现说明:这是一个富文本提现说明:这是一个富文本"); //提现说明 | |||
| return AjaxResult.success(map); | |||
| } | |||
| //合伙人工作台 - 绑定二维码 | |||
| @Override | |||
| public AjaxResult HhrCode(Long appUserId){ | |||
| AppUsers localAppletUser = new AppUsers(); | |||
| localAppletUser.setUserId(appUserId); | |||
| AppUsers appUsers = appUsersService.selectAppUsersByUserId(localAppletUser.getUserId()); | |||
| Map<String,Object> map = new HashMap<>(); | |||
| map.put("code","666666");//邀请码 | |||
| map.put("url","https://image.hhlm1688.com/img/work/log/headImage.png");//二维码地址 | |||
| map.put("bj_url","https://image.hhlm1688.com/img/work/log/headImage.png");//海报背景图 | |||
| map.put("title","欢迎来到宠物小程序二维码部分");//说明 | |||
| return AjaxResult.success(map); | |||
| } | |||
| //合伙人工作台 - 我的用户列表 0 未下单 1已下单 | |||
| @Override | |||
| public AjaxResult HhrMyUserList(Long appUserId,Integer state, Pageable page){ | |||
| AppUsers localAppletUser = new AppUsers(); | |||
| localAppletUser.setUserId(appUserId); | |||
| List<AppUsers> pageRes = appUsersService.selectAppUsersList(new AppUsers()); | |||
| // PageImpl<AppUsers> appUsers = new PageImpl<>(pageRes, page, ((Page) pageRes).getTotal()); | |||
| return AjaxResult.success("查询分页成功",pageRes); | |||
| } | |||
| //合伙人工作台 - 根据用户标识查询用户下单详细信息 | |||
| @Override | |||
| public AjaxResult HhrMyUserGetById(Long appUserId){ | |||
| Map<String,Object> map = new HashMap<>(); | |||
| map.put("createTime",new Date());//注册时间 | |||
| map.put("recently_pay_time",new Date());//最近下单时间 | |||
| map.put("accumulate_money","9999.99");//海报背景图 | |||
| map.put("reward_money","100");//累积报酬 | |||
| return AjaxResult.success("用户下单详细信息成功",map); | |||
| } | |||
| } | |||
| @ -0,0 +1,203 @@ | |||
| package com.ruoyi.model.service.impl; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.ruoyi.applet.pojo.dto.ApiAppletLoginDTO; | |||
| import com.ruoyi.applet.utils.wechat.WechatHttpConf; | |||
| import com.ruoyi.common.core.domain.AjaxResult; | |||
| import com.ruoyi.common.core.domain.model.LoginApplet; | |||
| import com.ruoyi.common.core.domain.model.LoginMember; | |||
| import com.ruoyi.model.domain.AppUsers; | |||
| import com.ruoyi.model.service.IAApiAppletLoginService; | |||
| import com.ruoyi.model.service.IAppUsersService; | |||
| import lombok.Data; | |||
| import lombok.extern.slf4j.Slf4j; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Value; | |||
| import org.springframework.http.ResponseEntity; | |||
| import com.ruoyi.framework.web.service.TokenService; | |||
| import org.springframework.stereotype.Service; | |||
| import org.springframework.transaction.annotation.Transactional; | |||
| import javax.annotation.Resource; | |||
| import java.io.BufferedReader; | |||
| import java.io.DataOutputStream; | |||
| import java.io.InputStreamReader; | |||
| import java.net.HttpURLConnection; | |||
| import java.net.URL; | |||
| import java.nio.charset.StandardCharsets; | |||
| import java.time.LocalDateTime; | |||
| import java.util.*; | |||
| import static org.bouncycastle.asn1.x500.style.RFC4519Style.member; | |||
| @Slf4j | |||
| @Service | |||
| public class AApiAppletLoginServiceImpl implements IAApiAppletLoginService { | |||
| @Value("${wechat-admin.appId}") | |||
| private String appId; | |||
| @Value("${wechat-admin.secret}") | |||
| private String secret; | |||
| private static final String TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=%s&secret=%s"; | |||
| private static final String API_URL = "https://api.weixin.qq.com/wxa/business/getuserphonenumber"; | |||
| @Resource | |||
| private WechatHttpConf wechatHttpConf; | |||
| @Resource | |||
| private IAppUsersService appUsersService; | |||
| @Resource | |||
| private TokenService tokenService; | |||
| //伴宠师-微信授权登录 | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| @Override | |||
| public AjaxResult wechatLogin(ApiAppletLoginDTO params){ | |||
| if(StringUtils.isEmpty(params.getCode())){ | |||
| throw new RuntimeException("参数错误"); | |||
| } | |||
| String loginUrl = "https://api.weixin.qq.com/sns/jscode2session?appid=" | |||
| + appId + "&secret=" | |||
| + secret+ "&js_code=" | |||
| + params.getCode() | |||
| + "&grant_type=authorization_code"; | |||
| JSONObject wx_json = wechatHttpConf.getJSONObject(loginUrl); | |||
| String wxOpenid = wx_json.getString("openid"); | |||
| if (StringUtils.isBlank(wxOpenid)) { | |||
| throw new RuntimeException("服务繁忙,稍后再试"); | |||
| } | |||
| AppUsers appUsers = appUsersService.selectAppUsersByOpenId(wxOpenid); | |||
| if (appUsers == null) { | |||
| //用户信息为空的情况下说明是新的用户 | |||
| appUsers = new AppUsers(); | |||
| long appletId = System.currentTimeMillis(); | |||
| appUsers.setUserId(appletId); | |||
| appUsers.setOpenid(wxOpenid); | |||
| appUsers.setUserName("伴宠师"+System.currentTimeMillis());//lzx需要修改到conf中的配置获取 | |||
| appUsers.setUserImage("https://image.hhlm1688.com/img/work/log/headImage.png"); //lzx需要修改到conf中的配置获取 | |||
| appUsers.setCreateTime(LocalDateTime.now()); | |||
| appUsersService.insertAppUsers(appUsers); | |||
| LoginApplet loginApplet = new LoginApplet(); | |||
| loginApplet.setAppletId(appletId); | |||
| String appletToken = tokenService.createAppletToken(loginApplet); | |||
| Map<String,Object> map = new HashMap(); | |||
| map.put("token",appletToken); | |||
| map.put("userInfo",appUsers); | |||
| return AjaxResult.success("登录成功",map); | |||
| }else{ | |||
| LoginApplet loginApplet = new LoginApplet(); | |||
| loginApplet.setAppletId(appUsers.getUserId()); | |||
| String appletToken = tokenService.createAppletToken(loginApplet); | |||
| Map<String,Object> map = new HashMap(); | |||
| map.put("token",appletToken); | |||
| map.put("userInfo",appUsers); | |||
| return AjaxResult.success("登录成功",map); | |||
| } | |||
| } | |||
| //伴宠师-获取手机号码 | |||
| @Override | |||
| public AjaxResult bindPhone(ApiAppletLoginDTO params){ | |||
| try { | |||
| String phoneNumber = this.getPhoneNumber(params.getCode()); | |||
| AppUsers appUsers = appUsersService.selectAppUsersByOpenId(params.getOpenid()); | |||
| //如果对象存在 | |||
| if (appUsers!=null){ | |||
| appUsers.setUserTelephone(phoneNumber); | |||
| appUsersService.updateAppUsers(appUsers); | |||
| } | |||
| return AjaxResult.success(phoneNumber); | |||
| }catch (Exception e){ | |||
| return AjaxResult.error(e.getMessage()); | |||
| } | |||
| } | |||
| //伴宠师-登录页基础信息 | |||
| @Override | |||
| public AjaxResult loginConf(){ | |||
| Map map = new HashMap(); | |||
| map.put("appletName","伴宠师"); | |||
| map.put("appletLogoImg","https://image.hhlm1688.com/img/Group%20213084%402x.png"); | |||
| map.put("user_xy","用户协议富文本"); | |||
| map.put("user_zc","隐私政策富文本"); | |||
| return AjaxResult.success("查询成功",map); | |||
| } | |||
| //伴宠师-获取用户基本能信息 | |||
| @Override | |||
| public AjaxResult getAppletUserInfo(Long appUserId){ | |||
| AppUsers appUsers = appUsersService.selectAppUsersByUserId(appUserId); | |||
| return AjaxResult.success("用户信息",appUsers); | |||
| } | |||
| public String getAccessToken() throws Exception { | |||
| String requestUrl = String.format(TOKEN_URL, appId, secret); | |||
| URL url = new URL(requestUrl); | |||
| HttpURLConnection conn = (HttpURLConnection) url.openConnection(); | |||
| conn.setRequestMethod("GET"); | |||
| try (BufferedReader br = new BufferedReader( | |||
| new InputStreamReader(conn.getInputStream(), "UTF-8"))) { | |||
| StringBuilder response = new StringBuilder(); | |||
| String responseLine; | |||
| while ((responseLine = br.readLine()) != null) { | |||
| response.append(responseLine.trim()); | |||
| } | |||
| org.json.JSONObject jsonResponse = new org.json.JSONObject(response.toString()); | |||
| return jsonResponse.getString("access_token"); | |||
| } | |||
| } | |||
| public String getPhoneNumber(String code) throws Exception { | |||
| URL url = new URL(API_URL + "?access_token=" + this.getAccessToken()); | |||
| HttpURLConnection conn = (HttpURLConnection) url.openConnection(); | |||
| conn.setRequestMethod("POST"); | |||
| conn.setRequestProperty("Content-Type", "application/json; utf-8"); | |||
| conn.setRequestProperty("Accept", "application/json"); | |||
| conn.setDoOutput(true); | |||
| JSONObject jsonInput = new JSONObject(); | |||
| jsonInput.put("code", code); | |||
| try (DataOutputStream os = new DataOutputStream(conn.getOutputStream())) { | |||
| byte[] input = jsonInput.toString().getBytes(StandardCharsets.UTF_8); | |||
| os.write(input, 0, input.length); | |||
| } | |||
| try (BufferedReader br = new BufferedReader( | |||
| new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8))) { | |||
| StringBuilder response = new StringBuilder(); | |||
| String responseLine; | |||
| while ((responseLine = br.readLine()) != null) { | |||
| response.append(responseLine.trim()); | |||
| } | |||
| //获取手机号码 | |||
| return response.toString(); | |||
| } | |||
| } | |||
| } | |||
| @ -0,0 +1,8 @@ | |||
| package com.ruoyi.model.service.impl; | |||
| import com.ruoyi.model.service.IApiAppletInfoService; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class ApiAppletInfoServiceImpl implements IApiAppletInfoService { | |||
| } | |||
| @ -0,0 +1,20 @@ | |||
| package com.ruoyi.common.core.domain.model; | |||
| import lombok.Data; | |||
| /** | |||
| * 伴宠师-小程序登录 | |||
| */ | |||
| @Data | |||
| public class LoginApplet { | |||
| private Long appletId; | |||
| private String token; | |||
| private Long loginTime; | |||
| private Long expireTime; | |||
| /** | |||
| * 登录类型(1伴宠师端) | |||
| */ | |||
| private Integer sourceType; | |||
| } | |||