change - add员工上下班记录

main
yinq 5 months ago
parent 629c9f18d2
commit df167fbb8f

@ -45,6 +45,15 @@ public class BaseProcessInfoController extends BaseController {
return getDataTable(list); return getDataTable(list);
} }
/**
*
*/
@GetMapping("/processInfoList")
public AjaxResult processInfoList(BaseProcessInfo baseProcessInfo) {
List<BaseProcessInfo> list = baseProcessInfoService.selectBaseProcessInfoList(baseProcessInfo);
return success(list);
}
/** /**
* *
*/ */

@ -91,6 +91,34 @@ public class BaseTeamMembers extends BaseEntity {
@Excel(name = "机台名称") @Excel(name = "机台名称")
private String machineName; private String machineName;
/**
*
*/
@Excel(name = "工序编号")
private String processCode;
/**
*
*/
@Excel(name = "工序名称")
private String processName;
public String getProcessCode() {
return processCode;
}
public void setProcessCode(String processCode) {
this.processCode = processCode;
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public String getStationName() { public String getStationName() {
return stationName; return stationName;
} }

@ -0,0 +1,100 @@
package com.os.mes.record.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.os.common.annotation.Log;
import com.os.common.core.controller.BaseController;
import com.os.common.core.domain.AjaxResult;
import com.os.common.enums.BusinessType;
import com.os.mes.record.domain.RecordStaffCommute;
import com.os.mes.record.service.IRecordStaffCommuteService;
import com.os.common.utils.poi.ExcelUtil;
import com.os.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-07-01
*/
@RestController
@RequestMapping("/mes/record/recordStaffCommute")
public class RecordStaffCommuteController extends BaseController {
@Autowired
private IRecordStaffCommuteService recordStaffCommuteService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:list')")
@GetMapping("/list")
public TableDataInfo list(RecordStaffCommute recordStaffCommute) {
startPage();
List<RecordStaffCommute> list = recordStaffCommuteService.selectRecordStaffCommuteList(recordStaffCommute);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:export')")
@Log(title = "员工上下班记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RecordStaffCommute recordStaffCommute) {
List<RecordStaffCommute> list = recordStaffCommuteService.selectRecordStaffCommuteList(recordStaffCommute);
ExcelUtil<RecordStaffCommute> util = new ExcelUtil<RecordStaffCommute>(RecordStaffCommute.class);
util.exportExcel(response, list, "员工上下班记录数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
return success(recordStaffCommuteService.selectRecordStaffCommuteByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:add')")
@Log(title = "员工上下班记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody RecordStaffCommute recordStaffCommute) {
recordStaffCommute.setCreateBy(getUsername());
return toAjax(recordStaffCommuteService.insertRecordStaffCommute(recordStaffCommute));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:edit')")
@Log(title = "员工上下班记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody RecordStaffCommute recordStaffCommute) {
recordStaffCommute.setUpdateBy(getUsername());
return toAjax(recordStaffCommuteService.updateRecordStaffCommute(recordStaffCommute));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('mes/record:recordStaffCommute:remove')")
@Log(title = "员工上下班记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(recordStaffCommuteService.deleteRecordStaffCommuteByObjIds(objIds));
}
}

@ -30,7 +30,7 @@ public class RecordStaffSalaryController extends BaseController {
/** /**
* *
* @param recordStaffSalary * @param recordStaffSalary
* @return * @return
*/ */
@ -40,4 +40,6 @@ public class RecordStaffSalaryController extends BaseController {
return success(list); return success(list);
} }
} }

@ -0,0 +1,195 @@
package com.os.mes.record.domain;
import java.math.BigDecimal;
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.os.common.annotation.Excel;
import com.os.common.core.domain.BaseEntity;
/**
* record_staff_commute
*
* @author Yinq
* @date 2024-07-01
*/
public class RecordStaffCommute extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objId;
/**
* ID
*/
@Excel(name = "员工ID")
private String staffId;
/**
*
*/
@Excel(name = "员工名称")
private String staffName;
/**
*
*/
@Excel(name = "班组编号")
private String teamCode;
/**
*
*/
@Excel(name = "班组名称")
private String teamName;
/**
* 1 2 3
*/
@Excel(name = "班次", readConverterExp = "1=早班,2=小夜,3=大夜")
private String classes;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "上班打卡时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date startWorkTime;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "下班打卡时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date endWorkTime;
/**
*
*/
@Excel(name = "在班时长率")
private BigDecimal clockingRatio;
/**
*
*/
@Excel(name = "是否标识")
private String isFlag;
/**
*
*/
@Excel(name = "机台编号")
private String machineCode;
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
public String getTeamName() {
return teamName;
}
public void setTeamName(String teamName) {
this.teamName = teamName;
}
public void setObjId(Long objId) {
this.objId = objId;
}
public Long getObjId() {
return objId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getStaffId() {
return staffId;
}
public void setTeamCode(String teamCode) {
this.teamCode = teamCode;
}
public String getTeamCode() {
return teamCode;
}
public void setClasses(String classes) {
this.classes = classes;
}
public String getClasses() {
return classes;
}
public void setStartWorkTime(Date startWorkTime) {
this.startWorkTime = startWorkTime;
}
public Date getStartWorkTime() {
return startWorkTime;
}
public void setEndWorkTime(Date endWorkTime) {
this.endWorkTime = endWorkTime;
}
public Date getEndWorkTime() {
return endWorkTime;
}
public void setClockingRatio(BigDecimal clockingRatio) {
this.clockingRatio = clockingRatio;
}
public BigDecimal getClockingRatio() {
return clockingRatio;
}
public void setIsFlag(String isFlag) {
this.isFlag = isFlag;
}
public String getIsFlag() {
return isFlag;
}
public void setMachineCode(String machineCode) {
this.machineCode = machineCode;
}
public String getMachineCode() {
return machineCode;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("staffId", getStaffId())
.append("teamCode", getTeamCode())
.append("classes", getClasses())
.append("startWorkTime", getStartWorkTime())
.append("endWorkTime", getEndWorkTime())
.append("clockingRatio", getClockingRatio())
.append("remark", getRemark())
.append("isFlag", getIsFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("machineCode", getMachineCode())
.toString();
}
}

@ -0,0 +1,61 @@
package com.os.mes.record.mapper;
import java.util.List;
import com.os.mes.record.domain.RecordStaffCommute;
/**
* Mapper
*
* @author Yinq
* @date 2024-07-01
*/
public interface RecordStaffCommuteMapper {
/**
*
*
* @param objId
* @return
*/
public RecordStaffCommute selectRecordStaffCommuteByObjId(Long objId);
/**
*
*
* @param recordStaffCommute
* @return
*/
public List<RecordStaffCommute> selectRecordStaffCommuteList(RecordStaffCommute recordStaffCommute);
/**
*
*
* @param recordStaffCommute
* @return
*/
public int insertRecordStaffCommute(RecordStaffCommute recordStaffCommute);
/**
*
*
* @param recordStaffCommute
* @return
*/
public int updateRecordStaffCommute(RecordStaffCommute recordStaffCommute);
/**
*
*
* @param objId
* @return
*/
public int deleteRecordStaffCommuteByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteRecordStaffCommuteByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.os.mes.record.service;
import java.util.List;
import com.os.mes.record.domain.RecordStaffCommute;
/**
* Service
*
* @author Yinq
* @date 2024-07-01
*/
public interface IRecordStaffCommuteService {
/**
*
*
* @param objId
* @return
*/
public RecordStaffCommute selectRecordStaffCommuteByObjId(Long objId);
/**
*
*
* @param recordStaffCommute
* @return
*/
public List<RecordStaffCommute> selectRecordStaffCommuteList(RecordStaffCommute recordStaffCommute);
/**
*
*
* @param recordStaffCommute
* @return
*/
public int insertRecordStaffCommute(RecordStaffCommute recordStaffCommute);
/**
*
*
* @param recordStaffCommute
* @return
*/
public int updateRecordStaffCommute(RecordStaffCommute recordStaffCommute);
/**
*
*
* @param objIds
* @return
*/
public int deleteRecordStaffCommuteByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteRecordStaffCommuteByObjId(Long objId);
}

@ -0,0 +1,90 @@
package com.os.mes.record.service.impl;
import java.util.List;
import com.os.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.os.mes.record.mapper.RecordStaffCommuteMapper;
import com.os.mes.record.domain.RecordStaffCommute;
import com.os.mes.record.service.IRecordStaffCommuteService;
/**
* Service
*
* @author Yinq
* @date 2024-07-01
*/
@Service
public class RecordStaffCommuteServiceImpl implements IRecordStaffCommuteService {
@Autowired
private RecordStaffCommuteMapper recordStaffCommuteMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public RecordStaffCommute selectRecordStaffCommuteByObjId(Long objId) {
return recordStaffCommuteMapper.selectRecordStaffCommuteByObjId(objId);
}
/**
*
*
* @param recordStaffCommute
* @return
*/
@Override
public List<RecordStaffCommute> selectRecordStaffCommuteList(RecordStaffCommute recordStaffCommute) {
return recordStaffCommuteMapper.selectRecordStaffCommuteList(recordStaffCommute);
}
/**
*
*
* @param recordStaffCommute
* @return
*/
@Override
public int insertRecordStaffCommute(RecordStaffCommute recordStaffCommute) {
recordStaffCommute.setCreateTime(DateUtils.getNowDate());
return recordStaffCommuteMapper.insertRecordStaffCommute(recordStaffCommute);
}
/**
*
*
* @param recordStaffCommute
* @return
*/
@Override
public int updateRecordStaffCommute(RecordStaffCommute recordStaffCommute) {
recordStaffCommute.setUpdateTime(DateUtils.getNowDate());
return recordStaffCommuteMapper.updateRecordStaffCommute(recordStaffCommute);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteRecordStaffCommuteByObjIds(Long[] objIds) {
return recordStaffCommuteMapper.deleteRecordStaffCommuteByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteRecordStaffCommuteByObjId(Long objId) {
return recordStaffCommuteMapper.deleteRecordStaffCommuteByObjId(objId);
}
}

@ -22,6 +22,8 @@
<result property="updateTime" column="update_time"/> <result property="updateTime" column="update_time"/>
<result property="machineCode" column="machine_code"/> <result property="machineCode" column="machine_code"/>
<result property="machineName" column="machine_name"/> <result property="machineName" column="machine_name"/>
<result property="processCode" column="process_code"/>
<result property="processName" column="process_name"/>
</resultMap> </resultMap>
<sql id="selectBaseTeamMembersVo"> <sql id="selectBaseTeamMembersVo">
@ -41,10 +43,13 @@
btm.update_by, btm.update_by,
btm.update_time, btm.update_time,
btm.machine_code, btm.machine_code,
bdl.device_name machine_name bdl.device_name machine_name,
btm.process_code,
bpi.process_name
from base_team_members btm from base_team_members btm
left join base_product_line bpl on bpl.product_line_code = btm.station_code left join base_product_line bpl on bpl.product_line_code = btm.station_code
left join base_device_ledger bdl on bdl.device_code = btm.machine_code left join base_device_ledger bdl on bdl.device_code = btm.machine_code
left join base_process_info bpi on btm.process_code = bpi.process_code
</sql> </sql>
<select id="selectBaseTeamMembersList" parameterType="BaseTeamMembers" resultMap="BaseTeamMembersResult"> <select id="selectBaseTeamMembersList" parameterType="BaseTeamMembers" resultMap="BaseTeamMembersResult">
@ -53,6 +58,7 @@
<if test="teamCode != null and teamCode != ''">and btm.team_code = #{teamCode}</if> <if test="teamCode != null and teamCode != ''">and btm.team_code = #{teamCode}</if>
<if test="teamName != null and teamName != ''">and btm.team_name like concat('%', #{teamName}, '%')</if> <if test="teamName != null and teamName != ''">and btm.team_name like concat('%', #{teamName}, '%')</if>
<if test="teamHead != null and teamHead != ''">and btm.team_head = #{teamHead}</if> <if test="teamHead != null and teamHead != ''">and btm.team_head = #{teamHead}</if>
<if test="processCode != null and processCode != ''">and btm.process_code = #{processCode}</if>
<if test="stationCode != null and stationCode != ''">and btm.station_code = #{stationCode}</if> <if test="stationCode != null and stationCode != ''">and btm.station_code = #{stationCode}</if>
<if test="classes != null and classes != ''">and btm.classes = #{classes}</if> <if test="classes != null and classes != ''">and btm.classes = #{classes}</if>
<if test="startTime != null and startTime != ''">and btm.start_time = #{startTime}</if> <if test="startTime != null and startTime != ''">and btm.start_time = #{startTime}</if>
@ -85,6 +91,7 @@
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="machineCode != null">machine_code,</if> <if test="machineCode != null">machine_code,</if>
<if test="processCode != null">process_code,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="teamCode != null">#{teamCode},</if> <if test="teamCode != null">#{teamCode},</if>
@ -101,6 +108,7 @@
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="machineCode != null">#{machineCode},</if> <if test="machineCode != null">#{machineCode},</if>
<if test="processCode != null">#{processCode},</if>
</trim> </trim>
</insert> </insert>
@ -121,6 +129,7 @@
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="machineCode != null">machine_code = #{machineCode},</if> <if test="machineCode != null">machine_code = #{machineCode},</if>
<if test="processCode != null">process_code = #{processCode},</if>
</trim> </trim>
where obj_id = #{objId} where obj_id = #{objId}
</update> </update>

@ -0,0 +1,138 @@
<?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.os.mes.record.mapper.RecordStaffCommuteMapper">
<resultMap type="RecordStaffCommute" id="RecordStaffCommuteResult">
<result property="objId" column="obj_id"/>
<result property="staffId" column="staff_id"/>
<result property="teamCode" column="team_code"/>
<result property="classes" column="classes"/>
<result property="startWorkTime" column="start_work_time"/>
<result property="endWorkTime" column="end_work_time"/>
<result property="clockingRatio" column="clocking_ratio"/>
<result property="remark" column="remark"/>
<result property="isFlag" column="is_flag"/>
<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="machineCode" column="machine_code"/>
<result property="staffName" column="staff_name"/>
<result property="teamName" column="team_name"/>
</resultMap>
<sql id="selectRecordStaffCommuteVo">
select rsc.obj_id,
rsc.staff_id,
bsi.staff_name,
rsc.team_code,
btm.team_name,
rsc.classes,
rsc.start_work_time,
rsc.end_work_time,
rsc.clocking_ratio,
rsc.remark,
rsc.is_flag,
rsc.create_by,
rsc.create_time,
rsc.update_by,
rsc.update_time,
rsc.machine_code
from record_staff_commute rsc
left join base_staff_info bsi on bsi.staff_id = rsc.staff_id
left join base_team_members btm on btm.team_code = rsc.team_code
</sql>
<select id="selectRecordStaffCommuteList" parameterType="RecordStaffCommute" resultMap="RecordStaffCommuteResult">
<include refid="selectRecordStaffCommuteVo"/>
<where>
<if test="staffId != null and staffId != ''">and rsc.staff_id = #{staffId}</if>
<if test="teamCode != null and teamCode != ''">and rsc.team_code = #{teamCode}</if>
<if test="classes != null and classes != ''">and rsc.classes = #{classes}</if>
<if test="params.beginStartWorkTime != null and params.beginStartWorkTime != '' and params.endStartWorkTime != null and params.endStartWorkTime != ''">
and rsc.start_work_time between #{params.beginStartWorkTime} and #{params.endStartWorkTime}
</if>
<if test="params.beginEndWorkTime != null and params.beginEndWorkTime != '' and params.endEndWorkTime != null and params.endEndWorkTime != ''">
and rsc.end_work_time between #{params.beginEndWorkTime} and #{params.endEndWorkTime}
</if>
<if test="clockingRatio != null ">and rsc.clocking_ratio = #{clockingRatio}</if>
<if test="isFlag != null and isFlag != ''">and rsc.is_flag = #{isFlag}</if>
<if test="machineCode != null and machineCode != ''">and rsc.machine_code = #{machineCode}</if>
</where>
</select>
<select id="selectRecordStaffCommuteByObjId" parameterType="Long" resultMap="RecordStaffCommuteResult">
<include refid="selectRecordStaffCommuteVo"/>
where rsc.obj_id = #{objId}
</select>
<insert id="insertRecordStaffCommute" parameterType="RecordStaffCommute" useGeneratedKeys="true"
keyProperty="objId">
insert into record_staff_commute
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="staffId != null and staffId != ''">staff_id,</if>
<if test="teamCode != null">team_code,</if>
<if test="classes != null">classes,</if>
<if test="startWorkTime != null">start_work_time,</if>
<if test="endWorkTime != null">end_work_time,</if>
<if test="clockingRatio != null">clocking_ratio,</if>
<if test="remark != null">remark,</if>
<if test="isFlag != null">is_flag,</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="machineCode != null">machine_code,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="staffId != null and staffId != ''">#{staffId},</if>
<if test="teamCode != null">#{teamCode},</if>
<if test="classes != null">#{classes},</if>
<if test="startWorkTime != null">#{startWorkTime},</if>
<if test="endWorkTime != null">#{endWorkTime},</if>
<if test="clockingRatio != null">#{clockingRatio},</if>
<if test="remark != null">#{remark},</if>
<if test="isFlag != null">#{isFlag},</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="machineCode != null">#{machineCode},</if>
</trim>
</insert>
<update id="updateRecordStaffCommute" parameterType="RecordStaffCommute">
update record_staff_commute
<trim prefix="SET" suffixOverrides=",">
<if test="staffId != null and staffId != ''">staff_id = #{staffId},</if>
<if test="teamCode != null">team_code = #{teamCode},</if>
<if test="classes != null">classes = #{classes},</if>
<if test="startWorkTime != null">start_work_time = #{startWorkTime},</if>
<if test="endWorkTime != null">end_work_time = #{endWorkTime},</if>
<if test="clockingRatio != null">clocking_ratio = #{clockingRatio},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="isFlag != null">is_flag = #{isFlag},</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="machineCode != null">machine_code = #{machineCode},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteRecordStaffCommuteByObjId" parameterType="Long">
delete
from record_staff_commute
where obj_id = #{objId}
</delete>
<delete id="deleteRecordStaffCommuteByObjIds" parameterType="String">
delete from record_staff_commute where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save