Merge remote-tracking branch 'origin/dev_2307' into dev

master
zhc077 1 year ago
commit ccf9f5f3c6
  1. 31
      ant-design-vue-jeecg/src/mixins/JeecgListMixin.js
  2. 3
      ant-design-vue-jeecg/src/views/functionx/FunctionxList.vue
  3. 74
      ant-design-vue-jeecg/src/views/modulex/ModulexList.vue
  4. 20
      ant-design-vue-jeecg/src/views/requirementitem/RequirementItemList.vue
  5. 79
      ant-design-vue-jeecg/src/views/requirementitem/modules/RequirementItemForm.vue
  6. 171
      ant-design-vue-jeecg/src/views/tablex/TablexList.vue
  7. 2
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/functiontemplate/controller/FunctionTemplateController.java
  8. 146
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/requirementitem/controller/RequirementItemController.java

@ -108,6 +108,34 @@ export const JeecgListMixin = {
this.loading = false;
})
},
loadDatawdxq(arg) {
if (!this.url.wdxqlist) {
this.$message.error("请设置url.list属性!")
return
}
//加载数据 若传入参数1则加载第一页的内容
if (arg === 1) {
this.ipagination.current = 1;
}
var params = this.getQueryParams();//查询条件
this.loading = true;
getAction(this.url.wdxqlist, params).then((res) => {
if (res.success) {
//update-begin---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
this.dataSource = res.result.records || res.result;
if (res.result.total) {
this.ipagination.total = res.result.total;
} else {
this.ipagination.total = 0;
}
//update-end---author:zhangyafei Date:20201118 for:适配不分页的数据列表------------
}
if (res.code === 510) {
this.$message.warning(res.message)
}
this.loading = false;
})
},
initDictConfig() {
console.log("--这是一个假的方法!")
},
@ -156,6 +184,9 @@ export const JeecgListMixin = {
searchQuery() {
this.loadData(1);
},
searchQuerywdxq() {
this.loadDatawdxq(1);
},
superQuery() {
this.$refs.superQueryModal.show();
},

@ -40,7 +40,7 @@
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus" v-if="role==1">新增</a-button>
<!--待开发功能模块提供思路给你们将模板list全部展示之后传出一个id对应加入-->
<a-button @click="muban" type="primary" icon="plus" v-if="role==1">模板</a-button>
<a-button @click="muban" type="primary" icon="plus" v-if="role==1">模板新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('功能管理')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel" v-if="role==1">
@ -282,6 +282,7 @@
title: '规则管理',
align:"center",
dataIndex: 'action1',
fixed:"right",
width:147,
scopedSlots: { customRender: 'action1' }
},

