|
|
|
@@ -12,16 +12,11 @@ import com.google.gson.reflect.TypeToken; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.common.Result; |
|
|
|
import com.iformall.common.ResultData; |
|
|
|
import com.iformall.domain.po.WxWeappBasicSet; |
|
|
|
import com.iformall.domain.po.WxWeappCodeStatus; |
|
|
|
import com.iformall.domain.po.WxWeappExtSet; |
|
|
|
import com.iformall.domain.po.WxWeappInfo; |
|
|
|
import com.iformall.domain.po.*; |
|
|
|
import com.iformall.enums.EnumAppType; |
|
|
|
import com.iformall.enums.EnumAuditStatus; |
|
|
|
import com.iformall.service.WxWeappBasicSetService; |
|
|
|
import com.iformall.service.WxWeappCodeStatusService; |
|
|
|
import com.iformall.service.WxWeappExtSetService; |
|
|
|
import com.iformall.service.WxWeappInfoService; |
|
|
|
import com.iformall.enums.EnumTemplateType; |
|
|
|
import com.iformall.service.*; |
|
|
|
import com.iformall.service.wechat.WxOpenService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiImplicitParam; |
|
|
|
@@ -71,6 +66,12 @@ public class WxWeappInfoController extends BaseController { |
|
|
|
@Autowired |
|
|
|
private WxOpenService openService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxAppinfoService appinfoService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private WxTemplateMsgService templateMsgService; |
|
|
|
|
|
|
|
|
|
|
|
@ApiOperation("分页列表接口") |
|
|
|
@GetMapping("list") |
|
|
|
@@ -158,6 +159,7 @@ public class WxWeappInfoController extends BaseController { |
|
|
|
|
|
|
|
// 设置微信模板 |
|
|
|
if(weappBasicSet.getType().equals(EnumAppType.C.getCode())) { |
|
|
|
WxAppinfo appinfo = appinfoService.getByAppId(appId); |
|
|
|
try { |
|
|
|
WxMaService maService = openService.getWxOpenComponentService().getWxMaServiceByAppid(appId); |
|
|
|
// 核销成功消息 |
|
|
|
@@ -165,13 +167,39 @@ public class WxWeappInfoController extends BaseController { |
|
|
|
JSONArray keyidlist = verify_success.getJSONArray("keyword_id_list"); |
|
|
|
List<Integer> keyArr = getIdList(keyidlist); |
|
|
|
WxMaTemplateAddResult ret = maService.getTemplateService().addTemplate(verify_success.getString("id"), keyArr); |
|
|
|
// TODO update wx_template_msg |
|
|
|
if(appinfo != null) { |
|
|
|
// wx_template_msg |
|
|
|
WxTemplateMsg templateMsgQ = new WxTemplateMsg(); |
|
|
|
templateMsgQ.setTenantId(appinfo.getTenantId()); |
|
|
|
templateMsgQ.setType(EnumTemplateType.VERIFY_SUCCESS.getCode()); |
|
|
|
WxTemplateMsg templateMsg = templateMsgService.getByObj(templateMsgQ); |
|
|
|
if(templateMsg != null) { |
|
|
|
templateMsg.setTemplateId(ret.getTemplateId()); |
|
|
|
templateMsgService.saveOrUpdate(templateMsg); |
|
|
|
} else { |
|
|
|
templateMsgQ.setTemplateId(ret.getTemplateId()); |
|
|
|
templateMsgService.saveOrUpdate(templateMsgQ); |
|
|
|
} |
|
|
|
} |
|
|
|
// 核销失败消息 |
|
|
|
JSONObject verify_fail = templeObj.getJSONObject("verify_fail"); |
|
|
|
keyidlist = verify_fail.getJSONArray("keyword_id_list"); |
|
|
|
List<Integer> keyArr1 = getIdList(keyidlist); |
|
|
|
ret = maService.getTemplateService().addTemplate(verify_fail.getString("id"), keyArr1); |
|
|
|
// TODO update wx_template_msg |
|
|
|
if(appinfo != null) { |
|
|
|
// wx_template_msg |
|
|
|
WxTemplateMsg templateMsgQ = new WxTemplateMsg(); |
|
|
|
templateMsgQ.setTenantId(appinfo.getTenantId()); |
|
|
|
templateMsgQ.setType(EnumTemplateType.VERIFY_FAIL.getCode()); |
|
|
|
WxTemplateMsg templateMsg = templateMsgService.getByObj(templateMsgQ); |
|
|
|
if(templateMsg != null) { |
|
|
|
templateMsg.setTemplateId(ret.getTemplateId()); |
|
|
|
templateMsgService.saveOrUpdate(templateMsg); |
|
|
|
} else { |
|
|
|
templateMsgQ.setTemplateId(ret.getTemplateId()); |
|
|
|
templateMsgService.saveOrUpdate(templateMsgQ); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (WxErrorException e) { |
|
|
|
logger.error(e.getMessage()); |
|
|
|
return new ResultData(Result.ERROR, e.getMessage()); |
|
|
|
|