应急救援队伍人员信息导入功能完成

公文管理公文删除优化
main
15036302109 12 months ago
parent a5eb92a210
commit 87485a3434

@ -14,6 +14,7 @@ import com.ruoyi.ehsDocTransfer.service.IEhsDocTransferService;
import com.ruoyi.ehsDocument.vo.DocResponseVo; import com.ruoyi.ehsDocument.vo.DocResponseVo;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
@ -138,13 +139,16 @@ public class EhsDocumentController extends BaseController {
} }
/** /**
* * ,
*/ */
@ApiOperation("删除公文管理") @ApiOperation("删除公文管理")
@PreAuthorize("@ss.hasPermi('ehs:ehsDocument:remove')") @PreAuthorize("@ss.hasPermi('ehs:ehsDocument:remove')")
@Log(title = "公文管理", businessType = BusinessType.DELETE) @Log(title = "公文管理", businessType = BusinessType.DELETE)
@Transactional
@DeleteMapping("/{ids}") @DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) { public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(ehsDocumentService.removeByIds(Arrays.asList(ids))); ehsDocumentService.removeByIds(Arrays.asList(ids));
boolean result = transferService.removeByDocumentIds(Arrays.asList(ids));
return toAjax(result);
} }
} }

@ -13,6 +13,7 @@ import com.ruoyi.ehsRescueTeam.domain.RescueTeamImportTemplate;
import com.ruoyi.ehsRescueTeam.service.IEhsRescueTeamService; import com.ruoyi.ehsRescueTeam.service.IEhsRescueTeamService;
import com.ruoyi.ehsRescueTeam.vo.TeamResponseVo; import com.ruoyi.ehsRescueTeam.vo.TeamResponseVo;
import com.ruoyi.ehsRescueTeamWorker.domain.EhsRescueTeamWorker; import com.ruoyi.ehsRescueTeamWorker.domain.EhsRescueTeamWorker;
import com.ruoyi.ehsRescueTeamWorker.domain.RescueTeamWorkerImportTemplate;
import com.ruoyi.ehsRescueTeamWorker.service.IEhsRescueTeamWorkerService; import com.ruoyi.ehsRescueTeamWorker.service.IEhsRescueTeamWorkerService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -141,10 +142,10 @@ public class EhsRescueTeamWorkerController extends BaseController {
* *
*/ */
@PostMapping("/importData") @PostMapping("/importData")
public AjaxResult importHubManage(MultipartFile file, Boolean updateSupport) throws Exception { public AjaxResult importData(MultipartFile file, Boolean updateSupport, Long params) throws Exception {
ExcelUtil<RescueTeamImportTemplate> util = new ExcelUtil<>(RescueTeamImportTemplate.class); ExcelUtil<RescueTeamWorkerImportTemplate> util = new ExcelUtil<>(RescueTeamWorkerImportTemplate.class);
List<RescueTeamImportTemplate> list = util.importExcel(file.getInputStream()); List<RescueTeamWorkerImportTemplate> list = util.importExcel(file.getInputStream());
String message = ehsRescueTeamService.importRescueTeam(list, updateSupport); String message = ehsRescueTeamWorkerService.importRescueTeamWorker(list, updateSupport, params);
return AjaxResult.success(message); return AjaxResult.success(message);
} }
} }

@ -33,4 +33,11 @@ public interface EhsDocTransferMapper extends BaseMapper<EhsDocTransfer> {
* id * id
*/ */
List<EhsDocTransfer> getTransferInfoByDocId(@Param("id") Long id); List<EhsDocTransfer> getTransferInfoByDocId(@Param("id") Long id);
/**
* ,
* @param documentIds
* @return
*/
boolean removeByDocumentIds(List<Long> documentIds);
} }

@ -33,4 +33,11 @@ public interface IEhsDocTransferService extends IService<EhsDocTransfer> {
* id * id
*/ */
List<EhsDocTransfer> getTransferInfoByDocId(Long id); List<EhsDocTransfer> getTransferInfoByDocId(Long id);
/**
* ,
* @param documentIds
* @return
*/
boolean removeByDocumentIds(List<Long> documentIds);
} }

