瀏覽代碼

挪用agent 应用管理到出包应用管理

marxjaw 3 月之前
父節點
當前提交
d6c9a3d51d
共有 25 個文件被更改,包括 939 次插入22 次删除
  1. 6 1
      yt-common/src/main/java/com/ytpm/agent/model/YtPlatformUserApp.java
  2. 24 0
      yt-common/src/main/java/com/ytpm/middle/param/ApkListParam.java
  3. 35 0
      yt-common/src/main/java/com/ytpm/middle/param/AppForm.java
  4. 20 0
      yt-common/src/main/java/com/ytpm/middle/param/AppListParam.java
  5. 1 1
      yt-common/src/main/java/com/ytpm/middle/view/AgentBaseInfoListVO.java
  6. 51 0
      yt-common/src/main/java/com/ytpm/middle/view/AppListVO.java
  7. 8 6
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/controller/AgentController.java
  8. 57 0
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/controller/AppController.java
  9. 44 0
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/controller/AttachController.java
  10. 2 1
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/controller/MiddleController.java
  11. 46 0
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/controller/OutsourcingController.java
  12. 3 5
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/dao/AgentMapper.java
  13. 27 0
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/dao/ApkMapper.java
  14. 31 0
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/dao/AppMapper.java
  15. 2 2
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/AgentService.java
  16. 20 0
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/ApkService.java
  17. 22 0
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/AppService.java
  18. 25 0
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/AttachService.java
  19. 5 4
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/impl/AgentServiceImpl.java
  20. 62 0
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/impl/ApkServiceImpl.java
  21. 62 0
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/impl/AppServiceImpl.java
  22. 98 0
      yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/impl/AttachServiceImpl.java
  23. 45 2
      yt-middle/middle-platform/src/main/resources/mapper/AgentMapper.xml
  24. 171 0
      yt-middle/middle-platform/src/main/resources/mapper/ApkMapper.xml
  25. 72 0
      yt-middle/middle-platform/src/main/resources/mapper/AppMapper.xml

+ 6 - 1
yt-common/src/main/java/com/ytpm/agent/model/YtPlatformUserApp.java

@@ -1,14 +1,17 @@
 package com.ytpm.agent.model;
 
+import com.ytpm.general.BaseParam;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
 import java.util.Date;
 
+@EqualsAndHashCode(callSuper = true)
 @Data
 @ApiModel("平台用户应用表")
