From 13211d382d6578361c1be80a888a414a83a06e40 Mon Sep 17 00:00:00 2001 From: cun-nan <19819293608@163.com> Date: Mon, 18 Mar 2024 09:03:14 +0800 Subject: [PATCH] bug --- .../EventMarketing/cardExchange/index.vue | 2 +- fuintAdmin_zt/src/views/Site/index.vue | 147 +++++++++++++----- .../src/views/components/Service/index.vue | 19 +-- .../store/service/impl/StoreServiceImpl.java | 12 ++ .../java/com/fuint/common/dto/StoreDto.java | 6 + .../dept/controller/SysDeptController.java | 5 +- .../com/fuint/system/dept/entity/SysDept.java | 6 +- .../system/dept/service/ISysDeptService.java | 2 + .../dept/service/impl/SysDeptServiceImpl.java | 16 ++ .../com/fuint/repository/model/TAccount.java | 2 + .../main/resources/mapper/TAccountMapper.xml | 3 +- 11 files changed, 165 insertions(+), 55 deletions(-) diff --git a/fuintAdmin/src/views/EventMarketing/cardExchange/index.vue b/fuintAdmin/src/views/EventMarketing/cardExchange/index.vue index 1d38b5fb1..cd5df1f92 100644 --- a/fuintAdmin/src/views/EventMarketing/cardExchange/index.vue +++ b/fuintAdmin/src/views/EventMarketing/cardExchange/index.vue @@ -181,7 +181,7 @@ :label="dict.name" :value="dict.id"> - + diff --git a/fuintAdmin_zt/src/views/Site/index.vue b/fuintAdmin_zt/src/views/Site/index.vue index 37e2edbac..9871a6d84 100644 --- a/fuintAdmin_zt/src/views/Site/index.vue +++ b/fuintAdmin_zt/src/views/Site/index.vue @@ -91,6 +91,7 @@ + @@ -533,6 +575,8 @@ export default { cascader:[], storeOptions:[], merchantOptions:[], + beginTime:"", + endTime:"", deleteid:0, pdinfo: 1 , activeName: 'list', @@ -763,6 +807,8 @@ export default { // 清空数据 rateClearing () { this.timeFrame =[] + this.beginTime = "" + this.endTime = "" this.ruleForm.turnoverLimit = 0 this.ruleForm.turnoverTime = '' this.ruleForm.turnoverStartTime = null @@ -879,14 +925,16 @@ export default { //新增节点 submitForms(formName) { console.log("timeFrame ",this.timeFrame) - console.log("this.ruleForm ",this.ruleForm) + console.log("this.ruleForm ",this.ruleForm,this.ruleForm.parentId) this.$refs[formName].validate((valid) => { if (valid) { console.log("timeFrame",this.timeFrame) if (this.timeFrame){ - this.ruleForm.turnoverStartTime = this.timeFrame[0] - this.ruleForm.turnoverEndTime = this.timeFrame[1] + // this.ruleForm.turnoverStartTime = this.timeFrame[0] + // this.ruleForm.turnoverEndTime = this.timeFrame[1] } + this.ruleForm.turnoverStartTime = this.beginTime + this.ruleForm.turnoverEndTime = this.endTime if (!this.storeNum) { this.ruleForm.storeNum = null } @@ -914,10 +962,12 @@ export default { if (!this.storeNum) { this.ruleForm.storeNum = null } - if (this.timeFrame){ - this.ruleForm.turnoverStartTime = this.timeFrame[0] - this.ruleForm.turnoverEndTime = this.timeFrame[1] - } + // if (this.timeFrame){ + // this.ruleForm.turnoverStartTime = this.timeFrame[0] + // this.ruleForm.turnoverEndTime = this.timeFrame[1] + // } + this.ruleForm.turnoverStartTime = this.beginTime + this.ruleForm.turnoverEndTime = this.endTime deptedit(this.ruleForm).then(res=>{ // console.log(res) if(res.code == 200){ @@ -952,6 +1002,8 @@ export default { this.activeName = 'info' this.pdinfo = 1 this.timeFrame = [] + this.beginTime = "" + this.endTime = "" this.addNode(data.id,data.label) // console.log(this.pdinfo) @@ -974,7 +1026,7 @@ export default { } }, // 新增数据 - async addNode(id,label) { + addNode(id,label) { let _this = this // 默认类型 this.isClick = false @@ -985,22 +1037,33 @@ export default { // _this.ruleForm.deptType = '1' // 点击树获取部门信息 - await Userlist(id).then(res=>{ - console.log("新增树的返回",res) - this.cascader = [] - this.deptType = res.data.deptType - if (res.data.deptType === "3") { - this.parentName = res.data.parentName - // this.cascader - this.ruleForm.parentId = res.data.parentId - } else { - this.parentName = res.data.deptName - this.ruleForm.parentId = res.data.deptId - } + this.cascader = [] + let fanCascader = [] + + Userlist(id).then(async res=>{ + console.log(res ,263) + this.deptType = res.data.deptType + this.parentName = res.data.parentName + // if (res.data.parentId==0){ + this.ruleForm.parentId = res.data.deptId + // }else { + // this.ruleForm.parentId = res.data.parentId + // } + + let pid = res.data.parentId + fanCascader.push(res.data.deptId) + while (pid!=0){ + await Userlist(pid).then(re=> { + pid = re.data.parentId + fanCascader.push(re.data.deptId) + }) + } + this.cascader = fanCascader.reverse() + this.isTopDept = false + console.log( this.ruleForm.parentId ,111) + }) + - this.cascader.push(this.ruleForm.parentId) - }) - this.isTopDept = false }, //修改树 @@ -1023,10 +1086,12 @@ export default { if (this.ruleForm.turnoverStartTime) { const date = new Date(this.ruleForm.turnoverStartTime); this.timeFrame[0] = date.toString(); + this.beginTime = date.toString(); } if (this.ruleForm.turnoverEndTime) { const date = new Date(this.ruleForm.turnoverEndTime); this.timeFrame[1] = date.toString(); + this.endTime = date.toString(); } if (this.ruleForm.storeNum) { this.storeNum = true diff --git a/fuintAdmin_zt/src/views/components/Service/index.vue b/fuintAdmin_zt/src/views/components/Service/index.vue index a75bfb88f..381bdd885 100644 --- a/fuintAdmin_zt/src/views/components/Service/index.vue +++ b/fuintAdmin_zt/src/views/components/Service/index.vue @@ -134,14 +134,15 @@ - - - - + + + + + + + + + @@ -296,7 +297,7 @@ uploadImages: [], dialogImageUrl: "", dialogVisible: false, - hideUpload: false, + // hideUpload: false, from:{ name: '', diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/StoreServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/StoreServiceImpl.java index 90c993a34..a35e70bb5 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/StoreServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/store/service/impl/StoreServiceImpl.java @@ -27,6 +27,7 @@ import com.fuint.repository.model.MtMerchant; import com.fuint.repository.model.TAccount; import com.fuint.system.dept.entity.SysDept; import com.fuint.system.dept.mapper.SysDeptMapper; +import com.fuint.system.dept.service.ISysDeptService; import com.fuint.system.role.entity.TDuty; import com.fuint.system.role.mapper.TDutyMapper; import com.fuint.utils.StringUtil; @@ -63,6 +64,8 @@ public class StoreServiceImpl extends ServiceImpl implem @Resource private MtMerchantMapper mtMerchantMapper; + @Resource + private ISysDeptService iSysDeptService; /** * 商户接口 @@ -261,6 +264,15 @@ public class StoreServiceImpl extends ServiceImpl implem } StoreDto mtStoreDto = new StoreDto(); + if (ObjectUtil.isNotEmpty(mtStore.getContractDeptId())){ + SysDept sysDept = iSysDeptService.selectDeptById(mtStore.getContractDeptId()); + if (ObjectUtil.isNotEmpty(sysDept)){ + SysDept sysDept1 = iSysDeptService.selectDeptById(sysDept.getParentId()); + if (ObjectUtil.isNotEmpty(sysDept1)){ + mtStore.setExpirationTime(sysDept1.getTurnoverEndTime()); + } + } + } BeanUtils.copyProperties(mtStore, mtStoreDto); return mtStoreDto; diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/StoreDto.java b/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/StoreDto.java index 130b2d445..02db2ed9c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/StoreDto.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/common/dto/StoreDto.java @@ -1,11 +1,15 @@ package com.fuint.common.dto; +import com.baomidou.mybatisplus.annotation.TableField; +import lombok.Data; + import java.io.Serializable; import java.util.Date; /** * 店铺实体 * */ +@Data public class StoreDto implements Serializable { private static final long serialVersionUID = 1L; @@ -149,6 +153,8 @@ public class StoreDto implements Serializable { * 最后操作人 */ private String operator; + @TableField(exist = false) + private Integer storeNums; /** * 服务到期时间 diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/controller/SysDeptController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/controller/SysDeptController.java index 323b0bd2f..f25f3dd9c 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/controller/SysDeptController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/controller/SysDeptController.java @@ -65,7 +65,10 @@ public class SysDeptController extends BaseController @GetMapping(value = "/{deptId}") public ResponseObject getInfo(@PathVariable Long deptId) { - return getSuccessResult(deptService.selectDeptById(deptId)); + List sysDepts = deptService.selectDeptLists(deptId); + SysDept sysDept = deptService.selectDeptById(deptId); + if (ObjectUtil.isNotEmpty(sysDept)) sysDept.setStoreNums(sysDepts.size()); + return getSuccessResult(sysDept); } @Autowired diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java index 08feb7915..9ac148176 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/entity/SysDept.java @@ -70,13 +70,15 @@ public class SysDept extends BaseEntity private String turnoverType; private BigDecimal turnoverLimit; -// @JsonFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") private Date turnoverStartTime; -// @JsonFormat(pattern = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd") private Date turnoverEndTime; private BigDecimal rates; @TableField(strategy = FieldStrategy.IGNORED) private Integer storeNum; private BigDecimal prepaidAmount; + @TableField(exist = false) + private Integer storeNums; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/ISysDeptService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/ISysDeptService.java index 006c2c917..88367a873 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/ISysDeptService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/ISysDeptService.java @@ -22,6 +22,8 @@ public interface ISysDeptService extends IService */ public List selectDeptList(SysDept dept); + List selectDeptLists(Long parentId); + /** * 查询部门树结构信息 * diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java index 51c27bc48..1e12268bc 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dept/service/impl/SysDeptServiceImpl.java @@ -1,5 +1,6 @@ package com.fuint.system.dept.service.impl; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ObjectUtil; import com.aliyun.oss.ServiceException; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -25,6 +26,7 @@ import com.fuint.framework.exception.BusinessCheckException; import com.fuint.system.dept.entity.SysDept; import com.fuint.system.dept.mapper.SysDeptMapper; import com.fuint.system.dept.service.ISysDeptService; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -73,6 +75,14 @@ public class SysDeptServiceImpl extends ServiceImpl imple return sysDepts; } + @Override + public List selectDeptLists(Long parentId) { + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("parent_id",parentId); + queryWrapper.eq("if_delete","0"); + return baseMapper.selectList(queryWrapper); + } + /** * 查询部门树结构信息 * @@ -234,6 +244,12 @@ public class SysDeptServiceImpl extends ServiceImpl imple throw new ServiceException("部门停用,不允许新增"); } dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); + List sysDepts = this.selectDeptLists(dept.getParentId()); + if (ObjectUtils.isNotEmpty(info) && ObjectUtils.isNotEmpty(info.getStoreNum()) && CollectionUtil.isNotEmpty(sysDepts) && sysDepts.size()>=info.getStoreNum()) + { + throw new Exception("已到达最大的油站数量,不可添加!"); + } + } int insert = baseMapper.insert(dept); //处理店铺 diff --git a/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/TAccount.java b/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/TAccount.java index fd33c7c2f..2247a9038 100644 --- a/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/TAccount.java +++ b/fuintBackend/fuint-repository/src/main/java/com/fuint/repository/model/TAccount.java @@ -74,6 +74,8 @@ public class TAccount extends BaseEntity implements Serializable { @TableField(exist = false) private String deptName; @TableField(exist = false) + private String roleName; + @TableField(exist = false) private String deptType; // @TableField(exist = false) private String mobile; diff --git a/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml b/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml index b1ffd6630..b29595e1f 100644 --- a/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml +++ b/fuintBackend/fuint-repository/src/main/resources/mapper/TAccountMapper.xml @@ -26,11 +26,12 @@