|
|
|
|
@@ -6,23 +6,28 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import org.nl.acs.device.domain.Device;
|
|
|
|
|
import org.nl.common.domain.query.PageQuery;
|
|
|
|
|
import org.nl.common.utils.SecurityUtils;
|
|
|
|
|
import org.nl.system.service.template.TemplateService;
|
|
|
|
|
import org.nl.system.service.template.dto.Template;
|
|
|
|
|
import org.nl.system.service.template.dto.mapper.TemplateMapper;
|
|
|
|
|
import org.nl.system.service.tickets.dto.Tickets;
|
|
|
|
|
import org.nl.system.service.tickets.dto.mapper.TicketsMapper;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@@ -31,20 +36,24 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> i
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private TemplateMapper templateMapper;
|
|
|
|
|
@Autowired
|
|
|
|
|
private TicketsMapper ticketsMapper;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addTemplate(Map map) {
|
|
|
|
|
String template_name =(String) map.get("template_name");
|
|
|
|
|
String panels1 = CollUtil.toList(map.get("panels")).get(0).toString();
|
|
|
|
|
String replace = panels1.replace("=", ":").substring(1, panels1.length() - 1);
|
|
|
|
|
Map panels=new HashMap();
|
|
|
|
|
panels.put("panels",map.get("panels"));
|
|
|
|
|
// String replace = panels1.replace("=", ":").substring(1, panels1.length() - 1);
|
|
|
|
|
Template template = new Template();
|
|
|
|
|
template.setTemplate_id(RandomUtil.randomNumbers(16));
|
|
|
|
|
template.setTemplate_name(template_name);
|
|
|
|
|
template.setTemplate(replace);
|
|
|
|
|
template.setTemplate(JSON.toJSONString(panels));
|
|
|
|
|
template.setCreate_by(SecurityUtils.getCurrentUsername());
|
|
|
|
|
template.setCreate_time(DateUtil.now());
|
|
|
|
|
template.setUpdate_by(SecurityUtils.getCurrentUsername());
|
|
|
|
|
template.setUpdate_time(DateUtil.now());
|
|
|
|
|
template.setIs_delete("1");
|
|
|
|
|
templateMapper.insert(template);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -61,12 +70,49 @@ public class TemplateServiceImpl extends ServiceImpl<TemplateMapper, Template> i
|
|
|
|
|
return template;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public JSONArray getTicketList() {
|
|
|
|
|
//设备基础信息表【acs_device】
|
|
|
|
|
// JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND device_type = 'conveyor'").getResultJSONArray(0);
|
|
|
|
|
List<Tickets> getTicketList = new LambdaQueryChainWrapper<>(ticketsMapper)
|
|
|
|
|
.apply("is_delete= '1'")
|
|
|
|
|
.list();
|
|
|
|
|
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(getTicketList));
|
|
|
|
|
JSONArray result = new JSONArray();
|
|
|
|
|
for (int i = 0; i < arr.size(); i++) {
|
|
|
|
|
JSONObject obj = arr.getJSONObject(i);
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("ticket_code", obj.getString("ticket_code"));
|
|
|
|
|
result.add(json);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public JSONArray getTemplateList() {
|
|
|
|
|
//设备基础信息表【acs_device】
|
|
|
|
|
// JSONArray arr = WQLObject.getWQLObject("acs_device").query("is_delete= '0' AND is_active= '1' AND device_type = 'conveyor'").getResultJSONArray(0);
|
|
|
|
|
List<Template> getTemplateList = new LambdaQueryChainWrapper<>(templateMapper)
|
|
|
|
|
.apply("is_delete= '1'")
|
|
|
|
|
.list();
|
|
|
|
|
JSONArray arr = JSONArray.parseArray(JSON.toJSONString(getTemplateList));
|
|
|
|
|
JSONArray result = new JSONArray();
|
|
|
|
|
for (int i = 0; i < arr.size(); i++) {
|
|
|
|
|
JSONObject obj = arr.getJSONObject(i);
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
json.put("template_id", obj.getString("template_id"));
|
|
|
|
|
json.put("template_name", obj.getString("template_name"));
|
|
|
|
|
result.add(json);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IPage<Template> query(Map param, PageQuery page) {
|
|
|
|
|
QueryWrapper<Template> wrapper = new QueryWrapper<>();
|
|
|
|
|
wrapper.like(ObjectUtil.isNotEmpty(param.get("template_name")),"template_name",param.get("template_name"))
|
|
|
|
|
.eq(ObjectUtil.isNotEmpty(param.get("template_status")),"template_status",1)
|
|
|
|
|
.orderByAsc("create_time");
|
|
|
|
|
wrapper.eq("is_delete", 1);
|
|
|
|
|
Page<Template> templatePage = this.page(new Page<>(page.getPage() + 1, page.getSize()), wrapper);
|
|
|
|
|
return templatePage;
|
|
|
|
|
}
|
|
|
|
|
|