派工单

This commit is contained in:
漂泊 2025-12-09 18:17:37 +08:00
parent 056ded0917
commit 9a583337f4
6 changed files with 870 additions and 0 deletions

View File

@ -0,0 +1,105 @@
package com.zhyc.module.work.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.zhyc.module.work.domain.WorkOrder;
import com.zhyc.module.work.service.IWorkOrderService;
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.zhyc.common.annotation.Log;
import com.zhyc.common.core.controller.BaseController;
import com.zhyc.common.core.domain.AjaxResult;
import com.zhyc.common.enums.BusinessType;
import com.zhyc.common.utils.poi.ExcelUtil;
import com.zhyc.common.core.page.TableDataInfo;
/**
* 派工单Controller
*
* @author piaobo
* @date 2025-12-07
*/
@RestController
@RequestMapping("/work/work")
public class WorkOrderController extends BaseController
{
@Autowired
private IWorkOrderService workOrderService;
/**
* 查询派工单列表
*/
@PreAuthorize("@ss.hasPermi('work:work:list')")
@GetMapping("/list")
public TableDataInfo list(WorkOrder workOrder)
{
startPage();
List<WorkOrder> list = workOrderService.selectWorkOrderList(workOrder);
return getDataTable(list);
}
/**
* 导出派工单列表
*/
@PreAuthorize("@ss.hasPermi('work:work:export')")
@Log(title = "派工单", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, WorkOrder workOrder)
{
List<WorkOrder> list = workOrderService.selectWorkOrderList(workOrder);
ExcelUtil<WorkOrder> util = new ExcelUtil<WorkOrder>(WorkOrder.class);
util.exportExcel(response, list, "派工单数据");
}
/**
* 获取派工单详细信息
*/
@PreAuthorize("@ss.hasPermi('work:work:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(workOrderService.selectWorkOrderById(id));
}
/**
* 新增派工单
*/
@PreAuthorize("@ss.hasPermi('work:work:add')")
@Log(title = "派工单", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody WorkOrder workOrder)
{
return toAjax(workOrderService.insertWorkOrder(workOrder));
}
/**
* 修改派工单
*/
@PreAuthorize("@ss.hasPermi('work:work:edit')")
@Log(title = "派工单", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody WorkOrder workOrder)
{
return toAjax(workOrderService.updateWorkOrder(workOrder));
}
/**
* 删除派工单
*/
@PreAuthorize("@ss.hasPermi('work:work:remove')")
@Log(title = "派工单", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(workOrderService.deleteWorkOrderByIds(ids));
}
}

View File

