监理、承包、分包新增人员
This commit is contained in:
parent
e2ee7bc418
commit
a6e3f6137f
|
|
@ -290,4 +290,32 @@ public interface ProjectMapper {
|
|||
* @return
|
||||
*/
|
||||
List<BaseBean> selectPhone(String proId);
|
||||
/**
|
||||
* 查询监理信息
|
||||
* @param supervisorUnitId
|
||||
* @return
|
||||
*/
|
||||
SubPerson getSupPerson(String supervisorUnitId);
|
||||
/**
|
||||
* 查询承包商信息
|
||||
* @param consId
|
||||
* @return
|
||||
*/
|
||||
SubPerson getConsPerson(String consId);
|
||||
|
||||
int addSupPersonToPsi(SubPerson subPerson);
|
||||
|
||||
int addSupPersonToLk(SubPerson subPerson);
|
||||
|
||||
int addConsPersonToPcp(SubPerson subPerson);
|
||||
|
||||
int addConsPersonToLk(SubPerson subPerson);
|
||||
|
||||
void delSupPersonToPsi(Project project);
|
||||
|
||||
void delSupPersonToLk(Project project);
|
||||
|
||||
void delConsPersonToPcp(Project project);
|
||||
|
||||
void delConsPersonToLk(Project project);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,4 +67,12 @@ public interface SubMapper {
|
|||
* @return 是否删除成功
|
||||
*/
|
||||
int delSub(int id);
|
||||
|
||||
int addSubPersonToPcp(SubPerson subPerson);
|
||||
|
||||
int addSubPersonToLk(SubPerson subPerson);
|
||||
|
||||
int delSubPersonToPcp(int id);
|
||||
|
||||
int delSubPersonToLk(int id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -151,6 +151,11 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
// if (code == 0) {
|
||||
// throw new RuntimeException("Failed to delete project");
|
||||
// }
|
||||
projectMapper.delSupPersonToPsi(project);
|
||||
projectMapper.delSupPersonToLk(project);
|
||||
projectMapper.delConsPersonToPcp(project);
|
||||
projectMapper.delConsPersonToLk(project);
|
||||
|
||||
}catch (Exception e){
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
log.error("Failed to delete project due to exception", e);
|
||||
|
|
@ -348,7 +353,8 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
result = addRelateInfoForPro(project);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to add supervisory unit due to exception", e);
|
||||
result = 0;
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -420,9 +426,14 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
projectMapper.delMaterialProject(project);
|
||||
projectMapper.delAddressProject(project);
|
||||
projectMapper.delSupervisoryProject(project);
|
||||
projectMapper.delSupPersonToPsi(project);
|
||||
projectMapper.delSupPersonToLk(project);
|
||||
projectMapper.delConsPersonToPcp(project);
|
||||
projectMapper.delConsPersonToLk(project);
|
||||
result = addRelateInfoForPro(project);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to add supervisory unit due to exception", e);
|
||||
result = 0;
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -458,7 +469,8 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Failed to add supervisory unit due to exception", e);
|
||||
result = 0;
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -479,6 +491,8 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
if (result <= 0) {
|
||||
throw new RuntimeException("Failed to add supervisory project");
|
||||
}
|
||||
//TODO 获取监理信息 --- 新增监理信息到监理人员表
|
||||
addSupPerson(project);
|
||||
}
|
||||
//插入承包商-工程关联信息
|
||||
for (int i = 0; i < project.getConsArr().size(); i++) {
|
||||
|
|
@ -498,6 +512,8 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
throw new RuntimeException("Failed to add material project");
|
||||
}
|
||||
}
|
||||
// TODO 获取承包商信息 --- 新增承包商信息到承包商人员表
|
||||
addConsPerson(project);
|
||||
}
|
||||
for (int i = 0; i < project.getProAddress().size(); i++) {
|
||||
//插入工程地址-工程关联信息
|
||||
|
|
@ -510,6 +526,37 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* 新增监理人员
|
||||
*
|
||||
* @param project 工程实体
|
||||
*/
|
||||
private void addSupPerson(Project project) {
|
||||
// TODO 获取监理信息 --- 新增监理信息到监理人员表
|
||||
SubPerson subPerson = projectMapper.getSupPerson(project.getSupervisorUnitId());
|
||||
subPerson.setUuid(StringUtils.getUuid());
|
||||
subPerson.setProId(Math.toIntExact(project.getProId()));
|
||||
//插入人员表
|
||||
projectMapper.addSupPersonToPsi(subPerson);
|
||||
//插入关联表
|
||||
projectMapper.addSupPersonToLk(subPerson);
|
||||
}
|
||||
/**
|
||||
* 新增承包商人员
|
||||
*
|
||||
* @param project 工程实体
|
||||
*/
|
||||
private void addConsPerson(Project project) {
|
||||
// TODO 获取承包商信息 --- 新增承包商信息到承包商人员表
|
||||
SubPerson subPerson = projectMapper.getConsPerson(project.getConsId());
|
||||
subPerson.setUuid(StringUtils.getUuid());
|
||||
subPerson.setProId(Math.toIntExact(project.getProId()));
|
||||
//插入人员表
|
||||
projectMapper.addConsPersonToPcp(subPerson);
|
||||
//插入关联表
|
||||
projectMapper.addConsPersonToLk(subPerson);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增用户岗位信息
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import org.slf4j.LoggerFactory;
|
|||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
|
@ -111,14 +112,36 @@ public class SubServiceImpl implements SubService {
|
|||
// 抛出异常触发事务回滚
|
||||
throw new RuntimeException("Failed to add subcontractor unit");
|
||||
}
|
||||
// TODO 添加分包商人员信息到人员表
|
||||
addSubPerson(bean);
|
||||
// 返回操作结果,可能是插入的记录数或者其他标识
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
log.error("Failed to add subcontractor unit due to exception", e );
|
||||
// 抛出异常触发事务回滚
|
||||
throw new RuntimeException("Failed to add subcontractor unit due to exception", e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void addSubPerson(SubcontractorsEntity bean){
|
||||
System.out.println("addSubPerson=========="+bean);
|
||||
SubPerson subPerson = new SubPerson();
|
||||
subPerson.setName(bean.getSubPrincipal());
|
||||
subPerson.setPhone(bean.getSubPrincipalPhone());
|
||||
subPerson.setIdCard(bean.getSubIdCard());
|
||||
subPerson.setSubUuid(bean.getSubUuid());
|
||||
subPerson.setUuid(StringUtils.getUuid());
|
||||
subPerson.setConsUuid(bean.getConsUuid());
|
||||
subPerson.setSupUuid(bean.getSupUuid());
|
||||
subPerson.setProId(bean.getProId());
|
||||
//插入人员表
|
||||
mapper.addSubPersonToPcp(subPerson);
|
||||
//插入关联表
|
||||
mapper.addSubPersonToLk(subPerson);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分包商人员入场申请列表
|
||||
* @param bean 分包商实体
|
||||
|
|
@ -159,6 +182,8 @@ public class SubServiceImpl implements SubService {
|
|||
*/
|
||||
@Override
|
||||
public int delSub(int id) {
|
||||
// mapper.delSubPersonToPcp(id);
|
||||
// mapper.delSubPersonToLk(id);
|
||||
return mapper.delSub(id);
|
||||
}
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -71,6 +71,22 @@
|
|||
(#{item.userId},#{item.roleId})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="addSupPersonToPsi" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pt_sup_person(sup_name, phone, post, is_active)
|
||||
values (#{name}, #{phone}, '1','1')
|
||||
</insert>
|
||||
<insert id="addSupPersonToLk">
|
||||
insert into lk_sup_person(uuid,pro_id, sup_persion_id,sup_uuid,status,is_exist_file)
|
||||
values (#{uuid}, #{proId},#{id},#{supUuid},'0','0')
|
||||
</insert>
|
||||
<insert id="addConsPersonToPcp" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pt_cons_person(cons_name, phone, post, is_active)
|
||||
values (#{name}, #{phone},'1', '1')
|
||||
</insert>
|
||||
<insert id="addConsPersonToLk">
|
||||
insert into lk_cont_person(uuid,pro_id, cons_persion_id,cont_uuid,is_exist_file)
|
||||
values (#{uuid}, #{proId},#{id},#{consUuid},'0')
|
||||
</insert>
|
||||
<update id="preparation">
|
||||
update pt_project_info
|
||||
set pro_status = '2'
|
||||
|
|
@ -129,6 +145,26 @@
|
|||
from lk_pro_sup
|
||||
where pro_id = #{proId}
|
||||
</delete>
|
||||
<delete id="delSupPersonToPsi">
|
||||
delete
|
||||
from pt_sup_person
|
||||
where sup_user_id = (select sup_persion_id from lk_sup_person where pro_id = #{proId})
|
||||
</delete>
|
||||
<delete id="delSupPersonToLk">
|
||||
delete
|
||||
from lk_sup_person
|
||||
where pro_id = #{proId}
|
||||
</delete>
|
||||
<delete id="delConsPersonToPcp">
|
||||
delete
|
||||
from pt_cons_person
|
||||
where cons_user_id in (select cons_persion_id from lk_cont_person where pro_id = #{proId})
|
||||
</delete>
|
||||
<delete id="delConsPersonToLk">
|
||||
delete
|
||||
from lk_cont_person
|
||||
where pro_id = #{proId}
|
||||
</delete>
|
||||
|
||||
<select id="selectPostList" resultType="com.bonus.project.domain.Project">
|
||||
select
|
||||
|
|
@ -356,4 +392,22 @@
|
|||
lpc.pro_id = #{proId}
|
||||
AND su.user_type = '02'
|
||||
</select>
|
||||
<select id="getSupPerson" resultType="com.bonus.project.domain.SubPerson">
|
||||
select
|
||||
sup_id as supId,
|
||||
uuid as supUuid,
|
||||
comm_user_name as name,
|
||||
comm_user_phone as phone
|
||||
from pt_sup_info
|
||||
where sup_id = #{supervisorUnitId}
|
||||
</select>
|
||||
<select id="getConsPerson" resultType="com.bonus.project.domain.SubPerson">
|
||||
select
|
||||
cont_id as consId,
|
||||
uuid as consUuid,
|
||||
comm_usert_name as name,
|
||||
comm_usert_phone as phone
|
||||
from pt_cont_info
|
||||
where cont_id = #{consId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -25,11 +25,31 @@
|
|||
insert into sys_user_role(user_id, role_id)
|
||||
values (#{id}, '8')
|
||||
</insert>
|
||||
<insert id="addSubPersonToPcp" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pt_cons_person(cons_name,phone,id_card,is_active)
|
||||
values(#{name},#{phone},#{idCard},'1')
|
||||
</insert>
|
||||
<insert id="addSubPersonToLk">
|
||||
insert into lk_cont_person(cons_persion_id,cont_uuid,sub_uuid,pro_id,is_exist_file,uuid)
|
||||
values(#{id},#{consUuid},#{subUuid},#{proId},'0',#{uuid})
|
||||
</insert>
|
||||
<delete id="delSub">
|
||||
update pt_sub_info
|
||||
set is_active = '0'
|
||||
where sub_id = #{id}
|
||||
</delete>
|
||||
<delete id="delSubPersonToPcp">
|
||||
delete
|
||||
from pt_cons_person
|
||||
where cons_user_id = (select cons_persion_id
|
||||
from lk_cont_person
|
||||
where uuid = (select uuid from pt_sub_info where sub_id = #{id}))
|
||||
</delete>
|
||||
<delete id="delSubPersonToLk">
|
||||
delete
|
||||
from lk_cont_person
|
||||
where uuid = (select uuid from pt_sub_info where sub_id = #{id})
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="checkIsExistSubName" resultType="java.lang.Integer">
|
||||
|
|
|
|||
Loading…
Reference in New Issue