d42c6390 张雷

危险作业工作流开发

1 个父辈 f464509b
......@@ -15,11 +15,11 @@
FROM
ajh_waste_produce p
LEFT JOIN ( SELECT * FROM ajh_waste_keep WHERE 1=1
<if test="reportMonth!=null and reportMonth!=''">
and LEFT ( keep_in_date, 7 ) = #{reportMonth}
</if>
) k ON p.depart_id = k.depart_id
AND p.waste_code = k.waste_code
AND p.waste_name = k.waste_name
......@@ -30,7 +30,10 @@
and LEFT ( p.pro_out_date, 7 ) = #{reportMonth}
</if>
<if test="departId!=null and departId!=''">
and p.depart_id = #{departId}
and p.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY
p.depart_id,
......
......@@ -20,7 +20,10 @@
WHERE
LEFT ( p.pro_out_date, 4 ) = #{reportYear}
<if test="departId!=null and departId!=''">
and p.depart_id = #{departId}
and p.depart_id in
<foreach item="item" index="index" collection="departId.split(',')" open="(" separator="," close=")">
'${item}'
</foreach>
</if>
GROUP BY
p.depart_id,
......
package com.skua.modules.ajh.service.impl;
import com.skua.core.context.BaseContextHandler;
import com.skua.modules.ajh.entity.AjhWasteMonthReport;
import com.skua.modules.ajh.mapper.AjhWasteMonthReportMapper;
import com.skua.modules.ajh.service.IAjhWasteMonthReportService;
import com.skua.modules.system.service.ISysDepartService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -19,16 +25,22 @@ public class AjhWasteMonthReportServiceImpl extends ServiceImpl<AjhWasteMonthRep
@Autowired
private AjhWasteMonthReportMapper ajhWasteMonthReportMapper;
@Resource
private ISysDepartService departService;
@Override
public List<AjhWasteMonthReport> getList(AjhWasteMonthReport ajhWasteMonthReport) {
List<AjhWasteMonthReport> list = new ArrayList<>();
String departId = null;
String reportMonth = null;
departId = ajhWasteMonthReport.getDepartId();
reportMonth = ajhWasteMonthReport.getReportMonth();
// if(reportMonth==null){
// reportMonth = "2022-03";
if (StringUtils.isBlank(ajhWasteMonthReport.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) {
departId = departService.getChildDepartId(BaseContextHandler.getDeparts());
}else{
departId = departService.getChildDepartId(ajhWasteMonthReport.getDepartId());
}
String reportMonth = ajhWasteMonthReport.getReportMonth();
// if(reportMonth == null){
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
// reportMonth = dateFormat.format(new Date());
// }
list = ajhWasteMonthReportMapper.getList(departId,reportMonth);
return list;
......
package com.skua.modules.ajh.service.impl;
import com.skua.core.context.BaseContextHandler;
import com.skua.modules.ajh.entity.AjhWasteYearReport;
import com.skua.modules.ajh.mapper.AjhWasteYearReportMapper;
import com.skua.modules.ajh.service.IAjhWasteYearReportService;
import com.skua.modules.system.service.ISysDepartService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javax.annotation.Resource;
import java.time.Year;
import java.util.ArrayList;
import java.util.List;
......@@ -19,16 +24,21 @@ public class AjhWasteYearReportServiceImpl extends ServiceImpl<AjhWasteYearRepor
@Autowired
private AjhWasteYearReportMapper ajhWasteYearReportMapper;
@Resource
private ISysDepartService departService;
@Override
public List<AjhWasteYearReport> queryList(AjhWasteYearReport ajhWasteYearReport) {
List<AjhWasteYearReport> list = new ArrayList<>();
String departId = null;
String reportYear = null;
departId = ajhWasteYearReport.getDepartId();
reportYear = ajhWasteYearReport.getReportYear();
if (StringUtils.isBlank(ajhWasteYearReport.getDepartId())&&StringUtils.isNotBlank(BaseContextHandler.getDeparts())) {
departId = departService.getChildDepartId(BaseContextHandler.getDeparts());
}else{
departId = departService.getChildDepartId(ajhWasteYearReport.getDepartId());
}
String reportYear = ajhWasteYearReport.getReportYear();
if(reportYear==null){
reportYear = "2022";
reportYear = String.valueOf(Year.now().getValue());
}
list = ajhWasteYearReportMapper.queryList(departId,reportYear);
return list;
......
......@@ -7,18 +7,17 @@ import com.skua.core.api.vo.Result;
import com.skua.core.aspect.annotation.AutoLog;
import com.skua.core.query.QueryGenerator;
import com.skua.core.util.ConvertUtils;
import com.skua.modules.emergency.dto.EmergencyRiskEventAddDTO;
import com.skua.modules.emergency.dto.EmergencyRiskEventHandleDto;
import com.skua.modules.emergency.entity.DangerousOperation;
import com.skua.modules.emergency.service.IDangerousOperationService;
import com.skua.modules.flow.business.service.FlowBusinessService;
import com.skua.modules.flow.core.entity.FlowAssemblyEntity;
import com.skua.tool.util.BeanExtUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.*;
......@@ -120,8 +119,8 @@ public class DangerousOperationController {
return result;
}
@AutoLog(value = "应急风险事件-分页列表查询")
@ApiOperation(value="应急风险事件-分页列表查询", notes="应急风险事件-分页列表查询")
@AutoLog(value = "危险作业事件-分页列表查询")
@ApiOperation(value="危险作业事件-分页列表查询", notes="危险作业事件-分页列表查询")
@GetMapping(value = "/list")
public Result<IPage<DangerousOperation>> queryPageList(DangerousOperation dangerousOperation,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
......@@ -166,16 +165,18 @@ public class DangerousOperationController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "应急风险事件-开始流程")
@ApiOperation(value="应急风险事件-开始流程", notes="应急风险事件-开始流程")
@PostMapping(value = "/startProcess")
public Result<DangerousOperation> startProcess(@Valid @RequestBody DangerousOperation dangerousOperation) {
Result<DangerousOperation> result = new Result<DangerousOperation>();
@AutoLog(value = "危险作业事件-开始流程")
@ApiOperation(value="危险作业事件-开始流程", notes="危险作业事件-开始流程")
@PostMapping(value = "/start-process")
public Result<DangerousOperation> startProcess(@RequestBody DangerousOperation dangerousOperation) {
Result<DangerousOperation> result = new Result<>();
try {
dangerousOperationService.startProcess(dangerousOperation);
dangerousOperation.setDelFlag(0);
DangerousOperation data = dangerousOperationService.startProcess(dangerousOperation);
result.setResult(data);
result.success("添加成功!");
} catch (Exception e) {
log.error(e.getMessage(),e);
log.error(e.getMessage(), e);
result.error500("操作失败");
}
return result;
......@@ -189,8 +190,8 @@ public class DangerousOperationController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "应急风险事件-处理")
@ApiOperation(value="应急风险事件-处理", notes="应急风险事件-处理")
@AutoLog(value = "危险作业事件-处理")
@ApiOperation(value="危险作业事件-处理", notes="危险作业事件-处理")
@PostMapping(value = "/handle")
public Result<DangerousOperation> handle(@Valid @RequestBody DangerousOperation dangerousOperation) {
Result<DangerousOperation> result = new Result<DangerousOperation>();
......@@ -207,8 +208,8 @@ public class DangerousOperationController {
* @author 开发者姓名, 开发时间
* @Description: TODO(这里描述这个方法的需求变更情况)
*/
@AutoLog(value = "应急风险事件-通过id删除")
@ApiOperation(value="应急风险事件-通过id删除", notes="应急风险事件-通过id删除")
@AutoLog(value = "危险作业事件-通过id删除")
@ApiOperation(value="危险作业事件-通过id删除", notes="危险作业事件-通过id删除")
@DeleteMapping(value = "/delete")
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
try {
......@@ -220,5 +221,45 @@ public class DangerousOperationController {
return Result.ok("删除成功!");
}
@PostMapping(value = "/complete-task-choose-user-pass")
public Result<?> completeTaskChooseUserPass(@RequestBody DangerousOperation dangerousOperation) throws Exception {
Result<?> result = new Result();
FlowAssemblyEntity flowAssemblyEntity = BeanExtUtils.bean2Bean(dangerousOperation, FlowAssemblyEntity.class);
if (org.apache.commons.lang.StringUtils.isEmpty(flowAssemblyEntity.getAssemblyKey())) {
//AssemblyKey对应参数用户id
flowAssemblyEntity.setAssemblyKey("");
}
String activeResult = this.flowBusinessService.completeTaskChooseUserPass(flowAssemblyEntity);
if ("noChooseUser".equals(activeResult)) {
result.error500("未指定下一节点用户!");
} else if ("fail".equals(activeResult)) {
result.error500("程序异常,流程审批失败!");
} else {
DangerousOperation dangerOperation = BeanExtUtils.bean2Bean(dangerousOperation, DangerousOperation.class);
dangerousOperationService.updateById(dangerOperation);
result.success("成功");
}
return result;
}
@AutoLog(value = "危险作业事件-办结流程")
@ApiOperation(value = "危险作业事件-办结流程", notes = "危险作业事件-办结流程")
@PostMapping(value = "/complete-process")
public Result<DangerousOperation> completeProcess(@RequestBody DangerousOperation dangerousOperation) {
Result<DangerousOperation> result = new Result<>();
try {
dangerousOperation.setDelFlag(0);
boolean flag = dangerousOperationService.completeProcess(dangerousOperation);
if (flag) {
result.success("办结成功!");
} else {
result.error500("办结失败!");
}
} catch (Exception e) {
log.error(e.getMessage(), e);
result.error500("办结失败");
}
return result;
}
}
......
......@@ -3,8 +3,6 @@ package com.skua.modules.emergency.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.skua.modules.emergency.entity.DangerousOperation;
import java.util.Map;
/**
* 应急风险事件
*/
......@@ -14,7 +12,7 @@ public interface IDangerousOperationService extends IService<DangerousOperation>
* 开始流程
* @param dangerousOperation
*/
void startProcess(DangerousOperation dangerousOperation);
DangerousOperation startProcess(DangerousOperation dangerousOperation);
/**
* 应急风险事件-处理
......@@ -22,4 +20,5 @@ public interface IDangerousOperationService extends IService<DangerousOperation>
*/
void handle(DangerousOperation dangerousOperation);
boolean completeProcess(DangerousOperation dangerousOperation);
}
......
......@@ -19,6 +19,7 @@ import com.skua.modules.flow.custombiz.handle.IFlowCustomHandle;
import com.skua.modules.flow.custombiz.vo.FlowProcessFormFieldInfoVO;
import com.skua.modules.flow.support.Kv;
import com.skua.modules.flow.utils.Func;
import com.skua.modules.system.entity.ProblemReportPlan;
import com.skua.tool.util.UniqIdUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
......@@ -26,6 +27,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -41,30 +44,24 @@ public class DangerousOperationServiceImpl extends ServiceImpl<DangerousOperatio
@Override
@Transactional(rollbackFor = Exception.class)
public void startProcess(DangerousOperation dangerousOperation) {
DangerousOperation saveParam = new DangerousOperation();
BeanUtils.copyProperties(dangerousOperation, saveParam);
saveParam.setId(UniqIdUtils.getInstance().getUniqID());
saveParam.setOperationStatus(DangerousOperationHandleResultEnums.UN_HANDLE.getItemValue());
this.save(saveParam);
public DangerousOperation startProcess(DangerousOperation dangerousOperation) {
String businessTable = "dangerous_operation_manage";
//设置当前人为上报人
dangerousOperation.setReportDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
this.saveOrUpdate(dangerousOperation);
// 启动流程
Kv variables = Kv.create().set(ProcessConstant.TASK_VARIABLE_CREATE_USER, "");
BladeFlow flow = flowService.startProcessInstanceById(dangerousOperation.getProcessDefinitionId(),
FlowUtil.getBusinessKey(businessTable, String.valueOf(dangerousOperation.getId())), variables);
BladeFlow flow = flowService.startProcessInstanceById(saveParam.getProcessDefinitionId(), FlowUtil.getBusinessKey(businessTable, String.valueOf(saveParam.getId())), variables);
if (Func.isNotEmpty(flow)) {
if (Func.isNotEmpty(flow)){
log.debug("流程已启动,流程ID:" + flow.getProcessInstanceId());
// 返回流程id写入leave
saveParam.setProcessInstanceId(flow.getProcessInstanceId());
updateById(saveParam);
dangerousOperation.setProcessInstanceId(flow.getProcessInstanceId());
updateById(dangerousOperation);
} else {
throw new JeecgBootException("开启流程失败");
}
return dangerousOperation;
}
@Override
......@@ -86,6 +83,21 @@ public class DangerousOperationServiceImpl extends ServiceImpl<DangerousOperatio
}
@Override
@Transactional(rollbackFor = Exception.class)
public boolean completeProcess(DangerousOperation dangerousOperation) {
DangerousOperation dangerousOperation1 = baseMapper.selectById(dangerousOperation.getId());
dangerousOperation1.setOperationStatus("1");
dangerousOperation1.setOperationUser(BaseContextHandler.getUserId());
dangerousOperation1.setOperationDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
dangerousOperation1.setOperationResult(dangerousOperation.getOperationResult());
dangerousOperation1.setOperationImg(dangerousOperation.getOperationImg());
this.updateById(dangerousOperation1);
//调用同意接口
boolean flag = flowBusinessService.completeTask(ProcessConstant.PASS_KEY, dangerousOperation.getFlow());
return flag;
}
@Override
public List<FlowProcessFormFieldInfoVO> buildCustomData(String s, List<FlowProcessFormFieldInfoVO> list) {
for (FlowProcessFormFieldInfoVO entity : list) {
if ("operationUser".equals(entity.getFieldCode())) {
......
......@@ -159,6 +159,21 @@ public class FlowBussinessDescManageServiceImpl implements IFlowBusinessDescServ
for (Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("title")));
}
}else if (tableName.equals("dangerous_operation_manage")) {
//危险作业
String ids = tableMap.get(tableName).substring(1);
List<String> avgIndexCodeArray = Arrays.asList(ids.split(","));
String inSqlPart = avgIndexCodeArray.stream().map(s -> "'" + s.trim() + "'").collect(Collectors.joining(","));
String sql = "SELECT a.id," +
" CONCAT(a.operation_name,'-危险作业审批') as title " +
"FROM " +
" dangerous_operation_manage a " +
"WHERE " +
" a.id in (" + inSqlPart + ")";
List<Map<String, Object>> dataList = masterDB.queryForList(sql);
for (Map<String, Object> dataMap : dataList) {
resultMap.put(ConvertUtils.getString(dataMap.get("id")), ConvertUtils.getString(dataMap.get("title")));
}
}
}
}
......
......@@ -192,35 +192,42 @@ public class FactoryCenterServiceImpl implements IFactoryCenterService {
Map<String, Object> yclslMap = new HashMap<>();
yclslMap.put("value","0");
yclslMap.put("valueTb","0");
yclslMap.put("unit","吨");
yclslMap.put("valueHb","0");
map.put("rjclsl",new HashMap<>());
Map<String, Object> rjclslMap = new HashMap<>();
rjclslMap.put("value","0");
rjclslMap.put("unit","吨");
rjclslMap.put("valueTb","0");
rjclslMap.put("valueHb","0");
map.put("yzdl",new HashMap<>());
Map<String, Object> yzdlMap = new HashMap<>();
yzdlMap.put("value","0");
yzdlMap.put("unit","Kw.h");
yzdlMap.put("valueTb","0");
yzdlMap.put("valueHb","0");
map.put("dsdh",new HashMap<>());
Map<String, Object> dsdhMap = new HashMap<>();
dsdhMap.put("value","0");
dsdhMap.put("unit","Kw.h/吨水");
dsdhMap.put("valueTb","-");
dsdhMap.put("valueHb","0");
map.put("yzcnl",new HashMap<>());
Map<String, Object> yzcnlMap = new HashMap<>();
yzcnlMap.put("value","0");
yzcnlMap.put("unit","吨");
yzcnlMap.put("valueTb","-");
yzcnlMap.put("valueHb","0");
map.put("wdscnl",new HashMap<>());
Map<String, Object> wdscnlMap = new HashMap<>();
wdscnlMap.put("value","0");
wdscnlMap.put("unit","吨/万吨");
wdscnlMap.put("valueTb","-");
wdscnlMap.put("valueHb","0");
map.put("rjdl",new HashMap<>());
Map<String, Object> rjdlMap = new HashMap<>();
rjdlMap.put("value","0");
rjdlMap.put("unit","Kw.h");
rjdlMap.put("valueTb","-");
rjdlMap.put("valueHb","0");
map.put("yclsl", yclslMap);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!