yangys
2024-10-30 d51367b0fe1a062d3eae47e3f7555ab3e56e6a08
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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<Long> workstationIds) {
        List<MachineExtDTO> 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失败");
                    }
                }
            });
        });
    }
}