Merge remote-tracking branch 'origin/main'
commit
8d922be8b1
|
|
@ -0,0 +1,60 @@
|
||||||
|
package com.zcloud.basic.info.facade;
|
||||||
|
|
||||||
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
|
import com.zcloud.basic.info.api.CorpInfoServiceI;
|
||||||
|
import com.zcloud.basic.info.command.convertor.CorpInfoCoConvertor;
|
||||||
|
import com.zcloud.basic.info.dto.CorpFormAddCmd;
|
||||||
|
import com.zcloud.basic.info.dto.CorpInfoAddCmd;
|
||||||
|
import com.zcloud.basic.info.dto.CorpInfoPageQry;
|
||||||
|
import com.zcloud.basic.info.dto.CorpInfoUpdateCmd;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.CorpInfoCO;
|
||||||
|
import com.zcloud.gbscommon.zcloudcorp.face.ZcloudCorpFacade;
|
||||||
|
import com.zcloud.gbscommon.zcloudcorp.request.ZcloudCorpInfoAddCmd;
|
||||||
|
import com.zcloud.gbscommon.zcloudcorp.request.ZcloudCorpInfoPageQry;
|
||||||
|
import com.zcloud.gbscommon.zcloudcorp.request.ZcloudCorpInfoQry;
|
||||||
|
import com.zcloud.gbscommon.zcloudcorp.request.ZcloudCorpInfoUpdateCmd;
|
||||||
|
import com.zcloud.gbscommon.zcloudcorp.response.ZcloudCorpInfoCO;
|
||||||
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@DubboService
|
||||||
|
public class ZcloudCorpFacadeImpl implements ZcloudCorpFacade {
|
||||||
|
@Resource
|
||||||
|
private CorpInfoServiceI corpInfoService;
|
||||||
|
@Resource
|
||||||
|
private CorpInfoCoConvertor corpInfoCoConvertor;
|
||||||
|
@Override
|
||||||
|
public SingleResponse<ZcloudCorpInfoCO> getCorpInfoById(ZcloudCorpInfoQry zcloudCorpInfoQry) {
|
||||||
|
CorpInfoCO info = corpInfoService.info(zcloudCorpInfoQry.getId());
|
||||||
|
ZcloudCorpInfoCO zcloudCorpInfoCO = new ZcloudCorpInfoCO();
|
||||||
|
BeanUtils.copyProperties(info, zcloudCorpInfoCO);
|
||||||
|
return SingleResponse.of(zcloudCorpInfoCO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResponse<ZcloudCorpInfoCO> pageByParentId(ZcloudCorpInfoPageQry zcloudCorpInfoPageQry) {
|
||||||
|
CorpInfoPageQry qry = new CorpInfoPageQry();
|
||||||
|
BeanUtils.copyProperties(zcloudCorpInfoPageQry, qry);
|
||||||
|
PageResponse<CorpInfoCO> corpInfoCOPageResponse = corpInfoService.listPage(qry);
|
||||||
|
List<ZcloudCorpInfoCO> zcloudPage = corpInfoCoConvertor.converCOsToDubboCOs(corpInfoCOPageResponse.getData());
|
||||||
|
return PageResponse.of(zcloudPage, corpInfoCOPageResponse.getTotalCount(), corpInfoCOPageResponse.getPageSize(), corpInfoCOPageResponse.getPageIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse addCorp(ZcloudCorpInfoAddCmd zcloudCorpInfoAddCmd) {
|
||||||
|
CorpInfoAddCmd addCmd =new CorpInfoAddCmd();
|
||||||
|
BeanUtils.copyProperties(zcloudCorpInfoAddCmd, addCmd);
|
||||||
|
return corpInfoService.add(addCmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SingleResponse editCorp(ZcloudCorpInfoUpdateCmd zcloudCorpInfoUpdateCmd) {
|
||||||
|
CorpInfoUpdateCmd updateCmd =new CorpInfoUpdateCmd();
|
||||||
|
BeanUtils.copyProperties(zcloudCorpInfoUpdateCmd, updateCmd);
|
||||||
|
return SingleResponse.buildSuccess();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,20 +1,28 @@
|
||||||
package com.zcloud.basic.info.facade;
|
package com.zcloud.basic.info.facade;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.alibaba.cola.dto.MultiResponse;
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
import com.alibaba.cola.dto.SingleResponse;
|
import com.alibaba.cola.dto.SingleResponse;
|
||||||
import com.zcloud.basic.info.api.PostServiceI;
|
import com.zcloud.basic.info.api.PostServiceI;
|
||||||
import com.zcloud.basic.info.dto.PostListQry;
|
import com.zcloud.basic.info.dto.PostListQry;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.DepartmentCO;
|
||||||
import com.zcloud.basic.info.dto.clientobject.PostCO;
|
import com.zcloud.basic.info.dto.clientobject.PostCO;
|
||||||
|
import com.zcloud.basic.info.dto.clientobject.PostDepartmentCO;
|
||||||
|
import com.zcloud.gbscommon.utils.DeepCopyUtil;
|
||||||
import com.zcloud.gbscommon.zcloudpost.facade.ZcloudPostFacade;
|
import com.zcloud.gbscommon.zcloudpost.facade.ZcloudPostFacade;
|
||||||
import com.zcloud.gbscommon.zcloudpost.request.ZcloudPostQry;
|
import com.zcloud.gbscommon.zcloudpost.request.ZcloudPostQry;
|
||||||
import com.zcloud.gbscommon.zcloudpost.response.ZcloudPostCO;
|
import com.zcloud.gbscommon.zcloudpost.response.ZcloudPostCO;
|
||||||
|
import com.zcloud.gbscommon.zcloudpost.response.ZcloudPostDepartmentCO;
|
||||||
import org.apache.dubbo.config.annotation.DubboService;
|
import org.apache.dubbo.config.annotation.DubboService;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author SondonYong
|
* @author SondonYong
|
||||||
|
|
@ -36,8 +44,18 @@ public class ZcloudPostFacadeImpl implements ZcloudPostFacade {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZcloudPostCO zcloudPostCO = new ZcloudPostCO();
|
// ZcloudPostCO zcloudPostCO = new ZcloudPostCO();
|
||||||
BeanUtils.copyProperties(postCO.getData(), zcloudPostCO);
|
// BeanUtils.copyProperties(postCO.getData(), zcloudPostCO);
|
||||||
|
|
||||||
|
// 定义映射关系
|
||||||
|
Map<Class<?>, Class<?>> mapping = new HashMap<>();
|
||||||
|
mapping.put(PostDepartmentCO.class, ZcloudPostDepartmentCO.class);
|
||||||
|
|
||||||
|
ZcloudPostCO zcloudPostCO = DeepCopyUtil.deepCopy(postCO.getData(), ZcloudPostCO.class, mapping);
|
||||||
|
|
||||||
|
// List<ZcloudPostDepartmentCO> zcloudPostDepartmentCOS = BeanUtil.copyToList(postCO.getData().getDepartmentList(), ZcloudPostDepartmentCO.class);
|
||||||
|
|
||||||
|
// zcloudPostCO.setDepartmentList(zcloudPostDepartmentCOS);
|
||||||
|
|
||||||
return SingleResponse.of(zcloudPostCO);
|
return SingleResponse.of(zcloudPostCO);
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +70,29 @@ public class ZcloudPostFacadeImpl implements ZcloudPostFacade {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ZcloudPostCO> zcloudPostCOList = BeanUtil.copyToList(list.getData(), ZcloudPostCO.class);
|
Map<Class<?>, Class<?>> mapping = new HashMap<>();
|
||||||
|
mapping.put(PostDepartmentCO.class, ZcloudPostDepartmentCO.class);
|
||||||
|
|
||||||
|
List<ZcloudPostCO> zcloudPostCOList = DeepCopyUtil.copyList(list.getData(), ZcloudPostCO.class, mapping);
|
||||||
|
|
||||||
|
// List<ZcloudPostCO> zcloudPostCOList = BeanUtil.copyToList(list.getData(), ZcloudPostCO.class);
|
||||||
|
// List<ZcloudPostCO> zcloudPostCOList = list.getData().stream()
|
||||||
|
// .map(postCO -> {
|
||||||
|
// // 复制基本属性
|
||||||
|
// ZcloudPostCO zcloudPostCO = BeanUtil.toBean(postCO, ZcloudPostCO.class);
|
||||||
|
//
|
||||||
|
// // 手动处理嵌套List
|
||||||
|
// if (CollUtil.isNotEmpty(postCO.getDepartmentList())) {
|
||||||
|
// List<ZcloudPostDepartmentCO> deptList = BeanUtil.copyToList(
|
||||||
|
// postCO.getDepartmentList(),
|
||||||
|
// ZcloudPostDepartmentCO.class
|
||||||
|
// );
|
||||||
|
// zcloudPostCO.setDepartmentList(deptList);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return zcloudPostCO;
|
||||||
|
// })
|
||||||
|
// .collect(Collectors.toList());
|
||||||
|
|
||||||
return MultiResponse.of(zcloudPostCOList);
|
return MultiResponse.of(zcloudPostCOList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -68,15 +68,15 @@ public class ImgFilesController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
@DeleteMapping("/{filePath}")
|
@DeleteMapping("/delete")
|
||||||
public Response removeFile(@PathVariable("filePath") String filePath) {
|
public Response removeFile(@RequestParam String filePath) {
|
||||||
imgFilesService.removeFile(filePath);
|
imgFilesService.removeFile(filePath);
|
||||||
return SingleResponse.buildSuccess();
|
return Response.buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除多个")
|
@ApiOperation("删除多个")
|
||||||
@DeleteMapping("/ids")
|
@DeleteMapping("/ids")
|
||||||
public Response removeBatch(@RequestParam Long[] ids) {
|
public Response removeBatch(@RequestParam Long[] ids) {
|
||||||
imgFilesService.removeBatch(ids);
|
imgFilesService.removeBatch(ids);
|
||||||
return SingleResponse.buildSuccess();
|
return SingleResponse.buildSuccess();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import com.jjb.saas.system.client.dept.facade.DeptFacade;
|
||||||
import com.jjb.saas.system.client.dept.request.FacadeUpdateDeptCmd;
|
import com.jjb.saas.system.client.dept.request.FacadeUpdateDeptCmd;
|
||||||
import com.zcloud.basic.info.domain.gateway.DepartmentGateway;
|
import com.zcloud.basic.info.domain.gateway.DepartmentGateway;
|
||||||
import com.zcloud.basic.info.domain.model.DepartmentE;
|
import com.zcloud.basic.info.domain.model.DepartmentE;
|
||||||
|
import com.zcloud.basic.info.domain.model.FacadeDepartmentE;
|
||||||
import com.zcloud.basic.info.dto.DepartmentUpdateCmd;
|
import com.zcloud.basic.info.dto.DepartmentUpdateCmd;
|
||||||
import com.zcloud.basic.info.persistence.dataobject.DepartmentDO;
|
import com.zcloud.basic.info.persistence.dataobject.DepartmentDO;
|
||||||
import com.zcloud.basic.info.persistence.repository.DepartmentRepository;
|
import com.zcloud.basic.info.persistence.repository.DepartmentRepository;
|
||||||
|
|
@ -46,12 +47,11 @@ public class DepartmentUpdateExe {
|
||||||
throw new BizException("修改失败");
|
throw new BizException("修改失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
FacadeUpdateDeptCmd deptCmd = new FacadeUpdateDeptCmd();
|
FacadeDepartmentE deptE =FacadeDepartmentE.initUpdate(departmentE);
|
||||||
deptCmd.setLinkId(departmentE.getId());
|
|
||||||
deptCmd.setLinkName(departmentE.getName());
|
|
||||||
deptCmd.setParentId(departmentE.getParentId());
|
|
||||||
deptFacade.updateDept(deptCmd);
|
|
||||||
|
|
||||||
|
FacadeUpdateDeptCmd deptCmd = new FacadeUpdateDeptCmd();
|
||||||
|
BeanUtils.copyProperties(deptE, deptCmd);
|
||||||
|
deptFacade.updateDept(deptCmd);
|
||||||
if(!departmentDO.getName().equals(departmentE.getName())){
|
if(!departmentDO.getName().equals(departmentE.getName())){
|
||||||
//TODO 名字不一样,发送mq
|
//TODO 名字不一样,发送mq
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,19 @@
|
||||||
package com.zcloud.basic.info.command;
|
package com.zcloud.basic.info.command;
|
||||||
|
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
|
import com.zcloud.basic.info.command.convertor.ImgFilesCoConvertor;
|
||||||
import com.zcloud.basic.info.domain.gateway.ImgFilesGateway;
|
import com.zcloud.basic.info.domain.gateway.ImgFilesGateway;
|
||||||
|
import com.zcloud.basic.info.domain.model.ImgFilesE;
|
||||||
|
import com.zcloud.basic.info.persistence.dataobject.ImgFilesDO;
|
||||||
|
import com.zcloud.basic.info.persistence.repository.ImgFilesRepository;
|
||||||
|
import com.zcloud.gbscommon.utils.Smb;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-app
|
* web-app
|
||||||
|
|
@ -17,20 +25,29 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ImgFilesRemoveExe {
|
public class ImgFilesRemoveExe {
|
||||||
private final ImgFilesGateway imgFilesGateway;
|
private final ImgFilesGateway imgFilesGateway;
|
||||||
|
private final ImgFilesRepository imgFilesRepository;
|
||||||
|
private final ImgFilesCoConvertor imgFilesCoConvertor;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean execute(String filePath) {
|
public boolean execute(String filePath) {
|
||||||
|
ImgFilesE imgFilesE = new ImgFilesE();
|
||||||
// if (!res) {
|
try {
|
||||||
// throw new BizException("删除失败");
|
imgFilesE.deleteFile(filePath);
|
||||||
// }
|
} catch (Exception e) {
|
||||||
|
throw new BizException("删除失败");
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean execute(Long[] ids) {
|
public boolean execute(Long[] ids) {
|
||||||
boolean res = imgFilesGateway.deletedImgFilesByIds(ids);
|
List<ImgFilesDO> imgFilesDOList = imgFilesRepository.listByIds(Arrays.asList(ids));
|
||||||
if (!res) {
|
List<ImgFilesE> imgFilesEList = imgFilesCoConvertor.converDOsToEs(imgFilesDOList);
|
||||||
|
ImgFilesE imgFilesE = new ImgFilesE();
|
||||||
|
try {
|
||||||
|
imgFilesE.deleteFileList(imgFilesEList);
|
||||||
|
imgFilesRepository.deleteList(ids);
|
||||||
|
} catch (Exception e) {
|
||||||
throw new BizException("删除失败");
|
throw new BizException("删除失败");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.zcloud.basic.info.command;
|
package com.zcloud.basic.info.command;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.zcloud.basic.info.domain.gateway.PostDepartmentGateway;
|
import com.zcloud.basic.info.domain.gateway.PostDepartmentGateway;
|
||||||
import com.zcloud.basic.info.domain.gateway.PostGateway;
|
import com.zcloud.basic.info.domain.gateway.PostGateway;
|
||||||
import com.zcloud.basic.info.domain.model.PostDepartmentE;
|
import com.zcloud.basic.info.domain.model.PostDepartmentE;
|
||||||
|
|
@ -42,7 +43,9 @@ public class PostAddExe {
|
||||||
// 岗位部门关联
|
// 岗位部门关联
|
||||||
if(res && cmd.getSupervisionFlag() == 1) {
|
if(res && cmd.getSupervisionFlag() == 1) {
|
||||||
List<PostDepartmentE> postDepartmentEList = postE.addDepartmentIds(postId, cmd.getDepartmentIds());
|
List<PostDepartmentE> postDepartmentEList = postE.addDepartmentIds(postId, cmd.getDepartmentIds());
|
||||||
res = postDepartmentGateway.addList(postDepartmentEList);
|
if(CollUtil.isNotEmpty(postDepartmentEList)){
|
||||||
|
res = postDepartmentGateway.addList(postDepartmentEList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.zcloud.basic.info.command;
|
package com.zcloud.basic.info.command;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.alibaba.cola.exception.BizException;
|
import com.alibaba.cola.exception.BizException;
|
||||||
import com.zcloud.basic.info.domain.gateway.PostDepartmentGateway;
|
import com.zcloud.basic.info.domain.gateway.PostDepartmentGateway;
|
||||||
import com.zcloud.basic.info.domain.gateway.PostGateway;
|
import com.zcloud.basic.info.domain.gateway.PostGateway;
|
||||||
|
|
@ -36,7 +37,9 @@ public class PostUpdateExe {
|
||||||
if(res && postUpdateCmd.getSupervisionFlag() == 1){
|
if(res && postUpdateCmd.getSupervisionFlag() == 1){
|
||||||
postDepartmentGateway.deletedPostDepartment(postE.getId());
|
postDepartmentGateway.deletedPostDepartment(postE.getId());
|
||||||
List<PostDepartmentE> postDepartmentEList = postE.addDepartmentIds(postE.getId(), postUpdateCmd.getDepartmentIds());
|
List<PostDepartmentE> postDepartmentEList = postE.addDepartmentIds(postE.getId(), postUpdateCmd.getDepartmentIds());
|
||||||
res = postDepartmentGateway.addList(postDepartmentEList);
|
if(CollUtil.isNotEmpty(postDepartmentEList)){
|
||||||
|
res = postDepartmentGateway.addList(postDepartmentEList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import com.zcloud.basic.info.dto.clientobject.CorpDepartmentCO;
|
||||||
import com.zcloud.basic.info.dto.clientobject.CorpInfoCO;
|
import com.zcloud.basic.info.dto.clientobject.CorpInfoCO;
|
||||||
import com.zcloud.basic.info.persistence.dataobject.CorpInfoDO;
|
import com.zcloud.basic.info.persistence.dataobject.CorpInfoDO;
|
||||||
import com.zcloud.basic.info.persistence.dataobject.DepartmentDO;
|
import com.zcloud.basic.info.persistence.dataobject.DepartmentDO;
|
||||||
|
import com.zcloud.gbscommon.zcloudcorp.response.ZcloudCorpInfoCO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -30,5 +31,7 @@ public interface CorpInfoCoConvertor {
|
||||||
List<DepartmentE> converDOsToDepartE(List<DepartmentDO> list);
|
List<DepartmentE> converDOsToDepartE(List<DepartmentDO> list);
|
||||||
|
|
||||||
List<CorpDepartmentCO> converCorpInfoToCorpDepartCOs(List<CorpDepartmentE> corpInfoList);
|
List<CorpDepartmentCO> converCorpInfoToCorpDepartCOs(List<CorpDepartmentE> corpInfoList);
|
||||||
|
|
||||||
|
List<ZcloudCorpInfoCO> converCOsToDubboCOs(List<CorpInfoCO> data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ public interface ImgFilesCoConvertor {
|
||||||
*/
|
*/
|
||||||
List<ImgFilesCO> converDOsToCOs(List<ImgFilesDO> imgFilesDOs);
|
List<ImgFilesCO> converDOsToCOs(List<ImgFilesDO> imgFilesDOs);
|
||||||
List<ImgFilesDO> converEsToDOs(List<ImgFilesE> imgFilesEs);
|
List<ImgFilesDO> converEsToDOs(List<ImgFilesE> imgFilesEs);
|
||||||
|
List<ImgFilesE> converDOsToEs(List<ImgFilesDO> imgFilesDOs);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.zcloud.basic.info.command.query;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
|
import com.jjb.saas.framework.auth.utils.AuthContext;
|
||||||
import com.zcloud.basic.info.command.convertor.DepartmentCoConvertor;
|
import com.zcloud.basic.info.command.convertor.DepartmentCoConvertor;
|
||||||
import com.zcloud.basic.info.domain.model.DepartmentE;
|
import com.zcloud.basic.info.domain.model.DepartmentE;
|
||||||
import com.zcloud.basic.info.dto.CorpDepartmentQry;
|
import com.zcloud.basic.info.dto.CorpDepartmentQry;
|
||||||
|
|
@ -15,6 +16,7 @@ import com.zcloud.basic.info.persistence.dataobject.DepartmentDO;
|
||||||
import com.zcloud.basic.info.persistence.repository.DepartmentRepository;
|
import com.zcloud.basic.info.persistence.repository.DepartmentRepository;
|
||||||
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
import com.zcloud.gbscommon.utils.PageQueryHelper;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
|
@ -48,6 +50,10 @@ public class DepartmentQueryExe {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<DepartmentTreeInfoCO> listTree(DepartmentTreeQry departmentQry) {
|
public List<DepartmentTreeInfoCO> listTree(DepartmentTreeQry departmentQry) {
|
||||||
|
if(Objects.isNull(departmentQry.getEqCorpinfoId())){
|
||||||
|
departmentQry.setEqCorpinfoId(AuthContext.getTenantId());
|
||||||
|
|
||||||
|
}
|
||||||
Map<String, Object> parmas = PageQueryHelper.toHashMap(departmentQry);
|
Map<String, Object> parmas = PageQueryHelper.toHashMap(departmentQry);
|
||||||
List<DepartmentDO> pageResponse = departmentRepository.listTree(parmas);
|
List<DepartmentDO> pageResponse = departmentRepository.listTree(parmas);
|
||||||
if(CollUtil.isEmpty(pageResponse)) {
|
if(CollUtil.isEmpty(pageResponse)) {
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@ public class DepartmentTreeQry {
|
||||||
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
* - `ne`: 不等比较查询,对应SQL的!=操作符
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ApiModelProperty(value = "企业id", name = "eqCorpInfoId")
|
@ApiModelProperty(value = "企业id", name = "eqCorpinfoId")
|
||||||
private String eqCorpInfoId;
|
private Long eqCorpinfoId;
|
||||||
@ApiModelProperty(value = "父id", name = "eqParentId")
|
@ApiModelProperty(value = "父id", name = "eqParentId")
|
||||||
private String eqParentId;
|
private Long eqParentId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,15 @@ public class ImgFilesCO extends ClientObject {
|
||||||
//企业id
|
//企业id
|
||||||
@ApiModelProperty(value = "企业id")
|
@ApiModelProperty(value = "企业id")
|
||||||
private Long corpinfoId;
|
private Long corpinfoId;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "文件列表")
|
||||||
|
private List<ImgFilesCO> fileList;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "md5")
|
||||||
|
private String md5;
|
||||||
//乐观锁
|
//乐观锁
|
||||||
@ApiModelProperty(value = "乐观锁")
|
@ApiModelProperty(value = "乐观锁")
|
||||||
private Integer version;
|
private Integer version;
|
||||||
|
|
@ -73,8 +82,6 @@ public class ImgFilesCO extends ClientObject {
|
||||||
//环境
|
//环境
|
||||||
@ApiModelProperty(value = "环境")
|
@ApiModelProperty(value = "环境")
|
||||||
private String env;
|
private String env;
|
||||||
@ApiModelProperty
|
|
||||||
private List<ImgFilesCO> fileList;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
package com.zcloud.basic.info.domain.model;
|
||||||
|
|
||||||
|
import com.alibaba.cola.domain.Entity;
|
||||||
|
import com.jjb.saas.framework.domain.model.BaseE;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* web-domain
|
||||||
|
*
|
||||||
|
* @Author zhaokai
|
||||||
|
* @Date 2025-10-30 10:10:48
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class FacadeDepartmentE extends BaseE {
|
||||||
|
|
||||||
|
//外部对象ID
|
||||||
|
private Long linkId;
|
||||||
|
//父级ID
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
//外部对象名称
|
||||||
|
private String linkName;
|
||||||
|
|
||||||
|
//区域父子级编码(逗号隔开)
|
||||||
|
private String regionCode;
|
||||||
|
|
||||||
|
//区域名称
|
||||||
|
private String regionCodeName;
|
||||||
|
|
||||||
|
|
||||||
|
public static FacadeDepartmentE initUpdate(DepartmentE departmentE) {
|
||||||
|
FacadeDepartmentE deptE = new FacadeDepartmentE();
|
||||||
|
deptE.setLinkId(departmentE.getId());
|
||||||
|
deptE.setLinkName(departmentE.getName());
|
||||||
|
deptE.setParentId(departmentE.getParentId());
|
||||||
|
return deptE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1,10 +1,8 @@
|
||||||
package com.zcloud.basic.info.domain.model;
|
package com.zcloud.basic.info.domain.model;
|
||||||
|
|
||||||
import com.jjb.saas.framework.domain.model.BaseE;
|
import com.jjb.saas.framework.domain.model.BaseE;
|
||||||
import com.zcloud.gbscommon.utils.DateUtil;
|
import com.zcloud.gbscommon.utils.*;
|
||||||
import com.zcloud.gbscommon.utils.FileUpload;
|
|
||||||
//import com.zcloud.gbscommon.utils.Smb;
|
//import com.zcloud.gbscommon.utils.Smb;
|
||||||
import com.zcloud.gbscommon.utils.Tools;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.beanutils.BeanUtils;
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
|
@ -41,6 +39,8 @@ public class ImgFilesE extends BaseE {
|
||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
private MultipartFile[] files;
|
private MultipartFile[] files;
|
||||||
|
|
||||||
|
private String md5;
|
||||||
//乐观锁
|
//乐观锁
|
||||||
private Integer version;
|
private Integer version;
|
||||||
//创建人
|
//创建人
|
||||||
|
|
@ -66,15 +66,11 @@ public class ImgFilesE extends BaseE {
|
||||||
//环境
|
//环境
|
||||||
private String env;
|
private String env;
|
||||||
|
|
||||||
public String initAdd(Long tenantId, ImgFilesE baseImgFilesE) throws InvocationTargetException, IllegalAccessException {
|
public String initAdd(Long tenantId, ImgFilesE baseImgFilesE) {
|
||||||
|
|
||||||
MultipartFile[] files = baseImgFilesE.getFiles();
|
MultipartFile[] files = baseImgFilesE.getFiles();
|
||||||
List<ImgFilesE> imgFilesList = new ArrayList<ImgFilesE>();
|
|
||||||
String foreignKey = ObjectUtils.isEmpty(baseImgFilesE.getForeignKey()) ? Tools.get32UUID() : baseImgFilesE.getForeignKey();
|
|
||||||
Long corpinfoId = ObjectUtils.isEmpty(baseImgFilesE.getCorpinfoId()) ? tenantId : baseImgFilesE.getCorpinfoId();
|
Long corpinfoId = ObjectUtils.isEmpty(baseImgFilesE.getCorpinfoId()) ? tenantId : baseImgFilesE.getCorpinfoId();
|
||||||
String filePath = corpinfoId.toString() + "/" + DateUtil.getMonth() + "/" + baseImgFilesE.getPath();
|
String filePath = corpinfoId.toString() + "/" + DateUtil.getMonth() + "/" + baseImgFilesE.getPath()+ "/";
|
||||||
ImgFilesE imgFile = new ImgFilesE();
|
|
||||||
BeanUtils.copyProperties(baseImgFilesE, imgFile);
|
|
||||||
// 文件上传并获取上传路径
|
// 文件上传并获取上传路径
|
||||||
String resultFilePath = FileUpload.fileUp(files[0], filePath, Tools.get32UUID());
|
String resultFilePath = FileUpload.fileUp(files[0], filePath, Tools.get32UUID());
|
||||||
return filePath + resultFilePath;
|
return filePath + resultFilePath;
|
||||||
|
|
@ -89,19 +85,30 @@ public class ImgFilesE extends BaseE {
|
||||||
|
|
||||||
for (MultipartFile file : files) {
|
for (MultipartFile file : files) {
|
||||||
ImgFilesE imgFile = new ImgFilesE();
|
ImgFilesE imgFile = new ImgFilesE();
|
||||||
BeanUtils.copyProperties(baseImgFilesE, imgFile);
|
BeanUtils.copyProperties(imgFile, baseImgFilesE);
|
||||||
// 文件上传并获取上传路径
|
// 文件上传并获取上传路径
|
||||||
// Smb.saveFile(file, filePath);
|
String resultFilePath = Smb.saveFile(file, filePath);
|
||||||
imgFile.setImgFilesId(Tools.get32UUID());
|
imgFile.setImgFilesId(Tools.get32UUID());
|
||||||
// imgFile.setFilePath(filePath+);
|
imgFile.setFilePath(resultFilePath);
|
||||||
imgFile.setType(baseImgFilesE.getType());
|
imgFile.setType(baseImgFilesE.getType());
|
||||||
imgFile.setForeignKey(foreignKey);
|
imgFile.setForeignKey(foreignKey);
|
||||||
imgFile.setFileName(file.getOriginalFilename());
|
imgFile.setFileName(file.getOriginalFilename());
|
||||||
imgFile.setCorpinfoId(corpinfoId);
|
imgFile.setCorpinfoId(corpinfoId);
|
||||||
|
// imgFile.setMd5(FileUtil.getMD5(file));
|
||||||
imgFilesList.add(imgFile);
|
imgFilesList.add(imgFile);
|
||||||
}
|
}
|
||||||
baseImgFilesE.setForeignKey(foreignKey);
|
baseImgFilesE.setForeignKey(foreignKey);
|
||||||
return imgFilesList;
|
return imgFilesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void deleteFile(String filePath) throws Exception {
|
||||||
|
Smb.deleteFile(filePath);
|
||||||
|
}
|
||||||
|
public void deleteFileList(List<ImgFilesE> imgFilesEList) throws Exception {
|
||||||
|
for (ImgFilesE imgFilesE: imgFilesEList) {
|
||||||
|
Smb.deleteFile(imgFilesE.getFilePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ public class ImgFilesGatewayImpl implements ImgFilesGateway {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean deletedImgFilesByIds(Long[] ids) {
|
public Boolean deletedImgFilesByIds(Long[] ids) {
|
||||||
|
|
||||||
return imgFilesRepository.removeByIds(Arrays.asList(ids));
|
return imgFilesRepository.removeByIds(Arrays.asList(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,35 +8,39 @@ import lombok.EqualsAndHashCode;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web-infrastructure
|
* web-infrastructure
|
||||||
* @Author zhangyue
|
*
|
||||||
* @Date 2025-10-30 16:10:06
|
* @Author zhangyue
|
||||||
*/
|
* @Date 2025-10-30 16:10:06
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("img_files")
|
@TableName("img_files")
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class ImgFilesDO extends BaseDO {
|
public class ImgFilesDO extends BaseDO {
|
||||||
//业务主键id
|
//业务主键id
|
||||||
@ApiModelProperty(value = "业务主键id")
|
@ApiModelProperty(value = "业务主键id")
|
||||||
private String imgFilesId;
|
private String imgFilesId;
|
||||||
//路径
|
//路径
|
||||||
@ApiModelProperty(value = "路径")
|
@ApiModelProperty(value = "路径")
|
||||||
private String filePath;
|
private String filePath;
|
||||||
//类型,参考 com.zcloud.imgfiles.enums.filetype
|
//类型,参考 com.zcloud.imgfiles.enums.filetype
|
||||||
@ApiModelProperty(value = "类型,参考 com.zcloud.imgfiles.enums.filetype")
|
@ApiModelProperty(value = "类型,参考 com.zcloud.imgfiles.enums.filetype")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
//外键
|
//外键
|
||||||
@ApiModelProperty(value = "外键")
|
@ApiModelProperty(value = "外键")
|
||||||
private String foreignKey;
|
private String foreignKey;
|
||||||
//附件名称
|
//附件名称
|
||||||
@ApiModelProperty(value = "附件名称")
|
@ApiModelProperty(value = "附件名称")
|
||||||
private String fileName;
|
private String fileName;
|
||||||
//企业id
|
//企业id
|
||||||
@ApiModelProperty(value = "企业id")
|
@ApiModelProperty(value = "企业id")
|
||||||
private Long corpinfoId;
|
private Long corpinfoId;
|
||||||
|
//企业id
|
||||||
|
@ApiModelProperty(value = "md5")
|
||||||
|
private String md5;
|
||||||
|
|
||||||
public ImgFilesDO(String imgFilesId) {
|
public ImgFilesDO(String imgFilesId) {
|
||||||
this.imgFilesId = imgFilesId;
|
this.imgFilesId = imgFilesId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,5 +18,8 @@ public interface ImgFilesRepository extends BaseRepository<ImgFilesDO> {
|
||||||
|
|
||||||
|
|
||||||
List<ImgFilesDO> listAll(Map<String,Object> parmas);
|
List<ImgFilesDO> listAll(Map<String,Object> parmas);
|
||||||
|
|
||||||
|
|
||||||
|
void deleteList(Long[] ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ public class DepartmentRepositoryImpl extends BaseRepositoryImpl<DepartmentMappe
|
||||||
public List<DepartmentDO> listTree(Map<String, Object> parmas) {
|
public List<DepartmentDO> listTree(Map<String, Object> parmas) {
|
||||||
QueryWrapper<DepartmentDO> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<DepartmentDO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, parmas);
|
queryWrapper = PageQueryHelper.createPageQueryWrapper(queryWrapper, parmas);
|
||||||
SSOUser ssoUser = AuthContext.getCurrentUser();
|
// SSOUser ssoUser = AuthContext.getCurrentUser();
|
||||||
queryWrapper.eq("tenant_id",ssoUser.getTenantId());
|
// queryWrapper.eq("tenant_id",ssoUser.getTenantId());
|
||||||
queryWrapper.orderByDesc("dep_order");
|
queryWrapper.orderByDesc("dep_order");
|
||||||
List<DepartmentDO> departmentDOList = departmentMapper.selectList(queryWrapper);
|
List<DepartmentDO> departmentDOList = departmentMapper.selectList(queryWrapper);
|
||||||
if (CollUtil.isEmpty(departmentDOList)) {
|
if (CollUtil.isEmpty(departmentDOList)) {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.zcloud.basic.info.persistence.repository.impl;
|
||||||
import com.alibaba.cola.dto.MultiResponse;
|
import com.alibaba.cola.dto.MultiResponse;
|
||||||
import com.alibaba.cola.dto.PageResponse;
|
import com.alibaba.cola.dto.PageResponse;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.jjb.saas.framework.repository.common.PageHelper;
|
import com.jjb.saas.framework.repository.common.PageHelper;
|
||||||
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
import com.jjb.saas.framework.repository.repo.impl.BaseRepositoryImpl;
|
||||||
|
|
@ -46,5 +47,14 @@ public class ImgFilesRepositoryImpl extends BaseRepositoryImpl<ImgFilesMapper, I
|
||||||
// queryWrapper.select("id", "img_files_id", "file_path", "type", "foreign_key", "file_name", "corpinfo_id");
|
// queryWrapper.select("id", "img_files_id", "file_path", "type", "foreign_key", "file_name", "corpinfo_id");
|
||||||
return imgFilesMapper.selectList(queryWrapper);
|
return imgFilesMapper.selectList(queryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteList(Long[] ids) {
|
||||||
|
UpdateWrapper<ImgFilesDO> updateWrapper = new UpdateWrapper<>();
|
||||||
|
updateWrapper.in("id", ids);
|
||||||
|
updateWrapper.eq("delete_enum" ,"FALSE");
|
||||||
|
updateWrapper.set("delete_enum", "TRUE");
|
||||||
|
imgFilesMapper.update(null, updateWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue