相关人员bug修改
This commit is contained in:
+3
@@ -23,6 +23,9 @@ public interface SysDictItemMapper extends BaseMapper<SysDictItem> {
|
||||
@Select("SELECT sys_dict_item.* FROM sys_dict_item LEFT JOIN sys_dict ON sys_dict_item.dict_id = sys_dict.id WHERE DICT_CODE = #{dictCode} order by sort_order asc, item_value asc")
|
||||
public List<SysDictItem> selectItemsByDictCode(String dictCode);
|
||||
|
||||
@Select("SELECT sys_dict_item.* FROM sys_dict_item LEFT JOIN sys_dict ON sys_dict_item.dict_id = sys_dict.id WHERE DICT_CODE = #{dictCode} order by create_time asc")
|
||||
public List<SysDictItem> selectItemsOrderByCreateTime(String dictCode);
|
||||
|
||||
@Select("SELECT sys_dict.dict_code,sys_dict_item.* from sys_dict_item LEFT JOIN sys_dict ON sys_dict_item.dict_id = sys_dict.id where status = 1")
|
||||
List<SysDictItem> selectItemsAll();
|
||||
|
||||
|
||||
+3
-2
@@ -171,10 +171,11 @@ public class ProjectRelatedPersonnelController extends JeroController<ProjectRel
|
||||
@ApiOperation(value="项目库-相关人员维护表-通过excel导入数据", notes="项目库-相关人员维护表-通过excel导入数据")
|
||||
@RequiresPermissions("projectRelatedPersonnel:importExcel")
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public void importExcel(MultipartFile file,
|
||||
public Result<?> importExcel(MultipartFile file,
|
||||
@RequestParam(name="projectId",required=true) String projectId,
|
||||
@RequestParam(name="cut",required=true) String cut) throws IOException, InvalidFormatException {
|
||||
projectRelatedPersonnelService.importExcel(file, ProjectRelatedPersonnel.class, projectId, cut);
|
||||
|
||||
return projectRelatedPersonnelService.importExcel(file, ProjectRelatedPersonnel.class, projectId, cut);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface ProjectRelatedPersonnelMapper extends BaseMapper<ProjectRelatedPersonnel> {
|
||||
|
||||
List<ProjectRelatedPersonnel> queryPageList(@Param("projectId") String projectId);
|
||||
List<ProjectRelatedPersonnel> queryPageList(@Param("projectId") String projectId,String dictCode);
|
||||
|
||||
List<ProjectRelatedPersonnel> queryById(@Param("id")String id);
|
||||
}
|
||||
|
||||
+6
-2
@@ -27,7 +27,8 @@
|
||||
prp.create_time,
|
||||
prp.update_by,
|
||||
prp.update_time,
|
||||
prp.sys_org_code
|
||||
prp.sys_org_code,
|
||||
sdi.create_time
|
||||
</sql>
|
||||
|
||||
<select id="queryPageList" resultType="com.jero.modules.project.entity.ProjectRelatedPersonnel">
|
||||
@@ -35,12 +36,15 @@
|
||||
<include refid="select_item"/>
|
||||
FROM
|
||||
project_related_personnel AS prp
|
||||
LEFT JOIN sys_dict_item AS sdi ON sdi.item_value = prp.duty_territory
|
||||
LEFT JOIN sys_dict AS sd ON sd.id = sdi.dict_id
|
||||
<where>
|
||||
<if test="projectId != null and projectId != ''">
|
||||
prp.project_id=#{projectId}
|
||||
</if>
|
||||
AND sd.dict_code = #{dictCode}
|
||||
</where>
|
||||
order by prp.create_time desc
|
||||
ORDER BY sdi.create_time
|
||||
</select>
|
||||
|
||||
<select id="queryById" resultType="com.jero.modules.project.entity.ProjectRelatedPersonnel">
|
||||
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
package com.jero.modules.project.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.project.entity.ProjectRelatedPersonnel;
|
||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -79,10 +80,10 @@ public interface IProjectRelatedPersonnelService extends IService<ProjectRelated
|
||||
/**设置导出模板*/
|
||||
void exportTemplate(ProjectRelatedPersonnel projectRelatedPersonnel, HttpServletResponse response, HttpServletRequest request);
|
||||
|
||||
void importExcel(MultipartFile file, Class<ProjectRelatedPersonnel> clazz, String projectId, String cut) throws IOException, InvalidFormatException;
|
||||
Result<?> importExcel(MultipartFile file, Class<ProjectRelatedPersonnel> clazz, String projectId, String cut) throws IOException, InvalidFormatException;
|
||||
|
||||
|
||||
void oppositeDisposeData(List<ProjectRelatedPersonnel> records, String projectId, String cut);
|
||||
Result<?> oppositeDisposeData(List<ProjectRelatedPersonnel> records, String projectId, String cut);
|
||||
|
||||
ProjectRelatedPersonnel queryByProjectIdAndDutyTerritory(String projectId, String dutyTerritory);
|
||||
|
||||
|
||||
+17
-9
@@ -3,6 +3,7 @@ package com.jero.modules.project.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
@@ -180,7 +181,7 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
@Override
|
||||
public List<ProjectRelatedPersonnel> queryPageList(String projectId) {
|
||||
//查询数据
|
||||
List<ProjectRelatedPersonnel> result = projectRelatedPersonnelMapper.queryPageList(projectId);
|
||||
List<ProjectRelatedPersonnel> result = projectRelatedPersonnelMapper.queryPageList(projectId,DictCodeEnum.DUTY_TERRITORY.getValue());
|
||||
//查询数据里的责任领域
|
||||
List<String> dutyTerritory = result.stream().map(e -> e.getDutyTerritory()).collect(Collectors.toList());
|
||||
//查标签内容里的责任领域数据
|
||||
@@ -197,7 +198,7 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
}
|
||||
}
|
||||
//重新查询列表
|
||||
result = projectRelatedPersonnelMapper.queryPageList(projectId);
|
||||
result = projectRelatedPersonnelMapper.queryPageList(projectId,DictCodeEnum.DUTY_TERRITORY.getValue());
|
||||
}
|
||||
disposeData(result);
|
||||
return result;
|
||||
@@ -660,7 +661,7 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
cell.setCellStyle(cellStyleTemp);
|
||||
|
||||
//查标签内容里的责任领域数据
|
||||
List<SysDictItem> dutyTerritory = sysDictItemMapper.selectItemsByDictCode(ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue());
|
||||
List<SysDictItem> dutyTerritory = sysDictItemMapper.selectItemsOrderByCreateTime(ProjectInventoryFieldEnum.DUTY_TERRITORY.getValue());
|
||||
List<String> dataList = dutyTerritory.stream().filter(e->e.getDelFlag()== CommonConstant.DEL_FLAG_0).map(e -> e.getItemText()).collect(Collectors.toList());
|
||||
//设置导出数据
|
||||
if(CollectionUtils.isNotEmpty(dataList)) {
|
||||
@@ -692,10 +693,11 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
/**
|
||||
* 导入excel数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void importExcel(MultipartFile file,
|
||||
Class<ProjectRelatedPersonnel> clazz, String projectId, String cut) throws IOException, InvalidFormatException {
|
||||
public Result<?> importExcel(MultipartFile file,
|
||||
Class<ProjectRelatedPersonnel> clazz, String projectId, String cut) throws IOException, InvalidFormatException {
|
||||
|
||||
String explainInfo= null;
|
||||
String titleOne = "";
|
||||
@@ -833,6 +835,8 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
String remark = remarkCell.toString();
|
||||
if(StringUtils.isNotEmpty(remark)) {
|
||||
projectRelatedPersonnel.setRemark(remark);
|
||||
}else {
|
||||
projectRelatedPersonnel.setRemark("");
|
||||
}
|
||||
|
||||
list.add(projectRelatedPersonnel);
|
||||
@@ -843,16 +847,18 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
}
|
||||
workbook.close();
|
||||
//把数据翻译成id,并保存
|
||||
oppositeDisposeData(list, projectId, cut);
|
||||
|
||||
Result<?> result = oppositeDisposeData(list, projectId, cut);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把导入的数据翻译成对应的id,校验,不存
|
||||
* 若除责任领域外的导入数据不能为空
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void oppositeDisposeData(List<ProjectRelatedPersonnel> records, String projectId, String cut) {
|
||||
public Result<?> oppositeDisposeData(List<ProjectRelatedPersonnel> records, String projectId, String cut) {
|
||||
Result<?> result = new Result<>();
|
||||
int row=3;
|
||||
StringBuilder message = new StringBuilder();
|
||||
for (ProjectRelatedPersonnel projectRelatedPersonnel:records) {
|
||||
@@ -1009,6 +1015,7 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
//
|
||||
|
||||
row++;
|
||||
result.error500(message.toString());
|
||||
}
|
||||
|
||||
//中英切换提示语,message为空 = 之前的数据没错
|
||||
@@ -1019,8 +1026,9 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
} else {
|
||||
message.append("Import succeeded.");
|
||||
}
|
||||
result.success(message.toString());
|
||||
}
|
||||
throw new JeroBootException(message.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user