6/21 同步优化

dev_kcyj
wangwei 1 year ago
parent 8eb4db5673
commit bcbe3745b5

@ -72,6 +72,7 @@ public class WebSocketServer {
}
}
/**
* @ Param session
* @ Param error

@ -127,7 +127,7 @@ public enum BasicExportStatusTimeEnum {
DEV_CHECK_DETAIL_ITEM("device_check_detail_item","巡检设备项目"),
//getDeviceRepairApply
DEV_REPAIR_APPLY("device_repair_apply","报修单数据"),
DEV_REPAIR_APPLY_DETAIL("device_repair_apply_detail","报修单明细数据"),
DEV_UPKEEP_DATA("device_upkeep","保养单数据"),
DEV_REPAIR("device_repair","设备维修单数据"),
PRODUCE_BUSINESS_DATA("thr_manufacturer", "生产企业数据"),

@ -61,6 +61,7 @@ public enum BasicExportTypeEnum {
DEVICE_INFO_DATA("device_info", "设备信息数据"),
DEVICE_CHECK_DATA("device_check", "巡检管理数据"),
DEVICE_REPAIR_DATA("device_repair_apply", "报修管理数据"),
DEVICE_UPKEEP_DATA("device__upkeep", "设备保养数据"),
PRODUCE_BUSINESS_DATA("thr_manufacturer", "生产企业数据"),
//

@ -37,5 +37,7 @@ public interface SocketMsgType {
*
*/
String DEV_TASK_DEL = "DEV_TASK_DEL";
String STAT_DATA_REQUEST = "STAT_DATA_REQUEST"; //汇总日报
String STAT_DATA = "STAT_DATA"; //
}

