提交代码

main
姜玉琦 2024-02-25 20:04:28 +08:00
parent 7eec6ad41a
commit b17dbd03aa
13 changed files with 330 additions and 28 deletions

View File

@ -89,6 +89,11 @@ public class Constants
*/
public static final Integer CAPTCHA_EXPIRATION = 2;
/**
*
*/
public static final Integer BASE_DATA_EXPIRATION = 30;
/**
*
*/

View File

@ -61,11 +61,16 @@ public class UserDetailsServiceImpl implements UserDetailsService
}
//设置项目单位信息
Long deptId = Convert.toLong(user.getDept().getAncestors().split(",")[2]);
if(deptId != null){
SysDept sysDept = sysDeptService.selectDeptById(deptId);
user.setParDeptId(sysDept.getDeptId());
user.setParDeptName(sysDept.getDeptName());
if(!user.isAdmin()){
Long deptId = Convert.toLong(user.getDept().getAncestors().split(",")[2]);
if(deptId != null){
SysDept sysDept = sysDeptService.selectDeptById(deptId);
user.setParDeptId(sysDept.getDeptId());
user.setParDeptName(sysDept.getDeptName());
}
}else{
user.setParDeptId(100L);
user.setParDeptName("研筑临时项目管理");
}
passwordService.validate(user);
return createLoginUser(user);

View File

@ -1,7 +1,13 @@
package com.yanzhu.base.controller;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletResponse;
import com.yanzhu.common.constant.Constants;
import com.yanzhu.common.core.domain.entity.SysUser;
import com.yanzhu.common.core.redis.RedisCache;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -34,6 +40,9 @@ public class BaseAssetsTypeController extends BaseController
@Autowired
private IBaseAssetsTypeService baseAssetsTypeService;
@Autowired
private RedisCache redisCache;
/**
*
*/
@ -101,4 +110,23 @@ public class BaseAssetsTypeController extends BaseController
{
return toAjax(baseAssetsTypeService.deleteBaseAssetsTypeByIds(ids));
}
/**
*
*/
@DeleteMapping("/findAllByCategory/{category}")
public AjaxResult findAllByCategory(@PathVariable String category)
{
SysUser sysUser = super.getLoginUser().getUser();
String key = "YANZHU.BASE.ASSETSTYPE.findAllByCategory." + sysUser.getParDeptId() + "." + category;
Object object = redisCache.getCacheObject(key);
if (object != null) {
return success(object);
}
List<BaseAssetsType> list = baseAssetsTypeService.findAllByCategory(category);
redisCache.setCacheObject(key, list, Constants.BASE_DATA_EXPIRATION, TimeUnit.MINUTES);
return success(list);
}
}

View File

@ -2,6 +2,10 @@ package com.yanzhu.project.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.yanzhu.common.core.domain.entity.SysUser;
import com.yanzhu.common.core.text.Convert;
import com.yanzhu.project.domain.ProProjectInfo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -101,4 +105,5 @@ public class ProProjectApplyController extends BaseController
{
return toAjax(proProjectApplyService.deleteProProjectApplyByIds(ids));
}
}

View File

