Merge remote-tracking branch 'origin/master'
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();
|
||||
|
||||
|
||||
+5
-3
@@ -171,10 +171,12 @@ 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,
|
||||
@RequestParam(name="projectId",required=true) String projectId,
|
||||
public Result<?> importExcel(MultipartFile file,
|
||||
HttpServletRequest request,
|
||||
@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, request);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+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, HttpServletRequest request) 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);
|
||||
|
||||
|
||||
+34
-16
@@ -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,11 +693,14 @@ 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, HttpServletRequest request) throws IOException, InvalidFormatException {
|
||||
//验证token
|
||||
String token = request.getHeader("X-Access-Token");
|
||||
TokenUtils.verifyToken(token, sysBaseAPI, redisUtil);
|
||||
String explainInfo= null;
|
||||
String titleOne = "";
|
||||
|
||||
@@ -778,14 +782,22 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
if (i == 1) {//校验填写说明
|
||||
row = sheet.getRow(i);
|
||||
int columNos = row.getLastCellNum();
|
||||
for (int k = 0; k < columNos; k++){
|
||||
if (row.getPhysicalNumberOfCells()>1 && StringUtils.isNotBlank(row.getCell(k).getStringCellValue())) {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
throw new JeroBootException("填写说明列数不对,请按照模板格式填写内容");
|
||||
} else {
|
||||
throw new JeroBootException("The number of columns of filling explanation is wrong. Please fill in the contents according to the template format.");
|
||||
if (StringUtils.isNotBlank(row.getCell(0).getStringCellValue())){
|
||||
for (int k = 1; k < columNos; k++){
|
||||
if(StringUtils.isNotBlank(row.getCell(k).getStringCellValue())){
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
throw new JeroBootException("第二行填写说明列数不对,请按照模板格式填写内容");
|
||||
} else {
|
||||
throw new JeroBootException("The number of explanatory columns in the second line is incorrect. Please fill in the contents according to the template format.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
throw new JeroBootException("填写说明不能为空,请按照模板格式填写内容");
|
||||
} else {
|
||||
throw new JeroBootException("The description cannot be blank. Please fill in the content according to the template format.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (i > 1) {//读取数据
|
||||
@@ -833,6 +845,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 +857,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 +1025,7 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
//
|
||||
|
||||
row++;
|
||||
result.error500(message.toString());
|
||||
}
|
||||
|
||||
//中英切换提示语,message为空 = 之前的数据没错
|
||||
@@ -1019,8 +1036,9 @@ public class ProjectRelatedPersonnelServiceImpl extends ServiceImpl<ProjectRelat
|
||||
} else {
|
||||
message.append("Import succeeded.");
|
||||
}
|
||||
result.success(message.toString());
|
||||
}
|
||||
throw new JeroBootException(message.toString());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -445,18 +445,20 @@ export default {
|
||||
})
|
||||
this.contentList = _tt
|
||||
} else {
|
||||
console.log(this.contentListedEdit,'编辑')
|
||||
console.log(this.contentListed,'联动数据')
|
||||
val.forEach((item) => {
|
||||
this.contentListed.push({
|
||||
textVal: '', // tab
|
||||
certCategory: item.value, // 所属认证类别
|
||||
paramsNumber: '', // 编号
|
||||
paramsName: '', // 参数名称
|
||||
description: ''// 参数说明
|
||||
let _val = []
|
||||
val.map((itemVal) => {
|
||||
this.contentListedEdit.forEach((item) => {
|
||||
if(item.certCategory == itemVal.value) {
|
||||
itemVal.textVal = item.textVal
|
||||
itemVal.certCategory = item.value
|
||||
itemVal.paramsNumber = item.nioNumber
|
||||
itemVal.paramsName = item.paramsName
|
||||
itemVal.description = item.description
|
||||
}
|
||||
})
|
||||
_val.push(itemVal)
|
||||
})
|
||||
this.contentList = val
|
||||
this.contentList = _val
|
||||
}
|
||||
},
|
||||
Onchange(val) {
|
||||
@@ -498,12 +500,12 @@ export default {
|
||||
this.visible = true
|
||||
this.formInline = value
|
||||
this.title = '编辑'
|
||||
this.contentListedEdit = value.certCategoryParamsInfoEOList
|
||||
value.certCategoryParamsInfoEOList.map((item, index) => {
|
||||
item.textVal = item.certCategory_dictText
|
||||
this.contentListed.push(item)
|
||||
})
|
||||
this.contentList = this.contentListed
|
||||
this.contentListedEdit = this.contentListed
|
||||
},
|
||||
handleCancel() {
|
||||
this.visible = false
|
||||
|
||||
Reference in New Issue
Block a user