@ -361,6 +361,7 @@ public class UdiRelevanceController extends BaseController {
udiProductEntity.setCpms(udiRelevanceSaveRequest.getCpms());
udiProductEntity.setPrice(udiRelevanceSaveRequest.getPrice());
udiProductEntity.setSpmc(udiRelevanceSaveRequest.getSpmc());
udiProductEntity.setBzgg(udiRelevanceSaveRequest.getBzgg());
udiProductEntity.setAllowNoBatch(udiRelevanceSaveRequest.getAllowNoBatch());
udiProductEntity.setAllowNoExpire(udiRelevanceSaveRequest.getAllowNoExpire());
udiProductEntity.setAllowNoProduct(udiRelevanceSaveRequest.getAllowNoProduct());

@ -387,8 +387,6 @@ public class IoOrderDetailResultController extends BaseController {
data.put("data", list);
String param = JSON.toJSONString(data);
JasperUtils.jasperReport(request, response, param, filePath + "pdf/template/" + systemPDFTemplateEntity.getPath(), "pdf");
return ResultVOUtils.success();

@ -32,7 +32,7 @@ public interface InvCountOrderMapper extends BaseMapper<InvCountOrderEntity> {
*
*
* @param invStorageCode
* @param invWarehouseCode
* @param
* @param invSpaceCode
* @return
*/

@ -380,6 +380,14 @@ public class BasicProductsEntity {
@ApiModelProperty(value="耗材材质")
private String matrial;
/**
*
*/
@TableField(value = "bzgg")
private String bzgg;
public static final String COL_ID = "id";
public static final String COL_UUID = "uuid";
@ -493,4 +501,6 @@ public class BasicProductsEntity {
public static final String COL_UPDATEUSER = "updateUser";
public static final String COL_REMARK = "remark";
public static final String COL_BZGG= "bzgg";
}

@ -102,6 +102,11 @@ public class UdiProductEntity {
private String createUser;
private Integer destinyType;
/**
*
*/
private String bzgg;
/**
* (
*/

@ -57,6 +57,13 @@ public class DeviceCheckItemDictEntity {
@TableField(value = "createTime")
private LocalDateTime createTime;
/**
*
*/
@TableField(value = "updateTime")
private LocalDateTime updateTime;
/**
*
*/

@ -118,6 +118,13 @@ public class DeviceRepairApplyEntity {
@TableField(value = "confirmPhone")
private String confirmPhone;
/**
* xianchang
*/
@TableField(value = "livePath")
private String livePath;
/**
*
*/

@ -75,11 +75,12 @@ public class SyncDataSetEntity {
private int deviceInfo; //设备信息管理
private int deviceCheck;//巡检管理
private int deviceCheckDetail;//巡检设备具体信息
private int deviceCheckDetailItem;//巡检设备项目表
// private int deviceCheckDetail;//巡检设备具体信息
// private int deviceCheckDetailItem;//巡检设备项目表
private int deviceRepairApply;//报修管理
private int deviceRepairDetail;//报修明细
private int deviceRepair;//维修单
// private int deviceRepairDetail;//报修明细
// private int deviceRepair;//维修单
private int deviceUpkeep;//保养单
private int produceBusiness;//生产企业 PRODUCE_BUSINESS_DATA
}

@ -13,8 +13,13 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.glxp.api.constant.FileConstant;
import com.glxp.api.entity.dev.DeviceRepairApplyDetailEntity;
import groovy.util.logging.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.tools.ant.util.DateUtils;
import org.hibernate.validator.internal.util.logging.Log;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@ -41,6 +46,7 @@ import okhttp3.Response;
/*文件服务*/
@Service
@Slf4j
public class FileServiceImpl implements FileService {
private static final Logger logger = LoggerFactory.getLogger(FileServiceImpl.class);
@Value("${file_path}")
@ -76,6 +82,16 @@ public class FileServiceImpl implements FileService {
}
return fileToUpload(list);
}
// @Test
// public void dddd(){
// String strs = "D:\\img\\11.png";
// boolean fileExist = FileUtils.isFileExist(strs);
// if (fileExist == false){
// logger.error( "以下文件不存在:\n");
// }else {
// System.out.println("cunzai ");
// }
// }
private BaseResponse fileToUpload(List<String> list) {
String host = "";
@ -234,12 +250,13 @@ public class FileServiceImpl implements FileService {
MultipartBody.Builder builder = new MultipartBody.Builder();
builder.setType(MultipartBody.FORM);
String fileType = "application/octet-stream";
String fileType2 = "image/jpeg";
if (files != null && files.size() > 0) {
for (int i = 0; i < files.size(); i++) {
if (!StringUtils.isEmpty(files.get(i))) {
File file = new File(files.get(i));
File file = new File(filePath + "register/device/" + files.get(i));
String fileName = files.get(i);
fileName = fileName.substring(fileName.lastIndexOf("/"));
// fileName = fileName.substring(fileName.lastIndexOf("/"));
builder.addFormDataPart("files", fileName,
RequestBody.create(MediaType.parse(fileType), file));
}

@ -117,6 +117,11 @@ public class UdiRelevanceSaveRequest {
private String certIdFk;
private Integer zdcfsycs;
/**
*
*/
private String bzgg;
/**
* (

@ -98,6 +98,9 @@ public class DevicePlanParam {
.frequency(frequency)
.status(status == null ? 1 : status)
.remark(remark)
.createUserId(user.getId())
.createUserName(user.getUserName())
.createTime(LocalDateTime.now())
.type(type)
.build();
if (!isUpdate) {

@ -40,6 +40,7 @@ public class DeviceRepairApplyAddParam {
Set<ApplyDetail> details;
Long taskId;
String livePath;
@Data
public static class ApplyDetail {
@ -96,6 +97,7 @@ public class DeviceRepairApplyAddParam {
.applyTime(LocalDateTime.now())
.deviceCount(details.size())
.finishCount(0)
.livePath(livePath)
.updateTime(LocalDateTime.now())
.build();
}

@ -203,6 +203,11 @@ public class UdiRelevanceResponse {
private Integer requireScanCode;
/**
*
*/
private String bzgg;
public int getBhzxxsbzsl() {
if (bhzxxsbzsl == null || bhzxxsbzsl == 0) {
return 1;

@ -127,4 +127,9 @@ public class InvProductResponse {
private BigDecimal price;
/**
*
*/
private String bzgg;
}

@ -17,7 +17,12 @@ public class SpsSyncDeviceDataResponse extends BaseSyncResponse{
List<DeviceCheckEntity> deviceCheckEntities;
List<DeviceCheckDetailEntity> deviceCheckDetailEntities;
List<DeviceCheckDetailItemEntity> deviceCheckDetailItemEntities;
List<DeviceCheckItemDictEntity> deviceCheckItemDictEntities;
List<DeviceRepairApplyDetailEntity> deviceRepairApplyDetailEntities;//报修单明细
List<DeviceRepairApplyEntity> deviceRepairApplyEntities;//报修单
List<DeviceRepairEntity> deviceRepairEntities;//维修单
List<DeviceUpkeepEntity> deviceUpkeepEntities;//保养单
List<DeviceUpkeepDetailEntity> deviceUpkeepDetailEntities;//保养单明细
List<DeviceUpkeepDetailItemEntity> deviceUpkeepDetailItemEntities;//保养单项目明细
}

@ -62,11 +62,12 @@ public class SyncDataSetResponse {
private int deviceInfo; //设备信息管理
private int deviceCheck;//巡检管理
private int deviceCheckDetail;//巡检设备具体信息
private int deviceCheckDetailItem;//巡检设备项目表
// private int deviceCheckDetail;//巡检设备具体信息
// private int deviceCheckDetailItem;//巡检设备项目表
private int deviceRepairApply;//报修管理
private int deviceRepairDetail;//报修明细
private int deviceRepair;//维修单
// private int deviceRepairDetail;//报修明细
// private int deviceRepair;//维修单
private int deviceUpkeep;//保养单
private int produceBusiness;//生产企业
}

@ -121,6 +121,7 @@ public class DeviceRepairApplyServiceImpl extends ServiceImpl<DeviceRepairApplyM
if (taskId != null){
deviceCheckDetailService.update(Wrappers.lambdaUpdate(DeviceCheckDetailEntity.class)
.set(DeviceCheckDetailEntity::getApplyId, repairApply.getId())
.set(DeviceCheckDetailEntity::getUpdateTime,LocalDateTime.now())
.eq(DeviceCheckDetailEntity::getTaskId, taskId)
.eq(DeviceCheckDetailEntity::getDeviceCode, d.getDeviceCode())
);

@ -6,6 +6,7 @@ import com.glxp.api.dao.thrsys.ThrManufacturerMapper;
import com.glxp.api.entity.dev.*;
import com.glxp.api.res.inv.InnerOrderPrintResponse;
import com.glxp.api.service.dev.*;
import org.junit.Test;
import org.springframework.beans.BeanUtils;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
@ -276,25 +277,30 @@ public class HeartService {
// if (needExec())
break;
case DEVICE_INFO_DATA:
if (needExec(info.getDeviceInfo())) {
if (needExec(info.getDeviceInfo(),info.getDeviceCheck(),info.getDeviceRepairApply(),info.getDeviceUpkeep())) {
uploadData(exportType, taskId, x -> x.getDeviceInfoData(info, taskId, now, syncTime));
}
break;
case DEVICE_CHECK_DATA:
if (needExec(info.getDeviceCheck(),info.getDeviceCheckDetail(),info.getDeviceCheckDetailItem())) {
uploadData(exportType, taskId, x -> x.getDeviceCheckData(info, taskId, now, syncTime));
}
break;
case DEVICE_REPAIR_DATA:
if (needExec(info.getDeviceRepairApply(),info.getDeviceRepairDetail(),info.getDeviceRepair())) {
uploadData(exportType, taskId, x -> x.getDeviceRepair(info, taskId, now, syncTime));
}
break;
case PRODUCE_BUSINESS_DATA:
// case DEVICE_CHECK_DATA:
// if (needExec(info.getDeviceCheck(),info.getDeviceCheckDetail(),info.getDeviceCheckDetailItem())) {
// uploadData(exportType, taskId, x -> x.getDeviceCheckData(info, taskId, now, syncTime));
// }
// break;
// case DEVICE_REPAIR_DATA:
// if (needExec(info.getDeviceRepairApply(),info.getDeviceRepairDetail(),info.getDeviceRepair())) {
// uploadData(exportType, taskId, x -> x.getDeviceRepair(info, taskId, now, syncTime));
// }
// break;
case PRODUCE_BUSINESS_DATA:
if (needExec(info.getProduceBusiness())) {
uploadData(exportType, taskId, x -> x.getProBusinessData(info, taskId, now, syncTime));
}
break;
// case DEVICE_UPKEEP_DATA:
// if (needExec(info.getDeviceUpkeep())) {
// uploadData(exportType, taskId, x -> x.getDeviceUpkeepData(info, taskId, now, syncTime));
// }
// break;
case DEVICE_TASK:
// if (needExec(info.getDeviceTask())) {
//默认开启
@ -1098,6 +1104,7 @@ public class HeartService {
}
@Resource
DeviceInspectTaskService deviceInspectTaskService;
@Resource
@ -1695,8 +1702,7 @@ public class HeartService {
}
Date startTime = new Date();
String data = spGetHttp.pullData(exportType);
log.warn("打印出来{}",data);
String data = spGetHttp.pullData(exportType);;
cn.hutool.json.JSONObject obj = JSONUtil.parseObj(data);
Integer code = obj.getInt("code");
if (!code.equals(20000)) {
@ -1706,7 +1712,7 @@ public class HeartService {
}
//数据内容
String dataStr = obj.getStr("data");
log.error("shujv neirong xiwangshi duide bushi cuode {}",dataStr);
// log.error("shujv neirong xiwangshi duide bushi cuode {}",dataStr);
if (StrUtil.isNotBlank(dataStr)) {
RelaySyncDto bean = JSONUtil.toBean(dataStr, RelaySyncDto.class);
log.error("??????????????????{}",bean);
@ -1733,6 +1739,9 @@ public class HeartService {
case DEVICE_REPAIR_DATA:
this.insertDeviceRepairData(bean.getFileContent());
break;
case DEVICE_UPKEEP_DATA:
this.insertDeviceUpkeepData(bean.getFileContent());
break;
case PRODUCE_BUSINESS_DATA:
this.insertProBusinessData(bean.getFileContent());
break;
@ -1968,12 +1977,16 @@ public class HeartService {
@Resource
DeviceCheckDetailItemMapper deviceCheckDetailItemMapper;
@Resource
DeviceCheckItemDictMapper deviceCheckItemDictMapper;
@Transactional(propagation = Propagation.NESTED)
public void insertDeviceCheckData(String content){
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(content);
List<DeviceCheckEntity> deviceCheckEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceCheckEntity.class.getSimpleName()), DeviceCheckEntity.class);
List<DeviceCheckDetailEntity> deviceCheckDetailEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceCheckDetailEntity.class.getSimpleName()), DeviceCheckDetailEntity.class);
List<DeviceCheckDetailItemEntity> deviceCheckDetailItemEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceCheckDetailItemEntity.class.getSimpleName()), DeviceCheckDetailItemEntity.class);
List<DeviceCheckItemDictEntity> deviceCheckItemDictEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceCheckItemDictEntity.class.getSimpleName()), DeviceCheckItemDictEntity.class);
if (CollectionUtil.isNotEmpty(deviceCheckEntities)) {
for (DeviceCheckEntity deviceCheckEntity : deviceCheckEntities) {
deviceCheckEntity.setUpdateTime(null);
@ -1992,6 +2005,12 @@ public class HeartService {
}
deviceCheckDetailItemMapper.replaceBatchs(deviceCheckDetailItemEntities);
}
if (CollectionUtil.isNotEmpty(deviceCheckItemDictEntities)) {
for (DeviceCheckItemDictEntity deviceCheckItemDictEntity : deviceCheckItemDictEntities) {
deviceCheckItemDictEntity.setUpdateTime(null);
}
deviceCheckItemDictMapper.replaceBatchs(deviceCheckItemDictEntities);
}
List<String> syncFiles = JSONUtil.toList(jsonObject.getJSONArray("syncFiles"), String.class);
if (CollUtil.isNotEmpty(syncFiles)) {
@ -2018,6 +2037,8 @@ public class HeartService {
List<DeviceRepairApplyEntity> deviceRepairApplyEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceRepairApplyEntity.class.getSimpleName()), DeviceRepairApplyEntity.class);
List<DeviceRepairApplyDetailEntity> deviceRepairApplyDetailEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceRepairApplyDetailEntity.class.getSimpleName()), DeviceRepairApplyDetailEntity.class);
List<DeviceRepairEntity> deviceRepairEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceRepairEntity.class.getSimpleName()), DeviceRepairEntity.class);
if (CollectionUtil.isNotEmpty(deviceRepairApplyEntities)) {
for (DeviceRepairApplyEntity deviceRepairApplyEntity : deviceRepairApplyEntities) {
deviceRepairApplyEntity.setUpdateTime(null);
@ -2037,6 +2058,54 @@ public class HeartService {
deviceRepairMapper.replaceBatchs(deviceRepairEntities);
}
List<String> syncFiles = JSONUtil.toList(jsonObject.getJSONArray("syncFiles"), String.class);
// if (CollUtil.isNotEmpty(syncFiles)) {
// fileService.download(syncFiles);
// }
if (CollUtil.isNotEmpty(syncFiles)) {
// fileService.download(syncFiles);
idcService.batchDownloadFile(spGetHttp.getIpUrl(), syncFiles.toArray(new String[syncFiles.size()]));
}
}
@Resource
DeviceUpkeepMapper deviceUpkeepMapper;
@Resource
DeviceUpkeepDetailMapper deviceUpkeepDetailMapper;
@Resource
DeviceUpkeepDetailItemMapper deviceUpkeepDetailItemMapper;
/**
* ||
* @param content
*/
@Transactional(propagation = Propagation.NESTED)
public void insertDeviceUpkeepData(String content){
cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(content);
List<DeviceUpkeepEntity> deviceUpkeepEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceUpkeepEntity.class.getSimpleName()), DeviceUpkeepEntity.class);
List<DeviceUpkeepDetailEntity> deviceUpkeepDetailEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceUpkeepDetailEntity.class.getSimpleName()), DeviceUpkeepDetailEntity.class);
List<DeviceUpkeepDetailItemEntity> deviceUpkeepDetailItemEntities = JSONUtil.toList(jsonObject.getJSONArray(DeviceUpkeepDetailItemEntity.class.getSimpleName()), DeviceUpkeepDetailItemEntity.class);
if (CollectionUtil.isNotEmpty(deviceUpkeepEntities)) {
for (DeviceUpkeepEntity entity : deviceUpkeepEntities) {
entity.setUpdateTime(null);
}
deviceUpkeepMapper.replaceBatchs(deviceUpkeepEntities);
}
if (CollectionUtil.isNotEmpty(deviceUpkeepDetailEntities)) {
for (DeviceUpkeepDetailEntity entity : deviceUpkeepDetailEntities) {
entity.setUpdateTime(null);
}
deviceUpkeepDetailMapper.replaceBatchs(deviceUpkeepDetailEntities);
}
if (CollectionUtil.isNotEmpty(deviceUpkeepDetailItemEntities)) {
for (DeviceUpkeepDetailItemEntity entity : deviceUpkeepDetailItemEntities) {
entity.setUpdateTime(null);
}
deviceUpkeepDetailItemMapper.replaceBatchs(deviceUpkeepDetailItemEntities);
}
List<String> syncFiles = JSONUtil.toList(jsonObject.getJSONArray("syncFiles"), String.class);
if (CollUtil.isNotEmpty(syncFiles)) {
fileService.download(syncFiles);
@ -2499,11 +2568,41 @@ public class HeartService {
@Resource
DeviceChangeOrderService deviceChangeOrderService;
@Resource
DeviceCheckService deviceCheckService;
@Resource
DeviceCheckDetailService deviceCheckDetailService;
@Resource
DeviceCheckDetailItemService deviceCheckDetailItemService;
@Resource
DeviceCheckItemDictService deviceCheckItemDictService;
@Resource
DeviceUpkeepService deviceUpkeepService;
@Resource
DeviceUpkeepDetailService deviceUpkeepDetailService;
@Resource
DeviceUpkeepDetailItemService deviceUpkeepDetailItemService;
@Resource
DeviceRepairApplyService deviceRepairApplyService;
@Resource
DeviceRepairApplyDetailService deviceRepairApplyDetailService;
@Resource
DeviceRepairService deviceRepairService;
public SpsSyncDeviceDataResponse getDeviceInfoData(SyncDataSetEntity info, String taskId, Date now, Date syncTime){
SpsSyncDeviceDataResponse dataResponse = null;
Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
syncTimeMap.put("isNew", true);
List<String> list = new ArrayList<>();
boolean ge = false;
if (syncTime != null) {
ge = true;
@ -2527,33 +2626,6 @@ public class HeartService {
remark.append("设备基础信息:").append(deptEntityList.size()).append("条\n");
}
}
if (dataResponse != null) {
dataResponse.setTaskId(taskId);
dataResponse.setType(BasicExportTypeEnum.DEVICE_INFO_DATA.getRemark());
dataResponse.setSyncRemark(remark.toString());
}
log.error("这是第三方数据库的东西 嘿嘿嘿嘿{}",dataResponse);
return dataResponse;
}
@Resource
DeviceCheckService deviceCheckService;
@Resource
DeviceCheckDetailService deviceCheckDetailService;
@Resource
DeviceCheckDetailItemService deviceCheckDetailItemService;
public SpsSyncDeviceDataResponse getDeviceCheckData(SyncDataSetEntity info, String taskId, Date now, Date syncTime){
SpsSyncDeviceDataResponse dataResponse = null;
Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
syncTimeMap.put("isNew", true);
boolean ge = false;
if (syncTime != null) {
ge = true;
}
StringBuffer remark = new StringBuffer();
/**
*
*/
@ -2566,14 +2638,13 @@ public class HeartService {
, map.get("oldDate"), now)
);
if (CollectionUtil.isNotEmpty(deviceCheckEntities)) {
dataResponse = new SpsSyncDeviceDataResponse();
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceDataResponse();
}
dataResponse.setDeviceCheckEntities(deviceCheckEntities);
remark.append("巡检任务信息:").append(deviceCheckEntities.size()).append("条\n");
remark.append("巡检设备数据").append(deviceCheckEntities.size()).append("条\n");
}
}
//巡检任务具体数据 deviceCheckDetail
if (needExec(info.getDeviceCheckDetail())) {
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_CHECK_DETAIL);
List<DeviceCheckDetailEntity> deviceCheckDetailEntities = deviceCheckDetailService.list(Wrappers.lambdaQuery(DeviceCheckDetailEntity.class)
.le(!ge && (boolean) map.get("isNew"), DeviceCheckDetailEntity::getUpdateTime, now)
.between(ge, DeviceCheckDetailEntity::getUpdateTime, syncTime, now)
@ -2585,13 +2656,9 @@ public class HeartService {
dataResponse = new SpsSyncDeviceDataResponse();
}
dataResponse.setDeviceCheckDetailEntities(deviceCheckDetailEntities);
remark.append("巡检设备具体信息").append(deviceCheckDetailEntities.size()).append("条\n");
remark.append("巡检设备具体数据").append(deviceCheckDetailEntities.size()).append("条\n");
}
}
//巡检设备项目表
if (needExec(info.getDeviceCheckDetailItem())) {
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_CHECK_DETAIL_ITEM);
//巡检设备项目表
List<DeviceCheckDetailItemEntity> deviceCheckDetailItemEntities = deviceCheckDetailItemService.list(Wrappers.lambdaQuery(DeviceCheckDetailItemEntity.class)
.le(!ge && (boolean) map.get("isNew"), DeviceCheckDetailItemEntity::getUpdateTime, now)
.between(ge, DeviceCheckDetailItemEntity::getUpdateTime, syncTime, now)
@ -2603,37 +2670,24 @@ public class HeartService {
dataResponse = new SpsSyncDeviceDataResponse();
}
dataResponse.setDeviceCheckDetailItemEntities(deviceCheckDetailItemEntities);
remark.append("巡检设备项目表:").append(deviceCheckDetailItemEntities.size()).append("条\n");
remark.append("巡检设备项目明细表:").append(deviceCheckDetailItemEntities.size()).append("条\n");
}
//巡检设备项目字典表
List<DeviceCheckItemDictEntity> deviceCheckItemDictEntities = deviceCheckItemDictService.list(Wrappers.lambdaQuery(DeviceCheckItemDictEntity.class)
.le(!ge && (boolean) map.get("isNew"), DeviceCheckItemDictEntity::getUpdateTime, now)
.between(ge, DeviceCheckItemDictEntity::getUpdateTime, syncTime, now)
.between(!ge && !(boolean) map.get("isNew"), DeviceCheckItemDictEntity::getUpdateTime
, map.get("oldDate"), now)
);
if (CollectionUtil.isNotEmpty(deviceCheckItemDictEntities)) {
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceDataResponse();
}
dataResponse.setDeviceCheckItemDictEntities(deviceCheckItemDictEntities);
remark.append("巡检设备项目字典表:").append(deviceCheckItemDictEntities.size()).append("条\n");
}
}
if (dataResponse != null) {
dataResponse.setTaskId(taskId);
dataResponse.setType(BasicExportTypeEnum.DEVICE_CHECK_DATA.getRemark());
dataResponse.setSyncRemark(remark.toString());
}
log.error("巡检任务管理的数据zzhzzhzzh{}",dataResponse);
return dataResponse;
}
@Resource
DeviceRepairApplyService deviceRepairApplyService;
@Resource
DeviceRepairApplyDetailService deviceRepairApplyDetailService;
@Resource
DeviceRepairService deviceRepairService;
// 报修表
public SpsSyncDeviceDataResponse getDeviceRepair(SyncDataSetEntity info, String taskId, Date now, Date syncTime){
SpsSyncDeviceDataResponse dataResponse = null;
Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
syncTimeMap.put("isNew", true);
boolean ge = false;
if (syncTime != null) {
ge = true;
}
StringBuffer remark = new StringBuffer();
//确认同步报修单开启
if (needExec(info.getDeviceRepairApply())) {
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_REPAIR_APPLY);
@ -2644,14 +2698,13 @@ public class HeartService {
, map.get("oldDate"), now)
);
if (CollectionUtil.isNotEmpty(deviceRepairApplyEntities)) {
dataResponse = new SpsSyncDeviceDataResponse();
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceDataResponse();
}
dataResponse.setDeviceRepairApplyEntities(deviceRepairApplyEntities);
remark.append("报修单数据:").append(deviceRepairApplyEntities.size()).append("条\n");
}
}
//确认开启报修单明细同步
if (needExec(info.getDeviceRepairDetail())) {
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_REPAIR_APPLY_DETAIL);
//报修单明细数据
List<DeviceRepairApplyDetailEntity> deviceRepairApplyDetailEntities = deviceRepairApplyDetailService.list(Wrappers.lambdaQuery(DeviceRepairApplyDetailEntity.class)
.le(!ge && (boolean) map.get("isNew"), DeviceRepairApplyDetailEntity::getUpdateTime, now)
.between(ge, DeviceRepairApplyDetailEntity::getUpdateTime, syncTime, now)
@ -2664,12 +2717,32 @@ public class HeartService {
}
dataResponse.setDeviceRepairApplyDetailEntities(deviceRepairApplyDetailEntities);
remark.append("报修单明细数据:").append(deviceRepairApplyDetailEntities.size()).append("条\n");
}
}
if (dataResponse != null) {
dataResponse.setTaskId(taskId);
dataResponse.setType(BasicExportTypeEnum.SYS_SET_DATA.getRemark());
dataResponse.setSyncRemark(remark.toString());
if (CollUtil.isNotEmpty(dataResponse.getDeviceRepairApplyDetailEntities())) {
// List<Map<String, String>> list = new ArrayList<>(spsSyncSysSettingResponse.getSystemPDFTemplateEntities().size() * 2);
dataResponse.getDeviceRepairApplyDetailEntities().forEach(deviceRepairApplyDetailEntity -> {
list.add(deviceRepairApplyDetailEntity.getLivePath());
if (deviceRepairApplyDetailEntity.getDiagnosisLivePath() != null){
list.add(deviceRepairApplyDetailEntity.getDiagnosisLivePath());
}
log.error("当前数据接受到的报修单明细list{}",list);
// BaseResponse<String> response = spGetHttp.postTemplateFile(list);
// if (response.getCode() == 20000) {
// log.error("图片列表上传成功");
//// uploadFileLog = "\n模板文件列表上传成功";
// } else {
// log.info("模板文件上传失败,响应信息:{}", response.getMessage());
//// uploadFileLog = "\n模板文件列表上传失败错误信息" + response.getMessage();
// }
});
//确认开启维修单同步
if (needExec(info.getDeviceRepair())) {
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_REPAIR);
}
}
}
//维修单数据
List<DeviceRepairEntity> deviceRepairEntities = deviceRepairService.list(Wrappers.lambdaQuery(DeviceRepairEntity.class)
.le(!ge && (boolean) map.get("isNew"), DeviceRepairEntity::getUpdateTime, now)
.between(ge, DeviceRepairEntity::getUpdateTime, syncTime, now)
@ -2682,19 +2755,274 @@ public class HeartService {
}
dataResponse.setDeviceRepairEntities(deviceRepairEntities);
remark.append("维修单数据:").append(deviceRepairEntities.size()).append("条\n");
dataResponse.getDeviceRepairEntities().forEach(deviceRepair -> {
list.add(deviceRepair.getLivePath());
if (deviceRepair.getDiagnosisLivePath() != null){
list.add(deviceRepair.getDiagnosisLivePath());
}
if (deviceRepair.getServiceLivePath() != null){
list.add(deviceRepair.getServiceLivePath());
}
log.error("当前数据接受到的维修单list{}",list);
BaseResponse<String> response = spGetHttp.postTemplateFile(list);
if (response.getCode() == 20000) {
log.error("图片列表上传成功");
// uploadFileLog = "\n模板文件列表上传成功";
} else {
log.info("模板文件上传失败,响应信息:{}", response.getMessage());
// uploadFileLog = "\n模板文件列表上传失败错误信息" + response.getMessage();
}
});
}
}
//确认开启同步保养单
if (needExec(info.getDeviceUpkeep())) {
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_UPKEEP_DATA);
List<DeviceUpkeepEntity> deviceUpkeepEntities = deviceUpkeepService.list(Wrappers.lambdaQuery(DeviceUpkeepEntity.class)
.le(!ge && (boolean) map.get("isNew"), DeviceUpkeepEntity::getUpdateTime, now)
.between(ge, DeviceUpkeepEntity::getUpdateTime, syncTime, now)
.between(!ge && !(boolean) map.get("isNew"), DeviceUpkeepEntity::getUpdateTime
, map.get("oldDate"), now)
);
if (CollectionUtil.isNotEmpty(deviceUpkeepEntities)) {
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceDataResponse();
}
dataResponse.setDeviceUpkeepEntities(deviceUpkeepEntities);
remark.append("保养单数据:").append(deviceUpkeepEntities.size()).append("条\n");
}
//保养单明细数据
List<DeviceUpkeepDetailEntity> deviceUpkeepDetailEntities = deviceUpkeepDetailService.list(Wrappers.lambdaQuery(DeviceUpkeepDetailEntity.class)
.le(!ge && (boolean) map.get("isNew"), DeviceUpkeepDetailEntity::getUpdateTime, now)
.between(ge, DeviceUpkeepDetailEntity::getUpdateTime, syncTime, now)
.between(!ge && !(boolean) map.get("isNew"), DeviceUpkeepDetailEntity::getUpdateTime
, map.get("oldDate"), now)
);
if (CollectionUtil.isNotEmpty(deviceUpkeepDetailEntities)) {
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceDataResponse();
}
dataResponse.setDeviceUpkeepDetailEntities(deviceUpkeepDetailEntities);
remark.append("保养单明细数据:").append(deviceUpkeepDetailEntities.size()).append("条\n");
}
//维修单数据
List<DeviceUpkeepDetailItemEntity> deviceUpkeepDetailItemEntities = deviceUpkeepDetailItemService.list(Wrappers.lambdaQuery(DeviceUpkeepDetailItemEntity.class)
.le(!ge && (boolean) map.get("isNew"), DeviceUpkeepDetailItemEntity::getUpdateTime, now)
.between(ge, DeviceUpkeepDetailItemEntity::getUpdateTime, syncTime, now)
.between(!ge && !(boolean) map.get("isNew"), DeviceUpkeepDetailItemEntity::getUpdateTime
, map.get("oldDate"), now)
);
if (CollectionUtil.isNotEmpty(deviceUpkeepDetailItemEntities)) {
if (dataResponse == null) {
dataResponse = new SpsSyncDeviceDataResponse();
}
dataResponse.setDeviceUpkeepDetailItemEntities(deviceUpkeepDetailItemEntities);
remark.append("设备保养项目数据:").append(deviceUpkeepDetailItemEntities.size()).append("条\n");
}
}
if (dataResponse != null) {
dataResponse.setTaskId(taskId);
dataResponse.setType(BasicExportTypeEnum.DEVICE_REPAIR_DATA.getRemark());
dataResponse.setType(BasicExportTypeEnum.DEVICE_INFO_DATA.getRemark());
dataResponse.setSyncRemark(remark.toString());
}
log.error("自主平台服务数据{}",dataResponse);
return dataResponse;
// if (dataResponse != null) {
// dataResponse.setTaskId(taskId);
// dataResponse.setType(BasicExportTypeEnum.SYS_SET_DATA.getRemark());
// dataResponse.setSyncRemark(remark.toString());
// if (CollUtil.isNotEmpty(dataResponse.getSystemPDFTemplateEntities())) {
//// List<Map<String, String>> list = new ArrayList<>(spsSyncSysSettingResponse.getSystemPDFTemplateEntities().size() * 2);
// List<String> list = new ArrayList<>();
// dataResponse.getSystemPDFTemplateEntities().forEach(systemPDFTemplateEntity -> {
// list.add(systemPDFTemplateEntity.getPath());
// });
//
// BaseResponse<String> response = spGetHttp.postTemplateFile(list);
// if (response.getCode() == 20000) {
// log.info("模板文件列表上传成功");
//// uploadFileLog = "\n模板文件列表上传成功";
// } else {
// log.info("模板文件上传失败,响应信息:{}", response.getMessage());
//// uploadFileLog = "\n模板文件列表上传失败错误信息" + response.getMessage();
// }
// }
// }
log.error("这是设备管理数据{}",dataResponse);
return dataResponse;
}
// public SpsSyncDeviceDataResponse getDeviceCheckData(SyncDataSetEntity info, String taskId, Date now, Date syncTime){
// SpsSyncDeviceDataResponse dataResponse = null;
// Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
// syncTimeMap.put("isNew", true);
// boolean ge = false;
// if (syncTime != null) {
// ge = true;
// }
// StringBuffer remark = new StringBuffer();
// /**
// * 确认巡检任务管理开启
// */
// if (needExec(info.getDeviceCheck())) {
// Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_CHECK_DATA);
// List<DeviceCheckEntity> deviceCheckEntities = deviceCheckService.list(Wrappers.lambdaQuery(DeviceCheckEntity.class)
// .le(!ge && (boolean) map.get("isNew"), DeviceCheckEntity::getUpdateTime, now)
// .between(ge, DeviceCheckEntity::getUpdateTime, syncTime, now)
// .between(!ge && !(boolean) map.get("isNew"), DeviceCheckEntity::getUpdateTime
// , map.get("oldDate"), now)
// );
// if (CollectionUtil.isNotEmpty(deviceCheckEntities)) {
// dataResponse = new SpsSyncDeviceDataResponse();
// dataResponse.setDeviceCheckEntities(deviceCheckEntities);
// remark.append("巡检任务信息:").append(deviceCheckEntities.size()).append("条\n");
// }
//
// List<DeviceCheckDetailEntity> deviceCheckDetailEntities = deviceCheckDetailService.list(Wrappers.lambdaQuery(DeviceCheckDetailEntity.class)
// .le(!ge && (boolean) map.get("isNew"), DeviceCheckDetailEntity::getUpdateTime, now)
// .between(ge, DeviceCheckDetailEntity::getUpdateTime, syncTime, now)
// .between(!ge && !(boolean) map.get("isNew"), DeviceCheckDetailEntity::getUpdateTime
// , map.get("oldDate"), now)
// );
// if (CollectionUtil.isNotEmpty(deviceCheckDetailEntities)) {
// if (dataResponse == null) {
// dataResponse = new SpsSyncDeviceDataResponse();
// }
// dataResponse.setDeviceCheckDetailEntities(deviceCheckDetailEntities);
// remark.append("巡检设备具体信息:").append(deviceCheckDetailEntities.size()).append("条\n");
// }
// }
// //巡检任务具体数据 deviceCheckDetail
// Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_CHECK_DETAIL);
// List<DeviceCheckDetailEntity> deviceCheckDetailEntities = deviceCheckDetailService.list(Wrappers.lambdaQuery(DeviceCheckDetailEntity.class)
// .le(!ge && (boolean) map.get("isNew"), DeviceCheckDetailEntity::getUpdateTime, now)
// .between(ge, DeviceCheckDetailEntity::getUpdateTime, syncTime, now)
// .between(!ge && !(boolean) map.get("isNew"), DeviceCheckDetailEntity::getUpdateTime
// , map.get("oldDate"), now)
// );
// if (CollectionUtil.isNotEmpty(deviceCheckDetailEntities)) {
// if (dataResponse == null) {
// dataResponse = new SpsSyncDeviceDataResponse();
// }
// dataResponse.setDeviceCheckDetailEntities(deviceCheckDetailEntities);
// remark.append("巡检设备具体信息:").append(deviceCheckDetailEntities.size()).append("条\n");
// }
//
//
// //巡检设备项目表
//
//// Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_CHECK_DETAIL_ITEM);
// List<DeviceCheckDetailItemEntity> deviceCheckDetailItemEntities = deviceCheckDetailItemService.list(Wrappers.lambdaQuery(DeviceCheckDetailItemEntity.class)
// .le(!ge && (boolean) map.get("isNew"), DeviceCheckDetailItemEntity::getUpdateTime, now)
// .between(ge, DeviceCheckDetailItemEntity::getUpdateTime, syncTime, now)
// .between(!ge && !(boolean) map.get("isNew"), DeviceCheckDetailItemEntity::getUpdateTime
// , map.get("oldDate"), now)
// );
// if (CollectionUtil.isNotEmpty(deviceCheckDetailItemEntities)) {
// if (dataResponse == null) {
// dataResponse = new SpsSyncDeviceDataResponse();
// }
// dataResponse.setDeviceCheckDetailItemEntities(deviceCheckDetailItemEntities);
// remark.append("巡检设备项目表:").append(deviceCheckDetailItemEntities.size()).append("条\n");
// }
//
//
// if (dataResponse != null) {
// dataResponse.setTaskId(taskId);
// dataResponse.setType(BasicExportTypeEnum.DEVICE_CHECK_DATA.getRemark());
// dataResponse.setSyncRemark(remark.toString());
// }
// log.error("巡检任务管理的数据zzhzzhzzh{}",dataResponse);
// return dataResponse;
// }
// @Resource
// DeviceRepairApplyService deviceRepairApplyService;
//
// @Resource
// DeviceRepairApplyDetailService deviceRepairApplyDetailService;
//
// @Resource
// DeviceRepairService deviceRepairService;
// 报修表
// public SpsSyncDeviceDataResponse getDeviceRepair(SyncDataSetEntity info, String taskId, Date now, Date syncTime){
// SpsSyncDeviceDataResponse dataResponse = null;
// Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
// syncTimeMap.put("isNew", true);
// boolean ge = false;
// if (syncTime != null) {
// ge = true;
// }
// StringBuffer remark = new StringBuffer();
// //确认同步报修单开启
// if (needExec(info.getDeviceRepairApply())) {
// Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_REPAIR_APPLY);
// List<DeviceRepairApplyEntity> deviceRepairApplyEntities = deviceRepairApplyService.list(Wrappers.lambdaQuery(DeviceRepairApplyEntity.class)
// .le(!ge && (boolean) map.get("isNew"), DeviceRepairApplyEntity::getUpdateTime, now)
// .between(ge, DeviceRepairApplyEntity::getUpdateTime, syncTime, now)
// .between(!ge && !(boolean) map.get("isNew"), DeviceRepairApplyEntity::getUpdateTime
// , map.get("oldDate"), now)
// );
// if (CollectionUtil.isNotEmpty(deviceRepairApplyEntities)) {
// dataResponse = new SpsSyncDeviceDataResponse();
// dataResponse.setDeviceRepairApplyEntities(deviceRepairApplyEntities);
// remark.append("报修单数据:").append(deviceRepairApplyEntities.size()).append("条\n");
// }
// }
// //确认开启报修单明细同步
// if (needExec(info.getDeviceRepairDetail())) {
// Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_REPAIR_APPLY_DETAIL);
// List<DeviceRepairApplyDetailEntity> deviceRepairApplyDetailEntities = deviceRepairApplyDetailService.list(Wrappers.lambdaQuery(DeviceRepairApplyDetailEntity.class)
// .le(!ge && (boolean) map.get("isNew"), DeviceRepairApplyDetailEntity::getUpdateTime, now)
// .between(ge, DeviceRepairApplyDetailEntity::getUpdateTime, syncTime, now)
// .between(!ge && !(boolean) map.get("isNew"), DeviceRepairApplyDetailEntity::getUpdateTime
// , map.get("oldDate"), now)
// );
// if (CollectionUtil.isNotEmpty(deviceRepairApplyDetailEntities)) {
// if (dataResponse == null) {
// dataResponse = new SpsSyncDeviceDataResponse();
// }
// dataResponse.setDeviceRepairApplyDetailEntities(deviceRepairApplyDetailEntities);
// remark.append("报修单明细数据:").append(deviceRepairApplyDetailEntities.size()).append("条\n");
// }
// }
//
// //确认开启维修单同步
// if (needExec(info.getDeviceRepair())) {
// Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_REPAIR);
// List<DeviceRepairEntity> deviceRepairEntities = deviceRepairService.list(Wrappers.lambdaQuery(DeviceRepairEntity.class)
// .le(!ge && (boolean) map.get("isNew"), DeviceRepairEntity::getUpdateTime, now)
// .between(ge, DeviceRepairEntity::getUpdateTime, syncTime, now)
// .between(!ge && !(boolean) map.get("isNew"), DeviceRepairEntity::getUpdateTime
// , map.get("oldDate"), now)
// );
// if (CollectionUtil.isNotEmpty(deviceRepairEntities)) {
// if (dataResponse == null) {
// dataResponse = new SpsSyncDeviceDataResponse();
// }
// dataResponse.setDeviceRepairEntities(deviceRepairEntities);
// remark.append("维修单数据:").append(deviceRepairEntities.size()).append("条\n");
// }
// }
// if (dataResponse != null) {
// dataResponse.setTaskId(taskId);
// dataResponse.setType(BasicExportTypeEnum.DEVICE_REPAIR_DATA.getRemark());
// dataResponse.setSyncRemark(remark.toString());
// }
// log.error("自主平台服务数据{}",dataResponse);
// return dataResponse;
//
// }
@Resource
ThrManufacturerService thrManufacturerService;
//生产企业
@ -2732,4 +3060,6 @@ public class HeartService {
return dataResponse;
}
}