@ -5,6 +5,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
import com.yanzhu.common.annotation.Excel;
import com.yanzhu.common.core.domain.BaseEntity;
import java.util.List;
/**
* base_assets_type
*
@ -42,6 +44,12 @@ public class BaseAssetsType extends BaseEntity
@Excel(name = "是否删除")
private String isDel;
/** 默认单位数据 */
private Long defaultDeptId;
/** 子类型列表 */
private List<BaseAssetsType> childrenAssetsTypeList;
public void setId(Long id)
{
this.id = id;
@ -106,6 +114,22 @@ public class BaseAssetsType extends BaseEntity
return isDel;
}
public List<BaseAssetsType> getChildrenAssetsTypeList() {
return childrenAssetsTypeList;
}
public void setChildrenAssetsTypeList(List<BaseAssetsType> childrenAssetsTypeList) {
this.childrenAssetsTypeList = childrenAssetsTypeList;
}
public Long getDefaultDeptId() {
return defaultDeptId;
}
public void setDefaultDeptId(Long defaultDeptId) {
this.defaultDeptId = defaultDeptId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

View File

@ -11,6 +11,7 @@ import com.yanzhu.base.domain.BaseAssetsType;
*/
public interface IBaseAssetsTypeService
{
/**
*
*
@ -58,4 +59,12 @@ public interface IBaseAssetsTypeService
* @return
*/
public int deleteBaseAssetsTypeById(Long id);
/**
*
*
* @param category
* @return
*/
public List<BaseAssetsType> findAllByCategory(String category);
}

View File

@ -1,13 +1,23 @@
package com.yanzhu.base.service.impl;
import java.util.Collection;
import java.util.List;
import com.yanzhu.common.core.domain.entity.SysDictData;
import com.yanzhu.common.core.domain.entity.SysUser;
import com.yanzhu.common.core.redis.RedisCache;
import com.yanzhu.common.utils.DateUtils;
import com.yanzhu.common.utils.SecurityUtils;
import com.yanzhu.system.mapper.SysDictDataMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanzhu.base.mapper.BaseAssetsTypeMapper;
import com.yanzhu.base.domain.BaseAssetsType;
import com.yanzhu.base.service.IBaseAssetsTypeService;
import javax.annotation.PostConstruct;
/**
* Service
*
@ -20,6 +30,18 @@ public class BaseAssetsTypeServiceImpl implements IBaseAssetsTypeService
@Autowired
private BaseAssetsTypeMapper baseAssetsTypeMapper;
@Autowired
private RedisCache redisCache;
/**
*
*/
private void loadingCache()
{
Collection<String> collection = redisCache.keys("YANZHU.BASE.ASSETSTYPE.findAllByCategory.*");
redisCache.deleteObject(collection);
}
/**
*
*
@ -54,7 +76,11 @@ public class BaseAssetsTypeServiceImpl implements IBaseAssetsTypeService
public int insertBaseAssetsType(BaseAssetsType baseAssetsType)
{
baseAssetsType.setCreateTime(DateUtils.getNowDate());
return baseAssetsTypeMapper.insertBaseAssetsType(baseAssetsType);
int res = baseAssetsTypeMapper.insertBaseAssetsType(baseAssetsType);
if(res>0){
this.loadingCache();
}
return res;
}
/**
@ -67,7 +93,11 @@ public class BaseAssetsTypeServiceImpl implements IBaseAssetsTypeService
public int updateBaseAssetsType(BaseAssetsType baseAssetsType)
{
baseAssetsType.setUpdateTime(DateUtils.getNowDate());
return baseAssetsTypeMapper.updateBaseAssetsType(baseAssetsType);
int res = baseAssetsTypeMapper.updateBaseAssetsType(baseAssetsType);
if(res>0){
this.loadingCache();
}
return res;
}
/**
@ -79,7 +109,11 @@ public class BaseAssetsTypeServiceImpl implements IBaseAssetsTypeService
@Override
public int deleteBaseAssetsTypeByIds(Long[] ids)
{
return baseAssetsTypeMapper.deleteBaseAssetsTypeByIds(ids);
int res = baseAssetsTypeMapper.deleteBaseAssetsTypeByIds(ids);
if(res>0){
this.loadingCache();
}
return res;
}
/**
@ -91,6 +125,35 @@ public class BaseAssetsTypeServiceImpl implements IBaseAssetsTypeService
@Override
public int deleteBaseAssetsTypeById(Long id)
{
return baseAssetsTypeMapper.deleteBaseAssetsTypeById(id);
int res = baseAssetsTypeMapper.deleteBaseAssetsTypeById(id);
if(res>0){
this.loadingCache();
}
return res;
}
/**
*
*
* @param category
* @return
*/
public List<BaseAssetsType> findAllByCategory(String category){
//boolean isAdmin = SysUser.isAdmin(SecurityUtils.getUserId());
BaseAssetsType baseAssetsType = new BaseAssetsType();
baseAssetsType.setParentId(0L);
baseAssetsType.setType(category);
List<BaseAssetsType> list = baseAssetsTypeMapper.selectBaseAssetsTypeList(baseAssetsType);
if(CollectionUtils.isNotEmpty(list)){
for(BaseAssetsType entity:list){
baseAssetsType.setParentId(entity.getId());
baseAssetsType.setDefaultDeptId(SecurityUtils.getLoginUser().getUser().getParDeptId());
List<BaseAssetsType> dataList = baseAssetsTypeMapper.selectBaseAssetsTypeList(baseAssetsType);
if(CollectionUtils.isNotEmpty(list)){
entity.setChildrenAssetsTypeList(dataList);
}
}
}
return list;
}
}