@ -6,10 +6,43 @@
<a-row :gutter="24">
<a-col :md="6" :sm="12">
<a-form-item label="角色名称">
<a-form-item label="模块中文名称">
<j-input v-model="queryParam.moduleName"></j-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-item label="模块英文名称">
<j-input v-model="queryParam.moduleEnName"></j-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-item label="模块编码">
<j-input v-model="queryParam.moduleCode"></j-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="项目名称">
<j-dict-select-tag type="list" v-model="queryParam.projectId" dict-code="projectx,project_name,id" placeholder="请选择" />
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="上级模块">
<j-dict-select-tag type="list" v-model="queryParam.pid" dict-code="modulex,module_name,id" placeholder="请选择" />
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="6" :sm="12">
<a-form-item label="模块状态">
<j-dict-select-tag type="list" v-model="queryParam.status" placeholder="请选择模块状态" dict-code="a_status"/>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="责任人">
<j-select-user-by-dep placeholder="请选择责任人" v-model="queryParam.managerUsers"/>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
@ -57,6 +90,8 @@
<a-divider type="vertical"/>
<a @click="tablexManage(record)">实体</a>
<a-divider type="vertical"/>
<a @click="viewVid(record)">字段</a>
</span>
@ -119,7 +154,8 @@
<modulex-modal ref="modalForm" @ok="modalFormOk"></modulex-modal>
<bugx-modal ref="BugxModal"></bugx-modal>
<TablexList ref="TablexList"></TablexList>
<FieldxList ref="FieldxList"></FieldxList>
</a-card>
</template>
@ -134,11 +170,15 @@ import {getAction} from "@api/manage";
import BugxModal from "@views/modulex/modules/BugxModal";
import store from "@/store";
import {filterObj} from "@/utils/util";
import FieldxList from "@views/fieldx/FieldxList.vue";
import TablexList from "@views/tablex/TablexList.vue";
export default {
name: 'ModulexList',
mixins: [JeecgListMixin, mixinDevice],
components: {
TablexList,
FieldxList,
BugxModal,
ModulexModal
},
@ -357,6 +397,22 @@ export default {
}
})
},
viewVid(record) {
// console.log(record)
let s = null;
getAction('/tablex/tablex/list', {moduleId: record.id}).then((res) =>{
s=res.result.records
console.log(s)
if (s[0]==null){
this.$message.error("该模块无实体");
}else{
this.$refs.FieldxList.showModal();
this.$refs.FieldxList.edit(s[0]);
this.$refs.FieldxList.disableSubmit = false;
}
})
},
bugfankui: function (record) {
this.$refs.BugxModal.add(record.id);
this.$refs.BugxModal.title = "BUG反馈";
@ -415,10 +471,13 @@ export default {
})
},
tablexManage(record) {
this.$router.push({
path: '/src/views/tablex/TablexList',
query: {moduleid: record.id,project:this.$route.query.project}
})
this.$refs.TablexList.showModal();
this.$refs.TablexList.edit(record);
this.$refs.TablexList.disableSubmit = false;
// this.$router.push({
// path: '/src/views/tablex/TablexList',
// query: {moduleid: record.id,project:this.$route.query.project}
// })
},
initDictConfig() {
},
@ -496,7 +555,8 @@ export default {
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
//param.id=this.id;
param.projectId = this.$route.query.project;
//!!!!!!!
// param.projectId = this.$route.query.project;
// console.log('paaaaaaaaaaaaaaaaaaaaa')
return filterObj(param);
},