@ -0,0 +1,375 @@
package com.zhyc.module.work.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zhyc.common.annotation.Excel;
import com.zhyc.common.core.domain.BaseEntity;
/**
* 派工单对象 work_order
*
* @author piaobo
* @date 2025-12-07
*/
public class WorkOrder extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 派工单唯一主键,自增整数 */
private Long id;
/** 业务单号 */
@Excel(name = "业务单号")
private String orderNo;
/** 关联生产/免疫计划ID无计划可空 */
@Excel(name = "关联生产/免疫计划ID无计划可空")
private Long planId;
/** 业务类型1免疫 2保健 3转群 4称重 5配种 6干奶 7淘汰 8消毒 9饲喂必填 */
@Excel(name = "业务类型1免疫 2保健 3转群 4称重 5配种 6干奶 7淘汰 8消毒 9饲喂必填")
private Integer bizType;
/** 简短任务标 */
@Excel(name = "简短任务标")
private String title;
/** 任务详细要求及注意事项,可空 */
@Excel(name = "任务详细要求及注意事项,可空")
private String content;
/** 执行部门/班组,下拉选择,必填 */
@Excel(name = "执行部门/班组,下拉选择,必填")
private String department;
/** 执行人ID多人用英文逗号必填 */
@Excel(name = "执行人ID", readConverterExp = "多=人用英文逗号")
private String executorIds;
/** 计划执行日期,必填 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "计划执行日期,必填", width = 30, dateFormat = "yyyy-MM-dd")
private Date executeDate;
/** 计划执行时段,可空 */
@Excel(name = "计划执行时段,可空")
private String executeTime;
/** 涉及羊只范围 */
@Excel(name = "涉及羊只范围")
private String sheepScope;
/** 执行地点/栏舍 */
@Excel(name = "执行地点/栏舍")
private String location;
/** 需领物料 */
@Excel(name = "需领物料")
private String materialList;
/** 需用设备 */
@Excel(name = "需用设备")
private String toolList;
/** 状态0待派工 1已派工 2执行中 3已完成 4已取消 5异常必填 */
@Excel(name = "状态0待派工 1已派工 2执行中 3已完成 4已取消 5异常必填")
private Integer status;
/** 优先级1普通 2重要 3紧急必填 */
@Excel(name = "优先级1普通 2重要 3紧急必填")
private Integer priority;
/** 派工人用户 */
@Excel(name = "派工人用户")
private Long issuerId;
/** 派工时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "派工时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date issueTime;
/** 接工人用户 */
@Excel(name = "接工人用户")
private Long receiverId;
/** 接工时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "接工时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date receiveTime;
/** 实际完成时间,可空 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "实际完成时间,可空", width = 30, dateFormat = "yyyy-MM-dd")
private Date finishTime;
/** 执行结果填报,可空 */
@Excel(name = "执行结果填报,可空")
private String result;
/** 逻辑删除0正常 1已删除必填 */
private Integer deleted;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setOrderNo(String orderNo)
{
this.orderNo = orderNo;
}
public String getOrderNo()
{
return orderNo;
}
public void setPlanId(Long planId)
{
this.planId = planId;
}
public Long getPlanId()
{
return planId;
}
public void setBizType(Integer bizType)
{
this.bizType = bizType;
}
public Integer getBizType()
{
return bizType;
}
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
{
return title;
}
public void setContent(String content)
{
this.content = content;
}
public String getContent()
{
return content;
}
public void setDepartment(String department)
{
this.department = department;
}
public String getDepartment()
{
return department;
}
public void setExecutorIds(String executorIds)
{
this.executorIds = executorIds;
}
public String getExecutorIds()
{
return executorIds;
}
public void setExecuteDate(Date executeDate)
{
this.executeDate = executeDate;
}
public Date getExecuteDate()
{
return executeDate;
}
public void setExecuteTime(String executeTime)
{
this.executeTime = executeTime;
}
public String getExecuteTime()
{
return executeTime;
}
public void setSheepScope(String sheepScope)
{
this.sheepScope = sheepScope;
}
public String getSheepScope()
{
return sheepScope;
}
public void setLocation(String location)
{
this.location = location;
}
public String getLocation()
{
return location;
}
public void setMaterialList(String materialList)
{
this.materialList = materialList;
}
public String getMaterialList()
{
return materialList;
}
public void setToolList(String toolList)
{
this.toolList = toolList;
}
public String getToolList()
{
return toolList;
}
public void setStatus(Integer status)
{
this.status = status;
}
public Integer getStatus()
{
return status;
}
public void setPriority(Integer priority)
{
this.priority = priority;
}
public Integer getPriority()
{
return priority;
}
public void setIssuerId(Long issuerId)
{
this.issuerId = issuerId;
}
public Long getIssuerId()
{
return issuerId;
}
public void setIssueTime(Date issueTime)
{
this.issueTime = issueTime;
}
public Date getIssueTime()
{
return issueTime;
}
public void setReceiverId(Long receiverId)
{
this.receiverId = receiverId;
}
public Long getReceiverId()
{
return receiverId;
}
public void setReceiveTime(Date receiveTime)
{
this.receiveTime = receiveTime;
}
public Date getReceiveTime()
{
return receiveTime;
}
public void setFinishTime(Date finishTime)
{
this.finishTime = finishTime;
}
public Date getFinishTime()
{
return finishTime;
}
public void setResult(String result)
{
this.result = result;
}
public String getResult()
{
return result;
}
public void setDeleted(Integer deleted)
{
this.deleted = deleted;
}
public Integer getDeleted()
{
return deleted;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("orderNo", getOrderNo())
.append("planId", getPlanId())
.append("bizType", getBizType())
.append("title", getTitle())
.append("content", getContent())
.append("department", getDepartment())
.append("executorIds", getExecutorIds())
.append("executeDate", getExecuteDate())
.append("executeTime", getExecuteTime())
.append("sheepScope", getSheepScope())
.append("location", getLocation())
.append("materialList", getMaterialList())
.append("toolList", getToolList())
.append("status", getStatus())
.append("priority", getPriority())
.append("issuerId", getIssuerId())
.append("issueTime", getIssueTime())
.append("receiverId", getReceiverId())
.append("receiveTime", getReceiveTime())
.append("finishTime", getFinishTime())
.append("result", getResult())
.append("remark", getRemark())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("deleted", getDeleted())
.toString();
}
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.work.mapper;
import java.util.List;
import com.zhyc.module.work.domain.WorkOrder;
/**
* 派工单Mapper接口
*
* @author piaobo
* @date 2025-12-07
*/
public interface WorkOrderMapper
{
/**
* 查询派工单
*
* @param id 派工单主键
* @return 派工单
*/
public WorkOrder selectWorkOrderById(Long id);
/**
* 查询派工单列表
*
* @param workOrder 派工单
* @return 派工单集合
*/
public List<WorkOrder> selectWorkOrderList(WorkOrder workOrder);
/**
* 新增派工单
*
* @param workOrder 派工单
* @return 结果
*/
public int insertWorkOrder(WorkOrder workOrder);
/**
* 修改派工单
*
* @param workOrder 派工单
* @return 结果
*/
public int updateWorkOrder(WorkOrder workOrder);
/**
* 删除派工单
*
* @param id 派工单主键
* @return 结果
*/
public int deleteWorkOrderById(Long id);
/**
* 批量删除派工单
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteWorkOrderByIds(Long[] ids);
}

View File

@ -0,0 +1,61 @@
package com.zhyc.module.work.service;
import java.util.List;
import com.zhyc.module.work.domain.WorkOrder;
/**
* 派工单Service接口
*
* @author piaobo
* @date 2025-12-07
*/
public interface IWorkOrderService
{
/**
* 查询派工单
*
* @param id 派工单主键
* @return 派工单
*/
public WorkOrder selectWorkOrderById(Long id);
/**
* 查询派工单列表
*
* @param workOrder 派工单
* @return 派工单集合
*/
public List<WorkOrder> selectWorkOrderList(WorkOrder workOrder);
/**
* 新增派工单
*
* @param workOrder 派工单
* @return 结果
*/
public int insertWorkOrder(WorkOrder workOrder);
/**
* 修改派工单
*
* @param workOrder 派工单
* @return 结果
*/
public int updateWorkOrder(WorkOrder workOrder);
/**
* 批量删除派工单
*
* @param ids 需要删除的派工单主键集合
* @return 结果
*/
public int deleteWorkOrderByIds(Long[] ids);
/**
* 删除派工单信息
*
* @param id 派工单主键
* @return 结果
*/
public int deleteWorkOrderById(Long id);
}

View File

@ -0,0 +1,96 @@
package com.zhyc.module.work.service.impl;
import java.util.List;
import com.zhyc.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zhyc.module.work.mapper.WorkOrderMapper;
import com.zhyc.module.work.domain.WorkOrder;
import com.zhyc.module.work.service.IWorkOrderService;
/**
* 派工单Service业务层处理
*
* @author piaobo
* @date 2025-12-07
*/
@Service
public class WorkOrderServiceImpl implements IWorkOrderService
{
@Autowired
private WorkOrderMapper workOrderMapper;
/**
* 查询派工单
*
* @param id 派工单主键
* @return 派工单
*/
@Override
public WorkOrder selectWorkOrderById(Long id)
{
return workOrderMapper.selectWorkOrderById(id);
}
/**
* 查询派工单列表
*
* @param workOrder 派工单
* @return 派工单
*/
@Override
public List<WorkOrder> selectWorkOrderList(WorkOrder workOrder)
{
return workOrderMapper.selectWorkOrderList(workOrder);
}
/**
* 新增派工单
*
* @param workOrder 派工单
* @return 结果
*/
@Override
public int insertWorkOrder(WorkOrder workOrder)
{
workOrder.setCreateTime(DateUtils.getNowDate());
return workOrderMapper.insertWorkOrder(workOrder);
}
/**
* 修改派工单
*
* @param workOrder 派工单
* @return 结果
*/
@Override
public int updateWorkOrder(WorkOrder workOrder)
{
workOrder.setUpdateTime(DateUtils.getNowDate());
return workOrderMapper.updateWorkOrder(workOrder);
}
/**
* 批量删除派工单
*
* @param ids 需要删除的派工单主键
* @return 结果
*/
@Override
public int deleteWorkOrderByIds(Long[] ids)
{
return workOrderMapper.deleteWorkOrderByIds(ids);
}
/**
* 删除派工单信息
*
* @param id 派工单主键
* @return 结果
*/
@Override
public int deleteWorkOrderById(Long id)
{
return workOrderMapper.deleteWorkOrderById(id);
}
}

View File

@ -0,0 +1,172 @@
<?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.zhyc.module.work.mapper.WorkOrderMapper">
<resultMap type="WorkOrder" id="WorkOrderResult">
<result property="id" column="id" />
<result property="orderNo" column="order_no" />
<result property="planId" column="plan_id" />
<result property="bizType" column="biz_type" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="department" column="department" />
<result property="executorIds" column="executor_ids" />
<result property="executeDate" column="execute_date" />
<result property="executeTime" column="execute_time" />
<result property="sheepScope" column="sheep_scope" />
<result property="location" column="location" />
<result property="materialList" column="material_list" />
<result property="toolList" column="tool_list" />
<result property="status" column="status" />
<result property="priority" column="priority" />
<result property="issuerId" column="issuer_id" />
<result property="issueTime" column="issue_time" />
<result property="receiverId" column="receiver_id" />
<result property="receiveTime" column="receive_time" />
<result property="finishTime" column="finish_time" />
<result property="result" column="result" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="deleted" column="deleted" />
</resultMap>
<sql id="selectWorkOrderVo">
select id, order_no, plan_id, biz_type, title, content, department, executor_ids, execute_date, execute_time, sheep_scope, location, material_list, tool_list, status, priority, issuer_id, issue_time, receiver_id, receive_time, finish_time, result, remark, create_time, update_time, deleted from work_order
</sql>
<select id="selectWorkOrderList" parameterType="WorkOrder" resultMap="WorkOrderResult">
<include refid="selectWorkOrderVo"/>
<where>
<if test="orderNo != null and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
<if test="planId != null "> and plan_id = #{planId}</if>
<if test="bizType != null "> and biz_type = #{bizType}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="department != null and department != ''"> and department = #{department}</if>
<if test="executorIds != null and executorIds != ''"> and executor_ids = #{executorIds}</if>
<if test="executeDate != null "> and execute_date = #{executeDate}</if>
<if test="executeTime != null and executeTime != ''"> and execute_time = #{executeTime}</if>
<if test="sheepScope != null and sheepScope != ''"> and sheep_scope = #{sheepScope}</if>
<if test="location != null and location != ''"> and location = #{location}</if>
<if test="materialList != null and materialList != ''"> and material_list = #{materialList}</if>
<if test="toolList != null and toolList != ''"> and tool_list = #{toolList}</if>
<if test="status != null "> and status = #{status}</if>
<if test="priority != null "> and priority = #{priority}</if>
<if test="issuerId != null "> and issuer_id = #{issuerId}</if>
<if test="issueTime != null "> and issue_time = #{issueTime}</if>
<if test="receiverId != null "> and receiver_id = #{receiverId}</if>
<if test="receiveTime != null "> and receive_time = #{receiveTime}</if>
<if test="finishTime != null "> and finish_time = #{finishTime}</if>
<if test="result != null and result != ''"> and result = #{result}</if>
</where>
</select>
<select id="selectWorkOrderById" parameterType="Long" resultMap="WorkOrderResult">
<include refid="selectWorkOrderVo"/>
where id = #{id}
</select>
<insert id="insertWorkOrder" parameterType="WorkOrder" useGeneratedKeys="true" keyProperty="id">
insert into work_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderNo != null and orderNo != ''">order_no,</if>
<if test="planId != null">plan_id,</if>
<if test="bizType != null">biz_type,</if>
<if test="title != null and title != ''">title,</if>
<if test="content != null">content,</if>
<if test="department != null and department != ''">department,</if>
<if test="executorIds != null and executorIds != ''">executor_ids,</if>
<if test="executeDate != null">execute_date,</if>
<if test="executeTime != null">execute_time,</if>
<if test="sheepScope != null and sheepScope != ''">sheep_scope,</if>
<if test="location != null">location,</if>
<if test="materialList != null">material_list,</if>
<if test="toolList != null">tool_list,</if>
<if test="status != null">status,</if>
<if test="priority != null">priority,</if>
<if test="issuerId != null">issuer_id,</if>
<if test="issueTime != null">issue_time,</if>
<if test="receiverId != null">receiver_id,</if>
<if test="receiveTime != null">receive_time,</if>
<if test="finishTime != null">finish_time,</if>
<if test="result != null">result,</if>
<if test="remark != null">remark,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="deleted != null">deleted,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderNo != null and orderNo != ''">#{orderNo},</if>
<if test="planId != null">#{planId},</if>
<if test="bizType != null">#{bizType},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="content != null">#{content},</if>
<if test="department != null and department != ''">#{department},</if>
<if test="executorIds != null and executorIds != ''">#{executorIds},</if>
<if test="executeDate != null">#{executeDate},</if>
<if test="executeTime != null">#{executeTime},</if>
<if test="sheepScope != null and sheepScope != ''">#{sheepScope},</if>
<if test="location != null">#{location},</if>
<if test="materialList != null">#{materialList},</if>
<if test="toolList != null">#{toolList},</if>
<if test="status != null">#{status},</if>
<if test="priority != null">#{priority},</if>
<if test="issuerId != null">#{issuerId},</if>
<if test="issueTime != null">#{issueTime},</if>
<if test="receiverId != null">#{receiverId},</if>
<if test="receiveTime != null">#{receiveTime},</if>
<if test="finishTime != null">#{finishTime},</if>
<if test="result != null">#{result},</if>
<if test="remark != null">#{remark},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="deleted != null">#{deleted},</if>
</trim>
</insert>
<update id="updateWorkOrder" parameterType="WorkOrder">
update work_order
<trim prefix="SET" suffixOverrides=",">
<if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
<if test="planId != null">plan_id = #{planId},</if>
<if test="bizType != null">biz_type = #{bizType},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null">content = #{content},</if>
<if test="department != null and department != ''">department = #{department},</if>
<if test="executorIds != null and executorIds != ''">executor_ids = #{executorIds},</if>
<if test="executeDate != null">execute_date = #{executeDate},</if>
<if test="executeTime != null">execute_time = #{executeTime},</if>
<if test="sheepScope != null and sheepScope != ''">sheep_scope = #{sheepScope},</if>
<if test="location != null">location = #{location},</if>
<if test="materialList != null">material_list = #{materialList},</if>
<if test="toolList != null">tool_list = #{toolList},</if>
<if test="status != null">status = #{status},</if>
<if test="priority != null">priority = #{priority},</if>
<if test="issuerId != null">issuer_id = #{issuerId},</if>
<if test="issueTime != null">issue_time = #{issueTime},</if>
<if test="receiverId != null">receiver_id = #{receiverId},</if>
<if test="receiveTime != null">receive_time = #{receiveTime},</if>
<if test="finishTime != null">finish_time = #{finishTime},</if>
<if test="result != null">result = #{result},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="deleted != null">deleted = #{deleted},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteWorkOrderById" parameterType="Long">
delete from work_order where id = #{id}
</delete>
<delete id="deleteWorkOrderByIds" parameterType="String">
delete from work_order where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>