|
|
|
@ -4,14 +4,17 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.hai.common.exception.ErrorCode; |
|
|
|
|
import com.hai.common.exception.ErrorHelp; |
|
|
|
|
import com.hai.common.exception.SysCode; |
|
|
|
|
import com.hai.config.MqttProviderConfig; |
|
|
|
|
import com.hai.config.SpPrinterConfig; |
|
|
|
|
import com.hai.config.SpPrinterTemplate; |
|
|
|
|
import com.hai.config.ZkcPrinterTemplate; |
|
|
|
|
import com.hai.dao.HighGasClassGroupTaskMapper; |
|
|
|
|
import com.hai.entity.HighGasClassGroup; |
|
|
|
|
import com.hai.entity.HighGasClassGroupTask; |
|
|
|
|
import com.hai.entity.HighGasClassGroupTaskExample; |
|
|
|
|
import com.hai.entity.HighMerchantStore; |
|
|
|
|
import com.hai.entity.*; |
|
|
|
|
import com.hai.enum_type.DeviceTypeEnum; |
|
|
|
|
import com.hai.enum_type.GasClassGroupTaskStatus; |
|
|
|
|
import com.hai.model.GasClassGroupTaskDataCount; |
|
|
|
|
import com.hai.model.GasClassGroupTaskOilCount; |
|
|
|
|
import com.hai.service.HighDeviceService; |
|
|
|
|
import com.hai.service.HighGasClassGroupService; |
|
|
|
|
import com.hai.service.HighGasClassGroupTaskService; |
|
|
|
|
import com.hai.service.HighMerchantStoreService; |
|
|
|
@ -37,6 +40,12 @@ public class HighGasClassGroupTaskServiceImpl implements HighGasClassGroupTaskSe |
|
|
|
|
@Resource |
|
|
|
|
private HighMerchantStoreService merchantStoreService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private HighDeviceService deviceService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private MqttProviderConfig mqttProviderConfig; |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|
|
|
|
public void startGroupTask(Long gasId, Long gasClassGroupId) { |
|
|
|
@ -82,8 +91,36 @@ public class HighGasClassGroupTaskServiceImpl implements HighGasClassGroupTaskSe |
|
|
|
|
HighGasClassGroupTask groupTask = list.get(0); |
|
|
|
|
groupTask.setEndTime(new Date()); |
|
|
|
|
groupTask.setStatus(GasClassGroupTaskStatus.status2.getStatus()); |
|
|
|
|
groupTask.setDataCount(JSONObject.toJSONString(countGroupTaskData(gasId, groupTask.getClassNum(), groupTask.getId(), groupTask.getStatus(), groupTask.getStartTime(), groupTask.getEndTime()))); |
|
|
|
|
// 统计
|
|
|
|
|
GasClassGroupTaskDataCount dataCount = countGroupTaskData(gasId, groupTask.getClassNum(), groupTask.getId(), groupTask.getStatus(), groupTask.getStartTime(), groupTask.getEndTime()); |
|
|
|
|
groupTask.setDataCount(JSONObject.toJSONString(dataCount)); |
|
|
|
|
editGroupTask(groupTask); |
|
|
|
|
|
|
|
|
|
// 查询加油站打印机
|
|
|
|
|
List<HighDevice> deviceList = deviceService.getDeviceListByStoreId(gasId); |
|
|
|
|
for (HighDevice device : deviceList) { |
|
|
|
|
if (device.getType().equals(DeviceTypeEnum.type1.getType())) { |
|
|
|
|
new Thread(() -> { |
|
|
|
|
try { |
|
|
|
|
// 推送打印机
|
|
|
|
|
SpPrinterConfig spPrinterConfig = new SpPrinterConfig(); |
|
|
|
|
spPrinterConfig.print(device.getDeviceSn(), SpPrinterTemplate.classGroupCountTemp(dataCount), 1); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
}).start(); |
|
|
|
|
} |
|
|
|
|
if (device.getType().equals(DeviceTypeEnum.type2.getType())) { |
|
|
|
|
new Thread(() -> { |
|
|
|
|
try { |
|
|
|
|
// 推送打印机
|
|
|
|
|
mqttProviderConfig.publish(2,false, device.getDeviceImei(), ZkcPrinterTemplate.classGroupCountTemp(dataCount)); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
e.printStackTrace(); |
|
|
|
|
} |
|
|
|
|
}).start(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|