@ -56,6 +56,17 @@ public class EhsDocTransferServiceImpl extends ServiceImpl<EhsDocTransferMapper,
return ehsDocTransferMapper.getTransferInfoByDocId(id); return ehsDocTransferMapper.getTransferInfoByDocId(id);
} }
/**
* ,
* @param documentIds
* @return
*/
@Override
public boolean removeByDocumentIds(List<Long> documentIds) {
return ehsDocTransferMapper.removeByDocumentIds(documentIds);
}
private LambdaQueryWrapper<EhsDocTransfer> buildQueryWrapper(EhsDocTransfer query) { private LambdaQueryWrapper<EhsDocTransfer> buildQueryWrapper(EhsDocTransfer query) {
Map<String, Object> params = query.getParams(); Map<String, Object> params = query.getParams();

@ -37,7 +37,7 @@ public class EhsRescueTeamWorker extends BaseEntity {
/** /**
* id * id
*/ */
@Excel(name = "应急救援队伍id") // @Excel(name = "应急救援队伍id")
private Long rescueTeamId; private Long rescueTeamId;
/** /**
@ -55,14 +55,14 @@ public class EhsRescueTeamWorker extends BaseEntity {
/** /**
* *
*/ */
@Excel(name = "性别") @Excel(name = "性别(0男 1女)")
private Integer gender; private Integer gender;
/** /**
* *
*/ */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出生年月", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "出生年月(格式为2023-12-12)", width = 30, dateFormat = "yyyy-MM-dd")
private Date birthday; private Date birthday;
/** /**

@ -0,0 +1,56 @@
package com.ruoyi.ehsRescueTeamWorker.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;
import java.util.Date;
@Data
public class RescueTeamWorkerImportTemplate {
/**
*
*/
@Excel(name = "人员姓名", type = Excel.Type.ALL)
private String workerName;
/**
*
*/
@Excel(name = "性别(0男 1女)", type = Excel.Type.ALL)
private Integer gender;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出生年月(格式为2023-12-12)", width = 30, dateFormat = "yyyy-MM-dd", type = Excel.Type.ALL)
private Date birthday;
/**
*
*/
@Excel(name = "身份证号", type = Excel.Type.ALL)
private String idCard;
/**
*
*/
@Excel(name = "联系方式", type = Excel.Type.ALL)
private String phone;
/**
*
*/
@Excel(name = "工作年限", type = Excel.Type.ALL)
private String workYear;
/**
*
*/
@Excel(name = "救援技能特长", type = Excel.Type.ALL)
private String speciality;
/**
*
*/
@Excel(name = "备注", type = Excel.Type.ALL)
private String remark;
}

@ -4,6 +4,7 @@ import java.util.List;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.ehsRescueTeamWorker.domain.EhsRescueTeamWorker; import com.ruoyi.ehsRescueTeamWorker.domain.EhsRescueTeamWorker;
import com.ruoyi.ehsRescueTeamWorker.domain.RescueTeamWorkerImportTemplate;
/** /**
* Service * Service
@ -31,4 +32,7 @@ public interface IEhsRescueTeamWorkerService extends IService<EhsRescueTeamWorke
// 根据队伍ids删除队伍中的队员 // 根据队伍ids删除队伍中的队员
boolean removeWorkerByTeamIds(List<Long> teamIds); boolean removeWorkerByTeamIds(List<Long> teamIds);
// 批量导入数据
public String importRescueTeamWorker(List<RescueTeamWorkerImportTemplate> list, Boolean updateSupport, Long params) throws Exception;
} }

@ -3,6 +3,11 @@ package com.ruoyi.ehsRescueTeamWorker.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.ehsRescueTeam.domain.EhsRescueTeam;
import com.ruoyi.ehsRescueTeam.domain.RescueTeamImportTemplate;
import com.ruoyi.ehsRescueTeam.mapper.EhsRescueTeamMapper;
import com.ruoyi.ehsRescueTeam.vo.TeamResponseVo;
import com.ruoyi.ehsRescueTeamWorker.domain.RescueTeamWorkerImportTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
@ -25,6 +30,8 @@ public class EhsRescueTeamWorkerServiceImpl extends ServiceImpl<EhsRescueTeamWor
@Autowired @Autowired
private EhsRescueTeamWorkerMapper ehsRescueTeamWorkerMapper; private EhsRescueTeamWorkerMapper ehsRescueTeamWorkerMapper;
@Autowired
private EhsRescueTeamMapper ehsRescueTeamMapper;
/** /**
* *
@ -54,6 +61,60 @@ public class EhsRescueTeamWorkerServiceImpl extends ServiceImpl<EhsRescueTeamWor
return ehsRescueTeamWorkerMapper.removeWorkerByTeamIds(teamIds); return ehsRescueTeamWorkerMapper.removeWorkerByTeamIds(teamIds);
} }
/**
*
* @param list
* @param updateSupport
* @Param params
* @return
*/
@Override
public String importRescueTeamWorker(List<RescueTeamWorkerImportTemplate> list, Boolean updateSupport, Long params) throws Exception {
if (StringUtils.isNull(list) || list.size() == 0) {
throw new Exception("导入应急救援队伍人员信息数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (RescueTeamWorkerImportTemplate rescueTeamWorkerTemplate : list) {
EhsRescueTeamWorker temp = new EhsRescueTeamWorker();
/**
* ,id,idString,uuid
* id,,id
*/
// temp.setId(IdUtils.fastSimpleUUID());
// 根据teamId查询队伍信息,parms前端传过来的是teamId
TeamResponseVo teamResponseVo = ehsRescueTeamMapper.getTeamInfoByTeamId(params);
temp.setRescueTeamId(teamResponseVo.getRescueTeamId());// 队伍id
temp.setRescueTeamName(teamResponseVo.getRescueTeamName());// 队伍名称
temp.setWorkerName(rescueTeamWorkerTemplate.getWorkerName());// 人员姓名
temp.setGender(rescueTeamWorkerTemplate.getGender());// 性别(0男 1女)
temp.setBirthday(rescueTeamWorkerTemplate.getBirthday());// 出生年月(格式为2023-12-12)
temp.setIdCard(rescueTeamWorkerTemplate.getIdCard());// 身份证号
temp.setPhone(rescueTeamWorkerTemplate.getPhone());// 联系方式
temp.setWorkYear(rescueTeamWorkerTemplate.getWorkYear());// 工作年限
temp.setSpeciality(rescueTeamWorkerTemplate.getSpeciality());// 救援技能特长
temp.setRemark(rescueTeamWorkerTemplate.getRemark());// 备注
try {
//插入数据
this.save(temp);
successNum++;
successMsg.append("<br />" + successNum + "、应急救援队伍人员信息" + temp.getWorkerName() + "导入成功");
} catch (Exception e) {
e.printStackTrace();
log.error(e.getLocalizedMessage());
failureNum++;
successMsg.append("<br /><font color='red'>" + failureNum + "、应急救援队伍人员信息" + temp.getWorkerName() + "导入异常,请联系管理员!</font>");
continue;
}
}
return successMsg.toString();
}
private LambdaQueryWrapper<EhsRescueTeamWorker> buildQueryWrapper(EhsRescueTeamWorker query) { private LambdaQueryWrapper<EhsRescueTeamWorker> buildQueryWrapper(EhsRescueTeamWorker query) {
Map<String, Object> params = query.getParams(); Map<String, Object> params = query.getParams();

@ -27,6 +27,7 @@
select id, transfer_user_id, transfer_name, transfer_time, doc_transfer_status, document_id, document_name, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_doc_transfer select id, transfer_user_id, transfer_name, transfer_time, doc_transfer_status, document_id, document_name, create_by, create_time, update_by, update_time, remark, dept_id, create_user_id, update_user_id from ehs_doc_transfer
</sql> </sql>
<select id="selectEhsDocTransferList" parameterType="EhsDocTransfer" resultMap="EhsDocTransferResult"> <select id="selectEhsDocTransferList" parameterType="EhsDocTransfer" resultMap="EhsDocTransferResult">
<include refid="selectEhsDocTransferVo"/> <include refid="selectEhsDocTransferVo"/>
<where> <where>
@ -50,5 +51,13 @@
order by t.transfer_time desc order by t.transfer_time desc
</select> </select>
<delete id="removeByDocumentIds">
delete from ehs_doc_transfer
where document_id in
<foreach collection="list" item="items" open="(" close=")" separator=",">
#{items}
</foreach>
</delete>
</mapper> </mapper>

@ -10,7 +10,7 @@
:limit="3" :limit="3"
accept=".xlsx, .xls" accept=".xlsx, .xls"
:headers="upload.headers" :headers="upload.headers"
:action="upload.url + '?updateSupport=' + upload.updateSupport" :action="upload.url + '?updateSupport=' + upload.updateSupport + '&params=' + upload.params"
:disabled="upload.isUploading" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress" :on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess" :on-success="handleFileSuccess"
@ -52,6 +52,8 @@ export default {
open: false, open: false,
// //
title: "", title: "",
//
params: "",
// //
isUploading: false, isUploading: false,
// //

@ -149,7 +149,7 @@
<span>{{ Number(scope.$index) + 1 }}</span> <span>{{ Number(scope.$index) + 1 }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="应急救援队伍id" align="center" prop="rescueTeamId" /> <!-- <el-table-column label="应急救援队伍id" align="center" prop="rescueTeamId" />-->
<el-table-column label="应急救援队伍名称" align="center" prop="rescueTeamName" /> <el-table-column label="应急救援队伍名称" align="center" prop="rescueTeamName" />
<el-table-column label="人员姓名" align="center" prop="workerName" /> <el-table-column label="人员姓名" align="center" prop="workerName" />
<el-table-column label="性别" align="center" prop="gender"> <el-table-column label="性别" align="center" prop="gender">
@ -200,9 +200,9 @@
<!-- 添加或修改应急救援队人员信息对话框 --> <!-- 添加或修改应急救援队人员信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px" :disabled="true"> <el-form ref="form" :model="form" :rules="rules" label-width="80px" :disabled="true">
<el-form-item label="应急救援队伍id" prop="rescueTeamId"> <!-- <el-form-item label="应急救援队伍id" prop="rescueTeamId">
<el-input v-model="form.rescueTeamId" placeholder="请输入应急救援队伍id" /> <el-input v-model="form.rescueTeamId" placeholder="请输入应急救援队伍id" />
</el-form-item> </el-form-item>-->
<el-form-item label="应急救援队伍名称" prop="rescueTeamName"> <el-form-item label="应急救援队伍名称" prop="rescueTeamName">
<el-input v-model="form.rescueTeamName" placeholder="请输入应急救援队伍名称" /> <el-input v-model="form.rescueTeamName" placeholder="请输入应急救援队伍名称" />
</el-form-item> </el-form-item>
@ -448,6 +448,7 @@ export default {
console.log(this.$refs.uploadRef.upload); console.log(this.$refs.uploadRef.upload);
this.$refs.uploadRef.upload.open = true; this.$refs.uploadRef.upload.open = true;
this.$refs.uploadRef.upload.title = "应急救援队伍人员导入"; this.$refs.uploadRef.upload.title = "应急救援队伍人员导入";
this.$refs.uploadRef.upload.params = this.id;// idrescueTeamId
this.$refs.uploadRef.upload.url = this.$refs.uploadRef.upload.url =
process.env.VUE_APP_BASE_API + "/ehs/ehsRescueTeamWorker/importData"; process.env.VUE_APP_BASE_API + "/ehs/ehsRescueTeamWorker/importData";
}, },

Loading…
Cancel
Save