增加每月重复校验,处理问题

This commit is contained in:
wenc000 2020-04-24 17:45:02 +08:00
parent f39a627bb8
commit 2e8b29b00f
15 changed files with 161 additions and 12 deletions

View File

@ -8,6 +8,7 @@ import com.cm.common.exception.SearchException;
import com.cm.common.pojo.ListPage; import com.cm.common.pojo.ListPage;
import com.cm.common.result.ErrorResult; import com.cm.common.result.ErrorResult;
import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList; import com.cm.common.result.SuccessResultList;
import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO; import com.cm.inspection.pojo.dtos.enterprise.EnterpriseDTO;
import com.cm.inspection.pojo.vos.enterprise.EnterpriseVO; import com.cm.inspection.pojo.vos.enterprise.EnterpriseVO;
@ -42,8 +43,8 @@ public class EnterpriseAppController extends AbstractController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@PostMapping("saveenterprise") @PostMapping("saveenterprise")
@CheckRequestBodyAnnotation @CheckRequestBodyAnnotation
public SuccessResult saveEnterprise(@RequestHeader("token") String token, @RequestBody EnterpriseVO enterpriseVO) throws Exception { public SuccessResultData<String> saveEnterprise(@RequestHeader("token") String token, @RequestBody EnterpriseVO enterpriseVO) throws Exception {
return enterpriseService.saveEnterpriseByToken(token, enterpriseVO); return enterpriseService.saveEnterpriseByTokenReturnId(token, enterpriseVO);
} }
@ApiOperation(value = "删除企业(id列表)", notes = "删除企业(id列表)接口") @ApiOperation(value = "删除企业(id列表)", notes = "删除企业(id列表)接口")

View File

@ -44,6 +44,16 @@ public interface ICheckService {
*/ */
SuccessResult saveCheckByToken(String token, CheckVO checkVO) throws Exception; SuccessResult saveCheckByToken(String token, CheckVO checkVO) throws Exception;
/**
* 新增检查表(APP)
*
* @param token
* @param checkVO
* @return
* @throws Exception
*/
SuccessResultData<String> saveCheckByTokenReturnId(String token, CheckVO checkVO) throws Exception;
/** /**
* 新增复查表 * 新增复查表
* *

View File

@ -8,6 +8,7 @@ import com.cm.common.result.SuccessResult;
import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList; import com.cm.common.result.SuccessResultList;
import com.cm.common.token.app.AppTokenManager; import com.cm.common.token.app.AppTokenManager;
import com.cm.common.token.app.entity.AppToken;
import com.cm.common.utils.DateUtil; import com.cm.common.utils.DateUtil;
import com.cm.common.utils.HashMapUtil; import com.cm.common.utils.HashMapUtil;
import com.cm.common.utils.UUIDUtil; import com.cm.common.utils.UUIDUtil;
@ -89,6 +90,11 @@ public class CheckServiceImpl extends BaseService implements ICheckService {
return new SuccessResult(); return new SuccessResult();
} }
@Override
public SuccessResultData<String> saveCheckByTokenReturnId(String token, CheckVO checkVO) throws Exception {
return new SuccessResultData<>(saveCheckInfoReturnId(token, checkVO));
}
@Override @Override
public SuccessResult saveReCheck(String checkId, CheckVO checkVO) throws Exception { public SuccessResult saveReCheck(String checkId, CheckVO checkVO) throws Exception {
saveReCheckInfo(null, checkId, checkVO); saveReCheckInfo(null, checkId, checkVO);
@ -140,9 +146,24 @@ public class CheckServiceImpl extends BaseService implements ICheckService {
* @throws Exception * @throws Exception
*/ */
private void saveCheckInfo(String token, CheckVO checkVO) throws Exception { private void saveCheckInfo(String token, CheckVO checkVO) throws Exception {
saveCheckInfoReturnId(token, checkVO);
}
/**
* 新增检查表
*
* @param token
* @param checkVO
* @return 新增ID
* @throws Exception
*/
private String saveCheckInfoReturnId(String token, CheckVO checkVO) throws Exception {
if (isEnterpriseCheckedForCurrentMonth(token, checkVO.getEnterpriseId())) {
throw new SaveException("本月已经检查过该企业,无需重复检查");
}
String checkId = UUIDUtil.getUUID();
checkVO.setIsComplete(0); checkVO.setIsComplete(0);
Integer isCoordination = checkVO.getIsCoordination(); Integer isCoordination = checkVO.getIsCoordination();
String checkId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(checkVO); Map<String, Object> params = HashMapUtil.beanToMap(checkVO);
saveCheckWithId(checkId, token, params); saveCheckWithId(checkId, token, params);
LOG.debug("开启流程"); LOG.debug("开启流程");
@ -158,6 +179,30 @@ public class CheckServiceImpl extends BaseService implements ICheckService {
taskCheckVO.setIsHandled(1); taskCheckVO.setIsHandled(1);
taskCheckService.updateTaskCheckByToken(token, checkVO.getTaskCheckId(), taskCheckVO); taskCheckService.updateTaskCheckByToken(token, checkVO.getTaskCheckId(), taskCheckVO);
} }
return checkId;
}
/**
* 当月企业是否检查
*
* @param enterpriseId
* @return
*/
private boolean isEnterpriseCheckedForCurrentMonth(String token, String enterpriseId) {
Map<String, Object> params = getHashMap(2);
params.put("enterpriseId", enterpriseId);
params.put("checkMonth", DateTime.now().toString(DateTimeFormat.forPattern("yyyy-MM")));
params.put("checkType", 1);
if (StringUtils.isBlank(token)) {
params.put("creator", securityComponent.getCurrentUser().getUserId());
} else {
params.put("creator", AppTokenManager.getInstance().getToken(token).getAppTokenUser().getId());
}
Integer countCheck = checkDao.countCheck(params);
if (countCheck > 0) {
return true;
}
return false;
} }
/** /**

View File

@ -42,6 +42,16 @@ public interface IEnterpriseService {
*/ */
SuccessResult saveEnterpriseByToken(String token, EnterpriseVO enterpriseVO) throws Exception; SuccessResult saveEnterpriseByToken(String token, EnterpriseVO enterpriseVO) throws Exception;
/**
* 新增企业(APP)
*
* @param token
* @param enterpriseVO
* @return 返回ID
* @throws SearchException
*/
SuccessResultData<String> saveEnterpriseByTokenReturnId(String token, EnterpriseVO enterpriseVO) throws Exception;
/** /**
* 删除企业 * 删除企业
* *
@ -155,4 +165,5 @@ public interface IEnterpriseService {
* @throws SearchException * @throws SearchException
*/ */
SuccessResultData<Map<String, Object>> countEnterpriseByNature(Map<String, Object> params) throws SearchException; SuccessResultData<Map<String, Object>> countEnterpriseByNature(Map<String, Object> params) throws SearchException;
} }

