|
|
|
@@ -1,20 +1,27 @@ |
|
|
|
package com.iformall.controller; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxWeappExtSet; |
|
|
|
import com.iformall.domain.vo.WxWeappInfo; |
|
|
|
import com.iformall.service.WxAuthorizerInfoService; |
|
|
|
import com.iformall.service.WxWeappExtSetService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
import io.swagger.annotations.ApiImplicitParams; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
|
* Stormeye Wu |
|
|
|
*/ |
|
|
|
@@ -55,4 +62,39 @@ public class WxWeappExtSetController extends BaseController { |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("batchUpdate") |
|
|
|
public ResultData batchAdd(@RequestBody WxWeappExtSet weappExtSet) { |
|
|
|
logger.debug("[" + getIpAddr() + "] WxWeappExtSetController::batchAdd"); |
|
|
|
if (null == weappExtSet) return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
if(StringUtils.isBlank(weappExtSet.getExtJson())) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
String extJson = weappExtSet.getExtJson(); |
|
|
|
JSONObject obj = JSON.parseObject(extJson); |
|
|
|
if(obj == null) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
JSONObject extObj = obj.getJSONObject("ext"); |
|
|
|
if(extObj == null) { |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); |
|
|
|
} |
|
|
|
WxWeappExtSet extSetQ = new WxWeappExtSet(); |
|
|
|
extSetQ.setType(weappExtSet.getType()); |
|
|
|
List<WxWeappExtSet> weappExtSetList = weappExtSetService.getList(extSetQ); |
|
|
|
for(WxWeappExtSet info: weappExtSetList) { |
|
|
|
obj.put("extAppid", info.getAppId()); |
|
|
|
if(extObj != null) { |
|
|
|
extObj.put("weappId", info.getAppId()); |
|
|
|
obj.put("ext", extObj); |
|
|
|
} |
|
|
|
info.setExtJson(JSON.toJSONString(obj)); |
|
|
|
try { |
|
|
|
weappExtSetService.saveOrUpdate(info); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("APPID " + info.getAppId() + ", 保存失败 " + e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
} |