| @@ -15,7 +15,7 @@ import org.slf4j.LoggerFactory; | |||||
| import org.springframework.scheduling.annotation.Async; | import org.springframework.scheduling.annotation.Async; | ||||
| import redis.clients.jedis.Jedis; | import redis.clients.jedis.Jedis; | ||||
| import redis.clients.jedis.JedisPool; | import redis.clients.jedis.JedisPool; | ||||
| import redis.clients.util.Pool; | |||||
| import redis.clients.jedis.util.Pool; | |||||
| import java.util.Date; | import java.util.Date; | ||||
| @@ -43,14 +43,14 @@ public class WeappAuditHandler extends AbstractHandler { | |||||
| WxSessionManager sessionManager) { | WxSessionManager sessionManager) { | ||||
| String appId = wxMpService.getWxMpConfigStorage().getAppId(); | String appId = wxMpService.getWxMpConfigStorage().getAppId(); | ||||
| if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.WEAPP_AUDIT_SUCCESS)) { | if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.WEAPP_AUDIT_SUCCESS)) { | ||||
| updateAuditStatus(appId, true, new Date(wxMessage.getSuccTime()*1000), null, null); | |||||
| updateAuditStatus(appId, true, new Date(wxMessage.getSuccTime()*1000), null); | |||||
| } else if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.WEAPP_AUDIT_FAIL)) { | } else if(wxMessage.getEvent().equalsIgnoreCase(WxConsts.EventType.WEAPP_AUDIT_FAIL)) { | ||||
| updateAuditStatus(appId, false, new Date(wxMessage.getFailTime()*1000), wxMessage.getReason(), wxMessage.getScreenShot()); | |||||
| updateAuditStatus(appId, false, new Date(wxMessage.getFailTime()*1000), wxMessage.getReason()); | |||||
| } | } | ||||
| return null; | return null; | ||||
| } | } | ||||
| private void updateAuditStatus(String appId, boolean success, Date auditTime, String reason, String screenShot) { | |||||
| private void updateAuditStatus(String appId, boolean success, Date auditTime, String reason) { | |||||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | ||||
| if (auditStatus != null) { | if (auditStatus != null) { | ||||
| if (success) { | if (success) { | ||||
| @@ -59,7 +59,6 @@ public class WeappAuditHandler extends AbstractHandler { | |||||
| } else { | } else { | ||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | ||||
| auditStatus.setAuditErrCode(reason); | auditStatus.setAuditErrCode(reason); | ||||
| auditStatus.setScreenShot(screenShot); | |||||
| } | } | ||||
| auditStatus.setAuditTime(auditTime); | auditStatus.setAuditTime(auditTime); | ||||
| weappAuditStatusService.updateStatus(auditStatus); | weappAuditStatusService.updateStatus(auditStatus); | ||||
| @@ -28,9 +28,18 @@ public class OpenConstant { | |||||
| public static final String ERRCODE = "errcode"; | public static final String ERRCODE = "errcode"; | ||||
| public static final Integer SUCC = 0; | public static final Integer SUCC = 0; | ||||
| /** | |||||
| * domain 操作 | |||||
| */ | |||||
| public static final String SET = "set"; // set覆盖 | |||||
| public static final String ADD = "add"; // add添加 | |||||
| public static final String DEL = "delete"; // delete删除 | |||||
| public static final String GET = "get"; // get获取 | |||||
| public static final String VERIFY_SUCC = "verify_success"; | public static final String VERIFY_SUCC = "verify_success"; | ||||
| public static final String VERIFY_FAIL = "verify_fail"; | public static final String VERIFY_FAIL = "verify_fail"; | ||||
| public static final String SET = "set"; | |||||
| public static final String URL = "url"; | public static final String URL = "url"; | ||||
| public static final String REQ_DOMAIN = "requestdomain"; | public static final String REQ_DOMAIN = "requestdomain"; | ||||
| public static final String WS_DOMAIN = "wsrequestdomain"; | public static final String WS_DOMAIN = "wsrequestdomain"; | ||||
| @@ -15,7 +15,7 @@ | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumns"> | <sql id="allColumns"> | ||||
| `id`,`tenant_id`,`app_id`,`type`,`user_version`,`version_desc`, `audit_status`,`audit_err_code`,`audit_time` | |||||
| `id`,`tenant_id`,`app_id`,`type`,`user_version`,`version_desc`, `auditid`, `audit_status`,`audit_err_code`,`audit_time` | |||||
| </sql> | </sql> | ||||
| <sql id="dynamicWhereConditions"> | <sql id="dynamicWhereConditions"> | ||||
| @@ -87,6 +87,7 @@ | |||||
| <result column="type" jdbcType="INTEGER" property="type"/> | <result column="type" jdbcType="INTEGER" property="type"/> | ||||
| <result column="user_version" jdbcType="VARCHAR" property="userVersion"/> | <result column="user_version" jdbcType="VARCHAR" property="userVersion"/> | ||||
| <result column="version_desc" jdbcType="VARCHAR" property="versionDesc"/> | <result column="version_desc" jdbcType="VARCHAR" property="versionDesc"/> | ||||
| <result column="auditid" jdbcType="INTEGER" property="auditid"/> | |||||
| <result column="audit_status" jdbcType="INTEGER" property="auditStatus"/> | <result column="audit_status" jdbcType="INTEGER" property="auditStatus"/> | ||||
| <result column="audit_err_code" jdbcType="VARCHAR" property="auditErrCode"/> | <result column="audit_err_code" jdbcType="VARCHAR" property="auditErrCode"/> | ||||
| <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime"/> | <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime"/> | ||||
| @@ -95,7 +96,7 @@ | |||||
| <sql id="allVoColumns"> | <sql id="allVoColumns"> | ||||
| c.`id`,c.`tenant_id` as `tenant_id`,c.`app_id`,c.`type` as `type`,c.`user_version` as `user_version`,`version_desc`, | c.`id`,c.`tenant_id` as `tenant_id`,c.`app_id`,c.`type` as `type`,c.`user_version` as `user_version`,`version_desc`, | ||||
| c.`audit_status`,c.`audit_err_code`,c.`audit_time` as `audit_time`, | |||||
| c.`auditid`, c.`audit_status`,c.`audit_err_code`,c.`audit_time` as `audit_time`, | |||||
| a.`name` | a.`name` | ||||
| </sql> | </sql> | ||||
| @@ -116,6 +117,9 @@ | |||||
| <if test=" null != userVersion "> | <if test=" null != userVersion "> | ||||
| and c.`user_version` = #{userVersion} | and c.`user_version` = #{userVersion} | ||||
| </if> | </if> | ||||
| <if test=" null != auditid "> | |||||
| and `auditid` = #{auditid} | |||||
| </if> | |||||
| <if test=" null != auditStatus "> | <if test=" null != auditStatus "> | ||||
| and c.`audit_status` = #{auditStatus} | and c.`audit_status` = #{auditStatus} | ||||
| </if> | </if> | ||||
| @@ -18,6 +18,8 @@ import me.chanjar.weixin.common.error.WxErrorException; | |||||
| import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage; | import me.chanjar.weixin.mp.bean.kefu.WxMpKefuMessage; | ||||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | import me.chanjar.weixin.mp.bean.message.WxMpXmlMessage; | ||||
| import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; | ||||
| import me.chanjar.weixin.open.bean.WxOpenCreateResult; | |||||
| import me.chanjar.weixin.open.bean.WxOpenGetResult; | |||||
| import me.chanjar.weixin.open.bean.message.WxOpenXmlMessage; | import me.chanjar.weixin.open.bean.message.WxOpenXmlMessage; | ||||
| import me.chanjar.weixin.open.bean.result.*; | import me.chanjar.weixin.open.bean.result.*; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -35,6 +37,7 @@ import java.io.InputStream; | |||||
| import java.io.PrintWriter; | import java.io.PrintWriter; | ||||
| import java.nio.charset.Charset; | import java.nio.charset.Charset; | ||||
| import java.util.Date; | import java.util.Date; | ||||
| import java.util.Map; | |||||
| @Controller | @Controller | ||||
| @RequestMapping("/wxOpen") | @RequestMapping("/wxOpen") | ||||
| @@ -282,18 +285,17 @@ public class WechatCalllbackController extends BaseController { | |||||
| public ResultData createOpenPlatform(@RequestParam(value = "appId") String appId) { | public ResultData createOpenPlatform(@RequestParam(value = "appId") String appId) { | ||||
| Gson gson = new GsonBuilder().create(); | Gson gson = new GsonBuilder().create(); | ||||
| try { | try { | ||||
| String responseStr = openService.getWxOpenComponentService().getWxMpServiceByAppid(appId).createOpenPlatform(appId); | |||||
| logger.info(responseStr); | |||||
| WxOpenPlatformResult openPlatformResult = gson.fromJson(responseStr, WxOpenPlatformResult.class); | |||||
| if (openPlatformResult.isSuccess()) { | |||||
| WxOpenCreateResult ret = openService.getWxOpenComponentService().createOpenAccount(appId); | |||||
| logger.info(ret.toString()); | |||||
| if (ret.isSuccess()) { | |||||
| WxAuthorizerInfo authorizerInfo = authorizerInfoService.getByAppId(appId); | WxAuthorizerInfo authorizerInfo = authorizerInfoService.getByAppId(appId); | ||||
| if (authorizerInfo != null) { | if (authorizerInfo != null) { | ||||
| authorizerInfo.setId(authorizerInfo.getId()); | authorizerInfo.setId(authorizerInfo.getId()); | ||||
| authorizerInfo.setOpenAppid(openPlatformResult.getOpenAppid()); | |||||
| authorizerInfo.setOpenAppid(ret.getOpenAppid()); | |||||
| authorizerInfoService.updateOpenAppid(authorizerInfo); | authorizerInfoService.updateOpenAppid(authorizerInfo); | ||||
| } | } | ||||
| } | } | ||||
| return new ResultData(responseStr); | |||||
| return new ResultData(ret.toString()); | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(Result.ERROR, e.getMessage()); | return new ResultData(Result.ERROR, e.getMessage()); | ||||
| @@ -305,10 +307,8 @@ public class WechatCalllbackController extends BaseController { | |||||
| public ResultData bindOpenPlatform(@RequestParam(value = "appId") String appId, @RequestParam(value = "openAppId") String openAppId) { | public ResultData bindOpenPlatform(@RequestParam(value = "appId") String appId, @RequestParam(value = "openAppId") String openAppId) { | ||||
| Gson gson = new GsonBuilder().create(); | Gson gson = new GsonBuilder().create(); | ||||
| try { | try { | ||||
| String responseStr = openService.getWxOpenComponentService().getWxMpServiceByAppid(appId).bindOpenPlatform(appId, openAppId); | |||||
| logger.info(responseStr); | |||||
| WxOpenResult openResult = gson.fromJson(responseStr, WxOpenResult.class); | |||||
| if (openResult.isSuccess()) { | |||||
| Boolean ret = openService.getWxOpenComponentService().bindOpenAccount(appId, openAppId); | |||||
| if (ret) { | |||||
| WxAuthorizerInfo authorizerInfo = authorizerInfoService.getByAppId(appId); | WxAuthorizerInfo authorizerInfo = authorizerInfoService.getByAppId(appId); | ||||
| if (authorizerInfo != null) { | if (authorizerInfo != null) { | ||||
| authorizerInfo.setId(authorizerInfo.getId()); | authorizerInfo.setId(authorizerInfo.getId()); | ||||
| @@ -317,7 +317,7 @@ public class WechatCalllbackController extends BaseController { | |||||
| } | } | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| return new ResultData(Result.ERROR, responseStr); | |||||
| return new ResultData(Result.ERROR, ret.toString()); | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(Result.ERROR, e.getMessage()); | return new ResultData(Result.ERROR, e.getMessage()); | ||||
| @@ -329,16 +329,14 @@ public class WechatCalllbackController extends BaseController { | |||||
| public ResultData unbindOpenPlatform(@RequestParam(value = "appId") String appId, @RequestParam(value = "openAppId") String openAppId) { | public ResultData unbindOpenPlatform(@RequestParam(value = "appId") String appId, @RequestParam(value = "openAppId") String openAppId) { | ||||
| Gson gson = new GsonBuilder().create(); | Gson gson = new GsonBuilder().create(); | ||||
| try { | try { | ||||
| String responseStr = openService.getWxOpenComponentService().getWxMpServiceByAppid(appId).unbindOpenPlatform(appId, openAppId); | |||||
| logger.info(responseStr); | |||||
| WxOpenResult openResult = gson.fromJson(responseStr, WxOpenResult.class); | |||||
| if (openResult.isSuccess()) { | |||||
| Boolean ret = openService.getWxOpenComponentService().unbindOpenAccount(appId, openAppId); | |||||
| if (ret) { | |||||
| WxAuthorizerInfo authorizerInfo = new WxAuthorizerInfo(); | WxAuthorizerInfo authorizerInfo = new WxAuthorizerInfo(); | ||||
| authorizerInfo.setAuthorizerAppid(appId); | authorizerInfo.setAuthorizerAppid(appId); | ||||
| authorizerInfoService.removeOpenAppid(authorizerInfo); | authorizerInfoService.removeOpenAppid(authorizerInfo); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| return new ResultData(Result.ERROR, responseStr); | |||||
| return new ResultData(Result.ERROR, ret.toString()); | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(Result.ERROR, e.getMessage()); | return new ResultData(Result.ERROR, e.getMessage()); | ||||
| @@ -350,21 +348,20 @@ public class WechatCalllbackController extends BaseController { | |||||
| public ResultData getOpenPlatform(@RequestParam(value = "appId") String appId) { | public ResultData getOpenPlatform(@RequestParam(value = "appId") String appId) { | ||||
| Gson gson = new GsonBuilder().create(); | Gson gson = new GsonBuilder().create(); | ||||
| try { | try { | ||||
| String responseStr = openService.getWxOpenComponentService().getWxMpServiceByAppid(appId).getBindOpenPlatform(appId); | |||||
| logger.info(responseStr); | |||||
| WxOpenPlatformResult openPlatformResult = gson.fromJson(responseStr, WxOpenPlatformResult.class); | |||||
| if (openPlatformResult.isSuccess()) { | |||||
| WxOpenGetResult ret = openService.getWxOpenComponentService().getOpenAccount(appId); | |||||
| logger.info(ret.toString()); | |||||
| if (ret.isSuccess()) { | |||||
| WxAuthorizerInfo authorizerInfo = authorizerInfoService.getByAppId(appId); | WxAuthorizerInfo authorizerInfo = authorizerInfoService.getByAppId(appId); | ||||
| if (authorizerInfo != null) { | if (authorizerInfo != null) { | ||||
| if(StringUtils.isBlank(authorizerInfo.getOpenAppid()) && StringUtils.isNotBlank(openPlatformResult.getOpenAppid())) { | |||||
| if(StringUtils.isBlank(authorizerInfo.getOpenAppid()) && StringUtils.isNotBlank(ret.getOpenAppid())) { | |||||
| authorizerInfo.setId(authorizerInfo.getId()); | authorizerInfo.setId(authorizerInfo.getId()); | ||||
| authorizerInfo.setOpenAppid(openPlatformResult.getOpenAppid()); | |||||
| authorizerInfo.setOpenAppid(ret.getOpenAppid()); | |||||
| authorizerInfoService.updateOpenAppid(authorizerInfo); | authorizerInfoService.updateOpenAppid(authorizerInfo); | ||||
| } | } | ||||
| } | } | ||||
| return new ResultData(openPlatformResult.getOpenAppid()); | |||||
| return new ResultData(ret.getOpenAppid()); | |||||
| } | } | ||||
| return new ResultData(Result.ERROR, responseStr); | |||||
| return new ResultData(Result.ERROR, ret.toString()); | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(Result.ERROR, e.getMessage()); | return new ResultData(Result.ERROR, e.getMessage()); | ||||
| @@ -387,17 +384,14 @@ public class WechatCalllbackController extends BaseController { | |||||
| @ApiOperation("拉取当前所有已授权的帐号基本信息") | @ApiOperation("拉取当前所有已授权的帐号基本信息") | ||||
| public ResultData getAuthorizerList() { | public ResultData getAuthorizerList() { | ||||
| try { | try { | ||||
| String accessToken = openService.getWxOpenComponentService().getComponentAccessToken(true); | |||||
| String ret = openService.getWxOpenComponentService().getApiGetAuthorizerList(accessToken, 0, 100); | |||||
| logger.info("getAuthorizerList: " + ret); | |||||
| JSONObject retObj = JSON.parseObject(ret); | |||||
| if(retObj.getInteger("total_count") > 0) { | |||||
| JSONArray dataList = retObj.getJSONArray("list"); | |||||
| for(int i= 0;i<dataList.size();i++) { | |||||
| JSONObject obj = dataList.getJSONObject(i); | |||||
| String appId = obj.getString("authorizer_appid"); | |||||
| String refreshToken = obj.getString("refresh_token"); | |||||
| Date authDate = new Date(obj.getLong("auth_time")*1000); | |||||
| WxOpenAuthorizerListResult authorizerListResult = openService.getWxOpenComponentService().getAuthorizerList(0, 100); | |||||
| logger.info("getAuthorizerList: " + authorizerListResult); | |||||
| if(authorizerListResult.getTotalCount() > 0) { | |||||
| for (Map<String, String> data : authorizerListResult.getList()) { | |||||
| String appId = data.get("authorizer_appid"); | |||||
| String refreshToken = data.get("refresh_token"); | |||||
| Long authTime = Long.valueOf(data.get("auth_time")); | |||||
| Date authDate = new Date(authTime*1000); | |||||
| if(StringUtils.isBlank(refreshToken)) { | if(StringUtils.isBlank(refreshToken)) { | ||||
| continue; | continue; | ||||
| @@ -412,7 +406,7 @@ public class WechatCalllbackController extends BaseController { | |||||
| openService.getWxOpenComponentService().getWxOpenConfigStorage().setAuthorizerRefreshToken(appId, refreshToken); | openService.getWxOpenComponentService().getWxOpenConfigStorage().setAuthorizerRefreshToken(appId, refreshToken); | ||||
| } | } | ||||
| } | } | ||||
| return new ResultData(ret); | |||||
| return new ResultData(authorizerListResult.toString()); | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(Result.ERROR, e.getMessage()); | return new ResultData(Result.ERROR, e.getMessage()); | ||||
| @@ -6,6 +6,7 @@ import com.google.gson.reflect.TypeToken; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.Result; | import com.iformall.common.Result; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.dto.WxWeappCodeAuditDto; | import com.iformall.domain.dto.WxWeappCodeAuditDto; | ||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.vo.WxWeappCodeStatusVo; | import com.iformall.domain.vo.WxWeappCodeStatusVo; | ||||
| @@ -45,7 +46,7 @@ import java.util.Map; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/weappCode") | @RequestMapping("/weappCode") | ||||
| @Api(description = "微信第三方开发平台-小程序-代码管理") | @Api(description = "微信第三方开发平台-小程序-代码管理") | ||||
| public class WechatWeappCodeController { | |||||
| public class WechatWeappCodeController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(getClass()); | private final Logger logger = LoggerFactory.getLogger(getClass()); | ||||
| @Autowired | @Autowired | ||||
| private FmOpenService openService; | private FmOpenService openService; | ||||
| @@ -254,6 +255,7 @@ public class WechatWeappCodeController { | |||||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(appId); | ||||
| boolean submitStatus = false; | boolean submitStatus = false; | ||||
| String codeErrCode = ""; | String codeErrCode = ""; | ||||
| Long auditId = null; | |||||
| try { | try { | ||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | ||||
| WxOpenMaSubmitAuditResult openRet = openMaService.submitAudit(subMessage); | WxOpenMaSubmitAuditResult openRet = openMaService.submitAudit(subMessage); | ||||
| @@ -261,6 +263,7 @@ public class WechatWeappCodeController { | |||||
| if(openRet.isSuccess()) { | if(openRet.isSuccess()) { | ||||
| submitStatus = true; | submitStatus = true; | ||||
| codeErrCode = gson.toJson(openRet); | codeErrCode = gson.toJson(openRet); | ||||
| auditId = openRet.getAuditId(); | |||||
| } else { | } else { | ||||
| submitStatus = false; | submitStatus = false; | ||||
| codeErrCode = gson.toJson(openRet); | codeErrCode = gson.toJson(openRet); | ||||
| @@ -317,6 +320,23 @@ public class WechatWeappCodeController { | |||||
| return new ResultData(ErrorCode.WEAPP_CODE_COMMIT_ERR); | return new ResultData(ErrorCode.WEAPP_CODE_COMMIT_ERR); | ||||
| } | } | ||||
| @ApiOperation("查询服务商的当月提审限额(quota)和加急次数") | |||||
| @GetMapping("/queryQuota") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true)}) | |||||
| public ResultData queryQuota(String appId) { | |||||
| logger.debug("[" + getIpAddr() + "] WechatWeappCodeController::queryQuota"); | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| WxOpenMaQueryQuotaResult openRet = openMaService.queryQuota(); | |||||
| logger.info(openRet.toString()); | |||||
| return new ResultData(openRet.toString()); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(e.getMessage()); | |||||
| } | |||||
| } | |||||
| @ApiOperation("将第三方提交的代码包提交审核") | @ApiOperation("将第三方提交的代码包提交审核") | ||||
| @PostMapping("/submitAuditWithFeedBack") | @PostMapping("/submitAuditWithFeedBack") | ||||
| public ResultData submitAudit(@RequestBody WxWeappCodeAuditDto codeAuditDto) { | public ResultData submitAudit(@RequestBody WxWeappCodeAuditDto codeAuditDto) { | ||||
| @@ -348,6 +368,7 @@ public class WechatWeappCodeController { | |||||
| WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(codeAuditDto.getAppId()); | WxWeappAuditStatus auditStatus = weappAuditStatusService.getByAppId(codeAuditDto.getAppId()); | ||||
| boolean submitStatus = false; | boolean submitStatus = false; | ||||
| String codeErrCode = ""; | String codeErrCode = ""; | ||||
| Long auditId = null; | |||||
| try { | try { | ||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(codeAuditDto.getAppId()); | WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(codeAuditDto.getAppId()); | ||||
| WxOpenMaSubmitAuditResult openRet = openMaService.submitAudit(subMessage); | WxOpenMaSubmitAuditResult openRet = openMaService.submitAudit(subMessage); | ||||
| @@ -355,6 +376,7 @@ public class WechatWeappCodeController { | |||||
| if(openRet.isSuccess()) { | if(openRet.isSuccess()) { | ||||
| submitStatus = true; | submitStatus = true; | ||||
| codeErrCode = gson.toJson(openRet); | codeErrCode = gson.toJson(openRet); | ||||
| auditId = openRet.getAuditId(); | |||||
| } else { | } else { | ||||
| submitStatus = false; | submitStatus = false; | ||||
| codeErrCode = gson.toJson(openRet); | codeErrCode = gson.toJson(openRet); | ||||
| @@ -373,6 +395,7 @@ public class WechatWeappCodeController { | |||||
| auditStatus.setType(codeStatus.getType()); | auditStatus.setType(codeStatus.getType()); | ||||
| auditStatus.setUserVersion(codeStatus.getUserVersion()); | auditStatus.setUserVersion(codeStatus.getUserVersion()); | ||||
| auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | ||||
| auditStatus.setAuditid(auditId); | |||||
| if(submitStatus) { | if(submitStatus) { | ||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | ||||
| } else { | } else { | ||||
| @@ -395,6 +418,7 @@ public class WechatWeappCodeController { | |||||
| } | } | ||||
| auditStatus.setUserVersion(codeStatus.getUserVersion()); | auditStatus.setUserVersion(codeStatus.getUserVersion()); | ||||
| auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | ||||
| auditStatus.setAuditid(auditId); | |||||
| auditStatus.setAuditTime(new Date()); | auditStatus.setAuditTime(new Date()); | ||||
| weappAuditStatusService.updateStatus(auditStatus); | weappAuditStatusService.updateStatus(auditStatus); | ||||
| } | } | ||||
| @@ -411,6 +435,23 @@ public class WechatWeappCodeController { | |||||
| return new ResultData(ErrorCode.WEAPP_CODE_COMMIT_ERR); | return new ResultData(ErrorCode.WEAPP_CODE_COMMIT_ERR); | ||||
| } | } | ||||
| @ApiOperation("加速某个指定版本的审核状态") | |||||
| @GetMapping("/speedAudit") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "appId", value = "appId", dataType = "String", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "auditid", value = "auditid", dataType = "Long", paramType = "query", required = true)}) | |||||
| public ResultData speedAudit(String appId, Long auditid) { | |||||
| logger.debug("[" + getIpAddr() + "] WechatWeappCodeController::speedAudit"); | |||||
| try { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| Boolean ret = openMaService.speedAudit(Long.valueOf(auditid)); | |||||
| return new ResultData(ret.toString()); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(e.getMessage()); | |||||
| } | |||||
| } | |||||
| @ApiOperation("查询某个指定版本的审核状态") | @ApiOperation("查询某个指定版本的审核状态") | ||||
| @PostMapping("/getAuditstatus") | @PostMapping("/getAuditstatus") | ||||
| public ResultData getAuditstatus(String appId, String auditidStr) { | public ResultData getAuditstatus(String appId, String auditidStr) { | ||||
| @@ -181,6 +181,60 @@ public class WxWeappInfoController extends BaseController { | |||||
| return new ResultData(); | return new ResultData(); | ||||
| } | } | ||||
| @ApiOperation(value = "APP清除域名", notes = "{\"weappId\":\"weappId\",\"type\":\"String\"}") | |||||
| @PostMapping("cleanDomain") | |||||
| public ResultData cleanDomain(@RequestBody Map<String, String> params) { | |||||
| logger.debug("[" + getIpAddr() + "] WxWeappInfoController::cleanDomain"); | |||||
| String appId = params.get(OpenConstant.WE_APPID); | |||||
| String typeStr = params.get(OpenConstant.TYPE); | |||||
| if(StringUtils.isBlank(typeStr)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "type参数不能为空"); | |||||
| } | |||||
| if(StringUtils.isBlank(appId)) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(), "weappId参数不能为空"); | |||||
| } | |||||
| Integer type = 0; | |||||
| try { | |||||
| type = Integer.parseInt(typeStr); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| } | |||||
| // 检查基础配置参数 | |||||
| WxWeappBasicSet weappBasicSetQ = new WxWeappBasicSet(); | |||||
| weappBasicSetQ.setType(type); | |||||
| weappBasicSetQ.setDeploy(getFmDeploy); | |||||
| WxWeappBasicSet weappBasicSet = weappBasicSetService.getByTypeAndDeploy(weappBasicSetQ); | |||||
| if(weappBasicSet == null) { | |||||
| logger.error("未找到相关的基础设置参数"); | |||||
| return new ResultData(ErrorCode.WEAPP_BASIC_SET_ERR); | |||||
| } | |||||
| JSONObject domainObj = JSON.parseObject(weappBasicSet.getDomainUrl()); | |||||
| if(domainObj == null) { | |||||
| logger.error("未找到相关的基础设置参数"); | |||||
| return new ResultData(ErrorCode.WEAPP_BASIC_SET_DOMAIN_ERR); | |||||
| } | |||||
| // 检查appId是否已授权 | |||||
| WxAuthorizerInfo authorizerInfo = authorizerInfoService.getByAppId(appId); | |||||
| if(authorizerInfo == null) { | |||||
| return new ResultData(ErrorCode.WEAPP_APPID_NOT_AUTH); | |||||
| } | |||||
| if(!authorizerInfo.getAuthorizationStatus().equals(EnumWxAuthorizationStatus.AUTHORIZED.getCode())) { | |||||
| return new ResultData(ErrorCode.WEAPP_APPID_NOT_AUTH); | |||||
| } | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | |||||
| try { | |||||
| modifyDomainUrl(OpenConstant.DEL, domainObj, authorizerInfo, openMaService); | |||||
| } catch (WxErrorException e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(Result.ERROR, e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| private ResultData setBasicForAppId(String appId, WxWeappBasicSet weappBasicSet, JSONObject domainObj, JSONObject templeObj) { | private ResultData setBasicForAppId(String appId, WxWeappBasicSet weappBasicSet, JSONObject domainObj, JSONObject templeObj) { | ||||
| WxAuthorizerInfo authorizerInfo = authorizerInfoService.getByAppId(appId); | WxAuthorizerInfo authorizerInfo = authorizerInfoService.getByAppId(appId); | ||||
| if(authorizerInfo == null) { | if(authorizerInfo == null) { | ||||
| @@ -189,8 +243,7 @@ public class WxWeappInfoController extends BaseController { | |||||
| WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | WxOpenMaService openMaService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); | ||||
| try { | try { | ||||
| setBasicVersion(weappBasicSet, authorizerInfo, openMaService); | setBasicVersion(weappBasicSet, authorizerInfo, openMaService); | ||||
| setDomainUrl(domainObj, authorizerInfo, openMaService); | |||||
| modifyDomainUrl(OpenConstant.SET, domainObj, authorizerInfo, openMaService); | |||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| return new ResultData(Result.ERROR, e.getMessage()); | return new ResultData(Result.ERROR, e.getMessage()); | ||||
| @@ -282,9 +335,8 @@ public class WxWeappInfoController extends BaseController { | |||||
| logger.info("setBasicTemplateMsgPressSuccess end."); | logger.info("setBasicTemplateMsgPressSuccess end."); | ||||
| } | } | ||||
| private void setDomainUrl(JSONObject domainObj, WxAuthorizerInfo authorizerInfo, WxOpenMaService openMaService) throws WxErrorException { | |||||
| private void modifyDomainUrl(String action, JSONObject domainObj, WxAuthorizerInfo authorizerInfo, WxOpenMaService openMaService) throws WxErrorException { | |||||
| // 服务器域名 | // 服务器域名 | ||||
| String action = OpenConstant.SET; | |||||
| JSONObject urlObj = domainObj.getJSONObject(OpenConstant.URL); | JSONObject urlObj = domainObj.getJSONObject(OpenConstant.URL); | ||||
| List<String> requestDomain = getUrlList(urlObj.getJSONArray(OpenConstant.REQ_DOMAIN)); | List<String> requestDomain = getUrlList(urlObj.getJSONArray(OpenConstant.REQ_DOMAIN)); | ||||
| List<String> wsrequestDomain = getUrlList(urlObj.getJSONArray(OpenConstant.WS_DOMAIN)); | List<String> wsrequestDomain = getUrlList(urlObj.getJSONArray(OpenConstant.WS_DOMAIN)); | ||||
| @@ -644,9 +696,9 @@ public class WxWeappInfoController extends BaseController { | |||||
| auditStatus.setType(codeStatus.getType()); | auditStatus.setType(codeStatus.getType()); | ||||
| auditStatus.setUserVersion(codeStatus.getUserVersion()); | auditStatus.setUserVersion(codeStatus.getUserVersion()); | ||||
| auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | ||||
| auditStatus.setAuditid(auditid); | |||||
| if(submitStatus) { | if(submitStatus) { | ||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | ||||
| auditStatus.setAuditid(auditid); | |||||
| } else { | } else { | ||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | ||||
| } | } | ||||
| @@ -654,6 +706,7 @@ public class WxWeappInfoController extends BaseController { | |||||
| auditStatus.setAuditTime(new Date()); | auditStatus.setAuditTime(new Date()); | ||||
| weappAuditStatusService.saveStatus(auditStatus); | weappAuditStatusService.saveStatus(auditStatus); | ||||
| } else { | } else { | ||||
| auditStatus.setAuditid(auditid); | |||||
| if(!submitStatus) { | if(!submitStatus) { | ||||
| if(!auditStatus.getUserVersion().equals(codeStatus.getUserVersion()) | if(!auditStatus.getUserVersion().equals(codeStatus.getUserVersion()) | ||||
| && auditStatus.getAuditStatus().equals(EnumWeappAuditStatus.AUDITING.getCode())) { | && auditStatus.getAuditStatus().equals(EnumWeappAuditStatus.AUDITING.getCode())) { | ||||
| @@ -663,7 +716,6 @@ public class WxWeappInfoController extends BaseController { | |||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | auditStatus.setAuditStatus(EnumWeappAuditStatus.FAIL.getCode()); | ||||
| } else { | } else { | ||||
| auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | auditStatus.setAuditStatus(EnumWeappAuditStatus.AUDITING.getCode()); | ||||
| auditStatus.setAuditid(auditid); | |||||
| } | } | ||||
| auditStatus.setUserVersion(codeStatus.getUserVersion()); | auditStatus.setUserVersion(codeStatus.getUserVersion()); | ||||
| auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | auditStatus.setVersionDesc(codeStatus.getVersionDesc()); | ||||
| @@ -72,7 +72,7 @@ public class WxCardController extends BaseController { | |||||
| if (type.equalsIgnoreCase("groupon")) { | if (type.equalsIgnoreCase("groupon")) { | ||||
| //团购券 | //团购券 | ||||
| WxMpCardCreateMessage grouponMessage = new WxMpCardCreateMessage(); | |||||
| WxMpCardCreateRequest grouponMessage = new WxMpCardCreateRequest(); | |||||
| GrouponCardCreateRequest grouponCardCreateRequest = new GrouponCardCreateRequest(); | GrouponCardCreateRequest grouponCardCreateRequest = new GrouponCardCreateRequest(); | ||||
| GrouponCard grouponCard = new GrouponCard(); | GrouponCard grouponCard = new GrouponCard(); | ||||
| grouponCard.setBaseInfo(base); | grouponCard.setBaseInfo(base); | ||||
| @@ -90,7 +90,7 @@ public class WxCardController extends BaseController { | |||||
| } | } | ||||
| } else if (type.equalsIgnoreCase("cash")) { | } else if (type.equalsIgnoreCase("cash")) { | ||||
| //现金券 | //现金券 | ||||
| WxMpCardCreateMessage cashMessage = new WxMpCardCreateMessage(); | |||||
| WxMpCardCreateRequest cashMessage = new WxMpCardCreateRequest(); | |||||
| CashCardCreateRequest cashCardCreateRequest = new CashCardCreateRequest(); | CashCardCreateRequest cashCardCreateRequest = new CashCardCreateRequest(); | ||||
| CashCard cashCard = new CashCard(); | CashCard cashCard = new CashCard(); | ||||
| cashCard.setBaseInfo(base); | cashCard.setBaseInfo(base); | ||||
| @@ -107,7 +107,7 @@ public class WxCardController extends BaseController { | |||||
| } | } | ||||
| } else if (type.equalsIgnoreCase("discount")) { | } else if (type.equalsIgnoreCase("discount")) { | ||||
| //折扣券 | //折扣券 | ||||
| WxMpCardCreateMessage discountMessage = new WxMpCardCreateMessage(); | |||||
| WxMpCardCreateRequest discountMessage = new WxMpCardCreateRequest(); | |||||
| DiscountCardCreateRequest discountCardCreateRequest = new DiscountCardCreateRequest(); | DiscountCardCreateRequest discountCardCreateRequest = new DiscountCardCreateRequest(); | ||||
| DiscountCard discountCard = new DiscountCard(); | DiscountCard discountCard = new DiscountCard(); | ||||
| discountCard.setBaseInfo(base); | discountCard.setBaseInfo(base); | ||||
| @@ -124,7 +124,7 @@ public class WxCardController extends BaseController { | |||||
| } | } | ||||
| } else if (type.equalsIgnoreCase("gift")) { | } else if (type.equalsIgnoreCase("gift")) { | ||||
| //兑换券 | //兑换券 | ||||
| WxMpCardCreateMessage giftMessage = new WxMpCardCreateMessage(); | |||||
| WxMpCardCreateRequest giftMessage = new WxMpCardCreateRequest(); | |||||
| GiftCardCreateRequest giftCardCreateRequest = new GiftCardCreateRequest(); | GiftCardCreateRequest giftCardCreateRequest = new GiftCardCreateRequest(); | ||||
| GiftCard giftCard = new GiftCard(); | GiftCard giftCard = new GiftCard(); | ||||
| giftCard.setBaseInfo(base); | giftCard.setBaseInfo(base); | ||||
| @@ -140,9 +140,9 @@ public class WxCardController extends BaseController { | |||||
| } | } | ||||
| } else if (type.equalsIgnoreCase("generalcard")) { | } else if (type.equalsIgnoreCase("generalcard")) { | ||||
| //普通兑换券 | //普通兑换券 | ||||
| WxMpCardCreateMessage generalMessage = new WxMpCardCreateMessage(); | |||||
| GeneralCardCreateRequest generalCardCreateRequest = new GeneralCardCreateRequest(); | |||||
| GeneralCard generalCard = new GeneralCard(); | |||||
| WxMpCardCreateRequest generalMessage = new WxMpCardCreateRequest(); | |||||
| GeneralCouponCreateRequest generalCardCreateRequest = new GeneralCouponCreateRequest(); | |||||
| GeneralCoupon generalCard = new GeneralCoupon(); | |||||
| generalCard.setBaseInfo(base); | generalCard.setBaseInfo(base); | ||||
| generalCard.setDefaultDetail("音乐木盒"); | generalCard.setDefaultDetail("音乐木盒"); | ||||
| @@ -276,7 +276,7 @@ public class WxCardController extends BaseController { | |||||
| logger.debug("[" + getIpAddr() + "] WxCardController::getCardList"); | logger.debug("[" + getIpAddr() + "] WxCardController::getCardList"); | ||||
| try { | try { | ||||
| WxMpService mpService = openService.getWxOpenComponentService().getWxMpServiceByAppid(appId); | WxMpService mpService = openService.getWxOpenComponentService().getWxMpServiceByAppid(appId); | ||||
| WxMpCardUserGetCardListResult result = mpService.getCardService().getUserCardList(openId, null); | |||||
| WxUserCardListResult result = mpService.getCardService().getUserCardList(openId, null); | |||||
| logger.info(result.toString()); | logger.info(result.toString()); | ||||
| } catch (WxErrorException e) { | } catch (WxErrorException e) { | ||||
| logger.error(e.getMessage()); | logger.error(e.getMessage()); | ||||
| @@ -1,16 +1,16 @@ | |||||
| package com.iformall.mp.utils; | package com.iformall.mp.utils; | ||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import me.chanjar.weixin.mp.api.WxMpInMemoryConfigStorage; | |||||
| import me.chanjar.weixin.mp.api.WxMpService; | import me.chanjar.weixin.mp.api.WxMpService; | ||||
| import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl; | ||||
| import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl; | |||||
| /** | /** | ||||
| * @author Stormeye | * @author Stormeye | ||||
| */ | */ | ||||
| public class MpUtil { | public class MpUtil { | ||||
| static public WxMpService getMpService(WxAppinfo appinfo) { | static public WxMpService getMpService(WxAppinfo appinfo) { | ||||
| WxMpInMemoryConfigStorage configStorage = new WxMpInMemoryConfigStorage(); | |||||
| WxMpDefaultConfigImpl configStorage = new WxMpDefaultConfigImpl(); | |||||
| configStorage.setAppId(appinfo.getAppId()); | configStorage.setAppId(appinfo.getAppId()); | ||||
| configStorage.setSecret(appinfo.getSecret()); | configStorage.setSecret(appinfo.getSecret()); | ||||
| configStorage.setToken(appinfo.getToken()); | configStorage.setToken(appinfo.getToken()); | ||||
| @@ -18,16 +18,16 @@ | |||||
| <parent> | <parent> | ||||
| <groupId>org.springframework.boot</groupId> | <groupId>org.springframework.boot</groupId> | ||||
| <artifactId>spring-boot-starter-parent</artifactId> | <artifactId>spring-boot-starter-parent</artifactId> | ||||
| <version>2.1.8.RELEASE</version> | |||||
| <version>2.2.5.RELEASE</version> | |||||
| <relativePath/> | <relativePath/> | ||||
| </parent> | </parent> | ||||
| <properties> | <properties> | ||||
| <weixin-java-common.version>3.4.0.A</weixin-java-common.version> | |||||
| <weixin-java-mp.version>3.4.0.A</weixin-java-mp.version> | |||||
| <weixin-java-miniapp.version>3.4.0.A</weixin-java-miniapp.version> | |||||
| <weixin-java-pay.version>3.4.0.A</weixin-java-pay.version> | |||||
| <weixin-java-open.version>3.4.0.A</weixin-java-open.version> | |||||
| <weixin-java-common.version>3.7.0.A</weixin-java-common.version> | |||||
| <weixin-java-mp.version>3.7.0.A</weixin-java-mp.version> | |||||
| <weixin-java-miniapp.version>3.7.0.A</weixin-java-miniapp.version> | |||||
| <weixin-java-pay.version>3.7.0.A</weixin-java-pay.version> | |||||
| <weixin-java-open.version>3.7.0.A</weixin-java-open.version> | |||||
| <quartz.version>2.3.0</quartz.version> | <quartz.version>2.3.0</quartz.version> | ||||
| </properties> | </properties> | ||||
| @@ -101,13 +101,7 @@ | |||||
| <dependency> | <dependency> | ||||
| <groupId>com.baomidou</groupId> | <groupId>com.baomidou</groupId> | ||||
| <artifactId>mybatis-plus-boot-starter</artifactId> | <artifactId>mybatis-plus-boot-starter</artifactId> | ||||
| <version>3.1.0</version> | |||||
| </dependency> | |||||
| <dependency> | |||||
| <groupId>org.mybatis.spring.boot</groupId> | |||||
| <artifactId>mybatis-spring-boot-starter</artifactId> | |||||
| <version>2.1.0</version> | |||||
| <version>3.3.1</version> | |||||
| </dependency> | </dependency> | ||||
| <dependency> | <dependency> | ||||