6/21 同步优化

dev_ksck_axxyy
wangwei 10 months ago
parent 38aec42f54
commit 7e14b47152

@ -133,13 +133,11 @@ public enum BasicExportStatusTimeEnum {
*/ */
DEVICE_INFO_DATA("device_info", "设备信息数据"), DEVICE_INFO_DATA("device_info", "设备信息数据"),
DEV_CHECK_DATA("device_check","巡检管理数据"), DEV_CHECK_DATA("device_check","巡检管理数据"),
DEV_CHECK_DETAIL("device_check_detail","巡检设备具体数据"),
DEV_CHECK_DETAIL_ITEM("device_check_detail_item","巡检设备项目"),
//getDeviceRepairApply //getDeviceRepairApply
DEV_REPAIR_APPLY("device_repair_apply","报修单数据"), 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", "生产企业数据"), PRODUCE_BUSINESS_DATA("thr_manufacturer", "生产企业数据"),
; ;
@EnumValue @EnumValue

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

@ -20,6 +20,8 @@ public interface SocketMsgType {
String BASIC_CORP_MAINTAIN_DELETE = "BASIC_CORP_MAINTAIN_DELETE"; //供应商字典 String BASIC_CORP_MAINTAIN_DELETE = "BASIC_CORP_MAINTAIN_DELETE"; //供应商字典
String BASIC_BUSINESS_TYPE_DELETE = "BASIC_BUSINESS_TYPE_DELETE"; //单据类型 String BASIC_BUSINESS_TYPE_DELETE = "BASIC_BUSINESS_TYPE_DELETE"; //单据类型
String STAT_DATA_REQUEST = "STAT_DATA_REQUEST"; //
String STAT_DATA = "STAT_DATA"; //

@ -370,6 +370,7 @@ public class UdiRelevanceController extends BaseController {
udiProductEntity.setMatrial(udiRelevanceSaveRequest.getMatrial()); udiProductEntity.setMatrial(udiRelevanceSaveRequest.getMatrial());
udiProductEntity.setRequireScanCode(udiRelevanceSaveRequest.getRequireScanCode()); udiProductEntity.setRequireScanCode(udiRelevanceSaveRequest.getRequireScanCode());
udiProductEntity.setFlbm(udiRelevanceSaveRequest.getFlbm()); udiProductEntity.setFlbm(udiRelevanceSaveRequest.getFlbm());
udiProductEntity.setBzgg(udiRelevanceSaveRequest.getBzgg());
// udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity); // udiProductEntity = UdiInfoUtil.initUdiInfoEntity(udiProductEntity);
if (StrUtil.isNotEmpty(udiRelevanceSaveRequest.getOriginUuid())) { if (StrUtil.isNotEmpty(udiRelevanceSaveRequest.getOriginUuid())) {
udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_UDI); udiProductEntity.setProductType(ConstantStatus.PRODUCT_TYPE_UDI);

@ -0,0 +1,54 @@
package com.glxp.api.controller.inout;
import com.github.pagehelper.PageInfo;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.SocketMsgType;
import com.glxp.api.controller.BaseController;
import com.glxp.api.controller.sync.SpsSyncWebSocket;
import com.glxp.api.entity.sync.SocketMsgEntity;
import com.glxp.api.req.basic.BasicDataRequest;
import com.glxp.api.req.inout.FilterOrderDetailResultRequest;
import com.glxp.api.req.inout.FilterStatDataRequest;
import com.glxp.api.service.inout.IoStatDataService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.net.URLEncoder;
import java.util.List;
/**
* Test
*/
@Slf4j
@RestController
@RequiredArgsConstructor
public class IoStatDataController extends BaseController {
// @Resource
// RestTemplate restTemplate;
@Resource
IoStatDataService ioStatDataService;
@GetMapping("/udiwms/inout/stat/filter")
public void filterList(FilterStatDataRequest statDataRequest) {
ioStatDataService.getData(statDataRequest);
// BasicDataRequest request = webSocketServer.insert(basicDataRequest,userId+"");
// request.setFilterOrderDetailResultRequest(orderDetailResultRequest);
// webSocketServer.sendMessage(SocketMsgEntity.builder().type(SocketMsgType.STAT_DATA_REQUEST).content(request).remark("汇总日报").build(), null);
}
}

@ -40,6 +40,7 @@ import com.glxp.api.req.sync.SyncUpLoadRequest;
import com.glxp.api.res.sync.*; import com.glxp.api.res.sync.*;
import com.glxp.api.service.auth.InvWarehouseService; import com.glxp.api.service.auth.InvWarehouseService;
import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.basic.IBasicBussinessTypeService;
import com.glxp.api.service.dev.DeviceUpkeepService;
import com.glxp.api.service.inout.IoAddInoutService; import com.glxp.api.service.inout.IoAddInoutService;
import com.glxp.api.service.inout.IoCheckInoutService; import com.glxp.api.service.inout.IoCheckInoutService;
import com.glxp.api.service.inout.IoOrderService; import com.glxp.api.service.inout.IoOrderService;
@ -68,6 +69,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.annotation.Resources;
import javax.servlet.ServletOutputStream; import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid; import javax.validation.Valid;
@ -123,6 +125,8 @@ public class SpsSyncDownloadController {
private final InvSpaceDao invSpaceDao; private final InvSpaceDao invSpaceDao;
// 下发单据接口 供给中继服务UDI管理系统下载 // 下发单据接口 供给中继服务UDI管理系统下载
@AuthRuleAnnotation("") @AuthRuleAnnotation("")
@GetMapping("sps/sync/order") @GetMapping("sps/sync/order")
@ -213,6 +217,7 @@ public class SpsSyncDownloadController {
.build(); .build();
} }
} }
// log.error("下发的基础数据是什么呢????????{}",relaySyncResponse);
baseResponse.setCode(ResultEnum.SUCCESS.getCode()); baseResponse.setCode(ResultEnum.SUCCESS.getCode());
baseResponse.setData(relaySyncResponse); baseResponse.setData(relaySyncResponse);
return baseResponse; return baseResponse;
@ -661,6 +666,8 @@ public class SpsSyncDownloadController {
@Resource @Resource
DeviceCheckDetailItemMapper deviceCheckDetailItemMapper; DeviceCheckDetailItemMapper deviceCheckDetailItemMapper;
@Resource @Resource
DeviceCheckItemDictMapper deviceCheckItemDictMapper;
@Resource
DeviceRepairApplyMapper deviceRepairApplyMapper; DeviceRepairApplyMapper deviceRepairApplyMapper;
@Resource @Resource
@ -669,6 +676,15 @@ public class SpsSyncDownloadController {
@Resource @Resource
DeviceRepairMapper deviceRepairMapper; DeviceRepairMapper deviceRepairMapper;
@Resource
DeviceUpkeepMapper deviceUpkeepMapper;
@Resource
DeviceUpkeepDetailMapper deviceUpkeepDetailMapper;
@Resource
DeviceUpkeepDetailItemMapper deviceUpkeepDetailItemMapper;
// 报修表 // 报修表
private void saveUploadDevTaskInfo(SpsSyncDeviceTaskResponse bean) { private void saveUploadDevTaskInfo(SpsSyncDeviceTaskResponse bean) {
@ -699,6 +715,13 @@ public class SpsSyncDownloadController {
boolean b = deviceCheckDetailItemMapper.replaceBatchs(bean.getDeviceCheckDetailItemEntities()); boolean b = deviceCheckDetailItemMapper.replaceBatchs(bean.getDeviceCheckDetailItemEntities());
} }
if (CollectionUtil.isNotEmpty(bean.getDeviceCheckItemDictEntities())) {
for (DeviceCheckItemDictEntity entity : bean.getDeviceCheckItemDictEntities()) {
entity.setUpdateTime(null);
}
boolean b = deviceCheckItemDictMapper.replaceBatchs(bean.getDeviceCheckItemDictEntities());
}
if (CollectionUtil.isNotEmpty(bean.getDeviceRepairApplyEntities())) { if (CollectionUtil.isNotEmpty(bean.getDeviceRepairApplyEntities())) {
for (DeviceRepairApplyEntity entity : bean.getDeviceRepairApplyEntities()) { for (DeviceRepairApplyEntity entity : bean.getDeviceRepairApplyEntities()) {
entity.setUpdateTime(null); entity.setUpdateTime(null);
@ -719,6 +742,30 @@ public class SpsSyncDownloadController {
} }
boolean b = deviceRepairMapper.replaceBatchs(bean.getDeviceRepairEntities()); boolean b = deviceRepairMapper.replaceBatchs(bean.getDeviceRepairEntities());
} }
if (CollectionUtil.isNotEmpty(bean.getDeviceUpkeepEntities())) {
for (DeviceUpkeepEntity entity : bean.getDeviceUpkeepEntities()) {
entity.setUpdateTime(null);
}
boolean b = deviceUpkeepMapper.replaceBatchs(bean.getDeviceUpkeepEntities());
}
if (CollectionUtil.isNotEmpty(bean.getDeviceUpkeepDetailEntities())) {
for (DeviceUpkeepDetailEntity entity : bean.getDeviceUpkeepDetailEntities()) {
entity.setUpdateTime(null);
}
boolean b = deviceUpkeepDetailMapper.replaceBatchs(bean.getDeviceUpkeepDetailEntities());
}
if (CollectionUtil.isNotEmpty(bean.getDeviceUpkeepDetailItemEntities())) {
for (DeviceUpkeepDetailItemEntity entity : bean.getDeviceUpkeepDetailItemEntities()) {
entity.setUpdateTime(null);
}
boolean b = deviceUpkeepDetailItemMapper.replaceBatchs(bean.getDeviceUpkeepDetailItemEntities());
}
} }

@ -107,6 +107,7 @@ public class SpsSyncWebSocket {
if (key.contains(sessionId)) { if (key.contains(sessionId)) {
log.info("推送的消息为:" + key); log.info("推送的消息为:" + key);
value.session.getBasicRemote().sendText(JsonUtils.toJsonString(socketMsgEntity)); value.session.getBasicRemote().sendText(JsonUtils.toJsonString(socketMsgEntity));
log.error("当前发送的数据是{}",JsonUtils.toJsonString(socketMsgEntity));
// List<byte[]> result = ByteArraySplitter.split(message, 64 * 1024); // List<byte[]> result = ByteArraySplitter.split(message, 64 * 1024);
// for (byte[] bytes : result) { // for (byte[] bytes : result) {
// String s = new String(bytes); // String s = new String(bytes);
@ -152,6 +153,12 @@ public class SpsSyncWebSocket {
deleteBasicDataRequest.setName("单据类型设置"); deleteBasicDataRequest.setName("单据类型设置");
basicDataRequest.setDeleteBasicDataRequest(deleteBasicDataRequest); basicDataRequest.setDeleteBasicDataRequest(deleteBasicDataRequest);
break; break;
case "STAT_DATA_REQUEST":
deleteBasicDataRequest.setDataType(basicDataRequest.getKey());
deleteBasicDataRequest.setParam(JSONUtil.toJsonStr(basicDataRequest.getDeleteRequest()) + basicDataRequest.getKey());
deleteBasicDataRequest.setName("汇总日报");
basicDataRequest.setDeleteBasicDataRequest(deleteBasicDataRequest);
break;
default: default:
break; break;
} }

@ -212,6 +212,8 @@ public class ThrProductsController {
udiProductEntity.setYlqxzcrbarmc(thrProductsEntity.getYlqxzcrbarmc()); udiProductEntity.setYlqxzcrbarmc(thrProductsEntity.getYlqxzcrbarmc());
if (StrUtil.isNotEmpty(thrProductsEntity.getCpms())) if (StrUtil.isNotEmpty(thrProductsEntity.getCpms()))
udiProductEntity.setCpms(thrProductsEntity.getCpms()); udiProductEntity.setCpms(thrProductsEntity.getCpms());
if (StrUtil.isNotEmpty(thrProductsEntity.getBzgg()))
udiProductEntity.setBzgg(thrProductsEntity.getBzgg());
// if (StrUtil.isNotEmpty(thrProductsEntity.getStandard())) // if (StrUtil.isNotEmpty(thrProductsEntity.getStandard()))
// udiProductEntity.setGgxh(thrProductsEntity.getStandard()); // udiProductEntity.setGgxh(thrProductsEntity.getStandard());
udiProductService.updateUdiInfo(udiProductEntity); udiProductService.updateUdiInfo(udiProductEntity);

@ -340,6 +340,13 @@ public class BasicProductsEntity {
@TableField(value = "`createUser`") @TableField(value = "`createUser`")
private String createUser; private String createUser;
/**
*
*/
@TableField(value = "bzgg")
private String bzgg;
/** /**
* *
*/ */
@ -514,4 +521,5 @@ public class BasicProductsEntity {
public static final String COL_UPDATEUSER = "updateUser"; public static final String COL_UPDATEUSER = "updateUser";
public static final String COL_REMARK = "remark"; public static final String COL_REMARK = "remark";
public static final String COL_BZGG= "bzgg";
} }

@ -162,5 +162,10 @@ public class UdiProductEntity {
private Integer requireScanCode; private Integer requireScanCode;
/**
*
*/
private String bzgg;
} }

@ -194,5 +194,4 @@ public class DeviceCheckDetailEntity {
*/ */
@TableField(value = "applyId") @TableField(value = "applyId")
private Long applyId; private Long applyId;
} }

@ -29,6 +29,12 @@ public class DeviceCheckEntity {
@TableId(value = "taskId") @TableId(value = "taskId")
private Long taskId; private Long taskId;
/**
*
*/
@TableField(value = "taskBillNo")
private String taskBillNo;
/** /**
* id * id
*/ */
@ -137,4 +143,5 @@ public class DeviceCheckEntity {
@TableField(value = "updateTime") @TableField(value = "updateTime")
private LocalDateTime updateTime; private LocalDateTime updateTime;
} }

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

@ -28,6 +28,12 @@ public class DeviceRepairApplyEntity {
@TableId(value = "id") @TableId(value = "id")
private Long id; private Long id;
/**
*
*/
@TableField(value = "repairApplyBillNo")
private String repairApplyBillNo;
/** /**
* *
*/ */
@ -112,6 +118,13 @@ public class DeviceRepairApplyEntity {
@TableField(value = "confirmPhone") @TableField(value = "confirmPhone")
private String confirmPhone; private String confirmPhone;
/**
* xianchang
*/
@TableField(value = "livePath")
private String livePath;
/** /**
* *
*/ */

@ -29,6 +29,12 @@ public class DeviceRepairEntity {
@TableId(value = "id") @TableId(value = "id")
private Long id; private Long id;
/**
*
*/
@TableField(value = "repairBillNo")
private String repairBillNo;
/** /**
* id * id
*/ */

@ -189,4 +189,5 @@ public class DeviceUpkeepDetailEntity {
@TableField(value = "updateTime") @TableField(value = "updateTime")
private LocalDateTime updateTime; private LocalDateTime updateTime;
} }

@ -29,6 +29,12 @@ public class DeviceUpkeepEntity {
@TableId(value = "taskId") @TableId(value = "taskId")
private Long taskId; private Long taskId;
/**
*
*/
@TableField(value = "taskBillNo")
private String taskBillNo;
/** /**
* id * id
*/ */
@ -136,5 +142,4 @@ public class DeviceUpkeepEntity {
*/ */
@TableField(value = "updateTime") @TableField(value = "updateTime")
private LocalDateTime updateTime; private LocalDateTime updateTime;
} }

@ -72,6 +72,7 @@ public class SyncDataSetEntity {
private int deviceInfo; //设备信息管理 private int deviceInfo; //设备信息管理
private int deviceCheck;//巡检管理 private int deviceCheck;//巡检管理
private int deviceRepairApply;//报修管理 private int deviceRepairApply;//报修管理
private int deviceUpkeep;//设备保养
private int produceBusiness;//生产企业 PRODUCE_BUSINESS_DATA private int produceBusiness;//生产企业 PRODUCE_BUSINESS_DATA

@ -161,6 +161,12 @@ public class ThrProductsEntity {
*/ */
private String price; private String price;
/**
*
*/
private String bzgg;
/** /**
* *
*/ */

@ -54,7 +54,7 @@ public class FileServiceImpl implements FileService {
@Resource @Resource
private IdcService idcService; private IdcService idcService;
private String imagePath = "register/file/image2/"; private String imagePath = "register/file/image2/";
String pdfPath = "pdf/template/"; String pdfPath = "pdf/template";
@Override @Override
public BaseResponse upload(List<String> list) { public BaseResponse upload(List<String> list) {

@ -203,7 +203,7 @@ public class IdcServiceImpl implements IdcService {
} }
} }
private void fetchFailFile(String host) { private void fetchFailFile(String host) {
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
map.put("sql", "select * from idc_file where createTime<date_sub(now(),interval 30 minute) order by createTime"); map.put("sql", "select * from idc_file where createTime<date_sub(now(),interval 30 minute) order by createTime");
@ -225,7 +225,7 @@ public class IdcServiceImpl implements IdcService {
/*未发送重新发送*/ /*未发送重新发送*/
asyncFailTask(map.get("syncIp").toString()); asyncFailTask(map.get("syncIp").toString());
} }
String[] syncTables = TableUtils.syncTables(); String[] syncTables = TableUtils.syncTables();
for (int i = 0; i < syncTables.length; i++) { for (int i = 0; i < syncTables.length; i++) {
String[] tnames = syncTables[i].split("/"); String[] tnames = syncTables[i].split("/");
@ -241,10 +241,10 @@ public class IdcServiceImpl implements IdcService {
} }
} }
/*上传失败重新上传*/ /*上传失败重新上传*/
private void asyncFailTask(String host) { private void asyncFailTask(String host) {
try try
{ {
String filePathSlash = filePath.substring(filePath.length() - 1).equals("/") ? "" : "/"; String filePathSlash = filePath.substring(filePath.length() - 1).equals("/") ? "" : "/";
String sql = "select * from basic_export_status where status='1' and receiveStatus='0' order by updateTime"; String sql = "select * from basic_export_status where status='1' and receiveStatus='0' order by updateTime";
@ -302,10 +302,10 @@ public class IdcServiceImpl implements IdcService {
} }
} }
} catch (Exception ex) { } catch (Exception ex) {
} }
} }
/*数据删除同步*/ /*数据删除同步*/
private void asyncDelete(String tname,boolean isUpload,String syncIp) { private void asyncDelete(String tname,boolean isUpload,String syncIp) {
String[] tnames = tname.split("/"); String[] tnames = tname.split("/");
@ -354,7 +354,7 @@ public class IdcServiceImpl implements IdcService {
try { try {
result = relay("", JSON.toJSONString(msg), null, syncIp); result = relay("", JSON.toJSONString(msg), null, syncIp);
} catch (Exception ex) { } catch (Exception ex) {
} }
if (IDCUtils.isJson(result)) { if (IDCUtils.isJson(result)) {
JSONObject json = JSON.parseObject(result); JSONObject json = JSON.parseObject(result);
@ -362,14 +362,14 @@ public class IdcServiceImpl implements IdcService {
saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total); saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total);
} else { } else {
success = false; success = false;
saveIdcLog(tnames[9], "", tnames[2] + ">" + result, i * limit, total); saveIdcLog(tnames[9], "", tnames[2] + ">" + result, i * limit, total);
} }
} else { } else {
success = false; success = false;
saveIdcLog(tnames[9], "", syncIp + ":" + tnames[2] + ">fail:上传地址未连通", i * limit, total); saveIdcLog(tnames[9], "", syncIp + ":" + tnames[2] + ">fail:上传地址未连通", i * limit, total);
} }
} else { } else {
saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total); saveIdcLog(tnames[9], "", tnames[2] + ">success(delete)", i * limit, total);
} }
@ -717,7 +717,7 @@ public class IdcServiceImpl implements IdcService {
Map<String, Object> whereParams = new HashMap<String, Object>(); Map<String, Object> whereParams = new HashMap<String, Object>();
whereParams.put("sqlWhere", params.get("sqlWhere")); whereParams.put("sqlWhere", params.get("sqlWhere"));
String dataWhere = params.get("dataWhere")!=null ? params.get("dataWhere").toString() : ""; String dataWhere = params.get("dataWhere")!=null ? params.get("dataWhere").toString() : "";
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
String where = DBAUtils.convertWhere(column, whereParams, dataWhere); String where = DBAUtils.convertWhere(column, whereParams, dataWhere);
@ -952,7 +952,7 @@ public class IdcServiceImpl implements IdcService {
private boolean analyToDB(String host, String tableName, String uniqueColumn, String private boolean analyToDB(String host, String tableName, String uniqueColumn, String
filePathColumn, List<Map<String, Object>> list, boolean isUpload) { filePathColumn, List<Map<String, Object>> list, boolean isUpload) {
String tName = DBAUtils.tableRealName(tableName); String tName = DBAUtils.tableRealName(tableName);
String sql = "replace " + tName + "("; String sql = "replace " + tName + "(";
String del = "delete from " + tName + " where "; String del = "delete from " + tName + " where ";
@ -1467,7 +1467,7 @@ public class IdcServiceImpl implements IdcService {
} }
private void executeSql(String sql) { private void executeSql(String sql) {
try { try {
jdbcTemplate.execute(sql); jdbcTemplate.execute(sql);
@ -1478,4 +1478,4 @@ public class IdcServiceImpl implements IdcService {
} }
} }

@ -2,6 +2,8 @@ package com.glxp.api.req.basic;
import com.glxp.api.entity.dev.DeviceInfoEntity; import com.glxp.api.entity.dev.DeviceInfoEntity;
import com.glxp.api.entity.inv.DeviceInspectTaskEntity; import com.glxp.api.entity.inv.DeviceInspectTaskEntity;
import com.glxp.api.req.inout.FilterOrderDetailResultRequest;
import com.glxp.api.req.inout.FilterStatDataRequest;
import com.glxp.api.req.system.DeleteCompanyFileRequest; import com.glxp.api.req.system.DeleteCompanyFileRequest;
import com.glxp.api.req.system.DeleteRequest; import com.glxp.api.req.system.DeleteRequest;
import lombok.Data; import lombok.Data;
@ -30,6 +32,9 @@ public class BasicDataRequest {
private DeviceInfoEntity deleteDeviceInfoEntity; private DeviceInfoEntity deleteDeviceInfoEntity;
private FilterStatDataRequest filterStatDataRequest;
private FilterOrderDetailResultRequest filterOrderDetailResultRequest;
private String key; private String key;
} }

@ -146,4 +146,9 @@ public class UdiRelevanceSaveRequest {
private String catalogcode; private String catalogcode;
private Integer requireScanCode; private Integer requireScanCode;
/**
*
*/
private String bzgg;
} }

@ -0,0 +1,36 @@
package com.glxp.api.req.inout;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
/**
*
*/
@Data
public class FilterStatDataRequest extends ListPageRequest {
private Integer id;
/**
*
*/
private String recordKey;
/**
* 1:2.3 4
*/
private String type;
/**
*
*/
private String startTime;
/**
*
*/
private String endTime;
private String invCode;
}

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

@ -0,0 +1,18 @@
package com.glxp.api.res.inout;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* @author : zhangsan
* @date : 2024/5/22 17:31
* @modyified By :
*/
@Data
@ApiModel("扫码单据列表信息")
public class IoStatDataResponse {
String code;
String message;
Object data;
}

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

@ -69,6 +69,7 @@ public class SyncDataSetResponse {
private int deviceInfo; //设备信息管理 private int deviceInfo; //设备信息管理
private int deviceCheck;//巡检管理 private int deviceCheck;//巡检管理
private int deviceRepairApply;//报修管理 private int deviceRepairApply;//报修管理
private int deviceUpkeep;//设备保养
private int produceBusiness;//生产企业 PRODUCE_BUSINESS_DATA produceBusiness private int produceBusiness;//生产企业 PRODUCE_BUSINESS_DATA produceBusiness

@ -49,4 +49,9 @@ public class ThrProductsResponse {
private Date updateTime; private Date updateTime;
private String remark; private String remark;
/**
*
*/
private String bzgg;
} }

@ -0,0 +1,37 @@
package com.glxp.api.service.inout;
import com.glxp.api.constant.SocketMsgType;
import com.glxp.api.controller.sync.SpsSyncWebSocket;
import com.glxp.api.entity.sync.SocketMsgEntity;
import com.glxp.api.req.inout.FilterStatDataRequest;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
/**
* @author : zhangsan
* @date : 2024/5/23 15:11
* @modyified By :
*/
@Slf4j
@Service
@RequiredArgsConstructor
public class IoStatDataService {
@Value("${WEBSOCKET_TOKEN}")
private String socketToken;
@Resource
SpsSyncWebSocket spsSyncWebSocket;
public void getData(FilterStatDataRequest statDataRequest) {
//推送
SocketMsgEntity socketMsgEntity = SocketMsgEntity.builder().content(statDataRequest).type(SocketMsgType.STAT_DATA).remark("我胡乱说的").build();
spsSyncWebSocket.sendMessage(socketMsgEntity, "1:" + socketToken);
}
}

@ -264,6 +264,11 @@ public class SpsSyncDownloadService {
, x -> x.generateDeviceRepairFile(info, now, false, syncTime) , x -> x.generateDeviceRepairFile(info, now, false, syncTime)
,x -> x.generateDeviceRepairFile(info, now, true, syncTime)); ,x -> x.generateDeviceRepairFile(info, now, true, syncTime));
break; break;
case DEVICE_UPKEEP_DATA:
basicExportInfoCreate(exportType,syncTime,now
, x -> x.generateDeviceUpkeepFile(info, now, false, syncTime)
,x -> x.generateDeviceUpkeepFile(info, now, true, syncTime));
break;
case PRODUCE_BUSINESS_DATA: case PRODUCE_BUSINESS_DATA:
basicExportInfoCreate(exportType,syncTime,now basicExportInfoCreate(exportType,syncTime,now
, x -> x.generateProBusFile(info, now, false, syncTime) , x -> x.generateProBusFile(info, now, false, syncTime)
@ -880,6 +885,7 @@ public class SpsSyncDownloadService {
} }
} }
if (jsonMap.size() > 0) { if (jsonMap.size() > 0) {
jsonMap.put(SYNC_REMARK, remark.toString()); jsonMap.put(SYNC_REMARK, remark.toString());
if (!createFile) { if (!createFile) {
@ -920,6 +926,9 @@ public class SpsSyncDownloadService {
@Resource @Resource
DeviceCheckDetailItemService deviceCheckDetailItemService; DeviceCheckDetailItemService deviceCheckDetailItemService;
@Resource
DeviceCheckItemDictService deviceCheckItemDictService;
//上传巡检设备信息 到中继服务 供给管理系统拉取 //上传巡检设备信息 到中继服务 供给管理系统拉取
protected boolean generateDeviceCheckFile(SyncDataSetResponse info, Date now, boolean createFile, Date syncTime) { protected boolean generateDeviceCheckFile(SyncDataSetResponse info, Date now, boolean createFile, Date syncTime) {
log.error("巡检设备信息任务"); log.error("巡检设备信息任务");
@ -967,11 +976,24 @@ public class SpsSyncDownloadService {
, map.get("oldDate"), now) , map.get("oldDate"), now)
); );
if (CollectionUtil.isNotEmpty(deviceCheckDetailItemEntities)) { if (CollectionUtil.isNotEmpty(deviceCheckDetailItemEntities)) {
log.error("设备巡检项目信息:"+deviceCheckDetailItemEntities);
remark.append("设备巡检项目信息:").append(deviceCheckDetailItemEntities.size()).append("条\n"); remark.append("设备巡检项目信息:").append(deviceCheckDetailItemEntities.size()).append("条\n");
jsonMap.put(DeviceCheckDetailItemEntity.class.getSimpleName(), deviceCheckDetailItemEntities); jsonMap.put(DeviceCheckDetailItemEntity.class.getSimpleName(), deviceCheckDetailItemEntities);
} }
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)) {
log.error("设备巡检项目字典信息:"+deviceCheckItemDictEntities);
remark.append("设备巡检项目字典信息:").append(deviceCheckItemDictEntities.size()).append("条\n");
jsonMap.put(DeviceCheckItemDictEntity.class.getSimpleName(), deviceCheckItemDictEntities);
}
} }
if (jsonMap.size() > 0) { if (jsonMap.size() > 0) {
jsonMap.put(SYNC_REMARK, remark.toString()); jsonMap.put(SYNC_REMARK, remark.toString());
if (!createFile) { if (!createFile) {
@ -1053,6 +1075,14 @@ public class SpsSyncDownloadService {
if (CollectionUtil.isNotEmpty(deviceRepairApplyDetailEntities)) { if (CollectionUtil.isNotEmpty(deviceRepairApplyDetailEntities)) {
remark.append("设备报修单明细信息:").append(deviceRepairApplyDetailEntities.size()).append("条\n"); remark.append("设备报修单明细信息:").append(deviceRepairApplyDetailEntities.size()).append("条\n");
jsonMap.put(DeviceRepairApplyDetailEntity.class.getSimpleName(), deviceRepairApplyDetailEntities); jsonMap.put(DeviceRepairApplyDetailEntity.class.getSimpleName(), deviceRepairApplyDetailEntities);
for (DeviceRepairApplyDetailEntity entity : deviceRepairApplyDetailEntities) {
if (StrUtil.isNotEmpty(entity.getLivePath())) {
syncFiles.add(entity.getLivePath());
}
if (StrUtil.isNotEmpty(entity.getDiagnosisLivePath())) {
syncFiles.add(entity.getDiagnosisLivePath());
}
}
} }
List<DeviceRepairEntity> deviceRepairEntities = deviceRepairService.list(Wrappers.lambdaQuery(DeviceRepairEntity.class) List<DeviceRepairEntity> deviceRepairEntities = deviceRepairService.list(Wrappers.lambdaQuery(DeviceRepairEntity.class)
.le(!ge && (boolean) map.get("isNew"), DeviceRepairEntity::getUpdateTime, now) .le(!ge && (boolean) map.get("isNew"), DeviceRepairEntity::getUpdateTime, now)
@ -1063,11 +1093,27 @@ public class SpsSyncDownloadService {
if (CollectionUtil.isNotEmpty(deviceRepairEntities)) { if (CollectionUtil.isNotEmpty(deviceRepairEntities)) {
remark.append("设备维修单信息:").append(deviceRepairEntities.size()).append("条\n"); remark.append("设备维修单信息:").append(deviceRepairEntities.size()).append("条\n");
jsonMap.put(DeviceRepairEntity.class.getSimpleName(), deviceRepairEntities); jsonMap.put(DeviceRepairEntity.class.getSimpleName(), deviceRepairEntities);
for (DeviceRepairEntity entity : deviceRepairEntities) {
if (StrUtil.isNotEmpty(entity.getLivePath())) {
syncFiles.add(entity.getLivePath());
}
if (StrUtil.isNotEmpty(entity.getDiagnosisLivePath())) {
syncFiles.add(entity.getDiagnosisLivePath());
}
if (StrUtil.isNotEmpty(entity.getServiceLivePath())) {
syncFiles.add(entity.getServiceLivePath());
}
}
}
log.error("接收到的各种图片集合{}",syncFiles);
if (CollUtil.isNotEmpty(syncFiles)) {
jsonMap.put("syncFiles", syncFiles);
} }
} }
if (jsonMap.size() > 0) { if (jsonMap.size() > 0) {
jsonMap.put(SYNC_REMARK, remark.toString()); jsonMap.put(SYNC_REMARK, remark.toString());
jsonMap.put("syncFiles", syncFiles);
if (!createFile) { if (!createFile) {
return true; return true;
} }
@ -1099,6 +1145,98 @@ public class SpsSyncDownloadService {
} }
@Resource
DeviceUpkeepService deviceUpkeepService;
@Resource
DeviceUpkeepDetailService deviceUpkeepDetailService;
@Resource
DeviceUpkeepDetailItemService deviceUpkeepDetailItemService;
protected boolean generateDeviceUpkeepFile(SyncDataSetResponse info, Date now, boolean createFile, Date syncTime) {
BasicExportTypeEnum exportType = BasicExportTypeEnum.DEVICE_UPKEEP_DATA;
//文件数据
Map<String, Object> jsonMap = new WeakHashMap<>(4);
List<String> syncFiles = new ArrayList<>();
Map<BasicExportStatusTimeEnum, Map<String, Object>> totalTimeMap = new WeakHashMap<>(10);
StringBuffer remark = new StringBuffer();
Map<String, Object> syncTimeMap = new WeakHashMap<>(3);
syncTimeMap.put("isNew", true);
boolean ge = false;
if (syncTime != null) {
ge = true;
}
try {
//确认有开启设备保养信息由外向内同步
if (needExec(info.getDeviceUpkeep())) {
log.error("shebei保养 ");
Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.DEV_UPKEEP_DATA, createFile);
totalTimeMap.put(BasicExportStatusTimeEnum.DEV_UPKEEP_DATA, map);
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)) {
jsonMap.put(DeviceUpkeepEntity.class.getSimpleName(), 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)) {
remark.append("设备保养单明细信息:").append(deviceUpkeepDetailEntities.size()).append("条\n");
jsonMap.put(DeviceUpkeepDetailEntity.class.getSimpleName(), deviceUpkeepDetailEntities);
}
log.error("开始设备保养项目信息");
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)) {
remark.append("设备保养项目信息:").append(deviceUpkeepDetailItemEntities.size()).append("条\n");
jsonMap.put(DeviceUpkeepDetailItemEntity.class.getSimpleName(), deviceUpkeepDetailItemEntities);
}
}
if (jsonMap.size() > 0) {
jsonMap.put(SYNC_REMARK, remark.toString());
if (!createFile) {
return true;
}
try {
String fileFullPath = writeFile(filePath, exportType.getRemark(), JsonUtils.toJsonString(jsonMap));
try {
//修改任务数据
boolean update = updateExportStatus(exportType, fileFullPath, remark.toString());
} catch (Exception e) {
// 异常回滚
this.exportTimeRollback(totalTimeMap, exportType, fileFullPath);
}
SocketMsgEntity socketMsgEntity = SocketMsgEntity.builder().type(SocketMsgType.DL_ALL_DATA).remark("下载设备保养信息").build();
spsSyncWebSocket.sendMessage(socketMsgEntity, "1:" + socketToken);
return true;
} catch (IOException e) {
logger.error(String.format("syncIdcSps----process------------生成[%s]文件及更改库操作异常,异常信息<%s>"
, exportType.getRemark(), e.getMessage()));
// 异常回滚
this.exportTimeRollback(totalTimeMap, exportType, null);
}
}
return false;
} catch (Exception e) {
logger.error(e.getMessage());
return false;
}
}
@Resource @Resource
ThrManufacturerService thrManufacturerService; ThrManufacturerService thrManufacturerService;
// 生产企业 generateProBusFile // 生产企业 generateProBusFile
@ -1146,9 +1284,9 @@ public class SpsSyncDownloadService {
// 异常回滚 // 异常回滚
this.exportTimeRollback(totalTimeMap, exportType, fileFullPath); this.exportTimeRollback(totalTimeMap, exportType, fileFullPath);
} }
// SocketMsgEntity socketMsgEntity = SocketMsgEntity.builder().type(SocketMsgType.STAT_DATA_REQUEST).remark("下载生产企业信息").build();
SocketMsgEntity socketMsgEntity = SocketMsgEntity.builder().type(SocketMsgType.DL_ALL_DATA).remark("下载生产企业信息").build(); SocketMsgEntity socketMsgEntity = SocketMsgEntity.builder().type(SocketMsgType.DL_ALL_DATA).remark("下载生产企业信息").build();
spsSyncWebSocket.sendMessage(socketMsgEntity, "1:" + socketToken); spsSyncWebSocket.sendMessage(socketMsgEntity, "1:" + socketToken);
return true; return true;
} catch (IOException e) { } catch (IOException e) {
logger.error(String.format("syncIdcSps----process------------生成[%s]文件及更改库操作异常,异常信息<%s>" logger.error(String.format("syncIdcSps----process------------生成[%s]文件及更改库操作异常,异常信息<%s>"

@ -529,6 +529,9 @@
<if test="categoryName != null"> <if test="categoryName != null">
categoryName=#{categoryName}, categoryName=#{categoryName},
</if> </if>
<if test="bzgg != null">
bzgg=#{bzgg},
</if>
</trim> </trim>
WHERE nameCode = #{nameCode} WHERE nameCode = #{nameCode}
and uuid = #{uuid} and uuid = #{uuid}
@ -748,6 +751,9 @@
<if test="requireScanCode != null"> <if test="requireScanCode != null">
requireScanCode=#{requireScanCode}, requireScanCode=#{requireScanCode},
</if> </if>
<if test="bzgg != null">
bzgg=#{bzgg},
</if>
</trim> </trim>
where uuid = #{uuid} where uuid = #{uuid}
</update> </update>

@ -471,7 +471,8 @@
basic_products.catalogname2, basic_products.catalogname2,
basic_products.catalogname3, basic_products.catalogname3,
basic_products.matrial, basic_products.matrial,
basic_products.requireScanCode basic_products.requireScanCode,
basic_products.bzgg
FROM basic_products FROM basic_products
inner JOIN basic_udirel inner JOIN basic_udirel

@ -16,6 +16,7 @@
ip.expireDate, ip.expireDate,
bp.ylqxzcrbarmc, bp.ylqxzcrbarmc,
bp.zczbhhzbapzbh, bp.zczbhhzbapzbh,
bp.bzgg,
sum(ip.inCount) as inCount, sum(ip.inCount) as inCount,
sum(ip.outCount) as outCount, sum(ip.outCount) as outCount,
sum(ip.reCount) as reCount, sum(ip.reCount) as reCount,

Loading…
Cancel
Save