项目相关功能完成,导入导出待明确需求
This commit is contained in:
parent
79cd4f89f1
commit
ca87787784
|
@ -16,4 +16,5 @@ public class Message implements Serializable {
|
|||
public static final String IMAGE_PATH_IS_NOT_EXIST = "图像地址不存在";
|
||||
public static final String IMAGE_ID_IS_NOT_EXIST = "图像id不存在";
|
||||
public static final String DEFECT_ID_IS_NOT_EXIST = "缺陷id不存在";
|
||||
public static final String PROJECT_ID_IS_NOT_EXIST = "项目id不存在";
|
||||
}
|
||||
|
|
|
@ -3,10 +3,8 @@ package com.dite.znpt.converts;
|
|||
import com.dite.znpt.domain.entity.DefectEntity;
|
||||
import com.dite.znpt.domain.entity.ImageCollectEntity;
|
||||
import com.dite.znpt.domain.entity.ImageEntity;
|
||||
import com.dite.znpt.domain.vo.DefectReq;
|
||||
import com.dite.znpt.domain.vo.DefectResp;
|
||||
import com.dite.znpt.domain.vo.ImageCollectReq;
|
||||
import com.dite.znpt.domain.vo.ImageReq;
|
||||
import com.dite.znpt.domain.entity.ProjectEntity;
|
||||
import com.dite.znpt.domain.vo.*;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.NullValuePropertyMappingStrategy;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
@ -29,4 +27,8 @@ public interface Converts {
|
|||
DefectEntity toDefectEntity(DefectReq req);
|
||||
|
||||
DefectResp toDefectResp(DefectEntity entity);
|
||||
|
||||
ProjectResp toProjectResp(ProjectEntity entity);
|
||||
|
||||
ProjectEntity toProjectEntity(ProjectReq req);
|
||||
}
|
||||
|
|
|
@ -17,9 +17,9 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
|||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("personnel")
|
||||
@ApiModel(value="PersonnelEntity对象", description="人员信息表")
|
||||
public class PersonnelEntity extends AuditableEntity implements Serializable {
|
||||
@TableName("person")
|
||||
@ApiModel(value="PersonEntity对象", description="人员信息表")
|
||||
public class PersonEntity extends AuditableEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -62273861742734411L;
|
||||
|
|
@ -83,12 +83,12 @@ public class ProjectEntity extends AuditableEntity implements Serializable {
|
|||
private String turbineModel;
|
||||
|
||||
@ApiModelProperty("施工人员")
|
||||
@TableField("construction_personnel")
|
||||
private String constructionPersonnel;
|
||||
@TableField("construction_person")
|
||||
private String constructionPerson;
|
||||
|
||||
@ApiModelProperty("施工人员id")
|
||||
@TableField("construction_personnel_id")
|
||||
private String constructionPersonnelId;
|
||||
@TableField("construction_person_id")
|
||||
private String constructionPersonId;
|
||||
|
||||
@ApiModelProperty("安全员id")
|
||||
@TableField("auditor_id")
|
||||
|
|
|
@ -13,7 +13,7 @@ import lombok.Data;
|
|||
*/
|
||||
@Data
|
||||
@ApiModel("人员信息列表请求实体")
|
||||
public class PersonnelListReq implements Serializable {
|
||||
public class PersonListReq implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -10363935468256543L;
|
||||
|
|
@ -3,7 +3,7 @@ package com.dite.znpt.domain.vo;
|
|||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import com.dite.znpt.domain.entity.PersonnelEntity;
|
||||
import com.dite.znpt.domain.entity.PersonEntity;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
|
@ -13,6 +13,6 @@ import com.dite.znpt.domain.entity.PersonnelEntity;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("人员信息响应实体")
|
||||
public class PersonnelResp extends PersonnelEntity {
|
||||
public class PersonResp extends PersonEntity {
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -19,9 +20,6 @@ public class ProjectListReq implements Serializable {
|
|||
|
||||
private static final long serialVersionUID = -74121355744234753L;
|
||||
|
||||
@ApiModelProperty("查询关键字")
|
||||
private String keyword;
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
|
@ -37,11 +35,13 @@ public class ProjectListReq implements Serializable {
|
|||
@ApiModelProperty("项目状态,枚举:ProjectStatusEnum")
|
||||
private String status;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty("创建日期-起")
|
||||
private LocalDate createDateBegin;
|
||||
private String createDateBegin;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty("创建日期-讫")
|
||||
private LocalDate createDateEnd;
|
||||
private String createDateEnd;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.dite.znpt.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
@ -19,15 +20,18 @@ public class ProjectReq implements Serializable {
|
|||
@Serial
|
||||
private static final long serialVersionUID = 740685592879189406L;
|
||||
|
||||
@ExcelProperty("项目名称")
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("项目封面")
|
||||
private String coverUrl;
|
||||
|
||||
@ExcelProperty("风场名称")
|
||||
@ApiModelProperty("风场名称")
|
||||
private String farmName;
|
||||
|
||||
@ExcelProperty("风场地址")
|
||||
@ApiModelProperty("风场地址")
|
||||
private String farmAddress;
|
||||
|
||||
|
@ -49,17 +53,19 @@ public class ProjectReq implements Serializable {
|
|||
@ApiModelProperty("检查单位联系电话")
|
||||
private String inspectionPhone;
|
||||
|
||||
@ExcelProperty("项目规模")
|
||||
@ApiModelProperty("项目规模")
|
||||
private String scale;
|
||||
|
||||
@ExcelProperty("风机型号")
|
||||
@ApiModelProperty("风机型号")
|
||||
private String turbineModel;
|
||||
|
||||
@ApiModelProperty("施工人员")
|
||||
private String constructionPersonnel;
|
||||
|
||||
@ApiModelProperty("施工人员id")
|
||||
private String constructionPersonnelId;
|
||||
private String constructionPersonId;
|
||||
|
||||
@ApiModelProperty("施工人员")
|
||||
private String constructionPersonName;
|
||||
|
||||
@ApiModelProperty("安全员id")
|
||||
private String auditorId;
|
||||
|
@ -89,7 +95,7 @@ public class ProjectReq implements Serializable {
|
|||
private String discloseContent;
|
||||
|
||||
@ApiModelProperty("状态:0待施工,1施工中,2已完工,3已审核,4已验收")
|
||||
private Integer status;
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty("项目工作类型 可能有多项,逗号分隔")
|
||||
private String workType;
|
||||
|
|
|
@ -26,7 +26,23 @@ public class ProjectResp extends ProjectReq implements Serializable {
|
|||
@Serial
|
||||
private static final long serialVersionUID = -1883901559600186726L;
|
||||
|
||||
@ExcelProperty("项目id")
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("安全员")
|
||||
private String auditorName;
|
||||
|
||||
@ApiModelProperty("质量员")
|
||||
private String qualityOfficerName;
|
||||
|
||||
@ApiModelProperty("项目经理")
|
||||
private String projectManagerName;
|
||||
|
||||
@ApiModelProperty("施工组长")
|
||||
private String constructionTeamLeaderName;
|
||||
|
||||
@ApiModelProperty("状态:0待施工,1施工中,2已完工,3已审核,4已验收")
|
||||
private String statusLabel;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
package com.dite.znpt.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.PersonnelEntity;
|
||||
import com.dite.znpt.domain.vo.PersonnelListReq;
|
||||
import com.dite.znpt.domain.vo.PersonnelResp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.dite.znpt.domain.entity.PersonEntity;
|
||||
import com.dite.znpt.domain.vo.PersonListReq;
|
||||
import com.dite.znpt.domain.vo.PersonResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -13,7 +12,7 @@ import java.util.List;
|
|||
* @date 2025/04/11 23:17
|
||||
* @Description: 人员信息表数据库访问层
|
||||
*/
|
||||
public interface PersonnelMapper extends BaseMapper<PersonnelEntity> {
|
||||
List<PersonnelResp> queryBySelective(PersonnelListReq personnelReq);
|
||||
public interface PersonnelMapper extends BaseMapper<PersonEntity> {
|
||||
List<PersonResp> queryBySelective(PersonListReq personnelReq);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.dite.znpt.mapper;
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.dite.znpt.domain.entity.ProjectEntity;
|
||||
import com.dite.znpt.domain.vo.ProjectListReq;
|
||||
import com.dite.znpt.domain.vo.ProjectListResp;
|
||||
import com.dite.znpt.domain.vo.ProjectResp;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
@ -14,6 +15,6 @@ import java.util.List;
|
|||
* @Description: 项目信息表数据库访问层
|
||||
*/
|
||||
public interface ProjectMapper extends BaseMapper<ProjectEntity> {
|
||||
List<ProjectResp> queryBySelective(ProjectListReq projectReq);
|
||||
List<ProjectListResp> queryBySelective(ProjectListReq projectReq);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.dite.znpt.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.dite.znpt.domain.entity.PersonnelEntity;
|
||||
import com.dite.znpt.domain.vo.PersonnelListReq;
|
||||
import com.dite.znpt.domain.vo.PersonnelResp;
|
||||
import com.dite.znpt.domain.entity.PersonEntity;
|
||||
import com.dite.znpt.domain.vo.PersonListReq;
|
||||
import com.dite.znpt.domain.vo.PersonResp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -12,27 +12,27 @@ import java.util.List;
|
|||
* @date 2025/04/11 23:17
|
||||
* @Description: 人员信息表服务接口
|
||||
*/
|
||||
public interface PersonnelService extends IService<PersonnelEntity> {
|
||||
public interface PersonService extends IService<PersonEntity> {
|
||||
|
||||
/**
|
||||
* 功能描述:查询人员信息列表
|
||||
*
|
||||
* @param personnelReq 人员信息
|
||||
* @return {@link List }<{@link PersonnelEntity }>
|
||||
* @return {@link List }<{@link PersonEntity }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
List<PersonnelResp> selectList(PersonnelListReq personnelReq);
|
||||
List<PersonResp> selectList(PersonListReq personnelReq);
|
||||
|
||||
/**
|
||||
* 功能描述:查询单条人员信息
|
||||
*
|
||||
* @param personId 人员信息Id
|
||||
* @return {@link PersonnelResp }
|
||||
* @return {@link PersonResp }
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
PersonnelResp selectById(String personId);
|
||||
PersonResp selectById(String personId);
|
||||
|
||||
/**
|
||||
* 功能描述:新增人员信息
|
||||
|
@ -41,7 +41,7 @@ public interface PersonnelService extends IService<PersonnelEntity> {
|
|||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
void saveData(PersonnelEntity personnel);
|
||||
void saveData(PersonEntity personnel);
|
||||
|
||||
/**
|
||||
* 功能描述:更新人员信息
|
||||
|
@ -50,7 +50,7 @@ public interface PersonnelService extends IService<PersonnelEntity> {
|
|||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
void updateData(PersonnelEntity personnel);
|
||||
void updateData(PersonEntity personnel);
|
||||
|
||||
/**
|
||||
* 功能描述:删除人员信息
|
|
@ -1,10 +1,10 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.domain.entity.PersonnelEntity;
|
||||
import com.dite.znpt.domain.vo.PersonnelListReq;
|
||||
import com.dite.znpt.domain.vo.PersonnelResp;
|
||||
import com.dite.znpt.service.PersonnelService;
|
||||
import com.dite.znpt.domain.entity.PersonEntity;
|
||||
import com.dite.znpt.domain.vo.PersonListReq;
|
||||
import com.dite.znpt.domain.vo.PersonResp;
|
||||
import com.dite.znpt.service.PersonService;
|
||||
import com.dite.znpt.mapper.PersonnelMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
|
@ -20,20 +20,20 @@ import java.util.List;
|
|||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PersonnelServiceImpl extends ServiceImpl<PersonnelMapper, PersonnelEntity> implements PersonnelService {
|
||||
public class PersonServiceImpl extends ServiceImpl<PersonnelMapper, PersonEntity> implements PersonService {
|
||||
|
||||
/**
|
||||
* 功能描述:查询人员信息列表
|
||||
*
|
||||
* @param personnelReq 人员信息信息
|
||||
* @return {@link List }<{@link PersonnelResp }>
|
||||
* @return {@link List }<{@link PersonResp }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public List<PersonnelResp> selectList(PersonnelListReq personnelReq) {
|
||||
public List<PersonResp> selectList(PersonListReq personnelReq) {
|
||||
PageUtil.startPage();
|
||||
List<PersonnelResp> personnelList= this.baseMapper.queryBySelective(personnelReq);
|
||||
List<PersonResp> personnelList= this.baseMapper.queryBySelective(personnelReq);
|
||||
personnelList.forEach(resp -> {
|
||||
|
||||
});
|
||||
|
@ -44,17 +44,17 @@ public class PersonnelServiceImpl extends ServiceImpl<PersonnelMapper, Personnel
|
|||
* 功能描述:查询单条人员信息
|
||||
*
|
||||
* @param personId 人员信息Id
|
||||
* @return {@link PersonnelResp }
|
||||
* @return {@link PersonResp }
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public PersonnelResp selectById(String personId) {
|
||||
PersonnelListReq personnelReq = new PersonnelListReq();
|
||||
public PersonResp selectById(String personId) {
|
||||
PersonListReq personnelReq = new PersonListReq();
|
||||
personnelReq.setPersonId(personId);
|
||||
|
||||
List<PersonnelResp> list = selectList(personnelReq);
|
||||
return list.isEmpty() ? CollUtil.getFirst(list) : new PersonnelResp();
|
||||
List<PersonResp> list = selectList(personnelReq);
|
||||
return list.isEmpty() ? CollUtil.getFirst(list) : new PersonResp();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,7 +65,7 @@ public class PersonnelServiceImpl extends ServiceImpl<PersonnelMapper, Personnel
|
|||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public void saveData(PersonnelEntity personnel) {
|
||||
public void saveData(PersonEntity personnel) {
|
||||
// todo 校验
|
||||
save(personnel);
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ public class PersonnelServiceImpl extends ServiceImpl<PersonnelMapper, Personnel
|
|||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public void updateData(PersonnelEntity personnel) {
|
||||
public void updateData(PersonEntity personnel) {
|
||||
// todo 校验
|
||||
updateById(personnel);
|
||||
}
|
|
@ -1,20 +1,33 @@
|
|||
package com.dite.znpt.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.dite.znpt.constant.Message;
|
||||
import com.dite.znpt.converts.Converts;
|
||||
import com.dite.znpt.domain.entity.PersonEntity;
|
||||
import com.dite.znpt.domain.entity.ProjectEntity;
|
||||
import com.dite.znpt.domain.vo.ProjectListReq;
|
||||
import com.dite.znpt.domain.vo.ProjectListResp;
|
||||
import com.dite.znpt.domain.vo.ProjectReq;
|
||||
import com.dite.znpt.domain.vo.ProjectResp;
|
||||
import com.dite.znpt.enums.ProjectStatusEnum;
|
||||
import com.dite.znpt.exception.ServiceException;
|
||||
import com.dite.znpt.service.PersonService;
|
||||
import com.dite.znpt.service.ProjectService;
|
||||
import com.dite.znpt.mapper.ProjectMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.dite.znpt.util.PageUtil;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author huise23
|
||||
|
@ -25,31 +38,29 @@ import java.util.List;
|
|||
@RequiredArgsConstructor
|
||||
public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity> implements ProjectService {
|
||||
|
||||
@Resource
|
||||
private PersonService personService;
|
||||
/**
|
||||
* 功能描述:查询项目信息列表
|
||||
*
|
||||
* @param projectReq 项目信息信息
|
||||
* @param req 项目信息信息
|
||||
* @return {@link List }<{@link ProjectResp }>
|
||||
* @author huise23
|
||||
* @date 2025/04/11 23:17
|
||||
**/
|
||||
@Override
|
||||
public List<ProjectListResp> page(ProjectListReq projectReq) {
|
||||
public List<ProjectListResp> page(ProjectListReq req) {
|
||||
PageUtil.startPage();
|
||||
List<ProjectResp> projectList= this.baseMapper.queryBySelective(projectReq);
|
||||
projectList.forEach(resp -> {
|
||||
|
||||
});
|
||||
return null;
|
||||
return this.list(req);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProjectListResp> list(ProjectListReq projectReq) {
|
||||
List<ProjectResp> projectList= this.baseMapper.queryBySelective(projectReq);
|
||||
projectList.forEach(resp -> {
|
||||
|
||||
public List<ProjectListResp> list(ProjectListReq req) {
|
||||
List<ProjectListResp> list= this.baseMapper.queryBySelective(req);
|
||||
list.forEach(resp -> {
|
||||
resp.setStatusLabel(ProjectStatusEnum.getDescByCode(resp.getStatus()));
|
||||
});
|
||||
return null;
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -62,8 +73,35 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity
|
|||
**/
|
||||
@Override
|
||||
public ProjectResp detail(String projectId) {
|
||||
|
||||
return null;
|
||||
ProjectEntity entity = this.baseMapper.selectById(projectId);
|
||||
if(entity == null){
|
||||
throw new ServiceException(Message.PROJECT_ID_IS_NOT_EXIST);
|
||||
}
|
||||
ProjectResp resp = Converts.INSTANCE.toProjectResp(entity);
|
||||
resp.setStatusLabel(ProjectStatusEnum.getDescByCode(resp.getStatus()));
|
||||
List<String> personIds = new ArrayList<>();
|
||||
if(StrUtil.isNotEmpty(resp.getAuditorId())){
|
||||
personIds.add(resp.getAuditorId());
|
||||
}
|
||||
if(StrUtil.isNotEmpty(resp.getQualityOfficerId())){
|
||||
personIds.add(resp.getQualityOfficerId());
|
||||
}
|
||||
if(StrUtil.isNotEmpty(resp.getConstructionTeamLeaderId())){
|
||||
personIds.add(resp.getConstructionTeamLeaderId());
|
||||
}
|
||||
if(StrUtil.isNotEmpty(resp.getProjectManagerId())){
|
||||
personIds.add(resp.getProjectManagerId());
|
||||
}
|
||||
if(CollUtil.isNotEmpty(personIds)){
|
||||
Map<String, PersonEntity> personIdMap = personService.listByIds(personIds).stream().collect(Collectors.toMap(k->k.getPersonId(), Function.identity()));
|
||||
if(CollUtil.isNotEmpty(personIdMap)){
|
||||
resp.setAuditorName(personIdMap.containsKey(resp.getAuditorId()) ? personIdMap.get(resp.getAuditorId()).getName() : null);
|
||||
resp.setProjectManagerName(personIdMap.containsKey(resp.getProjectManagerId()) ? personIdMap.get(resp.getProjectManagerId()).getName() : null);
|
||||
resp.setConstructionTeamLeaderName(personIdMap.containsKey(resp.getConstructionTeamLeaderId()) ? personIdMap.get(resp.getConstructionTeamLeaderId()).getName() : null);
|
||||
resp.setQualityOfficerName(personIdMap.containsKey(resp.getQualityOfficerId()) ? personIdMap.get(resp.getQualityOfficerId()).getName() : null);
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,8 +114,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void save(ProjectReq req) {
|
||||
// todo 校验
|
||||
|
||||
ProjectEntity entity = Converts.INSTANCE.toProjectEntity(req);
|
||||
this.save(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,8 +129,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void update(String projectId, ProjectReq req) {
|
||||
// todo 校验
|
||||
|
||||
if(null == this.baseMapper.selectById(projectId)){
|
||||
throw new ServiceException(Message.PROJECT_ID_IS_NOT_EXIST);
|
||||
}
|
||||
ProjectEntity entity = Converts.INSTANCE.toProjectEntity(req);
|
||||
entity.setProjectId(projectId);
|
||||
this.updateById(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,7 +147,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, ProjectEntity
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void deleteById(String projectId) {
|
||||
// todo 校验
|
||||
removeById(projectId);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
a.password, a.status
|
||||
</sql>
|
||||
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.PersonnelResp">
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.PersonResp">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from personnel a
|
||||
|
|
|
@ -2,42 +2,32 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.dite.znpt.mapper.ProjectMapper">
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
a.project_id, a.project_name, a.farm_name, a.farm_address,
|
||||
a.method_id, a.scale, a.turbine_model, a.status
|
||||
</sql>
|
||||
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.ProjectResp">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from project a
|
||||
|
||||
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.ProjectListResp">
|
||||
SELECT
|
||||
prj.project_id, prj.project_name, prj.farm_name, prj.status, prj.cover_url, prj.farm_address, prj.client, prj.client_contact, prj.client_phone, prj.inspection_unit,
|
||||
prj.inspection_contact, prj.inspection_phone, prj.scale, prj.turbine_model, prj.project_manager_id, pm.name AS project_manager_name, prj.construction_person_id, prj.construction_person_name , prj.create_time
|
||||
FROM project prj
|
||||
LEFT JOIN person pm ON pm.person_id = prj.project_manager_id
|
||||
<where>
|
||||
<if test="keyword != null and keyword != ''">
|
||||
# and (a.TODO like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or a.TODO like concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
|
||||
</if>
|
||||
<if test="projectId != null and projectId != ''">
|
||||
and a.project_id like concat ('%', #{projectId}, '%')
|
||||
</if>
|
||||
<if test="projectName != null and projectName != ''">
|
||||
and a.project_name like concat ('%', #{projectName}, '%')
|
||||
AND prj.project_name LIKE concat ('%', #{projectName}, '%')
|
||||
</if>
|
||||
<if test="farmName != null and farmName != ''">
|
||||
and a.farm_name like concat ('%', #{farmName}, '%')
|
||||
AND prj.farm_name LIKE concat ('%', #{farmName}, '%')
|
||||
</if>
|
||||
<if test="farmAddress != null and farmAddress != ''">
|
||||
and a.farm_address like concat ('%', #{farmAddress}, '%')
|
||||
AND prj.farm_address LIKE concat ('%', #{farmAddress}, '%')
|
||||
</if>
|
||||
<if test="methodId != null and methodId != ''">
|
||||
and a.method_id like concat ('%', #{methodId}, '%')
|
||||
</if>
|
||||
<if test="scale != null and scale != ''">
|
||||
and a.scale like concat ('%', #{scale}, '%')
|
||||
</if>
|
||||
<if test="turbineModel != null and turbineModel != ''">
|
||||
and a.turbine_model like concat ('%', #{turbineModel}, '%')
|
||||
<if test="client != null and client != ''">
|
||||
AND prj.client LIKE concat ('%', #{client}, '%')
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and a.status like concat ('%', #{status}, '%')
|
||||
AND prj.status = #{status}
|
||||
</if>
|
||||
<if test="createDateBegin != null and createDateBegin !='' and createDateEnd != null and createDateEnd != '' ">
|
||||
AND prj.create_time BETWEEN #{createDateBegin} AND #{createDateEnd}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
|
|
@ -2,10 +2,10 @@ package com.dite.znpt.web.controller;
|
|||
|
||||
|
||||
import com.dite.znpt.domain.Constants;
|
||||
import com.dite.znpt.domain.vo.PersonnelListReq;
|
||||
import com.dite.znpt.domain.vo.PersonnelResp;
|
||||
import com.dite.znpt.domain.entity.PersonnelEntity;
|
||||
import com.dite.znpt.service.PersonnelService;
|
||||
import com.dite.znpt.domain.vo.PersonListReq;
|
||||
import com.dite.znpt.domain.vo.PersonResp;
|
||||
import com.dite.znpt.domain.entity.PersonEntity;
|
||||
import com.dite.znpt.service.PersonService;
|
||||
import com.dite.znpt.domain.Result;
|
||||
import com.dite.znpt.domain.PageResult;
|
||||
import com.pig4cloud.plugin.excel.annotation.RequestExcel;
|
||||
|
@ -25,54 +25,54 @@ import java.util.List;
|
|||
*/
|
||||
@Api(tags = "人员信息")
|
||||
@RestController
|
||||
@RequestMapping("/personnel")
|
||||
public class PersonnelController {
|
||||
@RequestMapping("/person")
|
||||
public class PersonController {
|
||||
@Resource
|
||||
private PersonnelService personnelService;
|
||||
private PersonService personService;
|
||||
|
||||
@ApiOperation(value = "获取人员信息列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public PageResult<PersonnelResp> list(PersonnelListReq personnelReq) {
|
||||
return PageResult.ok(personnelService.selectList(personnelReq));
|
||||
public PageResult<PersonResp> list(PersonListReq personnelReq) {
|
||||
return PageResult.ok(personService.selectList(personnelReq));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "根据人员信息Id获取详细信息", httpMethod = "GET")
|
||||
@GetMapping("/{personId}")
|
||||
public Result<PersonnelResp> getInfo(@PathVariable String personId) {
|
||||
return Result.ok(personnelService.selectById(personId));
|
||||
public Result<PersonResp> getInfo(@PathVariable String personId) {
|
||||
return Result.ok(personService.selectById(personId));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增人员信息", httpMethod = "POST")
|
||||
@PostMapping
|
||||
public Result<Object> add(@RequestBody PersonnelEntity personnel) {
|
||||
personnelService.saveData(personnel);
|
||||
public Result<Object> add(@RequestBody PersonEntity personnel) {
|
||||
personService.saveData(personnel);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改人员信息", httpMethod = "PUT")
|
||||
@PutMapping
|
||||
public Result<Object> edit(@RequestBody PersonnelEntity personnel) {
|
||||
personnelService.updateData(personnel);
|
||||
public Result<Object> edit(@RequestBody PersonEntity personnel) {
|
||||
personService.updateData(personnel);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除人员信息", httpMethod = "DELETE")
|
||||
@DeleteMapping("/{personId}")
|
||||
public Result<Object> remove(@PathVariable String personId) {
|
||||
personnelService.deleteById(personId);
|
||||
personService.deleteById(personId);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出人员信息", httpMethod = "GET")
|
||||
@GetMapping("/export")
|
||||
@ResponseExcel(name = "人员信息")
|
||||
public List<PersonnelResp> export(PersonnelListReq personnelReq) {
|
||||
return personnelService.selectList(personnelReq);
|
||||
public List<PersonResp> export(PersonListReq personnelReq) {
|
||||
return personService.selectList(personnelReq);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入人员信息", httpMethod = "POST")
|
||||
@PostMapping("/import")
|
||||
public Result<Object> importData(@RequestExcel List<PersonnelEntity> dataList, BindingResult bindingResult) {
|
||||
public Result<Object> importData(@RequestExcel List<PersonEntity> dataList, BindingResult bindingResult) {
|
||||
// JSR 303 校验通用校验获取失败的数据
|
||||
List<ErrorMessage> errorMessageList = (List<ErrorMessage>) bindingResult.getTarget();
|
||||
if (errorMessageList != null && !errorMessageList.isEmpty()) {
|
|
@ -32,12 +32,18 @@ public class ProjectController {
|
|||
@Resource
|
||||
private ProjectService projectService;
|
||||
|
||||
@ApiOperation(value = "获取项目信息列表", httpMethod = "GET")
|
||||
@ApiOperation(value = "分页查询项目信息列表", httpMethod = "GET")
|
||||
@GetMapping("/page")
|
||||
public PageResult<ProjectListResp> page(@RequestBody ProjectListReq req) {
|
||||
public PageResult<ProjectListResp> page(ProjectListReq req) {
|
||||
return PageResult.ok(projectService.page(req));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询项目信息列表", httpMethod = "GET")
|
||||
@GetMapping("/list")
|
||||
public Result<List<ProjectListResp>> list(ProjectListReq req) {
|
||||
return Result.ok(projectService.list(req));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询项目信息详细信息", httpMethod = "GET")
|
||||
@GetMapping("/detail/{projectId}")
|
||||
public Result<ProjectResp> detail(@PathVariable String projectId) {
|
||||
|
@ -65,14 +71,14 @@ public class ProjectController {
|
|||
return Result.ok();
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出项目信息", httpMethod = "GET")
|
||||
@ApiOperation(value = "导出项目信息-需求待明确", httpMethod = "GET")
|
||||
@GetMapping("/export")
|
||||
@ResponseExcel(name = "项目信息")
|
||||
public List<ProjectResp> export(ProjectListReq req) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导入项目信息", httpMethod = "POST")
|
||||
@ApiOperation(value = "导入项目信息-需求待明确", httpMethod = "POST")
|
||||
@PostMapping("/import")
|
||||
public Result<Object> importData(@RequestExcel List<ProjectEntity> dataList, BindingResult bindingResult) {
|
||||
// JSR 303 校验通用校验获取失败的数据
|
||||
|
|
|
@ -84,7 +84,7 @@ spring:
|
|||
|
||||
sip-config:
|
||||
name: 信令服务
|
||||
ip: 192.168.0.207
|
||||
ip: 192.168.0.112
|
||||
port: 1074
|
||||
charset: gb2312
|
||||
domain: 3402000000
|
||||
|
@ -100,7 +100,7 @@ zlm-config:
|
|||
# 公网ip
|
||||
publicHost:
|
||||
# 接口ip
|
||||
apiHost: 192.168.0.207
|
||||
apiHost: 192.168.0.112
|
||||
# 接口端口
|
||||
apiPort: 8080
|
||||
# 密钥
|
||||
|
@ -108,7 +108,7 @@ zlm-config:
|
|||
# 流id前缀
|
||||
streamPrefix:
|
||||
# rtp ip
|
||||
rtpHost: 192.168.0.207
|
||||
rtpHost: 192.168.0.112
|
||||
# rtp 端口
|
||||
rtpPort: 8080
|
||||
# 动态端口起始值
|
||||
|
|
Loading…
Reference in New Issue