Browse Source

钢坯实绩异常数据接收

qiangxuan 2 tuần trước cách đây
mục cha
commit
5812648c8a

+ 172 - 0
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/billetActual/controller/BilletBasicInfoExceptionController.java

@@ -0,0 +1,172 @@
+package org.jeecg.modules.billetActual.controller;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.common.util.oConvertUtils;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import lombok.extern.slf4j.Slf4j;
+
+import org.jeecg.modules.billetActual.entity.BilletBasicInfoException;
+import org.jeecg.modules.billetActual.service.IBilletBasicInfoExceptionService;
+import org.jeecg.common.system.base.controller.JeecgController;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+import com.alibaba.fastjson.JSON;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.jeecg.common.aspect.annotation.AutoLog;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+
+ /**
+ * @Description: 钢坯实绩异常表
+ * @Author: jeecg-boot
+ * @Date:   2025-05-23
+ * @Version: V1.0
+ */
+@Api(tags="钢坯实绩异常表")
+@RestController
+@RequestMapping("/actualControl/billetActual/billetBasicInfoException")
+@Slf4j
+public class BilletBasicInfoExceptionController extends JeecgController<BilletBasicInfoException, IBilletBasicInfoExceptionService> {
+	@Autowired
+	private IBilletBasicInfoExceptionService billetBasicInfoExceptionService;
+	
+	/**
+	 * 分页列表查询
+	 *
+	 * @param billetBasicInfoException
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	//@AutoLog(value = "钢坯实绩异常表-分页列表查询")
+	@ApiOperation(value="钢坯实绩异常表-分页列表查询", notes="钢坯实绩异常表-分页列表查询")
+	@GetMapping(value = "/list")
+	public Result<IPage<BilletBasicInfoException>> queryPageList(BilletBasicInfoException billetBasicInfoException,
+								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+								   HttpServletRequest req) {
+		QueryWrapper<BilletBasicInfoException> queryWrapper = QueryGenerator.initQueryWrapper(billetBasicInfoException, req.getParameterMap());
+		Page<BilletBasicInfoException> page = new Page<BilletBasicInfoException>(pageNo, pageSize);
+		IPage<BilletBasicInfoException> pageList = billetBasicInfoExceptionService.page(page, queryWrapper);
+		return Result.OK(pageList);
+	}
+	
+	/**
+	 *   添加
+	 *
+	 * @param billetBasicInfoException
+	 * @return
+	 */
+	@AutoLog(value = "钢坯实绩异常表-添加")
+	@ApiOperation(value="钢坯实绩异常表-添加", notes="钢坯实绩异常表-添加")
+	@RequiresPermissions("deviceInfosL:billet_basic_info_exception:add")
+	@PostMapping(value = "/add")
+	public Result<String> add(@RequestBody BilletBasicInfoException billetBasicInfoException) {
+		billetBasicInfoExceptionService.save(billetBasicInfoException);
+		return Result.OK("添加成功!");
+	}
+	
+	/**
+	 *  编辑
+	 *
+	 * @param billetBasicInfoException
+	 * @return
+	 */
+	@AutoLog(value = "钢坯实绩异常表-编辑")
+	@ApiOperation(value="钢坯实绩异常表-编辑", notes="钢坯实绩异常表-编辑")
+	@RequiresPermissions("deviceInfosL:billet_basic_info_exception:edit")
+	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
+	public Result<String> edit(@RequestBody BilletBasicInfoException billetBasicInfoException) {
+		billetBasicInfoExceptionService.updateById(billetBasicInfoException);
+		return Result.OK("编辑成功!");
+	}
+	
+	/**
+	 *   通过id删除
+	 *
+	 * @param id
+	 * @return
+	 */
+	@AutoLog(value = "钢坯实绩异常表-通过id删除")
+	@ApiOperation(value="钢坯实绩异常表-通过id删除", notes="钢坯实绩异常表-通过id删除")
+	@RequiresPermissions("deviceInfosL:billet_basic_info_exception:delete")
+	@DeleteMapping(value = "/delete")
+	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
+		billetBasicInfoExceptionService.removeById(id);
+		return Result.OK("删除成功!");
+	}
+	
+	/**
+	 *  批量删除
+	 *
+	 * @param ids
+	 * @return
+	 */
+	@AutoLog(value = "钢坯实绩异常表-批量删除")
+	@ApiOperation(value="钢坯实绩异常表-批量删除", notes="钢坯实绩异常表-批量删除")
+	@RequiresPermissions("deviceInfosL:billet_basic_info_exception:deleteBatch")
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		this.billetBasicInfoExceptionService.removeByIds(Arrays.asList(ids.split(",")));
+		return Result.OK("批量删除成功!");
+	}
+	
+	/**
+	 * 通过id查询
+	 *
+	 * @param id
+	 * @return
+	 */
+	//@AutoLog(value = "钢坯实绩异常表-通过id查询")
+	@ApiOperation(value="钢坯实绩异常表-通过id查询", notes="钢坯实绩异常表-通过id查询")
+	@GetMapping(value = "/queryById")
+	public Result<BilletBasicInfoException> queryById(@RequestParam(name="id",required=true) String id) {
+		BilletBasicInfoException billetBasicInfoException = billetBasicInfoExceptionService.getById(id);
+		if(billetBasicInfoException==null) {
+			return Result.error("未找到对应数据");
+		}
+		return Result.OK(billetBasicInfoException);
+	}
+
+    /**
+    * 导出excel
+    *
+    * @param request
+    * @param billetBasicInfoException
+    */
+    @RequiresPermissions("deviceInfosL:billet_basic_info_exception:exportXls")
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, BilletBasicInfoException billetBasicInfoException) {
+        return super.exportXls(request, billetBasicInfoException, BilletBasicInfoException.class, "钢坯实绩异常表");
+    }
+
+    /**
+      * 通过excel导入数据
+    *
+    * @param request
+    * @param response
+    * @return
+    */
+    @RequiresPermissions("deviceInfosL:billet_basic_info_exception:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, BilletBasicInfoException.class);
+    }
+
+}