@ -1,6 +1,7 @@
package com.glxp.api.service.sync;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
@ -15,11 +16,15 @@ import com.glxp.api.entity.sync.SyncEditTypeEntity;
import com.glxp.api.http.sync.SpGetHttpClient;
import com.glxp.api.req.basic.BasicDataRequest;
import com.glxp.api.req.basic.DeleteBasicDataRequest;
import com.glxp.api.req.inout.FilterStatDataRequest;
import com.glxp.api.req.system.DeleteCompanyFileRequest;
import com.glxp.api.req.system.DeleteRequest;
import com.glxp.api.res.inout.IoStatOrderResponse;
import com.glxp.api.service.basic.*;
import com.glxp.api.service.inout.IoOrderService;
import com.glxp.api.service.inout.IoStatOrderService;
import com.glxp.api.service.inout.impl.IoCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@ -28,8 +33,10 @@ import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@Service
@Slf4j
public class SocketMsgService {
@Value("${SPMS_WEBSOCKET_TOKEN}")
@ -204,4 +211,30 @@ public class SocketMsgService {
syncEditTypeService.insertType(syncEditTypeEntity);
}
// if (message.contains(SocketMsgType.STAT_DATA)) {
// cn.hutool.json.JSONObject obj = JSONUtil.parseObj(message);
// String content = obj.getStr("content");
// cn.hutool.json.JSONObject obj1 = JSONUtil.parseObj(content);
// log.error("zaici zhuanhuan :{}",obj1);
// FilterStatDataRequest request = JSONUtil.toBean(obj1.getStr("content"), FilterStatDataRequest.class);
// log.error("hhh:{}",request);
// List<IoStatOrderResponse> ioStatOrderResponses = statOrderService.filterList(request);
// log.error("zuizhong de shujv ",ioStatOrderResponses);
// client.sendMessage(ioStatOrderResponses.toString());
// }
@Resource
IoStatOrderService statOrderService;
public BaseResponse getStatData(String socketMsgEntity){
cn.hutool.json.JSONObject obj = JSONUtil.parseObj(socketMsgEntity);
String content = obj.getStr("content");
cn.hutool.json.JSONObject obj1 = JSONUtil.parseObj(content);
FilterStatDataRequest request = JSONUtil.toBean(content, FilterStatDataRequest.class);
List<IoStatOrderResponse> ioStatOrderResponses = statOrderService.filterList(request);
return ResultVOUtils.success(ioStatOrderResponses);
}
}

