新增待复查企业

This commit is contained in:
wenc000 2020-04-01 17:54:50 +08:00
parent 5844aa1ef6
commit 71d24ae6fb
21 changed files with 852 additions and 162 deletions

View File

@ -13,14 +13,13 @@ import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.check.CheckDTO;
import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO;
import com.cm.inspection.pojo.vos.check.CheckVO;
import com.cm.inspection.service.check.ICheckService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.swing.text.ParagraphView;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -51,9 +50,27 @@ public class CheckController extends AbstractController {
throw new ParamsException("检查项列表为空");
}
}
checkVO.setCheckType(1);
return checkService.saveCheck(checkVO);
}
@ApiOperation(value = "新增检查表", notes = "新增检查表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "checkId", value = "checkId", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("saverecheck/{checkId}")
@CheckRequestBodyAnnotation
public SuccessResult saveReCheck(@PathVariable("checkId") String checkId, @RequestBody CheckVO checkVO) throws Exception {
if (checkVO.getIsCoordination() == 1) {
if (checkVO.getHiddenDangerReports().isEmpty()) {
throw new ParamsException("检查项列表为空");
}
}
checkVO.setCheckType(1);
return checkService.saveReCheck(checkId, checkVO);
}
@ApiOperation(value = "删除检查表(id列表)", notes = "删除检查表(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", value = "ID列表用下划线分隔", paramType = "path", example = "1_2_3")
@ -98,8 +115,6 @@ public class CheckController extends AbstractController {
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "form", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listpagecheck")
@ -117,19 +132,41 @@ public class CheckController extends AbstractController {
}
@ApiOperation(value = "我的复查项列表", notes = "我的复查项列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listrecheckofmine")
public List<CheckDTO> listReCheckOfMine() {
@GetMapping("listpagerecheckofmine")
public SuccessResultList<List<CheckDTO>> listPageReCheckOfMine(ListPage page) {
Map<String, Object> params = requestParams();
return checkService.listReCheckOfMine(params);
page.setParams(params);
return checkService.listPageReCheckOfMine(page);
}
@ApiOperation(value = "我的领导检查列表", notes = "我的领导检查列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "form", dataType = "Integer", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "form", dataType = "Integer", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "form", dataType = "String"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listleadercheckofmine")
public List<CheckDTO> listLeaderCheckOfMine() {
@GetMapping("listpageleadercheckofmine")
public SuccessResultList<List<CheckDTO>> listPageLeaderCheckOfMine(ListPage page) {
Map<String, Object> params = requestParams();
return checkService.listLeaderCheckOfMine(params);
page.setParams(params);
return checkService.listPageLeaderCheckOfMine(page);
}
@ApiOperation(value = "未通过的检查项列表通过检查ID", notes = "未通过的检查项列表通过检查ID接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "checkId", value = "检查ID", paramType = "path"),
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listcheckitemunpassbycheckid/{checkId}")
public List<CheckItemDTO> listCheckItemUnPassByCheckId(@PathVariable("checkId") String checkId) {
return checkService.listCheckItemUnPassByCheckId(checkId);
}
}

View File

@ -17,8 +17,6 @@ import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.jsp.tagext.PageData;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -50,9 +48,28 @@ public class CheckAppController extends AbstractController {
throw new ParamsException("检查项列表为空");
}
}
checkVO.setCheckType(1);
return checkService.saveCheckByToken(token, checkVO);
}
@ApiOperation(value = "新增复查表", notes = "新增复查表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ApiImplicitParam(name = "checkId", value = "checkId", paramType = "path")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("saverecheck/{checkId}")
@CheckRequestBodyAnnotation
public SuccessResult saveReCheck(@RequestHeader("token") String token, @PathVariable("checkId") String checkId, @RequestBody CheckVO checkVO) throws Exception {
if (checkVO.getIsCoordination() == 1) {
if (checkVO.getHiddenDangerReports().isEmpty()) {
throw new ParamsException("检查项列表为空");
}
}
checkVO.setCheckType(2);
return checkService.saveReCheckByToken(token, checkId, checkVO);
}
@ApiOperation(value = "删除检查表(id列表)", notes = "删除检查表(id列表)接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", paramType = "header"),
@ -138,9 +155,10 @@ public class CheckAppController extends AbstractController {
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listrecheckofmine")
public List<CheckDTO> listReCheckOfMine(@RequestHeader("token") String token) {
public SuccessResultList<List<CheckDTO>> listReCheckOfMine(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams();
return checkService.listReCheckOfMine(token, params);
page.setParams(params);
return checkService.listPageReCheckOfMine(token, page);
}
@ApiOperation(value = "我的领导检查列表", notes = "我的领导检查列表接口")
@ -149,9 +167,10 @@ public class CheckAppController extends AbstractController {
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listleadercheckofmine")
public List<CheckDTO> listLeaderCheckOfMine(@RequestHeader("token") String token) {
public SuccessResultList<List<CheckDTO>> listLeaderCheckOfMine(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams();
return checkService.listLeaderCheckOfMine(token, params);
page.setParams(params);
return checkService.listPageLeaderCheckOfMine(token, page);
}
}

View File

@ -5,6 +5,7 @@ import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.exception.UpdateException;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO;
import com.cm.inspection.pojo.dtos.hiddendangerreport.HiddenDangerReportDTO;
import org.springframework.stereotype.Repository;
@ -62,5 +63,13 @@ public interface IHiddenDangerReportDao {
* @throws SearchException
*/
List<HiddenDangerReportDTO> listHiddenDangerReport(Map<String, Object> params) throws SearchException;
/**
* 未通过的检查项列表通过检查ID
*
* @param params
* @return
* @throws SearchException
*/
List<CheckItemDTO> listCheckItemUnPass(Map<String, Object> params) throws SearchException;
}

View File

@ -4,7 +4,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @ClassName: IndustryCheckItemDTO
* @Description: 行业检查项
* @Author: WenG
@ -36,6 +35,7 @@ public class IndustryCheckItemDTO {
public void setIndustryCheckItemId(String industryCheckItemId) {
this.industryCheckItemId = industryCheckItemId;
}
public String getIndustryId() {
return industryId == null ? "" : industryId;
}
@ -51,6 +51,7 @@ public class IndustryCheckItemDTO {
public void setIndustryIdDictionaryName(String industryIdDictionaryName) {
this.industryIdDictionaryName = industryIdDictionaryName;
}
public String getCheckItemId() {
return checkItemId == null ? "" : checkItemId;
}

View File

@ -24,13 +24,11 @@ public class CheckVO {
@ApiModelProperty(name = "enterpriseId", value = "企业ID")
private String enterpriseId;
@ApiModelProperty(name = "checkType", value = "检查类型")
@CheckNumberAnnotation(name = "检查类型")
private Integer checkType;
@ApiModelProperty(name = "isCoordination", value = "是否配合")
@CheckNumberAnnotation(name = "是否配合")
private Integer isCoordination;
@ApiModelProperty(name = "isComplete", value = "是否完成")
@CheckNumberAnnotation(name = "是否完成")
private Integer isComplete;
@ApiModelProperty(name = "checkItems", value = "检查项")
private List<HiddenDangerReportVO> hiddenDangerReports;

View File

@ -8,6 +8,7 @@ import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.check.CheckDTO;
import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO;
import com.cm.inspection.pojo.vos.check.CheckVO;
import java.util.List;
@ -41,6 +42,25 @@ public interface ICheckService {
*/
SuccessResult saveCheckByToken(String token, CheckVO checkVO) throws Exception;
/**
* 新增复查表
* @param checkId
* @param checkVO
* @return
* @throws Exception
*/
SuccessResult saveReCheck(String checkId, CheckVO checkVO) throws Exception;
/**
* 新增复查表APP
* @param token
* @param checkId
* @param checkVO
* @return
* @throws Exception
*/
SuccessResult saveReCheckByToken(String token, String checkId, CheckVO checkVO) throws Exception;
/**
* 删除检查表
*
@ -129,40 +149,48 @@ public interface ICheckService {
/**
* 我的复查项列表
*
* @param params
* @param page
* @return
* @throws SearchException
*/
List<CheckDTO> listReCheckOfMine(Map<String, Object> params) throws SearchException;
SuccessResultList<List<CheckDTO>> listPageReCheckOfMine(ListPage page) throws SearchException;
/**
* 我的复查项列表
*
* @param token
* @param params
* @param page
* @return
* @throws SearchException
*/
List<CheckDTO> listReCheckOfMine(String token, Map<String, Object> params) throws SearchException;
SuccessResultList<List<CheckDTO>> listPageReCheckOfMine(String token, ListPage page) throws SearchException;
/**
* 我的领导检查列表
*
* @param params
* @param page
* @return
* @throws SearchException
*/
List<CheckDTO> listLeaderCheckOfMine(Map<String, Object> params) throws SearchException;
SuccessResultList<List<CheckDTO>> listPageLeaderCheckOfMine(ListPage page) throws SearchException;
/**
* 我的领导检查列表
*
* @param token
* @param params
* @param page
* @return
* @throws SearchException
*/
List<CheckDTO> listLeaderCheckOfMine(String token, Map<String, Object> params) throws SearchException;
SuccessResultList<List<CheckDTO>> listPageLeaderCheckOfMine(String token, ListPage page) throws SearchException;
/**
* 未通过的检查项列表通过检查ID
*
* @param checkId
* @return
* @throws SearchException
*/
List<CheckItemDTO> listCheckItemUnPassByCheckId(String checkId) throws SearchException;
}

View File

@ -1,6 +1,7 @@
package com.cm.inspection.service.check.impl;
import com.cm.common.exception.RemoveException;
import com.cm.common.exception.SaveException;
import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
@ -11,6 +12,7 @@ import com.cm.common.utils.UUIDUtil;
import com.cm.inspection.dao.check.ICheckDao;
import com.cm.inspection.enums.HiddenDangerCheckResultEnum;
import com.cm.inspection.pojo.dtos.check.CheckDTO;
import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO;
import com.cm.inspection.pojo.dtos.gridpersonnel.GridPersonnelDTO;
import com.cm.inspection.pojo.vos.check.CheckVO;
import com.cm.inspection.pojo.vos.hiddendangerreport.HiddenDangerReportVO;
@ -62,6 +64,18 @@ public class CheckServiceImpl extends BaseService implements ICheckService {
return new SuccessResult();
}
@Override
public SuccessResult saveReCheck(String checkId, CheckVO checkVO) throws Exception {
saveReCheckInfo(null, checkId, checkVO);
return new SuccessResult();
}
@Override
public SuccessResult saveReCheckByToken(String token, String checkId, CheckVO checkVO) throws Exception {
saveReCheckInfo(token, checkId, checkVO);
return new SuccessResult();
}
/**
* 新增检查表
*
@ -79,51 +93,117 @@ public class CheckServiceImpl extends BaseService implements ICheckService {
String businessKey = String.format("check:%s", checkId);
params.put("reporter", userId);
processService.startProcess(IProcessService.CHECK_SELF_PROCESS, businessKey, params);
Task task = processService.getTaskByAssigneeAndBusinessKey(userId, businessKey);
params.clear();
completeCheck(token, checkVO, checkId, userId, task, isCoordination);
}
/**
* 新增复查表
*
* @param token
* @param checkId
* @param checkVO
*/
private void saveReCheckInfo(String token, String checkId, CheckVO checkVO) throws Exception {
Integer isCoordination = checkVO.getIsCoordination();
String userId = getUserId(token);
Task task = processService.getTaskByAssigneeAndVariableKeyAndValue(userId, "lastCheckId", checkId);
if (task == null) {
throw new SaveException("任务不存在");
}
String newCheckId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(checkVO);
saveCheckWithId(newCheckId, token, params);
LOG.debug("复查流程处理");
completeCheck(token, checkVO, checkId, userId, task, isCoordination);
}
/**
* 完成检查复查任务
*
* @param checkVO
* @param checkId
* @param task
* @param userId
* @param isCoordination
* @throws Exception
*/
private void completeCheck(String token, CheckVO checkVO, String checkId, String userId, Task task, int isCoordination) throws Exception {
Map<String, Object> params = getHashMap(2);
params.put("isCoordination", isCoordination);
if (isCoordination == 1) {
LOG.debug("1.isCoordination: 1, 配合");
List<HiddenDangerReportVO> hiddenDangerReports = checkVO.getHiddenDangerReports();
int isAllPass = 1;
for (HiddenDangerReportVO hiddenDangerReportVO : hiddenDangerReports) {
hiddenDangerReportVO.setCheckId(checkId);
hiddenDangerReportService.saveHiddenDangerReportInfo(token, hiddenDangerReportVO);
if (HiddenDangerCheckResultEnum.PASS.getValue() != hiddenDangerReportVO.getCheckResult()) {
isAllPass = 0;
}
}
LOG.debug("2.isAllPass: {}", isAllPass);
params.put("isAllPass", isAllPass);
if (isAllPass == 0) {
LOG.debug("3.检查项没有完全通过,需要复查");
params.put("reReporter", userId);
processService.setTaskVariableByTaskId(task.getId(), "isReport", 1);
LOG.debug("4.标记上一次的检查项");
processService.setTaskVariableByTaskId(task.getId(), "lastCheckId", checkId);
} else {
LOG.debug("3.全部通过,更新当前检查状态");
CheckVO updateCheckVO = new CheckVO();
updateCheckVO.setIsComplete(1);
updateCheck(checkId, updateCheckVO);
}
saveHiddenDangerReport(token, checkVO, checkId, userId, task, params);
} else {
LOG.debug("1.isCoordination2, 不配合");
// 查询上级领导如果上级领导为空指向自己如果有多个网格员角色取最高level的上级领导
List<GridPersonnelDTO> gridPersonnelDTOs = gridPersonnelService.listGridPersonnelByUserIdAndIsGridOperator(userId, 1);
if (gridPersonnelDTOs.isEmpty()) {
params.put("leader", userId);
} else {
params.put("leader", gridPersonnelDTOs.get(0).getUserId().split("\\|")[0]);
}
processService.setTaskVariableByTaskId(task.getId(), "isLeader", 1);
LOG.debug("2.标记上一次的检查项");
processService.setTaskVariableByTaskId(task.getId(), "lastCheckId", checkId);
setLeaderCheck(userId, checkId, task, params);
}
processService.saveTaskCompleteByTaskId(task.getId(), params);
}
/**
* 保存隐患上报详情
*
* @param checkVO
* @param checkId
* @param task
* @param params
* @throws Exception
*/
private void saveHiddenDangerReport(String token, CheckVO checkVO, String checkId, String userId, Task task, Map<String, Object> params) throws Exception {
LOG.debug("1.isCoordination1配合处理");
List<HiddenDangerReportVO> hiddenDangerReports = checkVO.getHiddenDangerReports();
int isAllPass = 1;
for (HiddenDangerReportVO hiddenDangerReportVO : hiddenDangerReports) {
hiddenDangerReportVO.setCheckId(checkId);
hiddenDangerReportService.saveHiddenDangerReportInfo(token, hiddenDangerReportVO);
if (HiddenDangerCheckResultEnum.PASS.getValue() != hiddenDangerReportVO.getCheckResult()) {
isAllPass = 0;
}
}
LOG.debug("2.isAllPass: {}", isAllPass);
params.put("isAllPass", isAllPass);
if (isAllPass == 0) {
LOG.debug("3.检查项没有完全通过,需要复查");
params.put("reReporter", userId);
processService.setTaskVariableByTaskId(task.getId(), "isReport", 1);
LOG.debug("4.标记上一次的检查项");
processService.setTaskVariableByTaskId(task.getId(), "lastCheckId", checkId);
} else {
LOG.debug("3.全部通过,更新当前检查业务状态和流程业务状态");
CheckVO updateCheckVO = new CheckVO();
updateCheckVO.setIsComplete(1);
updateCheck(checkId, updateCheckVO);
String businessCheckId = task.getBusinessKey().split(":")[1];
if (!StringUtils.equals(checkId, businessCheckId)) {
updateCheck(businessCheckId, updateCheckVO);
}
}
}
/**
* 设置领导审核
*
* @param userId
* @param checkId
* @param task
* @param params
*/
private void setLeaderCheck(String userId, String checkId, Task task, Map<String, Object> params) {
LOG.debug("1.isCoordination2, 不配合");
// 查询上级领导如果上级领导为空指向自己如果有多个网格员角色取最高level的上级领导
List<GridPersonnelDTO> gridPersonnelDTOs = gridPersonnelService.listGridPersonnelByUserIdAndIsGridOperator(userId, 1);
if (gridPersonnelDTOs.isEmpty()) {
params.put("leader", userId);
} else {
params.put("leader", gridPersonnelDTOs.get(0).getUserId().split("\\|")[0]);
}
processService.setTaskVariableByTaskId(task.getId(), "isLeader", 1);
// 删除之上报相关属性
processService.removeTaskVariableByTaskId(task.getId(), "isReport");
processService.removeTaskVariableByTaskId(task.getId(), "reReporter");
LOG.debug("2.标记上一次的检查项");
processService.setTaskVariableByTaskId(task.getId(), "lastCheckId", checkId);
}
/**
* 保存检查项
*
@ -235,40 +315,45 @@ public class CheckServiceImpl extends BaseService implements ICheckService {
}
@Override
public List<CheckDTO> listReCheckOfMine(Map<String, Object> params) throws SearchException {
return listReCheckOfMine(null, params);
public SuccessResultList<List<CheckDTO>> listPageReCheckOfMine(ListPage page) throws SearchException {
return listPageReCheckOfMine(null, page);
}
@Override
public List<CheckDTO> listLeaderCheckOfMine(Map<String, Object> params) throws SearchException {
return listLeaderCheckOfMine(null, params);
public SuccessResultList<List<CheckDTO>> listPageLeaderCheckOfMine(ListPage page) throws SearchException {
return listPageLeaderCheckOfMine(null, page);
}
@Override
public List<CheckDTO> listLeaderCheckOfMine(String token, Map<String, Object> params) {
public SuccessResultList<List<CheckDTO>> listPageLeaderCheckOfMine(String token, ListPage page) {
List<String> checkIds = listLastCheckId(getUserId(token), "isLeader");
if (checkIds.isEmpty()) {
return new ArrayList<>();
return new SuccessResultList(new ArrayList<>(), 1, 0L);
}
params.put("checkIds", checkIds);
return listCheck(params);
page.getParams().put("checkIds", checkIds);
return listPageCheck(page);
}
@Override
public List<CheckItemDTO> listCheckItemUnPassByCheckId(String checkId) throws SearchException {
return hiddenDangerReportService.listCheckItemUnPassByCheckId(checkId);
}
/**
* 我的待复查列表
*
* @param token
* @param params
* @param page
* @return
*/
@Override
public List<CheckDTO> listReCheckOfMine(String token, Map<String, Object> params) {
public SuccessResultList<List<CheckDTO>> listPageReCheckOfMine(String token, ListPage page) {
List<String> checkIds = listLastCheckId(getUserId(token), "isReport");
if (checkIds.isEmpty()) {
return new ArrayList<>();
return new SuccessResultList(new ArrayList<>(), 1, 0L);
}
params.put("checkIds", checkIds);
return listCheck(params);
page.getParams().put("checkIds", checkIds);
return listPageCheck(page);
}
/**

View File

@ -7,6 +7,7 @@ import com.cm.common.pojo.ListPage;
import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO;
import com.cm.inspection.pojo.dtos.hiddendangerreport.HiddenDangerReportDTO;
import com.cm.inspection.pojo.vos.hiddendangerreport.HiddenDangerReportVO;
@ -117,4 +118,12 @@ public interface IHiddenDangerReportService {
*/
SuccessResultList<List<HiddenDangerReportDTO>> listPageHiddenDangerReport(ListPage page) throws SearchException;
/**
* 未通过的检查项列表通过检查ID
*
* @param checkId
* @return
* @throws SearchException
*/
List<CheckItemDTO> listCheckItemUnPassByCheckId(String checkId) throws SearchException;
}

View File

@ -9,6 +9,7 @@ import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil;
import com.cm.inspection.dao.hiddendangerreport.IHiddenDangerReportDao;
import com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO;
import com.cm.inspection.pojo.dtos.hiddendangerreport.HiddenDangerReportDTO;
import com.cm.inspection.pojo.vos.hiddendangerreport.HiddenDangerReportVO;
import com.cm.inspection.service.BaseService;
@ -143,4 +144,11 @@ public class HiddenDangerReportServiceImpl extends BaseService implements IHidde
return new SuccessResultList<>(hiddenDangerReportDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
@Override
public List<CheckItemDTO> listCheckItemUnPassByCheckId(String checkId) throws SearchException {
Map<String, Object> params = getHashMap(1);
params.put("checkId", checkId);
return hiddenDangerReportDao.listCheckItemUnPass(params);
}
}

View File

@ -51,6 +51,15 @@ public interface IProcessService {
*/
List<Task> listTaskByAssignee(String assignee);
/**
* 任务列表通过执行人和变量Key
*
* @param assignee
* @param key
* @return
*/
List<Task> listTaskByAssigneeAndVariablesKey(String assignee, String key);
/**
* 获取任务通过业务主键
*
@ -95,6 +104,16 @@ public interface IProcessService {
*/
Task getTaskByAssigneeAndProcessId(String assignee, String processId);
/**
* 获取任务通过执行人和变量名
*
* @param assignee
* @param key
* @param value
* @return
*/
Task getTaskByAssigneeAndVariableKeyAndValue(String assignee, String key, Object value);
/**
* 设置任务变量
*
@ -121,14 +140,31 @@ public interface IProcessService {
Map<String, Object> getTaskVariablesByTaskId(String taskId);
/**
* 获取任务变量
* 获取任务变量通过键
*
* @param taskId
* @param key
* @param value
* @return
*/
Object getTaskVariableByTaskId(String taskId, String key);
/**
* 删除任务变量
*
* @param taskId
* @param keys
*/
void removeTaskVariablesByTaskId(String taskId, List<String> keys);
/**
* 删除任务变量
*
* @param taskId
* @param key
*/
void removeTaskVariableByTaskId(String taskId, String key);
/**
* 完成案件通过taskId
*

View File

@ -7,6 +7,7 @@ import org.activiti.engine.history.HistoricTaskInstance;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.task.Task;
import org.activiti.engine.task.TaskQuery;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -57,6 +58,20 @@ public class ProcessServiceImpl implements IProcessService {
return taskList == null ? new ArrayList<>(0) : taskList;
}
@Override
public List<Task> listTaskByAssigneeAndVariablesKey(String assignee, String key) {
List<Task> taskList = listTaskByAssignee(assignee);
for (int i = 0; i < taskList.size(); i++) {
Task task = taskList.get(i);
Object value = taskService.getVariable(task.getId(), key);
if (value == null) {
taskList.remove(i);
i--;
}
}
return taskList;
}
@Override
public Task getTaskByBusinessKey(List<Task> listTask, String businessKey) {
if (listTask == null) {
@ -101,6 +116,18 @@ public class ProcessServiceImpl implements IProcessService {
return getTaskByProcessId(taskList, processId);
}
@Override
public Task getTaskByAssigneeAndVariableKeyAndValue(String assignee, String key, Object value) {
List<Task> taskList = listTaskByAssignee(assignee);
for (Task task : taskList) {
Object valueObj = taskService.getVariable(task.getId(), key);
if (!ObjectUtils.notEqual(value, valueObj)) {
return task;
}
}
return null;
}
@Override
public void setTaskVariablesByTaskId(String taskId, Map<String, Object> variables) {
taskService.setVariables(taskId, variables);
@ -121,6 +148,16 @@ public class ProcessServiceImpl implements IProcessService {
return taskService.getVariable(taskId, key);
}
@Override
public void removeTaskVariablesByTaskId(String taskId, List<String> keys) {
taskService.removeVariables(taskId, keys);
}
@Override
public void removeTaskVariableByTaskId(String taskId, String key) {
taskService.removeVariable(taskId, key);
}
@Override
public void saveTaskCompleteByTaskId(String taskId, Map<String, Object> params) {
taskService.complete(taskId, params);

View File

@ -95,12 +95,19 @@
<select id="getCheck" parameterType="map" resultMap="checkDTO">
SELECT
t1.enterprise_id,
jt1.name name_join_by_enterprise_id,
t1.check_type,
t1.is_coordination,
t1.is_complete,
t1.check_id
FROM
gen_check t1
INNER JOIN
gen_enterprise jt1
ON
t1.enterprise_id = jt1.enterprise_id
AND
jt1.is_delete = 0
WHERE
t1.is_delete = 0
<if test="checkId != null and checkId != ''">

View File

@ -115,11 +115,6 @@
#{checkItemIds[${index}]}
</foreach>
</if>
GROUP BY
t1.name,
t1.summary,
t1.type,
t1.check_item_id
</select>
</mapper>

View File

@ -154,15 +154,23 @@
SELECT
t1.name,
t1.type,
dt1.dictionary_name type_dictionary_name,
t1.area1,
dt4.dictionary_name area1_dictionary_name,
t1.area2,
dt5.dictionary_name area2_dictionary_name,
t1.area3,
dt6.dictionary_name area3_dictionary_name,
t1.area4,
dt7.dictionary_name area4_dictionary_name,
t1.area5,
dt8.dictionary_name area5_dictionary_name,
t1.address,
t1.industry,
dt2.dictionary_name industry_dictionary_name,
t1.engaged_count,
t1.risk_operation,
dt3.dictionary_name risk_operation_dictionary_name,
t1.master,
t1.phone,
t1.factory_gate,
@ -170,6 +178,54 @@
t1.enterprise_id
FROM
gen_enterprise t1
LEFT JOIN
data_dictionary dt1
ON
dt1.dictionary_id = t1.type
AND
dt1.is_delete = 0
LEFT JOIN
data_dictionary dt2
ON
dt2.dictionary_id = t1.industry
AND
dt2.is_delete = 0
LEFT JOIN
data_dictionary dt3
ON
dt3.dictionary_id = t1.risk_operation
AND
dt3.is_delete = 0
LEFT JOIN
data_dictionary dt4
ON
dt4.dictionary_id = t1.area1
AND
dt4.is_delete = 0
LEFT JOIN
data_dictionary dt5
ON
dt5.dictionary_id = t1.area2
AND
dt5.is_delete = 0
LEFT JOIN
data_dictionary dt6
ON
dt6.dictionary_id = t1.area3
AND
dt6.is_delete = 0
LEFT JOIN
data_dictionary dt7
ON
dt7.dictionary_id = t1.area4
AND
dt7.is_delete = 0
LEFT JOIN
data_dictionary dt8
ON
dt8.dictionary_id = t1.area5
AND
dt8.is_delete = 0
WHERE
t1.is_delete = 0
<if test="enterpriseId != null and enterpriseId != ''">

View File

@ -124,6 +124,11 @@
jt1.industry industry_join_by_enterprise_id,
jt1.engaged_count engaged_count_join_by_enterprise_id,
jt1.risk_operation risk_operation_join_by_enterprise_id,
dt1.dictionary_name area1_dictionary_name,
dt2.dictionary_name area2_dictionary_name,
dt3.dictionary_name area3_dictionary_name,
dt4.dictionary_name area4_dictionary_name,
dt5.dictionary_name area5_dictionary_name,
t1.enterprise_of_grid_operator_id
FROM
gen_enterprise_of_grid_operator t1
@ -133,6 +138,36 @@
t1.enterprise_id = jt1.enterprise_id
AND
jt1.is_delete = 0
LEFT JOIN
data_dictionary dt1
ON
dt1.dictionary_id = jt1.area1
AND
dt1.is_delete = 0
LEFT JOIN
data_dictionary dt2
ON
dt2.dictionary_id = jt1.area2
AND
dt2.is_delete = 0
LEFT JOIN
data_dictionary dt3
ON
dt3.dictionary_id = jt1.area3
AND
dt3.is_delete = 0
LEFT JOIN
data_dictionary dt4
ON
dt4.dictionary_id = jt1.area4
AND
dt4.is_delete = 0
LEFT JOIN
data_dictionary dt5
ON
dt5.dictionary_id = jt1.area5
AND
dt5.is_delete = 0
WHERE
t1.is_delete = 0
<if test="keywords != null and keywords != ''">
@ -158,6 +193,10 @@
AND
t1.user_id = #{userId}
</if>
<if test="type != null and type != ''">
AND
jt1.type = #{type}
</if>
<if test="area1 != null and area1 != ''">
AND
jt1.area1 = #{area1}
@ -292,6 +331,10 @@
AND
t1.name LIKE CONCAT('%', #{keywords}, '%')
</if>
<if test="type != null and type != ''">
AND
t1.type = #{type}
</if>
</select>
</mapper>

View File

@ -17,6 +17,13 @@
<result column="scene_photos" property="scenePhotos"/>
</resultMap>
<resultMap id="checkItemDTO" type="com.cm.inspection.pojo.dtos.checkitem.CheckItemDTO">
<id column="check_item_id" property="checkItemId"/>
<result column="name" property="name"/>
<result column="summary" property="summary"/>
<result column="type" property="type"/>
</resultMap>
<!-- 新增隐患上报 -->
<insert id="saveHiddenDangerReport" parameterType="map">
INSERT INTO gen_hidden_danger_report(
@ -166,18 +173,31 @@
#{hiddenDangerReportIds[${index}]}
</foreach>
</if>
GROUP BY
t1.check_id,
t1.check_item_id,
</select>
<!-- 检查未通过的检查项 -->
<select id="listCheckItemUnPass" resultMap="checkItemDTO">
SELECT
jt1.name,
jt1.summary,
jt1.type,
t1.check_result,
t1.rectification_type,
t1.immediately_change_type,
t1.rectification_days,
t1.summary,
t1.hidden_danger_report_id
jt1.check_item_id
FROM
gen_hidden_danger_report t1
LEFT JOIN
gen_check_item jt1
ON
t1.check_item_id = jt1.check_item_id
AND
jt1.is_delete = 0
WHERE
t1.is_delete = 0
AND
t1.check_result > 1
<if test="checkId != null and checkId != ''">
AND
t1.check_id = #{checkId}
</if>
</select>
</mapper>

View File

@ -45,7 +45,6 @@
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'

View File

@ -25,27 +25,12 @@
</button>
</div>
<table class="layui-hide" id="dataTable" lay-filter="dataTable"></table>
<!-- 表头按钮组 -->
<script type="text/html" id="headerToolBar">
<div class="layui-btn-group">
<button type="button" class="layui-btn layui-btn-sm" lay-event="saveEvent">
<i class="fa fa-lg fa-plus"></i> 新增
</button>
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateEvent">
<i class="fa fa-lg fa-edit"></i> 编辑
</button>
<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" lay-event="removeEvent">
<i class="fa fa-lg fa-trash"></i> 删除
</button>
</div>
</script>
</div>
</div>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
@ -59,7 +44,7 @@
var laydate = layui.laydate;
var common = layui.common;
var resizeTimeout = null;
var tableUrl = 'api/check/listpagecheck';
var tableUrl = 'api/check/listpagerecheckofmine';
// 初始化表格
function initTable() {
@ -71,13 +56,11 @@
height: $win.height() - 90,
limit: 20,
limits: [20, 40, 60, 80, 100, 200],
toolbar: '#headerToolBar',
request: {
pageName: 'page',
limitName: 'rows'
},
cols: [[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'nameJoinByEnterpriseId', width: 200, title: '企业名称', align:'center',
templet: function(row) {
@ -178,6 +161,11 @@
return rowData;
}
},
{field: 'updateCheckMine', width: 100, title: '复查', fixed:'right', align:'center',
templet: function(row) {
return '<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="updateCheckMineEvent"><i class="fa fa-lg fa-edit"></i> 复查</button>';
}
},
]],
page: true,
parseData: function(data) {
@ -237,12 +225,10 @@
$(document).on('click', '#search', function() {
reloadTable(1);
});
// 事件 - 增删改
table.on('toolbar(dataTable)', function(obj) {
table.on('tool(dataTable)', function(obj) {
var layEvent = obj.event;
var checkStatus = table.checkStatus('dataTable');
var checkDatas = checkStatus.data;
if(layEvent === 'saveEvent') {
var data = obj.data;
if(layEvent === 'updateCheckMineEvent') {
layer.open({
type: 2,
title: false,
@ -250,43 +236,11 @@
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/check/save-check.html', []),
content: top.restAjax.path('route/check/update-check-mine.html?checkId={checkId}', [data.checkId]),
end: function() {
reloadTable();
}
});
} else if(layEvent === 'updateEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectEdit);
} else if(checkDatas.length > 1) {
top.dialog.msg(top.dataMessage.table.selectOneEdit);
} else {
layer.open({
type: 2,
title: false,
closeBtn: 0,
area: ['100%', '100%'],
shadeClose: true,
anim: 2,
content: top.restAjax.path('route/check/update-check.html?checkId={checkId}', [checkDatas[0].checkId]),
end: function() {
reloadTable();
}
});
}
} else if(layEvent === 'removeEvent') {
if(checkDatas.length === 0) {
top.dialog.msg(top.dataMessage.table.selectDelete);
} else {
var ids = '';
for(var i = 0, item; item = checkDatas[i++];) {
if(i > 1) {
ids += '_';
}
ids += item['checkId'];
}
removeData(ids);
}
}
});
});

View File

@ -39,7 +39,6 @@
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script src="assets/js/vendor/viewer/viewer.min.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/'
@ -72,6 +71,7 @@
},
cols: [[
{type:'checkbox', fixed: 'left'},
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
{field: 'nameJoinByEnterpriseId', width: 200, title: '企业名称', align:'center',
templet: function(row) {
var rowData = row[this.field];

View File

@ -76,16 +76,6 @@
<input type="text" id="enterpriseName" class="layui-input" placeholder="请选择企业" style="cursor: pointer;">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">检查类型</label>
<div class="layui-input-block">
<select name="checkType" required>
<option value="">请选择检查类型</option>
<option value="1">检查</option>
<option value="2">复查</option>
</select>
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">是否配合</label>
<div class="layui-input-block">
@ -106,7 +96,7 @@
<tbody>
{{# for(var i = 0, item; item = d[i++]; ) { }}
<tr>
<td>{{item.nameJoinByCheckItemId}}({{item.typeJoinByCheckItemId == '1' ? '必查': '选'}})</td>
<td>{{item.nameJoinByCheckItemId}}({{item.typeJoinByCheckItemId == '1' ? '必查': '选'}})</td>
<td>
<input type="radio" name="hd_checkResult_{{item.checkItemId}}" value="0" title="未检查" lay-filter="checkResultFilter" checked>
<input type="radio" name="hd_checkResult_{{item.checkItemId}}" value="1" title="通过" lay-filter="checkResultFilter">

View File

@ -0,0 +1,359 @@
<!doctype html>
<html lang="en">
<head>
<base href="/inspection/">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.css"/>
<link rel="stylesheet" href="assets/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="assets/layuiadmin/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
<div class="layui-card">
<div class="layui-card-header">
<span class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
<a class="close" href="javascript:void(0);">上级列表</a><span lay-separator="">/</span>
<a href="javascript:void(0);"><cite>复查内容</cite></a>
</span>
</div>
<div class="layui-card-body" style="padding: 15px;">
<form class="layui-form layui-form-pane" lay-filter="dataForm">
<div class="layui-form-item">
<label class="layui-form-label">企业</label>
<div class="layui-input-block layui-form">
<input type="hidden" id="enterpriseId" name="enterpriseId" class="layui-input">
<input type="text" id="enterpriseName" name="enterpriseName" class="layui-input" placeholder="请选择企业" style="cursor: pointer;">
</div>
</div>
<div class="layui-form-item" pane>
<label class="layui-form-label">是否配合</label>
<div class="layui-input-block">
<input type="radio" name="isCoordination" value="0" title="否" checked>
<input type="radio" name="isCoordination" value="1" title="是">
</div>
</div>
<div class="layui-form-item layui-form-text">
<div class="layui-input-block" id="checkItemTemplateBox"></div>
<script id="checkItemTemplate" type="text/html">
<table class="layui-table">
<thead>
<tr>
<th>检查项</th>
<th>检查结果</th>
</tr>
</thead>
<tbody>
{{# for(var i = 0, item; item = d[i++]; ) { }}
<tr>
<td>{{item.name}}({{item.type == '1' ? '必查': '选查'}})</td>
<td>
<input type="radio" name="hd_checkResult_{{item.checkItemId}}" value="0" title="未检查" lay-filter="checkResultFilter" checked>
<input type="radio" name="hd_checkResult_{{item.checkItemId}}" value="1" title="通过" lay-filter="checkResultFilter">
<input type="radio" name="hd_checkResult_{{item.checkItemId}}" value="2" title="立即整改" lay-filter="checkResultFilter">
<input type="radio" name="hd_checkResult_{{item.checkItemId}}" value="3" title="限期整改" lay-filter="checkResultFilter">
<input type="radio" name="hd_checkResult_{{item.checkItemId}}" value="4" title="不配合" lay-filter="checkResultFilter">
</td>
</tr>
<tr id="hd_immediatelyChangeType_{{item.checkItemId}}_Box" style="display: none;">
<td></td>
<td>
<input type="radio" name="hd_immediatelyChangeType_{{item.checkItemId}}" value="1" title="当场" checked>
<input type="radio" name="hd_immediatelyChangeType_{{item.checkItemId}}" value="2" title="当天">
</td>
</tr>
<tr id="hd_rectificationDays_{{item.checkItemId}}_Box" style="display: none;">
<td></td>
<td>
<input type="radio" name="hd_rectificationDays_{{item.checkItemId}}" value="1" title="1天" checked>
<input type="radio" name="hd_rectificationDays_{{item.checkItemId}}" value="5" title="5天">
<input type="radio" name="hd_rectificationDays_{{item.checkItemId}}" value="15" title="15天">
<input type="radio" name="hd_rectificationDays_{{item.checkItemId}}" value="20" title="20天">
<input type="radio" name="hd_rectificationDays_{{item.checkItemId}}" value="25" title="25天">
<input type="radio" name="hd_rectificationDays_{{item.checkItemId}}" value="30" title="30天">
</td>
</tr>
<tr id="hd_scenePhotos_{{item.checkItemId}}_Box" style="display: none;">
<td></td>
<td>
<input type="hidden" id="hd_scenePhotos_{{item.checkItemId}}" name="hd_scenePhotos_{{item.checkItemId}}"/>
<div id="hd_scenePhotos_{{item.checkItemId}}_ImageBox" style="display: inline-block"></div>
<div class="upload-image-box" style="width: auto; height: auto; padding: 5px;">
<a href="javascript:void(0);" lay-form-button data-explain="厂区大门" data-name="hd_scenePhotos_{{item.checkItemId}}" lay-filter="scenePhotosUploadFiles">
<i class="fa fa-plus-square-o" style="font-size: 70px;"></i>
</a>
</div>
</td>
</tr>
{{# } }}
</tbody>
</table>
</script>
</div>
<div class="layui-form-item layui-layout-admin">
<div class="layui-input-block">
<div class="layui-footer" style="left: 0;">
<button type="button" class="layui-btn" lay-submit lay-filter="submitForm">提交新增</button>
<button type="button" class="layui-btn layui-btn-primary close">返回上级</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
<script src="assets/layuiadmin/layui/layui.js"></script>
<script>
layui.config({
base: 'assets/layuiadmin/' //静态资源所在路径
}).extend({
index: 'lib/index' //主入口模块
}).use(['index', 'form', 'laydate', 'laytpl'], function(){
var $ = layui.$;
var form = layui.form;
var laytpl = layui.laytpl;
var laydate = layui.laydate;
var checkId = top.restAjax.params(window.location.href).checkId;
function closeBox() {
parent.layer.close(parent.layer.getFrameIndex(window.name));
}
/**
* 初始化检查项
*
* @param data
*/
function initReCheckItem(checkId) {
top.restAjax.get(top.restAjax.path('api/check/listcheckitemunpassbycheckid/{checkId}', [checkId]), {}, null, function(code, data) {
laytpl(document.getElementById("checkItemTemplate").innerHTML).render(data, function(html) {
document.getElementById("checkItemTemplateBox").innerHTML = html;
});
form.render('radio');
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 初始化内容
function initData() {
var loadLayerIndex;
top.restAjax.get(top.restAjax.path('api/check/getcheckbyid/{checkId}', [checkId]), {}, null, function(code, data) {
var dataFormData = {
enterpriseId: data.enterpriseId,
enterpriseName: data.nameJoinByEnterpriseId,
};
form.val('dataForm', dataFormData);
form.render(null, 'dataForm');
initReCheckItem(data.checkId);
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.loading, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
}
initData();
// 提交表单
form.on('submit(submitForm)', function(formData) {
var field = formData.field;
// 获取隐患项列表
var hdFieldArray = [];
for(var i in field) {
if(i.indexOf('hd_') > -1) {
hdFieldArray.push({
k: i,
v: field[i]
});
delete field[i];
}
}
// 筛选隐藏项
var hiddenDangerReports = [];
var temp;
for(var i = 0, item; item = hdFieldArray[i]; i++) {
var hiddenDangerReportArray = item.k.split('_');
var checkItemId = hiddenDangerReportArray[2];
var removeItemCount = 0;
var hiddenDangerReport = {
checkItemId: checkItemId
};
for(var j = 0, checkItem; checkItem = hdFieldArray[j]; j++) {
var checkItemKey = checkItem.k;
if(checkItemKey.indexOf(checkItemId) > -1) {
if(checkItemKey.indexOf('checkResult') > -1) {
hiddenDangerReport.checkResult = checkItem.v;
hdFieldArray.splice(j, 1);
j--;
removeItemCount++;
} else if(checkItemKey.indexOf('immediatelyChangeType') > -1) {
hiddenDangerReport.immediatelyChangeType = checkItem.v;
hdFieldArray.splice(j, 1);
j--;
removeItemCount++;
} else if(checkItemKey.indexOf('rectificationDays') > -1) {
hiddenDangerReport.rectificationDays = checkItem.v;
hdFieldArray.splice(j, 1);
j--;
removeItemCount++;
} else if(checkItemKey.indexOf('scenePhotos') > -1) {
hiddenDangerReport.scenePhotos = checkItem.v;
hdFieldArray.splice(j, 1);
j--;
removeItemCount++;
}
}
}
hiddenDangerReports.push(hiddenDangerReport);
if(removeItemCount > 0) {
i--;
}
}
field.hiddenDangerReports = hiddenDangerReports;
top.dialog.confirm(top.dataMessage.commit, function(index) {
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.post(top.restAjax.path('api/check/savecheck', []), formData.field, null, function(code, data) {
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],
shade: 0.3,
yes: function(index) {
top.dialog.close(index);
window.location.reload();
},
btn2: function() {
closeBox();
}
});
}, function(code, data) {
top.dialog.msg(data.msg);
}, function() {
loadLayerIndex = top.dialog.msg(top.dataMessage.committing, {icon: 16, time: 0, shade: 0.3});
}, function() {
top.dialog.close(loadLayerIndex);
});
});
return false;
});
$('.close').on('click', function() {
closeBox();
});
// 校验
form.verify({
});
form.on('radio(checkResultFilter)', function(data) {
var name = data.elem.name;
var checkItemId = name.split('_')[2];
if(data.value == 2) {
$('#hd_immediatelyChangeType_'+ checkItemId +'_Box').show();
$('#hd_rectificationDays_'+ checkItemId +'_Box').hide();
} else if(data.value == 3) {
$('#hd_rectificationDays_'+ checkItemId +'_Box').show();
$('#hd_immediatelyChangeType_'+ checkItemId +'_Box').hide();
} else {
$('#hd_rectificationDays_'+ checkItemId +'_Box').hide();
$('#hd_immediatelyChangeType_'+ checkItemId +'_Box').hide();
}
if(data.value != 0) {
$('#hd_scenePhotos_'+ checkItemId +'_Box').show();
} else {
$('#hd_scenePhotos_'+ checkItemId +'_Box').hide();
}
form.render('radio');
});
function refreshDownloadTemplet(fileName, file) {
var dataRander = {};
dataRander[fileName] = file;
var photos = '';
for(var i = 0, item; item = file[i++];) {
photos += '<div class="upload-image-box">'+
'<span class="upload-image-span">'+
'<img src="route/file/downloadfile/false/'+ item.fileId +'" align="加载失败">'+
'</span>'+
'<a class="layui-btn layui-btn-xs layui-btn-danger text-danger remove-image" href="javascript:void(0);" lay-form-button data-id="'+ item.fileId +'" data-name="'+ fileName +'" lay-filter="scenePhotosRemoveFile">'+
'<i class="fa fa-trash-o"></i>'+
'</a>'+
'</div>';
}
$('#'+ fileName +'_ImageBox').empty();
$('#'+ fileName +'_ImageBox').append(photos);
}
// 初始化文件列表
function initFileList(fileName, ids, callback) {
var dataForm = {};
dataForm[fileName] = ids;
form.val('dataForm', dataForm);
if(!ids) {
refreshDownloadTemplet(fileName, []);
if(callback) {
callback(fileName, []);
}
return;
}
top.restAjax.get(top.restAjax.path('api/file/listfilebyfileid', []), {
ids: ids
}, null, function(code, data) {
refreshDownloadTemplet(fileName, data);
if(callback) {
callback(fileName, data);
}
}, function(code, data) {
top.dialog.msg(data.msg);
});
}
// 上传图片
form.on('button(scenePhotosUploadFiles)', function(obj) {
var name = this.dataset.name;
var explain = this.dataset.explain;
top.dialog.file({
type: 'image',
title: '上传'+ explain,
width: '400px',
height: '420px',
maxFileCount: '1',
onClose: function() {
var uploadFileArray = top.dialog.dialogData.uploadFileArray;
if(typeof(uploadFileArray) != 'undefined' && uploadFileArray.length > 0) {
var files = $('#'+ name).val();
for(var j = 0, file = uploadFileArray[j]; file = uploadFileArray[j++];) {
if(files.length > 0) {
files += ',';
}
files += file.data;
}
initFileList(name, files, function(fileName) {});
}
}
});
});
form.on('button(scenePhotosRemoveFile)', function(obj) {
var name = this.dataset.name;
var id = this.dataset.id;
var files = $('#'+ name).val().replace(id, '');
files = files.replace(/\,+/g, ',');
if(files.charAt(0) == ',') {
files = files.substring(1);
}
if(files.charAt(files.length - 1) == ',') {
files = files.substring(0, files.length - 2);
}
initFileList(name, files, function(fileName) {});
});
});
</script>
</body>
</html>