人员入场修改

This commit is contained in:
方亮 2025-09-17 16:23:17 +08:00
parent 2c4959267b
commit 4230781a4e
9 changed files with 176 additions and 52 deletions

View File

@ -1,38 +1,38 @@
//package com.bonus.gateway.config;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.boot.autoconfigure.web.ServerProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.Ordered;
//import org.springframework.core.annotation.Order;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.server.reactive.ServerHttpRequest;
//import org.springframework.web.server.ResponseStatusException;
//import org.springframework.web.server.WebFilter;
//
//@Configuration
//public class ContextPathConfig {
//
// @Bean
// @ConditionalOnProperty("server.servlet.context-path")
// @Order(Ordered.HIGHEST_PRECEDENCE)
// public WebFilter contextPathWebFilter(ServerProperties serverProperties){
// String contextPath = serverProperties.getServlet().getContextPath();
// return (serverWebExchange, webFilterChain) ->{
// ServerHttpRequest request = serverWebExchange.getRequest();
// String requestPath = request.getURI().getPath();
//
// if(requestPath.contains(contextPath)){
// String newPath = requestPath.replaceFirst(contextPath+"/", "");
// ServerHttpRequest newRequest = request.mutate()
// .path(newPath).build();
// return webFilterChain.filter(serverWebExchange.mutate()
// .request(newRequest)
// .build()
// );
// }else {
// throw new ResponseStatusException(HttpStatus.NOT_FOUND);
// }
// };
// }
//}
package com.bonus.gateway.config;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.server.WebFilter;
@Configuration
public class ContextPathConfig {
@Bean
@ConditionalOnProperty("server.servlet.context-path")
@Order(Ordered.HIGHEST_PRECEDENCE)
public WebFilter contextPathWebFilter(ServerProperties serverProperties){
String contextPath = serverProperties.getServlet().getContextPath();
return (serverWebExchange, webFilterChain) ->{
ServerHttpRequest request = serverWebExchange.getRequest();
String requestPath = request.getURI().getPath();
if(requestPath.contains(contextPath)){
String newPath = requestPath.replaceFirst(contextPath+"/", "");
ServerHttpRequest newRequest = request.mutate()
.path(newPath).build();
return webFilterChain.filter(serverWebExchange.mutate()
.request(newRequest)
.build()
);
}else {
throw new ResponseStatusException(HttpStatus.NOT_FOUND);
}
};
}
}

View File

@ -97,10 +97,14 @@ public class PmWorkerController extends BaseController {
return error("系统异常,请联系管理员");
}
//
/**
* 根据id查询详情
* @param id
* @return
*/
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("worker:ein:query"))
@PostMapping("/select/{id}")
@SysLog(title = "人员入场管理", businessType = OperaType.QUERY, logType = 0, module = "施工人员->出入场管理->人员入场管理", details = "修改人员入场")
@SysLog(title = "查询人员入场信息", businessType = OperaType.QUERY, logType = 0, module = "施工人员->出入场管理->人员入场管理", details = "查询人员入场信息")
public AjaxResult select(@PathVariable("id") Integer id) {
try {
AjaxResult ajax = AjaxResult.success();
@ -113,6 +117,28 @@ public class PmWorkerController extends BaseController {
return error("系统异常,请联系管理员");
}
/**
* 根据身份证去获取详情数据
* @param files
* @param fileMsg
* @param params
* @return
*/
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("worker:ein:query"))
@PostMapping("/selectByIdNumber/{idNumber}")
@SysLog(title = "查询人员入场信息", businessType = OperaType.QUERY, logType = 0, module = "施工人员->出入场管理->人员入场管理", details = "查询人员入场信息")
public AjaxResult select(@PathVariable("idNumber") String idNumber) {
try {
AjaxResult ajax = AjaxResult.success();
PmWorker worker = service.selectByIdNumber(idNumber);
ajax.put("data", worker);
return ajax;
} catch (Exception e) {
logger.error(e.toString(), e);
}
return error("系统异常,请联系管理员");
}
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("worker:ein:edit"))
@PostMapping("/edit")

View File

@ -17,6 +17,8 @@ public class MapBeanPo {
private Integer subId;
private Integer workerId;
public MapBeanPo(Integer id, String name) {
this.id = id;
this.name = name;

View File

@ -194,4 +194,6 @@ public class PmWorker {
private String photoIds;
}
private String isShanghai;
}

View File

@ -1,6 +1,7 @@
package com.bonus.bmw.mapper;
import com.bonus.bmw.domain.dto.PmWorkerDto;
import com.bonus.bmw.domain.vo.MapBeanVo;
import com.bonus.bmw.domain.vo.PmWorker;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -129,4 +130,8 @@ public interface PmWorkerMapper {
void updateIsActiveById(@Param("id") Integer id, @Param("isActive") int isActive);
PmWorker getWorkerByPhoneById(@Param("phone") String phone,@Param("id")Integer id);
}
PmWorker selectByIdNumber(String idNumber);
List<MapBeanVo> getProListByWorkerId(Integer id);
}

View File

@ -29,4 +29,12 @@ public interface PmWorkerService{
* @return 结果
*/
String importWorker(List<PmWorker> workerList, boolean isUpdateSupport);
/**
* 根据身份证号查询施工人员
*
* @param idNumber 身份证号
* @return 用户对象信息
*/
PmWorker selectByIdNumber(String idNumber);
}

View File

@ -6,6 +6,7 @@ import com.bonus.bmw.domain.dto.WebFileDto;
import com.bonus.bmw.domain.po.FaceRecognitionBean;
import com.bonus.bmw.domain.vo.BmWorkerContract;
import com.bonus.bmw.domain.vo.BmWorkerWageCard;
import com.bonus.bmw.domain.vo.MapBeanVo;
import com.bonus.bmw.service.*;
import com.bonus.common.core.constant.Constants;
import com.bonus.common.core.exception.ServiceException;
@ -195,6 +196,41 @@ public class PmWorkerServiceImpl implements PmWorkerService{
return worker;
}
/**
* 根据员工编号查询人员信息
* @param idNumber
* @return
*/
@Override
public PmWorker selectByIdNumber(String idNumber) {
//人员数据
PmWorker worker = mapper.selectByIdNumber(idNumber);
if(worker != null){
worker.setFiles(fileUploadUtils.getFileList("", worker.getId().toString(), Constants.FILE_UPLOAD_WORKER, ""));
//查询工资卡 数据
BmWorkerWageCard wageCard = new BmWorkerWageCard();
wageCard.setWorkerId(worker.getId());
BmWorkerWageCard bmWorkerWageCard = wageCardService.selectWageCardByWorkerId(wageCard);
worker.setBmWorkerWageCard(bmWorkerWageCard);
//查询合同数据 只有入场才会有合同
BmWorkerContract contract = new BmWorkerContract();
contract.setWorkerId(worker.getId());
BmWorkerContract workerContract = contractService.selectContractListByWorkerIdAndValid(contract);
worker.setBmWorkerContract(workerContract);
if("1".equals(worker.getIsShanghai())){
//可能已入场多个该工程把工程都查回来
List<MapBeanVo> projectList = mapper.getProListByWorkerId(worker.getId());
StringBuilder sb = new StringBuilder();
for (MapBeanVo mapBeanVo : projectList) {
sb.append(mapBeanVo.getName());
}
worker.setProName(sb.toString());
}
}
return worker;
}
/**
* 修改入场数据
* @param record

View File

@ -6,7 +6,6 @@
<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" />
@ -15,9 +14,6 @@
<result column="end_time" property="endTime" />
<result column="address" property="address" />
<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" />
@ -27,6 +23,7 @@
<result column="team_id" property="teamId" />
<result column="post_id" property="postId" />
<result column="sub_id" property="subId" />
<result column="is_shanghai" property="isShanghai"/>
</resultMap>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
SELECT
@ -52,7 +49,7 @@
IFNULL(bmew.ein_status,2) as ein_status
FROM
pm_worker pw
LEFT JOIN bm_worker_ein_msg bmew ON pw.id = bmew.worker_id
LEFT JOIN bm_worker_ein_msg bmew ON pw.id = bmew.worker_id and bmew.pro_id = #{proId}
WHERE
id = #{id}
</select>
@ -61,9 +58,9 @@
</delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.bonus.bmw.domain.vo.PmWorker" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into pm_worker (`name`, id_number, sex, age, phone, birthday, nation, issuing_authority,
insert into pm_worker (`name`, id_number, sex, age, phone, birthday, nation, issuing_authority,
start_time, end_time, address, create_user)
values (#{name}, #{idNumber}, #{sex}, #{age}, #{phone}, #{birthday}, #{nation}, #{issuingAuthority},
values (#{name}, #{idNumber}, #{sex}, #{age}, #{phone}, #{birthday}, #{nation}, #{issuingAuthority},
#{startTime}, #{endTime}, #{address}, #{createUser})
</insert>
@ -276,4 +273,46 @@
</if>
limit 1
</select>
</mapper>
<select id="selectByIdNumber" resultMap="BaseResultMap">
SELECT
pw.id,
pw.`name`,
pw.id_number,
pw.sex,
pw.phone,
pw.birthday,
pw.nation,
pw.issuing_authority,
pw.start_time,
pw.end_time,
pw.address,
bmew.pro_id,
bmew.team_id,
bmew.post_id,
bmew.sub_id,
bmew.pro_name,
bmew.sub_name,
bmew.team_name,
bmew.post_name,
IFNULL(bmew.ein_status,2) as ein_status,
pp.is_shanghai
FROM
pm_worker pw
LEFT JOIN bm_worker_ein_msg bmew ON pw.id = bmew.worker_id
LEFT JOIN pm_project pp ON pp.id = bmew.worker_id
WHERE
id_number = #{idNumber} and pw.is_active = 1
limit 1
</select>
<select id="getProListByWorkerId" resultType="com.bonus.bmw.domain.vo.MapBeanVo">
SELECT
bmew.pro_id as id,
bmew.pro_name as name
FROM
bm_worker_ein_msg bmew
WHERE
bmew.worker_id = #{workerId}
</select>
</mapper>

View File

@ -4,11 +4,14 @@
<select id="selectPro" resultType="com.bonus.bmw.domain.vo.MapBeanVo">
select
id,
pro_name as `name`
pp.id,
pp.pro_name as `name`
from pm_project pp
<if test="subId != null">
inner join bm_sub_contract bsc on pp.id = bsc.pro_id and bsc.sub_ein_status = 1 and bsc.is_active = 1
</if>
<if test="workerId != null">
inner join bm_worker_ein_msg bwem on pp.id = bwem.pro_id and bwem.is_active = 1 and bwem.worker_id = #{workerId}
</if>
<where>
pp.is_active = 1
@ -18,6 +21,9 @@
<if test="subId != null">
and bsc.sub_id = #{subId}
</if>
<if test="workerId != null">
and bwem.pro_id is null
</if>
</where>
</select>