工程管理
This commit is contained in:
parent
cbe203c382
commit
8f2ef810f1
|
|
@ -0,0 +1,61 @@
|
|||
package com.bonus.imgTool.basic.controller;
|
||||
|
||||
import com.bonus.imgTool.annotation.DecryptAndVerify;
|
||||
import com.bonus.imgTool.annotation.LogAnnotation;
|
||||
import com.bonus.imgTool.basic.service.ProService;
|
||||
import com.bonus.imgTool.basic.service.ProcessService;
|
||||
import com.bonus.imgTool.basic.vo.ProcessVo;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProDto;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProcessDto;
|
||||
import com.bonus.imgTool.system.vo.EncryptedReq;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author fly
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/basic/pro/")
|
||||
@Slf4j
|
||||
public class ProController {
|
||||
|
||||
@Resource
|
||||
private ProService service;
|
||||
|
||||
@GetMapping(value = "getProList")
|
||||
@DecryptAndVerify(decryptedClass = ProDto.class)//加解密统一管理
|
||||
@LogAnnotation(operModul = "工程管理", operation = "查询列表", operDesc = "系统级事件",operType="查询")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:pro:query')" )
|
||||
public ServerResponse getProList(EncryptedReq<ProDto> data) {
|
||||
PageHelper.startPage(data.getData().getPage(), data.getData().getLimit());
|
||||
try {
|
||||
List<ProDto> list = service.getProList(data.getData());
|
||||
PageInfo<ProDto> pageInfo = new PageInfo<>(list);
|
||||
return ServerResponse.createSuccessPage(pageInfo,data.getData().getPage(),data.getData().getLimit());
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErrorPage(data.getData().getPage(),data.getData().getLimit());
|
||||
}
|
||||
|
||||
@GetMapping(value = "updateProList")
|
||||
@LogAnnotation(operModul = "工程管理", operation = "更新数据", operDesc = "系统级事件",operType="更新")
|
||||
// @PreAuthorize("@pms.hasPermission('sys:pro:query')" )
|
||||
public ServerResponse updateProList() {
|
||||
try {
|
||||
service.updateProList();
|
||||
return ServerResponse.createSuccess("更新成功");
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return ServerResponse.createErroe("更新数据失败");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.bonus.imgTool.basic.dao;
|
||||
|
||||
import com.bonus.imgTool.basic.vo.ProcessVo;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProDto;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProcessDto;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface ProDao {
|
||||
List<ProDto> getProList(ProDto data);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.bonus.imgTool.basic.service;
|
||||
|
||||
|
||||
import com.bonus.imgTool.basic.vo.ProcessVo;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProDto;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProcessDto;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ProService {
|
||||
|
||||
List<ProDto> getProList(ProDto data);
|
||||
|
||||
void updateProList();
|
||||
}
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
package com.bonus.imgTool.basic.service.impl;
|
||||
|
||||
import com.bonus.imgTool.basic.dao.ProDao;
|
||||
import com.bonus.imgTool.basic.dao.ProcessDao;
|
||||
import com.bonus.imgTool.basic.service.ProService;
|
||||
import com.bonus.imgTool.basic.service.ProcessService;
|
||||
import com.bonus.imgTool.basic.vo.ProcessVo;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProDto;
|
||||
import com.bonus.imgTool.basic.vo.dto.ProcessDto;
|
||||
import com.bonus.imgTool.system.vo.LoginUser;
|
||||
import com.bonus.imgTool.task.job.ProPullTask;
|
||||
import com.bonus.imgTool.utils.ServerResponse;
|
||||
import com.bonus.imgTool.utils.UserUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class ProServiceImpl implements ProService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger("SelectServiceImpl");
|
||||
|
||||
@Resource
|
||||
private ProDao dao;
|
||||
|
||||
@Resource
|
||||
private ProPullTask proPullTask;
|
||||
|
||||
|
||||
@Override
|
||||
public List<ProDto> getProList(ProDto data) {
|
||||
return dao.getProList(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProList() {
|
||||
proPullTask.getAttTempDataTask();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.imgTool.basic.vo.dto;
|
||||
|
||||
import com.bonus.imgTool.base.entity.PageEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -10,7 +11,7 @@ import lombok.Data;
|
|||
* @description:下拉选-dto
|
||||
*/
|
||||
@Data
|
||||
public class ProDto {
|
||||
public class ProDto extends PageEntity {
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
<?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="com.bonus.imgTool.basic.dao.ProDao">
|
||||
|
||||
|
||||
<select id="getProList" resultType="com.bonus.imgTool.basic.vo.dto.ProDto">
|
||||
SELECT
|
||||
id AS proId,
|
||||
`name` AS proName,
|
||||
abbreviation,
|
||||
pro_type,
|
||||
voltage_level,
|
||||
company_name,
|
||||
origin,
|
||||
lon,
|
||||
lat,
|
||||
`status`,
|
||||
update_time,
|
||||
is_active
|
||||
FROM
|
||||
tb_project
|
||||
<where>
|
||||
<if test="companyName != null and companyName != ''">
|
||||
and locate(#{companyName},company_name)
|
||||
</if>
|
||||
<if test="proName != null and proName != ''">
|
||||
and locate(#{proName},`name`)
|
||||
</if>
|
||||
<if test="status != null and status != ''">
|
||||
and locate(#{status},status)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,137 @@
|
|||
let form, layer, dtree, table, tableIns;
|
||||
let pageNum = 1, limitSize = 10; // 默认第一页,分页数量为10
|
||||
let orgData,selectOrgId="";
|
||||
|
||||
layui.config({
|
||||
base: "../../js/layui-v2.6.8/dtree/", //此处路径请自行处理, 可以使用绝对路径
|
||||
}).extend({
|
||||
dtree: 'dtree'
|
||||
}).use(['form', 'layer', 'table','dtree', 'laydate'], function () {
|
||||
form = layui.form;
|
||||
layer = layui.layer;
|
||||
table = layui.table;
|
||||
dtree = layui.dtree;
|
||||
layui.form.render();
|
||||
pages(1, 10, 1);
|
||||
})
|
||||
|
||||
function pages(pageNum, pageSize, typeNum) {
|
||||
let params = getReqParams(pageNum, pageSize, typeNum);
|
||||
let url = dataUrl + "/basic/pro/getProList"
|
||||
ajaxRequest(url, "GET", params, true, function () {
|
||||
}, function (result) {
|
||||
console.log(result);
|
||||
if (result.code === 200) {
|
||||
if (result.data) {
|
||||
initTable(result.data, result.limit, result.curr)
|
||||
laypages(result.count, result.curr, result.limit)
|
||||
}
|
||||
} else if (result.code === 500) {
|
||||
layer.alert(result.msg, {icon: 2})
|
||||
}
|
||||
}, function (xhr) {
|
||||
error(xhr)
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function laypages(total, page, limit) {
|
||||
layui.use(['laypage'], function () {
|
||||
let laypage = layui.laypage;
|
||||
laypage.render({
|
||||
elem: 'voi-page',
|
||||
count: total,
|
||||
curr: page,
|
||||
limit: limit,
|
||||
limits: [10, 20, 50, 100, 200, 500],
|
||||
layout: ['prev', 'page', 'next', 'skip', 'count', 'limit'],
|
||||
groups: 5,
|
||||
jump: function (obj, first) {
|
||||
if (!first) {
|
||||
pageNum = obj.curr, limitSize = obj.limit;
|
||||
pages(obj.curr, obj.limit, null);
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/*初始化表格*/
|
||||
function initTable(dataList, limit, page) {
|
||||
let loadingMsg = layer.msg("数据加载中,请稍候...", {icon: 16, scrollbar: false, time: 0,});
|
||||
tableIns = table.render({
|
||||
elem: "#table_data",
|
||||
height: "full-130",
|
||||
data: dataList,
|
||||
limit: limit,
|
||||
cols: [
|
||||
[
|
||||
//表头
|
||||
{title: "序号", width: 80, unresize: true, align: "center",
|
||||
templet: function (d) {
|
||||
return (page - 1) * limit + d.LAY_INDEX;
|
||||
}
|
||||
},
|
||||
{field: "companyName", title: "分公司/组织", unresize: true, align: "center"},
|
||||
{field: "proName", title: "项目名称", unresize: true, align: "center"},
|
||||
{field: "proType", title: "工程类型", align: "center",templet: 'center'},
|
||||
{field: "voltageLevel", title: "电压等级", align: "center",templet: 'center'},
|
||||
{field: "origin", title: "工程地址", align: "center",templet: 'center'},
|
||||
{field: "status", title: "工程状态", align: "center",templet: 'center'},
|
||||
],
|
||||
],
|
||||
done: function (res, curr, count) {
|
||||
layer.close(loadingMsg);
|
||||
table.resize("table_data");
|
||||
count || this.elem.next(".layui-table-view").find(".layui-table-header").css("display", "inline-block");
|
||||
count || this.elem.next(".layui-table-view").find(".layui-table-box").css("overflow", "auto");
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// 获取参数
|
||||
function getReqParams(page, limit, type) {
|
||||
let obj = {};
|
||||
if (type === 2) {
|
||||
$('#companyName').val('')
|
||||
$('#proName').val('')
|
||||
$('#status').val('')
|
||||
layui.form.render();
|
||||
}
|
||||
obj = {
|
||||
page: page + "",
|
||||
limit: limit + "",
|
||||
companyName: $('#companyName').val(),
|
||||
proName: $('#proName').val(),
|
||||
status: $('#status').val(),
|
||||
};
|
||||
obj={
|
||||
encryptedData:encryptCBC(JSON.stringify(obj))
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
// 查询/重置
|
||||
function query(type) {
|
||||
pageNum = 1;
|
||||
pages(1, limitSize,type);
|
||||
}
|
||||
|
||||
|
||||
// 查询/重置
|
||||
function updatePro() {
|
||||
let url = dataUrl + "/basic/pro/updateProList"
|
||||
ajaxRequest(url, "GET", "", true, function () {
|
||||
}, function (result) {
|
||||
layer.msg(result.data, {
|
||||
time: 1000 // 显示时间,单位为毫秒,默认为3秒,这里设置为2秒
|
||||
}, function(){
|
||||
query(1); // 在消息关闭后执行查询操作
|
||||
});
|
||||
}, function (xhr) {
|
||||
error(xhr)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="../../js/layui-v2.6.8/css/layui.css" media="all">
|
||||
<link rel="stylesheet" href="../../js/layui-v2.6.8/dtree/dtree.css">
|
||||
<link rel="stylesheet" href="../../js/layui-v2.6.8/dtree/font/dtreefont.css">
|
||||
<link rel="stylesheet" href="../../css/table-common2.css">
|
||||
<script src="../../js/libs/jquery-3.7.0.min.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../js/layui-v2.6.8/layui.js" charset="UTF-8" type="text/javascript"></script>
|
||||
<script src="../../js/publicJs.js"></script>
|
||||
<script src="../../js/commonUtils.js"></script>
|
||||
<script src="../../js/openIframe.js"></script>
|
||||
<script src="../../js/my/aes.js"></script>
|
||||
<script src="../../js/ajaxRequest.js"></script>
|
||||
<title>工序管理</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content">
|
||||
<div class="basic-search-box layout">
|
||||
<form class="layui-form basic-form" onsubmit="return false;">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline" style="padding: 0 0 0 10px;">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="companyName" maxlength="30" class="layui-input" autocomplete="off" placeholder="分公司">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline" style="padding: 0 0 0 10px;">
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" id="proName" maxlength="30" class="layui-input" autocomplete="off" placeholder="工程">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline" style="padding: 0 0 0 10px;">
|
||||
<div class="layui-input-inline">
|
||||
<select id="status" name="status" class="form-control input-sm">
|
||||
<option value=""> 工程状态</option>
|
||||
<option value="在建"> 在建</option>
|
||||
<option value="完工"> 完工</option>
|
||||
<option value="筹建"> 筹建</option>
|
||||
<option value="停工"> 停工</option>
|
||||
<option value="收尾"> 收尾</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-inline btns">
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm btn-1" onclick="query(1)">查询
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm btn-1" onclick="query(2)">重置
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm btn-1" onclick="exprot()">导出
|
||||
</button>
|
||||
<button type="button" class="layui-btn layui-btn-normal layui-btn-sm btn-1" style="width: 100px" onclick="updatePro()">更新数据
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="table-box" table-responsive style="z-index: 1;">
|
||||
<table id="table_data" class="table" lay-filter="table_data"></table>
|
||||
<div id="voi-page" class="layout"></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<style>
|
||||
.layui-table-init {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script src="../../js/pro/pro.js" charset="UTF-8" type="text/javascript"></script>
|
||||
</html>
|
||||
Loading…
Reference in New Issue