唯一码模块1.0

This commit is contained in:
2026-03-17 11:22:05 +08:00
parent 65773de7bf
commit ada7f06004
13 changed files with 586 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
package com.shzg.project.worn.config;//package com.zg.project.wisdom.config;
package com.shzg.project.sensor.config;//package com.zg.project.wisdom.config;
import com.shzg.project.worn.mqtt.dispatcher.MqttMessageDispatcher;
import com.shzg.project.sensor.mqtt.dispatcher.MqttMessageDispatcher;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.*;
import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;

View File

@@ -1,4 +1,4 @@
package com.shzg.project.worn.config;
package com.shzg.project.sensor.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

View File

@@ -1,4 +1,4 @@
package com.shzg.project.worn.config;
package com.shzg.project.sensor.config;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttClient;

View File

@@ -1,8 +1,8 @@
package com.shzg.project.worn.mqtt.dispatcher;
package com.shzg.project.sensor.mqtt.dispatcher;
import com.shzg.project.worn.mqtt.handler.HumiSensorHandler;
import com.shzg.project.worn.mqtt.handler.SmokeSensorHandler;
import com.shzg.project.worn.mqtt.handler.TempSensorHandler;
import com.shzg.project.sensor.mqtt.handler.HumiSensorHandler;
import com.shzg.project.sensor.mqtt.handler.SmokeSensorHandler;
import com.shzg.project.sensor.mqtt.handler.TempSensorHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@@ -1,4 +1,4 @@
package com.shzg.project.worn.mqtt.handler;
package com.shzg.project.sensor.mqtt.handler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

View File

@@ -1,4 +1,4 @@
package com.shzg.project.worn.mqtt.handler;
package com.shzg.project.sensor.mqtt.handler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

View File

@@ -1,4 +1,4 @@
package com.shzg.project.worn.mqtt.handler;
package com.shzg.project.sensor.mqtt.handler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

View File

@@ -0,0 +1,104 @@
package com.shzg.project.unique.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.shzg.framework.aspectj.lang.annotation.Log;
import com.shzg.framework.aspectj.lang.enums.BusinessType;
import com.shzg.project.unique.domain.WornUniqueCode;
import com.shzg.project.unique.service.IWornUniqueCodeService;
import com.shzg.framework.web.controller.BaseController;
import com.shzg.framework.web.domain.AjaxResult;
import com.shzg.common.utils.poi.ExcelUtil;
import com.shzg.framework.web.page.TableDataInfo;
/**
* 唯一码管理Controller
*
* @author shzg
* @date 2026-03-17
*/
@RestController
@RequestMapping("/unique/code")
public class WornUniqueCodeController extends BaseController
{
@Autowired
private IWornUniqueCodeService wornUniqueCodeService;
/**
* 查询唯一码管理列表
*/
@PreAuthorize("@ss.hasPermi('unique:code:list')")
@GetMapping("/list")
public TableDataInfo list(WornUniqueCode wornUniqueCode)
{
startPage();
List<WornUniqueCode> list = wornUniqueCodeService.selectWornUniqueCodeList(wornUniqueCode);
return getDataTable(list);
}
/**
* 导出唯一码管理列表
*/
@PreAuthorize("@ss.hasPermi('unique:code:export')")
@Log(title = "唯一码管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WornUniqueCode wornUniqueCode)
{
List<WornUniqueCode> list = wornUniqueCodeService.selectWornUniqueCodeList(wornUniqueCode);
ExcelUtil<WornUniqueCode> util = new ExcelUtil<WornUniqueCode>(WornUniqueCode.class);
util.exportExcel(response, list, "唯一码管理数据");
}
/**
* 获取唯一码管理详细信息
*/
@PreAuthorize("@ss.hasPermi('unique:code:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(wornUniqueCodeService.selectWornUniqueCodeById(id));
}
/**
* 新增唯一码管理
*/
@PreAuthorize("@ss.hasPermi('unique:code:add')")
@Log(title = "唯一码管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WornUniqueCode wornUniqueCode)
{
return toAjax(wornUniqueCodeService.insertWornUniqueCode(wornUniqueCode));
}
/**
* 修改唯一码管理
*/
@PreAuthorize("@ss.hasPermi('unique:code:edit')")
@Log(title = "唯一码管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WornUniqueCode wornUniqueCode)
{
return toAjax(wornUniqueCodeService.updateWornUniqueCode(wornUniqueCode));
}
/**
* 删除唯一码管理
*/
@PreAuthorize("@ss.hasPermi('unique:code:remove')")
@Log(title = "唯一码管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(wornUniqueCodeService.deleteWornUniqueCodeByIds(ids));
}
}

View File

@@ -0,0 +1,147 @@
package com.shzg.project.unique.domain;
import com.shzg.framework.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.shzg.framework.aspectj.lang.annotation.Excel;
/**
* 唯一码管理对象 worn_unique_code
*
* @author shzg
* @date 2026-03-17
*/
public class WornUniqueCode extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 唯一码编号 */
@Excel(name = "唯一码编号")
private String code;
/** 所属入库单据号 */
@Excel(name = "所属入库单据号")
private String billNo;
/** 项目ID用于数据隔离对应sys_dept.id */
@Excel(name = "项目ID", readConverterExp = "用=于数据隔离对应sys_dept.id")
private Long projectId;
/** 当前状态0已生成 1已打印 2已入库 3已出库 4已配送 */
@Excel(name = "当前状态", readConverterExp = "0=已生成,1=已打印,2=已入库,3=已出库,4=已配送")
private String status;
/** RFID编码 */
@Excel(name = "RFID编码")
private String rfidCode;
/** 打印次数 */
@Excel(name = "打印次数")
private Long printCount;
/** 是否删除0正常 1删除 */
@Excel(name = "是否删除", readConverterExp = "0=正常,1=删除")
private String isDelete;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setCode(String code)
{
this.code = code;
}
public String getCode()
{
return code;
}
public void setBillNo(String billNo)
{
this.billNo = billNo;
}
public String getBillNo()
{
return billNo;
}
public void setProjectId(Long projectId)
{
this.projectId = projectId;
}
public Long getProjectId()
{
return projectId;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setRfidCode(String rfidCode)
{
this.rfidCode = rfidCode;
}
public String getRfidCode()
{
return rfidCode;
}
public void setPrintCount(Long printCount)
{
this.printCount = printCount;
}
public Long getPrintCount()
{
return printCount;
}
public void setIsDelete(String isDelete)
{
this.isDelete = isDelete;
}
public String getIsDelete()
{
return isDelete;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("code", getCode())
.append("billNo", getBillNo())
.append("projectId", getProjectId())
.append("status", getStatus())
.append("rfidCode", getRfidCode())
.append("printCount", getPrintCount())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("isDelete", getIsDelete())
.toString();
}
}

View File

@@ -0,0 +1,61 @@
package com.shzg.project.unique.mapper;
import java.util.List;
import com.shzg.project.unique.domain.WornUniqueCode;
/**
* 唯一码管理Mapper接口
*
* @author shzg
* @date 2026-03-17
*/
public interface WornUniqueCodeMapper
{
/**
* 查询唯一码管理
*
* @param id 唯一码管理主键
* @return 唯一码管理
*/
public WornUniqueCode selectWornUniqueCodeById(Long id);
/**
* 查询唯一码管理列表
*
* @param wornUniqueCode 唯一码管理
* @return 唯一码管理集合
*/
public List<WornUniqueCode> selectWornUniqueCodeList(WornUniqueCode wornUniqueCode);
/**
* 新增唯一码管理
*
* @param wornUniqueCode 唯一码管理
* @return 结果
*/
public int insertWornUniqueCode(WornUniqueCode wornUniqueCode);
/**
* 修改唯一码管理
*
* @param wornUniqueCode 唯一码管理
* @return 结果
*/
public int updateWornUniqueCode(WornUniqueCode wornUniqueCode);
/**
* 删除唯一码管理
*
* @param id 唯一码管理主键
* @return 结果
*/
public int deleteWornUniqueCodeById(Long id);
/**
* 批量删除唯一码管理
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWornUniqueCodeByIds(Long[] ids);
}

View File

@@ -0,0 +1,61 @@
package com.shzg.project.unique.service;
import java.util.List;
import com.shzg.project.unique.domain.WornUniqueCode;
/**
* 唯一码管理Service接口
*
* @author shzg
* @date 2026-03-17
*/
public interface IWornUniqueCodeService
{
/**
* 查询唯一码管理
*
* @param id 唯一码管理主键
* @return 唯一码管理
*/
public WornUniqueCode selectWornUniqueCodeById(Long id);
/**
* 查询唯一码管理列表
*
* @param wornUniqueCode 唯一码管理
* @return 唯一码管理集合
*/
public List<WornUniqueCode> selectWornUniqueCodeList(WornUniqueCode wornUniqueCode);
/**
* 新增唯一码管理
*
* @param wornUniqueCode 唯一码管理
* @return 结果
*/
public int insertWornUniqueCode(WornUniqueCode wornUniqueCode);
/**
* 修改唯一码管理
*
* @param wornUniqueCode 唯一码管理
* @return 结果
*/
public int updateWornUniqueCode(WornUniqueCode wornUniqueCode);
/**
* 批量删除唯一码管理
*
* @param ids 需要删除的唯一码管理主键集合
* @return 结果
*/
public int deleteWornUniqueCodeByIds(Long[] ids);
/**
* 删除唯一码管理信息
*
* @param id 唯一码管理主键
* @return 结果
*/
public int deleteWornUniqueCodeById(Long id);
}

View File

@@ -0,0 +1,96 @@
package com.shzg.project.unique.service.impl;
import java.util.List;
import com.shzg.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.shzg.project.unique.mapper.WornUniqueCodeMapper;
import com.shzg.project.unique.domain.WornUniqueCode;
import com.shzg.project.unique.service.IWornUniqueCodeService;
/**
* 唯一码管理Service业务层处理
*
* @author shzg
* @date 2026-03-17
*/
@Service
public class WornUniqueCodeServiceImpl implements IWornUniqueCodeService
{
@Autowired
private WornUniqueCodeMapper wornUniqueCodeMapper;
/**
* 查询唯一码管理
*
* @param id 唯一码管理主键
* @return 唯一码管理
*/
@Override
public WornUniqueCode selectWornUniqueCodeById(Long id)
{
return wornUniqueCodeMapper.selectWornUniqueCodeById(id);
}
/**
* 查询唯一码管理列表
*
* @param wornUniqueCode 唯一码管理
* @return 唯一码管理
*/
@Override
public List<WornUniqueCode> selectWornUniqueCodeList(WornUniqueCode wornUniqueCode)
{
return wornUniqueCodeMapper.selectWornUniqueCodeList(wornUniqueCode);
}
/**
* 新增唯一码管理
*
* @param wornUniqueCode 唯一码管理
* @return 结果
*/
@Override
public int insertWornUniqueCode(WornUniqueCode wornUniqueCode)
{
wornUniqueCode.setCreateTime(DateUtils.getNowDate());
return wornUniqueCodeMapper.insertWornUniqueCode(wornUniqueCode);
}
/**
* 修改唯一码管理
*
* @param wornUniqueCode 唯一码管理
* @return 结果
*/
@Override
public int updateWornUniqueCode(WornUniqueCode wornUniqueCode)
{
wornUniqueCode.setUpdateTime(DateUtils.getNowDate());
return wornUniqueCodeMapper.updateWornUniqueCode(wornUniqueCode);
}
/**
* 批量删除唯一码管理
*
* @param ids 需要删除的唯一码管理主键
* @return 结果
*/
@Override
public int deleteWornUniqueCodeByIds(Long[] ids)
{
return wornUniqueCodeMapper.deleteWornUniqueCodeByIds(ids);
}
/**
* 删除唯一码管理信息
*
* @param id 唯一码管理主键
* @return 结果
*/
@Override
public int deleteWornUniqueCodeById(Long id)
{
return wornUniqueCodeMapper.deleteWornUniqueCodeById(id);
}
}

View File

@@ -0,0 +1,106 @@
<?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="com.shzg.project.unique.mapper.WornUniqueCodeMapper">
<resultMap type="WornUniqueCode" id="WornUniqueCodeResult">
<result property="id" column="id" />
<result property="code" column="code" />
<result property="billNo" column="bill_no" />
<result property="projectId" column="project_id" />
<result property="status" column="status" />
<result property="rfidCode" column="rfid_code" />
<result property="printCount" column="print_count" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="isDelete" column="is_delete" />
</resultMap>
<sql id="selectWornUniqueCodeVo">
select id, code, bill_no, project_id, status, rfid_code, print_count, create_by, create_time, update_by, update_time, remark, is_delete from worn_unique_code
</sql>
<select id="selectWornUniqueCodeList" parameterType="WornUniqueCode" resultMap="WornUniqueCodeResult">
<include refid="selectWornUniqueCodeVo"/>
<where>
<if test="code != null and code != ''"> and code = #{code}</if>
<if test="billNo != null and billNo != ''"> and bill_no = #{billNo}</if>
<if test="projectId != null "> and project_id = #{projectId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="rfidCode != null and rfidCode != ''"> and rfid_code = #{rfidCode}</if>
<if test="printCount != null "> and print_count = #{printCount}</if>
<if test="isDelete != null and isDelete != ''"> and is_delete = #{isDelete}</if>
</where>
</select>
<select id="selectWornUniqueCodeById" parameterType="Long" resultMap="WornUniqueCodeResult">
<include refid="selectWornUniqueCodeVo"/>
where id = #{id}
</select>
<insert id="insertWornUniqueCode" parameterType="WornUniqueCode" useGeneratedKeys="true" keyProperty="id">
insert into worn_unique_code
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">code,</if>
<if test="billNo != null">bill_no,</if>
<if test="projectId != null">project_id,</if>
<if test="status != null">status,</if>
<if test="rfidCode != null">rfid_code,</if>
<if test="printCount != null">print_count,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="isDelete != null">is_delete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="code != null and code != ''">#{code},</if>
<if test="billNo != null">#{billNo},</if>
<if test="projectId != null">#{projectId},</if>
<if test="status != null">#{status},</if>
<if test="rfidCode != null">#{rfidCode},</if>
<if test="printCount != null">#{printCount},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
<update id="updateWornUniqueCode" parameterType="WornUniqueCode">
update worn_unique_code
<trim prefix="SET" suffixOverrides=",">
<if test="code != null and code != ''">code = #{code},</if>
<if test="billNo != null">bill_no = #{billNo},</if>
<if test="projectId != null">project_id = #{projectId},</if>
<if test="status != null">status = #{status},</if>
<if test="rfidCode != null">rfid_code = #{rfidCode},</if>
<if test="printCount != null">print_count = #{printCount},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isDelete != null">is_delete = #{isDelete},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWornUniqueCodeById" parameterType="Long">
delete from worn_unique_code where id = #{id}
</delete>
<delete id="deleteWornUniqueCodeByIds" parameterType="String">
delete from worn_unique_code where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>