|
@ -13,8 +13,12 @@ import com.epmet.dao.AuthorizationInfoDao; |
|
|
import com.epmet.dao.ComponentAccessTokenDao; |
|
|
import com.epmet.dao.ComponentAccessTokenDao; |
|
|
import com.epmet.dto.*; |
|
|
import com.epmet.dto.*; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.form.*; |
|
|
import com.epmet.dto.result.*; |
|
|
import com.epmet.dto.result.CodeHistoryResultDTO; |
|
|
|
|
|
import com.epmet.dto.result.QrCodeResultDTO; |
|
|
|
|
|
import com.epmet.dto.result.ReasonResultDTO; |
|
|
|
|
|
import com.epmet.dto.result.TemplateListResultDTO; |
|
|
import com.epmet.feign.OperCrmOpenFeignClient; |
|
|
import com.epmet.feign.OperCrmOpenFeignClient; |
|
|
|
|
|
import com.epmet.feign.OssFeignClient; |
|
|
import com.epmet.service.*; |
|
|
import com.epmet.service.*; |
|
|
import com.epmet.wxapi.param.WxMaCodeAuditStatusReq; |
|
|
import com.epmet.wxapi.param.WxMaCodeAuditStatusReq; |
|
|
import com.epmet.wxapi.param.WxMaCodeCommitReq; |
|
|
import com.epmet.wxapi.param.WxMaCodeCommitReq; |
|
@ -24,8 +28,6 @@ import com.epmet.wxapi.result.*; |
|
|
import com.epmet.wxapi.service.WxMaCodeService; |
|
|
import com.epmet.wxapi.service.WxMaCodeService; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.google.gson.JsonElement; |
|
|
|
|
|
import com.google.gson.JsonParser; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
@ -63,6 +65,8 @@ public class CodeServiceImpl implements CodeService { |
|
|
private CodeMediaService codeMediaService; |
|
|
private CodeMediaService codeMediaService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private CodeExtService codeExtService; |
|
|
private CodeExtService codeExtService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private OssFeignClient ossFeignClient; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<TemplateListResultDTO> templateList() { |
|
|
public List<TemplateListResultDTO> templateList() { |
|
@ -101,7 +105,7 @@ public class CodeServiceImpl implements CodeService { |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void upload(CodeUploadFormDTO formDTO) { |
|
|
public void upload(CodeUploadFormDTO formDTO) { |
|
|
//是否授权
|
|
|
//是否授权
|
|
|
if (customerMpService.getAuthFlag(formDTO.getCustomerId(), formDTO.getClientType())) { |
|
|
if (!customerMpService.getAuthFlag(formDTO.getCustomerId(), formDTO.getClientType())) { |
|
|
throw new RenException("未授权"); |
|
|
throw new RenException("未授权"); |
|
|
} |
|
|
} |
|
|
//获取小程序调用令牌
|
|
|
//获取小程序调用令牌
|
|
@ -148,6 +152,7 @@ public class CodeServiceImpl implements CodeService { |
|
|
CodeCustomerDTO codeCustomerDTO = ConvertUtils.sourceToTarget(formDTO, CodeCustomerDTO.class); |
|
|
CodeCustomerDTO codeCustomerDTO = ConvertUtils.sourceToTarget(formDTO, CodeCustomerDTO.class); |
|
|
codeCustomerDTO.setCustomerName(customerInfo.getData().getCustomerName()); |
|
|
codeCustomerDTO.setCustomerName(customerInfo.getData().getCustomerName()); |
|
|
codeCustomerDTO.setExtJson(formDTO.getExtJson()); |
|
|
codeCustomerDTO.setExtJson(formDTO.getExtJson()); |
|
|
|
|
|
codeCustomerDTO.setAppId(authInfo.getAuthorizerAppid()); |
|
|
codeCustomerDTO.setStatus(CodeConstant.UNAUDITED); |
|
|
codeCustomerDTO.setStatus(CodeConstant.UNAUDITED); |
|
|
codeCustomerService.save(codeCustomerDTO); |
|
|
codeCustomerService.save(codeCustomerDTO); |
|
|
|
|
|
|
|
@ -158,37 +163,36 @@ public class CodeServiceImpl implements CodeService { |
|
|
public PageData uploadList(UploadListFormDTO formDTO) { |
|
|
public PageData uploadList(UploadListFormDTO formDTO) { |
|
|
//获取小程序调用令牌
|
|
|
//获取小程序调用令牌
|
|
|
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); |
|
|
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); |
|
|
if (null == authInfo) { |
|
|
if (null != authInfo) { |
|
|
throw new RenException("未授权"); |
|
|
List<CodeCustomerDTO> auditingList = codeCustomerService.getAuditingCodeList(); |
|
|
} |
|
|
auditingList.forEach(code -> { |
|
|
List<CodeCustomerDTO> auditingList = codeCustomerService.getAuditingCodeList(); |
|
|
//获取审核结果信息
|
|
|
auditingList.forEach(code -> { |
|
|
CodeAuditResultDTO auditResult = codeAuditResultService.getAuditResultByCodeId(code.getId()); |
|
|
//获取审核结果信息
|
|
|
//调用微信API获取最新审核状态
|
|
|
CodeAuditResultDTO auditResult = codeAuditResultService.getAuditResultByCodeId(code.getId()); |
|
|
WxMaCodeAuditStatusReq request = new WxMaCodeAuditStatusReq(); |
|
|
//调用微信API获取最新审核状态
|
|
|
request.setAuditId(auditResult.getAuditId()); |
|
|
WxMaCodeAuditStatusReq request = new WxMaCodeAuditStatusReq(); |
|
|
WxResult<WxMaAuditStatusResult> wxAuditResult = wxMaCodeService.getAuditStatus(authInfo.getAuthorizerAccessToken(), request); |
|
|
request.setAuditId(auditResult.getAuditId()); |
|
|
if (wxAuditResult.success()) { |
|
|
WxResult<WxMaAuditStatusResult> wxAuditResult = wxMaCodeService.getAuditStatus(authInfo.getAuthorizerAccessToken(), request); |
|
|
WxMaAuditStatusResult result = wxAuditResult.getData(); |
|
|
if (wxAuditResult.success()) { |
|
|
if (result.getStatus() == NumConstant.ZERO) { |
|
|
WxMaAuditStatusResult result = wxAuditResult.getData(); |
|
|
code.setStatus(CodeConstant.AUDIT_SUCCESS); |
|
|
if (result.getStatus() == NumConstant.ZERO) { |
|
|
auditResult.setResult(CodeConstant.AUDIT_SUCCESS); |
|
|
code.setStatus(CodeConstant.AUDIT_SUCCESS); |
|
|
codeOperationHistoryService.updateDescribe(code.getId(), "审核成功"); |
|
|
auditResult.setResult(CodeConstant.AUDIT_SUCCESS); |
|
|
} else if (result.getStatus() == NumConstant.ONE) { |
|
|
codeOperationHistoryService.updateDescribe(code.getId(), "审核成功"); |
|
|
code.setStatus(CodeConstant.AUDIT_FAILED); |
|
|
} else if (result.getStatus() == NumConstant.ONE) { |
|
|
auditResult.setResult(CodeConstant.AUDIT_FAILED); |
|
|
code.setStatus(CodeConstant.AUDIT_FAILED); |
|
|
auditResult.setReason(result.getReason()); |
|
|
auditResult.setResult(CodeConstant.AUDIT_FAILED); |
|
|
codeOperationHistoryService.updateDescribe(code.getId(), result.getReason()); |
|
|
auditResult.setReason(result.getReason()); |
|
|
} else if (result.getStatus() == NumConstant.FOUR) { |
|
|
codeOperationHistoryService.updateDescribe(code.getId(), result.getReason()); |
|
|
code.setStatus(CodeConstant.DELAY); |
|
|
} else if (result.getStatus() == NumConstant.FOUR) { |
|
|
auditResult.setResult(CodeConstant.DELAY); |
|
|
code.setStatus(CodeConstant.DELAY); |
|
|
codeOperationHistoryService.updateDescribe(code.getId(), "审核延后"); |
|
|
auditResult.setResult(CodeConstant.DELAY); |
|
|
} |
|
|
codeOperationHistoryService.updateDescribe(code.getId(), "审核延后"); |
|
|
codeCustomerService.update(code); |
|
|
|
|
|
codeAuditResultService.update(auditResult); |
|
|
} |
|
|
} |
|
|
codeCustomerService.update(code); |
|
|
}); |
|
|
codeAuditResultService.update(auditResult); |
|
|
} |
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
return codeCustomerService.getCodeList(formDTO); |
|
|
return codeCustomerService.getCodeList(formDTO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -197,7 +201,7 @@ public class CodeServiceImpl implements CodeService { |
|
|
//获取上传代码信息
|
|
|
//获取上传代码信息
|
|
|
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |
|
|
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |
|
|
//是否授权
|
|
|
//是否授权
|
|
|
if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { |
|
|
if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { |
|
|
throw new RenException("未授权"); |
|
|
throw new RenException("未授权"); |
|
|
} |
|
|
} |
|
|
//获取小程序调用令牌
|
|
|
//获取小程序调用令牌
|
|
@ -232,7 +236,7 @@ public class CodeServiceImpl implements CodeService { |
|
|
//获取上传代码信息
|
|
|
//获取上传代码信息
|
|
|
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |
|
|
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |
|
|
//是否授权
|
|
|
//是否授权
|
|
|
if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { |
|
|
if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { |
|
|
throw new RenException("未授权"); |
|
|
throw new RenException("未授权"); |
|
|
} |
|
|
} |
|
|
//获取审核结果信息
|
|
|
//获取审核结果信息
|
|
@ -277,7 +281,7 @@ public class CodeServiceImpl implements CodeService { |
|
|
//获取上传代码信息
|
|
|
//获取上传代码信息
|
|
|
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |
|
|
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |
|
|
//是否授权
|
|
|
//是否授权
|
|
|
if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { |
|
|
if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { |
|
|
throw new RenException("未授权"); |
|
|
throw new RenException("未授权"); |
|
|
} |
|
|
} |
|
|
//获取小程序调用令牌
|
|
|
//获取小程序调用令牌
|
|
@ -308,7 +312,7 @@ public class CodeServiceImpl implements CodeService { |
|
|
//获取上传代码信息
|
|
|
//获取上传代码信息
|
|
|
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |
|
|
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |
|
|
//是否授权
|
|
|
//是否授权
|
|
|
if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { |
|
|
if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { |
|
|
throw new RenException("未授权"); |
|
|
throw new RenException("未授权"); |
|
|
} |
|
|
} |
|
|
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); |
|
|
AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); |
|
@ -343,7 +347,7 @@ public class CodeServiceImpl implements CodeService { |
|
|
//获取上传代码信息
|
|
|
//获取上传代码信息
|
|
|
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |
|
|
CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |
|
|
//是否授权
|
|
|
//是否授权
|
|
|
if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { |
|
|
if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { |
|
|
throw new RenException("未授权"); |
|
|
throw new RenException("未授权"); |
|
|
} |
|
|
} |
|
|
//获取小程序调用令牌
|
|
|
//获取小程序调用令牌
|
|
@ -383,7 +387,7 @@ public class CodeServiceImpl implements CodeService { |
|
|
CodeMediaDTO codeMediaDTO = new CodeMediaDTO(); |
|
|
CodeMediaDTO codeMediaDTO = new CodeMediaDTO(); |
|
|
codeMediaDTO.setCodeId(formDTO.getCodeId()); |
|
|
codeMediaDTO.setCodeId(formDTO.getCodeId()); |
|
|
codeMediaDTO.setMediaId(wxResult.getData().getMediaId()); |
|
|
codeMediaDTO.setMediaId(wxResult.getData().getMediaId()); |
|
|
codeMediaDTO.setMediaName(formDTO.getMedia().getName()); |
|
|
codeMediaDTO.setMediaName(formDTO.getMedia().getOriginalFilename()); |
|
|
codeMediaDTO.setMediaType(wxResult.getData().getType()); |
|
|
codeMediaDTO.setMediaType(wxResult.getData().getType()); |
|
|
codeMediaService.save(codeMediaDTO); |
|
|
codeMediaService.save(codeMediaDTO); |
|
|
return wxResult.getData().getMediaId(); |
|
|
return wxResult.getData().getMediaId(); |
|
@ -399,7 +403,7 @@ public class CodeServiceImpl implements CodeService { |
|
|
operationDTO.setCodeId(codeId); |
|
|
operationDTO.setCodeId(codeId); |
|
|
operationDTO.setVersion(version); |
|
|
operationDTO.setVersion(version); |
|
|
operationDTO.setOperation(operation); |
|
|
operationDTO.setOperation(operation); |
|
|
operationDTO.setDescribe(describe); |
|
|
operationDTO.setDescription(describe); |
|
|
codeOperationHistoryService.save(operationDTO); |
|
|
codeOperationHistoryService.save(operationDTO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|