人员入场上传
This commit is contained in:
parent
02f86476f2
commit
480407394a
|
|
@ -3,6 +3,7 @@ import com.bonus.bmw.domain.dto.PmWorkerDto;
|
|||
import com.bonus.bmw.domain.vo.BmWorkerContract;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.bmw.domain.vo.PmWorker;
|
||||
import com.bonus.bmw.service.PmWorkerService;
|
||||
import com.bonus.bmw.service.impl.PmWorkerServiceImpl;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
|
@ -31,7 +32,7 @@ public class PmWorkerController extends BaseController {
|
|||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private PmWorkerServiceImpl service;
|
||||
private PmWorkerService service;
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
package com.bonus.bmw.controller;
|
||||
|
||||
import com.bonus.bmw.domain.dto.PmWorkerDto;
|
||||
import com.bonus.bmw.domain.vo.PmWorker;
|
||||
import com.bonus.bmw.service.PmWorkerExitService;
|
||||
import com.bonus.bmw.service.impl.PmWorkerServiceImpl;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
import com.bonus.common.security.annotation.RequiresPermissionsOrInnerAuth;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人员基础信息表(pm_worker)表控制层
|
||||
*
|
||||
* @author xxxxx
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/workerExit")
|
||||
public class PmWorkerExitController extends BaseController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private PmWorkerExitService service;
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
* @param o
|
||||
* @return
|
||||
* , requiresPermissions = @RequiresPermissions("system:workerEin:list")
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth(isUser = false))
|
||||
@GetMapping("/list")
|
||||
@SysLog(title = "人员出场管理", businessType = OperaType.QUERY, logType = 0, module = "施工人员->出入场管理->人员出场管理", details = "查询人员出场列表")
|
||||
public TableDataInfo list(PmWorkerDto o) {
|
||||
try {
|
||||
startPage();
|
||||
List<PmWorker> list = service.selectWorkList(o);
|
||||
return getDataTable(list);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return getDataTableError(new ArrayList<>());
|
||||
}
|
||||
|
||||
//, requiresPermissions = @RequiresPermissions("system:workerExit:exit")
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth)
|
||||
@PostMapping("/exit/{id}")
|
||||
@SysLog(title = "人员出场管理", businessType = OperaType.UPDATE, logType = 0, module = "施工人员->出入场管理->人员出场管理", details = "人员入场")
|
||||
public AjaxResult exit(@PathVariable("id") Integer id) {
|
||||
try {
|
||||
return toAjax(service.updateWorkerExit(id));
|
||||
} catch (Exception e) {
|
||||
logger.error(e.toString(), e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -41,4 +41,6 @@ public interface BmWorkerContractMapper {
|
|||
* @return
|
||||
*/
|
||||
BmWorkerContract selectContractListByWorkerIdAndValid(BmWorkerContract o);
|
||||
|
||||
int deleteByWorkerId(Integer id);
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.bonus.bmw.mapper;
|
|||
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -49,5 +50,5 @@ public interface BmWorkerWageCardMapper {
|
|||
|
||||
int selectWageCardAndContract(Integer id);
|
||||
|
||||
void updateEinMsgByWorkerId(Integer id);
|
||||
void updateEinMsgByWorkerId(@Param("workerId") Integer id,@Param("lightStatus") Integer lightStatus,@Param("lightDate") String lightDate);
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
package com.bonus.bmw.mapper;
|
||||
|
||||
import com.bonus.bmw.domain.dto.PmWorkerDto;
|
||||
import com.bonus.bmw.domain.vo.PmWorker;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface PmWorkerExitMapper {
|
||||
|
||||
/**
|
||||
* 查询人员列表
|
||||
*
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<PmWorker> selectWorkList(PmWorkerDto o);
|
||||
|
||||
/**
|
||||
* 删除实时入场表
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int deleteEinMsgByWorkerId(Integer id);
|
||||
}
|
||||
|
|
@ -70,4 +70,12 @@ public interface PmWorkerMapper {
|
|||
* @return
|
||||
*/
|
||||
int insertEinProRecord(PmWorker record);
|
||||
|
||||
/**
|
||||
* 更新入场记录最新记录标识
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void updateEinRecordLast(Integer id);
|
||||
}
|
||||
|
|
@ -14,6 +14,13 @@ public interface BmWorkerContractService{
|
|||
*/
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
/**
|
||||
* 删除合同
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int deleteByWorkerId(Integer id);
|
||||
|
||||
/**
|
||||
* 修改合同
|
||||
* @param record
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
package com.bonus.bmw.service;
|
||||
|
||||
import com.bonus.bmw.domain.dto.PmWorkerDto;
|
||||
import com.bonus.bmw.domain.vo.PmWorker;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PmWorkerExitService {
|
||||
/**
|
||||
* 查询人员出场列表
|
||||
*
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
List<PmWorker> selectWorkList(PmWorkerDto o);
|
||||
|
||||
/**
|
||||
* 人员出场
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
int updateWorkerExit(Integer id);
|
||||
}
|
||||
|
|
@ -25,6 +25,11 @@ public class BmWorkerContractServiceImpl implements BmWorkerContractService{
|
|||
return mapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByWorkerId(Integer id) {
|
||||
return mapper.deleteByWorkerId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新合同
|
||||
* @param record
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.bmw.mapper.BmWorkerWageCardMapper;
|
||||
import com.bonus.bmw.service.BmWorkerWageCardService;
|
||||
|
|
@ -85,9 +86,15 @@ public class BmWorkerWageCardServiceImpl implements BmWorkerWageCardService {
|
|||
public void updateLightByWorkerId(Integer id) {
|
||||
//查询工资卡和合同是不是存在
|
||||
int i = selectWageCardAndContract(id);
|
||||
//黄灯
|
||||
int lightStatus = 1;
|
||||
String now = DateUtil.now();
|
||||
if(i==2){
|
||||
mapper.updateEinMsgByWorkerId(id);
|
||||
//变为绿灯
|
||||
lightStatus = 2;
|
||||
now = "";
|
||||
}
|
||||
mapper.updateEinMsgByWorkerId(id, lightStatus, now);
|
||||
}
|
||||
|
||||
private int selectWageCardAndContract(Integer id) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
package com.bonus.bmw.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.bonus.bmw.domain.dto.PmWorkerDto;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerContract;
|
||||
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
|
||||
import com.bonus.bmw.domain.vo.PmWorker;
|
||||
import com.bonus.bmw.mapper.PmWorkerExitMapper;
|
||||
import com.bonus.bmw.mapper.PmWorkerMapper;
|
||||
import com.bonus.bmw.service.BmWorkerContractService;
|
||||
import com.bonus.bmw.service.BmWorkerWageCardService;
|
||||
import com.bonus.bmw.service.PmWorkerExitService;
|
||||
import com.bonus.bmw.service.PmWorkerService;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class PmWorkerExitServiceImpl implements PmWorkerExitService {
|
||||
|
||||
@Autowired
|
||||
private PmWorkerExitMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private BmWorkerContractService contractService;
|
||||
|
||||
@Override
|
||||
public List<PmWorker> selectWorkList(PmWorkerDto o) {
|
||||
return mapper.selectWorkList(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateWorkerExit(Integer id) {
|
||||
//删除合同
|
||||
int i = contractService.deleteByWorkerId(id);
|
||||
//删除实时在场
|
||||
int j = mapper.deleteEinMsgByWorkerId(id);
|
||||
//修改在场记录表状态
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -68,10 +68,11 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
record.setEinStatus(1);
|
||||
//1.bm_worker_ein_msg
|
||||
int i = mapper.insertEinMsg(record);
|
||||
//2.bm_worker_ein_pro
|
||||
//2.bm_worker_ein_pro 忽略新增
|
||||
int j = mapper.insertEinPro(record);
|
||||
//3.bm_worker_ein_pro_record
|
||||
int k = mapper.insertEinProRecord(record);
|
||||
//4.pm_user 添加人员登录表 TODO
|
||||
}
|
||||
|
||||
private void addWorkerWageCardDataAndContract(PmWorker record) {
|
||||
|
|
@ -113,8 +114,16 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
return worker;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改入场数据
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public int updateByPrimaryKey(PmWorker record) {
|
||||
//更新入场记录最新记录标识 再入场,清除最新标识
|
||||
mapper.updateEinRecordLast(record.getId());
|
||||
//已经入过场了
|
||||
if(record.getEinStatus() == 1){
|
||||
addWorkerWageCardDataAndContract(record);
|
||||
|
|
@ -124,6 +133,11 @@ public class PmWorkerServiceImpl implements PmWorkerService{
|
|||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询人员列表
|
||||
* @param o
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PmWorker> selectWorkList(PmWorkerDto o) {
|
||||
return mapper.selectWorkList(o);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,12 @@
|
|||
update bm_worker_contract set is_active = 0
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByWorkerId" parameterType="java.lang.Integer">
|
||||
update bm_worker_contract set is_active = 0
|
||||
where worker_id = #{workerId} and is_active = 1
|
||||
</delete>
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.bonus.bmw.domain.vo.BmWorkerContract" useGeneratedKeys="true">
|
||||
<!--@mbg.generated-->
|
||||
insert into bm_worker_contract (worker_id, contract_code, contract_term_type, contract_start_date,
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@
|
|||
|
||||
<update id="updateEinMsgByWorkerId">
|
||||
update bm_worker_ein_msg
|
||||
set light_status = 2
|
||||
set light_status = #{lightStatus},yellow_date = #{lightDate}
|
||||
where worker_id = #{workerId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,91 @@
|
|||
<?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.bonus.bmw.mapper.PmWorkerExitMapper">
|
||||
<resultMap id="BaseResultMap" type="com.bonus.bmw.domain.vo.PmWorker">
|
||||
<id column="id" property="id" />
|
||||
<result column="name" property="name" />
|
||||
<result column="id_number" property="idNumber" />
|
||||
<result column="sex" property="sex" />
|
||||
<result column="age" property="age" />
|
||||
<result column="phone" property="phone" />
|
||||
<result column="birthday" property="birthday" />
|
||||
<result column="nation" property="nation" />
|
||||
<result column="issuing_authority" property="issuingAuthority" />
|
||||
<result column="start_time" property="startTime" />
|
||||
<result column="end_time" property="endTime" />
|
||||
<result column="address" property="address" />
|
||||
<result column="face_photo" property="facePhoto" />
|
||||
<result column="ein_status" property="einStatus" />
|
||||
<result column="light_status" property="lightStatus" />
|
||||
<result column="create_user" property="createUser" />
|
||||
<result column="update_user" property="updateUser" />
|
||||
<result column="pro_name" property="proName" />
|
||||
<result column="sub_name" property="subName" />
|
||||
<result column="team_name" property="teamName" />
|
||||
<result column="post_name" property="postName" />
|
||||
<result column="ein_time" property="einTime" />
|
||||
<result column="pro_id" property="proId" />
|
||||
<result column="team_id" property="teamId" />
|
||||
<result column="post_id" property="postId" />
|
||||
<result column="sub_id" property="subId" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, `name`, id_number, sex, age, phone, birthday, nation, issuing_authority, start_time,
|
||||
end_time, address, face_photo, ein_status, light_status, create_user, update_user
|
||||
</sql>
|
||||
|
||||
<select id="selectWorkList" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
pw.id,
|
||||
pw.`name`,
|
||||
pw.id_number,
|
||||
pw.phone,
|
||||
bwep.pro_id,
|
||||
bwep.pro_name,
|
||||
bwepr.sub_id,
|
||||
bwepr.sub_name,
|
||||
bwepr.team_id,
|
||||
bwepr.team_name,
|
||||
bwepr.post_id,
|
||||
bwepr.post_name,
|
||||
bwepr.ein_time,
|
||||
bwepr.ein_status
|
||||
FROM
|
||||
pm_worker pw
|
||||
LEFT JOIN bm_worker_ein_pro bwep ON pw.id = bwep.worker_id
|
||||
AND bwep.is_active = 1
|
||||
LEFT JOIN bm_worker_ein_pro_record bwepr ON bwep.id = bwepr.ein_pro_id
|
||||
AND bwepr.is_active = 1
|
||||
WHERE
|
||||
pw.is_active = 1
|
||||
<if test="name != null and name != ''">
|
||||
AND pw.`name` LIKE CONCAT('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="idNumber != null and idNumber != ''">
|
||||
AND pw.id_number LIKE CONCAT('%', #{idNumber}, '%')
|
||||
</if>
|
||||
<if test="phone != null and phone != ''">
|
||||
AND pw.phone LIKE CONCAT('%', #{phone}, '%')
|
||||
</if>
|
||||
<if test="proId != null and proId != ''">
|
||||
AND bwep.pro_id = #{proId}
|
||||
</if>
|
||||
<if test="subId != null and subId != ''">
|
||||
AND bwepr.sub_id = #{subId}
|
||||
</if>
|
||||
<if test="teamId != null and teamId != ''">
|
||||
AND bwepr.team_id = #{teamId}
|
||||
</if>
|
||||
<if test="postId != null and postId != ''">
|
||||
AND bwepr.post_id = #{postId}
|
||||
</if>
|
||||
<if test="einStatus != null and einStatus != ''">
|
||||
AND bwepr.ein_status = #{einStatus}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<delete id="deleteEinMsgByWorkerId">
|
||||
DELETE FROM bm_worker_ein_msg WHERE worker_id = #{id}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
|
@ -141,21 +141,25 @@
|
|||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertEinPro" keyColumn="einProId" keyProperty="id" useGeneratedKeys="true">
|
||||
INSERT INTO bm_worker_ein_pro(worker_id,pro_id,pro_name,create_user) VALUES
|
||||
<insert id="insertEinPro">
|
||||
INSERT ignore INTO bm_worker_ein_pro(worker_id,pro_id,pro_name,create_user) VALUES
|
||||
(#{id},#{proId},#{proName},#{createUser})
|
||||
</insert>
|
||||
|
||||
<insert id="insertEinProRecord">
|
||||
INSERT INTO bm_worker_ein_pro_record(ein_pro_id,team_id,team_name,sub_id,sub_name,post_id,post_name,ein_time,ein_status,create_user
|
||||
INSERT INTO bm_worker_ein_pro_record(worker_id,pro_id,pro_name,team_id,team_name,sub_id,sub_name,post_id,post_name,ein_time,ein_status,create_user
|
||||
<if test="contractId != null and contractId != ''">
|
||||
,contract_id
|
||||
</if>
|
||||
) VALUES
|
||||
(#{einProId},#{teamId},#{teamName},#{subId},#{subName},#{postId},#{postName},#{einTime},#{einStatus},#{createUser}
|
||||
(#{id},#{proId},#{proName},#{teamId},#{teamName},#{subId},#{subName},#{postId},#{postName},#{einTime},#{einStatus},#{createUser}
|
||||
<if test="contractId != null and contractId != ''">
|
||||
,#{contractId}
|
||||
</if>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateEinRecordLast">
|
||||
update bm_worker_ein_pro_record set is_last = 0 where worker_id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue