|  | @ -23,6 +23,7 @@ import com.github.pagehelper.PageHelper; | 
			
		
	
		
		
			
				
					|  |  | import com.github.pagehelper.PageInfo; |  |  | import com.github.pagehelper.PageInfo; | 
			
		
	
		
		
			
				
					|  |  | import lombok.extern.slf4j.Slf4j; |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
		
			
				
					|  |  | import org.apache.commons.io.FileUtils; |  |  | import org.apache.commons.io.FileUtils; | 
			
		
	
		
		
			
				
					|  |  |  |  |  | import org.apache.commons.lang3.StringUtils; | 
			
		
	
		
		
			
				
					|  |  | import org.springframework.beans.factory.annotation.Autowired; |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
		
			
				
					|  |  | import org.springframework.mock.web.MockMultipartFile; |  |  | import org.springframework.mock.web.MockMultipartFile; | 
			
		
	
		
		
			
				
					|  |  | import org.springframework.stereotype.Service; |  |  | import org.springframework.stereotype.Service; | 
			
		
	
	
		
		
			
				
					|  | @ -165,12 +166,26 @@ public class CodeServiceImpl implements CodeService { | 
			
		
	
		
		
			
				
					|  |  | 		codeCustomerDTO.setStatus(CodeConstant.UNAUDITED); |  |  | 		codeCustomerDTO.setStatus(CodeConstant.UNAUDITED); | 
			
		
	
		
		
			
				
					|  |  | 		String codeId = codeCustomerService.save(codeCustomerDTO); |  |  | 		String codeId = codeCustomerService.save(codeCustomerDTO); | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		//设置服务器域名
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		wxResult = wxMaCodeService.modifyDomain(authInfo.getAuthorizerAccessToken()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		if (!wxResult.success()) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			saveOperation(formDTO.getCustomerId(), null, formDTO.getUserVersion(), CodeConstant.OPER_UPLOAD, wxResult.getErrorMsg()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		//设置业务域名
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		wxResult = wxMaCodeService.setWebviewDomain(authInfo.getAuthorizerAccessToken()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		if (!wxResult.success()) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			saveOperation(formDTO.getCustomerId(), null, formDTO.getUserVersion(), CodeConstant.OPER_UPLOAD, wxResult.getErrorMsg()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | 		saveOperation(formDTO.getCustomerId(), codeId, formDTO.getUserVersion(), CodeConstant.OPER_UPLOAD, "上传成功"); |  |  | 		saveOperation(formDTO.getCustomerId(), codeId, formDTO.getUserVersion(), CodeConstant.OPER_UPLOAD, "上传成功"); | 
			
		
	
		
		
			
				
					|  |  | 	} |  |  | 	} | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | 	@Override |  |  | 	@Override | 
			
		
	
		
		
			
				
					|  |  | 	public PageData uploadList(UploadListFormDTO formDTO) { |  |  | 	public PageData uploadList(UploadListFormDTO formDTO) { | 
			
		
	
		
		
			
				
					|  |  | 		List<CodeCustomerDTO> auditingList = codeCustomerService.getAuditingCodeList(formDTO.getSource()); |  |  | 		List<CodeCustomerDTO> auditingList = codeCustomerService.getAuditingCodeList(formDTO.getSource()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		String customerId = formDTO.getCustomerId(); | 
			
		
	
		
		
			
				
					|  |  | 		if (null != auditingList && auditingList.size() > NumConstant.ZERO) { |  |  | 		if (null != auditingList && auditingList.size() > NumConstant.ZERO) { | 
			
		
	
		
		
			
				
					|  |  | 			auditingList.forEach(code -> { |  |  | 			auditingList.forEach(code -> { | 
			
		
	
		
		
			
				
					|  |  | 				//获取小程序调用令牌
 |  |  | 				//获取小程序调用令牌
 | 
			
		
	
	
		
		
			
				
					|  | @ -186,18 +201,18 @@ public class CodeServiceImpl implements CodeService { | 
			
		
	
		
		
			
				
					|  |  | 					if (result.getStatus() == NumConstant.ZERO) { |  |  | 					if (result.getStatus() == NumConstant.ZERO) { | 
			
		
	
		
		
			
				
					|  |  | 						code.setStatus(CodeConstant.AUDIT_SUCCESS); |  |  | 						code.setStatus(CodeConstant.AUDIT_SUCCESS); | 
			
		
	
		
		
			
				
					|  |  | 						auditResult.setResult(CodeConstant.AUDIT_SUCCESS); |  |  | 						auditResult.setResult(CodeConstant.AUDIT_SUCCESS); | 
			
		
	
		
		
			
				
					
					|  |  | 						saveOperation(formDTO.getCustomerId(), code.getId(), code.getUserVersion(), CodeConstant.OPER_SUCCESS, "审核成功"); |  |  | 						saveOperation(customerId, code.getId(), code.getUserVersion(), CodeConstant.OPER_SUCCESS, "审核成功"); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | 					} else if (result.getStatus() == NumConstant.ONE) { |  |  | 					} else if (result.getStatus() == NumConstant.ONE) { | 
			
		
	
		
		
			
				
					|  |  | 						code.setStatus(CodeConstant.AUDIT_FAILED); |  |  | 						code.setStatus(CodeConstant.AUDIT_FAILED); | 
			
		
	
		
		
			
				
					|  |  | 						auditResult.setResult(CodeConstant.AUDIT_FAILED); |  |  | 						auditResult.setResult(CodeConstant.AUDIT_FAILED); | 
			
		
	
		
		
			
				
					|  |  | 						auditResult.setReason(result.getReason()); |  |  | 						auditResult.setReason(result.getReason()); | 
			
		
	
		
		
			
				
					|  |  | 						auditResult.setScreenShot(result.getScreenshot()); |  |  | 						auditResult.setScreenShot(result.getScreenshot()); | 
			
		
	
		
		
			
				
					
					|  |  | 						saveOperation(formDTO.getCustomerId(), code.getId(), code.getUserVersion(), CodeConstant.OPER_FAILED, result.getReason()); |  |  | 						saveOperation(customerId, code.getId(), code.getUserVersion(), CodeConstant.OPER_FAILED, result.getReason()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | 					} else if (result.getStatus() == NumConstant.FOUR) { |  |  | 					} else if (result.getStatus() == NumConstant.FOUR) { | 
			
		
	
		
		
			
				
					|  |  | 						code.setStatus(CodeConstant.DELAY); |  |  | 						code.setStatus(CodeConstant.DELAY); | 
			
		
	
		
		
			
				
					|  |  | 						auditResult.setResult(CodeConstant.DELAY); |  |  | 						auditResult.setResult(CodeConstant.DELAY); | 
			
		
	
		
		
			
				
					|  |  | 						auditResult.setReason(result.getReason()); |  |  | 						auditResult.setReason(result.getReason()); | 
			
		
	
		
		
			
				
					
					|  |  | 						saveOperation(formDTO.getCustomerId(), code.getId(), code.getUserVersion(), CodeConstant.OPER_DELAY, result.getReason()); |  |  | 						saveOperation(customerId, code.getId(), code.getUserVersion(), CodeConstant.OPER_DELAY, result.getReason()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | 					} |  |  | 					} | 
			
		
	
		
		
			
				
					|  |  | 					codeCustomerService.update(code); |  |  | 					codeCustomerService.update(code); | 
			
		
	
		
		
			
				
					|  |  | 					codeAuditResultService.update(auditResult); |  |  | 					codeAuditResultService.update(auditResult); | 
			
		
	
	
		
		
			
				
					|  | @ -246,9 +261,13 @@ public class CodeServiceImpl implements CodeService { | 
			
		
	
		
		
			
				
					|  |  | 			codeAuditResultDTO.setResult(CodeConstant.AUDITING); |  |  | 			codeAuditResultDTO.setResult(CodeConstant.AUDITING); | 
			
		
	
		
		
			
				
					|  |  | 			codeAuditResultService.save(codeAuditResultDTO); |  |  | 			codeAuditResultService.save(codeAuditResultDTO); | 
			
		
	
		
		
			
				
					|  |  | 		} else { |  |  | 		} else { | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			codeAuditResultService.deleteById(codeAuditResultDTO.getId()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			codeAuditResultDTO = new CodeAuditResultDTO(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			codeAuditResultDTO.setCustomerId(codeCustomerDTO.getCustomerId()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			codeAuditResultDTO.setCodeId(codeCustomerDTO.getId()); | 
			
		
	
		
		
			
				
					|  |  | 			codeAuditResultDTO.setAuditId(wxResult.getData()); |  |  | 			codeAuditResultDTO.setAuditId(wxResult.getData()); | 
			
		
	
		
		
			
				
					|  |  | 			codeAuditResultDTO.setResult(CodeConstant.AUDITING); |  |  | 			codeAuditResultDTO.setResult(CodeConstant.AUDITING); | 
			
		
	
		
		
			
				
					
					|  |  | 			codeAuditResultService.update(codeAuditResultDTO); |  |  | 			codeAuditResultService.save(codeAuditResultDTO); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | 		} |  |  | 		} | 
			
		
	
		
		
			
				
					|  |  | 		//更新代码表状态
 |  |  | 		//更新代码表状态
 | 
			
		
	
		
		
			
				
					|  |  | 		codeCustomerDTO.setStatus(CodeConstant.AUDITING); |  |  | 		codeCustomerDTO.setStatus(CodeConstant.AUDITING); | 
			
		
	
	
		
		
			
				
					|  | @ -333,8 +352,9 @@ public class CodeServiceImpl implements CodeService { | 
			
		
	
		
		
			
				
					|  |  | 	} |  |  | 	} | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | 	@Override |  |  | 	@Override | 
			
		
	
		
		
			
				
					
					|  |  | 	public ReasonResultDTO reason(CodeCommonFormDTO formDTO) { |  |  | 	public List<ReasonResultDTO> reason(CodeCommonFormDTO formDTO) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  | 		ReasonResultDTO result = new ReasonResultDTO(); |  |  | 		List<ReasonResultDTO> resultList = new ArrayList<>(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | 		//获取上传代码信息
 |  |  | 		//获取上传代码信息
 | 
			
		
	
		
		
			
				
					|  |  | 		CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |  |  | 		CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); | 
			
		
	
		
		
			
				
					|  |  | 		//是否授权
 |  |  | 		//是否授权
 | 
			
		
	
	
		
		
			
				
					|  | @ -346,25 +366,48 @@ public class CodeServiceImpl implements CodeService { | 
			
		
	
		
		
			
				
					|  |  | 			throw new RenException("未授权"); |  |  | 			throw new RenException("未授权"); | 
			
		
	
		
		
			
				
					|  |  | 		} |  |  | 		} | 
			
		
	
		
		
			
				
					|  |  | 		//获取审核结果信息
 |  |  | 		//获取审核结果信息
 | 
			
		
	
		
		
			
				
					
					|  |  | 		CodeAuditResultDTO codeAuditResultDTO = codeAuditResultService.getAuditResultByCodeId(formDTO.getCodeId()); |  |  | 		List<CodeAuditResultDTO> codeAuditResultList = codeAuditResultService.getAuditFailedList(formDTO.getCodeId()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  | 		result.setReason(codeAuditResultDTO.getReason()); |  |  | 		codeAuditResultList.forEach(dto -> { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  | 		String[] mediaIds = codeAuditResultDTO.getScreenShot().split("[|]"); |  |  | 			ReasonResultDTO result = new ReasonResultDTO(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  | 			result.setReason(dto.getReason()); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			result.setAuditTime(DateUtils.format(dto.getCreatedTime(), DateUtils.DATE_TIME_PATTERN)); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			if (StringUtils.isBlank(dto.getScreenShotUrl())) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 				List<String> urlList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 				if(StringUtils.isNotBlank(dto.getScreenShot())) { | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 					String[] mediaIds = dto.getScreenShot().split("[|]"); | 
			
		
	
		
		
			
				
					|  |  | 					List<String> mediaIdList = new ArrayList<>(mediaIds.length); |  |  | 					List<String> mediaIdList = new ArrayList<>(mediaIds.length); | 
			
		
	
		
		
			
				
					|  |  | 					Collections.addAll(mediaIdList, mediaIds); |  |  | 					Collections.addAll(mediaIdList, mediaIds); | 
			
		
	
		
		
			
				
					
					|  |  | 		List<String> urlList = new ArrayList<>(); |  |  | 					String screenShotUrl = ""; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  | 		mediaIdList.forEach(mediaId -> { |  |  | 					for(String mediaId : mediaIdList) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  | 						//调用微信API获取素材
 |  |  | 						//调用微信API获取素材
 | 
			
		
	
		
		
			
				
					|  |  | 						WxMaCodeAuditStatusReq request = new WxMaCodeAuditStatusReq(); |  |  | 						WxMaCodeAuditStatusReq request = new WxMaCodeAuditStatusReq(); | 
			
		
	
		
		
			
				
					
					|  |  | 			request.setAuditId(codeAuditResultDTO.getAuditId()); |  |  | 						request.setAuditId(dto.getAuditId()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  | 						WxMaNewsReq wxMaNewsReq = new WxMaNewsReq(); |  |  | 						WxMaNewsReq wxMaNewsReq = new WxMaNewsReq(); | 
			
		
	
		
		
			
				
					|  |  | 						wxMaNewsReq.setMediaId(mediaId); |  |  | 						wxMaNewsReq.setMediaId(mediaId); | 
			
		
	
		
		
			
				
					|  |  | 						WxResult<byte[]> wxAuditResult = wxMaCodeService.getMaterial(authInfo.getAuthorizerAccessToken(), wxMaNewsReq); |  |  | 						WxResult<byte[]> wxAuditResult = wxMaCodeService.getMaterial(authInfo.getAuthorizerAccessToken(), wxMaNewsReq); | 
			
		
	
		
		
			
				
					|  |  | 						MultipartFile file = new MockMultipartFile("file", "QRCode.jpg", "image/jpeg", wxAuditResult.getData()); |  |  | 						MultipartFile file = new MockMultipartFile("file", "QRCode.jpg", "image/jpeg", wxAuditResult.getData()); | 
			
		
	
		
		
			
				
					|  |  | 						Result<UploadImgResultDTO> uploadResult = ossFeignClient.uploadQrCode(file); |  |  | 						Result<UploadImgResultDTO> uploadResult = ossFeignClient.uploadQrCode(file); | 
			
		
	
		
		
			
				
					|  |  | 						urlList.add(uploadResult.getData().getUrl()); |  |  | 						urlList.add(uploadResult.getData().getUrl()); | 
			
		
	
		
		
			
				
					
					|  |  | 		}); |  |  | 						if (StringUtils.isBlank(screenShotUrl)) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  | 							screenShotUrl = uploadResult.getData().getUrl(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 						} else { | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 							screenShotUrl = screenShotUrl + "|" + uploadResult.getData().getUrl(); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 						} | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 					} | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 					dto.setScreenShotUrl(screenShotUrl); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 					codeAuditResultService.update(dto); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 				} | 
			
		
	
		
		
			
				
					|  |  | 				result.setScreenshotUrl(urlList); |  |  | 				result.setScreenshotUrl(urlList); | 
			
		
	
		
		
			
				
					
					|  |  | 		return result; |  |  | 			} else { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					|  |  |  |  |  | 				String[] url = dto.getScreenShotUrl().split("[|]"); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 				List<String> urlList = new ArrayList<>(url.length); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 				Collections.addAll(urlList, url); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 				result.setScreenshotUrl(urlList); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 			resultList.add(result); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		}); | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  |  |  |  | 		return resultList; | 
			
		
	
		
		
			
				
					|  |  | 	} |  |  | 	} | 
			
		
	
		
		
			
				
					|  |  | 
 |  |  | 
 | 
			
		
	
		
		
			
				
					|  |  | 	@Override |  |  | 	@Override | 
			
		
	
	
		
		
			
				
					|  | @ -400,8 +443,8 @@ public class CodeServiceImpl implements CodeService { | 
			
		
	
		
		
			
				
					|  |  | 	public PageData history(CodeCommonFormDTO formDTO) { |  |  | 	public PageData history(CodeCommonFormDTO formDTO) { | 
			
		
	
		
		
			
				
					|  |  | 		PageHelper.startPage(formDTO.getPage(), formDTO.getLimit()); |  |  | 		PageHelper.startPage(formDTO.getPage(), formDTO.getLimit()); | 
			
		
	
		
		
			
				
					|  |  | 		//获取上传代码信息
 |  |  | 		//获取上传代码信息
 | 
			
		
	
		
		
			
				
					
					|  |  | 		CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); |  |  | //		CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId());
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  | 		List<CodeHistoryResultDTO> list = codeOperationHistoryService.getHistoryList(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); |  |  | 		List<CodeHistoryResultDTO> list = codeOperationHistoryService.getHistoryList(formDTO.getCodeId()); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					|  |  | 		PageInfo<CodeHistoryResultDTO> pageInfo = new PageInfo<>(list); |  |  | 		PageInfo<CodeHistoryResultDTO> pageInfo = new PageInfo<>(list); | 
			
		
	
		
		
			
				
					|  |  | 		return new PageData<>(list, pageInfo.getTotal()); |  |  | 		return new PageData<>(list, pageInfo.getTotal()); | 
			
		
	
		
		
			
				
					|  |  | 	} |  |  | 	} | 
			
		
	
	
		
		
			
				
					|  | 
 |