|  |  | @ -7,6 +7,7 @@ import com.dingtalk.api.request.OapiRobotSendRequest; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.constant.NumConstant; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.exception.RenException; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.ConvertUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.DateUtils; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.HttpClientManager; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.commons.tools.utils.Result; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.constant.ModuleConstant; | 
			
		
	
	
		
			
				
					|  |  | @ -17,6 +18,7 @@ import com.epmet.dto.form.CodeAuditRecordFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.form.MessagePushTextFormDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.AuthorizationInfoResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.CustomerIdAndClientResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.DingResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.dto.result.TemplateAndAppIdResultDTO; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.mpaes.AesException; | 
			
		
	
		
			
				
					|  |  |  | import com.epmet.mpaes.WXBizMsgCrypt; | 
			
		
	
	
		
			
				
					|  |  | @ -143,27 +145,35 @@ public class WarrantServiceImpl implements WarrantService { | 
			
		
	
		
			
				
					|  |  |  |                 codeAuditRecord.setCustomerId(customerId); | 
			
		
	
		
			
				
					|  |  |  |                 codeAuditRecord.setAuthAppId(authAppId); | 
			
		
	
		
			
				
					|  |  |  |                 codeAuditRecord.setTemplateId(templateId); | 
			
		
	
		
			
				
					|  |  |  |                 String customerName = paCustomerDao.selectCustomerName(customerId); | 
			
		
	
		
			
				
					|  |  |  |                 String client = clientType.equals(ModuleConstant.RESI) ? "居民端" : "工作端"; | 
			
		
	
		
			
				
					|  |  |  |                 //插入 代码审核 记录
 | 
			
		
	
		
			
				
					|  |  |  |                 log.info(String.format(ThirdRunTimeInfoConstant.CODE_AUDIT_RESULT, xml)); | 
			
		
	
		
			
				
					|  |  |  |                 codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); | 
			
		
	
		
			
				
					|  |  |  |                 // 修改 code_audit_result 中的代码审核结果
 | 
			
		
	
		
			
				
					|  |  |  |                 String reason = codeAuditRecord.getReason(); | 
			
		
	
		
			
				
					|  |  |  |                 String codeResult = null; | 
			
		
	
		
			
				
					|  |  |  |                 switch (event) { | 
			
		
	
		
			
				
					|  |  |  |                     case ModuleConstant.WEAPP_AUDIT_SUCCESS: | 
			
		
	
		
			
				
					|  |  |  |                         codeResult = ModuleConstant.AUDIT_SUCCESS; | 
			
		
	
		
			
				
					|  |  |  |                         Long successTime = Long.valueOf(xml.get(ModuleConstant.SUCC_TIME).toString()); | 
			
		
	
		
			
				
					|  |  |  |                         codeAuditRecord.setSuccTime(componentVerifyTicketServiceImpl.sToDate(successTime.toString())); | 
			
		
	
		
			
				
					|  |  |  |                         break; | 
			
		
	
		
			
				
					|  |  |  |                     case ModuleConstant.WEAPP_AUDIT_FAIL: | 
			
		
	
		
			
				
					|  |  |  |                         codeResult = ModuleConstant.AUDIT_FAILED; | 
			
		
	
		
			
				
					|  |  |  |                         Long failTime = Long.valueOf(xml.get(ModuleConstant.FAIL_TIME).toString()); | 
			
		
	
		
			
				
					|  |  |  |                         codeAuditRecord.setFailTime(componentVerifyTicketServiceImpl.sToDate(failTime.toString())); | 
			
		
	
		
			
				
					|  |  |  |                         break; | 
			
		
	
		
			
				
					|  |  |  |                     case ModuleConstant.WEAPP_AUDIT_DELAY: | 
			
		
	
		
			
				
					|  |  |  |                         codeResult = ModuleConstant.DELAY; | 
			
		
	
		
			
				
					|  |  |  |                         Long delayTime = Long.valueOf(xml.get(ModuleConstant.DELAY_TIME).toString()); | 
			
		
	
		
			
				
					|  |  |  |                         codeAuditRecord.setDelayTime(componentVerifyTicketServiceImpl.sToDate(delayTime.toString())); | 
			
		
	
		
			
				
					|  |  |  |                         break; | 
			
		
	
		
			
				
					|  |  |  |                     default: | 
			
		
	
		
			
				
					|  |  |  |                         codeResult = ModuleConstant.AUDIT_FAILED; | 
			
		
	
		
			
				
					|  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |                 //插入 代码审核 记录
 | 
			
		
	
		
			
				
					|  |  |  |                 log.info(String.format(ThirdRunTimeInfoConstant.CODE_AUDIT_RESULT, xml)); | 
			
		
	
		
			
				
					|  |  |  |                 codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); | 
			
		
	
		
			
				
					|  |  |  |                 // 修改 code_audit_result 中的代码审核结果
 | 
			
		
	
		
			
				
					|  |  |  |                 String reason = codeAuditRecord.getReason(); | 
			
		
	
		
			
				
					|  |  |  |                 log.info("开始寻找机器人发送消息"); | 
			
		
	
		
			
				
					|  |  |  |                 this.dingDingRobot(reason,event,customerName,client); | 
			
		
	
		
			
				
					|  |  |  |                 DingResultDTO dingResultDTO = codeCustomerDao.selectCustomerNameAndVersion(customerId, clientType); | 
			
		
	
		
			
				
					|  |  |  |                 this.dingDingRobot(reason,event,dingResultDTO,client,codeAuditRecord); | 
			
		
	
		
			
				
					|  |  |  |                 log.info("已找到robot,并发送消息......"); | 
			
		
	
		
			
				
					|  |  |  |                 String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); | 
			
		
	
		
			
				
					|  |  |  |                 codeAuditResultDao.updateAuditResult(customerId, codeCustomerId, codeResult); | 
			
		
	
	
		
			
				
					|  |  | @ -201,38 +211,57 @@ public class WarrantServiceImpl implements WarrantService { | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /*public static void main(String[] args) { | 
			
		
	
		
			
				
					|  |  |  |         WarrantServiceImpl w = new WarrantServiceImpl(); | 
			
		
	
		
			
				
					|  |  |  |         DingResultDTO ding = new DingResultDTO(); | 
			
		
	
		
			
				
					|  |  |  |         ding.setUserVersion("1.1.1"); | 
			
		
	
		
			
				
					|  |  |  |         ding.setCustomerName("阿里巴巴"); | 
			
		
	
		
			
				
					|  |  |  |         CodeAuditRecordFormDTO dto = new CodeAuditRecordFormDTO(); | 
			
		
	
		
			
				
					|  |  |  |         String format = DateUtils.format(new Date(),ModuleConstant.DATE_FORMAT); | 
			
		
	
		
			
				
					|  |  |  |         System.out.println(format); | 
			
		
	
		
			
				
					|  |  |  |         dto.setFailTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |         w.dingDingRobot("再次失败","weapp_audit_fail",ding,"支付宝",dto); | 
			
		
	
		
			
				
					|  |  |  |     }*/ | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |      * @Description  钉钉机器人报警 | 
			
		
	
		
			
				
					|  |  |  |      * @author zxc | 
			
		
	
		
			
				
					|  |  |  |      * @date 2020/8/5 4:33 下午 | 
			
		
	
		
			
				
					|  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |     public void dingDingRobot(String result,String event,String customerName,String clientType){ | 
			
		
	
		
			
				
					|  |  |  |     public void dingDingRobot(String result,String event,DingResultDTO dingResultDTO,String clientType,CodeAuditRecordFormDTO codeAuditRecord){ | 
			
		
	
		
			
				
					|  |  |  |         OapiRobotSendRequest request = new OapiRobotSendRequest(); | 
			
		
	
		
			
				
					|  |  |  |         request.setMsgtype("markdown"); | 
			
		
	
		
			
				
					|  |  |  |         OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); | 
			
		
	
		
			
				
					|  |  |  |         markdown.setTitle("代码审核结果"); | 
			
		
	
		
			
				
					|  |  |  |         String customerName = dingResultDTO.getCustomerName(); | 
			
		
	
		
			
				
					|  |  |  |         String userVersion = dingResultDTO.getUserVersion(); | 
			
		
	
		
			
				
					|  |  |  |         switch (event){ | 
			
		
	
		
			
				
					|  |  |  |             case ModuleConstant.WEAPP_AUDIT_SUCCESS: | 
			
		
	
		
			
				
					|  |  |  |                 markdown.setText("代码审核结果: 审核成功\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 客户名称:" + customerName +"\n\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 客户端:"+clientType+"\n"); | 
			
		
	
		
			
				
					|  |  |  |                         "> 客户端:"+clientType+"\n\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 审核成功时间:"+DateUtils.format(codeAuditRecord.getSuccTime(),ModuleConstant.DATE_FORMAT)+"\n\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 版本号:"+userVersion); | 
			
		
	
		
			
				
					|  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |             case ModuleConstant.WEAPP_AUDIT_FAIL: | 
			
		
	
		
			
				
					|  |  |  |                 markdown.setText("代码审核结果: 审核不通过\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 客户名称:" + customerName +"\n\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 客户端:"+clientType+"\n\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 审核失败时间:"+DateUtils.format(codeAuditRecord.getFailTime(),ModuleConstant.DATE_FORMAT)+"\n\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 版本号:"+userVersion+"\n\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 不通过原因:"+result); | 
			
		
	
		
			
				
					|  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |             case ModuleConstant.WEAPP_AUDIT_DELAY: | 
			
		
	
		
			
				
					|  |  |  |                 markdown.setText("代码审核结果: 审核延时\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 客户名称:" + customerName +"\n\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 客户端:"+clientType+"\n\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 审核延时时间:"+DateUtils.format(codeAuditRecord.getDelayTime(),ModuleConstant.DATE_FORMAT)+"\n\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 版本号:"+userVersion+"\n\n"+ | 
			
		
	
		
			
				
					|  |  |  |                         "> 延时原因:"+result); | 
			
		
	
		
			
				
					|  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |             default: | 
			
		
	
		
			
				
					|  |  |  |                 markdown.setText("机器人生病了......"); | 
			
		
	
		
			
				
					|  |  |  |                 log.info("event为:"+event); | 
			
		
	
		
			
				
					|  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |         request.setMarkdown(markdown); | 
			
		
	
		
			
				
					|  |  |  |         log.info("robot需要发送的内容为:"+markdown.getText()); | 
			
		
	
	
		
			
				
					|  |  | 
 |