@ -41,7 +41,6 @@
</span>
</a-col>
</a-row>
<a-input v-model="queryParam.createBy"></a-input>
</a-form>
</div>
<!-- 查询区域-END -->
@ -100,12 +99,12 @@
</template>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a @click="checkqx(record)">编辑</a>
<a-divider type="vertical" />
<a @click="handleDetail(record)">详情</a>
<a-divider type="vertical" />
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a-popconfirm title="确定删除吗?" @confirm="() => handleDeleteQx(record)">
<a>删除</a>
</a-popconfirm>
<a-divider type="vertical" />
@ -229,6 +228,7 @@
importExcelUrl: "requirementitem/requirementItem/importExcel",
qrxq:"/requirementitem/requirementItem/qrxq",
checkqx:"/requirementtype/requirementType/checkqx",
wdxqlist:"/requirementitem/requirementItem/wdxqlist",
},
dictOptions:{},
@ -244,9 +244,19 @@
},
},
methods: {
checkqx(record){
getAction(this.url.checkqx,{createBy:record.createBy}).then((res)=>{
if (res.success) {
this.$refs.modalForm.edit(record);
this.$refs.modalForm.title = "编辑";
this.$refs.modalForm.disableSubmit = false;
}else{
this.$message.warning(res.message);
}
});
},
wdxq(){
this.queryParam.createBy = 'admin';
this.searchQuery();
this.searchQuerywdxq();
},
qrxq(id){
getAction(this.url.qrxq,{id:id}).then((res)=>{

@ -5,7 +5,7 @@
<a-row>
<a-col :span="24">
<a-form-model-item label="项目" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="projectId">
<j-dict-select-tag type="list" v-model="model.projectId" dictCode="projectx,project_name,id" placeholder="请选择项目" :disabled="disablecol"/>
<j-dict-select-tag type="list" v-model="model.projectId" dictCode="projectx,project_name,id" placeholder="请选择项目" :disabled="disablecol" @change="getxqbm"/>
</a-form-model-item>
</a-col>
<a-col :span="24">
@ -15,12 +15,12 @@
</a-col>
<a-col :span="24" v-if="num===0">
<a-form-model-item label="上级需求" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="upperId">
<j-dict-select-tag type="list" v-model="model.upperId" dictCode="requirement_item,requirement_name,id" placeholder="请选择上级需求" :disabled="disablecol"/>
<j-dict-select-tag type="list" v-model="model.upperId" dictCode="requirement_item,requirement_name,id" placeholder="请选择上级需求" :disabled="disablecol" @change="getxqbm"/>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="需求编码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="requirementCode">
<a-input v-model="model.requirementCode" placeholder="请输入需求编码" ></a-input>
<a-input v-model="model.requirementCode" placeholder="请输入需求编码" disabled></a-input>
</a-form-model-item>
</a-col>
<a-col :span="24">
@ -103,7 +103,7 @@
],*/
requirementCode: [
{ required: true, message: '请输入需求编码!'},
{ validator: (rule, value, callback) => validateDuplicateValue('requirement_item', 'requirement_code', value, this.model.id, callback)},
/* { validator: (rule, value, callback) => validateDuplicateValue('requirement_item', 'requirement_code', value, this.model.id, callback)},*/
],
requirementName: [
{ required: true, message: '请输入中文名称!'},
@ -112,7 +112,9 @@
url: {
add: "/requirementitem/requirementItem/add",
edit: "/requirementitem/requirementItem/edit",
queryById: "/requirementitem/requirementItem/queryById"
queryById: "/requirementitem/requirementItem/queryById",
checkname:"/requirementitem/requirementItem/checkname",
requirementcode:"/requirementitem/requirementItem/requirementcode",
}
}
},
@ -125,6 +127,23 @@
//model
},
methods: {
getxqbm(){
if(this.model.upperId===undefined||this.model.upperId===null){
this.model.upperId = "";
}
if(this.model.projectId===undefined||this.model.projectId===null){
this.model.projectId = "";
}
if(this.model.projectId!==""){
getAction(this.url.requirementcode,{projectId:this.model.projectId,upperId:this.model.upperId}).then((res)=>{
if (res.success) {
this.$set(this.model, 'requirementCode', res.result);
}else{
this.$message.warning(res.message);
}
});
}
},
add (num,record) {
this.num = num;
this.model = Object.assign({}, record);
@ -133,8 +152,10 @@
if(record===''){
this.disablecol = false;
}else{
this.getxqbm();
this.disablecol = true;
}
this.model.id = "";
this.modelDefault = JSON.parse(JSON.stringify(this.model));
this.edit(this.modelDefault);
},
@ -155,30 +176,42 @@
this.visible = true;
},
submitForm () {
if(this.model.id === undefined){
this.model.id = "";
}
if(this.model.upperId === undefined){
this.model.upperId = "";
}
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
getAction(this.url.checkname,{projectid:this.model.projectId,requirementName:this.model.requirementName,id:this.model.id,upperId:this.model.upperId}).then((res)=>{
if (res.success) {
that.confirmLoading = true;
let httpurl = '';
let method = '';
if(!this.model.id){
httpurl+=this.url.add;
method = 'post';
}else{
httpurl+=this.url.edit;
method = 'put';
}
httpAction(httpurl,this.model,method).then((res)=>{
if(res.success){
that.$message.success(res.message);
that.$emit('ok');
}else{
that.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
}else{
that.$message.warning(res.message);
this.$message.warning(res.message);
}
}).finally(() => {
that.confirmLoading = false;
})
});
}
})