-public class YtPlatformUserApp {
+public class YtPlatformUserApp extends BaseParam {
     @ApiModelProperty("应用ID")
     private String appId;
     @ApiModelProperty("应用名称")
@@ -25,4 +28,6 @@ public class YtPlatformUserApp {
     private String domain;
     @ApiModelProperty("上架时间")
     private Date issuedTime;
+    @ApiModelProperty("微信应用ID")
+    private String wxAppId;
 }

+ 24 - 0
yt-common/src/main/java/com/ytpm/middle/param/ApkListParam.java

@@ -0,0 +1,24 @@
+package com.ytpm.middle.param;
+
+import com.ytpm.general.PageMeta;
+import io.swagger.annotations.ApiModel;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+@NoArgsConstructor
+@AllArgsConstructor
+@ApiModel("出包应用列表参数")
+public class ApkListParam extends PageMeta {
+    /** 所属应用ID */
+    private String appId;
+    /** 所属企业 */
+    private String enterpriseId;
+    /** apk游戏名称 */
+    private String apkName;
+    /** 所属渠道 */
+    private String ditchId;
+}

+ 35 - 0
yt-common/src/main/java/com/ytpm/middle/param/AppForm.java

@@ -0,0 +1,35 @@
+package com.ytpm.middle.param;
+
+import com.ytpm.general.BaseParam;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+import java.util.Date;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@ApiModel("App应用表单")
+public class AppForm extends BaseParam {
+    @ApiModelProperty("应用ID")
+    private String appId;
+    @ApiModelProperty("应用名称")
+    private String appName;
+    @ApiModelProperty("用户ID")
+    private String userId;
+    @ApiModelProperty("应用类型")
+    private Integer appType;
+    @ApiModelProperty("详情页链接")
+    private String detailUrl;
+    @ApiModelProperty("完整程序包名")
+    private String packageName;
+    @ApiModelProperty("域名")
+    private String domain;
+    @ApiModelProperty("上架时间")
+    private Date issuedTime;
+}

+ 20 - 0
yt-common/src/main/java/com/ytpm/middle/param/AppListParam.java

@@ -0,0 +1,20 @@
+package com.ytpm.middle.param;
+
+import com.ytpm.general.PageMeta;
+import io.swagger.annotations.ApiModel;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel("应用列表入参")
+@NoArgsConstructor
+@AllArgsConstructor
+public class AppListParam extends PageMeta {
+    /** 应用名称 */
+    private String appName;
+    /** 应用类型 */
+    private Integer appType;
+}

+ 1 - 1
yt-common/src/main/java/com/ytpm/middle/view/AgentBaseInfoListVo.java → yt-common/src/main/java/com/ytpm/middle/view/AgentBaseInfoListVO.java

@@ -13,7 +13,7 @@ import lombok.NoArgsConstructor;
 @ApiModel("企业信息列表")
 @NoArgsConstructor
 @AllArgsConstructor
-public class AgentBaseInfoListVo extends BaseParam {
+public class AgentBaseInfoListVO extends BaseParam {
     /** 企业ID */
     @ApiModelProperty("企业ID")
     private int enterpriseId;

+ 51 - 0
yt-common/src/main/java/com/ytpm/middle/view/AppListVO.java

@@ -0,0 +1,51 @@
+package com.ytpm.middle.view;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+@Data
+@ApiModel("应用列表")
+@AllArgsConstructor
+@NoArgsConstructor
+public class AppListVO {
+    /** 应用ID */
+    @ApiModelProperty("应用ID")
+    private String appId;
+    /** 应用名称 */
+    @ApiModelProperty("应用名称")
+    private String appName;
+    /** 代理商ID */
+    @ApiModelProperty("代理商ID")
+    private String userId;
+    /** 应用类型 1-Android 2-IOS 3-H5 4-HamonyOS */
+    @ApiModelProperty("应用类型 1-Android 2-IOS 3-H5 4-HamonyOS")
+    private Integer appType;
+    /** 详情页地址 */
+    @ApiModelProperty("详情页地址")
+    private String detailUrl;
+    /** 应用包名 */
+    @ApiModelProperty("应用包名")
+    private String packageName;
+    /** 应用域名 */
+    @ApiModelProperty("应用域名")
+    private String domain;
+    /** 上架时间 */
+    @ApiModelProperty("上架时间")
+    private String issuedTime;
+    /** 微信开放平台AppId */
+    @ApiModelProperty("微信开放平台AppId")
+    private String wxAppId;
+    /** 授权企业 */
+    @ApiModelProperty("授权企业")
+    private String enterpriseName;
+    /** 企业负责人 */
+    @ApiModelProperty("企业负责人")
+    private String legal;
+    /** 联系电话 */
+    @ApiModelProperty("联系电话")
+    private String concatPhone;
+}

+ 8 - 6
yt-middle/middle-platform/src/main/java/com/ytpm/middle/controller/AgentController.java

@@ -6,15 +6,17 @@ import com.ytpm.general.ResultTable;
 import com.ytpm.middle.param.AgentBaseInfoParam;
 import com.ytpm.middle.param.AgentForm;
 import com.ytpm.middle.service.AgentService;
-import com.ytpm.middle.view.AgentBaseInfoListVo;
+import com.ytpm.middle.view.AgentBaseInfoListVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.security.core.annotation.AuthenticationPrincipal;
+import org.springframework.web.bind.annotation.GetMapping;
 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.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
 
 import javax.annotation.Resource;
 
@@ -31,7 +33,7 @@ public class AgentController {
      */
     @ApiOperation("代理商基本信息列表")
     @PostMapping("/baseInfoList")
-    public ResultTable<AgentBaseInfoListVo> getBaseInfoList(@RequestBody AgentBaseInfoParam param){
+    public ResultTable<AgentBaseInfoListVO> getBaseInfoList(@RequestBody AgentBaseInfoParam param){
         return agentService.getBaseInfoList(param);
     }
 
@@ -40,7 +42,7 @@ public class AgentController {
      */
     @ApiOperation("新增代理商")
     @PostMapping("/addOne")
-    public Result<String> addOne(@RequestBody AgentForm form, @AuthenticationPrincipal AgentUserInfo userInfo){
+    public Result<String> addOne(@RequestBody AgentForm form, @ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo){
         form.setCreateUserId(userInfo.getUserId());
         return agentService.addOne(form);
     }
@@ -50,7 +52,7 @@ public class AgentController {
      */
     @ApiOperation("新增代理商")
     @PostMapping("/updateOne")
-    public Result<String> updateOne(@RequestBody AgentForm form, @AuthenticationPrincipal AgentUserInfo userInfo){
+    public Result<String> updateOne(@RequestBody AgentForm form,  @ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo){
         form.setUpdateParam(userInfo.getUserId());
         return agentService.updateOne(form);
     }
@@ -59,8 +61,8 @@ public class AgentController {
      * 启用或禁用
      */
     @ApiOperation("启用或禁用")
-    @PostMapping("/changeEnabled")
-    public Result<String> enabled(@RequestParam(name = "creditCode")String creditCode, @AuthenticationPrincipal AgentUserInfo userInfo){
+    @GetMapping("/changeEnabled")
+    public Result<String> enabled(@RequestParam(name = "creditCode")String creditCode,  @ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo){
         return agentService.enabled(creditCode,userInfo.getUserId());
     }
 }

+ 57 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/controller/AppController.java

@@ -0,0 +1,57 @@
+package com.ytpm.middle.controller;
+
+import com.ytpm.agent.view.AgentUserInfo;
+import com.ytpm.general.Result;
+import com.ytpm.general.ResultTable;
+import com.ytpm.middle.param.AppForm;
+import com.ytpm.middle.param.AppListParam;
+import com.ytpm.middle.service.AppService;
+import com.ytpm.middle.view.AppListVO;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.core.annotation.AuthenticationPrincipal;
+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.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
+
+import javax.annotation.Resource;
+
+@Api(tags = "应用管理")
+@RestController
+@RequestMapping("/app")
+public class AppController {
+
+    @Resource
+    private AppService appService;
+
+    /**
+     * 查询已上架应用列表
+     */
+    @ApiOperation("查询已上架应用列表")
+    @PostMapping("/appList")
+    public ResultTable<AppListVO> appList(@RequestBody AppListParam param){
+        return appService.appList(param);
+    }
+
+    /**
+     * 新增上架应用
+     */
+    @ApiOperation("新增上架应用")
+    @PostMapping("/addApp")
+    public Result<String> addApp(@RequestBody AppForm form, @ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo){
+        form.setCreateUserId(userInfo.getUserId());
+        return appService.addApp(form);
+    }
+
+    /**
+     * 删除应用
+     */
+    @ApiOperation("删除应用")
+    @PostMapping("/delApp")
+    public Result<String> delApp(@RequestParam("appId")String appId, @ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo){
+        return appService.delApp(appId,userInfo.getUserId());
+    }
+}

+ 44 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/controller/AttachController.java

@@ -0,0 +1,44 @@
+package com.ytpm.middle.controller;
+
+import com.ytpm.attach.Attach;
+import com.ytpm.attach.Image;
+import com.ytpm.general.Result;
+import com.ytpm.middle.service.AttachService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.annotation.Resource;
+
+@Api(tags = "文件管理")
+@Slf4j(topic = "attach-controller")
+@RequestMapping("/attach")
+@RestController
+public class AttachController {
+    @Resource
+    private AttachService attachService;
+
+    /**
+     * 图片上传
+     */
+    @ApiOperation("图片上传")
+    @PostMapping("/image")
+    public Result<Image> uploadImg(@RequestParam("file") MultipartFile multipartFile) {
+        return Result.resultObjOk(attachService.uploadImage(multipartFile));
+    }
+
+    /**
+     * 上传文件
+     */
+    @ApiOperation("文件上传")
+    @PostMapping( "/file")
+    public Result<Attach> upload(@RequestParam("file") MultipartFile multipartFile) {
+        return Result.resultObjOk(attachService.uploadFile(multipartFile));
+    }
+
+}

+ 2 - 1
yt-middle/middle-platform/src/main/java/com/ytpm/middle/controller/MiddleController.java

@@ -12,6 +12,7 @@ import org.springframework.security.core.annotation.AuthenticationPrincipal;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.annotations.ApiIgnore;
 
 import javax.annotation.Resource;
 
@@ -25,7 +26,7 @@ public class MiddleController {
 
     @ApiOperation("获取当前登录的用户信息")
     @GetMapping("/curUser")
-    public Result<AgentUserInfo> getCurUser(@AuthenticationPrincipal AgentUserInfo agentUserInfo) {
+    public Result<AgentUserInfo> getCurUser( @ApiIgnore @AuthenticationPrincipal AgentUserInfo agentUserInfo) {
         return Result.resultObjOk(agentUserInfo);
     }
 

+ 46 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/controller/OutsourcingController.java

@@ -0,0 +1,46 @@
+package com.ytpm.middle.controller;
+
+import com.ytpm.agent.param.AppListParam;
+import com.ytpm.agent.param.AppParam;
+import com.ytpm.agent.view.AgentAppView;
+import com.ytpm.agent.view.AgentUserInfo;
+import com.ytpm.general.Result;
+import com.ytpm.general.ResultTable;
+import com.ytpm.middle.service.ApkService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.security.core.annotation.AuthenticationPrincipal;
+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 springfox.documentation.annotations.ApiIgnore;
+
+import javax.annotation.Resource;
+
+@Api(tags = "出包管理")
+@RestController
+@RequestMapping("/outSourcing")
+public class OutsourcingController {
+
+    @Resource
+    private ApkService apkService;
+
+    /**
+     * 出包应用列表
+     */
+    @ApiOperation("出包应用列表")
+    @PostMapping("/searchApps")
+    public ResultTable<AgentAppView> searchAll(@RequestBody AppListParam appListParam, @ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo) {
+        return apkService.searchAppList(appListParam);
+    }
+
+    /**
+     * 保存应用
+     */
+    @ApiOperation("保存应用,新增修改共用")
+    @PostMapping("/saveApp")
+    public Result<?> saveApp(@RequestBody AppParam param, @ApiIgnore @AuthenticationPrincipal AgentUserInfo userInfo) {
+        return apkService.saveApp(param,userInfo.getUserId());
+    }
+}

+ 3 - 5
yt-middle/middle-platform/src/main/java/com/ytpm/middle/dao/AgentMapper.java

@@ -1,10 +1,8 @@
 package com.ytpm.middle.dao;
 
-import com.ytpm.middle.model.YtMiddleEnterprise;
 import com.ytpm.middle.param.AgentBaseInfoParam;
-import com.ytpm.middle.view.AgentBaseInfoListVo;
+import com.ytpm.middle.view.AgentBaseInfoListVO;
 import com.ytpm.oauth.model.YtPlatformUser;
-import org.apache.ibatis.annotations.Param;
 import org.mapstruct.Mapper;
 
 import java.util.List;
@@ -14,10 +12,10 @@ public interface AgentMapper {
     /**
      * 渠道商基本信息列表
      */
-    List<AgentBaseInfoListVo> getBaseInfoList(AgentBaseInfoParam param);
+    List<AgentBaseInfoListVO> getBaseInfoList(AgentBaseInfoParam param);
 
     /**
-     *
+     * 新增用户
      */
     void addOneUser(YtPlatformUser user);
 }

+ 27 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/dao/ApkMapper.java

@@ -0,0 +1,27 @@
+package com.ytpm.middle.dao;
+
+import com.ytpm.agent.model.YtApp;
+import com.ytpm.agent.param.AppListParam;
+import com.ytpm.agent.view.AgentAppView;
+import org.mapstruct.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface ApkMapper {
+
+    /**
+     * 查询应用列表
+     */
+    List<AgentAppView> searchAppList(AppListParam appListParam);
+
+    /**
+     * 新增应用信息
+     */
+    void insertOne(YtApp app);
+
+    /**
+     * 保存应用
+     */
+    void updateOne(YtApp app);
+}

+ 31 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/dao/AppMapper.java

@@ -0,0 +1,31 @@
+package com.ytpm.middle.dao;
+
+import com.ytpm.agent.model.YtPlatformUserApp;
+import com.ytpm.middle.param.AppListParam;
+import com.ytpm.middle.view.AppListVO;
+import org.apache.ibatis.annotations.Param;
+import org.mapstruct.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface AppMapper {
+    /**
+     *  应用列表
+     */
+    List<AppListVO> getAppList(AppListParam param);
+
+    /**
+     * 根据包名查询应用
+     */
+    YtPlatformUserApp getByPackName(@Param("packageName") String packageName);
+
+    /**
+     * 新增应用
+     */
+    void insertOne(YtPlatformUserApp app);
+    /**
+     * 删除应用
+     */
+    void delApp(@Param("appId") String appId, @Param("userId") String userId);
+}

+ 2 - 2
yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/AgentService.java

@@ -4,13 +4,13 @@ import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
 import com.ytpm.middle.param.AgentBaseInfoParam;
 import com.ytpm.middle.param.AgentForm;
-import com.ytpm.middle.view.AgentBaseInfoListVo;
+import com.ytpm.middle.view.AgentBaseInfoListVO;
 
 public interface AgentService {
     /**
      * 渠道商基本信息列表
      */
-    ResultTable<AgentBaseInfoListVo> getBaseInfoList(AgentBaseInfoParam param);
+    ResultTable<AgentBaseInfoListVO> getBaseInfoList(AgentBaseInfoParam param);
     /**
      * 新增渠道商
      */

+ 20 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/ApkService.java

@@ -0,0 +1,20 @@
+package com.ytpm.middle.service;
+
+import com.ytpm.agent.param.AppListParam;
+import com.ytpm.agent.param.AppParam;
+import com.ytpm.agent.view.AgentAppView;
+import com.ytpm.general.Result;
+import com.ytpm.general.ResultTable;
+
+public interface ApkService {
+
+
+    /**
+     * 出包应用列表
+     */
+    ResultTable<AgentAppView> searchAppList(AppListParam appListParam);
+    /**
+     * 保存应用
+     */
+    Result<?> saveApp(AppParam param, String userId);
+}

+ 22 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/AppService.java

@@ -0,0 +1,22 @@
+package com.ytpm.middle.service;
+
+import com.ytpm.general.Result;
+import com.ytpm.general.ResultTable;
+import com.ytpm.middle.param.AppForm;
+import com.ytpm.middle.param.AppListParam;
+import com.ytpm.middle.view.AppListVO;
+
+public interface AppService {
+    /**
+     *  应用列表
+     */
+    ResultTable<AppListVO> appList(AppListParam param);
+    /**
+     * 新增上架应用
+     */
+    Result<String> addApp(AppForm form);
+    /**
+     * 删除应用
+     */
+    Result<String> delApp(String appId, String userId);
+}

+ 25 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/AttachService.java

@@ -0,0 +1,25 @@
+package com.ytpm.middle.service;
+
+import com.ytpm.attach.Attach;
+import com.ytpm.attach.Image;
+import org.springframework.web.multipart.MultipartFile;
+
+public interface AttachService {
+    /**
+     * 上传文件
+     *
+     * @param multipartFile 文件
+    机构id
+     * @return 文件信息
+     */
+    Attach uploadFile(MultipartFile multipartFile);
+
+    /**
+     * 上传图片
+     *
+     * @param multipartFile 文件
+    机构
+     * @return 图片信息
+     */
+    Image uploadImage(MultipartFile multipartFile);
+}

+ 5 - 4
yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/impl/AgentServiceImpl.java

@@ -6,14 +6,13 @@ import com.github.pagehelper.PageInfo;
 import com.ytpm.general.RepMessage;
 import com.ytpm.general.Result;
 import com.ytpm.general.ResultTable;
-import com.ytpm.handle.CustomerException;
 import com.ytpm.middle.dao.AgentMapper;
 import com.ytpm.middle.dao.EnterpriseMapper;
 import com.ytpm.middle.model.YtMiddleEnterprise;
 import com.ytpm.middle.param.AgentBaseInfoParam;
 import com.ytpm.middle.param.AgentForm;
 import com.ytpm.middle.service.AgentService;
-import com.ytpm.middle.view.AgentBaseInfoListVo;
+import com.ytpm.middle.view.AgentBaseInfoListVO;
 import com.ytpm.oauth.model.YtPlatformUser;
 import com.ytpm.util.IDUtil;
 import com.ytpm.util.RandomPasswordGenerator;
@@ -39,9 +38,9 @@ public class AgentServiceImpl implements AgentService {
      * 渠道商基本信息列表
      */
     @Override
-    public ResultTable<AgentBaseInfoListVo> getBaseInfoList(AgentBaseInfoParam param) {
+    public ResultTable<AgentBaseInfoListVO> getBaseInfoList(AgentBaseInfoParam param) {
         PageHelper.startPage(param.getPage(), param.getLimit());
-        return ResultTable.resultTableOk(new PageInfo<AgentBaseInfoListVo>(agentMapper.getBaseInfoList(param)));
+        return ResultTable.resultTableOk(new PageInfo<AgentBaseInfoListVO>(agentMapper.getBaseInfoList(param)));
     }
 
     /**
@@ -121,6 +120,8 @@ public class AgentServiceImpl implements AgentService {
         user.setUserType(form.getUserType());
         user.setRegistryTime(new Date());
         user.setUserId(accountId);
+        user.setChannelId(accountId);
+        user.setLoginDays(1);
         agentMapper.addOneUser(user);
     }
 }

+ 62 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/impl/ApkServiceImpl.java

@@ -0,0 +1,62 @@
+package com.ytpm.middle.service.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.text.CharSequenceUtil;
+import cn.hutool.core.util.IdUtil;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ytpm.agent.model.YtApp;
+import com.ytpm.agent.param.AppListParam;
+import com.ytpm.agent.param.AppParam;
+import com.ytpm.agent.view.AgentAppView;
+import com.ytpm.general.RepMessage;
+import com.ytpm.general.Result;
+import com.ytpm.general.ResultTable;
+import com.ytpm.middle.dao.ApkMapper;
+import com.ytpm.middle.service.ApkService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+@Service
+public class ApkServiceImpl implements ApkService {
+
+    @Resource
+    private ApkMapper apkMapper;
+
+    /**
+     * 查询应用列表
+     */
+    @Override
+    public ResultTable<AgentAppView> searchAppList(AppListParam appListParam) {
+        PageHelper.startPage(appListParam.getPage(), appListParam.getLimit());
+        return ResultTable.resultTableOk(new PageInfo<>(apkMapper.searchAppList(appListParam)));
+    }
+
+    /**
+     * 新增应用
+     */
+    @Override
+    public Result<?> saveApp(AppParam param, String userId) {
+        //数据库操作,有appId为修改, 没有时为新增
+        changeDataAction(param,userId);
+        return Result.resultOk(RepMessage.SAVE_SUCCESS);
+    }
+
+    /**
+     * 处理数据库数据变更操作
+     */
+    private void changeDataAction(AppParam param, String userId) {
+        YtApp app = new YtApp();
+        BeanUtil.copyProperties(param, app);
+        if(CharSequenceUtil.isNotBlank(param.getAppId())){
+            apkMapper.updateOne(app);
+        }else{
+            app.setAppId(IdUtil.fastSimpleUUID());
+            app.setUserId(userId);
+            app.setEnabled(1);
+            apkMapper.insertOne(app);
+        }
+    }
+}

+ 62 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/impl/AppServiceImpl.java

@@ -0,0 +1,62 @@
+package com.ytpm.middle.service.impl;
+
+import cn.hutool.core.util.IdUtil;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.ytpm.agent.model.YtPlatformUserApp;
+import com.ytpm.general.RepMessage;
+import com.ytpm.general.Result;
+import com.ytpm.general.ResultTable;
+import com.ytpm.middle.dao.AppMapper;
+import com.ytpm.middle.param.AppForm;
+import com.ytpm.middle.param.AppListParam;
+import com.ytpm.middle.service.AppService;
+import com.ytpm.middle.view.AppListVO;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.Objects;
+
+@Service
+public class AppServiceImpl implements AppService {
+
+    @Resource
+    private AppMapper appMapper;
+
+    /**
+     *  应用列表
+     */
+    @Override
+    public ResultTable<AppListVO> appList(AppListParam param) {
+        PageHelper.startPage(param.getPage(), param.getLimit());
+        return ResultTable.resultTableOk(new PageInfo<AppListVO>(appMapper.getAppList(param)));
+    }
+    /**
+     * 新增上架应用
+     */
+    @Override
+    public Result<String> addApp(AppForm form) {
+        YtPlatformUserApp old =  appMapper.getByPackName(form.getPackageName());
+        if(Objects.nonNull(old)){
+            return Result.resultErr(RepMessage.OBJECT_ALREADY_EXIST);
+        }
+        YtPlatformUserApp app = new YtPlatformUserApp();
+        BeanUtils.copyProperties(form, app);
+        app.setCreateTime(new Date());
+        app.setCreateUserId(form.getCreateUserId());
+        app.setAvailable(1);
+        appMapper.insertOne(app);
+        return Result.resultOk(RepMessage.SAVE_SUCCESS);
+    }
+
+    /**
+     * 删除应用
+     */
+    @Override
+    public Result<String> delApp(String appId, String userId) {
+        appMapper.delApp(appId,userId);
+        return Result.resultOk(RepMessage.DELETE_SUCCESS);
+    }
+}

+ 98 - 0
yt-middle/middle-platform/src/main/java/com/ytpm/middle/service/impl/AttachServiceImpl.java

@@ -0,0 +1,98 @@
+package com.ytpm.middle.service.impl;
+
+import cn.hutool.core.util.IdUtil;
+import com.ytpm.attach.Attach;
+import com.ytpm.attach.Image;
+import com.ytpm.handle.CustomerException;
+import com.ytpm.middle.oss.OssProperties;
+import com.ytpm.middle.oss.OssUtil;
+import com.ytpm.middle.service.AttachService;
+import lombok.extern.slf4j.Slf4j;
+import net.coobird.thumbnailator.Thumbnails;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.IOException;
+
+@Slf4j(topic = "attach-service")
+@Service
+public class AttachServiceImpl implements AttachService {
+
+    @Autowired
+    OssProperties properties;
+
+    @Override
+    public Attach uploadFile(MultipartFile multipartFile) {
+
+        String originFilename = multipartFile.getOriginalFilename();
+        Attach attach = new Attach();
+        String ossName = upload(multipartFile, properties, false);
+        attach.setName(originFilename);
+        attach.setOssName(ossName);
+        attach.setUrl(OssUtil.getUrl(ossName, properties));
+        attach.setFileSize(multipartFile.getSize());
+        return attach;
+    }
+
+    @Override
+    public Image uploadImage(MultipartFile multipartFile) {
+        String ossName = upload(multipartFile, properties, true);
+
+        Image image = new Image();
+        image.setOssName(ossName);
+        image.setUrl(OssUtil.getUrl(ossName, properties));
+        return image;
+    }
+
+    /**
+     * 文件上传
+     *
+     * @param multipartFile 文件
+     * @param properties    存储配置
+     * @param isImage       是否为图片
+     * @return 文件ossName
+     */
+    private String upload(MultipartFile multipartFile, OssProperties properties, Boolean isImage) {
+        String originFilename = multipartFile.getOriginalFilename();
+        String suffix = originFilename.substring(originFilename.lastIndexOf("."));
+
+        if (isImage) {
+            suffix = suffix.toUpperCase();
+            //图片
+            if (!".JPEG,.JPG,.PNG".contains(suffix)||suffix.equals(".")||suffix.equals(",")) {
+                throw new CustomerException("格式类型错误");
+            }
+        }
+
+        String folder = System.getProperty("java.io.tmpdir");
+        File file = new File(folder + File.separator + IdUtil.fastSimpleUUID() + suffix);
+
+        try {
+            multipartFile.transferTo(file);
+            //压缩图片
+            compressFile(file, suffix);
+        } catch (IOException e) {
+            log.error("文件上传失败:", e);
+            throw new CustomerException(e.getMessage());
+        }
+
+        return OssUtil.upload(file, properties);
+    }
+
+    private void compressFile(File file, String suffix) {
+        //2、大于2M的图片需要压缩大小
+        long fileSize = file.length();
+        if (".JPEG,.JPG,.PNG".contains(suffix) && fileSize > 1024 * 1024 * 2) {
+            try {
+                Thumbnails.of(file)
+                        .scale(0.2)
+//                        .outputQuality(0.2f)
+                        .toFile(file);
+            } catch (IOException e) {
+                log.error("压缩报错了:", e);
+            }
+        }
+    }
+}

+ 45 - 2
yt-middle/middle-platform/src/main/resources/mapper/AgentMapper.xml

@@ -2,10 +2,53 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ytpm.middle.dao.AgentMapper">
     <insert id="addOneUser">
-
+        insert into yt_platform_user
+        (
+         user_id,
+         nick_name,
+         head_image,
+         login_name,
+         encrypt_pwd,
+         salt,
+         phone,
+         last_login_time,
+         last_login_ip,
+         phone_brand,
+         phone_model,
+         account_status,
+         channel_id,
+         user_type,
+         login_days,
+         total_income,
+         app_id,
+         registry_time,
+         transfer_amount
+        )
+        values
+        (
+         #{userId},
+         #{nickName},
+         #{headImage},
+         #{loginName},
+         #{encryptPwd},
+         #{salt},
+         #{phone},
+         #{lastLoginTime},
+         #{lastLoginIp},
+         #{phoneBrand},
+         #{phoneModel},
+         #{accountStatus},
+         #{channelId},
+         #{userType},
+         #{loginDays},
+         #{totalIncome},
+         #{appId},
+         #{registryTime},
+         #{transferAmount}
+        );
     </insert>
 
-    <select id="getBaseInfoList" resultType="com.ytpm.middle.view.AgentBaseInfoListVo">
+    <select id="getBaseInfoList" resultType="com.ytpm.middle.view.AgentBaseInfoListVO">
         select
         me.enterprise_id,
         me.user_id,

+ 171 - 0
yt-middle/middle-platform/src/main/resources/mapper/ApkMapper.xml

@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ytpm.middle.dao.ApkMapper">
+    <select id="searchAppList" resultType="com.ytpm.agent.view.AgentAppView">
+        SELECT
+        ya.app_id,
+        ya.app_key,
+        ya.app_name,
+        ya.superior_id,
+        pua.app_name superiorName,
+        ya.user_id,
+        ya.app_type,
+        ya.apk_url,
+        ya.qr_code,
+        ya.version_code,
+        ya.update_tips,
+        ya.enabled,
+        ya.store_on_sale,
+        ya.store_type,
+        ya.store_url,
+        ya.package_name,
+        ya.domain,
+        ya.category,
+        ya.sub_category,
+        ya.coppa,
+        ya.ccpa,
+        ya.screen_orientation,
+        ya.ditch_name,
+        ya.ditch_id,
+        u.nick_name
+        FROM
+        yt_app ya
+        JOIN yt_platform_user_app pua on ya.superior_id = pua.app_id
+        LEFT JOIN yt_app_channel_relative acr ON ya.app_id = acr.app_id
+        LEFT JOIN yt_platform_user u ON ya.user_id = u.user_id
+        <where>
+            <if test="appName !=null and appName != ''">
+                and ya.app_name like concat('%', #{appName} ,'%')
+            </if>
+            <if test="appType !=null">
+                and ya.app_type = #{appType}
+            </if>
+            GROUP BY
+            ya.app_id
+        </where>
+    </select>
+
+    <insert id="insertOne">
+        insert into yt_app
+        (
+            app_id,
+            app_key,
+            app_name,
+            user_id,
+            app_type,
+            apk_url,
+            qr_code,
+            version_code,
+            update_tips,
+            store_on_sale,
+            store_type,
+            package_name,
+            domain,
+            category,
+            sub_category,
+            coppa,
+            screen_orientation,
+            ccpa,
+            store_url,
+            ditch_id,
+            ditch_name,
+            superior_id,
+            enabled
+        )
+        values
+            (
+                #{appId},
+                #{appKey},
+                #{appName},
+                #{userId},
+                #{appType},
+                #{apkUrl},
+                #{qrCode},
+                #{versionCode},
+                #{updateTips},
+                #{storeOnSale},
+                #{storeType},
+                #{packageName},
+                #{domain},
+                #{category},
+                #{subCategory},
+                #{coppa},
+                #{screenOrientation},
+                #{ccpa},
+                #{storeUrl},
+                #{ditchId},
+                #{ditchName},
+                #{superiorId},
+                #{enabled}
+            )
+    </insert>
+    <update id="updateOne">
+        update yt_app
+        <set>
+            <if test="appKey != null">
+                app_key = #{appKey},
+            </if>
+            <if test="appName != null">
+                app_name = #{appName},
+            </if>
+            <if test="appType != null">
+                app_type = #{appType},
+            </if>
+            <if test="versionCode != null">
+                version_code = #{versionCode},
+            </if>
+            <if test="updateTips != null">
+                update_tips = #{updateTips},
+            </if>
+            <if test="enabled != null">
+                enabled = #{enabled},
+            </if>
+            <if test="storeOnSale != null">
+                store_on_sale = #{storeOnSale},
+            </if>
+            <if test="storeType != null">
+                store_type = #{storeType},
+            </if>
+            <if test="storeUrl != null">
+                store_url = #{storeUrl},
+            </if>
+            <if test="packageName != null">
+                package_name = #{packageName},
+            </if>
+            <if test="domain != null">
+                domain = #{domain},
+            </if>
+            <if test="category != null">
+                category = #{category},
+            </if>
+            <if test="subCategory != null">
+                sub_category = #{subCategory},
+            </if>
+            <if test="coppa != null">
+                coppa = #{coppa},
+            </if>
+            <if test="screenOrientation != null">
+                screen_orientation = #{screenOrientation},
+            </if>
+            <if test="ccpa != null">
+                ccpa = #{ccpa},
+            </if>
+            <if test=" apkUrl != null">
+                apk_url = #{apkUrl},
+            </if>
+            <if test="qrCode != null">
+                qr_code = #{qrCode},
+            </if>
+            <if test="ditchId != null">
+                ditch_id = #{ditchId},
+            </if>
+            <if test="ditchName != null">
+                ditch_name = #{ditchName},
+            </if>
+            <if test="superiorId != null">
+                superior_id = #{superiorId}
+            </if>
+        </set>
+        where app_id = #{appId}
+    </update>
+</mapper>

+ 72 - 0
yt-middle/middle-platform/src/main/resources/mapper/AppMapper.xml

@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ytpm.middle.dao.AppMapper">
+    <insert id="insertOne">
+        insert into yt_platform_user_app
+        (
+         app_id,
+         app_name,
+         user_id,
+         app_type,
+         detail_url,
+         package_name,
+         domain,
+         issued_time,
+         wx_app_id,
+         create_user_id,
+         create_time,
+         available
+        )
+        values
+        (
+         #{appId},
+         #{appName},
+         #{userId},
+         #{appType},
+         #{detailUrl},
+         #{packageName},
+         #{domain},
+         #{issuedTime},
+         #{wxAppId},
+         #{createUserId},
+         #{createTime},
+         #{available}
+        )
+    </insert>
+    <delete id="delApp">
+        update yt_platform_user_app set available = 0, update_time = now(), update_user_id = #{userId} where app_id = #{appId}
+    </delete>
+
+    <select id="getAppList" resultType="com.ytpm.middle.view.AppListVO">
+        select
+            pua.app_id,
+            pua.app_name,
+            pua.user_id,
+            pua.app_type,
+            pua.detail_url,
+            pua.package_name,
+            pua.domain,
+            pua.issued_time,
+            pua.wx_app_id,
+            me.enterprise_name,
+            me.legal,
+            me.concat_phone
+        from yt_platform_user_app pua
+        join yt_middle_enterprise me on pua.user_id = me.user_id
+        <where>
+            pua.available = 1
+            <if test="appType != null">
+                and pua.app_type = #{appType}
+            </if>
+            <if test="appName != null and appName!=''">
+                and pua.app_name like concat('%', #{appName} ,'%')
+            </if>
+        </where>
+    </select>
+    <select id="getByPackName" resultType="com.ytpm.agent.model.YtPlatformUserApp">
+        select
+            app_id, app_name, user_id, app_type, detail_url, package_name, domain, issued_time, wx_app_id
+        from yt_platform_user_app
+        where package_name = #{packageName}
+    </select>
+</mapper>