+ 237 - 0
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/billetActual/entity/BilletBasicInfoException.java

@@ -0,0 +1,237 @@
+package org.jeecg.modules.billetActual.entity;
+
+import java.io.Serializable;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+import org.jeecg.common.aspect.annotation.Dict;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * @Description: 钢坯实绩异常表
+ * @Author: jeecg-boot
+ * @Date:   2025-05-23
+ * @Version: V1.0
+ */
+@Data
+@TableName("billet_basic_info_exception")
+@Accessors(chain = true)
+@EqualsAndHashCode(callSuper = false)
+@ApiModel(value="billet_basic_info_exception对象", description="钢坯实绩异常表")
+public class BilletBasicInfoException implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    @TableId(type = IdType.ASSIGN_ID)
+    @ApiModelProperty(value = "主键")
+    private String id;
+    /**
+     * 创建人
+     */
+    @ApiModelProperty(value = "创建人")
+    private String createBy;
+    /**
+     * 创建日期
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "创建日期")
+    private Date createTime;
+    /**
+     * 更新人
+     */
+    @ApiModelProperty(value = "更新人")
+    private String updateBy;
+    /**
+     * 更新日期
+     */
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "更新日期")
+    private Date updateTime;
+    /**
+     * 所属部门
+     */
+    @ApiModelProperty(value = "所属部门")
+    private String sysOrgCode;
+    /**
+     * 炉号
+     */
+    @Excel(name = "炉号", width = 15)
+    @ApiModelProperty(value = "炉号", required = true)
+    private String heatNo;
+    /**
+     * 铸机号
+     */
+    @Excel(name = "铸机号", width = 15)
+    @ApiModelProperty(value = "铸机号", required = true)
+    private Integer ccmNo;
+    /**班组*/
+    @Excel(name = "班组", width = 15)
+    @ApiModelProperty(value = "班组")
+    @Dict(dicCode = "lg_bz")
+    private String shiftGroup;
+    /**班别*/
+    @Excel(name = "班别", width = 15)
+    @ApiModelProperty(value = "班别")
+    @Dict(dicCode = "lg_bb")
+    private String shift;
+
+    /**
+     * 流号
+     */
+    @Excel(name = "流号", width = 15)
+    @ApiModelProperty(value = "流号", required = true)
+    private Integer strandNo;
+    /**
+     * 拉速
+     */
+    @Excel(name = "拉速", width = 15)
+    @ApiModelProperty(value = "拉速", required = true)
+    private Double castingSpeed;
+
+    /**
+     * 坯重
+     */
+    @Excel(name = "坯重", width = 15)
+    @ApiModelProperty(value = "坯重", required = true)
+    private Double billetWeight;
+
+    /**
+     * 流号
+     */
+    @Excel(name = "钢包号", width = 15)
+    @ApiModelProperty(value = "钢包号", required = true)
+    private Integer ladleNo;
+    /**
+     * 支号
+     */
+    @Excel(name = "炉内顺序号", width = 15)
+    @ApiModelProperty(value = "炉内顺序号", required = true)
+    private Integer heatnoIndex;
+    /**
+     * 钢种
+     */
+    @Excel(name = "钢种", width = 15)
+    @ApiModelProperty(value = "钢种", required = true)
+    private String grade;
+    /**
+     * 定尺
+     */
+    @Excel(name = "定尺", width = 15)
+    @ApiModelProperty(value = "定尺", required = true)
+    private Integer length;
+    /**
+     * 实际长度
+     */
+    @Excel(name = "实际长度", width = 15)
+    @ApiModelProperty(value = "实际长度", required = true)
+    private Integer actualLength;
+    /**
+     * 宽度
+     */
+    @Excel(name = "宽度", width = 15)
+    @ApiModelProperty(value = "宽度", required = true)
+    private Integer width;
+    /**
+     * 厚度
+     */
+    @Excel(name = "厚度", width = 15)
+    @ApiModelProperty(value = "厚度", required = true)
+    private Integer thickness;
+    /**
+     * 规格
+     */
+    @Excel(name = "规格", width = 15)
+    @ApiModelProperty(value = "规格", required = true)
+    private String spec;
+    /**
+     * 定重
+     */
+    @Excel(name = "定重", width = 15)
+    @ApiModelProperty(value = "定重", required = true)
+    private Double weight;
+    /**
+     * 坯号
+     */
+    @Excel(name = "坯号", width = 15)
+    @ApiModelProperty(value = "坯号", required = true)
+    private String billetNo;
+    /**
+     * 顺序号
+     */
+    @Excel(name = "流内顺序号", width = 15)
+    @ApiModelProperty(value = "流内顺序号", required = true)
+    private Integer strandnoIndex;
+    /**
+     * 开始切割时间
+     */
+    @Excel(name = "开始切割时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "开始切割时间", required = true)
+    private Date cutStartTime;
+    /**
+     * 停止切割时间
+     */
+    @Excel(name = "停止切割时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "停止切割时间", required = true)
+    private Date cutStopTime;
+    /**
+     * 判级结果
+     */
+    @Excel(name = "判级结果", width = 15)
+    @ApiModelProperty(value = "判级结果", required = true)
+    private String ratingsResult;
+
+    /**
+     * 编辑条件
+     */
+    @Excel(name = "编辑条件", width = 15)
+    @ApiModelProperty(value = "编辑条件", required = true)
+    private Integer optype;
+
+    /**所属表*/
+    @Excel(name = "所属表", width = 15)
+    @ApiModelProperty(value = "所属表",required = true)
+    private String belongTable;
+
+    /**堆垛或车位关联id*/
+    @Excel(name = "堆垛或车位关联id", width = 15)
+    @ApiModelProperty(value = "堆垛或车位关联id",required = true)
+    private String stackOrCarId;
+
+    /**目的地*/
+    @Excel(name = "目的地", width = 15)
+    @ApiModelProperty(value = "目的地",required = true)
+    private String bhtcId;
+
+    /**
+     * 组坯号
+     */
+    @Excel(name = "组坯号", width = 15)
+    @ApiModelProperty(value = "组坯号", required = true)
+    private String assemblyNumber;
+
+    /**
+     * 牌号
+     */
+    @Excel(name = "牌号", width = 15)
+    @ApiModelProperty(value = "牌号")
+    private String brandNum;
+}

+ 14 - 0
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/billetActual/mapper/BilletBasicInfoExceptionMapper.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.billetActual.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.billetActual.entity.BilletBasicInfoException;
+
+/**
+ * @Description: 钢坯实绩异常表
+ * @Author: jeecg-boot
+ * @Date:   2025-05-23
+ * @Version: V1.0
+ */
+public interface BilletBasicInfoExceptionMapper extends BaseMapper<BilletBasicInfoException> {
+
+}

+ 5 - 0
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/billetActual/mapper/xml/BilletBasicInfoExceptionMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.billetActual.mapper.BilletBasicInfoExceptionMapper">
+
+</mapper>

+ 15 - 0
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/billetActual/service/IBilletBasicInfoExceptionService.java

@@ -0,0 +1,15 @@
+package org.jeecg.modules.billetActual.service;
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.billetActual.entity.BilletBasicInfo;
+import org.jeecg.modules.billetActual.entity.BilletBasicInfoException;
+
+/**
+ * @Description: 钢坯实绩异常表
+ * @Author: jeecg-boot
+ * @Date:   2025-05-23
+ * @Version: V1.0
+ */
+public interface IBilletBasicInfoExceptionService extends IService<BilletBasicInfoException> {
+
+    void addBilletBasicInfoException(BilletBasicInfo billetBasicInfo);
+}

+ 102 - 0
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/billetActual/service/impl/BilletBasicInfoExceptionServiceImpl.java

@@ -0,0 +1,102 @@
+package org.jeecg.modules.billetActual.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.common.util.oConvertUtils;
+import org.jeecg.modules.billetActual.entity.*;
+import org.jeecg.modules.billetActual.mapper.BilletBasicInfoExceptionMapper;
+import org.jeecg.modules.billetActual.mapper.BilletBasicInfoMapper;
+import org.jeecg.modules.billetActual.mapper.BilletHotsendMapper;
+import org.jeecg.modules.billetActual.mapper.BilletRulerConfigMapper;
+import org.jeecg.modules.billetActual.service.IBilletBasicInfoExceptionService;
+import org.jeecg.modules.billetActual.service.IBilletBasicInfoService;
+import org.jeecg.modules.heatsActuals.entity.HeatsActuals;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import java.util.Date;
+
+/**
+ * @Description: 钢坯实绩异常表
+ * @Author: jeecg-boot
+ * @Date:   2025-05-23
+ * @Version: V1.0
+ */
+@Service
+@Slf4j
+public class BilletBasicInfoExceptionServiceImpl extends ServiceImpl<BilletBasicInfoExceptionMapper, BilletBasicInfoException> implements IBilletBasicInfoExceptionService {
+
+    @Autowired
+    RedisTemplate redisTemplate;
+
+    @Autowired
+    BilletBasicInfoMapper billetBasicInfoMapper;
+
+    @Autowired
+    BilletRulerConfigMapper billetRulerConfigMapper;
+
+    @Override
+    public void addBilletBasicInfoException(BilletBasicInfo billetBasicInfo) {
+        try {
+            log.info("{}{}", "start接收到mqtt钢坯基础<异常>消息,开始保存异常数据:", DateUtils.date2Str(new Date(), DateUtils.datetimeFormat.get()));
+            BilletBasicInfoException billetBasicInfoException = new BilletBasicInfoException();
+            BeanUtils.copyProperties(billetBasicInfo, billetBasicInfoException);
+
+            String classShiftGroup = String.format("class:shift:group:%s", billetBasicInfoException.getCcmNo()); // 班组
+            String classShift = String.format("class:shift:%s", billetBasicInfoException.getCcmNo()); // 班别
+            String brandNum = String.format("billet:basic:info:brand:num:%s", billetBasicInfoException.getCcmNo()); // 牌号
+            String classShiftStr = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShift)) : "";
+            String classShiftGroupStr = !oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(classShiftGroup)) : "";
+            String brandNumStr = !oConvertUtils.getString(redisTemplate.opsForValue().get(brandNum)).isEmpty() ? oConvertUtils.getString(redisTemplate.opsForValue().get(brandNum)) : "";
+            log.info("{}{}", "钢坯实绩异常数据接收时,缓存中的班组班别:", classShiftGroupStr + " " + classShiftStr);
+            // 查询钢坯基础是否存在
+            LambdaQueryWrapper<BilletBasicInfoException> queryWrapper = new LambdaQueryWrapper<BilletBasicInfoException>()
+                    .eq(BilletBasicInfoException::getBilletNo, billetBasicInfoException.getBilletNo())
+                    .eq(BilletBasicInfoException::getCcmNo, billetBasicInfoException.getCcmNo())
+                    .eq(BilletBasicInfoException::getHeatNo, billetBasicInfoException.getHeatNo())
+                    .orderByDesc(BilletBasicInfoException::getCreateTime).last("limit 1");
+            BilletBasicInfoException basicInfoExceptionData = baseMapper.selectOne(queryWrapper);
+            if (oConvertUtils.isNotEmpty(basicInfoExceptionData) && oConvertUtils.isNotEmpty(basicInfoExceptionData.getId())) { // 编辑
+                log.info("{}{}", "更新钢坯实绩异常数据最新一条中的班组班别:", basicInfoExceptionData.getShiftGroup() + " " + basicInfoExceptionData.getShift());
+                // 编辑钢坯基础信息
+                billetBasicInfoException.setId(basicInfoExceptionData.getId());
+                billetBasicInfoException.setBilletWeight(basicInfoExceptionData.getBilletWeight());
+                billetBasicInfoException.setWeight(basicInfoExceptionData.getWeight());
+                billetBasicInfoException.setShift(basicInfoExceptionData.getShift());
+                billetBasicInfoException.setActualLength(basicInfoExceptionData.getActualLength());
+                billetBasicInfoException.setThickness(basicInfoExceptionData.getThickness());
+                billetBasicInfoException.setSpec(basicInfoExceptionData.getSpec());
+                billetBasicInfoException.setGrade(basicInfoExceptionData.getGrade());
+                billetBasicInfoException.setShiftGroup(basicInfoExceptionData.getShiftGroup());
+                baseMapper.updateById(billetBasicInfoException);
+            } else {
+                // 查询定尺规则
+                LambdaQueryWrapper<BilletRulerConfig> queryWrapperbilletRulerConfig = new LambdaQueryWrapper<BilletRulerConfig>()
+                        .eq(BilletRulerConfig::getLength, billetBasicInfo.getLength());
+                BilletRulerConfig billetRulerConfig = billetRulerConfigMapper.selectOne(queryWrapperbilletRulerConfig);
+                Double weight = 0.0;
+                if (oConvertUtils.isEmpty(billetRulerConfig)) {
+                    weight = billetBasicInfo.getWeight();
+                } else {
+                    weight = billetRulerConfig.getWeight();
+                }
+                // 新增数据
+                billetBasicInfo.setBilletWeight(weight);
+                billetBasicInfo.setShift(classShiftStr);
+                billetBasicInfo.setBrandNum(brandNumStr);
+                billetBasicInfo.setShiftGroup(classShiftGroupStr);
+                log.info("{}{}", "新增钢坯实绩异常数据:", billetBasicInfo.getShiftGroup() + " " + billetBasicInfo.getShift());
+                baseMapper.insert(billetBasicInfoException);
+            }
+            log.info("{}{}", "end钢坯实绩<异常>数据逻辑处理结束:", DateUtils.date2Str(new Date(), DateUtils.datetimeFormat.get()));
+        } catch (Exception e) {
+            log.error("自动化处理钢坯实绩异常数据时发生异常", e);
+            throw e;
+        }
+    }
+}