View File

@ -26,12 +26,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBaseAssetsTypeList" parameterType="BaseAssetsType" resultMap="BaseAssetsTypeResult">
<include refid="selectBaseAssetsTypeVo"/>
<where>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="parentId != null ">
<if test="parentId == 0 ">
and parent_id is null
</if>
<if test="parentId < 0 ">
and parent_id is null
</if>
<if test="parentId > 0 ">
and parent_id = #{parentId}
</if>
</if>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="unit != null and unit != ''"> and unit = #{unit}</if>
<if test="isDel != null and isDel != ''"> and is_del = #{isDel}</if>
<if test="defaultDeptId != null"> and (dept_id is null or dept_id = #{defaultDeptId})</if>
</where>
</select>

View File

@ -273,7 +273,7 @@ export default {
try {
self.bpmnViewer = new BpmnViewer({
container: this.$refs.flowCanvas,
height: "90px",
height: "100px",
});
await self.bpmnViewer.importXML(data.xmlData);
//
@ -492,7 +492,7 @@ export default {
}
.maskLayer {
width: 100%;
height: 90px;
height: 100px;
position: absolute;
z-index: 9999;
top: 77px;

View File

@ -162,7 +162,7 @@
try {
self.bpmnViewer = new BpmnViewer({
container: this.$refs.flowCanvas,
height: "150px",
height: "100px",
});
await self.bpmnViewer.importXML(data.xmlData);
//
@ -304,7 +304,7 @@
}
.maskLayer {
width: 100%;
height: 150px;
height: 100px;
position: absolute;
z-index: 9999;
top: 66px;

View File

@ -291,7 +291,6 @@
<el-table-column
label="操作"
align="center"
width="300"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">

View File

@ -16,8 +16,8 @@
:model="form"
:rules="rules"
v-loading="loading"
label-width="120px"
style="padding-right: 35px"
label-width="100px"
style="padding-left: 25px; padding-right: 25px"
>
<div class="mycanvas">
<div class="canvas" ref="flowCanvas"></div>
@ -65,7 +65,111 @@
:fileType="['pdf', 'png', 'jpg', 'jpeg', 'doc', 'docx', 'xls', 'xlsx']"
/>
</el-form-item>
<div style="text-align: center">
<el-divider content-position="left" style="margin-left"
>项目申请明细信息</el-divider
>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
icon="el-icon-plus"
size="mini"
@click="handleAddProProjectApplyDetail"
>添加</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
icon="el-icon-delete"
size="mini"
@click="handleDeleteProProjectApplyDetail"
>删除</el-button
>
</el-col>
</el-row>
<el-table
:data="proProjectApplyDetailList"
:row-class-name="rowProProjectApplyDetailIndex"
@selection-change="handleProProjectApplyDetailSelectionChange"
ref="proProjectApplyDetail"
>
<el-table-column type="selection" width="50" align="center" />
<el-table-column label="序号" align="center" prop="index" width="50" />
<el-table-column label="申请明细" align="center" prop="assetsId">
<template slot-scope="scope">
<el-select
v-model="form.projId"
placeholder="请选择项目名称"
style="width: 100%"
filterable
@change="projectChage"
>
<el-option
v-for="(item, index) in projectOptions"
:key="index"
:label="item.projName"
:value="item.id"
>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column label="申请数量" prop="number" align="center" width="180">
<template slot-scope="scope">
<el-row>
<el-col :span="12"
><el-input v-model="scope.row.number" placeholder="数量"
/></el-col>
<el-col :span="12"
><el-select
v-model="form.projId"
placeholder="单位"
style="width: 100%"
filterable
@change="projectChage"
>
<el-option
v-for="(item, index) in projectOptions"
:key="index"
:label="item.projName"
:value="item.id"
>
</el-option> </el-select
></el-col>
</el-row>
</template>
</el-table-column>
<el-table-column
v-if="showAssetsVersion"
label="申请规格"
align="center"
prop="assetsVersion"
width="160"
>
<template slot-scope="scope">
<el-input
type="textarea"
v-model="scope.row.assetsVersion"
placeholder="请输入申请规格"
rows="2"
maxlength="200"
/>
</template>
</el-table-column>
<el-table-column label="使用说明" prop="useReason" align="center">
<template slot-scope="scope">
<el-input
type="textarea"
v-model="scope.row.useReason"
placeholder="请输入申请规格"
rows="2"
maxlength="500"
/>
</template>
</el-table-column>
</el-table>
<div style="text-align: center; margin: 20px 0px">
<el-button type="primary" @click="submitForm"></el-button>
<el-button @click="doCanel"> </el-button>
</div>
@ -114,7 +218,7 @@ export default {
createTime: null,
updateBy: null,
updateTime: null,
remark: null
remark: null,
},
//
rules: {
@ -137,6 +241,10 @@ export default {
taskTitle: null,
taskOpen: false,
daterangeMarksTime: [],
proProjectApplyDetailList: [],
//
checkedProProjectApplyDetail: [],
showAssetsVersion:false,
};
},
computed: {},
@ -158,11 +266,11 @@ export default {
},
//
projectChage(val) {
for(let i = 0; i < this.projectOptions.length; i++) {
if(this.projectOptions[i].id == val) {
this.form.projName = this.projectOptions[i].projName;
return false;
}
for (let i = 0; i < this.projectOptions.length; i++) {
if (this.projectOptions[i].id == val) {
this.form.projName = this.projectOptions[i].projName;
return false;
}
}
},
doCanel() {
@ -171,6 +279,10 @@ export default {
show(options) {
this.options = options;
this.initMyProject();
//
if(options.category==1){
this.showAssetsVersion=true;
}
this.title = options.name;
this.form.parProjName = store.getters.parDeptName;
this.nickName = store.getters.name;
@ -185,7 +297,7 @@ export default {
try {
self.bpmnViewer = new BpmnViewer({
container: this.$refs.flowCanvas,
height: "150px",
height: "100px",
});
await self.bpmnViewer.importXML(data);
//
@ -207,6 +319,47 @@ export default {
}
});
},
/** 项目申请明细序号 */
rowProProjectApplyDetailIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
/** 项目申请明细添加按钮操作 */
handleAddProProjectApplyDetail() {
let obj = {};
obj.superTypeId = "";
obj.superTypeName = "";
obj.typeId = "";
obj.typeName = "";
obj.assetsId = "";
obj.assetsName = "";
obj.assetsUnit = "";
obj.number = "";
obj.useTime = "";
obj.useReason = "";
obj.price = "";
obj.totalPrice = "";
obj.isDel = "";
obj.remark = "";
this.proProjectApplyDetailList.push(obj);
},
/** 项目申请明细删除按钮操作 */
handleDeleteProProjectApplyDetail() {
if (this.checkedProProjectApplyDetail.length == 0) {
this.$modal.msgError("请先选择要删除的项目申请明细数据");
} else {
const proProjectApplyDetailList = this.proProjectApplyDetailList;
const checkedProProjectApplyDetail = this.checkedProProjectApplyDetail;
this.proProjectApplyDetailList = proProjectApplyDetailList.filter(function (
item
) {
return checkedProProjectApplyDetail.indexOf(item.index) == -1;
});
}
},
/** 复选框选中数据 */
handleProProjectApplyDetailSelectionChange(selection) {
this.checkedProProjectApplyDetail = selection.map((item) => item.index);
},
},
};
</script>
@ -216,7 +369,7 @@ export default {
}
.maskLayer {
width: 100%;
height: 150px;
height: 100px;
position: absolute;
z-index: 9999;
top: 66px;

View File

@ -344,7 +344,7 @@ export default {
try {
self.bpmnViewer = new BpmnViewer({
container: this.$refs.flowCanvas,
height: "90px",
height: "100px",
});
await self.bpmnViewer.importXML(data.xmlData);
//
@ -535,7 +535,7 @@ export default {
}
.maskLayer {
width: 100%;
height: 90px;
height: 100px;
position: absolute;
z-index: 9999;
top: 77px;