@ -1,59 +1,66 @@
<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<a-modal
width="96%"
title="实体管理"
:visible="visible"
:confirm-loading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
:bordered="false">
<!-- &lt;!&ndash; 查询区域 &ndash;&gt;-->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="中文名称">
<a-input placeholder="中文名称" v-model="queryParam.tableName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="英文名称">
<a-input placeholder="英文名称" v-model="queryParam.tableEnName"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="实体状态">
<j-dict-select-tag type="list" v-model="queryParam.status" dictCode="a_status" placeholder="请选择实体状态" />
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- <a-form layout="inline" @keyup.enter.native="searchQuery">-->
<!-- <a-row :gutter="24">-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <a-form-item label="中文名称">-->
<!-- <a-input placeholder="中文名称" v-model="queryParam.tableName"></a-input>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <a-form-item label="英文名称">-->
<!-- <a-input placeholder="英文名称" v-model="queryParam.tableEnName"></a-input>-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <a-form-item label="实体状态">-->
<!-- <j-dict-select-tag type="list" v-model="queryParam.status" dictCode="a_status" placeholder="请选择实体状态" />-->
<!-- </a-form-item>-->
<!-- </a-col>-->
<!-- <a-col :xl="6" :lg="7" :md="8" :sm="24">-->
<!-- <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">-->
<!-- <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>-->
<!-- <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>-->
<!-- </span>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!-- </a-form>-->
<!-- </div>-->
<!-- &lt;!&ndash; 查询区域-END &ndash;&gt;-->
<!-- 操作按钮区域 -->
<div class="table-operator">
<a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-button type="primary" icon="download" @click="handleExportXls('实体表')">导出</a-button>
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
<a-button type="primary" icon="import">导入</a-button>
</a-upload>
<!-- 高级查询区域 -->
<!-- <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
<a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay">
<a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu>
<a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>
</a-dropdown>
<a-button @click="fanhui" type="primary" icon="rollback">返回</a-button>
</div>
<!-- &lt;!&ndash; 操作按钮区域 &ndash;&gt;-->
<!-- <div class="table-operator">-->
<!-- <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>-->
<!-- <a-button type="primary" icon="download" @click="handleExportXls('实体表')">导出</a-button>-->
<!-- <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
<!-- <a-button type="primary" icon="import">导入</a-button>-->
<!-- </a-upload>-->
<!-- &lt;!&ndash; 高级查询区域 &ndash;&gt;-->
<!--&lt;!&ndash; <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>&ndash;&gt;-->
<!-- <a-dropdown v-if="selectedRowKeys.length > 0">-->
<!-- <a-menu slot="overlay">-->
<!-- <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
<!-- </a-menu>-->
<!-- <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
<!-- </a-dropdown>-->
<!-- <a-button @click="fanhui" type="primary" icon="rollback">返回</a-button>-->
<!-- </div>-->
<!-- table区域-begin -->
<div>
<div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
<i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>
<a style="margin-left: 24px" @click="onClearSelected">清空</a>
</div>
<!-- &lt;!&ndash; table区域-begin &ndash;&gt;-->
<!-- <div>-->
<!-- <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
<!-- <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>-->
<!-- <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
<!-- </div>-->
<a-table
ref="table"
@ -89,9 +96,9 @@
</a-button>
</template>
<template slot="htmlSlot" slot-scope="text,record">
<a @click="viewVid(record)">字段</a>
</template>
<!-- <template slot="htmlSlot" slot-scope="text,record">-->
<!-- <a @click="viewVid(record)">字段</a>-->
<!-- </template>-->
<span slot="action" slot-scope="text, record">
@ -110,7 +117,7 @@
<tablex-modal ref="modalForm" @ok="modalFormOk"></tablex-modal>
<FieldxList ref="FieldxList"></FieldxList>
</a-card>
</a-modal>
</template>
<script>
@ -136,9 +143,12 @@
data () {
let ellipsis = (v, l = 20) => (<j-ellipsis value={v} length={l}/>)
return {
loadRouteType:false,
// loadRouteType:false,
description: '实体表管理页面',
moduleid:'',
//
visible: false,
confirmLoading: false,
columns: [
{
title: '#',
@ -212,14 +222,14 @@
align:"center",
dataIndex: 'verison'
},
{
title: '管理',
dataIndex: 'htmlSlot',
align: "center",
fixed: "right",
width: 147,
scopedSlots: {customRender: 'htmlSlot'}
},
// {
// title: '',
// dataIndex: 'htmlSlot',
// align: "center",
// fixed: "right",
// width: 147,
// scopedSlots: {customRender: 'htmlSlot'}
// },
{
title: '操作',
dataIndex: 'action',
@ -261,6 +271,26 @@
}/*在引号中填写返回vue*/
});
},
edit(record) {
this.model = Object.assign({}, record);
console.log(this.model)
//console.log(topicid);
this.queryParam.moduleId = this.model.id;
this.tableid = this.model.id
this.tableName=this.model.tableName;
console.log(this.queryParam.moduleId);
this.loadData();
},
showModal() {
this.visible = true;
},
handleOk(e) {
this.visible = false;
},
handleCancel(e) {
console.log('Clicked cancel button');
this.visible = false;
},
viewVid(record) {
this.$refs.FieldxList.showModal();
this.$refs.FieldxList.edit(record);
@ -294,16 +324,17 @@
}
},
loadData(arg) {
if (!this.url.list) {
this.$message.error("请设置url.list属性!");
return
}
// if (!this.url.list) {
// this.$message.error("url.list!");
// return
// }
// 1
if (arg === 1) {
this.ipagination.current = 1;
}
this.loadParameter();
var params = this.getQueryParams();//
console.log(params)
this.loading = true;
getAction(this.url.list, params).then((res) => {
if (res.success) {
@ -334,7 +365,7 @@
param.pageNo = this.ipagination.current;
param.pageSize = this.ipagination.pageSize;
//param.id=this.id;
param.moduleId = this.$route.query.moduleid;
// param.moduleId = this.$route.query.moduleid;
return filterObj(param);
},
searchReset() {

@ -60,7 +60,7 @@ public class FunctionTemplateController extends JeecgController<FunctionTemplate
HttpServletRequest req) {
// QueryWrapper<FunctionTemplate> queryWrapper = QueryGenerator.initQueryWrapper(functionTemplate, req.getParameterMap());
QueryWrapper<FunctionTemplate> queryWrapper=new QueryWrapper<>();
queryWrapper.eq("modulextype_id",functionTemplate.getModulextypeId());
// queryWrapper.eq("modulextype_id",functionTemplate.getModulextypeId());
if(functionTemplate.getFunctionTemplateName()!=null){
queryWrapper.like("function_template_name",functionTemplate.getFunctionTemplateName());
}

@ -1,8 +1,7 @@
package org.jeecg.modules.demo.requirementitem.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
@ -32,6 +31,8 @@ import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -93,6 +94,43 @@ public class RequirementItemController extends JeecgController<RequirementItem,
return Result.OK(pageList);
}
/**
* 我的需求
*
* @param requirementItem
* @param pageNo
* @param pageSize
* @param req
* @return
*/
@AutoLog(value = "需求管理-分页列表查询")
@ApiOperation(value="需求管理-分页列表查询", notes="需求管理-分页列表查询")
@GetMapping(value = "/wdxqlist")
public Result<?> wdxqlist(RequirementItem requirementItem,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
LoginUser principal = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<RequirementItem> queryWrapper = QueryGenerator.initQueryWrapper(requirementItem, req.getParameterMap());
queryWrapper.eq("create_by",principal.getUsername());
Page<RequirementItem> page = new Page<RequirementItem>(pageNo, pageSize);
IPage<RequirementItem> pageList = requirementItemService.page(page, queryWrapper);
for (int i = 0 ; i < pageList.getRecords().size();i++){
Projectx projectx = projectxService.getById(pageList.getRecords().get(i).getProjectId());
if(!principal.getUsername().equals("admin")){
if(projectx.getCreateBy().equals(principal.getUsername())){
pageList.getRecords().get(i).setXqflag("1");
}else{
pageList.getRecords().get(i).setXqflag("0");
}
}else{
pageList.getRecords().get(i).setXqflag("1");
}
}
return Result.OK(pageList);
}
/**
* 添加
*
@ -103,6 +141,10 @@ public class RequirementItemController extends JeecgController<RequirementItem,
@ApiOperation(value="需求管理-添加", notes="需求管理-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody RequirementItem requirementItem) {
if(requirementItem.getUpperId()!=""){
RequirementItem requirementItem1 = requirementItemService.getById(requirementItem.getUpperId());
requirementItem.setRequirementHira((Integer.valueOf(requirementItem1.getRequirementHira())+1)+"");
}
requirementItemService.save(requirementItem);
return Result.OK("添加成功!");
}
@ -208,4 +250,102 @@ public class RequirementItemController extends JeecgController<RequirementItem,
return super.importExcel(request, response, RequirementItem.class);
}
/**
* 需求名称重复校验
*
* @param projectid,typename
* @return
*/
@AutoLog(value = "需求名称重复校验")
@ApiOperation(value="需求名称重复校验", notes="需求名称重复校验")
@GetMapping(value = "/checkname")
public Result<?> checkname(@RequestParam(name="projectid",required=true) String projectid,@RequestParam(name="requirementName",required=true) String requirementName,
@RequestParam(name="id",required=true) String id,@RequestParam(name="upperId",required=true) String upperId,HttpServletRequest req) {
if(id==""){
RequirementItem requirementItem = new RequirementItem();
QueryWrapper<RequirementItem> queryWrapper = QueryGenerator.initQueryWrapper(requirementItem, req.getParameterMap());
queryWrapper.eq("project_id",projectid);
queryWrapper.eq("requirement_name",requirementName);
queryWrapper.eq("upper_id",upperId);
List<RequirementItem> list = requirementItemService.list(queryWrapper);
if(list.size()>0) {
return Result.error("需求名称重复");
}
}else {
RequirementItem requirementItemcheck = requirementItemService.getById(id);
if(!requirementItemcheck.getRequirementName().equals(requirementName)){
RequirementItem requirementItem = new RequirementItem();
QueryWrapper<RequirementItem> queryWrapper = QueryGenerator.initQueryWrapper(requirementItem, req.getParameterMap());
queryWrapper.eq("project_id",projectid);
queryWrapper.eq("requirement_name",requirementName);
queryWrapper.eq("upper_id",upperId);
List<RequirementItem> list = requirementItemService.list(queryWrapper);
if(list.size()>0) {
return Result.error("需求名称重复");
}
}
}
return Result.OK("");
}
/**
* 需求编码
*
* @param projectId,upperId
* @return
*/
@AutoLog(value = "需求编码")
@ApiOperation(value="需求编码", notes="需求编码")
@GetMapping(value = "/requirementcode")
public Result<?> requirementcode(@RequestParam(name="projectId",required=true) String projectId,@RequestParam(name="upperId",required=true) String upperId,HttpServletRequest req) {
String requirementcode = "";
Projectx projectx = projectxService.getById(projectId);
if(upperId!=""){
RequirementItem requirementItem=requirementItemService.getById(upperId);
QueryWrapper<RequirementItem> queryWrapper = QueryGenerator.initQueryWrapper(requirementItem, req.getParameterMap());
queryWrapper.eq("requirement_hira",(Integer.valueOf(requirementItem.getRequirementHira())+1)+"");
List<RequirementItem> list = requirementItemService.list(queryWrapper);
List<String> collect = list.stream().map(RequirementItem::getRequirementCode).collect(Collectors.toList());
String OrdersNum = String.format("%04d", getListMax(collect, 4));
requirementcode = projectx.getProjectCode()+requirementItem.getRequirementCode()+OrdersNum;
}else{
RequirementItem requirementItem = new RequirementItem();
QueryWrapper<RequirementItem> queryWrapper = QueryGenerator.initQueryWrapper(requirementItem, req.getParameterMap());
queryWrapper.eq("requirement_hira",0);
List<RequirementItem> list = requirementItemService.list(queryWrapper);
List<String> collect = list.stream().map(RequirementItem::getRequirementCode).collect(Collectors.toList());
String OrdersNum = String.format("%04d", getListMax(collect, 4));
requirementcode = projectx.getProjectCode()+OrdersNum;
}
return Result.OK(requirementcode);
}
public Long getListMax(List<String> stringList, int digits) {
if (ObjectUtils.isEmpty(stringList)){
return 1L;
}
List<Long> longList = new ArrayList<>();
String REGEX = "[^0-9]";
for (String nums : stringList) {
//只要数字.trim()去空格
String newNums = Pattern.compile(REGEX).matcher(nums).replaceAll("").trim();
if (StringUtils.isEmpty(newNums)) continue;
if (newNums.length() <= digits) longList.add(Long.valueOf(newNums));
else {
//拿到后6位 substring(4) 截掉前4位
String substring = newNums.substring(newNums.length() - digits);
longList.add(Long.valueOf(substring));
}
}
long max = Collections.max(longList) + 1;
if (Long.toString(max).length() > digits) {
String toString = Long.toString(max);
String substring = toString.substring(toString.length() - digits);
return Long.valueOf(substring);
}
return max;
}
}

Loading…
Cancel
Save