+ 12 - 2
zgzt-sys-java/jeecg-module-conn/src/main/java/org/jeecg/modules/push/utils/MqttClientCallback.java

@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.eclipse.paho.client.mqttv3.*;
 import org.jeecg.common.util.SpringContextHolder;
 import org.jeecg.modules.billetActual.entity.BilletBasicInfo;
+import org.jeecg.modules.billetActual.service.IBilletBasicInfoExceptionService;
 import org.jeecg.modules.billetActual.service.IBilletBasicInfoService;
 import org.jeecg.modules.billetActual.service.IBilletHotsendBaseService;
 import org.jeecg.modules.billetActual.service.IBilletHotsendChangeShiftService;
@@ -52,6 +53,7 @@ public class MqttClientCallback implements MqttCallback, MqttCallbackExtended {
     private IStackingAndLoadingVehiclesService stackingAndLoadingVehiclesService = SpringContextHolder.getBean(IStackingAndLoadingVehiclesService.class);
     private IBilletAssemblyNumberService billetAssemblyNumberService = SpringContextHolder.getBean(IBilletAssemblyNumberService.class);
     private IBilletHotsendChangeShiftService billetHotsendChangeShiftService = SpringContextHolder.getBean(IBilletHotsendChangeShiftService.class);
+    private IBilletBasicInfoExceptionService billetBasicInfoExceptionService = SpringContextHolder.getBean(IBilletBasicInfoExceptionService.class);
 
     private AtomicInteger messageCount = new AtomicInteger(0);
 
@@ -228,8 +230,16 @@ public class MqttClientCallback implements MqttCallback, MqttCallbackExtended {
 
     private void handleBilletBasicInfo(String payload) {
         try {
-            BilletBasicInfo billetBasicInfo = JSON.parseObject(payload, BilletBasicInfo.class);
-            billetBasicInfoService.addC(billetBasicInfo);
+            JSONObject jsonObject = JSON.parseObject(payload);
+            String sign = jsonObject.getString("sign");
+            // sign:"1",正常数据;sign:"2",异常数据
+            if (sign.equals("2")) {
+                BilletBasicInfo billetBasicInfo = JSON.parseObject(payload, BilletBasicInfo.class);
+                billetBasicInfoExceptionService.addBilletBasicInfoException(billetBasicInfo);
+            }else{
+                BilletBasicInfo billetBasicInfo = JSON.parseObject(payload, BilletBasicInfo.class);
+                billetBasicInfoService.addC(billetBasicInfo);
+            }
         } catch (Exception e) {
             log.error("mqtt处理钢坯实绩消息出错", e);
         }

+ 3 - 3
zgzt-sys-java/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml

@@ -172,9 +172,9 @@ spring:
           slow-sql-millis: 5000
       datasource:
         master:
-#          url: jdbc:mysql://192.168.1.53/lg_0416?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
-          url: jdbc:mysql://127.0.0.1/lg?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
-          username: lg
+          url: jdbc:mysql://192.168.1.53/lg_0416?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+#          url: jdbc:mysql://127.0.0.1/lg?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          username: root
           password: 1qaz2wsx@..
           driver-class-name: com.mysql.cj.jdbc.Driver
           # 多数据源配置