@ -2,6 +2,7 @@ package com.glxp.api.service.sync;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.constant.SocketMsgType;
import com.glxp.api.entity.sync.SocketMsgEntity;
import org.java_websocket.WebSocket;
@ -48,6 +49,7 @@ public class SpsWebSocketClient extends WebSocketClient {
log.info("在线日志socket连接成功");
}
@Override
public void onMessage(String s) {
log.info("收到消息:" + s);
@ -56,7 +58,10 @@ public class SpsWebSocketClient extends WebSocketClient {
//收到更新下载数据则赋值由外部处理,多个任务只处理一次避免重复处理
if (socketMsgEntity.getType().equals(SocketMsgType.DL_ALL_DATA)) {
this.excptMessage = s;
} else {
}else if (socketMsgEntity.getType().equals(SocketMsgType.STAT_DATA)){
BaseResponse statData = socketMsgService.getStatData(s);
this.sendMessage(statData.toString());
} else {
//通知类消息则需转发
socketMsgService.dealNoticeMsg(socketMsgEntity);
}

@ -1,11 +1,19 @@
package com.glxp.api.service.sync;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.json.JSONUtil;
import com.glxp.api.config.WebSocketServer;
import com.glxp.api.constant.SocketMsgType;
import com.glxp.api.dao.system.SyncDataSetDao;
import com.glxp.api.dto.RelaySyncDto;
import com.glxp.api.entity.sync.SocketMsgEntity;
import com.glxp.api.entity.system.SyncDataSetEntity;
import com.glxp.api.req.inout.FilterStatDataRequest;
import com.glxp.api.res.inout.IoStatOrderResponse;
import com.glxp.api.service.inout.IoStatOrderService;
import com.glxp.api.service.system.SystemParamConfigService;
import com.glxp.api.task.SyncHeartService;
import com.glxp.api.task.TestStatOrderService;
import lombok.extern.slf4j.Slf4j;
import org.java_websocket.enums.ReadyState;
import org.springframework.beans.factory.annotation.Value;
@ -13,10 +21,12 @@ import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import javax.websocket.Session;
import java.net.URISyntaxException;
import java.util.List;
@Slf4j
//@Component
@Component
public class WebSocketComponent implements CommandLineRunner {
@Value("${SPMS_WEBSOCKET_TOKEN}")
@ -29,6 +39,16 @@ public class WebSocketComponent implements CommandLineRunner {
@Resource
SocketMsgService socketMsgService;
private Session session;
@Resource
WebSocketServer webSocketServer;
@Resource
IoStatOrderService statOrderService;
@Override
public void run(String... args) throws Exception {
ThreadUtil.execAsync(() -> {
@ -58,6 +78,14 @@ public class WebSocketComponent implements CommandLineRunner {
if (message.equals(SocketMsgType.DL_ALL_DATA)) {
heartTaskService.pullData();
}
if (message.contains(SocketMsgType.STAT_DATA)) {
cn.hutool.json.JSONObject obj = JSONUtil.parseObj(message);
String content = obj.getStr("content");
cn.hutool.json.JSONObject obj1 = JSONUtil.parseObj(content);
FilterStatDataRequest request = JSONUtil.toBean(obj1.getStr("content"), FilterStatDataRequest.class);
List<IoStatOrderResponse> ioStatOrderResponses = statOrderService.filterList(request);
client.sendMessage(ioStatOrderResponses.toString());
}
Thread.sleep(500);
//打印服务端返回的数据

@ -431,6 +431,9 @@
<if test="measname != null">
measname=#{measname},
</if>
<if test="bzgg != null">
bzgg=#{bzgg},
</if>
<if test="productType != null">
productType=#{productType},
</if>
@ -650,6 +653,9 @@
<if test="spmc != null">
spmc=#{spmc},
</if>
<if test="bzgg != null">
bzgg=#{bzgg},
</if>
<if test="cplx != null">
cplx=#{cplx},
</if>
@ -785,6 +791,9 @@
<if test="qxlb != null">
qxlb =#{qxlb},
</if>
<if test="bzgg != null">
bzgg =#{bzgg},
</if>
<if test="tyshxydm != null">
tyshxydm=#{tyshxydm},
</if>

@ -333,6 +333,7 @@
basic_products.syqsfxyjxmj,
basic_products.mjfs,
basic_products.categoryName,
basic_products.bzgg,
company_product_relevance.unitFk,
basic_corp.erpId as customerId,
basic_corp.name companyName,
@ -551,6 +552,7 @@
basic_products.sfwwjbz,
basic_products.syqsfxyjxmj,
basic_products.mjfs,
basic_products.bzgg,
basic_products.categoryName,
basic_products.catalogname1,
basic_products.catalogname2,

@ -9,6 +9,7 @@
ip.nameCode,
bp.cpmctymc,
bp.measname,
bp.bzgg,
ip.relIdFk,
bp.ggxh,
ip.batchNo,

@ -15,6 +15,7 @@
ipp.expireDate,
bp.ylqxzcrbarmc,
bp.zczbhhzbapzbh,
bp.bzgg,
ifnull(sum(ipp.inCount), 0) as inCount,
ifnull(sum(ipp.outCount), 0) as outCount,
ipp.inCount - ipp.outCount as reCount,

Loading…
Cancel
Save