package com.qianwen.smartman.modules.perf.service.impl; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.qianwen.smartman.common.constant.CommonConstant; import com.qianwen.core.tool.utils.Func; import com.qianwen.smartman.modules.smis.dto.MachineExtDTO; import com.qianwen.smartman.modules.smis.service.IMachineService; //import com.qianwen.smartman.modules.perf.forestClient.PerfForestClient; import com.qianwen.smartman.modules.perf.service.IEmployeeSendService; import com.qianwen.smartman.modules.sync.constant.QyWechatConstant; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; /** * 可能该类没有用了 */ @Service public class EmployeeSendServiceImpl implements IEmployeeSendService { private static final Logger log = LoggerFactory.getLogger(EmployeeSendServiceImpl.class); private final IMachineService machineService; //private final PerfForestClient forestClient; public EmployeeSendServiceImpl(final IMachineService machineService) {//, final PerfForestClient forestClient this.machineService = machineService; //this.forestClient = forestClient; } @Async public void sendMessageRocket(List workstationIds) { List extList = this.machineService.getMachineByWorkStation(workstationIds); workstationIds.forEach(wId -> { extList.stream().filter(c -> { return wId.equals(c.getWorkstationId()); }).findFirst().ifPresent(ext -> { String dmpId = this.machineService.queryDateTypeState(wId); if (Func.isNotBlank(dmpId)) { try { String employeeOnOff = "{}";//yangys 去掉了,241030this.forestClient.perfEmployeeOnOff(ext.getExtendId(), dmpId); JSONObject jsonObject = JSON.parseObject(employeeOnOff); Boolean success = jsonObject.getBoolean(QyWechatConstant.CALLBACK_RESULT); if (Boolean.FALSE.equals(success)) { log.error(jsonObject.getString(CommonConstant.ALARM_MSG)); } } catch (Exception e) { log.error("调用dmp失败"); } } }); }); } }