Commit 1ce21c8e authored by tianbo's avatar tianbo

隐患bug修改

parent dbb5b528
...@@ -845,4 +845,14 @@ public class DateUtils { ...@@ -845,4 +845,14 @@ public class DateUtils {
time = String.format(time, h, m, s); time = String.format(time, h, m, s);
return time; return time;
} }
public static Date getTargetEndTime(Date target) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(target);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
Date end = calendar.getTime();
return end;
}
} }
...@@ -37,7 +37,7 @@ public class LatentDangerDto { ...@@ -37,7 +37,7 @@ public class LatentDangerDto {
/** /**
* 创建隐患的业务id(p_check_input) * 创建隐患的业务id(p_check_input)
*/ */
private Long bizId = 0L; private Long bizId;
/** /**
* 建筑id * 建筑id
......
...@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams; ...@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.bo.RoleBo; import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum; import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService; import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
...@@ -242,7 +243,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -242,7 +243,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if (ValidationUtil.isEmpty(dangerTypeEnum)) { if (ValidationUtil.isEmpty(dangerTypeEnum)) {
throw new Exception("检查类型参数有误"); throw new Exception("检查类型参数有误");
} }
Date endTime = this.GetTargetEndTime(param.getReformLimitDate()); Date endTime = DateUtils.getTargetEndTime(param.getReformLimitDate());
param.setReformLimitDate(endTime); param.setReformLimitDate(endTime);
// 保存隐患 // 保存隐患
LatentDanger latentDanger = saveLatentDanger(param, userId, departmentId, businessKey, orgCode, LatentDanger latentDanger = saveLatentDanger(param, userId, departmentId, businessKey, orgCode,
...@@ -318,16 +319,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -318,16 +319,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
// riskFactorMapper.updateControlStatus(riskFactorBo); // riskFactorMapper.updateControlStatus(riskFactorBo);
// } // }
public static Date GetTargetEndTime(Date target) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(target);
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 59);
calendar.set(Calendar.SECOND, 59);
Date end = calendar.getTime();
return end;
}
// TODO 使用远程调用替换 // TODO 使用远程调用替换
private void updateCheckInputDangerState(Long id, int code) { private void updateCheckInputDangerState(Long id, int code) {
latentDangerMapper.updateCheckInputDangerState(id, code); latentDangerMapper.updateCheckInputDangerState(id, code);
...@@ -2206,10 +2197,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -2206,10 +2197,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
throw new Exception("隐患不存"); throw new Exception("隐患不存");
} }
latentDangerDto.setDangerPosition(null); latentDangerDto.setDangerPosition(null);
//以下方法存在bug会将数值类型的默认值0拷贝到对象上造成数据覆盖 Bean.copyExistPropertis(latentDangerDto, latentDanger);
//Bean.copyExistPropertis(latentDangerDto, latentDanger);
latentDanger.setId(latentDangerDto.getId());
latentDanger.setFlowJson(latentDangerDto.getFlowJson());
if (!ValidationUtil.isEmpty(latentDangerDto.getPhotoUrl())) { if (!ValidationUtil.isEmpty(latentDangerDto.getPhotoUrl())) {
latentDanger.setPhotoUrls(Joiner.on(",").join(latentDangerDto.getPhotoUrl())); latentDanger.setPhotoUrls(Joiner.on(",").join(latentDangerDto.getPhotoUrl()));
...@@ -2235,9 +2223,13 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -2235,9 +2223,13 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if (!executeSubmitDto.getIsOk()) { if (!executeSubmitDto.getIsOk()) {
throw new Exception(executeSubmitDto.getMsg()); throw new Exception(executeSubmitDto.getMsg());
} }
sendSubmitMessage(executeType, latentDanger, executeSubmitDto);
return executeSubmitDto;
}
public void sendSubmitMessage(Integer executeType, LatentDanger latentDanger, DangerExecuteSubmitDto executeSubmitDto) throws Exception {
List<String> userIds = workflowExecuteService.getUserIdsByWorkflow(latentDanger.getInstanceId(), executeSubmitDto.getCheckLeaderId()); List<String> userIds = workflowExecuteService.getUserIdsByWorkflow(latentDanger.getInstanceId(), executeSubmitDto.getCheckLeaderId());
ruleDangerService.addDangerSubmitRule(latentDanger, userIds, RuleTypeEnum.隐患审核.getCode(), ExecuteTypeEnum.getNameByCode(executeType)); ruleDangerService.addDangerSubmitRule(latentDanger, userIds, RuleTypeEnum.隐患审核.getCode(), ExecuteTypeEnum.getNameByCode(executeType));
return executeSubmitDto;
} }
@Override @Override
......
...@@ -17,6 +17,7 @@ import com.yeejoin.amos.latentdanger.common.enums.LatentDangerState; ...@@ -17,6 +17,7 @@ import com.yeejoin.amos.latentdanger.common.enums.LatentDangerState;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger; import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -87,6 +88,9 @@ public class RuleDangerService { ...@@ -87,6 +88,9 @@ public class RuleDangerService {
latentDangerRo.setIsSendWeb(true); latentDangerRo.setIsSendWeb(true);
latentDangerRo.setRecivers(userIds); latentDangerRo.setRecivers(userIds);
latentDangerRo.setTerminal(RuleConstant.APP_WEB); latentDangerRo.setTerminal(RuleConstant.APP_WEB);
if (ValidationUtil.isEmpty(userIds)) {
return false;
}
//触发规则 //触发规则
ruleTrigger.publish(latentDangerRo, packageId, new String[0]); ruleTrigger.publish(latentDangerRo, packageId, new String[0]);
return true; return true;
......
...@@ -58,7 +58,6 @@ public class RulePlanService { ...@@ -58,7 +58,6 @@ public class RulePlanService {
@Autowired @Autowired
private PointServiceImpl pointService; private PointServiceImpl pointService;
@Async
public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, Long pointId) throws Exception { public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, Long pointId) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, pointId); PlanRo planRo = buildPlanRo(plan, userIds, ruleType, pointId);
//触发规则 //触发规则
...@@ -66,7 +65,6 @@ public class RulePlanService { ...@@ -66,7 +65,6 @@ public class RulePlanService {
return true; return true;
} }
@Async
public Boolean addPlanAuditRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, String excuteStateName) throws Exception { public Boolean addPlanAuditRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, String excuteStateName) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, null); PlanRo planRo = buildPlanRo(plan, userIds, ruleType, null);
planRo.setExcuteStateName(excuteStateName); planRo.setExcuteStateName(excuteStateName);
...@@ -77,12 +75,12 @@ public class RulePlanService { ...@@ -77,12 +75,12 @@ public class RulePlanService {
private PlanRo buildPlanRo(Plan plan, List<String> userIds, RuleTypeEnum ruleType, Long pointId) { private PlanRo buildPlanRo(Plan plan, List<String> userIds, RuleTypeEnum ruleType, Long pointId) {
// 设置token // 设置token
if (ValidationUtil.isEmpty(RequestContext.getToken())) { // if (ValidationUtil.isEmpty(RequestContext.getToken())) {
Toke tokenObj = remoteSecurityService.getServerToken(); // Toke tokenObj = remoteSecurityService.getServerToken();
RequestContext.setProduct(tokenObj.getProduct()); // RequestContext.setProduct(tokenObj.getProduct());
RequestContext.setAppKey(tokenObj.getAppKey()); // RequestContext.setAppKey(tokenObj.getAppKey());
RequestContext.setToken(tokenObj.getToke()); // RequestContext.setToken(tokenObj.getToke());
} // }
PlanRo planRo = new PlanRo(); PlanRo planRo = new PlanRo();
BeanUtils.copyProperties(plan, planRo); BeanUtils.copyProperties(plan, planRo);
...@@ -116,7 +114,6 @@ public class RulePlanService { ...@@ -116,7 +114,6 @@ public class RulePlanService {
userIds = (List<String>) jcsFeignClient.getAmosIdListByUserIds(leadPeopleIds).getResult(); userIds = (List<String>) jcsFeignClient.getAmosIdListByUserIds(leadPeopleIds).getResult();
// pointId是被检查单位id // pointId是被检查单位id
if (!ValidationUtil.isEmpty(pointId)) { if (!ValidationUtil.isEmpty(pointId)) {
List<String> userIdList = Lists.newArrayList();
Point point = pointService.queryPointById(pointId); Point point = pointService.queryPointById(pointId);
List<OrgUsrFormDto> personList = List<OrgUsrFormDto> personList =
jcsFeignClient.getPersonListByCompanyId(point.getOriginalId()).getResult(); jcsFeignClient.getPersonListByCompanyId(point.getOriginalId()).getResult();
......
...@@ -959,7 +959,15 @@ ...@@ -959,7 +959,15 @@
pld.business_key = #{businessKey} pld.business_key = #{businessKey}
</select> </select>
<select id="selectPageByParam" resultType="com.yeejoin.amos.latentdanger.dao.entity.LatentDanger"> <select id="selectPageByParam" resultType="com.yeejoin.amos.latentdanger.dao.entity.LatentDanger">
select * from p_latent_danger a select
*,
CASE
WHEN a.reform_limit_date <![CDATA[ < ]]> NOW() THEN
1
ELSE
0
END as overtimeState
from p_latent_danger a
<where> <where>
deleted = 0 deleted = 0
<foreach collection="paramMap" index="key" item="value"> <foreach collection="paramMap" index="key" item="value">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment