|
|
@@ -1,15 +1,20 @@
|
|
|
package com.ytpm.middle.service.impl;
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
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.AgentMapper;
|
|
|
import com.ytpm.middle.dao.AppMapper;
|
|
|
+import com.ytpm.middle.dao.EnterpriseMapper;
|
|
|
+import com.ytpm.middle.model.YtMiddleEnterprise;
|
|
|
import com.ytpm.middle.param.AppForm;
|
|
|
import com.ytpm.middle.param.AppListParam;
|
|
|
+import com.ytpm.middle.param.GrantAppParam;
|
|
|
import com.ytpm.middle.service.AppService;
|
|
|
import com.ytpm.middle.view.AppListVO;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -24,6 +29,8 @@ public class AppServiceImpl implements AppService {
|
|
|
|
|
|
@Resource
|
|
|
private AppMapper appMapper;
|
|
|
+ @Resource
|
|
|
+ private EnterpriseMapper enterpriseMapper;
|
|
|
|
|
|
/**
|
|
|
* 应用列表
|
|
|
@@ -59,4 +66,43 @@ public class AppServiceImpl implements AppService {
|
|
|
appMapper.delApp(appId,userId);
|
|
|
return Result.resultOk(RepMessage.DELETE_SUCCESS);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 应用授权企业
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result<String> grantApp(GrantAppParam param) {
|
|
|
+ //查询企业是否存在
|
|
|
+ YtMiddleEnterprise enterprise = enterpriseMapper.getByCode(param.getCreditCode());
|
|
|
+ if(Objects.isNull(enterprise)){
|
|
|
+ return Result.resultErr(RepMessage.OBJECT_NOT_EXIST);
|
|
|
+ }
|
|
|
+ //目前先线下确认企业打款凭证
|
|
|
+ YtPlatformUserApp appInfo = appMapper.getByPrimary(param.getAppId());
|
|
|
+ if(Objects.isNull(appInfo)|| StrUtil.isBlank(appInfo.getWxAppId())){
|
|
|
+ return Result.resultErr(RepMessage.WX_APP_ID_NOT_EMPTY);
|
|
|
+ }
|
|
|
+ //将当前应用授权给企业
|
|
|
+ YtPlatformUserApp app = new YtPlatformUserApp();
|
|
|
+ app.setAppId(param.getAppId());
|
|
|
+ app.setUpdateParam(param.getUserId());
|
|
|
+ app.setUserId(enterprise.getUserId());
|
|
|
+ appMapper.updateById(app);
|
|
|
+ return Result.resultOk(RepMessage.GRANT_SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改上架应用信息
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Result<String> updateApp(AppForm form) {
|
|
|
+ YtPlatformUserApp old = appMapper.getByPrimary(form.getAppId());
|
|
|
+ if(Objects.isNull(old)){
|
|
|
+ return Result.resultErr(RepMessage.OBJECT_NOT_EXIST);
|
|
|
+ }
|
|
|
+ YtPlatformUserApp app = new YtPlatformUserApp();
|
|
|
+ BeanUtils.copyProperties(form, app);
|
|
|
+ appMapper.updateById(app);
|
|
|
+ return Result.resultOk(RepMessage.GRANT_SUCCESS);
|
|
|
+ }
|
|
|
}
|