View File

@ -57,6 +57,11 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer
return new SuccessResult(); return new SuccessResult();
} }
@Override
public SuccessResultData<String> saveEnterpriseByTokenReturnId(String token, EnterpriseVO enterpriseVO) throws Exception {
return new SuccessResultData<>(saveEnterpriseInfoReturnId(token, enterpriseVO));
}
/** /**
* 新增企业 * 新增企业
* *
@ -65,6 +70,18 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer
* @throws Exception * @throws Exception
*/ */
private void saveEnterpriseInfo(String token, EnterpriseVO enterpriseVO) throws Exception { private void saveEnterpriseInfo(String token, EnterpriseVO enterpriseVO) throws Exception {
saveEnterpriseInfoReturnId(token, enterpriseVO);
}
/**
* 新增企业
*
* @param token
* @param enterpriseVO
* @return 返回ID
* @throws Exception
*/
private String saveEnterpriseInfoReturnId(String token, EnterpriseVO enterpriseVO) throws Exception {
String enterpriseId = UUIDUtil.getUUID(); String enterpriseId = UUIDUtil.getUUID();
Map<String, Object> params = HashMapUtil.beanToMap(enterpriseVO); Map<String, Object> params = HashMapUtil.beanToMap(enterpriseVO);
params.put("enterpriseId", enterpriseId); params.put("enterpriseId", enterpriseId);
@ -80,6 +97,7 @@ public class EnterpriseServiceImpl extends BaseService implements IEnterpriseSer
enterpriseOfGridOperatorVO.setEnterpriseId(enterpriseId); enterpriseOfGridOperatorVO.setEnterpriseId(enterpriseId);
enterpriseOfGridOperatorVO.setUserId(params.get("creator").toString()); enterpriseOfGridOperatorVO.setUserId(params.get("creator").toString());
enterpriseOfGridOperatorService.saveEnterpriseOfGridOperatorByToken(token, enterpriseOfGridOperatorVO); enterpriseOfGridOperatorService.saveEnterpriseOfGridOperatorByToken(token, enterpriseOfGridOperatorVO);
return enterpriseId;
} }
@Override @Override

View File

@ -306,6 +306,10 @@
gen_check gen_check
WHERE WHERE
is_delete = 0 is_delete = 0
<if test="enterpriseId != null and enterpriseId != ''">
AND
enterprise_id = #{enterpriseId}
</if>
<if test="creator != null and creator != ''"> <if test="creator != null and creator != ''">
AND AND
creator = #{creator} creator = #{creator}

