Compare commits
79 Commits
162f538dd1
...
process-de
| Author | SHA1 | Date | |
|---|---|---|---|
| 0377a0cc8c | |||
| ebf57c2e82 | |||
| 6d5c8bfd65 | |||
| b9d6a7458f | |||
| 784ac30847 | |||
| b0e2e58d93 | |||
| 785654a510 | |||
| dafda57a0e | |||
| 9cc4d4a988 | |||
| fadbe2b59f | |||
| c11112b066 | |||
| f33f57f6a7 | |||
| c3babf2c4d | |||
| 04610aa678 | |||
| 596b2a68bf | |||
| 5bacfa37d4 | |||
| a5ac9fb038 | |||
| 1cd6750710 | |||
| b745bb8482 | |||
| 9a9dc780e4 | |||
| 3208f2b8a3 | |||
| 7048001c0c | |||
| 44b6bf04d5 | |||
| e50422d7a7 | |||
| 75f33e37d7 | |||
| 17751bd0ab | |||
| 82d68ed669 | |||
| 09fce43c98 | |||
| 9895757c92 | |||
| bce9cc42e8 | |||
| 9a9a743945 | |||
| 6de1aabe80 | |||
| 3ea3e0a9af | |||
| 56da3dc9ff | |||
| 2bfa643373 | |||
| 5e52e1db7c | |||
| acd1967b1f | |||
| 1c8f1f98d5 | |||
| 3da9c9afb5 | |||
| a187b11c33 | |||
| 7fbf63ed66 | |||
| 0d641d8d4f | |||
| 0200e883d7 | |||
| 4ca5d82ac0 | |||
| e3582cb6ae | |||
| a8f246c026 | |||
| 2a183cbf92 | |||
| a821565077 | |||
| 1798d7c841 | |||
| 061ededef9 | |||
| 0a9726fed8 | |||
| 2a8318599a | |||
| 29a836ce68 | |||
| fbd2186aaf | |||
| d1c8ae0b5a | |||
| 4b7e269c3a | |||
| 3fffc91cc1 | |||
| 3a50d35f2c | |||
| 2c1a99269f | |||
| 513741bbfa | |||
| cf7ca3515c | |||
| 0b265d817b | |||
| 7fd0768e8a | |||
| debeec23da | |||
| d70325751e | |||
| 5fa4d814aa | |||
| d60f8aa1f5 | |||
| 2b77b05c10 | |||
| 28e1b2a9f1 | |||
| b79f345ecc | |||
| 2def5338d9 | |||
| cd15aa75c3 | |||
| dc5ad9f5e1 | |||
| 73c02fa365 | |||
| ed81825425 | |||
| 3d81e6950f | |||
| 8cc5132e9b | |||
| 26031a77da | |||
| 696597feba |
22
pom.xml
22
pom.xml
@ -369,6 +369,12 @@
|
||||
<groupId>org.xhtmlrenderer</groupId>
|
||||
<artifactId>core-renderer</artifactId>
|
||||
<version>R8</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk14</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- 支持css样式渲染 -->
|
||||
<dependency>
|
||||
@ -597,6 +603,17 @@
|
||||
<groupId>org.redisson</groupId>
|
||||
<artifactId>redisson</artifactId>
|
||||
<version>3.11.4</version>
|
||||
<exclusions>
|
||||
<!-- 项目仍使用 jodd 3.x,排除 redisson 传入的 jodd 5.x,避免运行时方法签名冲突 -->
|
||||
<exclusion>
|
||||
<groupId>org.jodd</groupId>
|
||||
<artifactId>jodd-bean</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.jodd</groupId>
|
||||
<artifactId>jodd-core</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<!-- <version>3.13.3</version>-->
|
||||
</dependency>
|
||||
<!-- zkclient -->
|
||||
@ -817,6 +834,9 @@
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.json</include>
|
||||
<include>**/*.bpmn</include>
|
||||
<include>**/*.png</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
@ -871,4 +891,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
|
||||
@ -10,6 +10,8 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @Author : YYJ
|
||||
* @CreateTime : 2021/9/14
|
||||
@ -32,6 +34,18 @@ public class RedissonConfig {
|
||||
|
||||
@Value("${redis.password}")
|
||||
public String password;
|
||||
|
||||
@Value("${redis.timeout:10000}")
|
||||
public int timeout;
|
||||
|
||||
@Value("${redis.maxIdle:100}")
|
||||
public int maxIdle;
|
||||
|
||||
@Value("${redis.maxActive:300}")
|
||||
public int maxActive;
|
||||
|
||||
@Value("${redis.testOnBorrow:true}")
|
||||
public boolean testOnBorrow;
|
||||
|
||||
@Value("${cluster1.host.port:}")
|
||||
public String cluster1;
|
||||
@ -58,10 +72,33 @@ public class RedissonConfig {
|
||||
singleServerConfig.setAddress("redis://" + host + ":" + port);
|
||||
//设置连接密码
|
||||
singleServerConfig.setPassword(password);
|
||||
// 设置超时时间(毫秒)
|
||||
singleServerConfig.setTimeout(timeout);
|
||||
// 设置连接池大小
|
||||
singleServerConfig.setConnectionMinimumIdleSize(Math.min(10, maxIdle));
|
||||
singleServerConfig.setConnectionPoolSize(maxActive);
|
||||
// 设置空闲连接超时
|
||||
singleServerConfig.setIdleConnectionTimeout(10000);
|
||||
// 设置 ping 间隔,保持连接活跃
|
||||
singleServerConfig.setPingConnectionInterval(10000);
|
||||
// 设置失败重试次数
|
||||
singleServerConfig.setRetryAttempts(3);
|
||||
// 设置重试间隔
|
||||
singleServerConfig.setRetryInterval(1500);
|
||||
// 设置数据库索引
|
||||
// singleServerConfig.setDatabase(Integer.valueOf(database));
|
||||
}else if(MODE_CLUSTER.equals(mode)){//集群
|
||||
conf.useClusterServers()
|
||||
.setScanInterval(2000);
|
||||
.setScanInterval(2000)
|
||||
.setTimeout(timeout)
|
||||
.setMasterConnectionMinimumIdleSize(Math.min(10, maxIdle))
|
||||
.setMasterConnectionPoolSize(maxActive)
|
||||
.setSlaveConnectionMinimumIdleSize(Math.min(10, maxIdle))
|
||||
.setSlaveConnectionPoolSize(maxActive)
|
||||
.setIdleConnectionTimeout(10000)
|
||||
.setPingConnectionInterval(10000)
|
||||
.setRetryAttempts(3)
|
||||
.setRetryInterval(1500);
|
||||
if(cluster1!=null && !cluster1.isEmpty()){
|
||||
conf.useClusterServers().addNodeAddress("redis://" + cluster1);
|
||||
}
|
||||
@ -83,7 +120,7 @@ public class RedissonConfig {
|
||||
// .setPassword(password);
|
||||
}
|
||||
|
||||
//使用json序列化方式
|
||||
//使用 json 序列化方式
|
||||
Codec codec = new JsonJacksonCodec();
|
||||
conf.setCodec(codec);
|
||||
redisson = Redisson.create(conf);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,400 @@
|
||||
package com.sipai.controller.administration;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sipai.entity.activiti.WorkTask;
|
||||
import com.sipai.entity.administration.LeaveApply;
|
||||
import com.sipai.entity.administration.LeaveCommStr;
|
||||
import com.sipai.entity.base.Result;
|
||||
import com.sipai.entity.business.BusinessUnit;
|
||||
import com.sipai.entity.business.BusinessUnitAudit;
|
||||
import com.sipai.entity.business.BusinessUnitHandle;
|
||||
import com.sipai.entity.business.BusinessUnitRecord;
|
||||
import com.sipai.entity.user.User;
|
||||
import com.sipai.service.activiti.WorkflowProcessDefinitionService;
|
||||
import com.sipai.service.activiti.WorkflowService;
|
||||
import com.sipai.service.administration.LeaveApplyService;
|
||||
import com.sipai.service.business.BusinessUnitAuditService;
|
||||
import com.sipai.service.business.BusinessUnitHandleService;
|
||||
import com.sipai.service.user.UserService;
|
||||
import com.sipai.tools.ActivitiUtil;
|
||||
import com.sipai.tools.CommString;
|
||||
import com.sipai.tools.CommUtil;
|
||||
import net.sf.json.JSONArray;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.impl.pvm.process.ActivityImpl;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/administration/leaveApply")
|
||||
public class LeaveApplyController {
|
||||
@Resource
|
||||
private LeaveApplyService leaveApplyService;
|
||||
@Resource
|
||||
private WorkflowProcessDefinitionService workflowProcessDefinitionService;
|
||||
@Resource
|
||||
private BusinessUnitHandleService businessUnitHandleService;
|
||||
@Resource
|
||||
private BusinessUnitAuditService businessUnitAuditService;
|
||||
@Resource
|
||||
private WorkflowService workflowService;
|
||||
@Resource
|
||||
private RuntimeService runtimeService;
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@RequestMapping("/showList.do")
|
||||
public String showList(HttpServletRequest request, Model model) {
|
||||
return "/administration/leaveApplyList";
|
||||
}
|
||||
|
||||
@RequestMapping("/getList.do")
|
||||
public ModelAndView getList(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "page") Integer page,
|
||||
@RequestParam(value = "rows") Integer rows,
|
||||
@RequestParam(value = "sort", required = false) String sort,
|
||||
@RequestParam(value = "order", required = false) String order) {
|
||||
if (sort == null || "id".equals(sort)) {
|
||||
sort = " insdt ";
|
||||
}
|
||||
if (order == null) {
|
||||
order = " desc ";
|
||||
}
|
||||
String wherestr = " where 1=1 ";
|
||||
if (request.getParameter("search_code") != null && !request.getParameter("search_code").isEmpty()) {
|
||||
wherestr += " and unit_id = '" + request.getParameter("search_code") + "'";
|
||||
}
|
||||
if (request.getParameter("search_name") != null && !request.getParameter("search_name").isEmpty()) {
|
||||
wherestr += " and (reason like '%" + request.getParameter("search_name") + "%' or insuser like '%" + request.getParameter("search_name") + "%')";
|
||||
}
|
||||
if (request.getParameter("applyType") != null && !request.getParameter("applyType").isEmpty()) {
|
||||
wherestr += " and apply_type = '" + request.getParameter("applyType") + "'";
|
||||
}
|
||||
PageHelper.startPage(page, rows);
|
||||
List<LeaveApply> list = this.leaveApplyService.selectListByWhere(wherestr + " order by " + sort + " " + order);
|
||||
PageInfo<LeaveApply> pInfo = new PageInfo<LeaveApply>(list);
|
||||
JSONArray jsonArray = JSONArray.fromObject(list);
|
||||
String result = "{\"total\":" + pInfo.getTotal() + ",\"rows\":" + jsonArray + "}";
|
||||
model.addAttribute("result", result);
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
@RequestMapping("/add.do")
|
||||
public String add(HttpServletRequest request, Model model) {
|
||||
return "/administration/leaveApplyAdd";
|
||||
}
|
||||
|
||||
@RequestMapping("/save.do")
|
||||
public String save(HttpServletRequest request, Model model, @ModelAttribute LeaveApply leaveApply) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
leaveApply.setId(CommUtil.getUUID());
|
||||
leaveApply.setInsdt(CommUtil.nowDate());
|
||||
leaveApply.setInsuser(cu.getId());
|
||||
leaveApply.setState(LeaveCommStr.STATE_DRAFT);
|
||||
leaveApply.setDelFlag("0");
|
||||
int result = this.leaveApplyService.save(leaveApply);
|
||||
String resultstr = "{\"res\":\"" + result + "\",\"id\":\"" + leaveApply.getId() + "\"}";
|
||||
model.addAttribute("result", resultstr);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/edit.do")
|
||||
public String edit(HttpServletRequest request, Model model, @RequestParam(value = "id") String id) {
|
||||
model.addAttribute("leaveApply", this.leaveApplyService.selectById(id));
|
||||
return "/administration/leaveApplyEdit";
|
||||
}
|
||||
|
||||
@RequestMapping("/update.do")
|
||||
public String update(HttpServletRequest request, Model model, @ModelAttribute LeaveApply leaveApply) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
leaveApply.setUpduser(cu.getId());
|
||||
leaveApply.setUpddt(CommUtil.nowDate());
|
||||
int result = this.leaveApplyService.update(leaveApply);
|
||||
String resstr = "{\"res\":\"" + result + "\",\"id\":\"" + leaveApply.getId() + "\"}";
|
||||
model.addAttribute("result", resstr);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/view.do")
|
||||
public String view(HttpServletRequest request, Model model, @RequestParam(value = "id") String id) {
|
||||
model.addAttribute("leaveApply", this.leaveApplyService.selectById(id));
|
||||
return "/administration/leaveApplyView";
|
||||
}
|
||||
|
||||
@RequestMapping("/delete.do")
|
||||
public String delete(HttpServletRequest request, Model model, @RequestParam(value = "id") String id) {
|
||||
int result = this.leaveApplyService.deleteById(id);
|
||||
model.addAttribute("result", result);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/deletes.do")
|
||||
public String deletes(HttpServletRequest request, Model model, @RequestParam(value = "ids") String ids) {
|
||||
ids = ids.replace(",", "','");
|
||||
int result = this.leaveApplyService.deleteByWhere("where id in ('" + ids + "')");
|
||||
model.addAttribute("result", result);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/startProcess.do")
|
||||
public String startProcess(HttpServletRequest request, Model model, @ModelAttribute LeaveApply leaveApply) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
if (leaveApply.getId() == null || leaveApply.getId().isEmpty()) {
|
||||
leaveApply.setId(CommUtil.getUUID());
|
||||
}
|
||||
leaveApply.setInsuser(cu.getId());
|
||||
leaveApply.setInsdt(CommUtil.nowDate());
|
||||
int result = this.leaveApplyService.doStartProcess(leaveApply);
|
||||
String resstr = "{\"res\":\"" + result + "\",\"id\":\"" + leaveApply.getId() + "\"}";
|
||||
model.addAttribute("result", resstr);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/showExecuteView.do")
|
||||
public String showExecuteView(HttpServletRequest request, Model model) {
|
||||
String id = request.getParameter("id");
|
||||
LeaveApply leaveApply = this.leaveApplyService.selectById(id);
|
||||
if (leaveApply == null) {
|
||||
model.addAttribute("businessUnitRecords", JSONArray.fromObject(new ArrayList<BusinessUnitRecord>()));
|
||||
model.addAttribute("finishFlag", false);
|
||||
model.addAttribute("processStarted", false);
|
||||
model.addAttribute("processMessage", "未找到对应的请假申请记录。");
|
||||
if (request.getParameter("inModal") != null) {
|
||||
return "administration/leaveApplyExecuteViewInModal";
|
||||
}
|
||||
return "administration/leaveApplyExecuteView";
|
||||
}
|
||||
request.setAttribute("business", leaveApply);
|
||||
List<BusinessUnitRecord> businessUnitRecords = new ArrayList<BusinessUnitRecord>();
|
||||
User launchUser = userService.getUserById(leaveApply.getInsuser());
|
||||
String recordUser = leaveApply.getAuditMan();
|
||||
BusinessUnitRecord businessUnitRecord = new BusinessUnitRecord(
|
||||
leaveApply.getInsdt(), leaveApply.getInsuser(), leaveApply.getId(), leaveApply.getProcessid(),
|
||||
leaveApply.getUnitId(), null, (recordUser == null || recordUser.trim().isEmpty() || "待签收".equals(recordUser))
|
||||
? "提交了请假补假申请,等待审批人签收。"
|
||||
: "提交了请假补假申请至" + recordUser + "进行审批。", launchUser, "流程发起");
|
||||
businessUnitRecords.add(businessUnitRecord);
|
||||
|
||||
boolean processStarted = leaveApply.getProcessdefid() != null && !leaveApply.getProcessdefid().trim().isEmpty();
|
||||
if (processStarted) {
|
||||
List<WorkTask> workTasks = workflowProcessDefinitionService.getAllPDTask(leaveApply.getProcessdefid(), "desc");
|
||||
List<String> keys = new ArrayList<String>();
|
||||
for (WorkTask workTask : workTasks) {
|
||||
keys.add(workTask.getTaskKey());
|
||||
}
|
||||
Set set = new HashSet();
|
||||
set.addAll(keys);
|
||||
keys = new ArrayList<String>();
|
||||
keys.addAll(set);
|
||||
for (String item : keys) {
|
||||
if (BusinessUnit.UNIT_LEAVE_APPLY_HANDLE.equals(item)) {
|
||||
List<BusinessUnitHandle> list = businessUnitHandleService.selectListByWhere("where businessid='" + id + "'");
|
||||
for (BusinessUnitHandle businessUnitHandle : list) {
|
||||
businessUnitRecord = new BusinessUnitRecord(businessUnitHandle);
|
||||
businessUnitRecords.add(businessUnitRecord);
|
||||
}
|
||||
} else if (BusinessUnit.UNIT_LEAVE_APPLY_SECTION_AUDIT.equals(item)
|
||||
|| BusinessUnit.UNIT_LEAVE_APPLY_MANAGER_AUDIT.equals(item)
|
||||
|| BusinessUnit.UNIT_LEAVE_APPLY_GENERAL_MANAGER_AUDIT.equals(item)) {
|
||||
List<BusinessUnitAudit> listAudit = businessUnitAuditService.selectListByWhere("where businessid='" + id + "'");
|
||||
for (BusinessUnitAudit businessUnitAudit : listAudit) {
|
||||
businessUnitRecord = new BusinessUnitRecord(businessUnitAudit);
|
||||
businessUnitRecords.add(businessUnitRecord);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (leaveApply.getProcessid() != null && !leaveApply.getProcessid().trim().isEmpty()) {
|
||||
List<HistoricTaskInstance> list = this.workflowService.getHistoryService().createHistoricTaskInstanceQuery()
|
||||
.processInstanceId(leaveApply.getProcessid()).list();
|
||||
for (HistoricTaskInstance task : list) {
|
||||
if (task.getAssignee() == null || task.getClaimTime() == null) {
|
||||
continue;
|
||||
}
|
||||
businessUnitRecord = new BusinessUnitRecord(task);
|
||||
businessUnitRecords.add(businessUnitRecord);
|
||||
}
|
||||
}
|
||||
Collections.sort(businessUnitRecords, new Comparator<BusinessUnitRecord>() {
|
||||
public int compare(BusinessUnitRecord o1, BusinessUnitRecord o2) {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
try {
|
||||
Date dt1 = df.parse(o1.getInsdt());
|
||||
Date dt2 = df.parse(o2.getInsdt());
|
||||
if (dt1.getTime() > dt2.getTime()) {
|
||||
return 1;
|
||||
} else if (dt1.getTime() < dt2.getTime()) {
|
||||
return -1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
model.addAttribute("businessUnitRecords", JSONArray.fromObject(businessUnitRecords));
|
||||
long num = 0L;
|
||||
if (leaveApply.getProcessid() != null && !leaveApply.getProcessid().trim().isEmpty()) {
|
||||
num = runtimeService.createProcessInstanceQuery().processInstanceId(leaveApply.getProcessid()).count();
|
||||
}
|
||||
model.addAttribute("finishFlag", processStarted && num <= 0);
|
||||
model.addAttribute("processStarted", processStarted);
|
||||
model.addAttribute("processMessage", processStarted ? "" : "当前请假单尚未发起审批流程,仅显示单据信息。");
|
||||
if (request.getParameter("inModal") != null) {
|
||||
return "administration/leaveApplyExecuteViewInModal";
|
||||
}
|
||||
return "administration/leaveApplyExecuteView";
|
||||
}
|
||||
|
||||
@RequestMapping("/showAudit.do")
|
||||
public String showAudit(HttpServletRequest request, Model model) {
|
||||
String taskId = request.getParameter("taskId");
|
||||
String processInstanceId = request.getParameter("processInstanceId");
|
||||
BusinessUnitAudit businessUnitAudit = new BusinessUnitAudit();
|
||||
|
||||
Task task = this.taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
model.addAttribute("taskName", task.getName());
|
||||
ProcessInstance pInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
|
||||
businessUnitAudit.setId(CommUtil.getUUID());
|
||||
businessUnitAudit.setProcessid(processInstanceId);
|
||||
businessUnitAudit.setTaskid(taskId);
|
||||
businessUnitAudit.setBusinessid(pInstance.getBusinessKey());
|
||||
businessUnitAudit.setTaskdefinitionkey(task.getTaskDefinitionKey());
|
||||
model.addAttribute("businessUnitAudit", businessUnitAudit);
|
||||
model.addAttribute("leaveApply", this.leaveApplyService.selectById(pInstance.getBusinessKey()));
|
||||
|
||||
List<ActivityImpl> activityImpls = workflowProcessDefinitionService.getNEXTActivities(task.getProcessDefinitionId(), task.getTaskDefinitionKey());
|
||||
model.addAttribute("showTargetUsersFlag", activityImpls.size() > 0);
|
||||
return "administration/leaveApplyAudit";
|
||||
}
|
||||
|
||||
@RequestMapping("/doAudit.do")
|
||||
public String doAudit(HttpServletRequest request, Model model, @ModelAttribute BusinessUnitAudit businessUnitAudit) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
businessUnitAudit.setInsuser(cu.getId());
|
||||
businessUnitAudit.setInsdt(CommUtil.nowDate());
|
||||
if (businessUnitAudit.getPassstatus() && (businessUnitAudit.getTargetusers() == null || businessUnitAudit.getTargetusers().trim().isEmpty())) {
|
||||
LeaveApply leaveApply = this.leaveApplyService.selectById(businessUnitAudit.getBusinessid());
|
||||
businessUnitAudit.setTargetusers(this.leaveApplyService.getDefaultCandidateUserIdsForNextTask(
|
||||
leaveApply, businessUnitAudit.getTaskdefinitionkey(), businessUnitAudit.getRouteNum(), true));
|
||||
}
|
||||
int result = this.leaveApplyService.doAuditProcess(businessUnitAudit);
|
||||
String resstr = "{\"res\":\"" + result + "\",\"id\":\"" + businessUnitAudit.getId() + "\"}";
|
||||
model.addAttribute("result", resstr);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/showHandle.do")
|
||||
public String showHandle(HttpServletRequest request, Model model) {
|
||||
String taskId = request.getParameter("taskId");
|
||||
String processInstanceId = request.getParameter("processInstanceId");
|
||||
String unitId = request.getParameter("unitId");
|
||||
BusinessUnitHandle businessUnitHandle = new BusinessUnitHandle();
|
||||
Task task = this.taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
model.addAttribute("taskName", task.getName());
|
||||
List<BusinessUnitHandle> businessUnitHandles = this.businessUnitHandleService.selectListByWhere("where processid='" + processInstanceId + "' and taskId='" + taskId + "'");
|
||||
if (businessUnitHandles != null && businessUnitHandles.size() > 0) {
|
||||
businessUnitHandle = businessUnitHandles.get(0);
|
||||
businessUnitHandle.setTaskid(taskId);
|
||||
} else {
|
||||
businessUnitHandle.setId(CommUtil.getUUID());
|
||||
businessUnitHandle.setProcessid(processInstanceId);
|
||||
businessUnitHandle.setTaskid(taskId);
|
||||
ProcessInstance pInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
businessUnitHandle.setBusinessid(pInstance.getBusinessKey());
|
||||
businessUnitHandle.setTaskdefinitionkey(task.getTaskDefinitionKey());
|
||||
businessUnitHandle.setUnitid(unitId);
|
||||
}
|
||||
String userIds = businessUnitHandle.getTargetusers();
|
||||
if (userIds != null && !userIds.isEmpty()) {
|
||||
List<User> users = userService.selectListByWhere("where id in('" + userIds.replace(",", "','") + "')");
|
||||
String targetUsersName = "";
|
||||
for (User user : users) {
|
||||
if (!targetUsersName.isEmpty()) {
|
||||
targetUsersName += ",";
|
||||
}
|
||||
targetUsersName += user.getCaption();
|
||||
}
|
||||
model.addAttribute("targetUsersName", targetUsersName);
|
||||
}
|
||||
model.addAttribute("businessUnitHandle", businessUnitHandle);
|
||||
LeaveApply leaveApply = this.leaveApplyService.selectById(businessUnitHandle.getBusinessid());
|
||||
model.addAttribute("leaveApply", leaveApply);
|
||||
List<BusinessUnitAudit> businessUnitAudits = this.businessUnitAuditService.selectListByWhere("where businessId = '" + leaveApply.getId() + "' order by insdt desc");
|
||||
String rejectReason = "";
|
||||
if (businessUnitAudits != null && businessUnitAudits.size() > 0) {
|
||||
rejectReason = businessUnitAudits.get(0).getAuditopinion();
|
||||
}
|
||||
model.addAttribute("rejectReason", rejectReason);
|
||||
ActivityImpl activityImpl = workflowProcessDefinitionService.getNEXTActivityImpl(task.getProcessDefinitionId(), task.getTaskDefinitionKey(), CommString.ACTI_Condition_PASS);
|
||||
model.addAttribute("showTargetUsersFlag", activityImpl != null && "userTask".equals(activityImpl.getProperties().get("type")));
|
||||
return "administration/leaveApplyHandle";
|
||||
}
|
||||
|
||||
@RequestMapping("/doHandle.do")
|
||||
public String doHandle(HttpServletRequest request, Model model,
|
||||
@ModelAttribute LeaveApply leaveApply,
|
||||
@ModelAttribute BusinessUnitHandle businessUnitHandle) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
int result = 0;
|
||||
leaveApply.setUpduser(cu.getId());
|
||||
leaveApply.setUpddt(CommUtil.nowDate());
|
||||
leaveApply.setState(LeaveCommStr.STATE_SECTION_AUDIT);
|
||||
result = this.leaveApplyService.update(leaveApply);
|
||||
if (result > 0) {
|
||||
String routeNum = request.getParameter("routeNum");
|
||||
businessUnitHandle.setStatus(BusinessUnitHandle.Status_FINISH);
|
||||
if (!this.businessUnitHandleService.checkExit(businessUnitHandle)) {
|
||||
businessUnitHandle.setInsuser(cu.getId());
|
||||
businessUnitHandle.setInsdt(CommUtil.nowDate());
|
||||
result = this.businessUnitHandleService.save(businessUnitHandle);
|
||||
} else {
|
||||
result = this.businessUnitHandleService.update(businessUnitHandle);
|
||||
}
|
||||
try {
|
||||
Map<String, Object> variables = new HashMap<String, Object>();
|
||||
variables = ActivitiUtil.fixVariableWithRoute(variables, true, routeNum);
|
||||
if (businessUnitHandle.getTargetusers() == null || businessUnitHandle.getTargetusers().trim().isEmpty()) {
|
||||
businessUnitHandle.setTargetusers(this.leaveApplyService.getDefaultCandidateUserIds(
|
||||
leaveApply, BusinessUnit.UNIT_LEAVE_APPLY_SECTION_AUDIT));
|
||||
}
|
||||
variables.put(CommString.ACTI_KEK_Candidate_Users, businessUnitHandle.getTargetusers());
|
||||
variables.put(CommString.ACTI_KEK_Assignee, null);
|
||||
taskService.complete(businessUnitHandle.getTaskid(), variables);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
String resstr = "{\"res\":\"" + result + "\",\"id\":\"" + leaveApply.getId() + "\"}";
|
||||
model.addAttribute("result", resstr);
|
||||
return "result";
|
||||
}
|
||||
|
||||
@RequestMapping("/getList4Mobile.do")
|
||||
public Result getList4Mobile(HttpServletRequest request, Model model) {
|
||||
String wherestr = "where 1=1 order by insdt desc";
|
||||
List<LeaveApply> list = this.leaveApplyService.selectListByWhere(wherestr);
|
||||
JSONArray json = JSONArray.fromObject(list);
|
||||
String res = "{\"total\":" + list.size() + ",\"rows\":" + json + "}";
|
||||
return Result.success(res);
|
||||
}
|
||||
}
|
||||
@ -369,7 +369,9 @@ public class AlarmPointController {
|
||||
this.mPointService.updateLalarmmin(alarmPoint.getUnitId(), mPoint.getMpointcode());
|
||||
// mPoint.setLalarmmin(null);
|
||||
}
|
||||
// this.mPointService.update2(alarmPoint.getUnitId(),mPoint);
|
||||
// Enable TriggerAlarm to allow ScadaAlarmJob to process this MPoint
|
||||
mPoint.setTriggeralarm("1");
|
||||
this.mPointService.update2(alarmPoint.getUnitId(), mPoint);
|
||||
}
|
||||
|
||||
if (code == Result.SUCCESS) {
|
||||
|
||||
@ -197,16 +197,15 @@ public class ProAlarmController {
|
||||
// Iterator<String> sIterator = jsonObject.keys();
|
||||
|
||||
JSONArray arr = new JSONArray();
|
||||
List<XServer> allxServerList = this.xServerService.selectListByWhere(" where 1=1 ");
|
||||
for (XServer xServer :
|
||||
allxServerList) {
|
||||
// List<XServer> allxServerList = this.xServerService.selectListByWhere(" where 1=1 ");
|
||||
// for (XServer xServer : allxServerList) {
|
||||
// if (jsonObject.get(xServer.getBizid()) != null) {
|
||||
// String code_value = jsonObject.get(xServer.getBizid()).toString();
|
||||
// code_value = code_value + ",data_stop_alarm";
|
||||
// code_value = code_value.replace(",", "','");
|
||||
// List<ProAlarm> list = this.proAlarmService.selectListByWhere(xServer.getBizid(), wherestr + " and point_code in ('" + code_value + "')"
|
||||
// + orderstr);
|
||||
List<ProAlarm> list = this.proAlarmService.selectListByWhere(xServer.getBizid(), wherestr + orderstr);
|
||||
List<ProAlarm> list = this.proAlarmService.selectListByWhere(companyId, wherestr + orderstr);
|
||||
// System.out.println(wherestr + " and point_code in ('" + code_value + "')");
|
||||
if (list != null && list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
@ -249,7 +248,7 @@ public class ProAlarmController {
|
||||
}
|
||||
// }
|
||||
|
||||
}
|
||||
// }
|
||||
model.addAttribute("result", arr);
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
@ -47,14 +47,11 @@ public class BusinessUnitController {
|
||||
@RequestParam(value = "order", required=false) String order) {
|
||||
HttpSession currentSession = request.getSession(false);
|
||||
User cu=(User)request.getSession().getAttribute("cu");
|
||||
// if(cu==null){
|
||||
// cu=loginService.Login(request.getParameter("username"), request.getParameter("pwd"));
|
||||
// }
|
||||
if(sort==null){
|
||||
sort = " insdt ";
|
||||
}
|
||||
if(order==null){
|
||||
order = " asc ";
|
||||
order = " desc ";
|
||||
}
|
||||
String orderstr=" order by "+sort+" "+order;
|
||||
|
||||
@ -65,6 +62,9 @@ public class BusinessUnitController {
|
||||
if(request.getParameter("search_name")!=null && !request.getParameter("search_name").isEmpty()){
|
||||
wherestr += " and name like '%"+request.getParameter("search_name")+"%' ";
|
||||
}
|
||||
if(request.getParameter("search_processType")!=null && !request.getParameter("search_processType").isEmpty()){
|
||||
wherestr += " and process_type_id = '"+request.getParameter("search_processType")+"' ";
|
||||
}
|
||||
PageHelper.startPage(page, rows);
|
||||
List<BusinessUnit> list = this.businessUnitService.selectListByWhere(wherestr+orderstr);
|
||||
|
||||
@ -72,7 +72,6 @@ public class BusinessUnitController {
|
||||
JSONArray json=JSONArray.fromObject(list);
|
||||
|
||||
String result="{\"total\":"+pi.getTotal()+",\"rows\":"+json+"}";
|
||||
// System.out.println(result);
|
||||
model.addAttribute("result",result);
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
@ -327,13 +327,13 @@ public class DataController {
|
||||
fileIds = fileIds.replace(",","','");
|
||||
wherestr += " and (id in ('"+fileIds+"') or filename like '%"+fileName+"%') ";
|
||||
}
|
||||
if(request.getParameter("masterId")!=null && !request.getParameter("masterId").isEmpty()){
|
||||
String masterId = request.getParameter("masterId");
|
||||
masterId = masterId.replace(",","','");
|
||||
wherestr += " and masterid in ('"+masterId+"')";
|
||||
}else if(request.getParameter("equipmentId") == null){
|
||||
wherestr += " and masterid in ('')";
|
||||
}
|
||||
// if(request.getParameter("masterId")!=null && !request.getParameter("masterId").isEmpty()){
|
||||
// String masterId = request.getParameter("masterId");
|
||||
// masterId = masterId.replace(",","','");
|
||||
// wherestr += " and masterid in ('"+masterId+"')";
|
||||
// }else if(request.getParameter("equipmentId") == null){
|
||||
// wherestr += " and masterid in ('')";
|
||||
// }
|
||||
if(request.getParameter("equipmentId")!=null && !request.getParameter("equipmentId").isEmpty()){
|
||||
String fileIds = this.equipmentFileService.getFileIds(request.getParameter("equipmentId"));
|
||||
fileIds = fileIds.replace(",","','");
|
||||
|
||||
@ -1894,7 +1894,12 @@ public class EquipmentCardController {
|
||||
|
||||
//一些地方请求传参不一样 有pSectionId和processSectionId
|
||||
if (request.getParameter("pSectionId") != null && !request.getParameter("pSectionId").isEmpty()) {
|
||||
List<ProcessSection> list = processSectionService.selectListByWhere("where code = '" + request.getParameter("pSectionId") + "' and unit_id = '" + request.getParameter("unitId") + "'");
|
||||
// 优先使用unitId,如果没有则使用companyId作为fallback
|
||||
String unitIdParam = request.getParameter("unitId");
|
||||
if (unitIdParam == null || unitIdParam.isEmpty()) {
|
||||
unitIdParam = request.getParameter("companyId");
|
||||
}
|
||||
List<ProcessSection> list = processSectionService.selectListByWhere("where code = '" + request.getParameter("pSectionId") + "' and unit_id = '" + unitIdParam + "'");
|
||||
if (list != null && list.size() > 0) {
|
||||
wherestr += " and processSectionId = '" + list.get(0).getId() + "' ";
|
||||
}
|
||||
@ -5691,6 +5696,14 @@ public class EquipmentCardController {
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
// ├── Water Plant (水厂)
|
||||
//│ ├── Process Section A (工艺段) ← Previously lost
|
||||
//│ ├── Process Section B (工艺段) ← Previously lost
|
||||
//│ ├── Pump Station 1 (泵站) ← Was overwriting above
|
||||
//│ │ ├── Process Section C (工艺段)
|
||||
//│ │ └── Process Section D (工艺段)
|
||||
//│ └── Pump Station 2 (泵站)
|
||||
// │ └── Process Section E (工艺段)
|
||||
@RequestMapping("/getProcessSection4EquipmentCardTree.do")
|
||||
public String getProcessSection4EquipmentCardTree(HttpServletRequest request, Model model) {
|
||||
String unitId = request.getParameter("unitId");
|
||||
|
||||
@ -37,6 +37,7 @@ import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.impl.pvm.process.ActivityImpl;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.ui.Model;
|
||||
@ -356,7 +357,9 @@ public class MaintenancePlanController {
|
||||
model.addAttribute("nowDate", CommUtil.nowDate());
|
||||
String maintenancePlanId = pInstance.getBusinessKey();
|
||||
List<BusinessUnitAudit> list = this.businessUnitAuditService.selectListByWhere("where businessId = '" + maintenancePlanId + "' order by insdt desc ");
|
||||
model.addAttribute("businessUnitAudit", list.get(0));
|
||||
if (CollectionUtils.isNotEmpty(list)){
|
||||
model.addAttribute("businessUnitAudit", list.get(0));
|
||||
}
|
||||
MaintenancePlan maintenancePlan = this.maintenancePlanService.selectById(maintenancePlanId);
|
||||
model.addAttribute("maintenancePlan", maintenancePlan);
|
||||
EquipmentPlan equipmentPlan = this.equipmentPlanService.selectById(maintenancePlanId);
|
||||
|
||||
@ -279,10 +279,8 @@ public class EquipmentPlanController {
|
||||
if (company != null) {
|
||||
model.addAttribute("companyName", company.getSname());
|
||||
}
|
||||
User user = userService.getUserById(equipmentPlan.getAuditId());
|
||||
if (user != null) {
|
||||
model.addAttribute("userName", user.getCaption());
|
||||
}
|
||||
String userNames = userService.getUserNamesByUserIds(equipmentPlan.getAuditId());
|
||||
model.addAttribute("userName", userNames);
|
||||
EquipmentPlanType equipmentPlanType_big = equipmentPlanTypeService.selectById(equipmentPlan.getPlanTypeBig());
|
||||
if (equipmentPlanType_big != null) {
|
||||
model.addAttribute("planTypeBigName", equipmentPlanType_big.getName());
|
||||
@ -308,10 +306,8 @@ public class EquipmentPlanController {
|
||||
if (company != null) {
|
||||
model.addAttribute("companyName", company.getSname());
|
||||
}
|
||||
User user = userService.getUserById(equipmentPlan.getAuditId());
|
||||
if (user != null) {
|
||||
model.addAttribute("userName", user.getCaption());
|
||||
}
|
||||
String userNames = userService.getUserNamesByUserIds(equipmentPlan.getAuditId());
|
||||
model.addAttribute("userName", userNames);
|
||||
EquipmentPlanType equipmentPlanType_big = equipmentPlanTypeService.selectById(equipmentPlan.getPlanTypeBig());
|
||||
if (equipmentPlanType_big != null) {
|
||||
model.addAttribute("planTypeBigName", equipmentPlanType_big.getName());
|
||||
@ -422,10 +418,8 @@ public class EquipmentPlanController {
|
||||
if (company != null) {
|
||||
model.addAttribute("companyName", company.getSname());
|
||||
}
|
||||
User user = userService.getUserById(equipmentPlan.getAuditId());
|
||||
if (user != null) {
|
||||
model.addAttribute("userName", user.getCaption());
|
||||
}
|
||||
String userNames = userService.getUserNamesByUserIds(equipmentPlan.getAuditId());
|
||||
model.addAttribute("userName", userNames);
|
||||
EquipmentPlanType equipmentPlanType_big = equipmentPlanTypeService.selectById(equipmentPlan.getPlanTypeBig());
|
||||
if (equipmentPlanType_big != null) {
|
||||
model.addAttribute("planTypeBigName", equipmentPlanType_big.getName());
|
||||
|
||||
@ -165,7 +165,8 @@ public class EquipmentPlanTypeController {
|
||||
String id = request.getParameter("id");
|
||||
EquipmentPlanType equipmentPlanType = this.equipmentPlanTypeService.selectById(id);
|
||||
model.addAttribute("equipmentPlanType", equipmentPlanType);
|
||||
return "maintenance/equipmentPlanTypeView";
|
||||
// Return edit page so user can view parent and manage child records
|
||||
return "maintenance/equipmentPlanTypeEdit";
|
||||
}
|
||||
/**
|
||||
* 打开编辑界面
|
||||
@ -235,6 +236,12 @@ public class EquipmentPlanTypeController {
|
||||
|
||||
/**
|
||||
* 根据code获取类型下拉数据
|
||||
* 支持多种数据结构:
|
||||
* 1. 标准结构:code='wx'的父记录 -> 返回其子记录
|
||||
* 2. 简化结构:code='wx'的父记录无子记录 -> 返回该父记录本身
|
||||
* 3. 子记录结构:无code='wx'父记录但有type='0'的子记录 -> 返回这些子记录
|
||||
* 4. 扁平结构:只有type='0'的记录(无论pid) -> 返回这些记录
|
||||
* 5. 最终兜底:返回所有相关类型的记录
|
||||
* @param request
|
||||
* @param model
|
||||
* @return
|
||||
@ -242,31 +249,98 @@ public class EquipmentPlanTypeController {
|
||||
@RequestMapping("/getSelectList4Code.do")
|
||||
public String getSelectList4Code(HttpServletRequest request,Model model){
|
||||
String code = request.getParameter("code");
|
||||
String wherestr = "where 1=1 ";
|
||||
String pid = "";
|
||||
|
||||
EquipmentPlanType equipmentPlanType = equipmentPlanTypeService.selectByWhere("where code = '"+code+"' ");
|
||||
if(equipmentPlanType!=null){
|
||||
pid = equipmentPlanType.getId();//获取大类id
|
||||
}
|
||||
|
||||
if(pid!=null && !pid.equals("")){
|
||||
wherestr += " and pid = '"+pid+"'";
|
||||
}else {
|
||||
wherestr += " and pid = '-1'";
|
||||
}
|
||||
|
||||
List<EquipmentPlanType> list = this.equipmentPlanTypeService.selectListByWhere(wherestr+"order by morder asc");
|
||||
JSONArray json = new JSONArray();
|
||||
if(list!=null && list.size()>0){
|
||||
for(int i=0;i<list.size();i++){
|
||||
JSONObject jsonObject =new JSONObject();
|
||||
jsonObject.put("id", list.get(i).getId());
|
||||
jsonObject.put("text", list.get(i).getName());
|
||||
|
||||
if(code == null || code.isEmpty()){
|
||||
model.addAttribute("result", json.toString());
|
||||
return "result";
|
||||
}
|
||||
|
||||
String typeValue = getTypeValueByCode(code);
|
||||
|
||||
// Step 1: Try to find parent record by code
|
||||
EquipmentPlanType parentType = equipmentPlanTypeService.selectByWhere("where code = '"+code+"' ");
|
||||
|
||||
if(parentType != null){
|
||||
// Parent found, try to get children
|
||||
String pid = parentType.getId();
|
||||
List<EquipmentPlanType> list = this.equipmentPlanTypeService.selectListByWhere("where pid = '"+pid+"' order by morder asc");
|
||||
|
||||
if(list != null && list.size() > 0){
|
||||
// Standard case: return children
|
||||
for(int i = 0; i < list.size(); i++){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", list.get(i).getId());
|
||||
jsonObject.put("text", list.get(i).getName());
|
||||
json.add(jsonObject);
|
||||
}
|
||||
} else {
|
||||
// No children, return parent itself as the only option
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", parentType.getId());
|
||||
jsonObject.put("text", parentType.getName());
|
||||
json.add(jsonObject);
|
||||
}
|
||||
} else if(typeValue != null){
|
||||
// Step 2: No parent with code, try multiple fallback strategies
|
||||
|
||||
// 2a: First try child records with specific type (pid != '-1')
|
||||
List<EquipmentPlanType> list = this.equipmentPlanTypeService.selectListByWhere(
|
||||
"where type = '"+typeValue+"' and pid != '-1' order by morder asc");
|
||||
|
||||
if(list != null && list.size() > 0){
|
||||
for(int i = 0; i < list.size(); i++){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", list.get(i).getId());
|
||||
jsonObject.put("text", list.get(i).getName());
|
||||
json.add(jsonObject);
|
||||
}
|
||||
} else {
|
||||
// 2b: Try all records with specific type (including root records with pid='-1')
|
||||
list = this.equipmentPlanTypeService.selectListByWhere(
|
||||
"where type = '"+typeValue+"' order by morder asc");
|
||||
|
||||
if(list != null && list.size() > 0){
|
||||
for(int i = 0; i < list.size(); i++){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", list.get(i).getId());
|
||||
jsonObject.put("text", list.get(i).getName());
|
||||
json.add(jsonObject);
|
||||
}
|
||||
} else {
|
||||
// 2c: Final fallback - return all root records (pid='-1')
|
||||
// This handles the case where user added parent records without setting type
|
||||
list = this.equipmentPlanTypeService.selectListByWhere(
|
||||
"where pid = '-1' order by morder asc");
|
||||
if(list != null && list.size() > 0){
|
||||
for(int i = 0; i < list.size(); i++){
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", list.get(i).getId());
|
||||
jsonObject.put("text", list.get(i).getName());
|
||||
json.add(jsonObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
model.addAttribute("result", json.toString());
|
||||
return "result";
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取对应的type值
|
||||
* @param code
|
||||
* @return type值
|
||||
*/
|
||||
private String getTypeValueByCode(String code){
|
||||
if(EquipmentPlanType.Code_Type_Wx.equals(code)){
|
||||
return EquipmentPlanType.Type_Wx; // "0"
|
||||
} else if(EquipmentPlanType.Code_Type_By.equals(code)){
|
||||
return EquipmentPlanType.Type_Ty; // "1"
|
||||
} else if(EquipmentPlanType.Code_Type_Dx.equals(code)){
|
||||
return EquipmentPlanType.Type_Dx; // "5"
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import com.sipai.service.business.BusinessUnitAuditService;
|
||||
import com.sipai.service.business.BusinessUnitHandleService;
|
||||
import com.sipai.service.maintenance.RepairService;
|
||||
import com.sipai.service.user.UnitService;
|
||||
import com.sipai.service.user.UserService;
|
||||
import com.sipai.tools.ActivitiUtil;
|
||||
import com.sipai.tools.CommString;
|
||||
import com.sipai.tools.CommUtil;
|
||||
@ -59,6 +60,8 @@ public class RepairController {
|
||||
private BusinessUnitAuditService businessUnitAuditService;
|
||||
@Resource
|
||||
private UnitService unitService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
|
||||
@RequestMapping("/showlist.do")
|
||||
public String showCollection(HttpServletRequest request,Model model) {
|
||||
@ -124,6 +127,16 @@ public class RepairController {
|
||||
@RequestParam(value="id") String id){
|
||||
Repair repair = this.repairService.selectById(id);
|
||||
if(repair!=null){
|
||||
// 获取接收人姓名
|
||||
if(repair.getReceiveUserId() != null && !repair.getReceiveUserId().isEmpty()){
|
||||
String receiveUserName = userService.getUserNamesByUserIds(repair.getReceiveUserId());
|
||||
repair.setReceiveUserName(receiveUserName);
|
||||
}
|
||||
// 获取接收人们姓名
|
||||
if(repair.getReceiveUserIds() != null && !repair.getReceiveUserIds().isEmpty()){
|
||||
String receiveUsersName = userService.getUserNamesByUserIds(repair.getReceiveUserIds());
|
||||
repair.setReceiveUsersName(receiveUsersName);
|
||||
}
|
||||
model.addAttribute("repair",repair);
|
||||
}
|
||||
return "maintenance/repairView";
|
||||
|
||||
@ -0,0 +1,392 @@
|
||||
package com.sipai.controller.mpoint;
|
||||
|
||||
import com.sipai.entity.scada.MPointData;
|
||||
import com.sipai.service.scada.MPointDataService;
|
||||
import com.sipai.tools.CommString;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.redisson.api.RMapCache;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 测点数据控制器
|
||||
* 提供测点数据统计接口,支持动态表名查询
|
||||
* 表名规则:tb_mp_{mPointKey}
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/mpoint/data")
|
||||
public class MPointDataController {
|
||||
|
||||
@Resource
|
||||
private RedissonClient redissonClient;
|
||||
@Resource
|
||||
private MPointDataService mPointDataService;
|
||||
|
||||
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@RequestMapping("/getCurrentValue.do")
|
||||
public ModelAndView getStatistics(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "mPointKey") String mPointKey) {
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
// 参数校验
|
||||
if (mPointKey == null || mPointKey.trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "mPointKey参数不能为空");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
// 获取最新数据(当前值)
|
||||
int num = mPointKey.hashCode() % 25;
|
||||
RMapCache<String, String> map_redis_data = redissonClient.getMapCache(CommString.RedisMpointFlag + num);
|
||||
if (map_redis_data.get(mPointKey) != null && !"".equals(map_redis_data.get(mPointKey))) {
|
||||
String[] str = map_redis_data.get(mPointKey).split(";");
|
||||
if (str.length >= 3 && str[1] != null && !str[1].isEmpty() && !"null".equals(str[1])) {
|
||||
result.put("currentValue", formatAmount(new BigDecimal(str[1])));
|
||||
result.put("currentMeasureTime", str[2]);
|
||||
} else {
|
||||
result.put("currentValue", BigDecimal.ZERO);
|
||||
result.put("currentMeasureTime", null);
|
||||
}
|
||||
}
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取测点统计数据
|
||||
*
|
||||
* @param mPointKey 测点编码(如:DO1),必填
|
||||
* @param companyKey 公司编码(可选),用于筛选userid字段
|
||||
* @param startTimeStr 开始时间(可选),格式:yyyy-MM-dd HH:mm:ss
|
||||
* @param endTimeStr 结束时间(可选),格式:yyyy-MM-dd HH:mm:ss
|
||||
* @return 统计数据JSON
|
||||
* <p>
|
||||
* 返回内容:
|
||||
* - currentValue: 当前值(最新一条数据)
|
||||
* - currentMeasureTime: 当前值的测量时间
|
||||
* - avgValue: 平均值
|
||||
* - maxValue: 最高值
|
||||
* - minValue: 最低值
|
||||
* - totalCount: 数据总条数
|
||||
* <p>
|
||||
* 示例请求:/mpoint/data/getStatistics.do?mPointKey=DO1&companyKey=DEV022&startTime=2026-03-01 00:00:00&endTime=2026-03-08 23:59:59
|
||||
*/
|
||||
@RequestMapping("/getStatistics.do")
|
||||
public ModelAndView getStatistics(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "mPointKey") String mPointKey,
|
||||
@RequestParam(value = "companyKey", required = false) String companyKey,
|
||||
@RequestParam(value = "startTime", required = false) String startTimeStr,
|
||||
@RequestParam(value = "endTime", required = false) String endTimeStr) {
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
try {
|
||||
// 参数校验
|
||||
if (mPointKey == null || mPointKey.trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "mPointKey参数不能为空");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
mPointKey = mPointKey.trim();
|
||||
if (companyKey != null) {
|
||||
companyKey = companyKey.trim();
|
||||
}
|
||||
|
||||
// 解析时间参数
|
||||
Date startTime = null;
|
||||
Date endTime = null;
|
||||
|
||||
if (startTimeStr != null && !startTimeStr.trim().isEmpty()) {
|
||||
try {
|
||||
startTime = DATE_FORMAT.parse(startTimeStr.trim());
|
||||
} catch (ParseException e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "startTime格式错误,正确格式:yyyy-MM-dd HH:mm:ss");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
}
|
||||
|
||||
if (endTimeStr != null && !endTimeStr.trim().isEmpty()) {
|
||||
try {
|
||||
endTime = DATE_FORMAT.parse(endTimeStr.trim());
|
||||
} catch (ParseException e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "endTime格式错误,正确格式:yyyy-MM-dd HH:mm:ss");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
}
|
||||
|
||||
// 检查时间范围有效性
|
||||
if (startTime != null && endTime != null && startTime.after(endTime)) {
|
||||
result.put("success", false);
|
||||
result.put("message", "开始时间不能晚于结束时间");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
// 检查表是否存在
|
||||
if (!mPointDataService.checkTableExists(mPointKey)) {
|
||||
result.put("success", false);
|
||||
result.put("message", "未找到测点[" + mPointKey + "]对应的数据表");
|
||||
result.put("tableName", mPointDataService.buildTableName(mPointKey));
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
// 获取最新数据(当前值)
|
||||
MPointData latestData = mPointDataService.getLatestData(mPointKey, companyKey, startTime, endTime);
|
||||
if (latestData != null) {
|
||||
result.put("currentValue", formatAmount(latestData.getParmValue()));
|
||||
result.put("currentMeasureTime", formatDate(latestData.getMeasureDt()));
|
||||
} else {
|
||||
result.put("currentValue", null);
|
||||
result.put("currentMeasureTime", null);
|
||||
}
|
||||
|
||||
// 获取统计数据
|
||||
Map<String, Object> stats = mPointDataService.getStatistics(mPointKey, companyKey, startTime, endTime);
|
||||
|
||||
if (stats != null) {
|
||||
Object avgObj = stats.get("avgValue");
|
||||
Object maxObj = stats.get("maxValue");
|
||||
Object minObj = stats.get("minValue");
|
||||
Object countObj = stats.get("totalCount");
|
||||
|
||||
if (avgObj instanceof BigDecimal) {
|
||||
result.put("avgValue", formatAmount((BigDecimal) avgObj));
|
||||
} else if (avgObj instanceof Number) {
|
||||
result.put("avgValue", formatAmount(new BigDecimal(avgObj.toString())));
|
||||
} else {
|
||||
result.put("avgValue", "0.00");
|
||||
}
|
||||
|
||||
if (maxObj instanceof BigDecimal) {
|
||||
result.put("maxValue", formatAmount((BigDecimal) maxObj));
|
||||
} else if (maxObj instanceof Number) {
|
||||
result.put("maxValue", formatAmount(new BigDecimal(maxObj.toString())));
|
||||
} else {
|
||||
result.put("maxValue", "0.00");
|
||||
}
|
||||
|
||||
if (minObj instanceof BigDecimal) {
|
||||
result.put("minValue", formatAmount((BigDecimal) minObj));
|
||||
} else if (minObj instanceof Number) {
|
||||
result.put("minValue", formatAmount(new BigDecimal(minObj.toString())));
|
||||
} else {
|
||||
result.put("minValue", "0.00");
|
||||
}
|
||||
|
||||
if (countObj instanceof Number) {
|
||||
result.put("totalCount", ((Number) countObj).intValue());
|
||||
} else {
|
||||
result.put("totalCount", 0);
|
||||
}
|
||||
} else {
|
||||
result.put("avgValue", "0.00");
|
||||
result.put("maxValue", "0.00");
|
||||
result.put("minValue", "0.00");
|
||||
result.put("totalCount", 0);
|
||||
}
|
||||
|
||||
result.put("success", true);
|
||||
result.put("mPointKey", mPointKey);
|
||||
result.put("tableName", mPointDataService.buildTableName(mPointKey));
|
||||
if (companyKey != null && !companyKey.isEmpty()) {
|
||||
result.put("companyKey", companyKey);
|
||||
}
|
||||
if (startTime != null) {
|
||||
result.put("startTime", formatDate(startTime));
|
||||
}
|
||||
if (endTime != null) {
|
||||
result.put("endTime", formatDate(endTime));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "获取统计数据失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取测点每日汇总数据
|
||||
*
|
||||
* @param mPointKey 测点编码(如:DO1),必填
|
||||
* @param startTimeStr 开始时间,格式:yyyy-MM-dd HH:mm:ss
|
||||
* @param endTimeStr 结束时间,格式:yyyy-MM-dd HH:mm:ss
|
||||
* @return 每日汇总数据JSON
|
||||
* <p>
|
||||
* 返回内容:
|
||||
* - dailyData: 每日汇总数组
|
||||
* - dateStr: 日期(yyyy-MM-dd)
|
||||
* - totalValue: 当日ParamValue汇总值
|
||||
* - dataCount: 当日数据条数
|
||||
* - grandTotal: 总汇总值
|
||||
* - totalDays: 总天数
|
||||
* <p>
|
||||
* 示例请求:/mpoint/data/getDailyAggregation.do?mPointKey=DO1&startTime=2026-03-01 00:00:00&endTime=2026-03-08 23:59:59
|
||||
*/
|
||||
@RequestMapping("/getDailyAggregation.do")
|
||||
public ModelAndView getDailyAggregation(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "mPointKey") String mPointKey,
|
||||
@RequestParam(value = "startTime") String startTimeStr,
|
||||
@RequestParam(value = "endTime") String endTimeStr) {
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
try {
|
||||
// 参数校验
|
||||
if (mPointKey == null || mPointKey.trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "mPointKey参数不能为空");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
if (startTimeStr == null || startTimeStr.trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "startTime参数不能为空");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
if (endTimeStr == null || endTimeStr.trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "endTime参数不能为空");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
mPointKey = mPointKey.trim();
|
||||
|
||||
// 解析时间参数
|
||||
Date startTime;
|
||||
Date endTime;
|
||||
|
||||
try {
|
||||
startTime = DATE_FORMAT.parse(startTimeStr.trim());
|
||||
} catch (ParseException e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "startTime格式错误,正确格式:yyyy-MM-dd HH:mm:ss");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
try {
|
||||
endTime = DATE_FORMAT.parse(endTimeStr.trim());
|
||||
} catch (ParseException e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "endTime格式错误,正确格式:yyyy-MM-dd HH:mm:ss");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
// 检查时间范围有效性
|
||||
if (startTime.after(endTime)) {
|
||||
result.put("success", false);
|
||||
result.put("message", "开始时间不能晚于结束时间");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
// 检查表是否存在
|
||||
if (!mPointDataService.checkTableExists(mPointKey)) {
|
||||
result.put("success", false);
|
||||
result.put("message", "未找到测点[" + mPointKey + "]对应的数据表");
|
||||
result.put("tableName", mPointDataService.buildTableName(mPointKey));
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
// 获取每日汇总数据
|
||||
List<Map<String, Object>> dailyList = mPointDataService.getDailyAggregation(mPointKey, startTime, endTime);
|
||||
|
||||
JSONArray dailyData = new JSONArray();
|
||||
BigDecimal grandTotal = BigDecimal.ZERO;
|
||||
int totalDays = 0;
|
||||
|
||||
if (dailyList != null && !dailyList.isEmpty()) {
|
||||
for (Map<String, Object> dayItem : dailyList) {
|
||||
JSONObject dayObj = new JSONObject();
|
||||
dayObj.put("dateStr", dayItem.get("dateStr"));
|
||||
dayObj.put("dataCount", dayItem.get("dataCount"));
|
||||
|
||||
Object totalValueObj = dayItem.get("totalValue");
|
||||
BigDecimal dayTotal;
|
||||
if (totalValueObj instanceof BigDecimal) {
|
||||
dayTotal = (BigDecimal) totalValueObj;
|
||||
} else if (totalValueObj instanceof Number) {
|
||||
dayTotal = new BigDecimal(totalValueObj.toString());
|
||||
} else {
|
||||
dayTotal = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
dayObj.put("totalValue", formatAmount(dayTotal));
|
||||
dailyData.add(dayObj);
|
||||
|
||||
grandTotal = grandTotal.add(dayTotal);
|
||||
totalDays++;
|
||||
}
|
||||
}
|
||||
|
||||
result.put("success", true);
|
||||
result.put("mPointKey", mPointKey);
|
||||
result.put("tableName", mPointDataService.buildTableName(mPointKey));
|
||||
result.put("startTime", formatDate(startTime));
|
||||
result.put("endTime", formatDate(endTime));
|
||||
result.put("dailyData", dailyData);
|
||||
result.put("grandTotal", formatAmount(grandTotal));
|
||||
result.put("totalDays", totalDays);
|
||||
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "获取每日汇总数据失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化数值,保留2位小数
|
||||
*/
|
||||
private String formatAmount(BigDecimal amount) {
|
||||
if (amount == null) {
|
||||
return "0.00";
|
||||
}
|
||||
return amount.setScale(2, RoundingMode.HALF_UP).toPlainString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化日期
|
||||
*/
|
||||
private String formatDate(Date date) {
|
||||
if (date == null) {
|
||||
return null;
|
||||
}
|
||||
return DATE_FORMAT.format(date);
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@ import com.sipai.entity.user.User;
|
||||
import com.sipai.service.pipeline.PipelineDataService;
|
||||
import com.sipai.tools.CommUtil;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
@ -16,7 +17,9 @@ import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/pipeline/pipelineData")
|
||||
@ -47,6 +50,43 @@ public class PipelineDataController {
|
||||
if (request.getParameter("search_name") != null && !request.getParameter("search_name").isEmpty()) {
|
||||
wherestr += " and pipeline_name like '%" + request.getParameter("search_name") + "%'";
|
||||
}
|
||||
if (request.getParameter("search_pipeline_area") != null && !request.getParameter("search_pipeline_area").isEmpty()) {
|
||||
wherestr += " and pipeline_area = '" + request.getParameter("search_pipeline_area") + "'";
|
||||
}
|
||||
if (request.getParameter("search_pipe_material") != null && !request.getParameter("search_pipe_material").isEmpty()) {
|
||||
wherestr += " and pipe_material like '%" + request.getParameter("search_pipe_material") + "%'";
|
||||
}
|
||||
if (request.getParameter("search_associated_plant") != null && !request.getParameter("search_associated_plant").isEmpty()) {
|
||||
wherestr += " and associated_plant = '" + request.getParameter("search_associated_plant") + "'";
|
||||
}
|
||||
// 管道管径查询(支持范围或精确匹配)
|
||||
if (request.getParameter("search_diameter_min") != null && !request.getParameter("search_diameter_min").isEmpty()) {
|
||||
wherestr += " and diameter_mm >= " + request.getParameter("search_diameter_min");
|
||||
}
|
||||
if (request.getParameter("search_diameter_max") != null && !request.getParameter("search_diameter_max").isEmpty()) {
|
||||
wherestr += " and diameter_mm <= " + request.getParameter("search_diameter_max");
|
||||
}
|
||||
// 管道管长查询(支持范围)
|
||||
if (request.getParameter("search_length_min") != null && !request.getParameter("search_length_min").isEmpty()) {
|
||||
wherestr += " and length_m >= " + request.getParameter("search_length_min");
|
||||
}
|
||||
if (request.getParameter("search_length_max") != null && !request.getParameter("search_length_max").isEmpty()) {
|
||||
wherestr += " and length_m <= " + request.getParameter("search_length_max");
|
||||
}
|
||||
// 起点埋深查询(支持范围)
|
||||
if (request.getParameter("search_start_depth_min") != null && !request.getParameter("search_start_depth_min").isEmpty()) {
|
||||
wherestr += " and start_burial_depth_m >= " + request.getParameter("search_start_depth_min");
|
||||
}
|
||||
if (request.getParameter("search_start_depth_max") != null && !request.getParameter("search_start_depth_max").isEmpty()) {
|
||||
wherestr += " and start_burial_depth_m <= " + request.getParameter("search_start_depth_max");
|
||||
}
|
||||
// 终点埋深查询(支持范围)
|
||||
if (request.getParameter("search_end_depth_min") != null && !request.getParameter("search_end_depth_min").isEmpty()) {
|
||||
wherestr += " and end_burial_depth_m >= " + request.getParameter("search_end_depth_min");
|
||||
}
|
||||
if (request.getParameter("search_end_depth_max") != null && !request.getParameter("search_end_depth_max").isEmpty()) {
|
||||
wherestr += " and end_burial_depth_m <= " + request.getParameter("search_end_depth_max");
|
||||
}
|
||||
PageHelper.startPage(page, rows);
|
||||
List<PipelineData> list = this.pipelineDataService.selectListByWhere(wherestr + orderstr);
|
||||
PageInfo<PipelineData> pInfo = new PageInfo<PipelineData>(list);
|
||||
@ -83,7 +123,9 @@ public class PipelineDataController {
|
||||
@RequestMapping("/deletes.do")
|
||||
public String dodeletes(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "ids") String ids) {
|
||||
int result = this.pipelineDataService.deleteByWhere("where id in (" + ids + ")");
|
||||
// 移除末尾逗号,防止SQL语法错误
|
||||
String cleanIds = ids.replaceAll("[,\\s]+$", "").replaceAll("^[,\\s]+", "");
|
||||
int result = this.pipelineDataService.deleteByWhere("where id in (" + cleanIds + ")");
|
||||
model.addAttribute("result", result);
|
||||
return "result";
|
||||
}
|
||||
@ -113,4 +155,153 @@ public class PipelineDataController {
|
||||
model.addAttribute("pipelineData", pipelineData);
|
||||
return "/pipeline/pipelineDataView";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取管道统计数据
|
||||
* 返回内容:
|
||||
* - totalLength: 污水管线总长度(米)
|
||||
* - totalCount: 污水管网总数量
|
||||
* - materialLengthRatio: 污水管网【材质-长度】比例
|
||||
* - materialCountRatio: 污水管网【材质-数量】比例
|
||||
* - diameterLengthRatio: 污水管网【管径-长度】分布
|
||||
* - diameterCountRatio: 污水管网【管径-数量】分布
|
||||
*/
|
||||
@RequestMapping("/getStatistics.do")
|
||||
public ModelAndView getStatistics(HttpServletRequest request, Model model) {
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
try {
|
||||
// 获取总统计数据
|
||||
Map<String, Object> totalStats = pipelineDataService.selectTotalStats();
|
||||
|
||||
// 总数量
|
||||
long totalCount = 0;
|
||||
double totalLength = 0.0;
|
||||
|
||||
if (totalStats != null) {
|
||||
Object countObj = totalStats.get("totalCount");
|
||||
Object lengthObj = totalStats.get("totalLength");
|
||||
|
||||
if (countObj != null) {
|
||||
totalCount = ((Number) countObj).longValue();
|
||||
}
|
||||
if (lengthObj != null) {
|
||||
totalLength = ((Number) lengthObj).doubleValue();
|
||||
}
|
||||
}
|
||||
|
||||
result.put("totalLength", Math.round(totalLength * 100) / 100.0); // 保留2位小数
|
||||
result.put("totalCount", totalCount);
|
||||
|
||||
// 获取按材质分组的统计数据
|
||||
List<Map<String, Object>> materialStats = pipelineDataService.selectMaterialStats();
|
||||
|
||||
// 材质-长度比例
|
||||
JSONArray materialLengthRatio = new JSONArray();
|
||||
// 材质-数量比例
|
||||
JSONArray materialCountRatio = new JSONArray();
|
||||
|
||||
if (materialStats != null && !materialStats.isEmpty()) {
|
||||
for (Map<String, Object> stat : materialStats) {
|
||||
String material = (String) stat.get("material");
|
||||
if (material == null || material.isEmpty()) {
|
||||
material = "未知";
|
||||
}
|
||||
|
||||
Object countObj = stat.get("count");
|
||||
Object lengthObj = stat.get("totalLength");
|
||||
|
||||
int count = 0;
|
||||
double length = 0.0;
|
||||
|
||||
if (countObj != null) {
|
||||
count = ((Number) countObj).intValue();
|
||||
}
|
||||
if (lengthObj != null) {
|
||||
length = ((Number) lengthObj).doubleValue();
|
||||
}
|
||||
|
||||
// 计算比例
|
||||
double lengthRatio = totalLength > 0 ? Math.round(length / totalLength * 10000) / 100.0 : 0;
|
||||
double countRatio = totalCount > 0 ? Math.round(count * 1.0 / totalCount * 10000) / 100.0 : 0;
|
||||
|
||||
// 材质-长度比例
|
||||
JSONObject lengthItem = new JSONObject();
|
||||
lengthItem.put("material", material);
|
||||
lengthItem.put("length", Math.round(length * 100) / 100.0);
|
||||
lengthItem.put("ratio", lengthRatio); // 百分比
|
||||
materialLengthRatio.add(lengthItem);
|
||||
|
||||
// 材质-数量比例
|
||||
JSONObject countItem = new JSONObject();
|
||||
countItem.put("material", material);
|
||||
countItem.put("count", count);
|
||||
countItem.put("ratio", countRatio); // 百分比
|
||||
materialCountRatio.add(countItem);
|
||||
}
|
||||
}
|
||||
|
||||
result.put("materialLengthRatio", materialLengthRatio);
|
||||
result.put("materialCountRatio", materialCountRatio);
|
||||
|
||||
// 获取按管径分组的统计数据
|
||||
List<Map<String, Object>> diameterStats = pipelineDataService.selectDiameterStats();
|
||||
|
||||
// 管径-长度分布
|
||||
JSONArray diameterLengthRatio = new JSONArray();
|
||||
// 管径-数量分布
|
||||
JSONArray diameterCountRatio = new JSONArray();
|
||||
|
||||
if (diameterStats != null && !diameterStats.isEmpty()) {
|
||||
for (Map<String, Object> stat : diameterStats) {
|
||||
String diameter = (String) stat.get("diameter");
|
||||
if (diameter == null || diameter.isEmpty()) {
|
||||
diameter = "未知";
|
||||
}
|
||||
|
||||
Object countObj = stat.get("count");
|
||||
Object lengthObj = stat.get("totalLength");
|
||||
|
||||
int count = 0;
|
||||
double length = 0.0;
|
||||
|
||||
if (countObj != null) {
|
||||
count = ((Number) countObj).intValue();
|
||||
}
|
||||
if (lengthObj != null) {
|
||||
length = ((Number) lengthObj).doubleValue();
|
||||
}
|
||||
|
||||
// 计算比例
|
||||
double lengthRatio = totalLength > 0 ? Math.round(length / totalLength * 10000) / 100.0 : 0;
|
||||
double countRatio = totalCount > 0 ? Math.round(count * 1.0 / totalCount * 10000) / 100.0 : 0;
|
||||
|
||||
// 管径-长度分布
|
||||
JSONObject lengthItem = new JSONObject();
|
||||
lengthItem.put("diameter", diameter);
|
||||
lengthItem.put("length", Math.round(length * 100) / 100.0);
|
||||
lengthItem.put("ratio", lengthRatio); // 百分比
|
||||
diameterLengthRatio.add(lengthItem);
|
||||
|
||||
// 管径-数量分布
|
||||
JSONObject countItem = new JSONObject();
|
||||
countItem.put("diameter", diameter);
|
||||
countItem.put("count", count);
|
||||
countItem.put("ratio", countRatio); // 百分比
|
||||
diameterCountRatio.add(countItem);
|
||||
}
|
||||
}
|
||||
|
||||
result.put("diameterLengthRatio", diameterLengthRatio);
|
||||
result.put("diameterCountRatio", diameterCountRatio);
|
||||
result.put("success", true);
|
||||
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "获取统计数据失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
}
|
||||
|
||||
@ -374,6 +374,16 @@ public class RptCreateController {
|
||||
@RequestMapping("/doadd.do")
|
||||
public String doadd(HttpServletRequest request, Model model) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
String rptsetId = request.getParameter("rptsetId");
|
||||
|
||||
// 权限验证:检查用户是否有报表生成权限
|
||||
if (rptsetId != null && !rptsetId.isEmpty()) {
|
||||
if (!this.rptCreateService.checkGeneratePermission(rptsetId, cu)) {
|
||||
model.addAttribute("result", "{\"res\":\"您没有该报表的生成权限\",\"msg\":\"您没有该报表的生成权限\"}");
|
||||
return "result";
|
||||
}
|
||||
}
|
||||
|
||||
request.setAttribute("userId", cu.getId());
|
||||
request.setAttribute("userName", cu.getCaption());
|
||||
request.setAttribute("id", CommUtil.getUUID());
|
||||
@ -432,6 +442,14 @@ public class RptCreateController {
|
||||
String rptsetId = request.getParameter("rptsetId");
|
||||
int result = 0;
|
||||
|
||||
// 权限验证:检查用户是否有报表生成权限
|
||||
if (rptCreate.getRptsetId() != null && !rptCreate.getRptsetId().isEmpty()) {
|
||||
if (!this.rptCreateService.checkGeneratePermission(rptCreate.getRptsetId(), cu)) {
|
||||
model.addAttribute("result", "{\"res\":\"您没有该报表的生成权限\",\"msg\":\"您没有该报表的生成权限\"}");
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
}
|
||||
|
||||
RptInfoSet rptInfoSet = rptInfoSetService.selectById(rptCreate.getRptsetId());
|
||||
if (rptInfoSet != null) {
|
||||
//日报
|
||||
@ -545,6 +563,15 @@ public class RptCreateController {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
String rptsetId = request.getParameter("rptsetId");
|
||||
int result = 0;
|
||||
|
||||
// 权限验证:检查用户是否有报表生成权限
|
||||
if (rptCreate.getRptsetId() != null && !rptCreate.getRptsetId().isEmpty()) {
|
||||
if (!this.rptCreateService.checkGeneratePermission(rptCreate.getRptsetId(), cu)) {
|
||||
model.addAttribute("result", "{\"res\":\"您没有该报表的生成权限\",\"msg\":\"您没有该报表的生成权限\"}");
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
}
|
||||
|
||||
RptInfoSet rptInfoSet = rptInfoSetService.selectById(rptCreate.getRptsetId());
|
||||
if (rptInfoSet != null) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
@ -750,13 +777,26 @@ public class RptCreateController {
|
||||
@RequestMapping("/getSheet.do")
|
||||
public String getSheet(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "id") String id) {
|
||||
String path = "";
|
||||
String name = "";
|
||||
Result_Report result1 = new Result_Report();
|
||||
RptCreate rptCreate = this.rptCreateService.selectById(id);
|
||||
if (rptCreate != null) {//报表生成中的预览
|
||||
// 优先使用数据库中存储的文件路径,如果没有则构造路径(兼容旧数据)
|
||||
if (rptCreate.getAbspath() != null && !rptCreate.getAbspath().isEmpty()) {
|
||||
path = rptCreate.getAbspath();
|
||||
} else {
|
||||
path = rptCreate.getRptname() + rptCreate.getId() + ".xls";
|
||||
}
|
||||
// 获取文件扩展名
|
||||
String extension = ".xls";
|
||||
if (path.toLowerCase().endsWith(".xlsx")) {
|
||||
extension = ".xlsx";
|
||||
}
|
||||
String sourcePath = rptCreate.getRptname() + extension;
|
||||
List<RptInfoSetSheet> list = rptInfoSetSheetService.selectListByWhere("where rptInfoSet_id = '" + rptCreate.getRptsetId() + "'");
|
||||
try {
|
||||
String sourcePath = rptCreate.getRptname();
|
||||
byte[] isb = commonFileService.getInputStreamBytes(FileNameSpaceEnum.RptCreateFile.getNameSpace(), CommUtil.fixRptCreateFileName(rptCreate.getRptname() + rptCreate.getId()));
|
||||
byte[] isb = commonFileService.getInputStreamBytes(FileNameSpaceEnum.RptCreateFile.getNameSpace(), path);
|
||||
if (isb == null || isb.length == 0) {
|
||||
result1 = Result_Report.failed("文件不存在或已被删除");
|
||||
model.addAttribute("result", CommUtil.toJson(result1));
|
||||
@ -774,7 +814,7 @@ public class RptCreateController {
|
||||
List<RptInfoSetSheet> list = rptInfoSetSheetService.selectListByWhere("where rptInfoSet_id = '" + rptInfoSetFile.getMasterid() + "'");
|
||||
try {
|
||||
String sourcePath = "";
|
||||
String path = rptInfoSetFile.getAbspath();
|
||||
path = rptInfoSetFile.getAbspath();
|
||||
// path = path.replaceAll("\\.xlsx", "").replaceAll("\\.xls", "");
|
||||
// byte[] isb = commonFileService.getInputStreamBytes(FileNameSpaceEnum.RptInfoSetFile.getNameSpace(), CommUtil.fixRptCreateFileName(path));
|
||||
byte[] isb = commonFileService.getInputStreamBytes(FileNameSpaceEnum.RptInfoSetFile.getNameSpace(), path);
|
||||
@ -850,8 +890,18 @@ public class RptCreateController {
|
||||
String name = "";
|
||||
RptCreate rptCreate = this.rptCreateService.selectById(id);
|
||||
if (rptCreate != null) {
|
||||
path = rptCreate.getRptname() + rptCreate.getId() + ".xls";
|
||||
name = rptCreate.getRptname() + ".xls";
|
||||
// 优先使用数据库中存储的文件路径,如果没有则构造路径(兼容旧数据)
|
||||
if (rptCreate.getAbspath() != null && !rptCreate.getAbspath().isEmpty()) {
|
||||
path = rptCreate.getAbspath();
|
||||
} else {
|
||||
path = rptCreate.getRptname() + rptCreate.getId() + ".xls";
|
||||
}
|
||||
// 获取文件扩展名
|
||||
String extension = ".xls";
|
||||
if (path.toLowerCase().endsWith(".xlsx")) {
|
||||
extension = ".xlsx";
|
||||
}
|
||||
name = rptCreate.getRptname() + extension;
|
||||
}
|
||||
byte[] bytes = commonFileService.getInputStreamBytes(FileNameSpaceEnum.RptCreateFile.getNameSpace(), path);
|
||||
if (bytes == null || bytes.length == 0) {
|
||||
|
||||
@ -123,6 +123,13 @@ public class RptDayLogController {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
String userId = cu.getId();
|
||||
|
||||
// 权限验证:检查用户是否有填报权限
|
||||
if (!this.rptDayLogService.checkInputPermission(rptdeptId, cu)) {
|
||||
Result result = Result.failed("您没有该报表的填报权限");
|
||||
model.addAttribute("result", CommUtil.toJson(result));
|
||||
return "result";
|
||||
}
|
||||
|
||||
JSONObject jsonObject = this.rptDayLogService.getJson(null,rptdeptId,rptdt,userId);
|
||||
|
||||
Result result = Result.success(jsonObject);
|
||||
@ -149,6 +156,14 @@ public class RptDayLogController {
|
||||
@RequestParam(value = "rptdeptId") String rptdeptId) throws IOException {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
String userId = cu.getId();
|
||||
|
||||
// 权限验证:检查用户是否有填报权限
|
||||
if (!this.rptDayLogService.checkInputPermission(rptdeptId, cu)) {
|
||||
Result result = Result.failed("您没有该报表的填报权限");
|
||||
model.addAttribute("result", CommUtil.toJson(result));
|
||||
return "result";
|
||||
}
|
||||
|
||||
JSONObject jsonObject = this.rptDayLogService.getJson(id,rptdeptId,null,userId);
|
||||
model.addAttribute("rptDayLog", jsonObject);
|
||||
// return "/report/reportdetail";
|
||||
@ -191,11 +206,19 @@ public class RptDayLogController {
|
||||
}
|
||||
|
||||
@RequestMapping("/dosave.do")
|
||||
public String dosave(HttpServletRequest request,Model model){
|
||||
public ModelAndView dosave(HttpServletRequest request,Model model){
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
String userId = cu.getId();
|
||||
String json = request.getParameter("json");
|
||||
JSONObject jsonObject = JSONObject.fromObject(json);
|
||||
|
||||
// 权限验证:检查用户是否有填报权限
|
||||
String rptdeptId = (String) jsonObject.get("rptdeptId");
|
||||
if (!this.rptDayLogService.checkInputPermission(rptdeptId, cu)) {
|
||||
model.addAttribute("result", "{\"res\":\"您没有该报表的填报权限\",\"msg\":\"您没有该报表的填报权限\"}");
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
if (jsonObject.get("id")==null||jsonObject.get("id").equals("")) {
|
||||
jsonObject.put("id", CommUtil.getUUID());
|
||||
}
|
||||
@ -206,12 +229,12 @@ public class RptDayLogController {
|
||||
e.printStackTrace();
|
||||
Result result = Result.failed("插入失败");
|
||||
model.addAttribute("result", CommUtil.toJson(result));
|
||||
return "result";
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
Result result = Result.success(null);
|
||||
model.addAttribute("result", CommUtil.toJson(result));
|
||||
return "result";
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
@RequestMapping("/onekeyAudit.do")//一键审核
|
||||
@ -268,6 +291,14 @@ public class RptDayLogController {
|
||||
@RequestParam(value = "rptdeptId", required=false) String rptdeptId) {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
String userId = cu.getId();
|
||||
|
||||
// 权限验证:检查用户是否有填报权限
|
||||
if (!this.rptDayLogService.checkInputPermission(rptdeptId, cu)) {
|
||||
Result result = Result.failed("您没有该报表的填报权限");
|
||||
model.addAttribute("result", CommUtil.toJson(result));
|
||||
return "result";
|
||||
}
|
||||
|
||||
MultipartRequest multipartRequest = (MultipartRequest)request;
|
||||
|
||||
List<MultipartFile> fileList = multipartRequest.getFiles("filelist");
|
||||
|
||||
@ -36,6 +36,7 @@ import java.util.UUID;
|
||||
|
||||
/**
|
||||
* 综合检查
|
||||
*
|
||||
* @author lt
|
||||
*/
|
||||
@Controller
|
||||
@ -125,11 +126,13 @@ public class SafetyCheckComprehensiveController {
|
||||
@RequestMapping("/save.do")
|
||||
@ResponseBody
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result save(HttpServletRequest request, SafetyCheckComprehensive bean, MultipartFile file) throws Exception {
|
||||
public Result save(HttpServletRequest request, SafetyCheckComprehensive bean, MultipartFile[] multipartFiles) throws Exception {
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
bean.setId(UUID.randomUUID().toString());
|
||||
if (file.getSize() > 0) {
|
||||
safetyFilesService.upload(request, null, SafetyFunctionEnum.SAFETY_CHECK_COMPREHENSIVE.getId(), SafetyCheckStatusEnum.APPLY.getId(), bean.getId());
|
||||
if (multipartFiles != null) {
|
||||
for (MultipartFile file : multipartFiles) {
|
||||
safetyFilesService.upload(request, file, SafetyFunctionEnum.SAFETY_CHECK_COMPREHENSIVE.getId(), SafetyCheckStatusEnum.APPLY.getId(), bean.getId());
|
||||
}
|
||||
}
|
||||
bean.setCheckCode(safetySeqService.code(request, SafetyFunctionEnum.SAFETY_CHECK_COMPREHENSIVE));
|
||||
if (bean.getCheckResult() == SafetyCheckResultEnum.OK.getId()) {
|
||||
@ -153,8 +156,8 @@ public class SafetyCheckComprehensiveController {
|
||||
@RequestMapping("/saveApply.do")
|
||||
@ResponseBody
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result saveApply(HttpServletRequest request, SafetyCheckComprehensive bean, MultipartFile file) throws Exception {
|
||||
if(StringUtils.isEmpty(bean.getDutyUserId())){
|
||||
public Result saveApply(HttpServletRequest request, SafetyCheckComprehensive bean, MultipartFile[] file) throws Exception {
|
||||
if (StringUtils.isEmpty(bean.getDutyUserId())) {
|
||||
return Result.failed("整改负责人不能为空!");
|
||||
}
|
||||
|
||||
@ -178,8 +181,8 @@ public class SafetyCheckComprehensiveController {
|
||||
SafetyCheckStatusEnum.RESPONSE.getTaskTitle(),
|
||||
bean.getDutyUserId(), // 当前节点审批人
|
||||
bean.getDutyUserName(), // 当前节点审批人
|
||||
null, // 抄送人
|
||||
null,// 抄送人
|
||||
bean.getCopyUserId(), // 抄送人
|
||||
bean.getCopyUserName(),// 抄送人
|
||||
null);
|
||||
}
|
||||
return Result.success();
|
||||
@ -232,7 +235,7 @@ public class SafetyCheckComprehensiveController {
|
||||
@ResponseBody
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result apply(HttpServletRequest request, SafetyCheckComprehensive bean) throws IOException, ServiceException {
|
||||
if(StringUtils.isEmpty(bean.getDutyUserId())){
|
||||
if (StringUtils.isEmpty(bean.getDutyUserId())) {
|
||||
return Result.failed("整改负责人不能为空!");
|
||||
}
|
||||
update(request, bean);
|
||||
@ -336,7 +339,7 @@ public class SafetyCheckComprehensiveController {
|
||||
@ResponseBody
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result response(HttpServletRequest request, SafetyCheckComprehensive bean, String processInstanceId) throws IOException, ServiceException {
|
||||
if(StringUtils.isEmpty(bean.getConfirmUserId())){
|
||||
if (StringUtils.isEmpty(bean.getConfirmUserId())) {
|
||||
return Result.failed("验证人不能为空!");
|
||||
}
|
||||
|
||||
@ -374,10 +377,9 @@ public class SafetyCheckComprehensiveController {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result response(HttpServletRequest request, SafetyCheckComprehensive bean, String processInstanceId, int pass) throws IOException, ServiceException {
|
||||
|
||||
safetyCheckActivityService.audit(bean.getConfirmUserId(), processInstanceId, pass);
|
||||
|
||||
//通过
|
||||
if (pass == 1) {
|
||||
safetyCheckActivityService.audit(bean.getConfirmUserId(), processInstanceId, pass);
|
||||
bean.setStatus(SafetyCheckStatusEnum.COMPLETE.getId());
|
||||
service.update(bean);
|
||||
|
||||
@ -388,7 +390,7 @@ public class SafetyCheckComprehensiveController {
|
||||
bean.getConfirmUserName(),
|
||||
bean.getCopyUserId(),
|
||||
bean.getCopyUserName(),
|
||||
SafetyCheckStatusEnum.COMPLETE.getTaskRecordPass( bean.getConfirmUserName()));
|
||||
SafetyCheckStatusEnum.COMPLETE.getTaskRecordPass(bean.getConfirmUserName()));
|
||||
safetyFlowTaskService.saveWorkFlowRecord(true,
|
||||
bean.getId(),
|
||||
"结束",
|
||||
@ -400,6 +402,7 @@ public class SafetyCheckComprehensiveController {
|
||||
}
|
||||
//不通过
|
||||
else {
|
||||
safetyCheckActivityService.audit(bean.getDutyUserId(), processInstanceId, pass);
|
||||
bean.setStatus(SafetyCheckStatusEnum.APPLY.getId());
|
||||
service.update(bean);
|
||||
safetyFlowTaskService.saveWorkFlowRecord(true,
|
||||
|
||||
@ -211,7 +211,8 @@ public class SafetyCheckDaylyController {
|
||||
@ResponseBody
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result saveApply(HttpServletRequest request, SafetyCheckDayly bean, MultipartFile file) throws Exception {
|
||||
if(StringUtils.isEmpty(bean.getDutyUserId())){
|
||||
if(bean.getCheckResult() != 1 && StringUtils.isEmpty(bean.getDutyUserId())){
|
||||
// 弱智东西,不相符的才需要整改负责人
|
||||
return Result.failed("整改负责人不能为空!");
|
||||
}
|
||||
|
||||
@ -235,8 +236,8 @@ public class SafetyCheckDaylyController {
|
||||
SafetyCheckStatusEnum.RESPONSE.getTaskTitle(),
|
||||
bean.getDutyUserId(), // 当前节点审批人
|
||||
bean.getDutyUserName(), // 当前节点审批人
|
||||
null, // 抄送人
|
||||
null,// 抄送人
|
||||
bean.getCopyUserId(), // 抄送人
|
||||
bean.getCopyUserName(),// 抄送人
|
||||
null);
|
||||
|
||||
}
|
||||
@ -372,10 +373,9 @@ public class SafetyCheckDaylyController {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result response(HttpServletRequest request, SafetyCheckDayly bean, String processInstanceId, int pass) throws IOException, ServiceException {
|
||||
|
||||
safetyCheckActivityService.audit(bean.getConfirmUserId(), processInstanceId, pass);
|
||||
|
||||
//通过
|
||||
if (pass == 1) {
|
||||
safetyCheckActivityService.audit(bean.getConfirmUserId(), processInstanceId, pass);
|
||||
bean.setStatus(SafetyCheckStatusEnum.COMPLETE.getId());
|
||||
safetyCheckDaylyService.update(bean);
|
||||
|
||||
@ -399,6 +399,7 @@ public class SafetyCheckDaylyController {
|
||||
}
|
||||
//不通过
|
||||
else {
|
||||
safetyCheckActivityService.audit(bean.getDutyUserId(), processInstanceId, pass);
|
||||
bean.setStatus(SafetyCheckStatusEnum.APPLY.getId());
|
||||
safetyCheckDaylyService.update(bean);
|
||||
safetyFlowTaskService.saveWorkFlowRecord(true,
|
||||
|
||||
@ -197,8 +197,8 @@ public class SafetyCheckSpecialController {
|
||||
SafetyCheckStatusEnum.RESPONSE.getTaskTitle(),
|
||||
bean.getDutyUserId(), // 当前节点审批人
|
||||
bean.getDutyUserName(), // 当前节点审批人
|
||||
null, // 抄送人
|
||||
null,// 抄送人
|
||||
bean.getCopyUserId(), // 抄送人
|
||||
bean.getCopyUserName(),// 抄送人
|
||||
null);
|
||||
}
|
||||
return Result.success();
|
||||
@ -393,10 +393,9 @@ public class SafetyCheckSpecialController {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result response(HttpServletRequest request, SafetyCheckSpecial bean, String processInstanceId, int pass) throws IOException, ServiceException {
|
||||
|
||||
safetyCheckActivityService.audit(bean.getConfirmUserId(), processInstanceId, pass);
|
||||
|
||||
//通过
|
||||
if (pass == 1) {
|
||||
safetyCheckActivityService.audit(bean.getConfirmUserId(), processInstanceId, pass);
|
||||
bean.setStatus(SafetyCheckStatusEnum.COMPLETE.getId());
|
||||
service.update(bean);
|
||||
|
||||
@ -419,6 +418,7 @@ public class SafetyCheckSpecialController {
|
||||
}
|
||||
//不通过
|
||||
else {
|
||||
safetyCheckActivityService.audit(bean.getDutyUserId(), processInstanceId, pass);
|
||||
bean.setStatus(SafetyCheckStatusEnum.APPLY.getId());
|
||||
service.update(bean);
|
||||
safetyFlowTaskService.saveWorkFlowRecord(true,
|
||||
|
||||
@ -66,7 +66,7 @@ public class SafetyEducationTraineeController {
|
||||
**/
|
||||
@RequestMapping("/add.do")
|
||||
public String add(HttpServletRequest request, Model model) throws Exception {
|
||||
String educationCode =safetySeqService.code(request,SafetyFunctionEnum.EDUCATION_TRAINEE);
|
||||
String educationCode = safetySeqService.code(request, SafetyFunctionEnum.EDUCATION_TRAINEE);
|
||||
model.addAttribute("educationCode", educationCode);
|
||||
return "safety/EducationTraineeAdd";
|
||||
}
|
||||
@ -82,9 +82,10 @@ public class SafetyEducationTraineeController {
|
||||
SafetyEducationTrainee educationTrainee = safetyEducationTraineeService.selectById(id);
|
||||
SafetyFiles file = safetyFilesService.selectById(educationTrainee.getFileId());
|
||||
model.addAttribute("bean", educationTrainee);
|
||||
model.addAttribute("fileName", file==null?"":file.getOriginalFileName());
|
||||
model.addAttribute("fileName", file == null ? "" : file.getOriginalFileName());
|
||||
return "safety/EducationTraineeEdit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转至编辑弹窗
|
||||
*
|
||||
@ -96,9 +97,10 @@ public class SafetyEducationTraineeController {
|
||||
SafetyEducationTrainee educationTrainee = safetyEducationTraineeService.selectById(id);
|
||||
SafetyFiles file = safetyFilesService.selectById(educationTrainee.getFileId());
|
||||
model.addAttribute("bean", educationTrainee);
|
||||
model.addAttribute("fileName",file==null?"":file.getOriginalFileName());
|
||||
model.addAttribute("fileName", file == null ? "" : file.getOriginalFileName());
|
||||
return "safety/EducationTraineeView";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分页列表信息
|
||||
*
|
||||
@ -169,24 +171,24 @@ public class SafetyEducationTraineeController {
|
||||
@RequestMapping("/update.do")
|
||||
@ResponseBody
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result update(HttpServletRequest request,SafetyEducationTrainee bean, MultipartFile file) throws IOException, ParseException {
|
||||
public Result update(HttpServletRequest request, SafetyEducationTrainee bean, MultipartFile file) throws IOException, ParseException {
|
||||
|
||||
if (!safetyEducationTraineeService.timeRangeCheck(bean)) {
|
||||
return Result.failed("培训有效期早于培训日期!");
|
||||
}
|
||||
SafetyEducationTrainee oldBean = safetyEducationTraineeService.selectById(bean.getId());
|
||||
//如果文件id是空的,代表用户重新上传的文件,先删除原来的文件,然后再上传新文件。
|
||||
if (StringUtils.isEmpty(bean.getFileId())&&file.getSize()>0) {
|
||||
List<SafetyFiles> fileBeanList = safetyFilesService.upload(request,file, SafetyFunctionEnum.EDUCATION_TRAINEE.getId(), null, bean.getId());
|
||||
if (StringUtils.isEmpty(bean.getFileId()) && file.getSize() > 0) {
|
||||
List<SafetyFiles> fileBeanList = safetyFilesService.upload(request, file, SafetyFunctionEnum.EDUCATION_TRAINEE.getId(), null, bean.getId());
|
||||
bean.setFileId(fileBeanList.get(0).getId());
|
||||
safetyEducationTraineeService.update(bean);
|
||||
// 删除原来的附件记录
|
||||
safetyFilesService.deleteById(oldBean.getFileId());
|
||||
} else if (StringUtils.isEmpty(bean.getFileId()) && file.getSize()==0) {
|
||||
} else if (StringUtils.isEmpty(bean.getFileId()) && file.getSize() == 0) {
|
||||
bean.setFileId(null);
|
||||
safetyEducationTraineeService.update(bean);
|
||||
safetyFilesService.deleteById(oldBean.getFileId());
|
||||
}else {
|
||||
// safetyFilesService.deleteById(oldBean.getFileId());
|
||||
} else {
|
||||
safetyEducationTraineeService.update(bean);
|
||||
}
|
||||
return Result.success();
|
||||
@ -210,6 +212,7 @@ public class SafetyEducationTraineeController {
|
||||
}
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除附件
|
||||
*
|
||||
@ -223,8 +226,8 @@ public class SafetyEducationTraineeController {
|
||||
SafetyEducationTrainee bean = safetyEducationTraineeService.selectById(id);
|
||||
safetyFilesService.deleteById(bean.getFileId());
|
||||
bean.setFileId("");
|
||||
int row = safetyEducationTraineeService.update(bean);
|
||||
if (row!=0) {
|
||||
int row = safetyEducationTraineeService.update(bean);
|
||||
if (row != 0) {
|
||||
return Result.success();
|
||||
}
|
||||
return Result.failed("删除失败!");
|
||||
|
||||
@ -343,8 +343,6 @@ public class SafetyExternalCertificateController {
|
||||
int result = 0;
|
||||
for (String id : ids) {
|
||||
result += service.deleteById(id);
|
||||
}
|
||||
for (String id : ids) {
|
||||
safetyFilesService.deleteByBizId(id);
|
||||
}
|
||||
model.addAttribute("result", result);
|
||||
|
||||
@ -170,6 +170,16 @@ public class StaffArchivesController {
|
||||
return "result";
|
||||
}
|
||||
|
||||
// 更新用户的所属部门
|
||||
String pid = request.getParameter("pid");
|
||||
if(StringUtils.isNotBlank(pid)){
|
||||
User user = this.userService.getUserById(safetyStaffArchives.getUserid());
|
||||
if(user != null){
|
||||
user.setPid(pid);
|
||||
this.userService.updateUserById(user);
|
||||
}
|
||||
}
|
||||
|
||||
this.staffArchivesService.save(safetyStaffArchives);
|
||||
model.addAttribute("result", CommUtil.toJson(Result.success()));
|
||||
return "result";
|
||||
@ -195,6 +205,16 @@ public class StaffArchivesController {
|
||||
return "result";
|
||||
}
|
||||
|
||||
// 更新用户的所属部门
|
||||
String pid = request.getParameter("pid");
|
||||
if(StringUtils.isNotBlank(pid)){
|
||||
User user = this.userService.getUserById(safetyStaffArchives.getUserid());
|
||||
if(user != null){
|
||||
user.setPid(pid);
|
||||
this.userService.updateUserById(user);
|
||||
}
|
||||
}
|
||||
|
||||
int result = this.staffArchivesService.update(safetyStaffArchives);
|
||||
model.addAttribute("result", CommUtil.toJson(Result.success()));
|
||||
return "result";
|
||||
|
||||
@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sipai.entity.base.Result;
|
||||
import com.sipai.entity.sparepart.Sewage;
|
||||
import com.sipai.entity.user.ProcessSection;
|
||||
import com.sipai.entity.user.Unit;
|
||||
import com.sipai.entity.user.User;
|
||||
import com.sipai.service.sparepart.SewageService;
|
||||
@ -85,7 +86,13 @@ public class SewageController {
|
||||
wherestr += " and (contract_number like '%"+request.getParameter("search_name")+"%' or name like '%"+request.getParameter("search_name")+"%' ) ";
|
||||
}
|
||||
if (request.getParameter("processSectionId")!= null && !request.getParameter("processSectionId").isEmpty()) {
|
||||
wherestr += " and process_section_id = '"+request.getParameter("processSectionId")+"'";
|
||||
String processSectionId = request.getParameter("processSectionId");
|
||||
ProcessSection processSection = this.processSectionService.selectById(processSectionId);
|
||||
if (processSection != null) {
|
||||
wherestr += " and (process_section_id = '" + processSectionId + "' or process_section_id = '" + processSection.getCode() + "')";
|
||||
} else {
|
||||
wherestr += " and process_section_id = '"+processSectionId+"'";
|
||||
}
|
||||
}
|
||||
if (request.getParameter("city")!= null && !request.getParameter("city").isEmpty()) {
|
||||
wherestr += " and city like '%"+request.getParameter("city")+"%'";
|
||||
@ -192,6 +199,31 @@ public class SewageController {
|
||||
return "result";
|
||||
}
|
||||
|
||||
/**
|
||||
* 排污源页面专用泵站下拉,value 使用 process_section.id,避免前端提交 code 导致无法正确保存/查询
|
||||
*/
|
||||
@RequestMapping("/getProcessSectionId4Select.do")
|
||||
public ModelAndView getProcessSectionId4Select(HttpServletRequest request, Model model) {
|
||||
String companyId = request.getParameter("companyId");
|
||||
String wherestr = "where 1=1 and active='1' ";
|
||||
if (companyId != null && !companyId.isEmpty()) {
|
||||
wherestr += " and unit_id = '" + companyId + "' ";
|
||||
}
|
||||
wherestr += " order by code asc";
|
||||
List<ProcessSection> processSections = this.processSectionService.selectListByWhere(wherestr);
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
if (processSections != null && processSections.size() > 0) {
|
||||
for (ProcessSection processSection : processSections) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", processSection.getId());
|
||||
jsonObject.put("text", processSection.getSname() == null ? processSection.getName() : processSection.getSname());
|
||||
jsonArray.add(jsonObject);
|
||||
}
|
||||
}
|
||||
model.addAttribute("result", jsonArray.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/view.do")
|
||||
public String doview(HttpServletRequest request,Model model,
|
||||
@ -222,7 +254,13 @@ public class SewageController {
|
||||
wherestr += " and city like '%"+request.getParameter("search_name1")+"%'";
|
||||
}
|
||||
if (request.getParameter("processSectionId")!= null && !request.getParameter("processSectionId").isEmpty()) {
|
||||
wherestr += " and process_section_id = '"+request.getParameter("processSectionId")+"'";
|
||||
String processSectionId = request.getParameter("processSectionId");
|
||||
ProcessSection processSection = this.processSectionService.selectById(processSectionId);
|
||||
if (processSection != null) {
|
||||
wherestr += " and (process_section_id = '" + processSectionId + "' or process_section_id = '" + processSection.getCode() + "')";
|
||||
} else {
|
||||
wherestr += " and process_section_id = '"+processSectionId+"'";
|
||||
}
|
||||
}
|
||||
|
||||
List<Sewage> list = this.sewageService.selectListByWhere(wherestr+orderstr);
|
||||
|
||||
@ -227,7 +227,7 @@ public class PatrolModelController {
|
||||
User cu=(User)request.getSession().getAttribute("cu");
|
||||
String companyId = request.getParameter("bizId");
|
||||
String type = request.getParameter("type");
|
||||
List<PatrolModel> list = this.patrolModelService.selectListByWhere("where unit_id = '"+companyId+"' and type='"+type+"' order by insdt");
|
||||
List<PatrolModel> list = this.patrolModelService.selectListByWhere("where unit_id = '"+companyId+"' order by insdt");
|
||||
ArrayList<Select2> list4select2 = new ArrayList<Select2>();
|
||||
for (int i=0;i<list.size();i++){
|
||||
Select2 select2 = new Select2();
|
||||
|
||||
@ -242,10 +242,11 @@ public class ProcessSectionController {
|
||||
@RequestMapping("/getProcessSection4Select.do")
|
||||
public String getProcessSection4Select(HttpServletRequest request, Model model) {
|
||||
String companyId = request.getParameter("companyId"); // 默认查询JSBZ???
|
||||
Company company = this.companyService.selectByPrimaryKey(companyId);
|
||||
// 使用unitService获取Unit信息,因为companyId来自tb_unit表
|
||||
Unit unit = this.unitService.getUnitById(companyId);
|
||||
|
||||
String wherestr = "where 1=1 and active='" + CommString.Active_True + "' ";
|
||||
if (company != null && company.getType().equals(CommString.UNIT_TYPE_COMPANY)) { // "C";//公司
|
||||
if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_COMPANY)) { // "C";//公司
|
||||
String bizs = "";//公司下属所有厂id
|
||||
List<Unit> blist = this.unitService.getParentCompanyChildrenBizByUnitid(companyId);
|
||||
if (blist != null && blist.size() > 0) {
|
||||
@ -257,7 +258,7 @@ public class ProcessSectionController {
|
||||
}
|
||||
bizs = bizs.replace(",", "','");
|
||||
wherestr += " and (unit_id='" + ProcessSection.UnitId_Sys + "' or (code not in (select code from tb_process_section where unit_id='" + ProcessSection.UnitId_Sys + "')) and unit_id in ('" + bizs + "') ) ";
|
||||
} else if (company != null && company.getType().equals(CommString.UNIT_TYPE_BIZ)) { // B 水厂
|
||||
} else if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_BIZ)) { // B 水厂
|
||||
wherestr += " and unit_id='" + companyId + "' ";
|
||||
}
|
||||
if (request.getParameter("search_name") != null && !request.getParameter("search_name").isEmpty()) {
|
||||
@ -272,13 +273,13 @@ public class ProcessSectionController {
|
||||
for (int i = 0; i < processSections.size(); i++) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("id", processSections.get(i).getCode());
|
||||
if (company != null && company.getType().equals(CommString.UNIT_TYPE_COMPANY)) { // "C";//公司
|
||||
if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_COMPANY)) { // "C";//公司
|
||||
if (!processSections.get(i).getUnitId().equals(ProcessSection.UnitId_Sys)) {
|
||||
jsonObject.put("text", processSections.get(i).getSname() + "(" + processSections.get(i).getCompanySname() + ")");
|
||||
} else {
|
||||
jsonObject.put("text", processSections.get(i).getSname());
|
||||
}
|
||||
} else if (company != null && company.getType().equals(CommString.UNIT_TYPE_BIZ)) { // "B";//水厂
|
||||
} else if (unit != null && unit.getType().equals(CommString.UNIT_TYPE_BIZ)) { // "B";//水厂
|
||||
jsonObject.put("text", processSections.get(i).getSname());
|
||||
}
|
||||
|
||||
|
||||
@ -213,6 +213,9 @@ public class RoleController {
|
||||
JSONArray json = JSONArray.fromObject(list);
|
||||
model.addAttribute("json", json);
|
||||
model.addAttribute("roleid", roleid);
|
||||
if(request.getParameter("bizid") != null && !request.getParameter("bizid").isEmpty()){
|
||||
model.addAttribute("companyId", request.getParameter("bizid"));
|
||||
}
|
||||
return "user/roleUser";
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ import io.swagger.annotations.*;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.fileupload.servlet.ServletFileUpload;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -144,21 +145,27 @@ public class UserController {
|
||||
wherestr += "and pid in (" + pidstr + ") ";
|
||||
}
|
||||
} else {
|
||||
Company company = unitService.getCompanyByUserId(cu.getId());
|
||||
String companyId = "-1";
|
||||
if (company != null) {
|
||||
companyId = company.getId();
|
||||
}
|
||||
List<User> users = unitService.getChildrenUsersById(companyId);
|
||||
String userIds = "";
|
||||
for (User user : users) {
|
||||
if (!userIds.isEmpty()) {
|
||||
userIds += "','";
|
||||
String companyId = request.getParameter("companyId");
|
||||
if (StringUtils.isBlank(companyId) && cu != null && StringUtils.isNotBlank(cu.getId())) {
|
||||
Company company = unitService.getCompanyByUserId(cu.getId());
|
||||
if (company != null) {
|
||||
companyId = company.getId();
|
||||
}
|
||||
userIds += user.getId();
|
||||
}
|
||||
if (!userIds.isEmpty()) {
|
||||
wherestr += "and id in ('" + userIds + "') ";
|
||||
if (StringUtils.isNotBlank(companyId)) {
|
||||
List<User> users = unitService.getChildrenUsersById(companyId);
|
||||
String userIds = "";
|
||||
for (User user : users) {
|
||||
if (!userIds.isEmpty()) {
|
||||
userIds += "','";
|
||||
}
|
||||
userIds += user.getId();
|
||||
}
|
||||
if (!userIds.isEmpty()) {
|
||||
wherestr += "and id in ('" + userIds + "') ";
|
||||
}
|
||||
} else {
|
||||
wherestr += "and 1=0 ";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -852,11 +859,13 @@ public class UserController {
|
||||
public String userForSelectByCompany(HttpServletRequest request, Model model) {
|
||||
String userIds = request.getParameter("userIds");
|
||||
String jobIds = request.getParameter("jobIds");
|
||||
String displayDept = request.getParameter("displayDept");
|
||||
if (userIds != null && !userIds.isEmpty()) {
|
||||
List<User> list = this.userService.selectListByWhere("where id in ('" + userIds.replace(",", "','") + "') order by CHARINDEX(','+ id +',','," + userIds + ",')");
|
||||
List<User> list = this.userService.selectListByWhere("where id in ('" + userIds.replace(",", "','") + "') order by CHARINDEX(','+ id +',',','" + userIds + ",')");
|
||||
model.addAttribute("users", JSONArray.fromObject(list));
|
||||
}
|
||||
model.addAttribute("jobIds", jobIds);
|
||||
model.addAttribute("displayDept", displayDept);
|
||||
return "user/userForSelectByCompany";
|
||||
}
|
||||
|
||||
@ -864,6 +873,9 @@ public class UserController {
|
||||
public String getUsersByIds(HttpServletRequest request, Model model) {
|
||||
String userIds = request.getParameter("userIds");
|
||||
List<User> list = this.userService.selectListByWhere("where id in ('" + userIds.replace(",", "','") + "') order by CHARINDEX(','+ id +',','," + userIds + ",')");
|
||||
if (CollectionUtils.isNotEmpty(list)){
|
||||
list = list.stream().filter(u -> StringUtils.isNotBlank(u.getId())).collect(toList());
|
||||
}
|
||||
JSONArray json = JSONArray.fromObject(list);
|
||||
model.addAttribute("result", json);
|
||||
return "result";
|
||||
@ -1255,6 +1267,7 @@ public class UserController {
|
||||
model.addAttribute("users", JSONArray.fromObject(list));
|
||||
}
|
||||
model.addAttribute("jobIds", jobIds);
|
||||
model.addAttribute("displayDept", request.getParameter("displayDept"));
|
||||
return "user/userForSelectByWorkOrder";
|
||||
}
|
||||
|
||||
@ -1454,6 +1467,7 @@ public class UserController {
|
||||
model.addAttribute("users", JSONArray.fromObject(list));
|
||||
}
|
||||
model.addAttribute("jobIds", jobIds);
|
||||
model.addAttribute("displayDept", request.getParameter("displayDept"));
|
||||
return "user/userSelectLayer";
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,125 @@
|
||||
package com.sipai.controller.watervolume;
|
||||
|
||||
import com.sipai.service.scada.WaterVolumeLJLLService;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 水量统计控制器
|
||||
* 提供水量统计接口,支持动态表名查询
|
||||
* 表名规则:tb_mp_{companyKey}_LJLL
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/watervolume")
|
||||
public class WaterVolumeLJLLController {
|
||||
|
||||
@Resource
|
||||
private WaterVolumeLJLLService waterVolumeLJLLService;
|
||||
|
||||
/**
|
||||
* 获取水量统计数据
|
||||
*
|
||||
* @param companyKey 公司编码(如:DEV022),必填
|
||||
* @return 统计数据JSON
|
||||
*
|
||||
* 返回内容:
|
||||
* - todayTotal: 今日处理总量
|
||||
* - yesterdayTotal: 昨日处理总量
|
||||
* - monthTotal: 本月累计总量
|
||||
* - sevenDaysTotal: 七日水量处理总量(按日期分组)
|
||||
*
|
||||
* 示例请求:/watervolume/getStatistics.do?companyKey=DEV022
|
||||
*/
|
||||
@RequestMapping("/getStatistics.do")
|
||||
public ModelAndView getStatistics(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "companyKey") String companyKey) {
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
try {
|
||||
// 参数校验
|
||||
if (companyKey == null || companyKey.trim().isEmpty()) {
|
||||
result.put("success", false);
|
||||
result.put("message", "companyKey参数不能为空");
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
companyKey = companyKey.trim();
|
||||
|
||||
// 检查表是否存在
|
||||
if (!waterVolumeLJLLService.checkTableExists(companyKey)) {
|
||||
result.put("success", false);
|
||||
result.put("message", "未找到公司[" + companyKey + "]对应的水量数据表");
|
||||
result.put("tableName", waterVolumeLJLLService.buildTableName(companyKey));
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
// 今日处理总量
|
||||
BigDecimal todayTotal = waterVolumeLJLLService.getTodayTotal(companyKey);
|
||||
result.put("todayTotal", formatAmount(todayTotal));
|
||||
|
||||
// 昨日处理总量
|
||||
BigDecimal yesterdayTotal = waterVolumeLJLLService.getYesterdayTotal(companyKey);
|
||||
result.put("yesterdayTotal", formatAmount(yesterdayTotal));
|
||||
|
||||
// 本月累计总量
|
||||
BigDecimal monthTotal = waterVolumeLJLLService.getMonthTotal(companyKey);
|
||||
result.put("monthTotal", formatAmount(monthTotal));
|
||||
|
||||
// 七日水量处理总量
|
||||
List<Map<String, Object>> sevenDaysData = waterVolumeLJLLService.getSevenDaysTotal(companyKey);
|
||||
JSONArray sevenDaysArray = new JSONArray();
|
||||
if (sevenDaysData != null && !sevenDaysData.isEmpty()) {
|
||||
for (Map<String, Object> dayData : sevenDaysData) {
|
||||
JSONObject dayJson = new JSONObject();
|
||||
dayJson.put("date", dayData.get("date"));
|
||||
Object totalObj = dayData.get("total");
|
||||
if (totalObj instanceof BigDecimal) {
|
||||
dayJson.put("total", formatAmount((BigDecimal) totalObj));
|
||||
} else if (totalObj instanceof Number) {
|
||||
dayJson.put("total", formatAmount(new BigDecimal(totalObj.toString())));
|
||||
} else {
|
||||
dayJson.put("total", "0.00");
|
||||
}
|
||||
sevenDaysArray.add(dayJson);
|
||||
}
|
||||
}
|
||||
result.put("sevenDaysTotal", sevenDaysArray);
|
||||
|
||||
result.put("success", true);
|
||||
result.put("companyKey", companyKey);
|
||||
result.put("tableName", waterVolumeLJLLService.buildTableName(companyKey));
|
||||
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "获取统计数据失败:" + e.getMessage());
|
||||
}
|
||||
|
||||
model.addAttribute("result", result.toString());
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化金额,保留2位小数
|
||||
*/
|
||||
private String formatAmount(BigDecimal amount) {
|
||||
if (amount == null) {
|
||||
return "0.00";
|
||||
}
|
||||
return amount.setScale(2, RoundingMode.HALF_UP).toPlainString();
|
||||
}
|
||||
}
|
||||
@ -144,15 +144,17 @@ public class KPIPointController {
|
||||
public String doview(HttpServletRequest request,Model model){
|
||||
String userId = request.getParameter("id");
|
||||
KPIPoint kPIPoint = this.kPIPointService.selectById(userId);
|
||||
// 保存原始bizid用于MPoint查询
|
||||
String originalBizid = kPIPoint.getBizid();
|
||||
ProcessSection processSection = this.processSectionService.selectById(kPIPoint.getProcesssectionid());
|
||||
if (processSection != null) {
|
||||
kPIPoint.setProcessectionname(processSection.getName());
|
||||
}
|
||||
Company company = this.unitService.getCompById(kPIPoint.getBizid());
|
||||
Company company = this.unitService.getCompById(originalBizid);
|
||||
if (company != null) {
|
||||
kPIPoint.setBizid(company.getName());
|
||||
}
|
||||
MPoint mPoint = this.mPointService.selectById(kPIPoint.getBizid(),kPIPoint.getMpointid());
|
||||
MPoint mPoint = this.mPointService.selectById(originalBizid,kPIPoint.getMpointid());
|
||||
if (mPoint != null) {
|
||||
kPIPoint.setMpointname(mPoint.getParmname());
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.sipai.controller.work;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sipai.dao.repository.MPointRepo;
|
||||
import com.sipai.entity.base.Result;
|
||||
import com.sipai.entity.data.CurveMpoint;
|
||||
import com.sipai.entity.data.CurveRemark;
|
||||
@ -18,6 +19,7 @@ import com.sipai.entity.user.*;
|
||||
import com.sipai.entity.visual.JspElement;
|
||||
import com.sipai.entity.visual.VisualCacheData;
|
||||
import com.sipai.entity.work.MeasurePoint_DATA;
|
||||
import com.sipai.entity.work.MPointES;
|
||||
import com.sipai.entity.work.OverviewProduce;
|
||||
import com.sipai.entity.work.OverviewProduceBlot;
|
||||
import com.sipai.service.company.CompanyService;
|
||||
@ -63,10 +65,14 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.search.sort.SortBuilders;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.redisson.api.RMapCache;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
|
||||
import org.springframework.data.elasticsearch.core.query.SearchQuery;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
@ -84,13 +90,16 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/work/mpoint")
|
||||
public class MPointController {
|
||||
private static final Logger logger = Logger.getLogger(MPointController.class);
|
||||
@Resource
|
||||
private MPointService mPointService;
|
||||
@Resource
|
||||
@ -157,6 +166,10 @@ public class MPointController {
|
||||
private CompanyService companyService;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Autowired
|
||||
private MPointRepo mPointRepo;
|
||||
@Resource
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
/**
|
||||
* 从数据库查数据
|
||||
@ -414,150 +427,287 @@ public class MPointController {
|
||||
@RequestParam(value = "order", required = false) String order) {
|
||||
String companyId = request.getParameter("companyId");
|
||||
sort = "morder";
|
||||
SortOrder sortOrder = null;
|
||||
// if (order == null || order == "asc") {
|
||||
// sortOrder = SortOrder.ASC;
|
||||
// } else {
|
||||
// sortOrder = SortOrder.DESC;
|
||||
// }
|
||||
sortOrder = SortOrder.ASC;
|
||||
NativeSearchQueryBuilder nativeSearchQueryBuilder = new NativeSearchQueryBuilder();
|
||||
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
||||
SortOrder sortOrder = SortOrder.ASC;
|
||||
|
||||
BoolQueryBuilder childBoolQueryBuilder = QueryBuilders.boolQuery();
|
||||
// 获取查询参数
|
||||
String searchName = request.getParameter("search_name");
|
||||
String searchCode = request.getParameter("search_code");
|
||||
String pSectionId = request.getParameter("pSectionId");
|
||||
String type = request.getParameter("type");
|
||||
String signaltype = request.getParameter("signaltype");
|
||||
|
||||
if (searchName != null && !searchName.isEmpty()) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.wildcardQuery("parmname.keyword", "*" + searchName + "*"));
|
||||
}
|
||||
if (searchCode != null && !searchCode.isEmpty()) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.wildcardQuery("mpointcode.keyword", "*" + searchCode + "*"));
|
||||
// childBoolQueryBuilder.must(QueryBuilders.matchPhrasePrefixQuery("mpointcode", searchCode));
|
||||
}
|
||||
if (type != null && !type.isEmpty() && !type.equals("all")) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchPhraseQuery("source_type", type));
|
||||
}
|
||||
if (pSectionId != null && !pSectionId.isEmpty() && !pSectionId.equals("")) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchPhraseQuery("processsectioncode", pSectionId));
|
||||
}
|
||||
if (signaltype != null && !signaltype.isEmpty() && !signaltype.equals("-1") && !signaltype.equals("") && !signaltype.equals("all")) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchPhraseQuery("signaltype", signaltype));
|
||||
}
|
||||
|
||||
//设备id
|
||||
if (request.getParameter("pid") != null && !request.getParameter("pid").isEmpty()) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchPhraseQuery("equipmentid", request.getParameter("pid")));
|
||||
}
|
||||
|
||||
//设备编号
|
||||
if (request.getParameter("equipmentcardId") != null && !request.getParameter("equipmentcardId").isEmpty()) {
|
||||
EquipmentCard equipmentCard = equipmentCardService.getEquipmentByEquipmentCardId(request.getParameter("equipmentcardId"));
|
||||
if (equipmentCard != null) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchPhraseQuery("equipmentid", equipmentCard.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
// if (request.getParameter("signaltag") != null && !request.getParameter("signaltag").isEmpty()) {
|
||||
// String signalTag = request.getParameter("signaltag").replace(",", " ");
|
||||
// childBoolQueryBuilder.must(QueryBuilders.matchQuery("signaltag", signalTag));
|
||||
// }
|
||||
|
||||
// childBoolQueryBuilder.must(QueryBuilders.matchQuery("bizid", companyId));
|
||||
|
||||
String unitId = request.getParameter("unitId");
|
||||
|
||||
if (unitId != null && !unitId.isEmpty()) {
|
||||
List<Unit> units = this.unitService.getChildrenCBWByUnitId(unitId);
|
||||
Unit unit = this.unitService.getUnitById(unitId);
|
||||
if (unit != null) {
|
||||
units.add(unit);
|
||||
// 比对ES全量数据总数和数据库全量数据总数
|
||||
long dbCount = this.mPointService.getDbTotalCount();
|
||||
long esCount = 0;
|
||||
try {
|
||||
esCount = this.mPointService.getEsTotalCount();
|
||||
} catch (Exception e) {
|
||||
logger.warn("ES数据查询异常,跳过ES", e);
|
||||
}
|
||||
logger.info("getlistES数据比对 -> DB总数:" + dbCount + ", ES总数:" + esCount);
|
||||
|
||||
String result;
|
||||
if (dbCount != esCount) {
|
||||
// 数据不一致,将数据库全量数据更新到ES
|
||||
logger.info("ES与DB数据总数不一致,执行全量同步并返回数据库结果");
|
||||
try {
|
||||
this.syncAllDbDataToEs();
|
||||
} catch (Exception e) {
|
||||
logger.error("执行全量同步ES异常:", e);
|
||||
}
|
||||
//二次查询
|
||||
|
||||
String bizids = "";
|
||||
|
||||
//根据搜索关键字如果存在对应组织id,并且在搜索的bizid范围内,则将关键字搜索优先搜索
|
||||
// 构建数据库查询条件,返回数据库结果至前端
|
||||
String wherestr = " where 1=1 ";
|
||||
if (searchName != null && !searchName.isEmpty()) {
|
||||
int lastMatchNum = 1;
|
||||
String keyword = "";
|
||||
char[] sNchars = searchName.toCharArray();
|
||||
// logger.info("units--"+JSONArray.fromObject(units).toString());
|
||||
for (int u = 0; u < units.size(); u++) {
|
||||
int matchNum = 0;
|
||||
for (char item : sNchars) {
|
||||
if (units.get(u).getSname().contains(String.valueOf(item))) {
|
||||
matchNum++;
|
||||
wherestr += " and (parmname like '%" + searchName + "%' or mpointcode like '%" + searchName + "%')";
|
||||
}
|
||||
if (searchCode != null && !searchCode.isEmpty()) {
|
||||
wherestr += " and mpointcode like '%" + searchCode + "%' ";
|
||||
}
|
||||
if (type != null && !type.isEmpty() && !type.equals("all")) {
|
||||
wherestr += " and source_type = '" + type + "' ";
|
||||
}
|
||||
if (pSectionId != null && !pSectionId.isEmpty()) {
|
||||
wherestr += " and processSectionCode = '" + pSectionId + "' ";
|
||||
}
|
||||
if (signaltype != null && !signaltype.isEmpty() && !signaltype.equals("-1") && !signaltype.equals("all")) {
|
||||
wherestr += " and SignalType = '" + signaltype + "' ";
|
||||
}
|
||||
// 设备id
|
||||
if (request.getParameter("pid") != null && !request.getParameter("pid").isEmpty()) {
|
||||
wherestr += " and equipmentId = '" + request.getParameter("pid") + "' ";
|
||||
}
|
||||
// 设备编号
|
||||
if (request.getParameter("equipmentcardId") != null && !request.getParameter("equipmentcardId").isEmpty()) {
|
||||
EquipmentCard equipmentCard = equipmentCardService.getEquipmentByEquipmentCardId(request.getParameter("equipmentcardId"));
|
||||
if (equipmentCard != null) {
|
||||
wherestr += " and equipmentId = '" + equipmentCard.getId() + "' ";
|
||||
}
|
||||
}
|
||||
// unitId -> bizid 过滤
|
||||
if (unitId != null && !unitId.isEmpty()) {
|
||||
List<Unit> units = this.unitService.getChildrenCBWByUnitId(unitId);
|
||||
Unit unit = this.unitService.getUnitById(unitId);
|
||||
if (unit != null) {
|
||||
units.add(unit);
|
||||
}
|
||||
if (units.size() > 0) {
|
||||
String bizids = "";
|
||||
for (int u = 0; u < units.size(); u++) {
|
||||
if (!bizids.isEmpty()) {
|
||||
bizids += "','";
|
||||
}
|
||||
bizids += units.get(u).getId();
|
||||
}
|
||||
// logger.info("unit-match--"+u+"--"+matchNum);
|
||||
if (matchNum > lastMatchNum) {
|
||||
keyword = units.get(u).getId();
|
||||
}
|
||||
wherestr += " and bizid in ('" + bizids + "') ";
|
||||
}
|
||||
}
|
||||
|
||||
String orderstr = " order by " + sort + " asc ";
|
||||
PageHelper.startPage(page, rows);
|
||||
List<MPoint> list = this.mPointService.selectListByWhere(companyId, wherestr + orderstr);
|
||||
// 查询工艺段
|
||||
for (MPoint mp : list) {
|
||||
List<ProcessSection> processSections = processSectionService.selectSimpleListByWhere("where code = '" + mp.getProcesssectioncode() + "'");
|
||||
if (processSections != null && processSections.size() > 0) {
|
||||
mp.setProcessSection(processSections.get(0));
|
||||
}
|
||||
if (!keyword.isEmpty()) {
|
||||
units = this.getParent(keyword, units);
|
||||
//关键字提前,优先搜索
|
||||
bizids = keyword;
|
||||
}
|
||||
// logger.info("units---match--"+JSONArray.fromObject(units).toString());
|
||||
}
|
||||
for (int u = 0; u < units.size(); u++) {
|
||||
// if(!CommString.UNIT_TYPE_DEPT.equals(units.get(u).getType()) && !CommString.UNIT_TYPE_USER.equals(units.get(u).getType()) ){
|
||||
if (!bizids.isEmpty()) {
|
||||
bizids += " ";
|
||||
// 取redis点位数据最新值,没有就是0
|
||||
for (MPoint mPoint : list) {
|
||||
String id = mPoint.getId();
|
||||
int num = mPoint.getId().hashCode() % 25;
|
||||
RMapCache<String, String> map_redis_data = redissonClient.getMapCache(CommString.RedisMpointFlag + num);
|
||||
if (map_redis_data.get(id) != null && !"".equals(map_redis_data.get(id))) {
|
||||
String[] str = map_redis_data.get(id).split(";");
|
||||
if (str.length >= 3 && str[1] != null && !str[1].isEmpty() && !"null".equals(str[1])) {
|
||||
mPoint.setParmvalue(new BigDecimal(str[1]));
|
||||
mPoint.setMeasuredt(str[2]);
|
||||
} else {
|
||||
mPoint.setParmvalue(BigDecimal.ZERO);
|
||||
}
|
||||
}
|
||||
bizids += units.get(u).getId();
|
||||
// }
|
||||
}
|
||||
// System.out.println("测量点搜索查询bizId--" + bizids);
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchQuery("bizid", bizids));
|
||||
PageInfo<MPoint> pi = new PageInfo<MPoint>(list);
|
||||
JSONArray json = JSONArray.fromObject(list);
|
||||
result = "{\"total\":" + pi.getTotal() + ",\"rows\":" + json + "}";
|
||||
} else {
|
||||
// 数据一致,直接返回ES数据至前端
|
||||
NativeSearchQueryBuilder nativeSearchQueryBuilder = new NativeSearchQueryBuilder();
|
||||
BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
|
||||
BoolQueryBuilder childBoolQueryBuilder = QueryBuilders.boolQuery();
|
||||
|
||||
if (searchName != null && !searchName.isEmpty()) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.wildcardQuery("parmname.keyword", "*" + searchName + "*"));
|
||||
}
|
||||
if (searchCode != null && !searchCode.isEmpty()) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.wildcardQuery("mpointcode.keyword", "*" + searchCode + "*"));
|
||||
}
|
||||
if (type != null && !type.isEmpty() && !type.equals("all")) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchPhraseQuery("source_type", type));
|
||||
}
|
||||
if (pSectionId != null && !pSectionId.isEmpty() && !pSectionId.equals("")) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchPhraseQuery("processsectioncode", pSectionId));
|
||||
}
|
||||
if (signaltype != null && !signaltype.isEmpty() && !signaltype.equals("-1") && !signaltype.equals("") && !signaltype.equals("all")) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchPhraseQuery("signaltype", signaltype));
|
||||
}
|
||||
|
||||
// 设备id
|
||||
if (request.getParameter("pid") != null && !request.getParameter("pid").isEmpty()) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchPhraseQuery("equipmentid", request.getParameter("pid")));
|
||||
}
|
||||
|
||||
// 设备编号
|
||||
if (request.getParameter("equipmentcardId") != null && !request.getParameter("equipmentcardId").isEmpty()) {
|
||||
EquipmentCard equipmentCard = equipmentCardService.getEquipmentByEquipmentCardId(request.getParameter("equipmentcardId"));
|
||||
if (equipmentCard != null) {
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchPhraseQuery("equipmentid", equipmentCard.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
if (unitId != null && !unitId.isEmpty()) {
|
||||
List<Unit> units = this.unitService.getChildrenCBWByUnitId(unitId);
|
||||
Unit unit = this.unitService.getUnitById(unitId);
|
||||
if (unit != null) {
|
||||
units.add(unit);
|
||||
}
|
||||
|
||||
StringBuilder bizids = new StringBuilder();
|
||||
if (searchName != null && !searchName.isEmpty()) {
|
||||
String keyword = getKeyword(searchName, units);
|
||||
if (!keyword.isEmpty()) {
|
||||
units = this.getParent(keyword, units);
|
||||
bizids = new StringBuilder(keyword);
|
||||
}
|
||||
}
|
||||
for (Unit value : units) {
|
||||
if (bizids.length() > 0) {
|
||||
bizids.append(" ");
|
||||
}
|
||||
bizids.append(value.getId());
|
||||
}
|
||||
childBoolQueryBuilder.must(QueryBuilders.matchQuery("bizid", bizids.toString()));
|
||||
}
|
||||
|
||||
boolQueryBuilder.should(childBoolQueryBuilder);
|
||||
nativeSearchQueryBuilder.withSort(SortBuilders.fieldSort(sort).order(sortOrder));
|
||||
nativeSearchQueryBuilder.withQuery(boolQueryBuilder);
|
||||
nativeSearchQueryBuilder.withPageable(PageRequest.of(page - 1, rows));
|
||||
Page<MPoint> list = this.selectListByES(nativeSearchQueryBuilder);
|
||||
|
||||
// 查询工艺段
|
||||
for (MPoint mp : list) {
|
||||
List<ProcessSection> processSections = processSectionService.selectSimpleListByWhere("where code = '" + mp.getProcesssectioncode() + "'");
|
||||
if (processSections != null && !processSections.isEmpty()) {
|
||||
mp.setProcessSection(processSections.get(0));
|
||||
}
|
||||
}
|
||||
// 取redis点位数据最新值,没有就是0
|
||||
for (MPoint mPoint : list) {
|
||||
String id = mPoint.getId();
|
||||
int num = mPoint.getId().hashCode() % 25;
|
||||
RMapCache<String, String> map_redis_data = redissonClient.getMapCache(CommString.RedisMpointFlag + num);
|
||||
if (map_redis_data.get(id) != null && !"".equals(map_redis_data.get(id))) {
|
||||
String[] str = map_redis_data.get(id).split(";");
|
||||
if (str.length >= 3 && str[1] != null && !str[1].isEmpty() && !"null".equals(str[1])) {
|
||||
mPoint.setParmvalue(new BigDecimal(str[1]));
|
||||
mPoint.setMeasuredt(str[2]);
|
||||
} else {
|
||||
mPoint.setParmvalue(BigDecimal.ZERO);
|
||||
}
|
||||
}
|
||||
}
|
||||
JSONArray json = JSONArray.fromObject(list.getContent());
|
||||
result = "{\"total\":" + list.getTotalElements() + ",\"rows\":" + json + "}";
|
||||
}
|
||||
|
||||
|
||||
// System.out.println("---查询条件--" + childBoolQueryBuilder.toString());
|
||||
boolQueryBuilder.should(childBoolQueryBuilder);
|
||||
nativeSearchQueryBuilder.withSort(SortBuilders.fieldSort(sort).order(sortOrder));
|
||||
nativeSearchQueryBuilder.withQuery(boolQueryBuilder);
|
||||
|
||||
// Page<MPoint> list= this.mPointService.selectListByES(nativeSearchQueryBuilder);
|
||||
|
||||
// int total = list.size();
|
||||
nativeSearchQueryBuilder.withPageable(PageRequest.of(page - 1, rows));
|
||||
Page<MPoint> list = this.mPointService.selectListByES(nativeSearchQueryBuilder);
|
||||
|
||||
|
||||
/*for (MPoint mp : list) {
|
||||
Unit unit = this.unitService.getUnitById(mp.getBizid());
|
||||
if (unit != null) {
|
||||
String unitName = unit.getSname();
|
||||
if (unitName == null || unitName.isEmpty()) {
|
||||
unitName = unit.getName();
|
||||
}
|
||||
mp.setBizname(unitName);
|
||||
}
|
||||
}*/
|
||||
|
||||
//查询工艺段
|
||||
for (MPoint mp : list) {
|
||||
List<ProcessSection> processSections = processSectionService.selectSimpleListByWhere("where code = '" + mp.getProcesssectioncode() + "'");
|
||||
if (processSections != null && processSections.size() > 0) {
|
||||
mp.setProcessSection(processSections.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
JSONArray json = JSONArray.fromObject(list.getContent());
|
||||
|
||||
|
||||
String result = "{\"total\":" + list.getTotalElements() + ",\"rows\":" + json + "}";
|
||||
model.addAttribute("result", result);
|
||||
return new ModelAndView("result");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ES搜索查询,返回Page类型
|
||||
*
|
||||
* @param nativeSearchQueryBuilder
|
||||
* @return
|
||||
*/
|
||||
public Page<MPoint> selectListByES(NativeSearchQueryBuilder nativeSearchQueryBuilder) {
|
||||
SearchQuery searchQuery = nativeSearchQueryBuilder.build();
|
||||
Page<MPoint> mPage = mPointRepo.search(searchQuery);
|
||||
for (MPoint mPoint : mPage) {
|
||||
if (mPoint.getNumtail() != null) {
|
||||
BigDecimal value = CommUtil.formatMPointValue(mPoint.getParmvalue(), mPoint.getNumtail(), mPoint.getRate());
|
||||
if (value != null) {
|
||||
try {
|
||||
mPoint.setParmvalue(value);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (mPoint.getBizid() != null && !mPoint.getBizid().isEmpty()) {
|
||||
Unit unit = this.unitService.getUnitById(mPoint.getBizid());
|
||||
if (unit != null) {
|
||||
String unitName = unit.getSname();
|
||||
if (unitName == null || unitName.isEmpty()) {
|
||||
unitName = unit.getName();
|
||||
}
|
||||
mPoint.setBizname(unitName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mPage;
|
||||
}
|
||||
|
||||
public void syncAllDbDataToEs() {
|
||||
logger.info("ES与数据库数据总数不一致,开始全量同步数据库数据到ES...");
|
||||
MPoint query = new MPoint();
|
||||
query.setWhere("where 1=1");
|
||||
List<MPoint> allDbData = mPointService.selectListAllByWhere(query);
|
||||
if (allDbData != null && !allDbData.isEmpty()) {
|
||||
List<MPointES> esList = new ArrayList<>();
|
||||
for (MPoint mPoint : allDbData) {
|
||||
try {
|
||||
MPointES mPointES = MPointES.format(mPoint);
|
||||
esList.add(mPointES);
|
||||
} catch (Exception e) {
|
||||
logger.error("转换MPointES失败, id=" + mPoint.getId() + ", error=" + e.getMessage());
|
||||
}
|
||||
}
|
||||
if (!esList.isEmpty()) {
|
||||
try {
|
||||
mPointRepo.saveAll(esList);
|
||||
logger.info("全量同步完成,共同步 " + esList.size() + " 条数据到ES");
|
||||
} catch (Exception e) {
|
||||
logger.error("批量保存ES失败: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String getKeyword(String searchName, List<Unit> units) {
|
||||
int lastMatchNum = 1;
|
||||
String keyword = "";
|
||||
char[] sNchars = searchName.toCharArray();
|
||||
for (int u = 0; u < units.size(); u++) {
|
||||
int matchNum = 0;
|
||||
for (char item : sNchars) {
|
||||
if (units.get(u).getSname().contains(String.valueOf(item))) {
|
||||
matchNum++;
|
||||
}
|
||||
}
|
||||
if (matchNum > lastMatchNum) {
|
||||
keyword = units.get(u).getId();
|
||||
}
|
||||
}
|
||||
return keyword;
|
||||
}
|
||||
|
||||
@RequestMapping("/getKPIList.do")
|
||||
public ModelAndView getKPIList(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "page") Integer page,
|
||||
@ -1472,7 +1622,7 @@ public class MPointController {
|
||||
mPointExpandService.update(mPoint.getBizid(), mPointExpand);
|
||||
} else {
|
||||
MPointExpand mPointExpand2 = new MPointExpand();
|
||||
mPointExpand2.setId(CommUtil.getUUID());
|
||||
// mPointExpand2.setId(CommUtil.getUUID());
|
||||
mPointExpand2.setInsdt(CommUtil.nowDate());
|
||||
mPointExpand2.setExplain(explain);
|
||||
mPointExpand2.setMeasurePointId(mPoint.getId());
|
||||
@ -4002,8 +4152,15 @@ public class MPointController {
|
||||
for (int i = 0; i < ids.length; i++) {
|
||||
com.alibaba.fastjson.JSONObject jsonObject2 = new com.alibaba.fastjson.JSONObject();
|
||||
|
||||
//通过es查询bizid
|
||||
MPoint mPoint_es = mPointService.selectById(ids[i]);
|
||||
//通过数据库查询测点(优先通过unitId和测点编码查询)
|
||||
MPoint mPoint_es = mPointService.selectById(unitId, ids[i]);
|
||||
if (mPoint_es == null) {
|
||||
// 尝试通过测点编码查询
|
||||
List<MPoint> mPointList = mPointService.selectListByWhere(unitId, "where mpointcode='" + ids[i] + "'");
|
||||
if (mPointList != null && mPointList.size() > 0) {
|
||||
mPoint_es = mPointList.get(0);
|
||||
}
|
||||
}
|
||||
if (mPoint_es != null) {
|
||||
unitId = mPoint_es.getBizid();
|
||||
|
||||
@ -4483,7 +4640,7 @@ public class MPointController {
|
||||
}
|
||||
|
||||
PageHelper.startPage(page, rows);
|
||||
List<MPointHistory> list = mPointHistoryService.selectMpHisDataLeftMpHisChange(bizid, mpid,"'"+mpid+"'", wherestr + orderstr, dbname);
|
||||
List<MPointHistory> list = mPointHistoryService.selectMpHisDataLeftMpHisChange(bizid, mpid, "'" + mpid + "'", wherestr + orderstr, dbname);
|
||||
PageInfo<MPointHistory> pi = new PageInfo<MPointHistory>(list);
|
||||
JSONArray json = JSONArray.fromObject(list);
|
||||
|
||||
@ -4631,7 +4788,7 @@ public class MPointController {
|
||||
*/
|
||||
@RequestMapping("/hisDataImportExcel.do")
|
||||
public ModelAndView hisDataImportExcel(@RequestParam(value = "filelist", required = false)
|
||||
MultipartFile file, HttpServletRequest request, Model model) throws IOException {
|
||||
MultipartFile file, HttpServletRequest request, Model model) throws IOException {
|
||||
MultipartRequest multipartRequest = (MultipartRequest) request;
|
||||
MultipartFile excelFile = multipartRequest.getFile("filelist");
|
||||
|
||||
@ -4672,7 +4829,7 @@ public class MPointController {
|
||||
*/
|
||||
@RequestMapping("/hisDataMultipleImportExcel.do")
|
||||
public ModelAndView hisDataMultipleImportExcel(@RequestParam(value = "filelist", required = false)
|
||||
MultipartFile file, HttpServletRequest request, Model model) throws IOException {
|
||||
MultipartFile file, HttpServletRequest request, Model model) throws IOException {
|
||||
MultipartRequest multipartRequest = (MultipartRequest) request;
|
||||
MultipartFile excelFile = multipartRequest.getFile("filelist");
|
||||
|
||||
@ -4822,7 +4979,7 @@ public class MPointController {
|
||||
*/
|
||||
@RequestMapping("/saveExcelData.do")
|
||||
public ModelAndView dosaveExcelData(@RequestParam(value = "filelist", required = false)
|
||||
MultipartFile file, HttpServletRequest request, Model model) throws IOException {
|
||||
MultipartFile file, HttpServletRequest request, Model model) throws IOException {
|
||||
MultipartRequest multipartRequest = (MultipartRequest) request;
|
||||
MultipartFile excelFile = multipartRequest.getFile("filelist");
|
||||
|
||||
|
||||
@ -133,6 +133,9 @@ public class SchedulingController {
|
||||
public String doadd(HttpServletRequest request, Model model,
|
||||
@RequestParam(value = "date") String date) {
|
||||
model.addAttribute("date", date.substring(0, 10));
|
||||
if(request.getParameter("bizid") != null && !request.getParameter("bizid").isEmpty()){
|
||||
model.addAttribute("bizid", request.getParameter("bizid"));
|
||||
}
|
||||
return "work/schedulingAdd";
|
||||
}
|
||||
|
||||
@ -142,6 +145,9 @@ public class SchedulingController {
|
||||
String wherestr = " where s.id = '" + schedulingId + "'";
|
||||
List<Scheduling> scheduling = this.schedulingService.selectCalenderListByWhere(wherestr);
|
||||
model.addAttribute("scheduling", scheduling.get(0));
|
||||
if(request.getParameter("bizid") != null && !request.getParameter("bizid").isEmpty()){
|
||||
model.addAttribute("bizid", request.getParameter("bizid"));
|
||||
}
|
||||
return "work/schedulingEdit";
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
package com.sipai.dao.administration;
|
||||
|
||||
import com.sipai.dao.base.CommDaoImpl;
|
||||
import com.sipai.entity.administration.LeaveApply;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class LeaveApplyDao extends CommDaoImpl<LeaveApply> {
|
||||
public LeaveApplyDao() {
|
||||
super();
|
||||
this.setMappernamespace("administration.LeaveApplyMapper");
|
||||
}
|
||||
}
|
||||
@ -4,10 +4,34 @@ import com.sipai.dao.base.CommDaoImpl;
|
||||
import com.sipai.entity.pipeline.PipelineData;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public class PipelineDataDao extends CommDaoImpl<PipelineData> {
|
||||
public PipelineDataDao() {
|
||||
super();
|
||||
this.setMappernamespace("pipeline.PipelineDataMapper");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取按材质分组的统计数据
|
||||
*/
|
||||
public List<Map<String, Object>> selectMaterialStats() {
|
||||
return this.getSqlSession().selectList(this.getMappernamespace() + ".selectMaterialStats");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取总统计数据
|
||||
*/
|
||||
public Map<String, Object> selectTotalStats() {
|
||||
return this.getSqlSession().selectOne(this.getMappernamespace() + ".selectTotalStats");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取按管径分组的统计数据
|
||||
*/
|
||||
public List<Map<String, Object>> selectDiameterStats() {
|
||||
return this.getSqlSession().selectList(this.getMappernamespace() + ".selectDiameterStats");
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,10 @@ public class MPointDao extends CommDaoImpl<MPoint>{
|
||||
return list;
|
||||
}
|
||||
|
||||
public long selectCount() {
|
||||
return getSqlSession().selectOne("scada.MPointMapper.selectCount");
|
||||
}
|
||||
|
||||
public MPoint selectByMpointCode(String mpointcode){
|
||||
MPoint mPoint = this.getSqlSession().selectOne("scada.MPointMapper.selectByMpointCode", mpointcode);
|
||||
return mPoint;
|
||||
|
||||
82
src/main/java/com/sipai/dao/scada/MPointDataDao.java
Normal file
82
src/main/java/com/sipai/dao/scada/MPointDataDao.java
Normal file
@ -0,0 +1,82 @@
|
||||
package com.sipai.dao.scada;
|
||||
|
||||
import com.sipai.dao.base.CommDaoImpl;
|
||||
import com.sipai.entity.scada.MPointData;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public class MPointDataDao extends CommDaoImpl<MPointData> {
|
||||
|
||||
private static final String MAPPER_NAMESPACE = "scada.MPointDataMapper";
|
||||
|
||||
public MPointDataDao() {
|
||||
super();
|
||||
this.setMappernamespace(MAPPER_NAMESPACE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最新一条数据(当前值)
|
||||
* @param tableName 表名
|
||||
* @param companyKey 公司编码(可选)
|
||||
* @param startTime 开始时间(可选)
|
||||
* @param endTime 结束时间(可选)
|
||||
* @return 最新一条数据
|
||||
*/
|
||||
public MPointData selectLatest(String tableName, String companyKey,
|
||||
java.util.Date startTime, java.util.Date endTime) {
|
||||
Map<String, Object> params = new java.util.HashMap<>();
|
||||
params.put("tableName", tableName);
|
||||
params.put("companyKey", companyKey);
|
||||
params.put("startTime", startTime);
|
||||
params.put("endTime", endTime);
|
||||
return this.getSqlSession().selectOne(MAPPER_NAMESPACE + ".selectLatest", params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取统计数据
|
||||
* @param tableName 表名
|
||||
* @param companyKey 公司编码(可选)
|
||||
* @param startTime 开始时间(可选)
|
||||
* @param endTime 结束时间(可选)
|
||||
* @return 统计数据(avgValue, maxValue, minValue, totalCount)
|
||||
*/
|
||||
public Map<String, Object> selectStatistics(String tableName, String companyKey,
|
||||
java.util.Date startTime, java.util.Date endTime) {
|
||||
Map<String, Object> params = new java.util.HashMap<>();
|
||||
params.put("tableName", tableName);
|
||||
params.put("companyKey", companyKey);
|
||||
params.put("startTime", startTime);
|
||||
params.put("endTime", endTime);
|
||||
return this.getSqlSession().selectOne(MAPPER_NAMESPACE + ".selectStatistics", params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查表是否存在
|
||||
* @param tableName 表名
|
||||
* @return 是否存在
|
||||
*/
|
||||
public boolean checkTableExists(String tableName) {
|
||||
Integer count = this.getSqlSession().selectOne(MAPPER_NAMESPACE + ".checkTableExists", tableName);
|
||||
return count != null && count > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 按天汇总统计
|
||||
* @param tableName 表名
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 每天汇总数据列表(dateStr, totalValue, dataCount)
|
||||
*/
|
||||
public List<Map<String, Object>> selectDailyAggregation(String tableName,
|
||||
java.util.Date startTime,
|
||||
java.util.Date endTime) {
|
||||
Map<String, Object> params = new java.util.HashMap<>();
|
||||
params.put("tableName", tableName);
|
||||
params.put("startTime", startTime);
|
||||
params.put("endTime", endTime);
|
||||
return this.getSqlSession().selectList(MAPPER_NAMESPACE + ".selectDailyAggregation", params);
|
||||
}
|
||||
}
|
||||
78
src/main/java/com/sipai/dao/scada/WaterVolumeLJLLDao.java
Normal file
78
src/main/java/com/sipai/dao/scada/WaterVolumeLJLLDao.java
Normal file
@ -0,0 +1,78 @@
|
||||
package com.sipai.dao.scada;
|
||||
|
||||
import com.sipai.dao.base.CommDaoImpl;
|
||||
import com.sipai.entity.scada.WaterVolumeLJLL;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Repository
|
||||
public class WaterVolumeLJLLDao extends CommDaoImpl<WaterVolumeLJLL> {
|
||||
|
||||
private static final String MAPPER_NAMESPACE = "scada.WaterVolumeLJLLMapper";
|
||||
|
||||
public WaterVolumeLJLLDao() {
|
||||
super();
|
||||
this.setMappernamespace(MAPPER_NAMESPACE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取今日处理总量
|
||||
* @param tableName 表名(如:tb_mp_DEV022_LJLL)
|
||||
* @return 今日处理总量
|
||||
*/
|
||||
public BigDecimal selectTodayTotal(String tableName) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("tableName", tableName);
|
||||
BigDecimal result = this.getSqlSession().selectOne(MAPPER_NAMESPACE + ".selectTodayTotal", params);
|
||||
return result != null ? result : BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取昨日处理总量
|
||||
* @param tableName 表名
|
||||
* @return 昨日处理总量
|
||||
*/
|
||||
public BigDecimal selectYesterdayTotal(String tableName) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("tableName", tableName);
|
||||
BigDecimal result = this.getSqlSession().selectOne(MAPPER_NAMESPACE + ".selectYesterdayTotal", params);
|
||||
return result != null ? result : BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本月累计总量
|
||||
* @param tableName 表名
|
||||
* @return 本月累计总量
|
||||
*/
|
||||
public BigDecimal selectMonthTotal(String tableName) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("tableName", tableName);
|
||||
BigDecimal result = this.getSqlSession().selectOne(MAPPER_NAMESPACE + ".selectMonthTotal", params);
|
||||
return result != null ? result : BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取七日水量处理总量
|
||||
* @param tableName 表名
|
||||
* @return 七日水量列表
|
||||
*/
|
||||
public List<Map<String, Object>> selectSevenDaysTotal(String tableName) {
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("tableName", tableName);
|
||||
return this.getSqlSession().selectList(MAPPER_NAMESPACE + ".selectSevenDaysTotal", params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查表是否存在
|
||||
* @param tableName 表名
|
||||
* @return 是否存在
|
||||
*/
|
||||
public boolean checkTableExists(String tableName) {
|
||||
Integer count = this.getSqlSession().selectOne(MAPPER_NAMESPACE + ".checkTableExists", tableName);
|
||||
return count != null && count > 0;
|
||||
}
|
||||
}
|
||||
@ -50,6 +50,8 @@ public enum ProcessType {
|
||||
Administration_Reserve("Administration_Reserve","预案工作"),
|
||||
/*预案*/
|
||||
Administration_Temporary("Administration_Temporary","临时任务"),
|
||||
/*请假补假*/
|
||||
Administration_Leave("Administration_Leave","请假补假"),
|
||||
/*工艺调整*/
|
||||
Process_Adjustment("Process_Adjustment","工艺调整"),
|
||||
/*水质化验*/
|
||||
|
||||
267
src/main/java/com/sipai/entity/administration/LeaveApply.java
Normal file
267
src/main/java/com/sipai/entity/administration/LeaveApply.java
Normal file
@ -0,0 +1,267 @@
|
||||
package com.sipai.entity.administration;
|
||||
|
||||
import com.sipai.entity.base.BusinessUnitAdapter;
|
||||
|
||||
public class LeaveApply extends BusinessUnitAdapter {
|
||||
private String id;
|
||||
private String insdt;
|
||||
private String insuser;
|
||||
private String upduser;
|
||||
private String upddt;
|
||||
private String unitId;
|
||||
private String applyType;
|
||||
private String leaveType;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
private String hours;
|
||||
private String days;
|
||||
private String reason;
|
||||
private String handoverDesc;
|
||||
private String attachmentIds;
|
||||
private String overtimeRefId;
|
||||
private String overtimeHours;
|
||||
private String actualStartTime;
|
||||
private String actualEndTime;
|
||||
private String state;
|
||||
private String stateName;
|
||||
private String auditManId;
|
||||
private String auditMan;
|
||||
private String submissionTime;
|
||||
private String processid;
|
||||
private String processdefid;
|
||||
private String remark;
|
||||
private String delFlag;
|
||||
private String insuserName;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getInsdt() {
|
||||
return insdt;
|
||||
}
|
||||
|
||||
public void setInsdt(String insdt) {
|
||||
this.insdt = insdt;
|
||||
}
|
||||
|
||||
public String getInsuser() {
|
||||
return insuser;
|
||||
}
|
||||
|
||||
public void setInsuser(String insuser) {
|
||||
this.insuser = insuser;
|
||||
}
|
||||
|
||||
public String getUpduser() {
|
||||
return upduser;
|
||||
}
|
||||
|
||||
public void setUpduser(String upduser) {
|
||||
this.upduser = upduser;
|
||||
}
|
||||
|
||||
public String getUpddt() {
|
||||
return upddt;
|
||||
}
|
||||
|
||||
public void setUpddt(String upddt) {
|
||||
this.upddt = upddt;
|
||||
}
|
||||
|
||||
public String getUnitId() {
|
||||
return unitId;
|
||||
}
|
||||
|
||||
public void setUnitId(String unitId) {
|
||||
this.unitId = unitId;
|
||||
}
|
||||
|
||||
public String getApplyType() {
|
||||
return applyType;
|
||||
}
|
||||
|
||||
public void setApplyType(String applyType) {
|
||||
this.applyType = applyType;
|
||||
}
|
||||
|
||||
public String getLeaveType() {
|
||||
return leaveType;
|
||||
}
|
||||
|
||||
public void setLeaveType(String leaveType) {
|
||||
this.leaveType = leaveType;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public void setStartTime(String startTime) {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
public void setEndTime(String endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
public String getHours() {
|
||||
return hours;
|
||||
}
|
||||
|
||||
public void setHours(String hours) {
|
||||
this.hours = hours;
|
||||
}
|
||||
|
||||
public String getDays() {
|
||||
return days;
|
||||
}
|
||||
|
||||
public void setDays(String days) {
|
||||
this.days = days;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public String getHandoverDesc() {
|
||||
return handoverDesc;
|
||||
}
|
||||
|
||||
public void setHandoverDesc(String handoverDesc) {
|
||||
this.handoverDesc = handoverDesc;
|
||||
}
|
||||
|
||||
public String getAttachmentIds() {
|
||||
return attachmentIds;
|
||||
}
|
||||
|
||||
public void setAttachmentIds(String attachmentIds) {
|
||||
this.attachmentIds = attachmentIds;
|
||||
}
|
||||
|
||||
public String getOvertimeRefId() {
|
||||
return overtimeRefId;
|
||||
}
|
||||
|
||||
public void setOvertimeRefId(String overtimeRefId) {
|
||||
this.overtimeRefId = overtimeRefId;
|
||||
}
|
||||
|
||||
public String getOvertimeHours() {
|
||||
return overtimeHours;
|
||||
}
|
||||
|
||||
public void setOvertimeHours(String overtimeHours) {
|
||||
this.overtimeHours = overtimeHours;
|
||||
}
|
||||
|
||||
public String getActualStartTime() {
|
||||
return actualStartTime;
|
||||
}
|
||||
|
||||
public void setActualStartTime(String actualStartTime) {
|
||||
this.actualStartTime = actualStartTime;
|
||||
}
|
||||
|
||||
public String getActualEndTime() {
|
||||
return actualEndTime;
|
||||
}
|
||||
|
||||
public void setActualEndTime(String actualEndTime) {
|
||||
this.actualEndTime = actualEndTime;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getStateName() {
|
||||
return stateName;
|
||||
}
|
||||
|
||||
public void setStateName(String stateName) {
|
||||
this.stateName = stateName;
|
||||
}
|
||||
|
||||
public String getAuditManId() {
|
||||
return auditManId;
|
||||
}
|
||||
|
||||
public void setAuditManId(String auditManId) {
|
||||
this.auditManId = auditManId;
|
||||
}
|
||||
|
||||
public String getAuditMan() {
|
||||
return auditMan;
|
||||
}
|
||||
|
||||
public void setAuditMan(String auditMan) {
|
||||
this.auditMan = auditMan;
|
||||
}
|
||||
|
||||
public String getSubmissionTime() {
|
||||
return submissionTime;
|
||||
}
|
||||
|
||||
public void setSubmissionTime(String submissionTime) {
|
||||
this.submissionTime = submissionTime;
|
||||
}
|
||||
|
||||
public String getProcessid() {
|
||||
return processid;
|
||||
}
|
||||
|
||||
public void setProcessid(String processid) {
|
||||
this.processid = processid;
|
||||
}
|
||||
|
||||
public String getProcessdefid() {
|
||||
return processdefid;
|
||||
}
|
||||
|
||||
public void setProcessdefid(String processdefid) {
|
||||
this.processdefid = processdefid;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getInsuserName() {
|
||||
return insuserName;
|
||||
}
|
||||
|
||||
public void setInsuserName(String insuserName) {
|
||||
this.insuserName = insuserName;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.sipai.entity.administration;
|
||||
|
||||
public class LeaveCommStr {
|
||||
|
||||
public static final String APPLY_TYPE_LEAVE = "leave";
|
||||
public static final String APPLY_TYPE_COMPENSATORY = "compensatory";
|
||||
|
||||
public static final String STATE_DRAFT = "草稿";
|
||||
public static final String STATE_SECTION_AUDIT = "科长/副科长审批";
|
||||
public static final String STATE_MANAGER_AUDIT = "分管经理审批";
|
||||
public static final String STATE_GENERAL_MANAGER_AUDIT = "总经理审批";
|
||||
public static final String STATE_HANDLE = "退回修改";
|
||||
public static final String STATE_FINISH = "已通过";
|
||||
public static final String STATE_REJECT = "已驳回";
|
||||
|
||||
public static final String[][] APPLY_TYPES = {
|
||||
{APPLY_TYPE_LEAVE, "请假"},
|
||||
{APPLY_TYPE_COMPENSATORY, "补假"}
|
||||
};
|
||||
|
||||
public static final String[][] LEAVE_TYPES = {
|
||||
{"annual", "年假"},
|
||||
{"personal", "事假"},
|
||||
{"sick", "病假"},
|
||||
{"marriage", "婚假"},
|
||||
{"maternity", "产假"},
|
||||
{"funeral", "丧假"},
|
||||
{"adjustment", "调休"}
|
||||
};
|
||||
}
|
||||
41
src/main/java/com/sipai/entity/alarm/PipelineAreaEnum.java
Normal file
41
src/main/java/com/sipai/entity/alarm/PipelineAreaEnum.java
Normal file
@ -0,0 +1,41 @@
|
||||
package com.sipai.entity.alarm;
|
||||
|
||||
public enum PipelineAreaEnum {
|
||||
|
||||
PipelineArea_Out_Side("OUT_SIDE", "厂外管道"),
|
||||
PipelineArea_In_Side("In_SIDE", "厂内管道");
|
||||
|
||||
private String code;
|
||||
private String description;
|
||||
|
||||
PipelineAreaEnum(String code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public static PipelineAreaEnum getByCode(String code) {
|
||||
for (PipelineAreaEnum pipelineEnum : PipelineAreaEnum.values()) {
|
||||
if (pipelineEnum.getCode().equals(code)) {
|
||||
return pipelineEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PipelineAreaEnum getByName(String name) {
|
||||
for (PipelineAreaEnum pipelineEnum : PipelineAreaEnum.values()) {
|
||||
if (pipelineEnum.getDescription().equals(name)) {
|
||||
return pipelineEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -115,6 +115,11 @@ public class BusinessUnit extends SQLAdapter {
|
||||
//预案工作审核流程节点
|
||||
public final static String UNIT_Temporary_AUDIT = "temporary_audit";//指标审核
|
||||
public final static String UNIT_Temporary_HANDLE = "temporary_handle";//指标业务处理
|
||||
//请假补假流程节点
|
||||
public final static String UNIT_LEAVE_APPLY_SECTION_AUDIT = "leave_apply_section_audit";
|
||||
public final static String UNIT_LEAVE_APPLY_MANAGER_AUDIT = "leave_apply_manager_audit";
|
||||
public final static String UNIT_LEAVE_APPLY_GENERAL_MANAGER_AUDIT = "leave_apply_general_manager_audit";
|
||||
public final static String UNIT_LEAVE_APPLY_HANDLE = "leave_apply_handle";
|
||||
|
||||
/**
|
||||
* 运行模块
|
||||
|
||||
@ -71,6 +71,24 @@ public class PipelineData extends SQLAdapter implements Serializable {
|
||||
@Column(name = "pipeline_invert_elevation_m", precision = 10, scale = 5)
|
||||
private BigDecimal pipelineInvertElevationM;
|
||||
|
||||
/**
|
||||
* 管道场内场外标识(厂外管道/厂内管道)
|
||||
*/
|
||||
@Column(name = "pipeline_area", length = 20)
|
||||
private String pipelineArea;
|
||||
|
||||
/**
|
||||
* 管道材质
|
||||
*/
|
||||
@Column(name = "pipe_material", length = 50)
|
||||
private String pipeMaterial;
|
||||
|
||||
/**
|
||||
* 所属厂站
|
||||
*/
|
||||
@Column(name = "associated_plant", length = 100)
|
||||
private String associatedPlant;
|
||||
|
||||
// 构造方法
|
||||
public PipelineData() {
|
||||
}
|
||||
@ -148,6 +166,30 @@ public class PipelineData extends SQLAdapter implements Serializable {
|
||||
this.pipelineInvertElevationM = pipelineInvertElevationM;
|
||||
}
|
||||
|
||||
public String getPipelineArea() {
|
||||
return pipelineArea;
|
||||
}
|
||||
|
||||
public void setPipelineArea(String pipelineArea) {
|
||||
this.pipelineArea = pipelineArea;
|
||||
}
|
||||
|
||||
public String getPipeMaterial() {
|
||||
return pipeMaterial;
|
||||
}
|
||||
|
||||
public void setPipeMaterial(String pipeMaterial) {
|
||||
this.pipeMaterial = pipeMaterial;
|
||||
}
|
||||
|
||||
public String getAssociatedPlant() {
|
||||
return associatedPlant;
|
||||
}
|
||||
|
||||
public void setAssociatedPlant(String associatedPlant) {
|
||||
this.associatedPlant = associatedPlant;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PipelineData{" +
|
||||
@ -160,6 +202,9 @@ public class PipelineData extends SQLAdapter implements Serializable {
|
||||
", startGroundElevationM=" + startGroundElevationM +
|
||||
", endGroundElevationM=" + endGroundElevationM +
|
||||
", pipelineInvertElevationM=" + pipelineInvertElevationM +
|
||||
", pipelineArea='" + pipelineArea + '\'' +
|
||||
", pipeMaterial='" + pipeMaterial + '\'' +
|
||||
", associatedPlant='" + associatedPlant + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -22,6 +22,10 @@ public class SafetyStaffArchivesVo extends SafetyStaffArchives {
|
||||
* 性别翻译
|
||||
*/
|
||||
private String sexText;
|
||||
/**
|
||||
* 所属部门ID
|
||||
*/
|
||||
private String pid;
|
||||
/**
|
||||
* 所属部门
|
||||
*/
|
||||
|
||||
@ -38,6 +38,7 @@ public class MPoint extends SQLAdapter implements Serializable {
|
||||
|
||||
private String id;
|
||||
private String mpointid;
|
||||
@Field(type = FieldType.Keyword, normalizer = "my_normalizer")
|
||||
private String mpointcode;
|
||||
// @Field(name="parmname")
|
||||
private String parmname;
|
||||
|
||||
135
src/main/java/com/sipai/entity/scada/MPointData.java
Normal file
135
src/main/java/com/sipai/entity/scada/MPointData.java
Normal file
@ -0,0 +1,135 @@
|
||||
package com.sipai.entity.scada;
|
||||
|
||||
import com.sipai.entity.base.SQLAdapter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 测点数据实体类
|
||||
* 表名规则:tb_mp_{mPointKey}
|
||||
*/
|
||||
public class MPointData extends SQLAdapter implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "ItemID")
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 测量值
|
||||
*/
|
||||
@Column(name = "ParmValue", precision = 18, scale = 4)
|
||||
private BigDecimal parmValue;
|
||||
|
||||
/**
|
||||
* 测量时间
|
||||
*/
|
||||
@Column(name = "MeasureDT")
|
||||
private Date measureDt;
|
||||
|
||||
/**
|
||||
* 备注类型
|
||||
*/
|
||||
@Column(name = "memotype", length = 100)
|
||||
private String memotype;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Column(name = "memo", length = 50)
|
||||
private String memo;
|
||||
|
||||
/**
|
||||
* 用户ID(公司标识)
|
||||
*/
|
||||
@Column(name = "userid", length = 50)
|
||||
private String userid;
|
||||
|
||||
/**
|
||||
* 入库时间
|
||||
*/
|
||||
@Column(name = "insdt")
|
||||
private Date insdt;
|
||||
|
||||
// 构造方法
|
||||
public MPointData() {
|
||||
}
|
||||
|
||||
// Getters 和 Setters
|
||||
public Long getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(Long itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public BigDecimal getParmValue() {
|
||||
return parmValue;
|
||||
}
|
||||
|
||||
public void setParmValue(BigDecimal parmValue) {
|
||||
this.parmValue = parmValue;
|
||||
}
|
||||
|
||||
public Date getMeasureDt() {
|
||||
return measureDt;
|
||||
}
|
||||
|
||||
public void setMeasureDt(Date measureDt) {
|
||||
this.measureDt = measureDt;
|
||||
}
|
||||
|
||||
public String getMemotype() {
|
||||
return memotype;
|
||||
}
|
||||
|
||||
public void setMemotype(String memotype) {
|
||||
this.memotype = memotype;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public void setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
}
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public Date getInsdt() {
|
||||
return insdt;
|
||||
}
|
||||
|
||||
public void setInsdt(Date insdt) {
|
||||
this.insdt = insdt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MPointData{" +
|
||||
"itemId=" + itemId +
|
||||
", parmValue=" + parmValue +
|
||||
", measureDt=" + measureDt +
|
||||
", memotype='" + memotype + '\'' +
|
||||
", memo='" + memo + '\'' +
|
||||
", userid='" + userid + '\'' +
|
||||
", insdt=" + insdt +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
135
src/main/java/com/sipai/entity/scada/WaterVolumeLJLL.java
Normal file
135
src/main/java/com/sipai/entity/scada/WaterVolumeLJLL.java
Normal file
@ -0,0 +1,135 @@
|
||||
package com.sipai.entity.scada;
|
||||
|
||||
import com.sipai.entity.base.SQLAdapter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 水量累计表实体类
|
||||
* 表名规则:tb_mp_{companyKey}_LJLL
|
||||
*/
|
||||
public class WaterVolumeLJLL extends SQLAdapter implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增主键
|
||||
*/
|
||||
@Id
|
||||
@Column(name = "ItemID")
|
||||
private Long itemId;
|
||||
|
||||
/**
|
||||
* 水量值
|
||||
*/
|
||||
@Column(name = "ParmValue", precision = 18, scale = 4)
|
||||
private BigDecimal parmValue;
|
||||
|
||||
/**
|
||||
* 统计时间
|
||||
*/
|
||||
@Column(name = "MeasureDT")
|
||||
private Date measureDt;
|
||||
|
||||
/**
|
||||
* 备注类型
|
||||
*/
|
||||
@Column(name = "memotype", length = 100)
|
||||
private String memotype;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@Column(name = "memo", length = 50)
|
||||
private String memo;
|
||||
|
||||
/**
|
||||
* 用户ID(公司标识)
|
||||
*/
|
||||
@Column(name = "userid", length = 50)
|
||||
private String userid;
|
||||
|
||||
/**
|
||||
* 入库时间
|
||||
*/
|
||||
@Column(name = "insdt")
|
||||
private Date insdt;
|
||||
|
||||
// 构造方法
|
||||
public WaterVolumeLJLL() {
|
||||
}
|
||||
|
||||
// Getters 和 Setters
|
||||
public Long getItemId() {
|
||||
return itemId;
|
||||
}
|
||||
|
||||
public void setItemId(Long itemId) {
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public BigDecimal getParmValue() {
|
||||
return parmValue;
|
||||
}
|
||||
|
||||
public void setParmValue(BigDecimal parmValue) {
|
||||
this.parmValue = parmValue;
|
||||
}
|
||||
|
||||
public Date getMeasureDt() {
|
||||
return measureDt;
|
||||
}
|
||||
|
||||
public void setMeasureDt(Date measureDt) {
|
||||
this.measureDt = measureDt;
|
||||
}
|
||||
|
||||
public String getMemotype() {
|
||||
return memotype;
|
||||
}
|
||||
|
||||
public void setMemotype(String memotype) {
|
||||
this.memotype = memotype;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public void setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
}
|
||||
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
public Date getInsdt() {
|
||||
return insdt;
|
||||
}
|
||||
|
||||
public void setInsdt(Date insdt) {
|
||||
this.insdt = insdt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WaterVolumeLJLL{" +
|
||||
"itemId=" + itemId +
|
||||
", parmValue=" + parmValue +
|
||||
", measureDt=" + measureDt +
|
||||
", memotype='" + memotype + '\'' +
|
||||
", memo='" + memo + '\'' +
|
||||
", userid='" + userid + '\'' +
|
||||
", insdt=" + insdt +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,160 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="administration.LeaveApplyMapper" >
|
||||
<resultMap id="BaseResultMap" type="com.sipai.entity.administration.LeaveApply" >
|
||||
<id column="id" property="id" jdbcType="VARCHAR" />
|
||||
<result column="insdt" property="insdt" jdbcType="TIMESTAMP" />
|
||||
<result column="insuser" property="insuser" jdbcType="VARCHAR" />
|
||||
<result column="upduser" property="upduser" jdbcType="VARCHAR" />
|
||||
<result column="upddt" property="upddt" jdbcType="TIMESTAMP" />
|
||||
<result column="unit_id" property="unitId" jdbcType="VARCHAR" />
|
||||
<result column="apply_type" property="applyType" jdbcType="VARCHAR" />
|
||||
<result column="leave_type" property="leaveType" jdbcType="VARCHAR" />
|
||||
<result column="start_time" property="startTime" jdbcType="TIMESTAMP" />
|
||||
<result column="end_time" property="endTime" jdbcType="TIMESTAMP" />
|
||||
<result column="hours" property="hours" jdbcType="DECIMAL" />
|
||||
<result column="days" property="days" jdbcType="DECIMAL" />
|
||||
<result column="reason" property="reason" jdbcType="VARCHAR" />
|
||||
<result column="handover_desc" property="handoverDesc" jdbcType="VARCHAR" />
|
||||
<result column="attachment_ids" property="attachmentIds" jdbcType="VARCHAR" />
|
||||
<result column="overtime_ref_id" property="overtimeRefId" jdbcType="VARCHAR" />
|
||||
<result column="overtime_hours" property="overtimeHours" jdbcType="DECIMAL" />
|
||||
<result column="actual_start_time" property="actualStartTime" jdbcType="TIMESTAMP" />
|
||||
<result column="actual_end_time" property="actualEndTime" jdbcType="TIMESTAMP" />
|
||||
<result column="state" property="state" jdbcType="VARCHAR" />
|
||||
<result column="audit_man_id" property="auditManId" jdbcType="VARCHAR" />
|
||||
<result column="submission_time" property="submissionTime" jdbcType="TIMESTAMP" />
|
||||
<result column="processid" property="processid" jdbcType="VARCHAR" />
|
||||
<result column="processdefid" property="processdefid" jdbcType="VARCHAR" />
|
||||
<result column="remark" property="remark" jdbcType="VARCHAR" />
|
||||
<result column="del_flag" property="delFlag" jdbcType="CHAR" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List" >
|
||||
id, insdt, insuser, upduser, upddt, unit_id, apply_type, leave_type, start_time, end_time,
|
||||
hours, days, reason, handover_desc, attachment_ids, overtime_ref_id, overtime_hours,
|
||||
actual_start_time, actual_end_time, state, audit_man_id, submission_time, processid,
|
||||
processdefid, remark, del_flag
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String" >
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_administration_leave_apply
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
|
||||
delete from tb_administration_leave_apply
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.sipai.entity.administration.LeaveApply" >
|
||||
insert into tb_administration_leave_apply (
|
||||
id, insdt, insuser, upduser, upddt, unit_id, apply_type, leave_type, start_time, end_time,
|
||||
hours, days, reason, handover_desc, attachment_ids, overtime_ref_id, overtime_hours,
|
||||
actual_start_time, actual_end_time, state, submission_time, processid,
|
||||
processdefid, remark, del_flag)
|
||||
values (
|
||||
#{id,jdbcType=VARCHAR}, #{insdt,jdbcType=TIMESTAMP}, #{insuser,jdbcType=VARCHAR}, #{upduser,jdbcType=VARCHAR}, #{upddt,jdbcType=TIMESTAMP},
|
||||
#{unitId,jdbcType=VARCHAR}, #{applyType,jdbcType=VARCHAR}, #{leaveType,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
|
||||
NULLIF(#{hours,jdbcType=VARCHAR}, ''), NULLIF(#{days,jdbcType=VARCHAR}, ''), #{reason,jdbcType=VARCHAR}, #{handoverDesc,jdbcType=VARCHAR}, #{attachmentIds,jdbcType=VARCHAR},
|
||||
#{overtimeRefId,jdbcType=VARCHAR}, NULLIF(#{overtimeHours,jdbcType=VARCHAR}, ''), #{actualStartTime,jdbcType=TIMESTAMP}, #{actualEndTime,jdbcType=TIMESTAMP},
|
||||
#{state,jdbcType=VARCHAR}, #{submissionTime,jdbcType=TIMESTAMP}, #{processid,jdbcType=VARCHAR},
|
||||
#{processdefid,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{delFlag,jdbcType=CHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.sipai.entity.administration.LeaveApply" >
|
||||
insert into tb_administration_leave_apply
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >id,</if>
|
||||
<if test="insdt != null" >insdt,</if>
|
||||
<if test="insuser != null" >insuser,</if>
|
||||
<if test="upduser != null" >upduser,</if>
|
||||
<if test="upddt != null" >upddt,</if>
|
||||
<if test="unitId != null" >unit_id,</if>
|
||||
<if test="applyType != null" >apply_type,</if>
|
||||
<if test="leaveType != null" >leave_type,</if>
|
||||
<if test="startTime != null" >start_time,</if>
|
||||
<if test="endTime != null" >end_time,</if>
|
||||
<if test="hours != null" >hours,</if>
|
||||
<if test="days != null" >days,</if>
|
||||
<if test="reason != null" >reason,</if>
|
||||
<if test="handoverDesc != null" >handover_desc,</if>
|
||||
<if test="attachmentIds != null" >attachment_ids,</if>
|
||||
<if test="overtimeRefId != null" >overtime_ref_id,</if>
|
||||
<if test="overtimeHours != null" >overtime_hours,</if>
|
||||
<if test="actualStartTime != null" >actual_start_time,</if>
|
||||
<if test="actualEndTime != null" >actual_end_time,</if>
|
||||
<if test="state != null" >state,</if>
|
||||
<if test="submissionTime != null" >submission_time,</if>
|
||||
<if test="processid != null" >processid,</if>
|
||||
<if test="processdefid != null" >processdefid,</if>
|
||||
<if test="remark != null" >remark,</if>
|
||||
<if test="delFlag != null" >del_flag,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >#{id,jdbcType=VARCHAR},</if>
|
||||
<if test="insdt != null" >#{insdt,jdbcType=TIMESTAMP},</if>
|
||||
<if test="insuser != null" >#{insuser,jdbcType=VARCHAR},</if>
|
||||
<if test="upduser != null" >#{upduser,jdbcType=VARCHAR},</if>
|
||||
<if test="upddt != null" >#{upddt,jdbcType=TIMESTAMP},</if>
|
||||
<if test="unitId != null" >#{unitId,jdbcType=VARCHAR},</if>
|
||||
<if test="applyType != null" >#{applyType,jdbcType=VARCHAR},</if>
|
||||
<if test="leaveType != null" >#{leaveType,jdbcType=VARCHAR},</if>
|
||||
<if test="startTime != null" >#{startTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="endTime != null" >#{endTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="hours != null" >NULLIF(#{hours,jdbcType=VARCHAR}, ''),</if>
|
||||
<if test="days != null" >NULLIF(#{days,jdbcType=VARCHAR}, ''),</if>
|
||||
<if test="reason != null" >#{reason,jdbcType=VARCHAR},</if>
|
||||
<if test="handoverDesc != null" >#{handoverDesc,jdbcType=VARCHAR},</if>
|
||||
<if test="attachmentIds != null" >#{attachmentIds,jdbcType=VARCHAR},</if>
|
||||
<if test="overtimeRefId != null" >#{overtimeRefId,jdbcType=VARCHAR},</if>
|
||||
<if test="overtimeHours != null" >NULLIF(#{overtimeHours,jdbcType=VARCHAR}, ''),</if>
|
||||
<if test="actualStartTime != null" >#{actualStartTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="actualEndTime != null" >#{actualEndTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="state != null" >#{state,jdbcType=VARCHAR},</if>
|
||||
<if test="submissionTime != null" >#{submissionTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="processid != null" >#{processid,jdbcType=VARCHAR},</if>
|
||||
<if test="processdefid != null" >#{processdefid,jdbcType=VARCHAR},</if>
|
||||
<if test="remark != null" >#{remark,jdbcType=VARCHAR},</if>
|
||||
<if test="delFlag != null" >#{delFlag,jdbcType=CHAR},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.sipai.entity.administration.LeaveApply" >
|
||||
update tb_administration_leave_apply
|
||||
<set >
|
||||
<if test="insdt != null" >insdt = #{insdt,jdbcType=TIMESTAMP},</if>
|
||||
<if test="insuser != null" >insuser = #{insuser,jdbcType=VARCHAR},</if>
|
||||
<if test="upduser != null" >upduser = #{upduser,jdbcType=VARCHAR},</if>
|
||||
<if test="upddt != null" >upddt = #{upddt,jdbcType=TIMESTAMP},</if>
|
||||
<if test="unitId != null" >unit_id = #{unitId,jdbcType=VARCHAR},</if>
|
||||
<if test="applyType != null" >apply_type = #{applyType,jdbcType=VARCHAR},</if>
|
||||
<if test="leaveType != null" >leave_type = #{leaveType,jdbcType=VARCHAR},</if>
|
||||
<if test="startTime != null" >start_time = #{startTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="endTime != null" >end_time = #{endTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="hours != null" >hours = NULLIF(#{hours,jdbcType=VARCHAR}, ''),</if>
|
||||
<if test="days != null" >days = NULLIF(#{days,jdbcType=VARCHAR}, ''),</if>
|
||||
<if test="reason != null" >reason = #{reason,jdbcType=VARCHAR},</if>
|
||||
<if test="handoverDesc != null" >handover_desc = #{handoverDesc,jdbcType=VARCHAR},</if>
|
||||
<if test="attachmentIds != null" >attachment_ids = #{attachmentIds,jdbcType=VARCHAR},</if>
|
||||
<if test="overtimeRefId != null" >overtime_ref_id = #{overtimeRefId,jdbcType=VARCHAR},</if>
|
||||
<if test="overtimeHours != null" >overtime_hours = NULLIF(#{overtimeHours,jdbcType=VARCHAR}, ''),</if>
|
||||
<if test="actualStartTime != null" >actual_start_time = #{actualStartTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="actualEndTime != null" >actual_end_time = #{actualEndTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="state != null" >state = #{state,jdbcType=VARCHAR},</if>
|
||||
audit_man_id = NULL,
|
||||
<if test="submissionTime != null" >submission_time = #{submissionTime,jdbcType=TIMESTAMP},</if>
|
||||
<if test="processid != null" >processid = #{processid,jdbcType=VARCHAR},</if>
|
||||
<if test="processdefid != null" >processdefid = #{processdefid,jdbcType=VARCHAR},</if>
|
||||
<if test="remark != null" >remark = #{remark,jdbcType=VARCHAR},</if>
|
||||
<if test="delFlag != null" >del_flag = #{delFlag,jdbcType=CHAR},</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<select id="selectListByWhere" parameterType="java.lang.String" resultMap="BaseResultMap" >
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from tb_administration_leave_apply
|
||||
${where}
|
||||
</select>
|
||||
<delete id="deleteByWhere" parameterType="java.lang.String" >
|
||||
delete from tb_administration_leave_apply
|
||||
${where}
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -11,10 +11,14 @@
|
||||
<result column="start_ground_elevation_m" property="startGroundElevationM" jdbcType="DECIMAL" />
|
||||
<result column="end_ground_elevation_m" property="endGroundElevationM" jdbcType="DECIMAL" />
|
||||
<result column="pipeline_invert_elevation_m" property="pipelineInvertElevationM" jdbcType="DECIMAL" />
|
||||
<result column="pipeline_area" property="pipelineArea" jdbcType="VARCHAR" />
|
||||
<result column="pipe_material" property="pipeMaterial" jdbcType="VARCHAR" />
|
||||
<result column="associated_plant" property="associatedPlant" jdbcType="VARCHAR" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List" >
|
||||
id, pipeline_name, diameter_mm, length_m, start_burial_depth_m, end_burial_depth_m,
|
||||
start_ground_elevation_m, end_ground_elevation_m, pipeline_invert_elevation_m
|
||||
start_ground_elevation_m, end_ground_elevation_m, pipeline_invert_elevation_m, pipeline_area,
|
||||
pipe_material, associated_plant
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
|
||||
select
|
||||
@ -30,11 +34,12 @@
|
||||
insert into tb_pipeline_data (pipeline_name, diameter_mm,
|
||||
length_m, start_burial_depth_m, end_burial_depth_m,
|
||||
start_ground_elevation_m, end_ground_elevation_m,
|
||||
pipeline_invert_elevation_m)
|
||||
pipeline_invert_elevation_m, pipeline_area, pipe_material, associated_plant)
|
||||
values (#{pipelineName,jdbcType=VARCHAR}, #{diameterMm,jdbcType=DECIMAL},
|
||||
#{lengthM,jdbcType=DECIMAL}, #{startBurialDepthM,jdbcType=DECIMAL}, #{endBurialDepthM,jdbcType=DECIMAL},
|
||||
#{startGroundElevationM,jdbcType=DECIMAL}, #{endGroundElevationM,jdbcType=DECIMAL},
|
||||
#{pipelineInvertElevationM,jdbcType=DECIMAL})
|
||||
#{pipelineInvertElevationM,jdbcType=DECIMAL}, #{pipelineArea,jdbcType=VARCHAR},
|
||||
#{pipeMaterial,jdbcType=VARCHAR}, #{associatedPlant,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.sipai.entity.pipeline.PipelineData" useGeneratedKeys="true" keyProperty="id" >
|
||||
insert into tb_pipeline_data
|
||||
@ -64,6 +69,15 @@
|
||||
<if test="pipelineInvertElevationM != null" >
|
||||
pipeline_invert_elevation_m,
|
||||
</if>
|
||||
<if test="pipelineArea != null" >
|
||||
pipeline_area,
|
||||
</if>
|
||||
<if test="pipeMaterial != null" >
|
||||
pipe_material,
|
||||
</if>
|
||||
<if test="associatedPlant != null" >
|
||||
associated_plant,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
|
||||
@ -91,6 +105,15 @@
|
||||
<if test="pipelineInvertElevationM != null" >
|
||||
#{pipelineInvertElevationM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="pipelineArea != null" >
|
||||
#{pipelineArea,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pipeMaterial != null" >
|
||||
#{pipeMaterial,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="associatedPlant != null" >
|
||||
#{associatedPlant,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.sipai.entity.pipeline.PipelineData" >
|
||||
@ -120,6 +143,15 @@
|
||||
<if test="pipelineInvertElevationM != null" >
|
||||
pipeline_invert_elevation_m = #{pipelineInvertElevationM,jdbcType=DECIMAL},
|
||||
</if>
|
||||
<if test="pipelineArea != null" >
|
||||
pipeline_area = #{pipelineArea,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="pipeMaterial != null" >
|
||||
pipe_material = #{pipeMaterial,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="associatedPlant != null" >
|
||||
associated_plant = #{associatedPlant,jdbcType=VARCHAR},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
@ -132,7 +164,10 @@
|
||||
end_burial_depth_m = #{endBurialDepthM,jdbcType=DECIMAL},
|
||||
start_ground_elevation_m = #{startGroundElevationM,jdbcType=DECIMAL},
|
||||
end_ground_elevation_m = #{endGroundElevationM,jdbcType=DECIMAL},
|
||||
pipeline_invert_elevation_m = #{pipelineInvertElevationM,jdbcType=DECIMAL}
|
||||
pipeline_invert_elevation_m = #{pipelineInvertElevationM,jdbcType=DECIMAL},
|
||||
pipeline_area = #{pipelineArea,jdbcType=VARCHAR},
|
||||
pipe_material = #{pipeMaterial,jdbcType=VARCHAR},
|
||||
associated_plant = #{associatedPlant,jdbcType=VARCHAR}
|
||||
where id = #{id,jdbcType=BIGINT}
|
||||
</update>
|
||||
<select id="selectListByWhere" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
@ -146,4 +181,34 @@
|
||||
tb_pipeline_data
|
||||
${where}
|
||||
</delete>
|
||||
|
||||
<!-- 获取管道统计信息:按材质分组 -->
|
||||
<select id="selectMaterialStats" resultType="java.util.Map">
|
||||
SELECT
|
||||
COALESCE(pipe_material, '未知') as material,
|
||||
COUNT(*) as count,
|
||||
SUM(COALESCE(length_m, 0)) as totalLength
|
||||
FROM tb_pipeline_data
|
||||
GROUP BY pipe_material
|
||||
ORDER BY count DESC
|
||||
</select>
|
||||
|
||||
<!-- 获取管道总统计 -->
|
||||
<select id="selectTotalStats" resultType="java.util.Map">
|
||||
SELECT
|
||||
COUNT(*) as totalCount,
|
||||
SUM(COALESCE(length_m, 0)) as totalLength
|
||||
FROM tb_pipeline_data
|
||||
</select>
|
||||
|
||||
<!-- 获取管道统计信息:按管径分组 -->
|
||||
<select id="selectDiameterStats" resultType="java.util.Map">
|
||||
SELECT
|
||||
COALESCE(CAST(diameter_mm AS VARCHAR(50)), '未知') as diameter,
|
||||
COUNT(*) as count,
|
||||
SUM(COALESCE(length_m, 0)) as totalLength
|
||||
FROM tb_pipeline_data
|
||||
GROUP BY diameter_mm
|
||||
ORDER BY count DESC
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
<result column="caption" property="caption" jdbcType="VARCHAR"/>
|
||||
<result column="sex" property="sex" jdbcType="VARCHAR"/>
|
||||
<result column="sexText" property="sexText" jdbcType="VARCHAR"/>
|
||||
<result column="pid" property="pid" jdbcType="VARCHAR"/>
|
||||
<result column="deptName" property="deptName" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
@ -164,6 +165,7 @@
|
||||
u.caption,
|
||||
u.sex,
|
||||
(case when u.sex='0' then '女' else '男' end) as sexText,
|
||||
u.pid,
|
||||
uu.name as deptName
|
||||
from tb_safety_staff_archives ssa
|
||||
INNER JOIN tb_user u ON ssa.userid = u.id
|
||||
@ -178,6 +180,7 @@
|
||||
u.caption,
|
||||
u.sex,
|
||||
(case when u.sex='0' then '女' else '男' end) as sexText,
|
||||
u.pid,
|
||||
uu.name as deptName
|
||||
from tb_safety_staff_archives ssa
|
||||
INNER JOIN tb_user u ON ssa.userid = u.id
|
||||
|
||||
82
src/main/java/com/sipai/mapper/scada/MPointDataMapper.xml
Normal file
82
src/main/java/com/sipai/mapper/scada/MPointDataMapper.xml
Normal file
@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="scada.MPointDataMapper">
|
||||
<resultMap id="BaseResultMap" type="com.sipai.entity.scada.MPointData" >
|
||||
<id column="ItemID" property="itemId" jdbcType="BIGINT" />
|
||||
<result column="ParmValue" property="parmValue" jdbcType="DECIMAL" />
|
||||
<result column="MeasureDT" property="measureDt" jdbcType="TIMESTAMP" />
|
||||
<result column="memotype" property="memotype" jdbcType="VARCHAR" />
|
||||
<result column="memo" property="memo" jdbcType="VARCHAR" />
|
||||
<result column="userid" property="userid" jdbcType="VARCHAR" />
|
||||
<result column="insdt" property="insdt" jdbcType="TIMESTAMP" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List" >
|
||||
ItemID, ParmValue, MeasureDT, memotype, memo, userid, insdt
|
||||
</sql>
|
||||
|
||||
<!-- 获取最新一条数据(当前值) -->
|
||||
<select id="selectLatest" resultMap="BaseResultMap">
|
||||
SELECT TOP 1 <include refid="Base_Column_List" />
|
||||
FROM ${tableName}
|
||||
<where>
|
||||
<if test="companyKey != null and companyKey != ''">
|
||||
AND userid = #{companyKey}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
AND MeasureDT >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
AND MeasureDT <= #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY MeasureDT DESC
|
||||
</select>
|
||||
|
||||
<!-- 获取统计数据:平均值、最高值、最低值 -->
|
||||
<select id="selectStatistics" resultType="java.util.Map">
|
||||
SELECT
|
||||
ISNULL(AVG(ParmValue), 0) as avgValue,
|
||||
ISNULL(MAX(ParmValue), 0) as maxValue,
|
||||
ISNULL(MIN(ParmValue), 0) as minValue,
|
||||
COUNT(*) as totalCount
|
||||
FROM ${tableName}
|
||||
<where>
|
||||
<if test="companyKey != null and companyKey != ''">
|
||||
AND userid = #{companyKey}
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
AND MeasureDT >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
AND MeasureDT <= #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 检查表是否存在 -->
|
||||
<select id="checkTableExists" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_NAME = #{tableName}
|
||||
</select>
|
||||
|
||||
<!-- 按天汇总统计:每天ParamValue的总量 -->
|
||||
<select id="selectDailyAggregation" resultType="java.util.Map">
|
||||
SELECT
|
||||
CONVERT(VARCHAR(10), MeasureDT, 120) as dateStr,
|
||||
ISNULL(SUM(ParmValue), 0) as totalValue,
|
||||
COUNT(*) as dataCount
|
||||
FROM ${tableName}
|
||||
<where>
|
||||
<if test="startTime != null">
|
||||
AND MeasureDT >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
AND MeasureDT <= #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY CONVERT(VARCHAR(10), MeasureDT, 120)
|
||||
ORDER BY dateStr ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@ -22,17 +22,14 @@
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.sipai.entity.scada.MPointExpand" >
|
||||
insert into TB_MeasurePoint_Expand (id, insdt, insuser,
|
||||
insert into TB_MeasurePoint_Expand (insdt, insuser,
|
||||
measure_point_id, explain)
|
||||
values (#{id,jdbcType=VARCHAR}, #{insdt,jdbcType=TIMESTAMP}, #{insuser,jdbcType=VARCHAR},
|
||||
values (#{insdt,jdbcType=TIMESTAMP}, #{insuser,jdbcType=VARCHAR},
|
||||
#{measurePointId,jdbcType=VARCHAR}, #{explain,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.sipai.entity.scada.MPointExpand" >
|
||||
insert into TB_MeasurePoint_Expand
|
||||
<trim prefix="(" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >
|
||||
id,
|
||||
</if>
|
||||
<if test="insdt != null" >
|
||||
insdt,
|
||||
</if>
|
||||
@ -47,9 +44,6 @@
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides="," >
|
||||
<if test="id != null" >
|
||||
#{id,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="insdt != null" >
|
||||
#{insdt,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
|
||||
@ -764,6 +764,9 @@
|
||||
structureId = #{structureId,jdbcType=VARCHAR}
|
||||
where ID = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
<select id="selectCount" resultType="java.lang.Long">
|
||||
select count(1) from tb_measurepoint
|
||||
</select>
|
||||
<select id="selectListByWhere" parameterType="java.lang.String" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
|
||||
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||
<mapper namespace="scada.WaterVolumeLJLLMapper">
|
||||
<resultMap id="BaseResultMap" type="com.sipai.entity.scada.WaterVolumeLJLL" >
|
||||
<id column="ItemID" property="itemId" jdbcType="BIGINT" />
|
||||
<result column="ParmValue" property="parmValue" jdbcType="DECIMAL" />
|
||||
<result column="MeasureDT" property="measureDt" jdbcType="TIMESTAMP" />
|
||||
<result column="memotype" property="memotype" jdbcType="VARCHAR" />
|
||||
<result column="memo" property="memo" jdbcType="VARCHAR" />
|
||||
<result column="userid" property="userid" jdbcType="VARCHAR" />
|
||||
<result column="insdt" property="insdt" jdbcType="TIMESTAMP" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List" >
|
||||
ItemID, ParmValue, MeasureDT, memotype, memo, userid, insdt
|
||||
</sql>
|
||||
|
||||
<!-- 今日处理总量 -->
|
||||
<select id="selectTodayTotal" resultType="java.math.BigDecimal">
|
||||
SELECT ISNULL(SUM(ParmValue), 0)
|
||||
FROM ${tableName}
|
||||
WHERE CONVERT(VARCHAR(10), MeasureDT, 120) = CONVERT(VARCHAR(10), GETDATE(), 120)
|
||||
</select>
|
||||
|
||||
<!-- 昨日处理总量 -->
|
||||
<select id="selectYesterdayTotal" resultType="java.math.BigDecimal">
|
||||
SELECT ISNULL(SUM(ParmValue), 0)
|
||||
FROM ${tableName}
|
||||
WHERE CONVERT(VARCHAR(10), MeasureDT, 120) = CONVERT(VARCHAR(10), DATEADD(day, -1, GETDATE()), 120)
|
||||
</select>
|
||||
|
||||
<!-- 本月累计总量 -->
|
||||
<select id="selectMonthTotal" resultType="java.math.BigDecimal">
|
||||
SELECT ISNULL(SUM(ParmValue), 0)
|
||||
FROM ${tableName}
|
||||
WHERE YEAR(MeasureDT) = YEAR(GETDATE())
|
||||
AND MONTH(MeasureDT) = MONTH(GETDATE())
|
||||
</select>
|
||||
|
||||
<!-- 七日水量处理总量 -->
|
||||
<select id="selectSevenDaysTotal" resultType="java.util.Map">
|
||||
SELECT
|
||||
CONVERT(VARCHAR(10), MeasureDT, 120) as date,
|
||||
ISNULL(SUM(ParmValue), 0) as total
|
||||
FROM ${tableName}
|
||||
WHERE MeasureDT >= DATEADD(day, -6, CONVERT(VARCHAR(10), GETDATE(), 120))
|
||||
AND MeasureDT < DATEADD(day, 1, CONVERT(VARCHAR(10), GETDATE(), 120))
|
||||
GROUP BY CONVERT(VARCHAR(10), MeasureDT, 120)
|
||||
ORDER BY date ASC
|
||||
</select>
|
||||
|
||||
<!-- 检查表是否存在 -->
|
||||
<select id="checkTableExists" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
FROM INFORMATION_SCHEMA.TABLES
|
||||
WHERE TABLE_NAME = #{tableName}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -4,10 +4,14 @@ import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.SocketChannel;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import io.netty.util.concurrent.GenericFutureListener;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class NettyClient extends Thread {
|
||||
private int port;
|
||||
@ -16,6 +20,9 @@ public class NettyClient extends Thread {
|
||||
//private String host = "132.120.132.74";//公司内网
|
||||
|
||||
private Channel channel;
|
||||
private EventLoopGroup clientWorker;
|
||||
private volatile boolean running = true;
|
||||
private Bootstrap bootstrap;
|
||||
|
||||
public NettyClient(int port){
|
||||
this.port = port;
|
||||
@ -29,49 +36,39 @@ public class NettyClient extends Thread {
|
||||
/**
|
||||
* 负责装客户端的事件处理线程池
|
||||
*/
|
||||
EventLoopGroup clientWorker = new NioEventLoopGroup();
|
||||
clientWorker = new NioEventLoopGroup();
|
||||
try {
|
||||
/**
|
||||
* netty客户端引导启动器
|
||||
*/
|
||||
Bootstrap bootstrap = new Bootstrap();
|
||||
bootstrap = new Bootstrap();
|
||||
bootstrap
|
||||
.group(clientWorker)//把事件处理线程池添加进启动引导器
|
||||
.channel(NioSocketChannel.class)//设置通道的建立方式,这里采用Nio的通道方式来建立请求连接
|
||||
//.option(ChannelOption.SO_KEEPALIVE, true)
|
||||
.option(ChannelOption.SO_KEEPALIVE, true) // 启用心跳保活机制
|
||||
.option(ChannelOption.TCP_NODELAY, true) // 禁用Nagle算法,提高响应速度
|
||||
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10000) // 连接超时10秒
|
||||
.handler(new ChannelInitializer<SocketChannel>() {
|
||||
@Override
|
||||
protected void initChannel(SocketChannel socketChannel) throws Exception {
|
||||
/**
|
||||
* 此处添加客户端的通道处理器
|
||||
*/
|
||||
socketChannel.pipeline().addLast(new NettyClientHandler());
|
||||
socketChannel.pipeline().addLast(new NettyClientHandler(NettyClient.this));
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 客户端绑定端口并且开始发起连接请求
|
||||
*/
|
||||
ChannelFuture future = null;
|
||||
try {
|
||||
future = bootstrap.connect(host, port).sync();
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (future.isSuccess()){
|
||||
System.out.println("客户端连接服务器成功!");
|
||||
}
|
||||
/**
|
||||
* 将通道设置好, 以便外面获取
|
||||
*/
|
||||
this.channel = future.channel();
|
||||
|
||||
// 开始连接
|
||||
connect();
|
||||
|
||||
/**
|
||||
* 关闭客户端
|
||||
*/
|
||||
try {
|
||||
future.channel().closeFuture().sync();
|
||||
if (channel != null) {
|
||||
channel.closeFuture().sync();
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("客户端即将关闭!");
|
||||
@ -84,6 +81,76 @@ public class NettyClient extends Thread {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接服务器
|
||||
*/
|
||||
public void connect() {
|
||||
if (!running) {
|
||||
return;
|
||||
}
|
||||
System.out.println("正在连接服务器 " + host + ":" + port + " ...");
|
||||
ChannelFuture future = null;
|
||||
try {
|
||||
future = bootstrap.connect(host, port);
|
||||
future.addListener(new GenericFutureListener<ChannelFuture>() {
|
||||
@Override
|
||||
public void operationComplete(ChannelFuture future) throws Exception {
|
||||
if (future.isSuccess()) {
|
||||
System.out.println("客户端连接服务器成功!");
|
||||
} else {
|
||||
System.out.println("客户端连接服务器失败,5秒后重连...");
|
||||
future.channel().eventLoop().schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
connect();
|
||||
}
|
||||
}, 5, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
});
|
||||
future.sync();
|
||||
this.channel = future.channel();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
System.out.println("连接异常:" + e.getMessage() + ",5秒后重连...");
|
||||
clientWorker.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
connect();
|
||||
}
|
||||
}, 5, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接断开时调用,进行重连
|
||||
*/
|
||||
public void reconnect() {
|
||||
if (running && clientWorker != null) {
|
||||
System.out.println("连接断开,5秒后重连...");
|
||||
clientWorker.schedule(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
connect();
|
||||
}
|
||||
}, 5, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止客户端
|
||||
*/
|
||||
public void stopClient() {
|
||||
running = false;
|
||||
if (channel != null) {
|
||||
channel.close();
|
||||
}
|
||||
if (clientWorker != null) {
|
||||
clientWorker.shutdownGracefully();
|
||||
}
|
||||
}
|
||||
|
||||
public Channel getChannel(){
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
@ -5,10 +5,18 @@ import io.netty.buffer.Unpooled;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Date;
|
||||
|
||||
public class NettyClientHandler extends ChannelInboundHandlerAdapter {
|
||||
|
||||
private NettyClient nettyClient;
|
||||
|
||||
public NettyClientHandler(NettyClient nettyClient) {
|
||||
this.nettyClient = nettyClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通道信息读取处理
|
||||
* @param ctx
|
||||
@ -25,6 +33,8 @@ public class NettyClientHandler extends ChannelInboundHandlerAdapter {
|
||||
* 给服务端回复消息
|
||||
*/
|
||||
ctx.writeAndFlush("客户端收到! 消息为: " + m.toString(Charset.defaultCharset()));
|
||||
} catch (Exception e) {
|
||||
System.err.println("读取消息异常: " + e.getMessage());
|
||||
} finally {
|
||||
m.release();
|
||||
}
|
||||
@ -42,15 +52,56 @@ public class NettyClientHandler extends ChannelInboundHandlerAdapter {
|
||||
* 消息格式必须是ByteBuf才行!!!!!
|
||||
* 如果是其他格式服务端是接收不到的!!!!
|
||||
*/
|
||||
System.out.println("首次连接完成!");
|
||||
String helo = "你好呀!";
|
||||
ByteBuf byteBuf = Unpooled.wrappedBuffer(helo.getBytes());
|
||||
ctx.channel().writeAndFlush(byteBuf);
|
||||
System.out.println("首次连接完成!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 当连接断开时调用
|
||||
* @param ctx
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
System.out.println("连接已断开,准备重连...");
|
||||
if (nettyClient != null) {
|
||||
nettyClient.reconnect();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 异常处理
|
||||
* @param ctx
|
||||
* @param cause
|
||||
*/
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
|
||||
cause.printStackTrace();
|
||||
// 处理远程主机强制关闭连接的异常
|
||||
if (cause instanceof IOException) {
|
||||
String message = cause.getMessage();
|
||||
if (message != null && (message.contains("远程主机强迫关闭了一个现有的连接")
|
||||
|| message.contains("Connection reset")
|
||||
|| message.contains("远程主机强迫关闭")
|
||||
|| message.contains("An existing connection was forcibly closed"))) {
|
||||
System.out.println("[" + java.time.LocalDateTime.now() + "] 远程主机已关闭连接,等待重连...");
|
||||
ctx.close();
|
||||
// 触发重连
|
||||
if (nettyClient != null) {
|
||||
nettyClient.reconnect();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 其他异常只打印简要信息,不打印完整堆栈
|
||||
System.err.println("[" + java.time.LocalDateTime.now() + "] 客户端异常:" + cause.getClass().getSimpleName() + " - " + cause.getMessage());
|
||||
ctx.close();
|
||||
|
||||
// 触发重连
|
||||
if (nettyClient != null) {
|
||||
nettyClient.reconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,6 +15,7 @@ import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
import io.netty.util.CharsetUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
@ -107,13 +108,36 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
|
||||
|
||||
@Override
|
||||
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
||||
super.exceptionCaught(ctx, cause);
|
||||
// 处理远程主机强制关闭连接的异常
|
||||
if (cause instanceof IOException) {
|
||||
String message = cause.getMessage();
|
||||
if (message != null && (message.contains("远程主机强迫关闭了一个现有的连接")
|
||||
|| message.contains("Connection reset")
|
||||
|| message.contains("远程主机强迫关闭")
|
||||
|| message.contains("An existing connection was forcibly closed"))) {
|
||||
System.out.println("[" + java.time.LocalDateTime.now() + "] 客户端 [" + ctx.channel().remoteAddress() + "] 已断开连接");
|
||||
ctx.close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 异常捕获
|
||||
* 异常捕获 - 只打印简要信息
|
||||
*/
|
||||
System.err.println("[" + java.time.LocalDateTime.now() + "] 服务器处理异常:" + cause.getClass().getSimpleName() + " - " + cause.getMessage());
|
||||
cause.printStackTrace();
|
||||
ctx.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当连接断开时调用
|
||||
* @param ctx
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
|
||||
System.out.println("[" + java.time.LocalDateTime.now() + "] 客户端 [" + ctx.channel().remoteAddress() + "] 连接断开");
|
||||
super.channelInactive(ctx);
|
||||
}
|
||||
public static boolean isNumber(String str){
|
||||
String reg = "^[0-9]+(.[0-9]+)?$";
|
||||
return str.matches(reg);
|
||||
|
||||
367
src/main/java/com/sipai/service/activiti/BpmnImportService.java
Normal file
367
src/main/java/com/sipai/service/activiti/BpmnImportService.java
Normal file
@ -0,0 +1,367 @@
|
||||
package com.sipai.service.activiti;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.editor.language.json.converter.BpmnJsonConverter;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Deployment;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* BPMN文件导入服务
|
||||
* 用于导入现有的BPMN文件到Activiti模型编辑器
|
||||
*
|
||||
* @author system
|
||||
*/
|
||||
@Service
|
||||
public class BpmnImportService {
|
||||
|
||||
protected Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
protected RepositoryService repositoryService;
|
||||
|
||||
// BPMN文件存储的基础路径(文件系统路径)
|
||||
private static final String DIAGRAMS_BASE_PATH = "src/main/resources/diagrams";
|
||||
|
||||
/**
|
||||
* 获取所有BPMN文件列表
|
||||
*/
|
||||
public List<Map<String, Object>> listBpmnFiles() {
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
|
||||
// 首先尝试从文件系统读取
|
||||
File diagramsDir = new File(DIAGRAMS_BASE_PATH);
|
||||
if (diagramsDir.exists() && diagramsDir.isDirectory()) {
|
||||
listBpmnFilesFromFileSystem(diagramsDir, "", result);
|
||||
if (!result.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果文件系统路径不存在,尝试从classpath读取
|
||||
try {
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
Resource[] resources = resolver.getResources("classpath:diagrams/**/*.bpmn");
|
||||
|
||||
for (Resource resource : resources) {
|
||||
Map<String, Object> fileInfo = new HashMap<>();
|
||||
String filename = resource.getFilename();
|
||||
String path = resource.getURL().getPath();
|
||||
|
||||
fileInfo.put("filename", filename);
|
||||
fileInfo.put("path", path);
|
||||
fileInfo.put("size", resource.contentLength());
|
||||
fileInfo.put("lastModified", System.currentTimeMillis());
|
||||
|
||||
// 尝试解析BPMN获取流程名称
|
||||
try (InputStream is = resource.getInputStream()) {
|
||||
BpmnModel model = parseBpmnFromInputStream(is);
|
||||
if (model != null && model.getMainProcess() != null) {
|
||||
fileInfo.put("processId", model.getMainProcess().getId());
|
||||
fileInfo.put("processName", model.getMainProcess().getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to parse BPMN file: {}", filename);
|
||||
}
|
||||
|
||||
result.add(fileInfo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("Could not load BPMN files from classpath, trying file system: {}", e.getMessage());
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从文件系统递归获取BPMN文件列表
|
||||
*/
|
||||
private void listBpmnFilesFromFileSystem(File dir, String relativePath, List<Map<String, Object>> result) {
|
||||
File[] files = dir.listFiles();
|
||||
if (files == null) return;
|
||||
|
||||
for (File file : files) {
|
||||
if (file.isDirectory()) {
|
||||
listBpmnFilesFromFileSystem(file, relativePath + file.getName() + "/", result);
|
||||
} else if (file.getName().endsWith(".bpmn")) {
|
||||
Map<String, Object> fileInfo = new HashMap<>();
|
||||
fileInfo.put("filename", file.getName());
|
||||
fileInfo.put("path", relativePath + file.getName());
|
||||
fileInfo.put("size", file.length());
|
||||
fileInfo.put("lastModified", file.lastModified());
|
||||
|
||||
// 尝试解析BPMN获取流程名称
|
||||
try (InputStream is = new FileInputStream(file)) {
|
||||
BpmnModel model = parseBpmnFromInputStream(is);
|
||||
if (model != null && model.getMainProcess() != null) {
|
||||
fileInfo.put("processId", model.getMainProcess().getId());
|
||||
fileInfo.put("processName", model.getMainProcess().getName());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to parse BPMN file: {}", file.getName());
|
||||
}
|
||||
|
||||
result.add(fileInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从classpath路径导入BPMN文件创建模型
|
||||
*
|
||||
* @param bpmnFilePath BPMN文件路径(相对于diagrams目录)
|
||||
* @param modelName 模型名称
|
||||
* @param description 模型描述
|
||||
* @return 模型ID
|
||||
*/
|
||||
public String importBpmnFile(String bpmnFilePath, String modelName, String description) {
|
||||
return importBpmnFile(bpmnFilePath, modelName, description, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从classpath路径导入BPMN文件创建模型(带自定义Key)
|
||||
*
|
||||
* @param bpmnFilePath BPMN文件路径(相对于diagrams目录)
|
||||
* @param modelName 模型名称
|
||||
* @param description 模型描述
|
||||
* @param modelKey 模型Key(格式:processTypeId-companyId-maintenanceType)
|
||||
* @return 模型ID
|
||||
*/
|
||||
public String importBpmnFile(String bpmnFilePath, String modelName, String description, String modelKey) {
|
||||
InputStream is = null;
|
||||
try {
|
||||
// 首先尝试从文件系统读取
|
||||
File file = new File(DIAGRAMS_BASE_PATH + "/" + bpmnFilePath);
|
||||
if (file.exists()) {
|
||||
is = new FileInputStream(file);
|
||||
} else {
|
||||
// 如果文件系统不存在,尝试从classpath读取
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
Resource resource = resolver.getResource("classpath:diagrams/" + bpmnFilePath);
|
||||
if (resource.exists()) {
|
||||
is = resource.getInputStream();
|
||||
}
|
||||
}
|
||||
|
||||
if (is == null) {
|
||||
logger.error("BPMN file not found: {}", bpmnFilePath);
|
||||
return null;
|
||||
}
|
||||
|
||||
return importBpmnFromInputStream(is, modelName, description, modelKey);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error importing BPMN file: {}", bpmnFilePath, e);
|
||||
return null;
|
||||
} finally {
|
||||
if (is != null) {
|
||||
try { is.close(); } catch (Exception e) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 从输入流导入BPMN创建模型
|
||||
*
|
||||
* @param inputStream BPMN文件输入流
|
||||
* @param modelName 模型名称
|
||||
* @param description 模型描述
|
||||
* @return 模型ID
|
||||
*/
|
||||
public String importBpmnFromInputStream(InputStream inputStream, String modelName, String description) {
|
||||
return importBpmnFromInputStream(inputStream, modelName, description, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从输入流导入BPMN创建模型(带自定义Key)
|
||||
*
|
||||
* @param inputStream BPMN文件输入流
|
||||
* @param modelName 模型名称
|
||||
* @param description 模型描述
|
||||
* @param modelKey 模型Key(格式:processTypeId-companyId-maintenanceType)
|
||||
* @return 模型ID
|
||||
*/
|
||||
public String importBpmnFromInputStream(InputStream inputStream, String modelName, String description, String modelKey) {
|
||||
try {
|
||||
// 解析BPMN XML
|
||||
BpmnModel bpmnModel = parseBpmnFromInputStream(inputStream);
|
||||
if (bpmnModel == null) {
|
||||
logger.error("Failed to parse BPMN model");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 获取流程信息
|
||||
String processId = bpmnModel.getMainProcess().getId();
|
||||
String processName = bpmnModel.getMainProcess().getName();
|
||||
if (modelName == null || modelName.isEmpty()) {
|
||||
modelName = processName != null ? processName : processId;
|
||||
}
|
||||
|
||||
// 转换为JSON格式
|
||||
BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
|
||||
ObjectNode modelNode = jsonConverter.convertToJson(bpmnModel);
|
||||
|
||||
// 创建模型
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
ObjectNode editorNode = objectMapper.createObjectNode();
|
||||
editorNode.put("id", "canvas");
|
||||
editorNode.put("resourceId", "canvas");
|
||||
|
||||
ObjectNode stencilSetNode = objectMapper.createObjectNode();
|
||||
stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
|
||||
editorNode.put("stencilset", stencilSetNode);
|
||||
|
||||
// 合并转换后的模型数据
|
||||
editorNode.setAll(modelNode);
|
||||
|
||||
// 创建模型元数据
|
||||
Model modelData = repositoryService.newModel();
|
||||
ObjectNode modelObjectNode = objectMapper.createObjectNode();
|
||||
modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, modelName);
|
||||
modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);
|
||||
modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION,
|
||||
description != null ? description : "");
|
||||
modelData.setMetaInfo(modelObjectNode.toString());
|
||||
modelData.setName(modelName);
|
||||
// 如果提供了自定义Key则使用,否则使用processId
|
||||
modelData.setKey(modelKey != null && !modelKey.isEmpty() ? modelKey : processId);
|
||||
|
||||
// 保存模型
|
||||
repositoryService.saveModel(modelData);
|
||||
repositoryService.addModelEditorSource(modelData.getId(),
|
||||
editorNode.toString().getBytes("UTF-8"));
|
||||
|
||||
logger.info("Successfully imported BPMN model: {} with ID: {} and Key: {}", modelName, modelData.getId(), modelData.getKey());
|
||||
return modelData.getId();
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("Error importing BPMN from input stream", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接部署BPMN文件
|
||||
*
|
||||
* @param bpmnFilePath BPMN文件路径
|
||||
* @param deploymentName 部署名称
|
||||
* @return 部署ID
|
||||
*/
|
||||
public String deployBpmnFile(String bpmnFilePath, String deploymentName) {
|
||||
try {
|
||||
byte[] bpmnBytes = null;
|
||||
String filename = bpmnFilePath;
|
||||
|
||||
// 首先尝试从文件系统读取
|
||||
File file = new File(DIAGRAMS_BASE_PATH + "/" + bpmnFilePath);
|
||||
if (file.exists()) {
|
||||
try (InputStream is = new FileInputStream(file)) {
|
||||
bpmnBytes = IOUtils.toByteArray(is);
|
||||
filename = file.getName();
|
||||
}
|
||||
} else {
|
||||
// 如果文件系统不存在,尝试从classpath读取
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
Resource resource = resolver.getResource("classpath:diagrams/" + bpmnFilePath);
|
||||
if (resource.exists()) {
|
||||
try (InputStream is = resource.getInputStream()) {
|
||||
bpmnBytes = IOUtils.toByteArray(is);
|
||||
filename = resource.getFilename();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bpmnBytes == null) {
|
||||
logger.error("BPMN file not found: {}", bpmnFilePath);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (deploymentName == null || deploymentName.isEmpty()) {
|
||||
deploymentName = filename;
|
||||
if (deploymentName.endsWith(".bpmn")) {
|
||||
deploymentName = deploymentName.substring(0, deploymentName.length() - 5);
|
||||
}
|
||||
}
|
||||
|
||||
String processName = deploymentName + ".bpmn20.xml";
|
||||
Deployment deployment = repositoryService.createDeployment()
|
||||
.name(deploymentName)
|
||||
.addString(processName, new String(bpmnBytes, "UTF-8"))
|
||||
.deploy();
|
||||
|
||||
logger.info("Successfully deployed BPMN: {} with deployment ID: {}",
|
||||
deploymentName, deployment.getId());
|
||||
return deployment.getId();
|
||||
} catch (Exception e) {
|
||||
logger.error("Error deploying BPMN file: {}", bpmnFilePath, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析BPMN XML文件
|
||||
*/
|
||||
private BpmnModel parseBpmnFromInputStream(InputStream inputStream) {
|
||||
try {
|
||||
XMLInputFactory xif = XMLInputFactory.newInstance();
|
||||
InputStreamReader in = new InputStreamReader(inputStream, "UTF-8");
|
||||
XMLStreamReader xtr = xif.createXMLStreamReader(in);
|
||||
|
||||
BpmnXMLConverter converter = new BpmnXMLConverter();
|
||||
return converter.convertToBpmnModel(xtr);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error parsing BPMN", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取BPMN文件内容
|
||||
*/
|
||||
public String getBpmnFileContent(String bpmnFilePath) {
|
||||
try {
|
||||
// 首先尝试从文件系统读取
|
||||
File file = new File(DIAGRAMS_BASE_PATH + "/" + bpmnFilePath);
|
||||
if (file.exists()) {
|
||||
try (InputStream is = new FileInputStream(file)) {
|
||||
return IOUtils.toString(is, "UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
// 如果文件系统不存在,尝试从classpath读取
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
Resource resource = resolver.getResource("classpath:diagrams/" + bpmnFilePath);
|
||||
if (resource.exists()) {
|
||||
try (InputStream is = resource.getInputStream()) {
|
||||
return IOUtils.toString(is, "UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
logger.error("Error reading BPMN file: {}", bpmnFilePath, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -362,9 +362,22 @@ public class WorkflowProcessDefinitionService {
|
||||
String pvmTransitionId = "";
|
||||
for (WorkTask workTask : list) {
|
||||
PvmTransition item=this.getTransition(processDefId, taskDefId,workTask.getId(),pvmTransitionId);
|
||||
if (item == null) {
|
||||
// 未找到对应路径时默认标记为通过路径,继续处理其他任务
|
||||
workTask.setPassFlag(true);
|
||||
continue;
|
||||
}
|
||||
pvmTransitionId = item.getId();
|
||||
String conditionText=String.valueOf(item.getProperty("conditionText"));
|
||||
if (conditionText!=null && conditionText.contains("!"+CommString.ACTI_KEK_Condition)) {
|
||||
// 检测退回路径:支持多种条件表达式格式
|
||||
// ${!pass} / ${pass == false} / ${pass==false} / ${pass != true} / ${pass!=true}
|
||||
boolean isRejectPath = conditionText != null && (
|
||||
conditionText.contains("!"+CommString.ACTI_KEK_Condition) ||
|
||||
conditionText.contains(CommString.ACTI_KEK_Condition+" == false") ||
|
||||
conditionText.contains(CommString.ACTI_KEK_Condition+"==false") ||
|
||||
conditionText.contains(CommString.ACTI_KEK_Condition+" != true") ||
|
||||
conditionText.contains(CommString.ACTI_KEK_Condition+"!=true"));
|
||||
if (isRejectPath) {
|
||||
workTask.setPassFlag(false);
|
||||
}else{
|
||||
workTask.setPassFlag(true);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,477 @@
|
||||
package com.sipai.service.administration;
|
||||
|
||||
import com.sipai.dao.administration.LeaveApplyDao;
|
||||
import com.sipai.entity.activiti.ProcessType;
|
||||
import com.sipai.entity.administration.LeaveApply;
|
||||
import com.sipai.entity.administration.LeaveCommStr;
|
||||
import com.sipai.entity.base.BusinessUnitAdapter;
|
||||
import com.sipai.entity.business.BusinessUnit;
|
||||
import com.sipai.entity.business.BusinessUnitAudit;
|
||||
import com.sipai.entity.business.BusinessUnitRecord;
|
||||
import com.sipai.entity.maintenance.MaintenanceCommString;
|
||||
import com.sipai.entity.user.User;
|
||||
import com.sipai.service.activiti.WorkflowProcessDefinitionService;
|
||||
import com.sipai.service.activiti.WorkflowService;
|
||||
import com.sipai.service.business.BusinessUnitAuditService;
|
||||
import com.sipai.service.user.JobService;
|
||||
import com.sipai.service.user.UnitService;
|
||||
import com.sipai.service.user.UserJobService;
|
||||
import com.sipai.service.user.UserService;
|
||||
import com.sipai.tools.CommService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class LeaveApplyService implements CommService<LeaveApply> {
|
||||
@Resource
|
||||
private LeaveApplyDao leaveApplyDao;
|
||||
@Resource
|
||||
private UserService userService;
|
||||
@Resource
|
||||
private WorkflowProcessDefinitionService workflowProcessDefinitionService;
|
||||
@Resource
|
||||
private WorkflowService workflowService;
|
||||
@Resource
|
||||
private BusinessUnitAuditService businessUnitAuditService;
|
||||
@Resource
|
||||
private JobService jobService;
|
||||
@Resource
|
||||
private UserJobService userJobService;
|
||||
@Resource
|
||||
private UnitService unitService;
|
||||
|
||||
@Override
|
||||
public LeaveApply selectById(String id) {
|
||||
LeaveApply leaveApply = this.leaveApplyDao.selectByPrimaryKey(id);
|
||||
this.fillExtraInfo(leaveApply);
|
||||
return leaveApply;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteById(String id) {
|
||||
return this.leaveApplyDao.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(LeaveApply leaveApply) {
|
||||
this.normalizeLeaveApply(leaveApply);
|
||||
return this.leaveApplyDao.insert(leaveApply);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(LeaveApply leaveApply) {
|
||||
this.normalizeLeaveApply(leaveApply);
|
||||
return this.leaveApplyDao.updateByPrimaryKeySelective(leaveApply);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LeaveApply> selectListByWhere(String wherestr) {
|
||||
LeaveApply leaveApply = new LeaveApply();
|
||||
leaveApply.setWhere(wherestr);
|
||||
List<LeaveApply> list = this.leaveApplyDao.selectListByWhere(leaveApply);
|
||||
if (list != null) {
|
||||
for (LeaveApply item : list) {
|
||||
this.fillExtraInfo(item);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByWhere(String wherestr) {
|
||||
LeaveApply leaveApply = new LeaveApply();
|
||||
leaveApply.setWhere(wherestr);
|
||||
return this.leaveApplyDao.deleteByWhere(leaveApply);
|
||||
}
|
||||
|
||||
public String getUserNamesByUserIds(String userIds) {
|
||||
if (userIds == null || userIds.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
userIds = userIds.replace(",", "','");
|
||||
String userNames = "";
|
||||
List<User> users = this.userService.selectListByWhere("where id in ('" + userIds + "')");
|
||||
for (User item : users) {
|
||||
if (!userNames.isEmpty()) {
|
||||
userNames += ",";
|
||||
}
|
||||
userNames += item.getCaption();
|
||||
}
|
||||
return userNames;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public int doStartProcess(LeaveApply leaveApply) {
|
||||
try {
|
||||
this.normalizeLeaveApply(leaveApply);
|
||||
String candidateUserIds = this.getDefaultCandidateUserIds(leaveApply, BusinessUnit.UNIT_LEAVE_APPLY_SECTION_AUDIT);
|
||||
Map<String, Object> variables = new HashMap<String, Object>();
|
||||
if (StringUtils.isBlank(candidateUserIds)) {
|
||||
return MaintenanceCommString.Response_StartProcess_NoUser;
|
||||
}
|
||||
variables.put("userIds", candidateUserIds);
|
||||
variables.put("applyType", leaveApply.getApplyType());
|
||||
variables.put("leaveType", leaveApply.getLeaveType());
|
||||
variables.put("days", leaveApply.getDays());
|
||||
variables.put("hours", leaveApply.getHours());
|
||||
variables.put("applicantId", null);
|
||||
|
||||
List<ProcessDefinition> processDefinitions = workflowProcessDefinitionService.getProcessDefsBykey(
|
||||
ProcessType.Administration_Leave.getId() + "-" + leaveApply.getUnitId());
|
||||
if (processDefinitions == null || processDefinitions.size() == 0) {
|
||||
processDefinitions = workflowProcessDefinitionService.getProcessDefsBykey(ProcessType.Administration_Leave.getId());
|
||||
}
|
||||
if (processDefinitions == null || processDefinitions.size() == 0) {
|
||||
return MaintenanceCommString.Response_StartProcess_NoProcessDef;
|
||||
}
|
||||
|
||||
ProcessInstance processInstance = workflowService.startWorkflow(
|
||||
leaveApply.getId(), leaveApply.getInsuser(), processDefinitions.get(0).getKey(), variables);
|
||||
if (processInstance == null) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
leaveApply.setProcessid(processInstance.getId());
|
||||
leaveApply.setProcessdefid(processDefinitions.get(0).getId());
|
||||
leaveApply.setState(LeaveCommStr.STATE_SECTION_AUDIT);
|
||||
leaveApply.setSubmissionTime(leaveApply.getInsdt());
|
||||
|
||||
int res = 0;
|
||||
LeaveApply db = this.selectById(leaveApply.getId());
|
||||
if (db != null) {
|
||||
res = this.leaveApplyDao.updateByPrimaryKeySelective(leaveApply);
|
||||
} else {
|
||||
res = this.leaveApplyDao.insert(leaveApply);
|
||||
}
|
||||
if (res == 1) {
|
||||
User user = userService.getUserById(leaveApply.getInsuser());
|
||||
String recordUser = this.getUserNamesByUserIds(candidateUserIds);
|
||||
BusinessUnitRecord businessUnitRecord = new BusinessUnitRecord(
|
||||
leaveApply.getInsdt(), leaveApply.getInsuser(), leaveApply.getId(), leaveApply.getProcessid(),
|
||||
leaveApply.getUnitId(), null, StringUtils.isBlank(recordUser)
|
||||
? "提交了请假补假申请,等待审批人签收。"
|
||||
: "提交了请假补假申请至" + recordUser + "进行审批。", user, "流程发起");
|
||||
businessUnitRecord.sendMessage(candidateUserIds, "");
|
||||
}
|
||||
return res;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
public int updateStatus(String id) {
|
||||
LeaveApply leaveApply = this.selectById(id);
|
||||
List<Task> task = workflowService.getTaskService().createTaskQuery().processInstanceId(leaveApply.getProcessid()).list();
|
||||
if (task != null && task.size() > 0) {
|
||||
leaveApply.setState(task.get(0).getName());
|
||||
} else {
|
||||
leaveApply.setState(LeaveCommStr.STATE_FINISH);
|
||||
}
|
||||
return this.update(leaveApply);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public int doAuditProcess(BusinessUnitAudit entity) {
|
||||
try {
|
||||
BusinessUnitAdapter businessUnitAdapter = this.selectById(entity.getBusinessid());
|
||||
int res = businessUnitAuditService.doAudit(entity, businessUnitAdapter);
|
||||
if (res > 0) {
|
||||
this.updateStatus(entity.getBusinessid());
|
||||
}
|
||||
return res;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException();
|
||||
}
|
||||
}
|
||||
|
||||
private void fillExtraInfo(LeaveApply leaveApply) {
|
||||
if (leaveApply == null) {
|
||||
return;
|
||||
}
|
||||
if (leaveApply.getAuditManId() != null && !leaveApply.getAuditManId().isEmpty()) {
|
||||
leaveApply.setAuditMan(this.getUserNamesByUserIds(leaveApply.getAuditManId()));
|
||||
} else if (StringUtils.isNotBlank(leaveApply.getProcessid())
|
||||
&& !LeaveCommStr.STATE_FINISH.equals(leaveApply.getState())
|
||||
&& !LeaveCommStr.STATE_DRAFT.equals(leaveApply.getState())) {
|
||||
leaveApply.setAuditMan("待签收");
|
||||
}
|
||||
if (leaveApply.getInsuser() != null && !leaveApply.getInsuser().isEmpty()) {
|
||||
User user = this.userService.getUserById(leaveApply.getInsuser());
|
||||
if (user != null) {
|
||||
leaveApply.setInsuserName(user.getCaption());
|
||||
}
|
||||
}
|
||||
leaveApply.setStateName(leaveApply.getState());
|
||||
}
|
||||
|
||||
private void normalizeLeaveApply(LeaveApply leaveApply) {
|
||||
if (leaveApply == null) {
|
||||
return;
|
||||
}
|
||||
leaveApply.setStartTime(StringUtils.trimToNull(leaveApply.getStartTime()));
|
||||
leaveApply.setEndTime(StringUtils.trimToNull(leaveApply.getEndTime()));
|
||||
leaveApply.setActualStartTime(this.normalizeDateTimeValue(leaveApply.getActualStartTime()));
|
||||
leaveApply.setActualEndTime(this.normalizeDateTimeValue(leaveApply.getActualEndTime()));
|
||||
leaveApply.setHours(StringUtils.trimToNull(leaveApply.getHours()));
|
||||
leaveApply.setDays(StringUtils.trimToNull(leaveApply.getDays()));
|
||||
leaveApply.setOvertimeHours(StringUtils.trimToNull(leaveApply.getOvertimeHours()));
|
||||
this.calculateDuration(leaveApply);
|
||||
leaveApply.setStartTime(this.normalizeLeaveTimeValue(leaveApply.getStartTime()));
|
||||
leaveApply.setEndTime(this.normalizeLeaveTimeValue(leaveApply.getEndTime()));
|
||||
}
|
||||
|
||||
public String getDefaultCandidateUserIds(LeaveApply leaveApply) {
|
||||
return this.getDefaultCandidateUserIds(leaveApply, null);
|
||||
}
|
||||
|
||||
public String getDefaultCandidateUserIds(LeaveApply leaveApply, String taskDefinitionKey) {
|
||||
if (leaveApply == null) {
|
||||
return null;
|
||||
}
|
||||
String resourceId = StringUtils.trimToNull(taskDefinitionKey);
|
||||
if (resourceId == null) {
|
||||
resourceId = BusinessUnit.UNIT_LEAVE_APPLY_SECTION_AUDIT;
|
||||
}
|
||||
String jobIds = StringUtils.trimToNull(this.jobService.getJobs4Activiti(
|
||||
leaveApply.getUnitId(), ProcessType.Administration_Leave.getId(), resourceId));
|
||||
if (StringUtils.isBlank(jobIds) && !BusinessUnit.UNIT_LEAVE_APPLY_SECTION_AUDIT.equals(resourceId)) {
|
||||
jobIds = StringUtils.trimToNull(this.jobService.getJobs4Activiti(
|
||||
leaveApply.getUnitId(), ProcessType.Administration_Leave.getId()));
|
||||
}
|
||||
Set<String> unitUserIds = new LinkedHashSet<String>();
|
||||
List<User> unitUsers = this.unitService.getChildrenUsersById(leaveApply.getUnitId());
|
||||
if (unitUsers != null) {
|
||||
for (User user : unitUsers) {
|
||||
if (user != null && StringUtils.isNotBlank(user.getId())) {
|
||||
unitUserIds.add(user.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
Set<String> candidateUserIds = new LinkedHashSet<String>();
|
||||
if (StringUtils.isNotBlank(jobIds)) {
|
||||
List<com.sipai.entity.user.UserJob> userJobs = this.userJobService.selectListByWhere(
|
||||
"where jobid in ('" + jobIds.replace(",", "','") + "')");
|
||||
if (userJobs != null) {
|
||||
for (com.sipai.entity.user.UserJob userJob : userJobs) {
|
||||
if (userJob != null && StringUtils.isNotBlank(userJob.getUserid())
|
||||
&& (unitUserIds.isEmpty() || unitUserIds.contains(userJob.getUserid()))) {
|
||||
candidateUserIds.add(userJob.getUserid());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (candidateUserIds.isEmpty()) {
|
||||
candidateUserIds.addAll(unitUserIds);
|
||||
}
|
||||
return this.joinUserIds(new ArrayList<String>(candidateUserIds));
|
||||
}
|
||||
|
||||
public String getDefaultCandidateUserIdsForNextTask(LeaveApply leaveApply, String currentTaskDefinitionKey, Integer routeNum, boolean passStatus) {
|
||||
if (leaveApply == null || StringUtils.isBlank(leaveApply.getProcessdefid()) || StringUtils.isBlank(currentTaskDefinitionKey)) {
|
||||
return this.getDefaultCandidateUserIds(leaveApply);
|
||||
}
|
||||
List<com.sipai.entity.activiti.WorkTask> nextWorkTasks =
|
||||
workflowProcessDefinitionService.getNextWorkTasks(leaveApply.getProcessdefid(), currentTaskDefinitionKey);
|
||||
if (nextWorkTasks == null || nextWorkTasks.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
int expectedRouteNum = routeNum == null ? -1 : routeNum;
|
||||
boolean matchedRoute = false;
|
||||
for (com.sipai.entity.activiti.WorkTask workTask : nextWorkTasks) {
|
||||
if (workTask == null) {
|
||||
continue;
|
||||
}
|
||||
if (workTask.isPassFlag() != passStatus) {
|
||||
continue;
|
||||
}
|
||||
if (expectedRouteNum >= 0 && workTask.getRouteNum() != expectedRouteNum) {
|
||||
continue;
|
||||
}
|
||||
matchedRoute = true;
|
||||
if (!"userTask".equals(workTask.getType())) {
|
||||
continue;
|
||||
}
|
||||
return this.getDefaultCandidateUserIds(leaveApply, workTask.getTaskKey());
|
||||
}
|
||||
return matchedRoute ? null : this.getDefaultCandidateUserIds(leaveApply);
|
||||
}
|
||||
|
||||
private String joinUserIds(List<String> userIds) {
|
||||
if (userIds == null || userIds.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder builder = new StringBuilder();
|
||||
for (String userId : userIds) {
|
||||
if (StringUtils.isBlank(userId)) {
|
||||
continue;
|
||||
}
|
||||
if (builder.length() > 0) {
|
||||
builder.append(",");
|
||||
}
|
||||
builder.append(userId.trim());
|
||||
}
|
||||
return builder.length() == 0 ? null : builder.toString();
|
||||
}
|
||||
|
||||
private void calculateDuration(LeaveApply leaveApply) {
|
||||
if (StringUtils.isBlank(leaveApply.getStartTime()) || StringUtils.isBlank(leaveApply.getEndTime())) {
|
||||
leaveApply.setHours(null);
|
||||
leaveApply.setDays(null);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (this.isHalfDayValue(leaveApply.getStartTime()) && this.isHalfDayValue(leaveApply.getEndTime())) {
|
||||
LeaveTimePoint startPoint = this.parseLeaveTimePoint(leaveApply.getStartTime());
|
||||
LeaveTimePoint endPoint = this.parseLeaveTimePoint(leaveApply.getEndTime());
|
||||
int halfDays = this.calculateHalfDays(startPoint, endPoint);
|
||||
if (halfDays <= 0) {
|
||||
leaveApply.setHours(null);
|
||||
leaveApply.setDays(null);
|
||||
return;
|
||||
}
|
||||
leaveApply.setHours(this.formatDecimal(BigDecimal.valueOf(halfDays * 4L)));
|
||||
leaveApply.setDays(this.formatDecimal(BigDecimal.valueOf(halfDays).divide(BigDecimal.valueOf(2), 1, RoundingMode.HALF_UP)));
|
||||
return;
|
||||
}
|
||||
|
||||
Date startDate = this.parseDateTime(leaveApply.getStartTime());
|
||||
Date endDate = this.parseDateTime(leaveApply.getEndTime());
|
||||
long diffMillis = endDate.getTime() - startDate.getTime();
|
||||
if (diffMillis <= 0) {
|
||||
leaveApply.setHours(null);
|
||||
leaveApply.setDays(null);
|
||||
return;
|
||||
}
|
||||
BigDecimal hours = BigDecimal.valueOf(diffMillis)
|
||||
.divide(BigDecimal.valueOf(1000L * 60L * 60L), 2, RoundingMode.HALF_UP);
|
||||
BigDecimal days = hours.divide(BigDecimal.valueOf(8), 2, RoundingMode.HALF_UP);
|
||||
if (days.compareTo(BigDecimal.valueOf(0.5)) < 0) {
|
||||
days = BigDecimal.valueOf(0.5);
|
||||
}
|
||||
leaveApply.setHours(this.formatDecimal(hours));
|
||||
leaveApply.setDays(this.formatDecimal(days));
|
||||
} catch (ParseException e) {
|
||||
leaveApply.setHours(null);
|
||||
leaveApply.setDays(null);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isHalfDayValue(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return false;
|
||||
}
|
||||
String trimmed = StringUtils.trim(value);
|
||||
if (trimmed.matches("^\\d{4}-\\d{2}-\\d{2}\\s+(上午|下午)$")) {
|
||||
return true;
|
||||
}
|
||||
return trimmed.matches("^\\d{4}-\\d{2}-\\d{2}\\s+(00:00(?::00)?|12:00(?::00)?)$");
|
||||
}
|
||||
|
||||
private LeaveTimePoint parseLeaveTimePoint(String value) throws ParseException {
|
||||
String[] parts = StringUtils.trim(value).split("\\s+");
|
||||
if (parts.length != 2) {
|
||||
throw new ParseException("Unsupported leave time format: " + value, 0);
|
||||
}
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
sdf.setLenient(false);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(sdf.parse(parts[0]));
|
||||
return new LeaveTimePoint(calendar, this.parsePeriodIndex(parts[1]));
|
||||
}
|
||||
|
||||
private int calculateHalfDays(LeaveTimePoint startPoint, LeaveTimePoint endPoint) {
|
||||
long diffMillis = endPoint.calendar.getTimeInMillis() - startPoint.calendar.getTimeInMillis();
|
||||
int dayDiff = (int) (diffMillis / (1000 * 60 * 60 * 24));
|
||||
return dayDiff * 2 + (endPoint.periodIndex - startPoint.periodIndex) + 1;
|
||||
}
|
||||
|
||||
private int parsePeriodIndex(String period) throws ParseException {
|
||||
if ("下午".equals(period) || "12:00".equals(period) || "12:00:00".equals(period)) {
|
||||
return 1;
|
||||
}
|
||||
if ("上午".equals(period) || "00:00".equals(period) || "00:00:00".equals(period)) {
|
||||
return 0;
|
||||
}
|
||||
throw new ParseException("Unsupported leave period: " + period, 0);
|
||||
}
|
||||
|
||||
private String normalizeLeaveTimeValue(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return null;
|
||||
}
|
||||
String trimmed = StringUtils.trim(value);
|
||||
if (!trimmed.matches("^\\d{4}-\\d{2}-\\d{2}\\s+(上午|下午)$")) {
|
||||
return this.normalizeDateTimeValue(trimmed);
|
||||
}
|
||||
String[] parts = trimmed.split("\\s+");
|
||||
return parts[0] + ("下午".equals(parts[1]) ? " 12:00:00" : " 00:00:00");
|
||||
}
|
||||
|
||||
private String normalizeDateTimeValue(String value) {
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return null;
|
||||
}
|
||||
String trimmed = StringUtils.trim(value);
|
||||
String[] patterns = new String[]{"yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM-dd"};
|
||||
for (String pattern : patterns) {
|
||||
try {
|
||||
SimpleDateFormat parser = new SimpleDateFormat(pattern);
|
||||
parser.setLenient(false);
|
||||
Date parsed = parser.parse(trimmed);
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
return formatter.format(parsed);
|
||||
} catch (ParseException e) {
|
||||
// try next format
|
||||
}
|
||||
}
|
||||
return trimmed;
|
||||
}
|
||||
|
||||
private Date parseDateTime(String value) throws ParseException {
|
||||
String trimmed = StringUtils.trim(value);
|
||||
String[] patterns = new String[]{"yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM-dd"};
|
||||
for (String pattern : patterns) {
|
||||
try {
|
||||
SimpleDateFormat parser = new SimpleDateFormat(pattern);
|
||||
parser.setLenient(false);
|
||||
return parser.parse(trimmed);
|
||||
} catch (ParseException e) {
|
||||
// try next format
|
||||
}
|
||||
}
|
||||
throw new ParseException("Unsupported datetime format: " + value, 0);
|
||||
}
|
||||
|
||||
private String formatDecimal(BigDecimal value) {
|
||||
return value.stripTrailingZeros().toPlainString();
|
||||
}
|
||||
|
||||
private static class LeaveTimePoint {
|
||||
private final Calendar calendar;
|
||||
private final int periodIndex;
|
||||
|
||||
private LeaveTimePoint(Calendar calendar, int periodIndex) {
|
||||
this.calendar = calendar;
|
||||
this.periodIndex = periodIndex;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -20,9 +20,12 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@ -351,6 +354,8 @@ public class CommonFileServiceImpl implements CommonFileService {
|
||||
String errorMsg = e.getMessage();
|
||||
if (errorMsg != null && errorMsg.contains("NoSuchKey")) {
|
||||
logger.error("MinIO文件不存在: bucketName={}, objectName={}", nameSpace, filePath);
|
||||
} else if (errorMsg != null && errorMsg.contains("NoSuchBucket")) {
|
||||
logger.error("MinIO存储桶不存在: bucketName={}, objectName={}", nameSpace, filePath);
|
||||
} else {
|
||||
logger.error("获取MinIO文件失败: bucketName={}, objectName={}, 错误: {}", nameSpace, filePath, errorMsg, e);
|
||||
}
|
||||
@ -375,12 +380,12 @@ public class CommonFileServiceImpl implements CommonFileService {
|
||||
try {
|
||||
// 安全获取文件名(自动检测编码)
|
||||
fileName = getSafeFileName(item);
|
||||
|
||||
|
||||
// 生成MinIO安全的对象名称
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd-HH-mm-ss");
|
||||
String timestamp = dateFormat.format(new Date());
|
||||
filePath = generateMinioObjectName(fileName, timestamp);
|
||||
|
||||
|
||||
InputStream in = item.getInputStream();
|
||||
String contentType = item.getContentType();
|
||||
minioTemplate.makeBucket(nameSpace);
|
||||
@ -389,7 +394,7 @@ public class CommonFileServiceImpl implements CommonFileService {
|
||||
CommonFile commonFile = new CommonFile();
|
||||
commonFile.setId(CommUtil.getUUID());
|
||||
commonFile.setMasterid(masterId);
|
||||
// 20210105 YYJ 用于文件表绑定资料节点用字段 tb_doc_file内和masterId一样
|
||||
// 20210105 YYJ 用于文件表绑定<EFBFBD><EFBFBD>料节点用字段 tb_doc_file内和masterId一样
|
||||
// commonFile.setPid(masterId);
|
||||
commonFile.setFilename(fileName); // 保存原始文件名用于显示
|
||||
commonFile.setType(contentType);
|
||||
@ -398,6 +403,19 @@ public class CommonFileServiceImpl implements CommonFileService {
|
||||
commonFile.setAbspath(filePath); // 保存MinIO对象名称
|
||||
commonFile.setInsdt(CommUtil.nowDate());
|
||||
commonFile.setSize((int) item.getSize());
|
||||
// 获取当前用户ID并设置
|
||||
try {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
if (attributes != null) {
|
||||
HttpServletRequest request = attributes.getRequest();
|
||||
User cu = (User) request.getSession().getAttribute("cu");
|
||||
if (cu != null) {
|
||||
commonFile.setInsuser(cu.getId());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("无法获取当前用户信息: {}", e.getMessage());
|
||||
}
|
||||
res = this.insertByTable(tableName, commonFile);
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to update file to MinIO for masterId: {}", masterId, e);
|
||||
|
||||
@ -112,17 +112,24 @@ public class BusinessUnitAuditService implements CommService<BusinessUnitAudit>{
|
||||
}
|
||||
List<HistoricActivityInstance> list=historyService.createHistoricActivityInstanceQuery().processInstanceId(entity.getProcessid()).activityId(wortTaskId)
|
||||
.orderByHistoricActivityInstanceStartTime().desc().list();
|
||||
if (list != null && list.size()>0) {
|
||||
variables.put(CommString.ACTI_KEK_Assignee, list.get(0).getAssignee());
|
||||
if(entity.getAuditopinion()!=null && !entity.getAuditopinion().isEmpty()){
|
||||
taskService.addComment(entity.getTaskid(), entity.getProcessid(), entity.getAuditopinion());
|
||||
}
|
||||
}else {
|
||||
variables.put(CommString.ACTI_KEK_Assignee, businessUnitAdapter.getInsuser());
|
||||
if(entity.getAuditopinion()!=null && !entity.getAuditopinion().isEmpty()){
|
||||
taskService.addComment(entity.getTaskid(), entity.getProcessid(), entity.getAuditopinion());
|
||||
}
|
||||
// 优先取历史记录中的 assignee;若 assignee 为空(候选人任务未签收),则查 BusinessUnitAudit 记录获取实际提交人
|
||||
String targetAssignee = null;
|
||||
if (list != null && list.size() > 0) {
|
||||
targetAssignee = list.get(0).getAssignee();
|
||||
}
|
||||
if (targetAssignee == null && !wortTaskId.isEmpty()) {
|
||||
// 历史 assignee 为空时,从 BusinessUnitAudit 记录中查找该步骤的实际提交人
|
||||
List<BusinessUnitAudit> previousAuditList = this.selectListByWhere(
|
||||
"where businessid='" + entity.getBusinessid() + "' and taskdefinitionkey='" + wortTaskId + "' order by insdt desc");
|
||||
if (previousAuditList != null && previousAuditList.size() > 0) {
|
||||
targetAssignee = previousAuditList.get(0).getInsuser();
|
||||
}
|
||||
}
|
||||
// 设置退回目标处理人(若仍为空则由流程变量 userIds 确定候选人,不再回退到工单创建人)
|
||||
variables.put(CommString.ACTI_KEK_Assignee, targetAssignee);
|
||||
if(entity.getAuditopinion()!=null && !entity.getAuditopinion().isEmpty()){
|
||||
taskService.addComment(entity.getTaskid(), entity.getProcessid(), entity.getAuditopinion());
|
||||
}
|
||||
}
|
||||
//int res=0;
|
||||
taskService.complete(entity.getTaskid(), variables);
|
||||
@ -141,17 +148,24 @@ public class BusinessUnitAuditService implements CommService<BusinessUnitAudit>{
|
||||
BusinessUnitRecord businessUnitRecord = new BusinessUnitRecord(entity);
|
||||
if(entity.getPassstatus()){
|
||||
//通过
|
||||
if(variables.get(CommString.ACTI_KEK_Candidate_Users)!=null){
|
||||
businessUnitRecord.sendMessage(variables.get(CommString.ACTI_KEK_Candidate_Users).toString(),"");
|
||||
String candidateUsers = variables.get(CommString.ACTI_KEK_Candidate_Users) != null
|
||||
? variables.get(CommString.ACTI_KEK_Candidate_Users).toString() : null;
|
||||
if(candidateUsers != null && !candidateUsers.isEmpty()){
|
||||
// 有下一步接收人,通知下一步处理人
|
||||
businessUnitRecord.sendMessage(candidateUsers, "");
|
||||
}else if(variables.get(CommString.ACTI_KEK_AssigneeList) != null){
|
||||
// 会签
|
||||
businessUnitRecord.sendMessage(entity.getTargetusers(), "");
|
||||
}else{
|
||||
//会签
|
||||
if(variables.get(CommString.ACTI_KEK_AssigneeList)!=null){
|
||||
businessUnitRecord.sendMessage(entity.getTargetusers(),"");
|
||||
}
|
||||
// 最后一步,无下一步处理人,通知当前提交人(完成确认)
|
||||
if(entity.getInsuser() != null && !entity.getInsuser().isEmpty()){
|
||||
businessUnitRecord.sendMessage(entity.getInsuser(), "");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(variables.get(CommString.ACTI_KEK_Assignee)!=null){
|
||||
businessUnitRecord.sendMessage(variables.get(CommString.ACTI_KEK_Assignee).toString(),"");
|
||||
// 退回:通知目标处理人(排除空值,避免错误发送)
|
||||
if(variables.get(CommString.ACTI_KEK_Assignee) != null){
|
||||
businessUnitRecord.sendMessage(variables.get(CommString.ACTI_KEK_Assignee).toString(), "");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -340,7 +340,9 @@ public class EquipmentCardService implements CommService<EquipmentCard> {
|
||||
|
||||
if (item.getEquipmentBelongId() != null && !item.getEquipmentBelongId().isEmpty()) {
|
||||
EquipmentBelong equipmentBelong = this.equipmentBelongService.selectById(item.getEquipmentBelongId());
|
||||
item.set_equipmentBelongName(equipmentBelong.getBelongName());
|
||||
if (equipmentBelong != null) {
|
||||
item.set_equipmentBelongName(equipmentBelong.getBelongName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return equipmentCards;
|
||||
@ -361,23 +363,23 @@ public class EquipmentCardService implements CommService<EquipmentCard> {
|
||||
for (EquipmentCard item : equipmentCards) {
|
||||
if (null != item.getId() && !item.getId().isEmpty()) {
|
||||
EquipmentCardProp cardProp = this.propService.selectByEquipmentId(item.getId());
|
||||
if (cardProp != null && cardProp.getKeynum() != null) {
|
||||
if (cardProp != null) {
|
||||
item.setEquipmentCardProp(cardProp);
|
||||
//查找该设备下的测量点,并将故障点为0的状态给equipmentcardprop的_state
|
||||
//查找该设备下的测量点,并将故障点为 0 的状态给 equipmentcardprop 的_state
|
||||
List<MPoint> mPoints = this.mPointService.selectListByWhere(bizid, "where equipmentId = '" + item.getId() + "' and parmName like '%故障%' ");
|
||||
|
||||
|
||||
if (mPoints != null && mPoints.size() > 0) {
|
||||
if (mPoints.get(0).getParmvalue().compareTo(BigDecimal.ZERO) == 0) {
|
||||
cardProp.set_state(0);
|
||||
} else {
|
||||
cardProp.set_state(1);
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
cardProp.set_state(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -459,7 +461,7 @@ public class EquipmentCardService implements CommService<EquipmentCard> {
|
||||
if (null == item.getEquipmentClearTime()) {
|
||||
item.setEquipmentClearTime(0.0);
|
||||
}
|
||||
if (cardProp.getRunTime() != null) {
|
||||
if (cardProp != null && cardProp.getRunTime() != null) {
|
||||
if (item.getEquipmentSetTime() < cardProp.getRunTime() - item.getEquipmentClearTime()) {
|
||||
remindequipmentCards.add(item);
|
||||
}
|
||||
@ -8422,7 +8424,13 @@ public class EquipmentCardService implements CommService<EquipmentCard> {
|
||||
}
|
||||
}
|
||||
if (childlist.size() > 0) {
|
||||
mp.put("nodes", childlist);
|
||||
// 保留已有的nodes(如工艺段),将子单元添加到现有nodes中
|
||||
List<Map<String, Object>> existingNodes = (List<Map<String, Object>>) mp.get("nodes");
|
||||
if (existingNodes != null && existingNodes.size() > 0) {
|
||||
existingNodes.addAll(childlist);
|
||||
} else {
|
||||
mp.put("nodes", childlist);
|
||||
}
|
||||
getTreeList4ProcessSection(childlist, list);
|
||||
}
|
||||
}
|
||||
@ -8489,7 +8497,13 @@ public class EquipmentCardService implements CommService<EquipmentCard> {
|
||||
}
|
||||
}
|
||||
if (childlist.size() > 0) {
|
||||
mp.put("nodes", childlist);
|
||||
// 保留已有的nodes(如设备类型),将子单元添加到现有nodes中
|
||||
List<Map<String, Object>> existingNodes = (List<Map<String, Object>>) mp.get("nodes");
|
||||
if (existingNodes != null && existingNodes.size() > 0) {
|
||||
existingNodes.addAll(childlist);
|
||||
} else {
|
||||
mp.put("nodes", childlist);
|
||||
}
|
||||
getTreeList4EquipmentClass(childlist, list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,28 +41,33 @@ public class RepairServiceImpl implements RepairService{
|
||||
Repair item=repairDao.selectByPrimaryKey(id);
|
||||
//维修类型
|
||||
EquipmentPlanType eqPlanType=this.equipmentPlanTypeService.selectById(item.getRepairType());
|
||||
item.setRepairTypeName(eqPlanType.getName());
|
||||
if(eqPlanType != null){
|
||||
item.setRepairTypeName(eqPlanType.getName());
|
||||
}
|
||||
//接收人员们
|
||||
String[] receiveUserids=item.getReceiveUserIds().split(",");
|
||||
if(receiveUserids!=null&&receiveUserids.length>0){
|
||||
String receiveUsersName="";
|
||||
for(int u=0;u<receiveUserids.length;u++){
|
||||
User user=this.userService.getUserById(receiveUserids[u]);
|
||||
if(user!=null){
|
||||
receiveUsersName+=user.getCaption()+",";
|
||||
String receiveUserIds = item.getReceiveUserIds();
|
||||
if(receiveUserIds != null && !receiveUserIds.isEmpty()){
|
||||
String[] receiveUseridsArray = receiveUserIds.split(",");
|
||||
if(receiveUseridsArray != null && receiveUseridsArray.length > 0){
|
||||
String receiveUsersName = "";
|
||||
for(int u = 0; u < receiveUseridsArray.length; u++){
|
||||
User user = this.userService.getUserById(receiveUseridsArray[u]);
|
||||
if(user != null){
|
||||
receiveUsersName += user.getCaption() + ",";
|
||||
}
|
||||
}
|
||||
if(receiveUsersName.length() > 0){
|
||||
item.setReceiveUsersName(receiveUsersName.substring(0, receiveUsersName.length() - 1));
|
||||
}
|
||||
}
|
||||
if(receiveUsersName.length()>0){
|
||||
item.setReceiveUsersName(receiveUsersName.substring(0, receiveUsersName.length()-1));
|
||||
}
|
||||
}
|
||||
//接收人员
|
||||
User user=this.userService.getUserById(item.getReceiveUserId());
|
||||
if(user!=null){
|
||||
User user = this.userService.getUserById(item.getReceiveUserId());
|
||||
if(user != null){
|
||||
item.setReceiveUserName(user.getCaption());
|
||||
}
|
||||
//设备
|
||||
EquipmentCard eCard=this.equipmentCardService.selectById(item.getEquipmentId());
|
||||
EquipmentCard eCard = this.equipmentCardService.selectById(item.getEquipmentId());
|
||||
item.setEquipmentCard(eCard);
|
||||
|
||||
return item;
|
||||
@ -91,28 +96,33 @@ public class RepairServiceImpl implements RepairService{
|
||||
for (Repair item : list) {
|
||||
//维修类型
|
||||
EquipmentPlanType eqPlanType=this.equipmentPlanTypeService.selectById(item.getRepairType());
|
||||
item.setRepairTypeName(eqPlanType.getName());
|
||||
if(eqPlanType != null){
|
||||
item.setRepairTypeName(eqPlanType.getName());
|
||||
}
|
||||
//接收人员们
|
||||
String[] receiveUserids=item.getReceiveUserIds().split(",");
|
||||
if(receiveUserids!=null&&receiveUserids.length>0){
|
||||
String receiveUsersName="";
|
||||
for(int u=0;u<receiveUserids.length;u++){
|
||||
User user=this.userService.getUserById(receiveUserids[u]);
|
||||
if(user!=null){
|
||||
receiveUsersName+=user.getCaption()+",";
|
||||
String receiveUserIds = item.getReceiveUserIds();
|
||||
if(receiveUserIds != null && !receiveUserIds.isEmpty()){
|
||||
String[] receiveUseridsArray = receiveUserIds.split(",");
|
||||
if(receiveUseridsArray != null && receiveUseridsArray.length > 0){
|
||||
String receiveUsersName = "";
|
||||
for(int u = 0; u < receiveUseridsArray.length; u++){
|
||||
User user = this.userService.getUserById(receiveUseridsArray[u]);
|
||||
if(user != null){
|
||||
receiveUsersName += user.getCaption() + ",";
|
||||
}
|
||||
}
|
||||
if(receiveUsersName.length() > 0){
|
||||
item.setReceiveUsersName(receiveUsersName.substring(0, receiveUsersName.length() - 1));
|
||||
}
|
||||
}
|
||||
if(receiveUsersName.length()>0){
|
||||
item.setReceiveUsersName(receiveUsersName.substring(0, receiveUsersName.length()-1));
|
||||
}
|
||||
}
|
||||
//接收人员
|
||||
User user=this.userService.getUserById(item.getReceiveUserId());
|
||||
if(user!=null){
|
||||
User user = this.userService.getUserById(item.getReceiveUserId());
|
||||
if(user != null){
|
||||
item.setReceiveUserName(user.getCaption());
|
||||
}
|
||||
//设备
|
||||
EquipmentCard eCard=this.equipmentCardService.selectById(item.getEquipmentId());
|
||||
EquipmentCard eCard = this.equipmentCardService.selectById(item.getEquipmentId());
|
||||
item.setEquipmentCard(eCard);
|
||||
|
||||
}
|
||||
|
||||
@ -454,7 +454,8 @@ public class MsgServiceImpl implements MsgService {
|
||||
String mtypeid = "";
|
||||
int result = 0;
|
||||
MsgType mtype = new MsgType();
|
||||
mtype = this.msgtypeService.getMsgType(" where T.id='" + msgtypeid + "' order by T.insdt").get(0);
|
||||
List<MsgType> msgType = this.msgtypeService.getMsgType(" where T.id='" + msgtypeid + "' order by T.insdt");
|
||||
mtype = msgType.get(0);
|
||||
String sendway = mtype.getSendway();
|
||||
String[] recvids = recvid.split(",");
|
||||
//判断权限
|
||||
|
||||
@ -7,6 +7,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class PipelineDataService implements CommService<PipelineData> {
|
||||
@ -62,4 +63,25 @@ public class PipelineDataService implements CommService<PipelineData> {
|
||||
pipelineData.setWhere(wherestr);
|
||||
return pipelineDataDao.deleteByWhere(pipelineData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取按材质分组的统计数据
|
||||
*/
|
||||
public List<Map<String, Object>> selectMaterialStats() {
|
||||
return pipelineDataDao.selectMaterialStats();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取总统计数据
|
||||
*/
|
||||
public Map<String, Object> selectTotalStats() {
|
||||
return pipelineDataDao.selectTotalStats();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取按管径分组的统计数据
|
||||
*/
|
||||
public List<Map<String, Object>> selectDiameterStats() {
|
||||
return pipelineDataDao.selectDiameterStats();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.sipai.service.report;
|
||||
|
||||
import com.sipai.entity.business.BusinessUnitAudit;
|
||||
import com.sipai.entity.report.RptCreate;
|
||||
import com.sipai.entity.user.User;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
@ -45,4 +46,11 @@ public interface RptCreateService {
|
||||
|
||||
//改变状态
|
||||
public abstract int updateStatus(String id);
|
||||
|
||||
/** 检查用户是否有报表生成权限
|
||||
* @param rptInfoSetId 报表配置id
|
||||
* @param user 当前用户
|
||||
* @return true=有权限, false=无权限
|
||||
*/
|
||||
public abstract boolean checkGeneratePermission(String rptInfoSetId, User user);
|
||||
}
|
||||
@ -60,4 +60,11 @@ public interface RptDayLogService {
|
||||
* @return
|
||||
*/
|
||||
public abstract Result onekeyAudit(String ids ,User cu,String rptdeptId);
|
||||
|
||||
/** 检查用户是否有填报权限
|
||||
* @param rptdeptId 填报配置id
|
||||
* @param user 当前用户
|
||||
* @return true=有权限, false=无权限
|
||||
*/
|
||||
public abstract boolean checkInputPermission(String rptdeptId, User user);
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import com.sipai.entity.report.*;
|
||||
import com.sipai.entity.scada.MPoint;
|
||||
import com.sipai.entity.scada.TempReport;
|
||||
import com.sipai.entity.user.User;
|
||||
import com.sipai.entity.user.UserJob;
|
||||
import com.sipai.entity.work.GroupDetail;
|
||||
import com.sipai.entity.work.Scheduling;
|
||||
import com.sipai.service.activiti.WorkflowProcessDefinitionService;
|
||||
@ -24,6 +25,7 @@ import com.sipai.service.report.*;
|
||||
import com.sipai.service.scada.MPointService;
|
||||
import com.sipai.service.scada.TempReportService;
|
||||
import com.sipai.service.user.UserService;
|
||||
import com.sipai.service.user.UserJobService;
|
||||
import com.sipai.service.work.GroupDetailService;
|
||||
import com.sipai.service.work.SchedulingService;
|
||||
import com.sipai.tools.*;
|
||||
@ -46,6 +48,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.xmlpull.v1.XmlPullParserException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
@ -70,6 +74,7 @@ import static org.apache.poi.ss.usermodel.CellType.FORMULA;
|
||||
@Service("rptCreateService")
|
||||
//@Service
|
||||
public class RptCreateServiceImpl implements RptCreateService {
|
||||
private static final Logger logger = LoggerFactory.getLogger(RptCreateServiceImpl.class);
|
||||
@Resource
|
||||
private RptCreateDao rptCreateDao;
|
||||
@Resource
|
||||
@ -104,6 +109,8 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
private BusinessUnitHandleDetailService businessUnitHandleDetailService;
|
||||
@Resource
|
||||
private GroupDetailService groupDetailService;
|
||||
@Resource
|
||||
private UserJobService userJobService;
|
||||
|
||||
@Override
|
||||
public RptCreate selectById(String id) {
|
||||
@ -393,7 +400,7 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
}
|
||||
}
|
||||
Row row2 = sheet.getRow(row);
|
||||
HSSFCell cell = (HSSFCell) row2.getCell(column);
|
||||
Cell cell = row2.getCell(column);
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -830,6 +837,20 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
// System.out.println("rptdt==============================================================" + rptdt);
|
||||
String rpttype = rptInfoSet.getRpttype();//报表类型
|
||||
String bucketName = "rptinfosetfile";
|
||||
String endtype = ".xls"; // 默认文件扩展名
|
||||
|
||||
// 首先确保report bucket存在
|
||||
try {
|
||||
MinioClient minioClient = new MinioClient(minioProp.getEndPoint(), minioProp.getAccessKey(), minioProp.getSecretKey());
|
||||
boolean isExist = minioClient.bucketExists("report");
|
||||
if (!isExist) {
|
||||
minioClient.makeBucket("report");
|
||||
logger.info("Created MinIO bucket: report");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("Failed to create report bucket", e);
|
||||
}
|
||||
|
||||
List<RptInfoSetFile> filelist = this.rptInfoSetFileService.selectListByWhere(" where masterid='" + rptInfoSet.getId() + "' ");
|
||||
String path = "";
|
||||
try {
|
||||
@ -840,52 +861,59 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
rptInfoSetFile.setAbspath(obj);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
logger.error("Failed to get template file from MinIO", e);
|
||||
}
|
||||
if (filelist == null || filelist.size() == 0) {
|
||||
logger.error("No template file configured for report: {}", rptInfoSet.getId());
|
||||
return null;
|
||||
}
|
||||
if (filelist != null && filelist.size() > 0) {
|
||||
// 设定Excel文件所在路径
|
||||
String excelFileName = filelist.get(0).getAbspath();
|
||||
// 读取Excel文件内容
|
||||
HSSFWorkbook workbook = null;
|
||||
Workbook workbook = null;
|
||||
FileInputStream inputStream = null;
|
||||
byte[] bytes_m = commonFileService.getInputStreamBytes(FileNameSpaceEnum.RptInfoSetFile.getNameSpace(), path);
|
||||
// Check if bytes_m is null or empty
|
||||
if (bytes_m == null || bytes_m.length == 0) {
|
||||
logger.error("Excel template file is empty or not found: {}", path);
|
||||
return null;
|
||||
}
|
||||
// 直接从本地文件创建Workbook, 从输入流创建Workbook
|
||||
InputStream ins = new ByteArrayInputStream(bytes_m);
|
||||
// 构建Workbook对象, 只读Workbook对象
|
||||
// 构建Workbook对象, 只读Workbook对象 - use WorkbookFactory to support both .xls and .xlsx
|
||||
try {
|
||||
workbook = new HSSFWorkbook(ins);
|
||||
workbook = WorkbookFactory.create(ins);
|
||||
} catch (IOException e) {
|
||||
logger.error("Failed to create workbook from file: " + path, e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
String endtype = ".xls";
|
||||
// 更新文件扩展名(根据模板文件)
|
||||
endtype = path.toLowerCase().endsWith(".xlsx") ? ".xlsx" : ".xls";
|
||||
// 生成一个样式,用在表格数据
|
||||
HSSFCellStyle listStyle = null;
|
||||
if (endtype.equals(".xls")) {
|
||||
listStyle = workbook.createCellStyle();
|
||||
// 设置这些样式
|
||||
listStyle.setBorderBottom(BorderStyle.THIN);
|
||||
listStyle.setBorderLeft(BorderStyle.THIN);
|
||||
listStyle.setBorderRight(BorderStyle.THIN);
|
||||
listStyle.setBorderTop(BorderStyle.THIN);
|
||||
listStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
|
||||
listStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
|
||||
//listStyle.setWrapText(false);//不自动换行
|
||||
//listStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("0.00"));//设置格式
|
||||
}
|
||||
CellStyle listStyle = null;
|
||||
listStyle = workbook.createCellStyle();
|
||||
// 设置这些样式
|
||||
listStyle.setBorderBottom(BorderStyle.THIN);
|
||||
listStyle.setBorderLeft(BorderStyle.THIN);
|
||||
listStyle.setBorderRight(BorderStyle.THIN);
|
||||
listStyle.setBorderTop(BorderStyle.THIN);
|
||||
listStyle.setAlignment(HorizontalAlignment.CENTER);//水平居中
|
||||
listStyle.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
|
||||
//listStyle.setWrapText(false);//不自动换行
|
||||
//listStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("0.00"));//设置格式
|
||||
// 生成一个样式,用在表格数据 修改过的数据
|
||||
HSSFCellStyle listStyle2 = null;
|
||||
if (endtype.equals(".xls")) {
|
||||
listStyle2 = workbook.createCellStyle();
|
||||
// 设置这些样式
|
||||
listStyle2.setBorderBottom(BorderStyle.THIN);
|
||||
listStyle2.setBorderLeft(BorderStyle.THIN);
|
||||
listStyle2.setBorderRight(BorderStyle.THIN);
|
||||
listStyle2.setBorderTop(BorderStyle.THIN);
|
||||
listStyle2.setAlignment(HorizontalAlignment.CENTER);//水平居中
|
||||
listStyle2.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
|
||||
listStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
listStyle2.setFillForegroundColor(IndexedColors.GREEN.getIndex());
|
||||
}
|
||||
CellStyle listStyle2 = null;
|
||||
listStyle2 = workbook.createCellStyle();
|
||||
// 设置这些样式
|
||||
listStyle2.setBorderBottom(BorderStyle.THIN);
|
||||
listStyle2.setBorderLeft(BorderStyle.THIN);
|
||||
listStyle2.setBorderRight(BorderStyle.THIN);
|
||||
listStyle2.setBorderTop(BorderStyle.THIN);
|
||||
listStyle2.setAlignment(HorizontalAlignment.CENTER);//水平居中
|
||||
listStyle2.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
|
||||
listStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
listStyle2.setFillForegroundColor(IndexedColors.GREEN.getIndex());
|
||||
List<RptSpSet> rptSpSetlist = this.rptSpSetService.selectListByWhere(" where pid='" + rptInfoSet.getId() + "' and (active !='" + CommString.Active_False_CH + "' or active is null) order by morder asc");
|
||||
if (rptSpSetlist != null && rptSpSetlist.size() > 0) {
|
||||
for (int s = 0; s < rptSpSetlist.size(); s++) {
|
||||
@ -993,10 +1021,10 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
if (spname != null && spname.equals(RptSpSet.RptSpSet_Type_Confirm)) { //接班人 类型
|
||||
for (int ws = 0; ws < workbook.getNumberOfSheets(); ws++) {//获取每个Sheet表
|
||||
if (workbook.getSheetName(ws).equals(rptSpSetlist.get(s).getSheet())) {
|
||||
HSSFSheet sheet = workbook.getSheetAt(ws);
|
||||
HSSFRow row = sheet.getRow(posy - 1);
|
||||
Sheet sheet = workbook.getSheetAt(ws);
|
||||
Row row = sheet.getRow(posy - 1);
|
||||
if (row != null) {
|
||||
HSSFCell cell_d = row.getCell(posx - 1);
|
||||
Cell cell_d = row.getCell(posx - 1);
|
||||
if (cell_d != null) {
|
||||
//插入日志表
|
||||
RptLog rptLog = new RptLog();
|
||||
@ -1029,10 +1057,10 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
} else if (spname != null && spname.equals(RptSpSet.RptSpSet_Type_Rptdt)) {//日期 类型
|
||||
for (int ws = 0; ws < workbook.getNumberOfSheets(); ws++) {//获取每个Sheet表
|
||||
if (workbook.getSheetName(ws).equals(rptSpSetlist.get(s).getSheet())) {
|
||||
HSSFSheet sheet = workbook.getSheetAt(ws);
|
||||
HSSFRow row = sheet.getRow(posy - 1);
|
||||
Sheet sheet = workbook.getSheetAt(ws);
|
||||
Row row = sheet.getRow(posy - 1);
|
||||
if (row != null) {
|
||||
HSSFCell cell_d = row.getCell(posx - 1);
|
||||
Cell cell_d = row.getCell(posx - 1);
|
||||
if (cell_d != null) {
|
||||
try {
|
||||
cell_d.setCellStyle(cell_d.getCellStyle());
|
||||
@ -1058,10 +1086,10 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
} else if (spname != null && spname.equals(RptSpSet.RptSpSet_Type_BanZhang)) {//值班班长 类型
|
||||
for (int ws = 0; ws < workbook.getNumberOfSheets(); ws++) {//获取每个Sheet表
|
||||
if (workbook.getSheetName(ws).equals(rptSpSetlist.get(s).getSheet())) {
|
||||
HSSFSheet sheet = workbook.getSheetAt(ws);
|
||||
HSSFRow row = sheet.getRow(posy - 1);
|
||||
Sheet sheet = workbook.getSheetAt(ws);
|
||||
Row row = sheet.getRow(posy - 1);
|
||||
if (row != null) {
|
||||
HSSFCell cell_d = row.getCell(posx - 1);
|
||||
Cell cell_d = row.getCell(posx - 1);
|
||||
if (cell_d != null) {
|
||||
//插入日志表
|
||||
RptLog rptLog = new RptLog();
|
||||
@ -1094,10 +1122,10 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
} else if (spname != null && spname.equals(RptSpSet.RptSpSet_Type_ZuYuan)) { //值班组员 类型
|
||||
for (int ws = 0; ws < workbook.getNumberOfSheets(); ws++) {//获取每个Sheet表
|
||||
if (workbook.getSheetName(ws).equals(rptSpSetlist.get(s).getSheet())) {
|
||||
HSSFSheet sheet = workbook.getSheetAt(ws);
|
||||
HSSFRow row = sheet.getRow(posy - 1);
|
||||
Sheet sheet = workbook.getSheetAt(ws);
|
||||
Row row = sheet.getRow(posy - 1);
|
||||
if (row != null) {
|
||||
HSSFCell cell_d = row.getCell(posx - 1);
|
||||
Cell cell_d = row.getCell(posx - 1);
|
||||
if (cell_d != null) {
|
||||
//插入日志表
|
||||
RptLog rptLog = new RptLog();
|
||||
@ -1134,12 +1162,12 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
for (int r = 0; r < rpttemplist.size(); r++) {
|
||||
for (int ws = 0; ws < workbook.getNumberOfSheets(); ws++) {//获取每个Sheet表
|
||||
if (workbook.getSheetName(ws).equals(rptSpSetlist.get(s).getSheet())) {
|
||||
HSSFSheet sheet = workbook.getSheetAt(ws);
|
||||
HSSFRow row = sheet.getRow(rpttemplist.get(r).getColposy() - 1);
|
||||
Sheet sheet = workbook.getSheetAt(ws);
|
||||
Row row = sheet.getRow(rpttemplist.get(r).getColposy() - 1);
|
||||
if (row != null) {
|
||||
Cell cell_d = row.getCell(rpttemplist.get(r).getColposx() - 1);
|
||||
if (cell_d != null) {
|
||||
HSSFCellStyle cellStyle = row.getCell(rpttemplist.get(r).getColposx() - 1).getCellStyle();
|
||||
CellStyle cellStyle = row.getCell(rpttemplist.get(r).getColposx() - 1).getCellStyle();
|
||||
// HSSFCellStyle cellStyle_r = row.getCell(rpttemplist.get(r).getColposx() - 1).getCellStyle();
|
||||
try {
|
||||
/**
|
||||
@ -1286,9 +1314,9 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
*/
|
||||
List<RptLog> list = rptLogService.selectListByWhere("where creat_id = '" + rptCreate.getId() + "'");
|
||||
for (RptLog rptLog : list) {
|
||||
HSSFSheet sheet = workbook.getSheet(rptLog.getSheet());
|
||||
Sheet sheet = workbook.getSheet(rptLog.getSheet());
|
||||
if (rptLog.getPosyE() != null && !rptLog.getPosyE().equals("") && sheet != null) {
|
||||
HSSFRow row = sheet.getRow(Integer.parseInt(rptLog.getPosyE()) - 1);
|
||||
Row row = sheet.getRow(Integer.parseInt(rptLog.getPosyE()) - 1);
|
||||
if (row != null) {
|
||||
Cell cell_d = row.getCell(Integer.parseInt(rptLog.getPosxE()) - 1);
|
||||
if (cell_d != null) {
|
||||
@ -1369,6 +1397,10 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
//删除文件 只保留minio中的文件
|
||||
File file = new File(file3);//根据指定的文件名创建File对象
|
||||
file.delete();
|
||||
|
||||
// 保存文件路径到数据库
|
||||
rptCreate.setAbspath(showname + endtype);
|
||||
rptCreateDao.updateByPrimaryKeySelective(rptCreate);
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
@ -1907,4 +1939,54 @@ public class RptCreateServiceImpl implements RptCreateService {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户是否有报表生成权限
|
||||
* @param rptInfoSetId 报表配置id
|
||||
* @param user 当前用户
|
||||
* @return true=有权限, false=无权限
|
||||
*/
|
||||
@Override
|
||||
public boolean checkGeneratePermission(String rptInfoSetId, User user) {
|
||||
if (user == null || rptInfoSetId == null || rptInfoSetId.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 管理员默认有权限
|
||||
if ("emp01".equals(user.getId())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 获取报表配置信息
|
||||
RptInfoSet rptInfoSet = rptInfoSetService.selectById4Simple(rptInfoSetId);
|
||||
if (rptInfoSet == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String userId = user.getId();
|
||||
|
||||
// 检查用户是否在createusers列表中
|
||||
String createusers = rptInfoSet.getCreateusers();
|
||||
if (createusers != null && !createusers.isEmpty()) {
|
||||
if (createusers.contains(userId)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 检查用户岗位是否在generate_position列表中
|
||||
String generatePosition = rptInfoSet.getGeneratePosition();
|
||||
if (generatePosition != null && !generatePosition.isEmpty()) {
|
||||
// 获取用户的所有岗位
|
||||
List<UserJob> userJobs = userJobService.selectListByWhere(" where userid='" + userId + "'");
|
||||
if (userJobs != null && !userJobs.isEmpty()) {
|
||||
for (UserJob userJob : userJobs) {
|
||||
if (generatePosition.contains(userJob.getJobid())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.sipai.entity.scada.MPoint;
|
||||
import com.sipai.entity.scada.MPointExpand;
|
||||
import com.sipai.entity.scada.MPointHistory;
|
||||
import com.sipai.entity.user.User;
|
||||
import com.sipai.entity.user.UserJob;
|
||||
import com.sipai.service.msg.MsgService;
|
||||
import com.sipai.service.msg.MsgServiceImpl;
|
||||
import com.sipai.service.msg.MsgTypeService;
|
||||
@ -20,6 +21,7 @@ import com.sipai.service.scada.MPointExpandService;
|
||||
import com.sipai.service.scada.MPointHistoryService;
|
||||
import com.sipai.service.scada.MPointService;
|
||||
import com.sipai.service.user.UserService;
|
||||
import com.sipai.service.user.UserJobService;
|
||||
import com.sipai.tools.CommUtil;
|
||||
import com.sipai.tools.SpringContextUtil;
|
||||
import net.sf.json.JSONArray;
|
||||
@ -65,6 +67,8 @@ public class RptDayLogServiceImpl implements RptDayLogService {
|
||||
private MsgTypeService msgtypeService;
|
||||
@Resource
|
||||
private MPointExpandService mPointExpandService;
|
||||
@Resource
|
||||
private UserJobService userJobService;
|
||||
|
||||
@Override
|
||||
public RptDayLog selectById(String id) {
|
||||
@ -877,5 +881,69 @@ public class RptDayLogServiceImpl implements RptDayLogService {
|
||||
Result result = Result.success(1);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkInputPermission(String rptdeptId, User user) {
|
||||
if (rptdeptId == null || user == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RptDeptSet rptDeptSet = this.rptDeptSetService.selectById(rptdeptId);
|
||||
if (rptDeptSet == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Integer roleType = rptDeptSet.getRoleType();
|
||||
String inputuser = rptDeptSet.getInputuser();
|
||||
String inputjob = rptDeptSet.getInputjob();
|
||||
String userId = user.getId();
|
||||
|
||||
// role_type=2: 不控制权限,所有人都可以填报
|
||||
if (roleType != null && roleType == 2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// role_type 为 null 或空字符串: 允许所有人
|
||||
if (roleType == null || roleType == 0 && (inputuser == null || inputuser.isEmpty())
|
||||
|| roleType == 1 && (inputjob == null || inputjob.isEmpty())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// role_type=0: 按用户控制权限
|
||||
if (roleType == 0) {
|
||||
if (inputuser != null && !inputuser.isEmpty()) {
|
||||
// 检查当前用户ID是否在inputuser中
|
||||
String[] userIds = inputuser.split(",");
|
||||
for (String uid : userIds) {
|
||||
if (userId.equals(uid.trim())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// role_type=1: 按岗位控制权限
|
||||
if (roleType == 1) {
|
||||
if (inputjob != null && !inputjob.isEmpty()) {
|
||||
// 获取当前用户的所有岗位
|
||||
List<UserJob> userJobs = this.userJobService.selectListByWhere("where userid = '" + userId + "'");
|
||||
if (userJobs != null && !userJobs.isEmpty()) {
|
||||
String[] jobIds = inputjob.split(",");
|
||||
for (UserJob userJob : userJobs) {
|
||||
String userJobId = userJob.getJobid();
|
||||
for (String jobId : jobIds) {
|
||||
if (userJobId != null && userJobId.equals(jobId.trim())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -47,12 +47,22 @@ public class SafetyCheckActivityService {
|
||||
if (processDefinitions == null || processDefinitions.size() == 0) {
|
||||
return Result.failed(company.getName() + "缺少该流程定义。");
|
||||
}
|
||||
// 防止重复发起:若该业务已有运行中的流程实例,则跳过,避免创建双倍待办任务
|
||||
List<org.activiti.engine.runtime.ProcessInstance> existingInstances = workflowService.getRuntimeService()
|
||||
.createProcessInstanceQuery()
|
||||
.processDefinitionKey(processKey)
|
||||
.processInstanceBusinessKey(bizId)
|
||||
.active()
|
||||
.list();
|
||||
if (existingInstances != null && !existingInstances.isEmpty()) {
|
||||
return Result.success();
|
||||
}
|
||||
// 启动流程实例
|
||||
// 设置网关条件
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(CommString.ACTI_KEK_Condition, 1);
|
||||
map.put(CommString.ACTI_KEK_Assignee, applyUserId);
|
||||
map.put(CommString.ACTI_KEK_Candidate_Users, applyUserId);
|
||||
map.put(CommString.ACTI_KEK_Candidate_Users, "");
|
||||
|
||||
// 启动流程
|
||||
ProcessInstance processInstance = workflowService.startWorkflow(
|
||||
@ -71,7 +81,7 @@ public class SafetyCheckActivityService {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put(CommString.ACTI_KEK_Condition, 1);
|
||||
map2.put(CommString.ACTI_KEK_Assignee, nextUserId);
|
||||
map2.put(CommString.ACTI_KEK_Candidate_Users, nextUserId);
|
||||
map2.put(CommString.ACTI_KEK_Candidate_Users, "");
|
||||
workflowService.getTaskService().complete(task.getId(), map2);
|
||||
|
||||
return Result.success();
|
||||
@ -84,13 +94,16 @@ public class SafetyCheckActivityService {
|
||||
* @Date: 2022/10/10
|
||||
**/
|
||||
public Result audit(String nextUserId, String processInstanceId, int pass) {
|
||||
Task task =
|
||||
workflowService.getTaskService().createTaskQuery().processInstanceId(processInstanceId).singleResult();
|
||||
List<Task> tasks = workflowService.getTaskService().createTaskQuery().processInstanceId(processInstanceId).active().list();
|
||||
if (tasks == null || tasks.isEmpty()) {
|
||||
return Result.failed("No active task found for process instance: " + processInstanceId);
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put(CommString.ACTI_KEK_Condition, pass);
|
||||
map.put(CommString.ACTI_KEK_Assignee, nextUserId);
|
||||
map.put(CommString.ACTI_KEK_Candidate_Users, nextUserId);
|
||||
workflowService.getTaskService().complete(task.getId(), map);
|
||||
map.put(CommString.ACTI_KEK_Candidate_Users, "");
|
||||
// 只完成第一个任务,防止多任务场景下指数级创建待办(如因重复发起导致有多个并发任务时)
|
||||
workflowService.getTaskService().complete(tasks.get(0).getId(), map);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
|
||||
@ -101,6 +101,9 @@ public class SafetyFilesService implements CommService<SafetyFiles> {
|
||||
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
||||
List<MultipartFile> files = multipartRequest.getFiles("file");
|
||||
for (MultipartFile mfile : files) {
|
||||
if (mfile == null || mfile.getSize() == 0) {
|
||||
continue;
|
||||
}
|
||||
String suffix = mfile.getOriginalFilename().substring(mfile.getOriginalFilename().lastIndexOf("."));
|
||||
|
||||
//判断保存文件的路径是否存在
|
||||
|
||||
@ -100,44 +100,65 @@ public class SafetyFlowTaskService implements CommService<SafetyFlowTask> {
|
||||
String copyNames,
|
||||
String record) throws ServiceException {
|
||||
|
||||
SafetyFlowTask safetyFlowTask;
|
||||
SafetyFlowTask safetyFlowTask = null;
|
||||
List<SafetyFlowTask> list = selectListByWhere(" where biz_id='" + bizId + "' order by create_time desc");
|
||||
if (list != null && list.size() != 0 && list.get(0).getTaskName().equals(taskTitle)) {
|
||||
safetyFlowTask = list.get(0);
|
||||
safetyFlowTask.setIsDone(true);
|
||||
safetyFlowTask.setCopy(copyNames);
|
||||
safetyFlowTask.setDoneTime(DateUtil.toStr(null, new Date()));
|
||||
update(safetyFlowTask);
|
||||
} else if (list != null && list.size() != 0 && !list.get(0).getTaskName().equals(taskTitle)) {
|
||||
safetyFlowTask = list.get(0);
|
||||
safetyFlowTask.setIsDone(true);
|
||||
safetyFlowTask.setCopy(copyNames);
|
||||
safetyFlowTask.setDoneTime(DateUtil.toStr(null, new Date()));
|
||||
update(safetyFlowTask);
|
||||
|
||||
safetyFlowTask = new SafetyFlowTask();
|
||||
|
||||
safetyFlowTask.setId(UUID.randomUUID().toString());
|
||||
safetyFlowTask.setBizId(bizId);
|
||||
safetyFlowTask.setTaskName(taskTitle);
|
||||
safetyFlowTask.setIsDone(isDone);
|
||||
safetyFlowTask.setDoneTime(isDone ? DateUtil.toStr(null, new Date()) : null);
|
||||
safetyFlowTask.setAuditor(auditorName);
|
||||
safetyFlowTask.setCopy(copyNames);
|
||||
save(safetyFlowTask);
|
||||
|
||||
} else {
|
||||
safetyFlowTask = new SafetyFlowTask();
|
||||
|
||||
safetyFlowTask.setId(UUID.randomUUID().toString());
|
||||
safetyFlowTask.setBizId(bizId);
|
||||
safetyFlowTask.setTaskName(taskTitle);
|
||||
safetyFlowTask.setIsDone(isDone);
|
||||
safetyFlowTask.setDoneTime(isDone ? DateUtil.toStr(null, new Date()) : null);
|
||||
safetyFlowTask.setAuditor(auditorName);
|
||||
safetyFlowTask.setCopy(copyNames);
|
||||
save(safetyFlowTask);
|
||||
|
||||
// 查找是否已存在相同taskTitle的记录
|
||||
SafetyFlowTask existingTask = null;
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (SafetyFlowTask task : list) {
|
||||
if (task.getTaskName().equals(taskTitle)) {
|
||||
existingTask = task;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isDone) {
|
||||
// 标记任务为完成
|
||||
if (existingTask != null) {
|
||||
// 更新已存在的记录
|
||||
existingTask.setIsDone(true);
|
||||
existingTask.setCopy(copyNames);
|
||||
existingTask.setDoneTime(DateUtil.toStr(null, new Date()));
|
||||
update(existingTask);
|
||||
safetyFlowTask = existingTask;
|
||||
} else {
|
||||
// 创建新的完成记录
|
||||
safetyFlowTask = new SafetyFlowTask();
|
||||
safetyFlowTask.setId(UUID.randomUUID().toString());
|
||||
safetyFlowTask.setBizId(bizId);
|
||||
safetyFlowTask.setTaskName(taskTitle);
|
||||
safetyFlowTask.setIsDone(true);
|
||||
safetyFlowTask.setDoneTime(DateUtil.toStr(null, new Date()));
|
||||
safetyFlowTask.setAuditor(auditorName);
|
||||
safetyFlowTask.setCopy(copyNames);
|
||||
save(safetyFlowTask);
|
||||
}
|
||||
} else {
|
||||
// 创建待处理任务
|
||||
if (existingTask == null) {
|
||||
// 不存在才创建
|
||||
safetyFlowTask = new SafetyFlowTask();
|
||||
safetyFlowTask.setId(UUID.randomUUID().toString());
|
||||
safetyFlowTask.setBizId(bizId);
|
||||
safetyFlowTask.setTaskName(taskTitle);
|
||||
safetyFlowTask.setIsDone(false);
|
||||
safetyFlowTask.setDoneTime(null);
|
||||
safetyFlowTask.setAuditor(auditorName);
|
||||
safetyFlowTask.setCopy(copyNames);
|
||||
save(safetyFlowTask);
|
||||
} else {
|
||||
// 已存在,重置为待处理状态(用于流程回退后重新处理)
|
||||
existingTask.setIsDone(false);
|
||||
existingTask.setDoneTime(null);
|
||||
existingTask.setAuditor(auditorName);
|
||||
existingTask.setCopy(copyNames);
|
||||
update(existingTask);
|
||||
safetyFlowTask = existingTask;
|
||||
}
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(record)) {
|
||||
SafetyFlowTaskDetail safetyFlowTaskDetail = new SafetyFlowTaskDetail();
|
||||
safetyFlowTaskDetail.setId(UUID.randomUUID().toString());
|
||||
|
||||
111
src/main/java/com/sipai/service/scada/MPointDataService.java
Normal file
111
src/main/java/com/sipai/service/scada/MPointDataService.java
Normal file
@ -0,0 +1,111 @@
|
||||
package com.sipai.service.scada;
|
||||
|
||||
import com.sipai.dao.scada.MPointDataDao;
|
||||
import com.sipai.entity.scada.MPointData;
|
||||
import com.sipai.tools.CommService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class MPointDataService implements CommService<MPointData> {
|
||||
|
||||
@Resource
|
||||
private MPointDataDao mPointDataDao;
|
||||
|
||||
/**
|
||||
* 构建表名
|
||||
* @param mPointKey 测点编码(如:DO1)
|
||||
* @return 完整表名(如:tb_mp_DO1)
|
||||
*/
|
||||
public String buildTableName(String mPointKey) {
|
||||
if (mPointKey == null || mPointKey.isEmpty()) {
|
||||
throw new IllegalArgumentException("mPointKey cannot be null or empty");
|
||||
}
|
||||
return "tb_mp_" + mPointKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查表是否存在
|
||||
* @param mPointKey 测点编码
|
||||
* @return 是否存在
|
||||
*/
|
||||
public boolean checkTableExists(String mPointKey) {
|
||||
String tableName = buildTableName(mPointKey);
|
||||
return mPointDataDao.checkTableExists(tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最新一条数据(当前值)
|
||||
* @param mPointKey 测点编码
|
||||
* @param companyKey 公司编码(可选)
|
||||
* @param startTime 开始时间(可选)
|
||||
* @param endTime 结束时间(可选)
|
||||
* @return 最新一条数据
|
||||
*/
|
||||
public MPointData getLatestData(String mPointKey, String companyKey,
|
||||
Date startTime, Date endTime) {
|
||||
String tableName = buildTableName(mPointKey);
|
||||
return mPointDataDao.selectLatest(tableName, companyKey, startTime, endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取统计数据
|
||||
* @param mPointKey 测点编码
|
||||
* @param companyKey 公司编码(可选)
|
||||
* @param startTime 开始时间(可选)
|
||||
* @param endTime 结束时间(可选)
|
||||
* @return 统计数据
|
||||
*/
|
||||
public Map<String, Object> getStatistics(String mPointKey, String companyKey,
|
||||
Date startTime, Date endTime) {
|
||||
String tableName = buildTableName(mPointKey);
|
||||
return mPointDataDao.selectStatistics(tableName, companyKey, startTime, endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取每日汇总数据
|
||||
* @param mPointKey 测点编码
|
||||
* @param startTime 开始时间
|
||||
* @param endTime 结束时间
|
||||
* @return 每天汇总数据列表
|
||||
*/
|
||||
public List<Map<String, Object>> getDailyAggregation(String mPointKey,
|
||||
Date startTime, Date endTime) {
|
||||
String tableName = buildTableName(mPointKey);
|
||||
return mPointDataDao.selectDailyAggregation(tableName, startTime, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MPointData selectById(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteById(String id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(MPointData entity) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(MPointData entity) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MPointData> selectListByWhere(String wherestr) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByWhere(String wherestr) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -17,15 +17,14 @@ import com.sipai.service.equipment.EquipmentCardService;
|
||||
import com.sipai.service.user.UnitService;
|
||||
import com.sipai.service.work.ModbusFigService;
|
||||
import com.sipai.service.work.ScadaPic_MPointService;
|
||||
import com.sipai.tools.CommString;
|
||||
import com.sipai.tools.CommUtil;
|
||||
import com.sipai.tools.ValueTypeEnum;
|
||||
import com.sipai.tools.*;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.usermodel.DateUtil;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.XSSFCell;
|
||||
import org.apache.poi.xssf.usermodel.XSSFRow;
|
||||
@ -661,41 +660,23 @@ public class MPointService {
|
||||
|
||||
|
||||
/**
|
||||
* 通过ES搜索查询,返回Page类型
|
||||
*
|
||||
* @param nativeSearchQueryBuilder
|
||||
* @return
|
||||
* 获取数据库中测量点总数
|
||||
*/
|
||||
public Page<MPoint> selectListByES(NativeSearchQueryBuilder nativeSearchQueryBuilder) {
|
||||
SearchQuery searchQuery = nativeSearchQueryBuilder.build();
|
||||
Page<MPoint> mPage = mPointRepo.search(searchQuery);
|
||||
for (MPoint mPoint : mPage) {
|
||||
if (mPoint.getNumtail() != null) {
|
||||
BigDecimal value = CommUtil.formatMPointValue(mPoint.getParmvalue(), mPoint.getNumtail(), mPoint.getRate());
|
||||
if (value != null) {
|
||||
try {
|
||||
mPoint.setParmvalue(value);
|
||||
} catch (Exception e) {
|
||||
// TODO: handle exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (mPoint.getBizid() != null && !mPoint.getBizid().isEmpty()) {
|
||||
Unit unit = this.unitService.getUnitById(mPoint.getBizid());
|
||||
if (unit != null) {
|
||||
String unitName = unit.getSname();
|
||||
if (unitName == null || unitName.isEmpty()) {
|
||||
unitName = unit.getName();
|
||||
}
|
||||
mPoint.setBizname(unitName);
|
||||
}
|
||||
}
|
||||
}
|
||||
return mPage;
|
||||
public long getDbTotalCount() {
|
||||
return mPointDao.selectCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取ES中测量点总数
|
||||
*/
|
||||
public long getEsTotalCount() {
|
||||
return mPointRepo.count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数据库全量数据同步到ES
|
||||
*/
|
||||
|
||||
@Transactional
|
||||
public int updateValue(String bizId, MPoint entity, MPointHistory mPointHistory) {
|
||||
try {
|
||||
@ -1493,7 +1474,7 @@ public class MPointService {
|
||||
if (DateUtil.isCellDateFormatted(cell)) {
|
||||
//用于转化为日期格式
|
||||
Date d = cell.getDateCellValue();
|
||||
SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String cellDate = formater.format(d);
|
||||
return cellDate;
|
||||
} else {
|
||||
@ -1529,7 +1510,7 @@ public class MPointService {
|
||||
if (DateUtil.isCellDateFormatted(cell)) {
|
||||
//用于转化为日期格式
|
||||
Date d = cell.getDateCellValue();
|
||||
SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
SimpleDateFormat formater = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String cellDate = formater.format(d);
|
||||
return cellDate;
|
||||
} else {
|
||||
@ -1680,7 +1661,7 @@ public class MPointService {
|
||||
for (int i = minCellNum; i < maxCellNum; i++) {
|
||||
HSSFCell mpidCell = mpidRow.getCell(i);
|
||||
String mpidStr = getStringVal(mpidCell);
|
||||
MPoint mPoint = this.selectByWhere(unitId, "where MPointCode like '%" + mpidStr + "%' or ParmName like '%" + mpidStr + "%' ");
|
||||
MPoint mPoint = this.selectByWhere(unitId, "where MPointCode = '"+ mpidStr+"'");
|
||||
if (mPoint != null) {
|
||||
String mpid = mPoint.getMpointcode();
|
||||
MPointHistory mPointHistory = new MPointHistory();
|
||||
@ -1774,4 +1755,9 @@ public class MPointService {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@DataSourceTypeAnno(value = DataSources.SCADA_0533JS)
|
||||
public List<MPoint> selectListAllByWhere(MPoint query) {
|
||||
return mPointDao.selectListByWhere(query);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,110 @@
|
||||
package com.sipai.service.scada;
|
||||
|
||||
import com.sipai.dao.scada.WaterVolumeLJLLDao;
|
||||
import com.sipai.entity.scada.WaterVolumeLJLL;
|
||||
import com.sipai.tools.CommService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class WaterVolumeLJLLService implements CommService<WaterVolumeLJLL> {
|
||||
|
||||
@Resource
|
||||
private WaterVolumeLJLLDao waterVolumeLJLLDao;
|
||||
|
||||
/**
|
||||
* 构建表名
|
||||
* @param companyKey 公司编码(如:DEV022)
|
||||
* @return 完整表名(如:tb_mp_DEV022_LJLL)
|
||||
*/
|
||||
public String buildTableName(String companyKey) {
|
||||
if (companyKey == null || companyKey.isEmpty()) {
|
||||
throw new IllegalArgumentException("companyKey cannot be null or empty");
|
||||
}
|
||||
return "tb_mp_" + companyKey + "_LJLL";
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查表是否存在
|
||||
* @param companyKey 公司编码
|
||||
* @return 是否存在
|
||||
*/
|
||||
public boolean checkTableExists(String companyKey) {
|
||||
String tableName = buildTableName(companyKey);
|
||||
return waterVolumeLJLLDao.checkTableExists(tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取今日处理总量
|
||||
* @param companyKey 公司编码
|
||||
* @return 今日处理总量
|
||||
*/
|
||||
public BigDecimal getTodayTotal(String companyKey) {
|
||||
String tableName = buildTableName(companyKey);
|
||||
return waterVolumeLJLLDao.selectTodayTotal(tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取昨日处理总量
|
||||
* @param companyKey 公司编码
|
||||
* @return 昨日处理总量
|
||||
*/
|
||||
public BigDecimal getYesterdayTotal(String companyKey) {
|
||||
String tableName = buildTableName(companyKey);
|
||||
return waterVolumeLJLLDao.selectYesterdayTotal(tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本月累计总量
|
||||
* @param companyKey 公司编码
|
||||
* @return 本月累计总量
|
||||
*/
|
||||
public BigDecimal getMonthTotal(String companyKey) {
|
||||
String tableName = buildTableName(companyKey);
|
||||
return waterVolumeLJLLDao.selectMonthTotal(tableName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取七日水量处理总量
|
||||
* @param companyKey 公司编码
|
||||
* @return 七日水量列表
|
||||
*/
|
||||
public List<Map<String, Object>> getSevenDaysTotal(String companyKey) {
|
||||
String tableName = buildTableName(companyKey);
|
||||
return waterVolumeLJLLDao.selectSevenDaysTotal(tableName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaterVolumeLJLL selectById(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteById(String id) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int save(WaterVolumeLJLL entity) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int update(WaterVolumeLJLL entity) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WaterVolumeLJLL> selectListByWhere(String wherestr) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int deleteByWhere(String wherestr) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@ -46,14 +46,30 @@ public class SewageService implements CommService<Sewage>{
|
||||
|
||||
@Resource
|
||||
private JsywPointService jsywPointService;
|
||||
|
||||
private ProcessSection getProcessSectionByStoredValue(String processSectionValue) {
|
||||
if (processSectionValue == null || processSectionValue.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
ProcessSection processSection = this.processSectionService.selectById(processSectionValue);
|
||||
if (processSection != null) {
|
||||
return processSection;
|
||||
}
|
||||
List<ProcessSection> processSectionList = this.processSectionService.selectListByWhere(
|
||||
"where code = '" + processSectionValue + "' and unit_id = 'JSBZ'");
|
||||
if (processSectionList != null && processSectionList.size() > 0) {
|
||||
return processSectionList.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Sewage selectById(String id) {
|
||||
Sewage sewage = SewageDao.selectByPrimaryKey(id);
|
||||
sewage.setCompany(this.unitService.getCompById(sewage.getUnitId()));
|
||||
List<ProcessSection> processSectionList = this.processSectionService.selectListByWhere("where code = '"+sewage.getProcessSectionId()+"' and unit_id = 'JSBZ'");
|
||||
if (processSectionList.size()>0) {
|
||||
sewage.setProcessSection(processSectionList.get(0));
|
||||
ProcessSection processSection = this.getProcessSectionByStoredValue(sewage.getProcessSectionId());
|
||||
if (processSection != null) {
|
||||
sewage.setProcessSection(processSection);
|
||||
}
|
||||
List<SewageInput> sewageInputList = this.sewageInputService.selectListByWhere("where sewage_id='"+sewage.getContractNumber()+"' order by insdt");
|
||||
if(sewageInputList!=null && sewageInputList.size()>0){
|
||||
@ -92,9 +108,9 @@ public class SewageService implements CommService<Sewage>{
|
||||
List<Sewage> list = SewageDao.selectListByWhere(sewage);
|
||||
for (Sewage item : list) {
|
||||
item.setCompany(this.unitService.getCompById(item.getUnitId()));
|
||||
List<ProcessSection> processSectionList = this.processSectionService.selectListByWhere("where code = '"+item.getProcessSectionId()+"' and unit_id = 'JSBZ'");
|
||||
if (processSectionList.size()>0) {
|
||||
item.setProcessSection(processSectionList.get(0));
|
||||
ProcessSection processSection = this.getProcessSectionByStoredValue(item.getProcessSectionId());
|
||||
if (processSection != null) {
|
||||
item.setProcessSection(processSection);
|
||||
}
|
||||
List<SewageInput> sewageInputList = this.sewageInputService.selectListByWhere4Pure("where sewage_id='"+item.getContractNumber()+"' order by insdt");
|
||||
if(sewageInputList!=null && sewageInputList.size()>0){
|
||||
|
||||
@ -132,6 +132,7 @@ public class PatrolContentsServiceImpl implements PatrolContentsService {
|
||||
jsonObject.put("id", list3.get(j).getId());
|
||||
jsonObject.put("name", list3.get(j).getContents());
|
||||
jsonObject.put("text", list3.get(j).getContents());
|
||||
jsonObject.put("contentsDetail", list3.get(j).getContentsDetail());
|
||||
jsonObject.put("type", TimeEfficiencyCommStr.PatrolEquipment_Equipment);
|
||||
jsonObject.put("icon", TimeEfficiencyCommStr.PatrolContents);
|
||||
jsonArrayEqu.add(jsonObject);
|
||||
|
||||
@ -33,4 +33,13 @@ public interface JobService {
|
||||
* @return
|
||||
*/
|
||||
String getJobs4Activiti(String unitId, String type);
|
||||
|
||||
/**
|
||||
* 获取流程指定节点岗位
|
||||
* @param unitId 单位ID
|
||||
* @param type ProcessType中的type
|
||||
* @param resourceId 流程节点resourceId/taskDefinitionKey
|
||||
* @return 逗号分隔的岗位ID
|
||||
*/
|
||||
String getJobs4Activiti(String unitId, String type, String resourceId);
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ import com.sipai.entity.user.User;
|
||||
import com.sipai.entity.user.UserJob;
|
||||
import com.sipai.tools.CommUtil;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -156,16 +157,50 @@ public class JobServiceImpl implements JobService {
|
||||
|
||||
@Override
|
||||
public String getJobs4Activiti(String unitId, String type) {
|
||||
return this.getJobs4Activiti(unitId, type, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJobs4Activiti(String unitId, String type, String resourceId) {
|
||||
Model model = this.findModel(unitId, type);
|
||||
if (model == null) {
|
||||
return "";
|
||||
}
|
||||
return this.findJobIds(model.getId(), resourceId);
|
||||
}
|
||||
|
||||
private Model findModel(String unitId, String type) {
|
||||
String sql = "select * from [ACT_RE_MODEL] where KEY_ like '%" + unitId + "%' and KEY_ = '" + type + "-" + unitId + "'";
|
||||
List<Model> listModel = repositoryService.createNativeModelQuery().sql(sql).list();
|
||||
if (listModel != null && listModel.size() > 0) {
|
||||
return listModel.get(0);
|
||||
}
|
||||
sql = "select * from [ACT_RE_MODEL] where KEY_ = '" + type + "'";
|
||||
listModel = repositoryService.createNativeModelQuery().sql(sql).list();
|
||||
if (listModel != null && listModel.size() > 0) {
|
||||
return listModel.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String findJobIds(String modelId, String resourceId) {
|
||||
String jobIds = "";
|
||||
List<org.activiti.engine.repository.Model> list_model = repositoryService.createNativeModelQuery().sql(sql).list();
|
||||
if (list_model != null && list_model.size() > 0) {
|
||||
ModelNodeJob modelNodeJob = new ModelNodeJob();
|
||||
modelNodeJob.setWhere("where model_id = '" + list_model.get(0).getId() + "'");
|
||||
List<ModelNodeJob> list_model_node = modelNodeJobDao.selectListByWhere(modelNodeJob);
|
||||
HashSet<String> hs = new HashSet<String>();
|
||||
for (int i = 0; i < list_model_node.size(); i++) {
|
||||
jobIds += "" + list_model_node.get(i).getJobId() + ",";
|
||||
String where = "where model_id = '" + modelId + "'";
|
||||
if (resourceId != null && !resourceId.trim().isEmpty()) {
|
||||
where += " and resource_id = '" + resourceId.trim() + "'";
|
||||
}
|
||||
ModelNodeJob modelNodeJob = new ModelNodeJob();
|
||||
modelNodeJob.setWhere(where);
|
||||
List<ModelNodeJob> listModelNode = modelNodeJobDao.selectListByWhere(modelNodeJob);
|
||||
HashSet<String> exists = new HashSet<String>();
|
||||
if (listModelNode != null) {
|
||||
for (ModelNodeJob item : listModelNode) {
|
||||
if (item == null || item.getJobId() == null || item.getJobId().trim().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (exists.add(item.getJobId())) {
|
||||
jobIds += item.getJobId() + ",";
|
||||
}
|
||||
}
|
||||
}
|
||||
return jobIds;
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
package com.sipai.tools;
|
||||
|
||||
import org.aspectj.lang.JoinPoint;
|
||||
import org.aspectj.lang.Signature;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/*@Aspect // for aop
|
||||
@Component // for auto scan
|
||||
@ -12,24 +16,28 @@ public class DataSourceInterceptor {
|
||||
|
||||
//@Before("dataSourceScadaPointcut()")
|
||||
public void before(JoinPoint jp) {
|
||||
Object[] argusObjects = jp.getArgs();
|
||||
|
||||
// Object[] argusObjects = jp.getArgs();
|
||||
Signature signature = jp.getSignature();
|
||||
//若只有一个参数,则默认使用es
|
||||
if (argusObjects == null || argusObjects.length < 2 || !(argusObjects[0] instanceof String)) {
|
||||
return;
|
||||
// if (argusObjects == null || argusObjects.length < 2 || !(argusObjects[0] instanceof String)) {
|
||||
// return;
|
||||
// }
|
||||
String fullMethodPath = signature.toString();
|
||||
MethodSignature methodSignature = (MethodSignature) signature;
|
||||
Method method = methodSignature.getMethod();
|
||||
DataSourceTypeAnno typeAnno = method.getAnnotation(DataSourceTypeAnno.class);
|
||||
DataSources sourceEnum = null;
|
||||
if (typeAnno != null) {
|
||||
sourceEnum = typeAnno.value();
|
||||
}
|
||||
|
||||
Object argus = argusObjects[0];
|
||||
if (argus != null) {
|
||||
DataSourceHolder.setDataSources(DataSources.valueOf("SCADA_"+argus.toString()));
|
||||
// DataSourceHolder.setDataSources(DataSources.valueOf("SCADA_HFCG"));
|
||||
// Object argus = argusObjects[0];
|
||||
String packageName = method.getDeclaringClass().getName();
|
||||
if (fullMethodPath.contains(".scada.") || packageName.contains(".scada.") || (sourceEnum == DataSources.SCADA_0533JS)) {
|
||||
DataSourceHolder.setDataSources(DataSources.SCADA_0533JS);
|
||||
} else {
|
||||
// DataSourceHolder.setDataSources(DataSources.valueOf("SCADA_YL"));
|
||||
DataSourceHolder.setDataSources(DataSources.valueOf("SCADA_0533JS"));
|
||||
DataSourceHolder.setDataSources(DataSources.MASTER);
|
||||
}
|
||||
|
||||
//适应所有生产库存集中为一个数据库
|
||||
// DataSourceHolder.setDataSources(DataSources.SCADA_0756ZH);
|
||||
}
|
||||
|
||||
//@After("dataSourceScadaPointcut()")
|
||||
|
||||
17
src/main/java/com/sipai/tools/DataSourceTypeAnno.java
Normal file
17
src/main/java/com/sipai/tools/DataSourceTypeAnno.java
Normal file
@ -0,0 +1,17 @@
|
||||
package com.sipai.tools;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 自定义注解
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME) // 在运行时可见
|
||||
@Target(ElementType.METHOD) // 注解可以用在方法上
|
||||
public @interface DataSourceTypeAnno {
|
||||
//使用方式在service层方法上添加@DataSourceTypeAnno(DataSourceEnum.数据源枚举类型)用于指定所使用的数据源
|
||||
DataSources value() default DataSources.MASTER;
|
||||
// DataSourceEnum value() default DataSourceEnum.SCADA_JSWS;
|
||||
}
|
||||
138
src/main/resources/diagrams/leave/Administration_Leave.bpmn
Normal file
138
src/main/resources/diagrams/leave/Administration_Leave.bpmn
Normal file
@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:activiti="http://activiti.org/bpmn"
|
||||
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
|
||||
xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC"
|
||||
xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI"
|
||||
targetNamespace="http://com.sipai.activiti">
|
||||
<process id="Administration_Leave" name="请假补假流程" isExecutable="true">
|
||||
<documentation>请假补假流程</documentation>
|
||||
<startEvent id="startevent1" name="Start" activiti:initiator="applyUserId"/>
|
||||
|
||||
<userTask id="sectionChiefAudit" name="科长/副科长审批" activiti:candidateUsers="#{userIds}">
|
||||
<documentation>leave_apply_section_audit</documentation>
|
||||
</userTask>
|
||||
<exclusiveGateway id="gatewaySection" name="科长审批判断"/>
|
||||
|
||||
<userTask id="managerAudit" name="分管经理审批" activiti:candidateUsers="#{userIds}">
|
||||
<documentation>leave_apply_manager_audit</documentation>
|
||||
</userTask>
|
||||
<exclusiveGateway id="gatewayManager" name="分管经理审批判断"/>
|
||||
|
||||
<userTask id="generalManagerAudit" name="总经理审批" activiti:candidateUsers="#{userIds}">
|
||||
<documentation>leave_apply_general_manager_audit</documentation>
|
||||
</userTask>
|
||||
<exclusiveGateway id="gatewayGeneralManager" name="总经理审批判断"/>
|
||||
|
||||
<userTask id="modifyApply" name="退回修改" activiti:assignee="${applicantId}">
|
||||
<documentation>leave_apply_handle</documentation>
|
||||
</userTask>
|
||||
|
||||
<endEvent id="endevent1" name="End"/>
|
||||
|
||||
<sequenceFlow id="flow1" sourceRef="startevent1" targetRef="sectionChiefAudit"/>
|
||||
<sequenceFlow id="flow2" sourceRef="sectionChiefAudit" targetRef="gatewaySection"/>
|
||||
<sequenceFlow id="flow3" name="通过" sourceRef="gatewaySection" targetRef="managerAudit">
|
||||
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${pass && route==1}]]></conditionExpression>
|
||||
</sequenceFlow>
|
||||
<sequenceFlow id="flow4" name="驳回" sourceRef="gatewaySection" targetRef="modifyApply">
|
||||
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${!pass && route==0}]]></conditionExpression>
|
||||
</sequenceFlow>
|
||||
<sequenceFlow id="flow5" sourceRef="managerAudit" targetRef="gatewayManager"/>
|
||||
<sequenceFlow id="flow6" name="通过" sourceRef="gatewayManager" targetRef="generalManagerAudit">
|
||||
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${pass && route==1}]]></conditionExpression>
|
||||
</sequenceFlow>
|
||||
<sequenceFlow id="flow7" name="驳回" sourceRef="gatewayManager" targetRef="modifyApply">
|
||||
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${!pass && route==0}]]></conditionExpression>
|
||||
</sequenceFlow>
|
||||
<sequenceFlow id="flow8" sourceRef="modifyApply" targetRef="sectionChiefAudit"/>
|
||||
<sequenceFlow id="flow9" sourceRef="generalManagerAudit" targetRef="gatewayGeneralManager"/>
|
||||
<sequenceFlow id="flow10" name="通过" sourceRef="gatewayGeneralManager" targetRef="endevent1">
|
||||
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${pass && route==1}]]></conditionExpression>
|
||||
</sequenceFlow>
|
||||
<sequenceFlow id="flow11" name="驳回" sourceRef="gatewayGeneralManager" targetRef="modifyApply">
|
||||
<conditionExpression xsi:type="tFormalExpression"><![CDATA[${!pass && route==0}]]></conditionExpression>
|
||||
</sequenceFlow>
|
||||
</process>
|
||||
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_Administration_Leave">
|
||||
<bpmndi:BPMNPlane bpmnElement="Administration_Leave" id="BPMNPlane_Administration_Leave">
|
||||
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
|
||||
<omgdc:Bounds height="35.0" width="35.0" x="40.0" y="110.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="sectionChiefAudit" id="BPMNShape_sectionChiefAudit">
|
||||
<omgdc:Bounds height="55.0" width="120.0" x="110.0" y="100.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="gatewaySection" id="BPMNShape_gatewaySection">
|
||||
<omgdc:Bounds height="40.0" width="40.0" x="265.0" y="108.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="managerAudit" id="BPMNShape_managerAudit">
|
||||
<omgdc:Bounds height="55.0" width="100.0" x="350.0" y="100.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="gatewayManager" id="BPMNShape_gatewayManager">
|
||||
<omgdc:Bounds height="40.0" width="40.0" x="485.0" y="108.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="generalManagerAudit" id="BPMNShape_generalManagerAudit">
|
||||
<omgdc:Bounds height="55.0" width="100.0" x="560.0" y="100.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="gatewayGeneralManager" id="BPMNShape_gatewayGeneralManager">
|
||||
<omgdc:Bounds height="40.0" width="40.0" x="695.0" y="108.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="modifyApply" id="BPMNShape_modifyApply">
|
||||
<omgdc:Bounds height="55.0" width="100.0" x="430.0" y="220.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
|
||||
<omgdc:Bounds height="35.0" width="35.0" x="800.0" y="110.0"/>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
|
||||
<omgdi:waypoint x="75.0" y="127.0"/>
|
||||
<omgdi:waypoint x="110.0" y="127.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
|
||||
<omgdi:waypoint x="230.0" y="127.0"/>
|
||||
<omgdi:waypoint x="265.0" y="128.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
|
||||
<omgdi:waypoint x="305.0" y="128.0"/>
|
||||
<omgdi:waypoint x="350.0" y="127.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
|
||||
<omgdi:waypoint x="285.0" y="148.0"/>
|
||||
<omgdi:waypoint x="285.0" y="247.0"/>
|
||||
<omgdi:waypoint x="430.0" y="247.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
|
||||
<omgdi:waypoint x="450.0" y="127.0"/>
|
||||
<omgdi:waypoint x="485.0" y="128.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
|
||||
<omgdi:waypoint x="525.0" y="128.0"/>
|
||||
<omgdi:waypoint x="560.0" y="127.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow7" id="BPMNEdge_flow7">
|
||||
<omgdi:waypoint x="505.0" y="148.0"/>
|
||||
<omgdi:waypoint x="505.0" y="247.0"/>
|
||||
<omgdi:waypoint x="530.0" y="247.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow8" id="BPMNEdge_flow8">
|
||||
<omgdi:waypoint x="430.0" y="247.0"/>
|
||||
<omgdi:waypoint x="170.0" y="247.0"/>
|
||||
<omgdi:waypoint x="170.0" y="155.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow9" id="BPMNEdge_flow9">
|
||||
<omgdi:waypoint x="660.0" y="127.0"/>
|
||||
<omgdi:waypoint x="695.0" y="128.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow10" id="BPMNEdge_flow10">
|
||||
<omgdi:waypoint x="735.0" y="128.0"/>
|
||||
<omgdi:waypoint x="800.0" y="127.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow11" id="BPMNEdge_flow11">
|
||||
<omgdi:waypoint x="715.0" y="148.0"/>
|
||||
<omgdi:waypoint x="715.0" y="247.0"/>
|
||||
<omgdi:waypoint x="530.0" y="247.0"/>
|
||||
</bpmndi:BPMNEdge>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</definitions>
|
||||
294
src/main/resources/es_mpoint_init.script
Normal file
294
src/main/resources/es_mpoint_init.script
Normal file
@ -0,0 +1,294 @@
|
||||
GET _search
|
||||
{
|
||||
"query": {
|
||||
"match_all": {}
|
||||
}
|
||||
}
|
||||
|
||||
# Elasticsearch Index Initialization Script for MPoint
|
||||
# Index: es_measurepoint
|
||||
# Type: esmeasurepoint
|
||||
# Generated from: MPoint.java entity
|
||||
|
||||
# Step 1: Delete existing index (if exists)
|
||||
DELETE /es_measurepoint
|
||||
|
||||
PUT /es_measurepoint
|
||||
{
|
||||
"settings": {
|
||||
"number_of_shards": 1,
|
||||
"number_of_replicas": 0,
|
||||
"analysis": {
|
||||
"normalizer": {
|
||||
"my_normalizer": {
|
||||
"type": "custom",
|
||||
"char_filter": [],
|
||||
"filter": [
|
||||
"lowercase",
|
||||
"asciifolding"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"esmeasurepoint": {
|
||||
"properties": {
|
||||
"mpointcode": {
|
||||
"type": "keyword",
|
||||
"normalizer": "my_normalizer"
|
||||
},
|
||||
"parmname": {
|
||||
"type": "text",
|
||||
"analyzer": "ik_smart",
|
||||
"search_analyzer": "ik_smart"
|
||||
},
|
||||
"id": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"mpointid": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"unit": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"alarmmax": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"alarmmin": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"halarmmax": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"lalarmmin": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"parmvalue": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"parmvalueStr": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"measuredt": {
|
||||
"type": "date",
|
||||
"format": "yyyy-MM-dd'T'HH:mm:ss'Z'||yyyy-MM-dd HH:mm:ss||epoch_millis"
|
||||
},
|
||||
"rate": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 1000
|
||||
},
|
||||
"freq": {
|
||||
"type": "integer"
|
||||
},
|
||||
"frequnit": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"signaltype": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"signaltag": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"ledtype": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"ledcolor": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"directtype": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"bizid": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"biztype": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"numtail": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"prochour": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"procday": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"procmonth": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"showname": {
|
||||
"type": "text",
|
||||
"analyzer": "standard",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
},
|
||||
"exp": {
|
||||
"type": "text"
|
||||
},
|
||||
"forcemin": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"forcemax": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"avgmax": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"avgmin": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"remoteup": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"morder": {
|
||||
"type": "integer"
|
||||
},
|
||||
"triggeralarm": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"confirmalarm": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"flowset": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"triggercycle": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"cyclemax": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"cyclemin": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"triggermutation": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"mutationset": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"causeset": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"operateset": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"resultset": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"triggerequoff": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"mathop": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"valuetype": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"valuemeaning": {
|
||||
"type": "text"
|
||||
},
|
||||
"active": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"soundalarm": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"scdtype": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"spanrange": {
|
||||
"type": "scaled_float",
|
||||
"scaling_factor": 100
|
||||
},
|
||||
"modbusfigid": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"register": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"processsectioncode": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"equipmentid": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"source_type": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"patrol_type": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"remark": {
|
||||
"type": "text"
|
||||
},
|
||||
"alarmLevel": {
|
||||
"type": "integer"
|
||||
},
|
||||
"structureId": {
|
||||
"type": "keyword"
|
||||
},
|
||||
"bizname": {
|
||||
"type": "text",
|
||||
"analyzer": "standard",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
},
|
||||
"disname": {
|
||||
"type": "text",
|
||||
"analyzer": "standard",
|
||||
"fields": {
|
||||
"keyword": {
|
||||
"type": "keyword",
|
||||
"ignore_above": 256
|
||||
}
|
||||
}
|
||||
},
|
||||
"subscriptionStatus": {
|
||||
"type": "integer"
|
||||
},
|
||||
"text": {
|
||||
"type": "text",
|
||||
"analyzer": "standard"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
POST /es_measurepoint/_close
|
||||
|
||||
POST /es_measurepoint/_open
|
||||
|
||||
# Step 3: Verify index creation
|
||||
GET /es_measurepoint/_mapping
|
||||
|
||||
# Step 4: Check index settings
|
||||
GET /es_measurepoint/_settings
|
||||
|
||||
127
src/main/resources/sql/add_leave_apply_module.sql
Normal file
127
src/main/resources/sql/add_leave_apply_module.sql
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
请假补假模块初始化脚本
|
||||
1) 建表 tb_administration_leave_apply
|
||||
2) 注册流程节点 tb_business_unit
|
||||
3) 增加菜单并授权 admin
|
||||
*/
|
||||
|
||||
IF OBJECT_ID('dbo.tb_administration_leave_apply', 'U') IS NULL
|
||||
BEGIN
|
||||
CREATE TABLE dbo.tb_administration_leave_apply (
|
||||
id varchar(50) NOT NULL PRIMARY KEY,
|
||||
insdt datetime NULL,
|
||||
insuser varchar(50) NULL,
|
||||
upduser varchar(50) NULL,
|
||||
upddt datetime NULL,
|
||||
unit_id varchar(50) NULL,
|
||||
apply_type varchar(20) NULL,
|
||||
leave_type varchar(20) NULL,
|
||||
start_time datetime NULL,
|
||||
end_time datetime NULL,
|
||||
hours decimal(10,2) NULL,
|
||||
days decimal(10,2) NULL,
|
||||
reason varchar(1000) NULL,
|
||||
handover_desc varchar(1000) NULL,
|
||||
attachment_ids varchar(1000) NULL,
|
||||
overtime_ref_id varchar(50) NULL,
|
||||
overtime_hours decimal(10,2) NULL,
|
||||
actual_start_time datetime NULL,
|
||||
actual_end_time datetime NULL,
|
||||
state varchar(100) NULL,
|
||||
audit_man_id varchar(max) NULL,
|
||||
submission_time datetime NULL,
|
||||
processid varchar(100) NULL,
|
||||
processdefid varchar(100) NULL,
|
||||
remark varchar(1000) NULL,
|
||||
del_flag char(1) NULL DEFAULT '0'
|
||||
);
|
||||
END
|
||||
GO
|
||||
|
||||
IF OBJECT_ID('dbo.tb_administration_leave_apply', 'U') IS NOT NULL
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM sys.columns
|
||||
WHERE object_id = OBJECT_ID('dbo.tb_administration_leave_apply')
|
||||
AND name = 'audit_man_id'
|
||||
AND max_length <> -1
|
||||
)
|
||||
BEGIN
|
||||
ALTER TABLE dbo.tb_administration_leave_apply
|
||||
ALTER COLUMN audit_man_id varchar(max) NULL;
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM tb_business_unit WHERE id = 'leave_apply_section_audit')
|
||||
BEGIN
|
||||
INSERT INTO tb_business_unit (id, name, process_type_id, insdt, insuser, active, url, modal_id)
|
||||
VALUES ('leave_apply_section_audit', N'请假补假-科长/副科长审批', 'Administration_Leave', GETDATE(), 'emp01', '1',
|
||||
'administration/leaveApply/showAudit.do', 'subModal');
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM tb_business_unit WHERE id = 'leave_apply_manager_audit')
|
||||
BEGIN
|
||||
INSERT INTO tb_business_unit (id, name, process_type_id, insdt, insuser, active, url, modal_id)
|
||||
VALUES ('leave_apply_manager_audit', N'请假补假-分管经理审批', 'Administration_Leave', GETDATE(), 'emp01', '1',
|
||||
'administration/leaveApply/showAudit.do', 'subModal');
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM tb_business_unit WHERE id = 'leave_apply_general_manager_audit')
|
||||
BEGIN
|
||||
INSERT INTO tb_business_unit (id, name, process_type_id, insdt, insuser, active, url, modal_id)
|
||||
VALUES ('leave_apply_general_manager_audit', N'请假补假-总经理审批', 'Administration_Leave', GETDATE(), 'emp01', '1',
|
||||
'administration/leaveApply/showAudit.do', 'subModal');
|
||||
END
|
||||
GO
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM tb_business_unit WHERE id = 'leave_apply_handle')
|
||||
BEGIN
|
||||
INSERT INTO tb_business_unit (id, name, process_type_id, insdt, insuser, active, url, modal_id)
|
||||
VALUES ('leave_apply_handle', N'请假补假-退回修改', 'Administration_Leave', GETDATE(), 'emp01', '1',
|
||||
'administration/leaveApply/showHandle.do', 'subModal');
|
||||
END
|
||||
GO
|
||||
|
||||
DECLARE @menuId VARCHAR(50) = 'leave_apply_menu_001';
|
||||
DECLARE @menuName NVARCHAR(200) = N'请假补假申请';
|
||||
DECLARE @menuLocation VARCHAR(1000) = 'administration/leaveApply/showList.do';
|
||||
DECLARE @parentMenuId VARCHAR(50);
|
||||
DECLARE @nextOrder INT;
|
||||
|
||||
SELECT TOP 1 @parentMenuId = id
|
||||
FROM tb_menuitem
|
||||
WHERE name IN (N'事项管理', N'行政管理')
|
||||
AND type = 'menu'
|
||||
ORDER BY morder;
|
||||
|
||||
IF @parentMenuId IS NULL
|
||||
SET @parentMenuId = '-1';
|
||||
|
||||
SELECT @nextOrder = ISNULL(MAX(CAST(morder AS INT)), -1) + 1
|
||||
FROM tb_menuitem
|
||||
WHERE pid = @parentMenuId
|
||||
AND type = 'menu';
|
||||
|
||||
IF NOT EXISTS (SELECT 1 FROM tb_menuitem WHERE id = @menuId OR location = @menuLocation)
|
||||
BEGIN
|
||||
INSERT INTO tb_menuitem (
|
||||
id, pid, PowerID, caption, name, description, location, target, onclick, onmouseover, onmouseout,
|
||||
image, altImage, tooltip, roles, page, width, height, forward, action, morder, lvl, active, type,
|
||||
mainpage, count, engkey
|
||||
)
|
||||
VALUES (
|
||||
@menuId, @parentMenuId, NULL, NULL, @menuName, NULL, @menuLocation, NULL, NULL, NULL, NULL,
|
||||
'fa-calendar', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @nextOrder, NULL, N'启用', 'menu',
|
||||
NULL, NULL, NULL
|
||||
);
|
||||
END
|
||||
GO
|
||||
|
||||
IF OBJECT_ID('dbo.tb_role_menu', 'U') IS NOT NULL
|
||||
AND NOT EXISTS (SELECT 1 FROM tb_role_menu WHERE roleID = 'rol0001' AND menuID = 'leave_apply_menu_001')
|
||||
BEGIN
|
||||
INSERT INTO tb_role_menu (roleID, menuID) VALUES ('rol0001', 'leave_apply_menu_001');
|
||||
END
|
||||
GO
|
||||
14
src/main/resources/sql/upgrade_leave_apply_audit_man_id.sql
Normal file
14
src/main/resources/sql/upgrade_leave_apply_audit_man_id.sql
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
请假补假流程审批人字段扩容脚本
|
||||
场景:
|
||||
1) audit_man_id 保存当前节点候选审批人 ID 列表
|
||||
2) 组织下候选人员较多时,原 varchar(250/500) 可能被截断
|
||||
*/
|
||||
|
||||
IF OBJECT_ID('dbo.tb_administration_leave_apply', 'U') IS NOT NULL
|
||||
AND COL_LENGTH('dbo.tb_administration_leave_apply', 'audit_man_id') IS NOT NULL
|
||||
BEGIN
|
||||
ALTER TABLE dbo.tb_administration_leave_apply
|
||||
ALTER COLUMN audit_man_id varchar(max) NULL;
|
||||
END
|
||||
GO
|
||||
BIN
src/main/webapp/IMG/loginbp.png
Normal file
BIN
src/main/webapp/IMG/loginbp.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 72 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 80 KiB |
BIN
src/main/webapp/IMG/logo1.png
Normal file
BIN
src/main/webapp/IMG/logo1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 82 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 28 MiB After Width: | Height: | Size: 21 MiB |
@ -346,6 +346,10 @@ var processSelectNodeForHandle = function(taskId){
|
||||
//选择下一节点,先选择审核结果,再选择节点
|
||||
$.post(ext.contextPath + "/activiti/workflow/getRoutesForSelect2.do", {taskId:taskId,passFlag:passFlag}, function(data) {
|
||||
$("#routeNum").empty();
|
||||
if (!data || data.length === 0) {
|
||||
console.warn('getRoutesForSelect2: no routes found for passFlag=' + passFlag);
|
||||
return;
|
||||
}
|
||||
var selelct = $("#routeNum").select2({
|
||||
data: data,
|
||||
placeholder:'请先选择审核结果',//默认文字提示
|
||||
@ -374,6 +378,10 @@ var processSelectNodeForHandle = function(taskId){
|
||||
})
|
||||
selectResult.val('').trigger("change");
|
||||
$.post(ext.contextPath + "/activiti/workflow/getRoutesForSelect2.do", {taskId:taskId,passFlag:true}, function(data) {
|
||||
if (!data || data.length === 0) {
|
||||
console.warn('getRoutesForSelect2: no routes found for passFlag=true');
|
||||
return;
|
||||
}
|
||||
var selelct = $("#routeNum").select2({
|
||||
data: data,
|
||||
placeholder:'请先选择审核结果',//默认文字提示
|
||||
|
||||
@ -493,89 +493,12 @@ function getMpPic() {
|
||||
|
||||
function initMenu() {
|
||||
var menu = $('#menu');
|
||||
|
||||
// 定义一个内部函数来执行DOM操作添加菜单
|
||||
var appendS223Menu = function() {
|
||||
var $menu = $('#menu');
|
||||
|
||||
// 查找“纳管企业清单”所在的菜单项
|
||||
// 情况1: 一级菜单,名称在 span 中
|
||||
var $targetSpan = $menu.find("span").filter(function() {
|
||||
return $(this).text().trim() === '纳管企业清单';
|
||||
});
|
||||
|
||||
var $targetLi = null;
|
||||
|
||||
if ($targetSpan.length > 0) {
|
||||
$targetLi = $targetSpan.closest('li');
|
||||
} else {
|
||||
// 情况2: 二级菜单,名称直接在 a 标签中(可能是文本节点)
|
||||
var $targetLink = $menu.find('a').filter(function() {
|
||||
// 克隆节点,移除子元素(如图标),只获取自身的文本
|
||||
return $(this).clone().children().remove().end().text().trim() === '纳管企业清单';
|
||||
});
|
||||
if ($targetLink.length > 0) {
|
||||
$targetLi = $targetLink.closest('li');
|
||||
}
|
||||
}
|
||||
|
||||
if ($targetLi && $targetLi.length > 0) {
|
||||
var $treeviewMenu = $targetLi.find('> .treeview-menu');
|
||||
|
||||
// 确保 treeview-menu 存在
|
||||
if ($treeviewMenu.length === 0) {
|
||||
$treeviewMenu = $('<ul class="treeview-menu"></ul>');
|
||||
$targetLi.append($treeviewMenu);
|
||||
}
|
||||
|
||||
// 检查是否已经添加过,防止重复添加
|
||||
// 注意:新菜单项可能直接是文本,也可能包含 i 标签
|
||||
var exists = false;
|
||||
$treeviewMenu.find('li').each(function() {
|
||||
// if ($(this).text().indexOf('管道管理') > -1) {
|
||||
// exists = true;
|
||||
// }
|
||||
});
|
||||
|
||||
if (!exists) {
|
||||
// 根据层级决定样式,通常二级或三级菜单项不需要 span 包裹文字,或者保持一致
|
||||
// 这里的样式参考了 menuitems.jsp 中的 Level 3: <li><a ...><i ...></i> Name</a></li>
|
||||
// 使用 addTab 函数而不是 refreshPage,以支持在 tab 页中打开(如果系统支持)或者在当前 iframe 打开
|
||||
// 检查 addTab 是否存在,如果存在则使用它,否则回退到 refreshPage
|
||||
var newMenuHtml = '';
|
||||
if (typeof addTab === 'function') {
|
||||
// 假设 addTab(id, name, url)
|
||||
} else {
|
||||
// 如果没有 addTab,尝试使用 iframe 加载或者直接跳转(但在框架内)
|
||||
// refreshPage 通常是 location.replace,这会刷新整个页面。
|
||||
// 如果目标是内嵌,我们应该寻找 iframe 的加载方式。
|
||||
// 查看 comm.js 其他部分,发现有 refreshPage(url) 实现为 location.replace(url)。
|
||||
// 如果要内嵌,通常是设置某个 iframe 的 src。
|
||||
// 假设主内容区域是一个 iframe,或者支持通过 data-url 加载。
|
||||
// 暂时使用 refreshPage,但确认它是在当前窗口(iframe)中加载,而不是弹出新窗口。
|
||||
// 用户反馈说“不要新开特么弹窗”,可能是指 window.open 或者 target="_blank"。
|
||||
// refreshPage 使用 location.replace,是在当前窗口打开。
|
||||
// 如果当前窗口是整个 index 页面,那就会刷新整个页面。
|
||||
// 如果是 SPA 或者 iframe 架构,我们需要找到正确的方法。
|
||||
|
||||
// 观察 menuitems.jsp,发现二级菜单使用 addTab('${cumcl2.id}','${cumcl2.name}','${cumcl2.location}')
|
||||
// 所以我们应该优先使用 addTab。
|
||||
// 如果 addTab 未定义(可能在 index.jsp 中定义),我们尝试模拟它。
|
||||
// 由于 comm.js 被 index.jsp 引用,addTab 应该可用。
|
||||
}
|
||||
$treeviewMenu.append(newMenuHtml);
|
||||
|
||||
// 确保父菜单是展开状态(可选)
|
||||
// $targetLi.addClass('active menu-open');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (sessionStorage.menu != undefined) {
|
||||
$('#menu').html(sessionStorage.menu);
|
||||
|
||||
// 即使是缓存加载,也尝试添加新菜单
|
||||
appendS223Menu();
|
||||
// 更新大屏菜单的onclick事件,确保使用全屏功能
|
||||
updateBigScreenMenuEvents();
|
||||
|
||||
if (sessionStorage.m1 != undefined) {
|
||||
$('#' + sessionStorage.m1).addClass('treeview active menu-open')
|
||||
@ -589,29 +512,8 @@ function initMenu() {
|
||||
//return;
|
||||
} else {
|
||||
$.post(ext.contextPath + "/user/showMenuListByCu.do", {}, function (result) {
|
||||
var bigScreenHtml = '<li class="treeview">' +
|
||||
'<a href="#">' +
|
||||
'<i class="fa fa-desktop"></i> <span>大屏展示</span>' +
|
||||
'<span class="pull-right-container">' +
|
||||
'<i class="fa fa-angle-left pull-right"></i>' +
|
||||
'</span>' +
|
||||
'</a>' +
|
||||
'<ul class="treeview-menu">' +
|
||||
'<li><a href="javascript:void(0);" onclick="window.open(\'' + ext.contextPath + '/jsp/bigScreen.jsp\', \'_blank\');"><i class="fa fa-circle-o"></i> 水厂大屏</a></li>' +
|
||||
'<li><a href="javascript:void(0);" onclick="window.open(\'' + ext.contextPath + '/jsp/bigScreen2.jsp\', \'_blank\');"><i class="fa fa-circle-o"></i> 区域管线大屏</a></li>' +
|
||||
'<li><a href="javascript:void(0);" onclick="window.open(\'' + ext.contextPath + '/jsp/bigScreen3.jsp\', \'_blank\');"><i class="fa fa-circle-o"></i> 排污户大屏</a></li>' +
|
||||
'</ul>' +
|
||||
'</li>';
|
||||
result = result + bigScreenHtml;
|
||||
// 替换源头GIS管理页面链接为JSP
|
||||
result = result.replace('newSourceGISPage.html', 'newSourceGISPage.jsp');
|
||||
result = result.replace('newGIS.html', 'newSourceGISPage.jsp');
|
||||
|
||||
$('#menu').html(result);
|
||||
|
||||
// 在设置HTML后执行DOM注入
|
||||
appendS223Menu();
|
||||
|
||||
sessionStorage.setItem("menu", $('#menu').html()); // 保存修改后的HTML到sessionStorage
|
||||
|
||||
if (sessionStorage.m1 != undefined) {
|
||||
@ -647,6 +549,51 @@ function initMenuScroll(menu) {
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取浏览器当前缩放比例
|
||||
* @returns 100为100%
|
||||
*/
|
||||
/**
|
||||
* 打开全屏窗口
|
||||
* @param url 页面URL
|
||||
*/
|
||||
function openFullScreenWindow(url) {
|
||||
// 打开新窗口,使用屏幕全部尺寸
|
||||
var width = screen.width;
|
||||
var height = screen.height;
|
||||
var newWindow = window.open(url, '_blank',
|
||||
'width=' + width + ',height=' + height +
|
||||
',top=0,left=0,menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=no');
|
||||
|
||||
// 尝试让新窗口获得焦点
|
||||
if (newWindow) {
|
||||
newWindow.focus();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新大屏菜单的点击事件,确保使用全屏功能
|
||||
* 用于处理缓存菜单的情况
|
||||
*/
|
||||
function updateBigScreenMenuEvents() {
|
||||
// 查找所有大屏菜单项并更新onclick事件
|
||||
$('#menu a').each(function() {
|
||||
var text = $(this).text().trim();
|
||||
var url = '';
|
||||
if (text === '水厂大屏') {
|
||||
url = ext.contextPath + '/jsp/bigScreen.jsp';
|
||||
} else if (text === '区域管线大屏') {
|
||||
url = ext.contextPath + '/jsp/bigScreen2.jsp';
|
||||
} else if (text === '排污户大屏') {
|
||||
url = ext.contextPath + '/jsp/bigScreen3.jsp';
|
||||
}
|
||||
if (url) {
|
||||
$(this).attr('href', 'javascript:void(0);');
|
||||
$(this).attr('onclick', 'openFullScreenWindow(\'' + url + '\');');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 获取浏览器当前缩放比例
|
||||
* @returns 100为100%
|
||||
*/
|
||||
@ -923,7 +870,7 @@ function openModal(modalId) {
|
||||
}
|
||||
|
||||
}
|
||||
})
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1113,6 +1060,12 @@ $(function () {
|
||||
});
|
||||
//FastClick.attach(document.body);
|
||||
|
||||
// 解决嵌套模态框中输入框无法获得焦点的问题
|
||||
// 禁用Bootstrap模态框的enforceFocus,允许嵌套模态框中的输入框正常工作
|
||||
if ($.fn.modal && $.fn.modal.Constructor) {
|
||||
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
|
||||
}
|
||||
|
||||
//弹窗关闭触发方法
|
||||
/*$(".modal").on("hidden.bs.modal", function() {
|
||||
$('.modal').css("overflow","auto");
|
||||
|
||||
@ -116,8 +116,11 @@ var getFileListMinioPic = function (divId, status, entityId, previews, previewCo
|
||||
tbName: tbName,
|
||||
bucketName: bucketName
|
||||
}, function (data) {
|
||||
// 清空数组而不是重新赋值,这样可以保持引用不变
|
||||
previews.length = 0;
|
||||
previewConfigs.length = 0;
|
||||
|
||||
if (data.length > 0) {
|
||||
previews = new Array();
|
||||
$('#maintenancefile').show();
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
var previewConfig = new Object();
|
||||
@ -133,10 +136,9 @@ var getFileListMinioPic = function (divId, status, entityId, previews, previewCo
|
||||
}
|
||||
previewConfigs.push(previewConfig);
|
||||
}
|
||||
showFileInput_new(divId, previews, previewConfigs);
|
||||
} else {
|
||||
$('#' + divId).hide();
|
||||
}
|
||||
// 无论是否有数据都重新初始化控件
|
||||
showFileInput_new(divId, previews, previewConfigs);
|
||||
}, 'json');
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
//金山项目首页
|
||||
|
||||
|
||||
/**
|
||||
* 获取点位实时值
|
||||
* @param unitId
|
||||
@ -8,30 +7,64 @@
|
||||
* @param valueId
|
||||
* @param textId
|
||||
*/
|
||||
function getValue(unitId, mpointCode, valueId, textId) {
|
||||
function getValue4Es(unitId, mpointCode, valueId, textId) {
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: ext.contextPath + '/work/mpoint/getValue4Es.do?unitId=' + unitId + '&mpointCode=' + mpointCode,
|
||||
type: "GET",
|
||||
url:
|
||||
ext.contextPath +
|
||||
"/work/mpoint/getValue4Es.do?unitId=" +
|
||||
unitId +
|
||||
"&mpointCode=" +
|
||||
mpointCode,
|
||||
async: true,
|
||||
globle: false,
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
success: function (data) {
|
||||
if (data != null && data != '') {
|
||||
var data = eval('(' + data + ')');
|
||||
if (data != null && data != "") {
|
||||
var data = eval("(" + data + ")");
|
||||
//只限制上限为0.8 下限根据设定值自己设
|
||||
// var maxvalue = data.alarmmax/0.8;
|
||||
// var minvalue = data.alarmmin/maxvalue;
|
||||
// var acvalue = data.parmvalue/maxvalue*100;
|
||||
$('#' + valueId).html(data.parmvalue);//赋值
|
||||
$("#" + valueId).html(data.parmvalue); //赋值
|
||||
if (data.unit == undefined) {
|
||||
$('#' + textId).html(data.parmname);//赋值名称
|
||||
$("#" + textId).html(data.parmname); //赋值名称
|
||||
} else {
|
||||
$('#' + textId).html(data.parmname + ' (' + data.unit + ')');//赋值名称+单位
|
||||
$("#" + textId).html(data.parmname + " (" + data.unit + ")"); //赋值名称+单位
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function getValue(unitId, mpointCode, valueId, textId) {
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url:
|
||||
ext.contextPath +
|
||||
"/work/mpoint/getValue.do?unitId=" +
|
||||
unitId +
|
||||
"&mpointCode=" +
|
||||
mpointCode,
|
||||
async: true,
|
||||
globle: false,
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
success: function (data) {
|
||||
if (data != null && data != "") {
|
||||
var data = eval("(" + data + ")");
|
||||
console.log(data);
|
||||
$("#" + valueId).html(data.parmvalue); //赋值
|
||||
if (data.unit == undefined) {
|
||||
$("#" + textId).html(data.parmname); //赋值名称
|
||||
} else {
|
||||
$("#" + textId).html(data.parmname + " (" + data.unit + ")"); //赋值名称+单位
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -41,19 +74,24 @@ function getValue(unitId, mpointCode, valueId, textId) {
|
||||
function echartPie(unitId, mpointCode, echartId, textId) {
|
||||
var myChart = echarts.init(document.getElementById(echartId));
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: ext.contextPath + '/work/mpoint/getValue4Es.do?unitId=' + unitId + '&mpointCode=' + mpointCode,
|
||||
type: "GET",
|
||||
url:
|
||||
ext.contextPath +
|
||||
"/work/mpoint/getValue4Es.do?unitId=" +
|
||||
unitId +
|
||||
"&mpointCode=" +
|
||||
mpointCode,
|
||||
async: true,
|
||||
globle: false,
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
success: function (data) {
|
||||
if (data != null && data != '') {
|
||||
if (data != null && data != "") {
|
||||
var echart_minvalue = 0.2;
|
||||
var echart_maxvalue = 0.8;
|
||||
|
||||
var data = eval('(' + data + ')');
|
||||
var data = eval("(" + data + ")");
|
||||
//180度的上限
|
||||
var maxvalue_20 = data.alarmmax * 1.2;
|
||||
//0度的下限
|
||||
@ -63,7 +101,7 @@ function echartPie(unitId, mpointCode, echartId, textId) {
|
||||
var minvalue = data.alarmmin;
|
||||
|
||||
//判断是否需要下限
|
||||
if (data.alarmmin == null || data.alarmmin == '') {
|
||||
if (data.alarmmin == null || data.alarmmin == "") {
|
||||
minvalue_20 = 0;
|
||||
minvalue = 0;
|
||||
echart_minvalue = 0;
|
||||
@ -71,12 +109,12 @@ function echartPie(unitId, mpointCode, echartId, textId) {
|
||||
|
||||
var parmvalue = data.parmvalue;
|
||||
var rate = 0;
|
||||
var unit = '';
|
||||
var unit = "";
|
||||
|
||||
$('#' + textId).html(data.parmname);
|
||||
$("#" + textId).html(data.parmname);
|
||||
|
||||
if (data.unit != undefined && data.unit != null && data.unit != '') {
|
||||
unit = '(' + data.unit + ')';
|
||||
if (data.unit != undefined && data.unit != null && data.unit != "") {
|
||||
unit = "(" + data.unit + ")";
|
||||
}
|
||||
|
||||
//计算实际值比例
|
||||
@ -87,7 +125,7 @@ function echartPie(unitId, mpointCode, echartId, textId) {
|
||||
minvalue = minvalue * 100;
|
||||
maxvalue = maxvalue * 100;
|
||||
if (maxvalue != undefined && minvalue != undefined) {
|
||||
rate = parmvalue / (maxvalue_20 - minvalue_20) * 100;
|
||||
rate = (parmvalue / (maxvalue_20 - minvalue_20)) * 100;
|
||||
} else {
|
||||
rate = parmvalue;
|
||||
}
|
||||
@ -103,52 +141,92 @@ function echartPie(unitId, mpointCode, echartId, textId) {
|
||||
}
|
||||
|
||||
//计算颜色
|
||||
var colorStr = '#6C6C6C';
|
||||
var colorStr = "#6C6C6C";
|
||||
if (parmvalue < minvalue) {
|
||||
colorStr = '#6C6C6C';
|
||||
colorStr = "#6C6C6C";
|
||||
} else if (parmvalue > maxvalue) {
|
||||
colorStr = '#f35a4a';
|
||||
colorStr = "#f35a4a";
|
||||
} else {
|
||||
colorStr = '#66d99f';
|
||||
colorStr = "#66d99f";
|
||||
}
|
||||
|
||||
console.log(data.parmname + '扩大下限:' + minvalue_20 + '------扩大上限:' + maxvalue_20 + '------实际比率:' + rate + '------实际值:' + parmvalue + '------实际下限:' + minvalue + '------实际上限:' + maxvalue);
|
||||
console.log(
|
||||
data.parmname +
|
||||
"扩大下限:" +
|
||||
minvalue_20 +
|
||||
"------扩大上限:" +
|
||||
maxvalue_20 +
|
||||
"------实际比率:" +
|
||||
rate +
|
||||
"------实际值:" +
|
||||
parmvalue +
|
||||
"------实际下限:" +
|
||||
minvalue +
|
||||
"------实际上限:" +
|
||||
maxvalue,
|
||||
);
|
||||
|
||||
var option = {
|
||||
toolbox: { //可视化的工具箱
|
||||
show: false, feature: {
|
||||
restore: { //重置
|
||||
show: true
|
||||
}, saveAsImage: {//保存图片
|
||||
show: true
|
||||
}
|
||||
}
|
||||
}, series: [{
|
||||
name: '业务指标', type: 'gauge', startAngle: 180, endAngle: 0, radius: 70, center: ['50%', '80%'],//设置饼图位置
|
||||
axisLine: {
|
||||
show: true, // 属性lineStyle控制线条样式
|
||||
lineStyle: {
|
||||
width: 15, // color: [[0.2, '#e2e2e2'], [0.8, '#66d99f'], [maxvalue, '#f35a4a']]
|
||||
color: [[echart_minvalue, '#f35a4a'], [echart_maxvalue, '#66d99f'], [maxvalue_20, '#f35a4a']]
|
||||
}
|
||||
}, splitLine: {
|
||||
show: false,
|
||||
}, axisTick: {
|
||||
show: false,
|
||||
}, axisLabel: {
|
||||
show: false,
|
||||
}, pointer: {
|
||||
length: '40px', width: '3px',
|
||||
}, detail: {
|
||||
offsetCenter: [0, '20%'], fontSize: 14, color: colorStr, //formatter: data.parmname,
|
||||
formatter: data.parmvalue + unit//data.parmvalue为实际值 acvalue为计算后的比例
|
||||
}, data: [{value: rate}]
|
||||
}]
|
||||
toolbox: {
|
||||
//可视化的工具箱
|
||||
show: false,
|
||||
feature: {
|
||||
restore: {
|
||||
//重置
|
||||
show: true,
|
||||
},
|
||||
saveAsImage: {
|
||||
//保存图片
|
||||
show: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "业务指标",
|
||||
type: "gauge",
|
||||
startAngle: 180,
|
||||
endAngle: 0,
|
||||
radius: 70,
|
||||
center: ["50%", "80%"], //设置饼图位置
|
||||
axisLine: {
|
||||
show: true, // 属性lineStyle控制线条样式
|
||||
lineStyle: {
|
||||
width: 15, // color: [[0.2, '#e2e2e2'], [0.8, '#66d99f'], [maxvalue, '#f35a4a']]
|
||||
color: [
|
||||
[echart_minvalue, "#f35a4a"],
|
||||
[echart_maxvalue, "#66d99f"],
|
||||
[maxvalue_20, "#f35a4a"],
|
||||
],
|
||||
},
|
||||
},
|
||||
splitLine: {
|
||||
show: false,
|
||||
},
|
||||
axisTick: {
|
||||
show: false,
|
||||
},
|
||||
axisLabel: {
|
||||
show: false,
|
||||
},
|
||||
pointer: {
|
||||
length: "40px",
|
||||
width: "3px",
|
||||
},
|
||||
detail: {
|
||||
offsetCenter: [0, "20%"],
|
||||
fontSize: 14,
|
||||
color: colorStr, //formatter: data.parmname,
|
||||
formatter: data.parmvalue + unit, //data.parmvalue为实际值 acvalue为计算后的比例
|
||||
},
|
||||
data: [{ value: rate }],
|
||||
},
|
||||
],
|
||||
};
|
||||
myChart.setOption(option);
|
||||
myChart.resize();
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -159,42 +237,97 @@ function echartLine(unitId, mpointCode, echartId) {
|
||||
var myChart = echarts.init(document.getElementById(echartId));
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: ext.contextPath + '/work/mpoint/getValueMonth.do?unitId=' + unitId + '&mpointCode=' + mpointCode,
|
||||
type: "GET",
|
||||
url:
|
||||
ext.contextPath +
|
||||
"/work/mpoint/getValueMonth.do?unitId=" +
|
||||
unitId +
|
||||
"&mpointCode=" +
|
||||
mpointCode,
|
||||
async: true,
|
||||
globle: false,
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
success: function (data) {
|
||||
var data = eval('(' + data + ')');
|
||||
var data = eval("(" + data + ")");
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
}, title: [{
|
||||
left: 'center', text: data.name
|
||||
}], grid: {
|
||||
left: '3%', right: '4%', bottom: '3%', containLabel: true
|
||||
}, xAxis: {
|
||||
type: 'category',
|
||||
trigger: "axis",
|
||||
},
|
||||
title: [
|
||||
{
|
||||
left: "center",
|
||||
text: data.name,
|
||||
},
|
||||
],
|
||||
grid: {
|
||||
left: "3%",
|
||||
right: "4%",
|
||||
bottom: "3%",
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: {
|
||||
type: "category",
|
||||
boundaryGap: false,
|
||||
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31']
|
||||
}, yAxis: {
|
||||
type: 'value'
|
||||
}, series: [{
|
||||
name: '上限', type: 'line', // stack: '总量',
|
||||
data: data.maxlist
|
||||
}, {
|
||||
name: '下限', type: 'line', // stack: '总量',
|
||||
data: data.minlist
|
||||
}, {
|
||||
name: '实际值', type: 'line', // stack: '总量',
|
||||
data: data.datalist
|
||||
}]
|
||||
data: [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"16",
|
||||
"17",
|
||||
"18",
|
||||
"19",
|
||||
"20",
|
||||
"21",
|
||||
"22",
|
||||
"23",
|
||||
"24",
|
||||
"25",
|
||||
"26",
|
||||
"27",
|
||||
"28",
|
||||
"29",
|
||||
"30",
|
||||
"31",
|
||||
],
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: "上限",
|
||||
type: "line", // stack: '总量',
|
||||
data: data.maxlist,
|
||||
},
|
||||
{
|
||||
name: "下限",
|
||||
type: "line", // stack: '总量',
|
||||
data: data.minlist,
|
||||
},
|
||||
{
|
||||
name: "实际值",
|
||||
type: "line", // stack: '总量',
|
||||
data: data.datalist,
|
||||
},
|
||||
],
|
||||
};
|
||||
myChart.setOption(option);
|
||||
myChart.resize();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -205,76 +338,381 @@ function echartColumnar(unitId, mpointCode, echartId) {
|
||||
var myChart = echarts.init(document.getElementById(echartId));
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: ext.contextPath + '/work/mpoint/getValueMonth.do?unitId=' + unitId + '&mpointCode=' + mpointCode,
|
||||
type: "GET",
|
||||
url:
|
||||
ext.contextPath +
|
||||
"/work/mpoint/getValueMonth.do?unitId=" +
|
||||
unitId +
|
||||
"&mpointCode=" +
|
||||
mpointCode,
|
||||
async: true,
|
||||
globle: false,
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
success: function (data) {
|
||||
var data = eval('(' + data + ')');
|
||||
var data = eval("(" + data + ")");
|
||||
var option = {
|
||||
color: '#62AEDF', tooltip: {
|
||||
trigger: 'axis', axisPointer: { // 坐标轴指示器,坐标轴触发有效
|
||||
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
|
||||
}
|
||||
}, xAxis: {
|
||||
type: 'category',
|
||||
data: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31']
|
||||
}, yAxis: {
|
||||
type: 'value'
|
||||
}, title: [{
|
||||
left: 'center', text: data.name
|
||||
}], grid: {
|
||||
left: '3%', right: '4%', bottom: '3%', containLabel: true
|
||||
}, series: [{
|
||||
data: data.datalist, type: 'bar', showBackground: true
|
||||
// backgroundStyle: {
|
||||
// //color: '#62AEDF'
|
||||
// }
|
||||
}]
|
||||
color: "#62AEDF",
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
// 坐标轴指示器,坐标轴触发有效
|
||||
type: "shadow", // 默认为直线,可选为:'line' | 'shadow'
|
||||
},
|
||||
},
|
||||
xAxis: {
|
||||
type: "category",
|
||||
data: [
|
||||
"1",
|
||||
"2",
|
||||
"3",
|
||||
"4",
|
||||
"5",
|
||||
"6",
|
||||
"7",
|
||||
"8",
|
||||
"9",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"16",
|
||||
"17",
|
||||
"18",
|
||||
"19",
|
||||
"20",
|
||||
"21",
|
||||
"22",
|
||||
"23",
|
||||
"24",
|
||||
"25",
|
||||
"26",
|
||||
"27",
|
||||
"28",
|
||||
"29",
|
||||
"30",
|
||||
"31",
|
||||
],
|
||||
},
|
||||
yAxis: {
|
||||
type: "value",
|
||||
},
|
||||
title: [
|
||||
{
|
||||
left: "center",
|
||||
text: data.name,
|
||||
},
|
||||
],
|
||||
grid: {
|
||||
left: "3%",
|
||||
right: "4%",
|
||||
bottom: "3%",
|
||||
containLabel: true,
|
||||
},
|
||||
series: [
|
||||
{
|
||||
data: data.datalist,
|
||||
type: "bar",
|
||||
showBackground: true,
|
||||
// backgroundStyle: {
|
||||
// //color: '#62AEDF'
|
||||
// }
|
||||
},
|
||||
],
|
||||
};
|
||||
myChart.setOption(option);
|
||||
myChart.resize();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* echart柱状图--多点
|
||||
* echart柱状图--多点 (原有)
|
||||
*/
|
||||
function echartColumnar2(unitId, mpointCode, echartId) {
|
||||
function echartColumnar2_1(unitId, mpointCode, echartId) {
|
||||
var myChart = echarts.init(document.getElementById(echartId));
|
||||
|
||||
$.ajax({
|
||||
type: 'GET',
|
||||
url: ext.contextPath + '/work/mpoint/getValueWeekS.do?unitId=' + unitId + '&mpointCode=' + mpointCode,
|
||||
type: "GET",
|
||||
url:
|
||||
ext.contextPath +
|
||||
"/work/mpoint/getValueWeekS.do?unitId=" +
|
||||
unitId +
|
||||
"&mpointCode=" +
|
||||
mpointCode,
|
||||
async: true,
|
||||
globle: false,
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
success: function (data) {
|
||||
var datastr = eval('(' + data + ')');
|
||||
var datastr = eval("(" + data + ")");
|
||||
|
||||
var data1 = datastr.dataJson;
|
||||
var data2 = datastr.timeJson;
|
||||
|
||||
var option = {
|
||||
color: ['#67D89F', '#FFBB00'], legend: {}, calculable: true, xAxis: [{
|
||||
type: 'category', axisLabel: {
|
||||
interval: 0,//代表显示所有x轴标签显示
|
||||
}, data: data2
|
||||
}], yAxis: [{
|
||||
type: 'value'
|
||||
}], grid: {
|
||||
left: '2%', right: '5%', bottom: '3%', containLabel: true
|
||||
}, series: data1
|
||||
color: ["#67D89F", "#FFBB00"],
|
||||
legend: {},
|
||||
calculable: true,
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
axisLabel: {
|
||||
interval: 0, //代表显示所有x轴标签显示
|
||||
},
|
||||
data: data2,
|
||||
},
|
||||
],
|
||||
yAxis: [
|
||||
{
|
||||
type: "value",
|
||||
},
|
||||
],
|
||||
grid: {
|
||||
left: "2%",
|
||||
right: "5%",
|
||||
bottom: "3%",
|
||||
containLabel: true,
|
||||
},
|
||||
series: data1,
|
||||
};
|
||||
myChart.setOption(option);
|
||||
myChart.resize();
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function initEchartColumnar2() {
|
||||
var chart = echarts.init(document.getElementById('myChartProduce8'));
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
axisPointer: {
|
||||
type: 'shadow'
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['工业进水', '工业出水', '生活进水', '生活出水'],
|
||||
top: 5,
|
||||
textStyle: {
|
||||
fontSize: 12
|
||||
}
|
||||
},
|
||||
grid: {
|
||||
left: '5%',
|
||||
right: '5%',
|
||||
bottom: '8%',
|
||||
top: '18%',
|
||||
containLabel: true
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
data: ['3/16', '3/17', '3/18', '3/19', '3/20', '3/21', '3/22'],
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: '#e8e8e8'
|
||||
}
|
||||
},
|
||||
axisLabel: {
|
||||
color: '#666',
|
||||
fontSize: 12
|
||||
}
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
name: 'm³/D',
|
||||
nameTextStyle: {
|
||||
fontSize: 12
|
||||
},
|
||||
axisLine: {
|
||||
show: false
|
||||
},
|
||||
axisTick: {
|
||||
show: false
|
||||
},
|
||||
axisLabel: {
|
||||
color: '#666',
|
||||
fontSize: 12
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: '#f0f0f0'
|
||||
}
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '工业进水',
|
||||
type: 'bar',
|
||||
barWidth: '20%',
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{offset: 0, color: '#378dcc'},
|
||||
{offset: 1, color: '#5ba3d9'}
|
||||
])
|
||||
},
|
||||
data: [0, 0, 0, 0, 0, 0, 0]
|
||||
},
|
||||
{
|
||||
name: '工业出水',
|
||||
type: 'bar',
|
||||
barWidth: '20%',
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{offset: 0, color: '#5b8def'},
|
||||
{offset: 1, color: '#40a9ff'}
|
||||
])
|
||||
},
|
||||
data: [0, 0, 0, 0, 0, 0, 0]
|
||||
},
|
||||
{
|
||||
name: '生活进水',
|
||||
type: 'bar',
|
||||
barWidth: '20%',
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{offset: 0, color: '#52c41a'},
|
||||
{offset: 1, color: '#73d13d'}
|
||||
])
|
||||
},
|
||||
data: [0, 0, 0, 0, 0, 0, 0]
|
||||
},
|
||||
{
|
||||
name: '生活出水',
|
||||
type: 'bar',
|
||||
barWidth: '20%',
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
||||
{offset: 0, color: '#2ecc71'},
|
||||
{offset: 1, color: '#58d68d'}
|
||||
])
|
||||
},
|
||||
data: [0, 0, 0, 0, 0, 0, 0]
|
||||
}
|
||||
]
|
||||
};
|
||||
chart.setOption(option);
|
||||
chart.resize();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* echart柱状图--多点 (TGLW新版)- (工业生活污水流量7天日趋势)
|
||||
*/
|
||||
function echartColumnar2(unitId, mpointCode, echartId) {
|
||||
var myChart = echarts.init(document.getElementById(echartId));
|
||||
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
// url: ext.contextPath + '/work/mpoint/getValueWeekS.do?unitId=' + unitId + '&mpointCode=' + mpointCode,
|
||||
url:
|
||||
ext.contextPath +
|
||||
"/work/mpoint/getValueWeekS.do?unitId=" +
|
||||
unitId +
|
||||
"&mpointCode=" +
|
||||
"C_GYJsssll,C_GYCsssll,C_SHJsssll,C_SHCsssll",
|
||||
async: true,
|
||||
globle: false,
|
||||
error: function () {
|
||||
return false;
|
||||
},
|
||||
success: function (data) {
|
||||
var datastr = eval("(" + data + ")");
|
||||
|
||||
var data1 = datastr.dataJson;
|
||||
var data2 = datastr.timeJson;
|
||||
var series = [];
|
||||
var legendData = [];
|
||||
|
||||
if (data1) {
|
||||
data1.forEach(function(item, index) {
|
||||
legendData.push(item.name);
|
||||
var colors = [
|
||||
[{offset: 0, color: '#378dcc'}, {offset: 1, color: '#5ba3d9'}],
|
||||
[{offset: 0, color: '#5b8def'}, {offset: 1, color: '#40a9ff'}],
|
||||
[{offset: 0, color: '#52c41a'}, {offset: 1, color: '#73d13d'}],
|
||||
[{offset: 0, color: '#2ecc71'}, {offset: 1, color: '#58d68d'}]
|
||||
];
|
||||
series.push({
|
||||
name: item.name,
|
||||
type: item.type || 'bar',
|
||||
barWidth: '20%',
|
||||
itemStyle: {
|
||||
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, colors[index % colors.length])
|
||||
},
|
||||
data: item.data
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
var option = {
|
||||
tooltip: {
|
||||
trigger: "axis",
|
||||
axisPointer: {
|
||||
type: "shadow",
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
data: legendData,
|
||||
top: 5,
|
||||
textStyle: {
|
||||
fontSize: 12,
|
||||
},
|
||||
},
|
||||
grid: {
|
||||
left: "5%",
|
||||
right: "5%",
|
||||
bottom: "8%",
|
||||
top: "18%",
|
||||
containLabel: true,
|
||||
},
|
||||
xAxis: [
|
||||
{
|
||||
type: "category",
|
||||
data: data2,
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: "#e8e8e8",
|
||||
},
|
||||
},
|
||||
axisLabel: {
|
||||
color: "#666",
|
||||
fontSize: 12,
|
||||
interval: 0, //代表显示所有x轴标签显示
|
||||
},
|
||||
},
|
||||
],
|
||||
yAxis: {
|
||||
type: "value",
|
||||
name: "m³/D",
|
||||
nameTextStyle: {
|
||||
fontSize: 12,
|
||||
},
|
||||
axisLine: {
|
||||
show: false,
|
||||
},
|
||||
axisTick: {
|
||||
show: false,
|
||||
},
|
||||
axisLabel: {
|
||||
color: "#666",
|
||||
fontSize: 12,
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
color: "#f0f0f0",
|
||||
},
|
||||
},
|
||||
},
|
||||
series: series,
|
||||
};
|
||||
myChart.setOption(option);
|
||||
myChart.resize();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@ -283,7 +721,10 @@ function echartColumnar2(unitId, mpointCode, echartId) {
|
||||
* @param unitId
|
||||
*/
|
||||
function getPic(unitId) {
|
||||
$("#mainImg").attr("src", ext.contextPath + "/IMG/main/main_" + unitId + ".jpg");
|
||||
$("#mainImg").attr(
|
||||
"src",
|
||||
ext.contextPath + "/IMG/main/main_" + unitId + ".jpg",
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -294,21 +735,37 @@ function getPic(unitId, unit, proDatavisualFrame) {
|
||||
//$("#mainImg").attr("src", ext.contextPath + "/IMG/main/main_" + unitId + ".jpg");
|
||||
var unitIds = JSON.parse(unit);
|
||||
var proDatavisualFrames = JSON.parse(proDatavisualFrame);
|
||||
var active = '';
|
||||
var item = '';
|
||||
var active = "";
|
||||
var item = "";
|
||||
var proDatavisualFrames_i = 0;
|
||||
if (unitIds != null && unitIds.length > 0) {
|
||||
for (var i = 0; i < unitIds.length; i++) {
|
||||
if (unitIds[i].type == 'B' || unitIds[i].type == 'C') {
|
||||
if (unitIds[i].type == "B" || unitIds[i].type == "C") {
|
||||
var proDatavisualFrameId = proDatavisualFrames[proDatavisualFrames_i];
|
||||
proDatavisualFrames_i++;
|
||||
if (unitId == unitIds[i].id) {
|
||||
active = 'active';
|
||||
active = "active";
|
||||
} else {
|
||||
active = '';
|
||||
active = "";
|
||||
}
|
||||
var src = ext.contextPath + "/IMG/main/main_" + unitIds[i].id + ".jpg";
|
||||
item += '<div class="item ' + active + ' ">' + '<img src="' + src + '" class="mainImg">' + '<div class="carousel-caption" onclick="proDatavisualFrame(\'' + unitIds[i].id + '\',\'' + proDatavisualFrameId + '\')">' + '<h4>' + unitIds[i].text + '</h4>' + '</div>' + '</div>';
|
||||
item +=
|
||||
'<div class="item ' +
|
||||
active +
|
||||
' ">' +
|
||||
'<img src="' +
|
||||
src +
|
||||
'" class="mainImg">' +
|
||||
'<div class="carousel-caption" onclick="proDatavisualFrame(\'' +
|
||||
unitIds[i].id +
|
||||
"','" +
|
||||
proDatavisualFrameId +
|
||||
"')\">" +
|
||||
"<h4>" +
|
||||
unitIds[i].text +
|
||||
"</h4>" +
|
||||
"</div>" +
|
||||
"</div>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -316,15 +773,39 @@ function getPic(unitId, unit, proDatavisualFrame) {
|
||||
}
|
||||
|
||||
function getUnitsByUnitId4Select(id, funname, proDatavisualFrame) {
|
||||
$.post(ext.contextPath + "/user/getUnitsByUnitId4Select.do", {id: id}, function (data) {
|
||||
//console.log(data);
|
||||
var unitIds = data;
|
||||
eval(funname + "('" + id + "','" + unitIds + "','" + proDatavisualFrame + "')")
|
||||
});
|
||||
$.post(
|
||||
ext.contextPath + "/user/getUnitsByUnitId4Select.do",
|
||||
{ id: id },
|
||||
function (data) {
|
||||
//console.log(data);
|
||||
var unitIds = data;
|
||||
eval(
|
||||
funname +
|
||||
"('" +
|
||||
id +
|
||||
"','" +
|
||||
unitIds +
|
||||
"','" +
|
||||
proDatavisualFrame +
|
||||
"')",
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
function proDatavisualFrame(unitId, proDatavisualFrameId) {
|
||||
if (proDatavisualFrameId != null && proDatavisualFrameId != undefined && proDatavisualFrameId != '') {
|
||||
parent.addTab(proDatavisualFrameId, '工艺可视化', 'process/dataVisualFrame/view.do?frameId=' + proDatavisualFrameId + '&unitId=' + unitId);
|
||||
if (
|
||||
proDatavisualFrameId != null &&
|
||||
proDatavisualFrameId != undefined &&
|
||||
proDatavisualFrameId != ""
|
||||
) {
|
||||
parent.addTab(
|
||||
proDatavisualFrameId,
|
||||
"工艺可视化",
|
||||
"process/dataVisualFrame/view.do?frameId=" +
|
||||
proDatavisualFrameId +
|
||||
"&unitId=" +
|
||||
unitId,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd">
|
||||
|
||||
<bean id="SCADA_021HQWS" class="com.alibaba.druid.pool.DruidDataSource" init-method="init"
|
||||
<bean id="SCADA_0533JS" class="com.alibaba.druid.pool.DruidDataSource" init-method="init"
|
||||
destroy-method="close">
|
||||
<property name="driverClassName" value="${driver}" />
|
||||
<property name="url" value="${scada-url}" />
|
||||
|
||||
@ -175,7 +175,7 @@
|
||||
<map key-type="com.sipai.tools.DataSources">
|
||||
<entry key="MASTER" value-ref="dataSourceMaster"/>
|
||||
<!-- <entry key="SCADA_HFCG" value-ref="SCADA_HFCG"/>-->
|
||||
<entry key="SCADA_0533JS" value-ref="SCADA_021HQWS"/>
|
||||
<entry key="SCADA_0533JS" value-ref="SCADA_0533JS"/>
|
||||
<!-- 这里还可以加多个dataSource -->
|
||||
</map>
|
||||
</property>
|
||||
@ -250,6 +250,8 @@
|
||||
</tx:advice>
|
||||
<bean id="dataSourceScadaBean" class="com.sipai.tools.DataSourceInterceptor"/>
|
||||
<aop:config>
|
||||
<!-- <aop:pointcut id="transactionPointcut" expression="execution(public * com.sipai.dao.scada.*.*(..))"/>-->
|
||||
<!-- <aop:pointcut id="dataSourceScadaPointcut" expression="execution(public * com.sipai.dao.scada.*.*(..)))"/>-->
|
||||
<aop:pointcut id="transactionPointcut" expression="execution(public * com.sipai.service.*.*(..))"/>
|
||||
<aop:pointcut id="dataSourceScadaPointcut" expression="execution(public * com.sipai.service.scada.*.*(..)))"/>
|
||||
<aop:advisor pointcut-ref="transactionPointcut"
|
||||
|
||||
311
src/main/webapp/jsp/activiti/bpmnFileList.jsp
Normal file
311
src/main/webapp/jsp/activiti/bpmnFileList.jsp
Normal file
@ -0,0 +1,311 @@
|
||||
<%@ page language="java" pageEncoding="UTF-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ page import="com.sipai.entity.base.ServerObject"%>
|
||||
<%@ page import="com.sipai.entity.user.User"%>
|
||||
<%@ page import="com.sipai.entity.user.Company"%>
|
||||
<%@ page import="com.sipai.service.user.UnitService"%>
|
||||
<%@ page import="org.springframework.web.context.WebApplicationContext"%>
|
||||
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils"%>
|
||||
<%@ page import="java.util.List" %>
|
||||
<%@ taglib uri="http://www.springsecurity.org/jsp" prefix="security"%>
|
||||
<%
|
||||
String contextPath = request.getContextPath();
|
||||
User cu = (User)request.getSession().getAttribute("cu");
|
||||
WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(request.getServletContext());
|
||||
UnitService unitService = (UnitService)ctx.getBean("unitService");
|
||||
List<Company> companies = null;
|
||||
if (cu != null) {
|
||||
companies = unitService.getCompaniesByUserId(cu.getId());
|
||||
}
|
||||
%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= ServerObject.atttable.get("TOPTITLE")%> - BPMN流程文件管理</title>
|
||||
<jsp:include page="/jsp/inc.jsp"></jsp:include>
|
||||
<script type="text/javascript">
|
||||
var importBpmnFun = function(path, processName) {
|
||||
// 弹出对话框让用户选择公司
|
||||
var companyId = $('#companyIdSelect').val() || '';
|
||||
var companyHtml = '<select id="dialogCompanyId" class="form-control input-sm">';
|
||||
companyHtml += '<option value="">-- 不指定公司 --</option>';
|
||||
$('#companyIdSelect option').each(function() {
|
||||
companyHtml += '<option value="' + $(this).val() + '">' + $(this).text() + '</option>';
|
||||
});
|
||||
companyHtml += '</select>';
|
||||
|
||||
swal({
|
||||
title: '导入BPMN文件',
|
||||
html: '<div class="form-group">' +
|
||||
'<label>模型名称:</label><input type="text" id="dialogModelName" class="form-control input-sm" value="' + (processName || '') + '">' +
|
||||
'</div>' +
|
||||
'<div class="form-group">' +
|
||||
'<label>所属公司:</label>' + companyHtml +
|
||||
'</div>',
|
||||
showCancelButton: true,
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
preConfirm: function() {
|
||||
return new Promise(function(resolve) {
|
||||
resolve({
|
||||
modelName: $('#dialogModelName').val(),
|
||||
companyId: $('#dialogCompanyId').val()
|
||||
});
|
||||
});
|
||||
}
|
||||
}).then(function(result) {
|
||||
if (result && result.value) {
|
||||
$.post(ext.contextPath + '/activiti/workflow/model/importBpmnFile.do', {
|
||||
bpmnFilePath: path,
|
||||
modelName: result.value.modelName,
|
||||
description: "",
|
||||
companyId: result.value.companyId
|
||||
}, function(data) {
|
||||
if (data.res == 1) {
|
||||
showAlert('s', '导入成功!模型ID: ' + data.modelId);
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '导入失败!');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var deployBpmnFun = function(path, filename) {
|
||||
swal({
|
||||
text: "确定要直接部署此BPMN文件吗?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
}).then(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/activiti/workflow/model/deployBpmnFile.do', {
|
||||
bpmnFilePath: path,
|
||||
deploymentName: filename
|
||||
}, function(data) {
|
||||
if (data.res == 1) {
|
||||
showAlert('s', '部署成功!部署ID: ' + data.deploymentId);
|
||||
} else {
|
||||
showAlert('d', '部署失败!');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var viewBpmnFun = function(path) {
|
||||
window.open(ext.contextPath + '/activiti/workflow/model/getBpmnFileContent.do?bpmnFilePath=' + encodeURIComponent(path), '_blank');
|
||||
};
|
||||
|
||||
var importAllFun = function() {
|
||||
swal({
|
||||
text: "确定要导入所有BPMN文件到模型编辑器吗?",
|
||||
dangerMode: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: "取消",
|
||||
value: null,
|
||||
visible: true,
|
||||
className: "btn btn-default btn-sm",
|
||||
closeModal: true,
|
||||
},
|
||||
confirm: {
|
||||
text: "确定",
|
||||
value: true,
|
||||
visible: true,
|
||||
className: "btn btn-danger btn-sm",
|
||||
closeModal: true
|
||||
}
|
||||
}
|
||||
}).then(function(willDelete) {
|
||||
if (willDelete) {
|
||||
$.post(ext.contextPath + '/activiti/workflow/model/importAllBpmnFiles.do', {}, function(data) {
|
||||
if (data.res == 1) {
|
||||
showAlert('s', '批量导入完成!成功: ' + data.successCount + ', 失败: ' + data.failCount);
|
||||
$("#table").bootstrapTable('refresh');
|
||||
} else {
|
||||
showAlert('d', '批量导入失败!');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
function showTable() {
|
||||
$("#table").bootstrapTable({
|
||||
url: ext.contextPath + '/activiti/workflow/model/getBpmnFileList.do',
|
||||
cache: false,
|
||||
striped: true,
|
||||
pagination: true,
|
||||
pageList: [10, 20, 50],
|
||||
pageSize: 20,
|
||||
pageNumber: 1,
|
||||
sidePagination: 'client',
|
||||
columns: [
|
||||
{
|
||||
field: 'filename',
|
||||
title: '文件名',
|
||||
align: 'left',
|
||||
valign: 'middle'
|
||||
}, {
|
||||
field: 'processId',
|
||||
title: '流程ID',
|
||||
align: 'center',
|
||||
valign: 'middle'
|
||||
}, {
|
||||
field: 'processName',
|
||||
title: '流程名称',
|
||||
align: 'center',
|
||||
valign: 'middle'
|
||||
}, {
|
||||
field: 'path',
|
||||
title: '文件路径',
|
||||
align: 'left',
|
||||
valign: 'middle',
|
||||
formatter: function(value, row) {
|
||||
if (value && value.indexOf('diagrams/') >= 0) {
|
||||
return value.substring(value.indexOf('diagrams/'));
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}, {
|
||||
title: "操作",
|
||||
align: 'center',
|
||||
valign: 'middle',
|
||||
width: 280,
|
||||
formatter: function(value, row, index) {
|
||||
var path = row.path;
|
||||
if (path && path.indexOf('diagrams/') >= 0) {
|
||||
path = path.substring(path.indexOf('diagrams/') + 9);
|
||||
}
|
||||
var str = '';
|
||||
str += '<button class="btn btn-default btn-sm" onclick="importBpmnFun(\'' + path + '\', \'' + (row.processName || row.filename) + '\')" title="导入到模型编辑器"><i class="fa fa-download"></i> 导入</button>';
|
||||
str += '<button class="btn btn-default btn-sm" onclick="deployBpmnFun(\'' + path + '\', \'' + row.filename + '\')" title="直接部署"><i class="fa fa-play"></i> 部署</button>';
|
||||
str += '<button class="btn btn-default btn-sm" onclick="viewBpmnFun(\'' + path + '\')" title="查看XML"><i class="fa fa-eye"></i> 查看</button>';
|
||||
return '<div class="btn-group">' + str + '</div>';
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadSuccess: function() {
|
||||
adjustBootstrapTableView("table");
|
||||
},
|
||||
onLoadError: function() {
|
||||
console.info("加载数据失败");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 上传BPMN文件
|
||||
var uploadBpmnFun = function() {
|
||||
var formData = new FormData($('#uploadForm')[0]);
|
||||
$.ajax({
|
||||
url: ext.contextPath + '/activiti/workflow/model/uploadBpmnFile.do',
|
||||
type: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
if (data.res == 1) {
|
||||
showAlert('s', '上传导入成功!模型ID: ' + data.modelId);
|
||||
window.location.href = ext.contextPath + '/activiti/workflow/model/showModelList.do';
|
||||
} else {
|
||||
showAlert('d', '上传导入失败!');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
showAlert('d', '上传失败!');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$(function() {
|
||||
showTable();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body class="hold-transition ${cu.themeclass} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
<div class="content-wrapper">
|
||||
<section class="content container-fluid">
|
||||
<div id="alertDiv"></div>
|
||||
<!-- 隐藏的公司选择器 -->
|
||||
<select id="companyIdSelect" style="display:none;">
|
||||
<% if (companies != null) { for (Company company : companies) { %>
|
||||
<option value="<%= company.getId() %>"><%= company.getName() %></option>
|
||||
<% } } %>
|
||||
</select>
|
||||
|
||||
<div class="form-group" style="padding:0;">
|
||||
<div class="btn-group" style="padding-bottom:10px;">
|
||||
<!-- 上传按钮 -->
|
||||
<button type="button" class="btn btn-success btn-sm" data-toggle="modal" data-target="#uploadModal">
|
||||
<i class="fa fa-upload"></i> 上传BPMN
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary btn-sm" onclick="importAllFun();">
|
||||
<i class="fa fa-download"></i> 批量导入所有
|
||||
</button>
|
||||
<a href="<%=contextPath%>/activiti/workflow/model/showModelList.do" class="btn btn-default btn-sm">
|
||||
<i class="fa fa-list"></i> 模型列表
|
||||
</a>
|
||||
</div>
|
||||
<div class="form-group pull-right">
|
||||
<span class="help-block">BPMN文件目录: src/main/resources/diagrams/</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 上传对话框 -->
|
||||
<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal"><span>×</span></button>
|
||||
<h4 class="modal-title">上传BPMN文件</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="uploadForm" enctype="multipart/form-data">
|
||||
<div class="form-group">
|
||||
<label>选择BPMN文件:</label>
|
||||
<input type="file" name="file" class="form-control" accept=".bpmn,.bpmn20.xml" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>所属公司:</label>
|
||||
<select name="companyId" class="form-control">
|
||||
<option value="">-- 请选择 --</option>
|
||||
<% if (companies != null) { for (Company company : companies) { %>
|
||||
<option value="<%= company.getId() %>"><%= company.getName() %></option>
|
||||
<% } } %>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
|
||||
<button type="button" class="btn btn-primary" onclick="uploadBpmnFun()">上传并导入</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="table"></table>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -79,8 +79,8 @@ var initTable = function(id) {
|
||||
align: 'center', // 左右居中
|
||||
valign: 'middle', // 上下居中
|
||||
formatter:function(value,row,index){
|
||||
return value.name;
|
||||
}
|
||||
return row.nodeName || (value && value.name) || '';
|
||||
}
|
||||
},{
|
||||
field: 'businessunit', // 返回json数据中的name
|
||||
title: '节点业务名称', // 表格表头显示文字
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user