工程总监下拉选修改
This commit is contained in:
parent
22d63b5d1b
commit
bdc939ece2
|
|
@ -187,22 +187,34 @@ public class ProjectController extends BaseController {
|
|||
@SysLog(title = "工程管理", businessType = OperaType.INSERT,logType = 0,module = "工程管理->新建工程",details = "新增监理单位")
|
||||
public AjaxResult addSupervisoryUnit(@Validated @RequestBody SupervisoryUnit bean) {
|
||||
try{
|
||||
int code = projectService.addSupervisoryUnit(bean);
|
||||
if (code == StaticVariableUtils.ZERO_INT) {
|
||||
return error("新增监理单位失败");
|
||||
}else if (code == StaticVariableUtils.NEGATIVE_ONE_INT){
|
||||
return error("新增监理单位失败,总监名称和总监联系方式不匹配,请仔细核对!");
|
||||
}else if (code == StaticVariableUtils.NEGATIVE_TWO_INT){
|
||||
return error("新增监理单位失败,总监联系方式已存在!");
|
||||
}else if(code == StaticVariableUtils.NEGATIVE_THREE_INT){
|
||||
return error("新增监理单位失败,总监身份证已存在!");
|
||||
}
|
||||
return toAjax(1);
|
||||
return projectService.addSupervisoryUnit(bean);
|
||||
// if (code == StaticVariableUtils.ZERO_INT) {
|
||||
// return error("新增监理单位失败");
|
||||
// }else if (code == StaticVariableUtils.NEGATIVE_ONE_INT){
|
||||
// return error("新增监理单位失败,总监名称和总监联系方式不匹配,请仔细核对!");
|
||||
// }else if (code == StaticVariableUtils.NEGATIVE_TWO_INT){
|
||||
// return error("新增监理单位失败,总监联系方式已存在!");
|
||||
// }else if(code == StaticVariableUtils.NEGATIVE_THREE_INT){
|
||||
// return error("新增监理单位失败,总监身份证已存在!");
|
||||
// }
|
||||
// return toAjax(1);
|
||||
}catch (Exception e){
|
||||
logger.error(e.toString(),e);
|
||||
}
|
||||
return error("系统异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增监理单位
|
||||
* @param bean 监理单位实体
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@PostMapping("/addSupervisoryUnitUser")
|
||||
@SysLog(title = "工程管理", businessType = OperaType.INSERT,logType = 0,module = "工程管理->新建工程",details = "新增总监信息")
|
||||
public AjaxResult addSupervisoryUnitUser(@Validated @RequestBody SupervisoryUnit bean) {
|
||||
return projectService.addSupervisoryUnitUser(bean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增承包商单位
|
||||
* @param bean 监理单位实体
|
||||
|
|
|
|||
|
|
@ -100,10 +100,20 @@ public class Project{
|
|||
*/
|
||||
private String supervisorUnitId;
|
||||
|
||||
/**
|
||||
* 总监id
|
||||
*/
|
||||
private String supervisorUnitUserId;
|
||||
|
||||
|
||||
/**
|
||||
* 监理单位名称
|
||||
*/
|
||||
private String supervisorUnit;
|
||||
/**
|
||||
* 总监名称
|
||||
*/
|
||||
private String supervisorUnitUser;
|
||||
|
||||
/**
|
||||
* 承包商Arr
|
||||
|
|
|
|||
|
|
@ -17,6 +17,14 @@ public class SupervisoryUnit extends BaseBean {
|
|||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Integer id;
|
||||
/**
|
||||
* 监理单位id
|
||||
*/
|
||||
private String jlId;
|
||||
/**
|
||||
* 监理uuid
|
||||
*/
|
||||
private String jlUuid;
|
||||
/**
|
||||
* 监理单位名称
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -318,4 +318,25 @@ public interface ProjectMapper {
|
|||
void delConsPersonToPcp(Project project);
|
||||
|
||||
void delConsPersonToLk(Project project);
|
||||
|
||||
/**
|
||||
* 添加监理单位数据
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
int addSupervisoryUnitUser(SupervisoryUnit bean);
|
||||
|
||||
/**
|
||||
* 查询监理单位信息
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
SupervisoryUnit getSupervisoryUnitById(SupervisoryUnit bean);
|
||||
|
||||
/**
|
||||
* 查询监理单位名称是否重复
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
int getSupervisoryUnitUser(SupervisoryUnit bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public interface ProjectService {
|
|||
* @param bean 监理单位实体
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
int addSupervisoryUnit(SupervisoryUnit bean);
|
||||
AjaxResult addSupervisoryUnit(SupervisoryUnit bean);
|
||||
/**
|
||||
* 检查监理单位名称是否存在
|
||||
* @param bean 监理单位实体
|
||||
|
|
@ -89,4 +89,11 @@ public interface ProjectService {
|
|||
* @return 是否修改成功
|
||||
*/
|
||||
int editProInfo(Project project);
|
||||
|
||||
/**
|
||||
* 添加总监人员数据
|
||||
* @param bean
|
||||
* @return
|
||||
*/
|
||||
AjaxResult addSupervisoryUnitUser(SupervisoryUnit bean);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ import com.bonus.project.mapper.AdmissionRequestMapper;
|
|||
import com.bonus.project.mapper.ProjectMapper;
|
||||
import com.bonus.project.service.ProjectService;
|
||||
import com.bonus.system.api.RemoteUserService;
|
||||
import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.hibernate.validator.internal.util.StringHelper;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -171,8 +173,25 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int addSupervisoryUnit(SupervisoryUnit bean) {
|
||||
public AjaxResult addSupervisoryUnit(SupervisoryUnit bean) {
|
||||
//设置回滚点
|
||||
Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint();
|
||||
try {
|
||||
if(StringHelper.isNullOrEmptyString(bean.getJlId())){
|
||||
return AjaxResult.error("请先选择监理单位");
|
||||
}else {
|
||||
//对监理人员信息进行赋值
|
||||
SupervisoryUnit unit= projectMapper.getSupervisoryUnitById(bean);
|
||||
if(unit==null){
|
||||
return AjaxResult.error("监理单位不存在");
|
||||
}
|
||||
bean.setJlUuid(unit.getJlUuid());
|
||||
bean.setUnitAddress(unit.getUnitAddress());
|
||||
bean.setUnitName(unit.getUnitName());
|
||||
bean.setCorporateName(unit.getCorporateName());
|
||||
bean.setCorporatePhone(unit.getCorporatePhone());
|
||||
bean.setSocialUnifiedCreditCode(unit.getSocialUnifiedCreditCode());
|
||||
}
|
||||
// 新增监理信息到人员表
|
||||
bean.setPassword(SecurityUtils.encryptPassword(StaticVariableUtils.SUPERVISION_PASSWORD));
|
||||
bean.setCreateTime(DateUtils.getTime());
|
||||
|
|
@ -186,7 +205,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
//查询身份证是否重复
|
||||
result = projectMapper.checkIsExistIdCard(bean.getDirectorsIdCard());
|
||||
if (result > 0) {
|
||||
return -3;
|
||||
return AjaxResult.error("总监身份证号码已存在!");
|
||||
}
|
||||
// 添加监理信息到人员表
|
||||
AdmissionRequest admissionRequest = new AdmissionRequest();
|
||||
|
|
@ -195,8 +214,9 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
bean.setDeptId(deptId);
|
||||
result = projectMapper.addDirectors(bean);
|
||||
if (result <= 0) {
|
||||
TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
|
||||
// 抛出异常触发事务回滚
|
||||
throw new RuntimeException("Failed to add directors");
|
||||
return AjaxResult.error("添加总监人员失败!");
|
||||
}
|
||||
//向SysUser bean中添加监理人员id
|
||||
SysUser sysUser = new SysUser();
|
||||
|
|
@ -210,27 +230,53 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
insertUserPost(sysUser);
|
||||
// 新增用户角色信息
|
||||
insertUserRole(Long.valueOf(bean.getId()), roleIds);
|
||||
|
||||
} else {
|
||||
return -2;
|
||||
return AjaxResult.error("总监手机号已存在!");
|
||||
}
|
||||
// 添加监理信息到监理单位表
|
||||
result = projectMapper.addSupervisoryUnit(bean);
|
||||
if (result <= 0) {
|
||||
if (result > 0) {
|
||||
// 抛出异常触发事务回滚
|
||||
throw new RuntimeException("Failed to add supervisory unit");
|
||||
TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
|
||||
return AjaxResult.success("添加成功");
|
||||
}
|
||||
|
||||
// 返回操作结果,可能是插入的记录数或者其他标识
|
||||
return result;
|
||||
} catch (Exception e) {
|
||||
// 抛出异常触发事务回滚
|
||||
throw new RuntimeException("Failed to add supervisory unit due to exception", e);
|
||||
// 手动进行回滚
|
||||
TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint);
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.error("添加总监人员失败,请联系管理员!");
|
||||
}
|
||||
@Override
|
||||
public AjaxResult addSupervisoryUnitUser(SupervisoryUnit bean) {
|
||||
try{
|
||||
int nums=projectMapper.getSupervisoryUnitUser(bean);
|
||||
if(nums>0){
|
||||
return AjaxResult.error("监理单位名称已存在");
|
||||
}
|
||||
// 新增监理信息到人员表
|
||||
bean.setCreateTime(DateUtils.getTime());
|
||||
bean.setCreatePerson(SecurityUtils.getUsername());
|
||||
bean.setCreatePersonId(String.valueOf(SecurityUtils.getUserId()));
|
||||
bean.setUuid(StringUtils.getUuid());
|
||||
int successNum=projectMapper.addSupervisoryUnitUser(bean);
|
||||
if(successNum<1){
|
||||
return AjaxResult.error("监理单位添加失败,请联系管理员");
|
||||
}
|
||||
return AjaxResult.success("添加成功",bean);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return AjaxResult.error("监理单位添加失败,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 新增承包商单位
|
||||
*
|
||||
* @param bean 监理单位实体
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
|
|
@ -475,6 +521,8 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 插入关联信息
|
||||
*
|
||||
|
|
@ -486,7 +534,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
//插入监理-工程关联信息
|
||||
if (StaticVariableUtils.TWO.equals(project.getProType())) {
|
||||
project.setRelateUuid(StringUtils.getUuid());
|
||||
project.setSupUuid(projectMapper.getSupUuid(project.getSupervisorUnitId()));
|
||||
project.setSupUuid(projectMapper.getSupUuid(project.getSupervisorUnitUserId()));
|
||||
result = projectMapper.addSupervisoryProject(project);
|
||||
if (result <= 0) {
|
||||
throw new RuntimeException("Failed to add supervisory project");
|
||||
|
|
@ -533,7 +581,7 @@ public class ProjectServiceImpl implements ProjectService {
|
|||
*/
|
||||
private void addSupPerson(Project project) {
|
||||
// TODO 获取监理信息 --- 新增监理信息到监理人员表
|
||||
SubPerson subPerson = projectMapper.getSupPerson(project.getSupervisorUnitId());
|
||||
SubPerson subPerson = projectMapper.getSupPerson(project.getSupervisorUnitUserId());
|
||||
subPerson.setUuid(StringUtils.getUuid());
|
||||
subPerson.setProId(Math.toIntExact(project.getProId()));
|
||||
//插入人员表
|
||||
|
|
|
|||
|
|
@ -10,17 +10,21 @@
|
|||
'01', '1', '0', #{createPerson}, #{createTime}, '1,2,3', #{deptId},#{uuid},#{directorsIdCard})
|
||||
</insert>
|
||||
<insert id="addSupervisoryUnit">
|
||||
insert into pt_sup_info(sup_name,
|
||||
sup_address, legal_name, legal_phone, sup_code, comm_user_id, comm_user_name,
|
||||
comm_user_phone,
|
||||
create_user,
|
||||
create_id,
|
||||
uuid,
|
||||
create_time)
|
||||
values (#{unitName}, #{unitAddress}, #{corporateName}, #{corporatePhone}, #{socialUnifiedCreditCode}, #{id},
|
||||
#{directorsName},
|
||||
#{directorsPhone}, #{createPerson}, #{createPersonId}, #{uuid}, #{createTime})
|
||||
insert into pt_sup_info
|
||||
(sup_name, unit_id,unit_uuid, sup_address, legal_name, legal_phone, sup_code, comm_user_id, comm_user_name,
|
||||
comm_user_phone, create_user, create_id, uuid, create_time)
|
||||
values (#{unitName}, #{jlId},#{jlUuid},#{unitAddress}, #{corporateName}, #{corporatePhone}, #{socialUnifiedCreditCode}, #{id},
|
||||
#{directorsName}, #{directorsPhone}, #{createPerson}, #{createPersonId}, #{uuid}, #{createTime})
|
||||
</insert>
|
||||
|
||||
<insert id="addSupervisoryUnitUser" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pt_sup_info_data(
|
||||
uuid, sup_name, sup_address, legal_name, legal_phone, sup_code, create_time,
|
||||
update_time, create_id, create_user, is_active
|
||||
)values (#{uuid},#{unitName},#{unitAddress},#{corporateName},#{corporatePhone},#{socialUnifiedCreditCode},
|
||||
now(),now(),#{createPersonId},#{createPerson},1)
|
||||
</insert>
|
||||
|
||||
<insert id="addConsUnit">
|
||||
insert into pt_cont_info(cont_name, cont_address, legal_name, legal_phone, sup_code, con_usert_id,
|
||||
comm_usert_name, comm_usert_phone, create_user, create_id, uuid)
|
||||
|
|
@ -36,12 +40,13 @@
|
|||
</insert>
|
||||
<insert id="addProInfo" useGeneratedKeys="true" keyProperty="proId">
|
||||
insert into pt_project_info(pro_name,pro_user_id, pro_user_name, pro_user_phone, pro_type, is_outsource,
|
||||
plan_start_time,
|
||||
plan_end_time, sup_unit_id, sup_unit_name, pro_status, create_user, create_id, uuid)
|
||||
plan_start_time, plan_end_time, sup_unit_id, sup_unit_name,
|
||||
sup_user_id,sup_user_name,
|
||||
pro_status, create_user, create_id, uuid)
|
||||
values (#{proName}, #{proLeaderId},#{proLeader}, #{proLeaderPhone}, #{proType}, #{isOutsourcing}, #{startDate},
|
||||
#{endDate},
|
||||
#{supervisorUnitId},
|
||||
#{supervisorUnit}, '1', #{createPerson}, #{createPersonId}, #{uuid})
|
||||
#{endDate}, #{supervisorUnitId}, #{supervisorUnit},
|
||||
#{supervisorUnitUserId},#{supervisorUnitUser},
|
||||
'1', #{createPerson}, #{createPersonId}, #{uuid})
|
||||
</insert>
|
||||
<insert id="addSupervisoryProject">
|
||||
insert into lk_pro_sup(pro_id, sup_uuid, uuid)
|
||||
|
|
@ -87,6 +92,7 @@
|
|||
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'
|
||||
|
|
@ -105,7 +111,9 @@
|
|||
sup_unit_id = #{supervisorUnitId},
|
||||
sup_unit_name = #{supervisorUnit},
|
||||
create_user = #{createPerson},
|
||||
create_id = #{createPersonId}
|
||||
create_id = #{createPersonId},
|
||||
sup_user_id = #{supervisorUnitUserId},
|
||||
sup_user_name = #{supervisorUnitUser}
|
||||
where pro_id = #{proId}
|
||||
</update>
|
||||
<update id="updateUserStatus">
|
||||
|
|
@ -219,9 +227,7 @@
|
|||
select user_id as userId,
|
||||
user_name as userName
|
||||
from sys_user
|
||||
where phonenumber = #{directorsPhone}
|
||||
and del_flag = '0'
|
||||
and status = '0'
|
||||
where phonenumber = #{directorsPhone} and del_flag = '0'
|
||||
limit 1
|
||||
</select>
|
||||
<select id="checkIsExistConsName" resultType="java.lang.Integer">
|
||||
|
|
@ -265,6 +271,8 @@
|
|||
ppi.plan_end_time as endDate,
|
||||
IFNULL(ppi.sup_unit_id, '') as supervisorUnitId,
|
||||
ppi.sup_unit_name as supervisorUnit,
|
||||
IFNULL(ppi.sup_user_id, '') as supervisorUnitUserId,
|
||||
ppi.sup_user_name as supervisorUnitUser,
|
||||
ppi.pro_status as proStatus,
|
||||
ppi.create_user as createPerson,
|
||||
ppi.create_time as createTime
|
||||
|
|
@ -410,4 +418,18 @@
|
|||
from pt_cont_info
|
||||
where cont_id = #{consId}
|
||||
</select>
|
||||
<select id="getSupervisoryUnitById" resultType="com.bonus.project.domain.SupervisoryUnit">
|
||||
select id jlId, uuid jlUuid, sup_name unitName, sup_address unitAddress, legal_name corporateName, legal_phone corporatePhone,
|
||||
sup_code socialUnifiedCreditCode
|
||||
from pt_sup_info_data
|
||||
where id=#{jlId}
|
||||
</select>
|
||||
<select id="getSupervisoryUnitUser" resultType="java.lang.Integer">
|
||||
select count(1)
|
||||
from pt_sup_info_data
|
||||
where sup_name=#{unitName}
|
||||
AND is_active=1
|
||||
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -128,6 +128,18 @@ public class SysSelectController extends BaseController {
|
|||
}
|
||||
return error("系统异常");
|
||||
}
|
||||
@PostMapping("selectSupervisionUnitUser")
|
||||
@SysLog(title = "下拉选", businessType = OperaType.QUERY,logType = 0,module = "下拉选->查询监理单位")
|
||||
public AjaxResult selectSupervisionUnitUser(@RequestBody SysSelect sysSelect) {
|
||||
try{
|
||||
List<SysSelect> list = sysSelectService.selectSupervisionUnitUser(sysSelect);
|
||||
return success(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return error("系统异常");
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件查询
|
||||
* @param sysFile 入参
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ public interface SysSelectMapper {
|
|||
* @return 监理单位集合
|
||||
*/
|
||||
List<SysSelect> selectSupervisionUnit(SysSelect sysSelect);
|
||||
|
||||
List<SysSelect> selectSupervisionUnitUser(SysSelect sysSelect);
|
||||
/**
|
||||
* 文件查询
|
||||
* @param sysFile 入参
|
||||
|
|
|
|||
|
|
@ -45,6 +45,12 @@ public interface ISysSelectService {
|
|||
* @return 监理单位集合
|
||||
*/
|
||||
List<SysSelect> selectSupervisionUnit(SysSelect sysSelect);
|
||||
/**
|
||||
* 监理单位 人员 下拉选
|
||||
* @param sysSelect 入参
|
||||
* @return 监理单位集合
|
||||
*/
|
||||
List<SysSelect> selectSupervisionUnitUser(SysSelect sysSelect);
|
||||
/**
|
||||
* 文件查询
|
||||
* @param sysFile 入参
|
||||
|
|
|
|||
|
|
@ -72,6 +72,16 @@ public class SysSelectServiceImpl implements ISysSelectService {
|
|||
public List<SysSelect> selectSupervisionUnit(SysSelect sysSelect) {
|
||||
return sysSelectMapper.selectSupervisionUnit(sysSelect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 监理单位人员下拉选
|
||||
* @param sysSelect 入参
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SysSelect> selectSupervisionUnitUser(SysSelect sysSelect) {
|
||||
return sysSelectMapper.selectSupervisionUnitUser(sysSelect);
|
||||
}
|
||||
/**
|
||||
* 文件查询
|
||||
* @param sysFile 入参
|
||||
|
|
|
|||
|
|
@ -52,11 +52,17 @@
|
|||
and material_type = '1' and status = '1'
|
||||
</select>
|
||||
<select id="selectSupervisionUnit" resultType="com.bonus.system.domain.SysSelect">
|
||||
select sup_name as label,
|
||||
sup_id as value
|
||||
select comm_user_name as label, sup_id as value
|
||||
from pt_sup_info
|
||||
where is_active = '1' and unit_id=#{key}
|
||||
</select>
|
||||
<select id="selectSupervisionUnitUser" resultType="com.bonus.system.domain.SysSelect">
|
||||
select sup_name as label,
|
||||
id as value
|
||||
from pt_sup_info_data
|
||||
where is_active = '1'
|
||||
</select>
|
||||
|
||||
<select id="selectFile" resultType="com.bonus.system.domain.SysFileInfo">
|
||||
select information_id as id,
|
||||
information_name as fileName,
|
||||
|
|
|
|||
Loading…
Reference in New Issue