View File

@ -41,7 +41,7 @@
#{name}, #{name},
#{summary}, #{summary},
#{icon}, #{icon},
#{iconPress} #{iconPress},
#{creator}, #{creator},
#{gmtCreate}, #{gmtCreate},
#{modifier}, #{modifier},

View File

@ -39,6 +39,27 @@
{{# } }} {{# } }}
</select> </select>
</script> </script>
<div class="layui-inline layui-form search-item">
<select id="checkType" name="checkType">
<option value="">检查类型</option>
<option value="1">检查</option>
<option value="2">复查</option>
</select>
</div>
<div class="layui-inline layui-form search-item">
<select name="isCoordination" id="isCoordination">
<option value="">是否配合</option>
<option value="0">不配合</option>
<option value="1">配合</option>
</select>
</div>
<div class="layui-inline layui-form search-item">
<select name="isComplete" id="isComplete">
<option value="">是否完成</option>
<option value="0">未完成</option>
<option value="1">完成</option>
</select>
</div>
<button type="button" id="search" class="layui-btn layui-btn-sm"> <button type="button" id="search" class="layui-btn layui-btn-sm">
<i class="fa fa-lg fa-search"></i> 搜索 <i class="fa fa-lg fa-search"></i> 搜索
</button> </button>
@ -228,6 +249,9 @@
}, },
{field: 'updateCheckMine', width: 110, title: '检查结果', fixed:'right', align:'center', {field: 'updateCheckMine', width: 110, title: '检查结果', fixed:'right', align:'center',
templet: function(row) { templet: function(row) {
if(row.isCoordination != 1) {
return '不配合';
}
return '<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="getCheckMineEvent"><i class="fa fa-lg fa-search"></i> 检查项</button>'; return '<button type="button" class="layui-btn layui-btn-normal layui-btn-sm" lay-event="getCheckMineEvent"><i class="fa fa-lg fa-search"></i> 检查项</button>';
} }
}, },
@ -251,6 +275,9 @@
keywords: $('#keywords').val(), keywords: $('#keywords').val(),
type: $('#type').val(), type: $('#type').val(),
industry: $('#industry').val(), industry: $('#industry').val(),
checkType: $('#checkType').val(),
isCoordination: $('#isCoordination').val(),
isComplete: $('#isComplete').val()
}, },
page: { page: {
curr: currentPage curr: currentPage

View File

@ -38,6 +38,13 @@
{{# } }} {{# } }}
</select> </select>
</script> </script>
<div class="layui-inline layui-form search-item">
<select id="checkType" name="checkType">
<option value="">检查类型</option>
<option value="1">检查</option>
<option value="2">复查</option>
</select>
</div>
<div class="layui-inline layui-form search-item"> <div class="layui-inline layui-form search-item">
<select name="isCoordination" id="isCoordination"> <select name="isCoordination" id="isCoordination">
<option value="">是否配合</option> <option value="">是否配合</option>
@ -270,6 +277,7 @@
keywords: $('#keywords').val(), keywords: $('#keywords').val(),
type: $('#type').val(), type: $('#type').val(),
industry: $('#industry').val(), industry: $('#industry').val(),
checkType: $('#checkType').val(),
isCoordination: $('#isCoordination').val(), isCoordination: $('#isCoordination').val(),
isComplete: $('#isComplete').val() isComplete: $('#isComplete').val()
}, },

View File

@ -85,14 +85,14 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">是否配合</label> <label class="layui-form-label">是否配合</label>
<div class="layui-input-block"> <div class="layui-input-block">
<select id="isCoordination" name="isCoordination" lay-verify="required"> <select id="isCoordination" name="isCoordination" lay-verify="required" lay-filter="isCoordination">
<option value="">请选择</option> <option value="">请选择</option>
<option value="0">不配合</option> <option value="0">不配合</option>
<option value="1">配合</option> <option value="1">配合</option>
</select> </select>
</div> </div>
</div> </div>
<div class="layui-form-item layui-form-text"> <div id="checkItemReportBox" class="layui-form-item layui-form-text" style="display: none;">
<div class="layui-input-block" id="checkItemTemplateBox"></div> <div class="layui-input-block" id="checkItemTemplateBox"></div>
<script id="checkItemTemplate" type="text/html"> <script id="checkItemTemplate" type="text/html">
<table class="layui-table"> <table class="layui-table">
@ -514,6 +514,14 @@
} }
}); });
form.on('select(isCoordination)', function(data) {
if(data.value == 1) {
$('#checkItemReportBox').show();
} else {
$('#checkItemReportBox').hide();
}
});
// area1 选择事件 // area1 选择事件
form.on('select(area1)', function(data) { form.on('select(area1)', function(data) {
initArea2Select(data.value); initArea2Select(data.value);

View File

@ -37,14 +37,14 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">是否配合</label> <label class="layui-form-label">是否配合</label>
<div class="layui-input-block"> <div class="layui-input-block">
<select id="isCoordination" name="isCoordination" lay-verify="required"> <select id="isCoordination" name="isCoordination" lay-verify="required" lay-filter="isCoordination">
<option value="">请选择</option> <option value="">请选择</option>
<option value="0">未整改</option> <option value="0">未整改</option>
<option value="1">配合</option> <option value="1">配合</option>
</select> </select>
</div> </div>
</div> </div>
<div class="layui-form-item layui-form-text"> <div id="checkItemReportBox" class="layui-form-item layui-form-text" style="display: none;">
<div class="layui-input-block" id="checkItemTemplateBox"></div> <div class="layui-input-block" id="checkItemTemplateBox"></div>
<script id="checkItemTemplate" type="text/html"> <script id="checkItemTemplate" type="text/html">
<table class="layui-table"> <table class="layui-table">
@ -320,6 +320,14 @@
} }
}); });
form.on('select(isCoordination)', function(data) {
if(data.value == 1) {
$('#checkItemReportBox').show();
} else {
$('#checkItemReportBox').hide();
}
});
form.on('radio(checkItemOptionCheckResult)', function(data) { form.on('radio(checkItemOptionCheckResult)', function(data) {
var name = data.elem.name; var name = data.elem.name;
var checkItemId = name.split('_')[2]; var checkItemId = name.split('_')[2];

View File

@ -31,14 +31,14 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">是否配合</label> <label class="layui-form-label">是否配合</label>
<div class="layui-input-block"> <div class="layui-input-block">
<select id="isCoordination" name="isCoordination" lay-verify="required"> <select id="isCoordination" name="isCoordination" lay-verify="required" lay-filter="isCoordination">
<option value="">请选择</option> <option value="">请选择</option>
<option value="0">未整改</option> <option value="0">未整改</option>
<option value="1">配合</option> <option value="1">配合</option>
</select> </select>
</div> </div>
</div> </div>
<div class="layui-form-item layui-form-text"> <div id="checkItemReportBox" class="layui-form-item layui-form-text" style="display: none;">
<div class="layui-input-block" id="checkItemTemplateBox"></div> <div class="layui-input-block" id="checkItemTemplateBox"></div>
<script id="checkItemTemplate" type="text/html"> <script id="checkItemTemplate" type="text/html">
<table class="layui-table"> <table class="layui-table">
@ -324,6 +324,14 @@
} }
}); });
form.on('select(isCoordination)', function(data) {
if(data.value == 1) {
$('#checkItemReportBox').show();
} else {
$('#checkItemReportBox').hide();
}
});
form.on('radio(checkItemOptionCheckResult)', function(data) { form.on('radio(checkItemOptionCheckResult)', function(data) {
var name = data.elem.name; var name = data.elem.name;
var checkItemId = name.split('_')[2]; var checkItemId = name.split('_')[2];

View File

@ -157,6 +157,7 @@
var layIndex; var layIndex;
top.restAjax.delete(top.restAjax.path('api/checkitem/removecheckitem/{ids}', [ids]), {}, null, function (code, data) { top.restAjax.delete(top.restAjax.path('api/checkitem/removecheckitem/{ids}', [ids]), {}, null, function (code, data) {
top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000}); top.dialog.msg(top.dataMessage.deleteSuccess, {time: 1000});
parent.common.refreshTree('leftTree');
reloadTable(); reloadTable();
}, function (code, data) { }, function (code, data) {
top.dialog.msg(data.msg); top.dialog.msg(data.msg);

View File

@ -43,7 +43,7 @@
</div> </div>
</div> </div>
<div class="layui-form-item" pane> <div class="layui-form-item" pane>
<label class="layui-form-label">错误</label> <label class="layui-form-label">整改</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="radio" name="isWrong" value="0" title="否" checked> <input type="radio" name="isWrong" value="0" title="否" checked>
<input type="radio" name="isWrong" value="1" title="是"> <input type="radio" name="isWrong" value="1" title="是">

View File

@ -43,7 +43,7 @@
</div> </div>
</div> </div>
<div class="layui-form-item" pane> <div class="layui-form-item" pane>
<label class="layui-form-label">错误</label> <label class="layui-form-label">整改</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="radio" name="isWrong" value="0" title="否"> <input type="radio" name="isWrong" value="0" title="否">
<input type="radio" name="isWrong" value="1" title="是"> <input type="radio" name="isWrong" value="1" title="是">