Commit 11fef7ed by 284718418@qq.com

Merge branch 'develop' into feature_20220222_huayi

parents c087099c 42eff639
......@@ -355,6 +355,8 @@ public class DiskCatalogueController {
boolean flag = diskCatalogue.updateById();
if(flag){
//资源上传文件 资源目录,上传文件中间关系
diskCatalogueService.updateDiskCatalogue(diskCatalogue);
return ResultUtil.success();
}else {
return ResultUtil.error("操作失败!");
......@@ -389,7 +391,7 @@ public class DiskCatalogueController {
@GetMapping(value = "/getFileById")
@ApiOperation(value = "查看用户文件夹列表", httpMethod = "GET", notes = "文件夹或共享空间:type=0共享空间,1文件夹")
@ApiOperationSupport(order = 2)
public Result<Object> getFileOfId(@CurrentUser UserBean userBean, DiskCatalogueParam diskCatalogueParam) {
public Result<Object> getFileById(@CurrentUser UserBean userBean, DiskCatalogueParam diskCatalogueParam) {
diskCatalogueParam.setOrgId(userBean.getOrgCode());
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getEmpNum,diskCatalogueParam.getUserId()));
// 获取文件夹
......@@ -443,11 +445,12 @@ public class DiskCatalogueController {
return ResultUtil.data(map);
}
@GetMapping(value = "/deleteAlLFile")
@ApiOperation(value = "删除用户下的所有文件夹", httpMethod = "GET", notes = "文件夹或共享空间:type=0共享空间,1文件夹")
@ApiOperationSupport(order = 2)
@Log(title = "删除用户下的所有文件夹", businessType = BusinessType.OTHER)
private Result<Object> deleteAlLFile(@CurrentUser UserBean userBean, DiskCatalogueParam diskCatalogueParam){
public Result<Object> deleteAlLFile(@CurrentUser UserBean userBean, DiskCatalogueParam diskCatalogueParam){
List<DiskCatalogue> diskCatalogueList = DiskCatalogue.builder().build().selectList(new QueryWrapper<DiskCatalogue>().lambda()
.eq(DiskCatalogue::getCreateUserId,diskCatalogueParam.getUserId())
.eq(DiskCatalogue::getParentId,0)
......@@ -455,57 +458,92 @@ public class DiskCatalogueController {
if (diskCatalogueList.size()<=0){
return ResultUtil.error("该用户下没有文件");
}
/*查找ids第一个*/
diskCatalogueList.forEach(d->{
getSubCatalogueList(d.getId());
List<DiskCatalogue> subList =diskCatalogueService.getSubCatalogueList(d.getId().toString(),diskCatalogueParam.getUserId());//所有的子文件夹
if(subList!=null) {
subList.forEach(s -> {
List<DiskCatalogueFiles> diskCatalogueFilesList = DiskCatalogueFiles.builder().build().selectList(new QueryWrapper<DiskCatalogueFiles>().lambda()
.eq(DiskCatalogueFiles::getCatalogueId, s.getId())
.eq(DiskCatalogueFiles::getDeleteFlag, 0));
if (diskCatalogueFilesList.size() > 0) {
diskFilesService.deleteDiskFile(diskCatalogueFilesList.stream().map(DiskCatalogueFiles::getFilesId).collect(Collectors.toList()));
}
});
}
d.setDeleteFlag(1);
d.updateById();
});
return ResultUtil.success();
}
private void getSubCatalogueList(Integer id){
List<DiskCatalogue> subFileList =DiskCatalogue.builder().build().selectList(new QueryWrapper<DiskCatalogue>().lambda()
.like(DiskCatalogue::getParentId,id)
.eq(DiskCatalogue::getDeleteFlag,0));
subFileList.forEach(s->{
if(subFileList.size()>0){
getSubCatalogueList(s.getId());
}
List<DiskCatalogueFiles> diskCatalogueFilesList = DiskCatalogueFiles.builder().build().selectList(new QueryWrapper<DiskCatalogueFiles>().lambda()
.eq(DiskCatalogueFiles::getCatalogueId,s.getId())
.eq(DiskCatalogueFiles::getDeleteFlag,0));
diskCatalogueFilesList.forEach(f->{
DiskFiles.builder().deleteFlag(1).build().update(new QueryWrapper<DiskFiles>().lambda().eq(DiskFiles::getId,f.getFilesId()));
f.setDeleteFlag(1);
f.updateById();
});
s.setDeleteFlag(1);
s.updateById();
});
}
// private void getSubCatalogueList2(Integer id){
// List<DiskCatalogue> subFileList =DiskCatalogue.builder().build().selectList(new QueryWrapper<DiskCatalogue>().lambda()
// .like(DiskCatalogue::getParentId,id)
// .eq(DiskCatalogue::getDeleteFlag,0));
// subFileList.forEach(s->{
// if(subFileList.size()>0){
// getSubCatalogueList(s.getId());
// }
// List<DiskCatalogueFiles> diskCatalogueFilesList = DiskCatalogueFiles.builder().build().selectList(new QueryWrapper<DiskCatalogueFiles>().lambda()
// .eq(DiskCatalogueFiles::getCatalogueId,s.getId())
// .eq(DiskCatalogueFiles::getDeleteFlag,0));
// if(diskCatalogueFilesList!=null) {
// if(diskCatalogueFilesList.size()>0) {
// diskFilesService.deleteDiskFile(diskCatalogueFilesList.stream().map(DiskCatalogueFiles::getFilesId).collect(Collectors.toList()));
// }
// }
//// diskCatalogueFilesList.forEach(f->{
//// DiskFiles.builder().deleteFlag(1).build().update(new QueryWrapper<DiskFiles>().lambda().eq(DiskFiles::getId,f.getFilesId()));
//// });
// s.setDeleteFlag(1);
// s.updateById();
// });
// }
}
......@@ -2,6 +2,7 @@ package cn.timer.api.controller.disk.sevice;
import cn.timer.api.bean.disk.DiskCatalogue;
import cn.timer.api.dto.disk.DiskCatalogueParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -27,4 +28,20 @@ public interface DiskCatalogueService {
* @return
*/
List<DiskCatalogue> getDiskCatalogue(DiskCatalogueParam diskCatalogueParam);
/**
* 获取所有子文件夹
* @param ids
* @return
*/
List<DiskCatalogue> getSubCatalogueList(String ids,Integer userId);
/**
* 逻辑删除 文件夹,空间 ,中间关系以及文件
* @param diskCatalogue
* @return Boolean
*/
boolean updateDiskCatalogue(DiskCatalogue diskCatalogue);
}
......@@ -2,10 +2,12 @@ package cn.timer.api.controller.disk.sevice;
import cn.timer.api.bean.disk.DiskCatalogue;
import cn.timer.api.bean.disk.DiskCatalogueFiles;
import cn.timer.api.bean.disk.DiskFileImage;
import cn.timer.api.bean.disk.DiskFiles;
import cn.timer.api.dao.disk.DiskCatalogueMapper;
import cn.timer.api.dto.disk.DiskCatalogueParam;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -70,6 +72,42 @@ public class DiskCatalogueServiceImpl implements DiskCatalogueService {
return null;
}
@Override
public boolean updateDiskCatalogue(DiskCatalogue diskCatalogue) {
List<Integer> ids = diskCatalogueMapper.selectIdListById(diskCatalogue.getId());
if(CollectionUtils.isEmpty(ids)){
return true;
}
List<DiskCatalogueFiles> diskCatalogueFilesList = DiskCatalogueFiles.builder().build().selectList(new QueryWrapper<DiskCatalogueFiles>()
.lambda().in(DiskCatalogueFiles::getCatalogueId, ids)
.eq(DiskCatalogueFiles::getDeleteFlag, 0)
);
if(CollectionUtils.isEmpty(diskCatalogueFilesList)){
return true;
}
// 逻辑删除
DiskCatalogueFiles.builder().deleteFlag(1).build().update(new QueryWrapper<DiskCatalogueFiles>()
.lambda().in(DiskCatalogueFiles::getCatalogueId, ids)
.eq(DiskCatalogueFiles::getDeleteFlag, 0)
);
List<Integer> filesIds = diskCatalogueFilesList.stream().map(item -> item.getFilesId()).collect(Collectors.toList());
if(CollectionUtils.isEmpty(filesIds)){
return true;
}
// 逻辑删除
DiskFiles.builder().deleteFlag(1).updateUserId(diskCatalogue.getUpdateUserId()).build().update(new QueryWrapper<DiskFiles>()
.lambda().in(DiskFiles::getId, filesIds)
.eq(DiskFiles::getDeleteFlag, 0)
);
return true;
}
@Override
public List<DiskCatalogue> getSubCatalogueList(String ids,Integer userId){
return diskCatalogueMapper.getSubCatalogueList(ids,userId);
}
/**
* 递归获取树形结构
*
......
......@@ -28,4 +28,12 @@ public interface DiskFilesService {
* @return
*/
DiskFileCatalogueDto getFileCount(Integer userId);
/**
* 删除文件
* @param list
* @return
*/
Integer deleteDiskFile(List<Integer> list);
}
......@@ -40,4 +40,9 @@ public class DiskFilesServiceImpl implements DiskFilesService {
dto.setShowSize("1G");
return dto;
}
@Override
public Integer deleteDiskFile(List<Integer> list) {
return diskFilesMapper.deleteDiskFile(list);
}
}
......@@ -326,8 +326,9 @@ public class KqglServiceImpl implements KqglService {
KqglMainKqz attgro = kqglmainkqzmapper.getAttendanceGroupInformationByUserid(repaappr.getUserid(),repaappr.getOrgcode()); //考勤组信息
if(attgro != null) {
AttendanceCardListDto attdate = MethodCall(repaappr.getOrgcode(),repaappr.getUserid(),cardrepltime);//获取当天打卡班次信息
if(EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
//排班方式 // 考勤类型:1-固定排班、2-排班制、3-自由工时
//自由工时无班次ID 另行逻辑
if(attgro.getPbfs()<3 && EmptyUtil.isNotEmpty(attdate.getAttsch())) {//班次不为空
List<AttSchedule> ash = attdate.getAttsch();//获取当天应打卡时间
shifid = ash.get(0).getId();//班次id
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0,
......@@ -806,6 +807,165 @@ public class KqglServiceImpl implements KqglService {
}
}
if(attgro.getPbfs() == 3){
long starttime1 = 0,starttime1ks = 0,starttime1js = 0,endtime1 = 0,endtime1ks = 0,endtime1js = 0,starttime2 = 0,starttime2ks = 0,starttime2js = 0,endtime2 = 0,endtime2ks = 0,endtime2js = 0,starttime3 = 0,starttime3ks = 0,starttime3js = 0,
endtime3 = 0,endtime3ks = 0,endtime3js = 0;
KqglAssoDkmx dkmc = KqglAssoDkmx.builder().build().selectOne(new QueryWrapper<KqglAssoDkmx>().lambda().eq(KqglAssoDkmx::getUserid, repaappr.getUserid()).eq(KqglAssoDkmx::getQyid, repaappr.getOrgcode())
.ge(KqglAssoDkmx::getDksj, start_time).le(KqglAssoDkmx::getDksj, end_time));//获取补卡当天是否有打卡记录
if(dkmc != null) {
dkmxid = dkmc.getId();
if(repaappr.getCardreplperiod() == 1 && dkmc.getSbdk1() == null) {//上班
int sbdkjg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - starttime1)/1000/60;
if(time > 0){//上班1打卡结果
sbdkjg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
if(dkmc.getXbdk1() != null){
Long time1 = (repaappr.getCardrepltime() - dkmc.getXbdk1())/1000/60;
gzsctime = Math.abs(Double.valueOf(time1.toString()));//只打一次卡时计算工作时长
}
KqglAssoDkmx.builder().id(dkmc.getId()).sbdk1(repaappr.getCardrepltime()).sbdk1jg(sbdkjg).dktj1(1).gzsc(gzsctime).build().updateById();
}
atttype = 1;
results = sbdkjg;
}else if(repaappr.getCardreplperiod() == 2 && dkmc.getXbdk1() == null) {//下班
int xbdk1jg = 0;
if(isRange) {
Long time = (repaappr.getCardrepltime() - endtime1)/1000/60;
if(time > 0){}else{
xbdk1jg = Math.abs(Integer.valueOf(time.toString()));
}
Double gzsctime = null;//工作时长
if(dkmc.getSbdk1() != null) {
Long time1 = (repaappr.getCardrepltime() - dkmc.getSbdk1())/1000/60;
gzsctime = Math.abs(Double.valueOf(time1.toString()));
}
KqglAssoDkmx.builder().id(dkmc.getId()).xbdk1(repaappr.getCardrepltime()).xbdk1jg(xbdk1jg).dktj2(1).gzsc(gzsctime).build().updateById();
}
atttype = 2;
results = xbdk1jg;
}
}else {//补卡当天无打卡记录时
KqglAssoDkmx pcd = KqglAssoDkmx.builder().userid(repaappr.getUserid()).data(cardrepltime).qyid(repaappr.getOrgcode()).dksj(start_time).ydkcs(2)
.gzsc(0d).build();
if(repaappr.getCardreplperiod() == 1) {//上班
int sbdkjg = 0;
if(isRange) {
pcd.setSbdk1(repaappr.getCardrepltime());
pcd.setSbdk1jg(sbdkjg);
pcd.setDktj1(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
}
atttype = 1;
}else if(repaappr.getCardreplperiod() == 2) {//下班
int xbdk1jg = 0;
if(isRange) {
pcd.setXbdk1(repaappr.getCardrepltime());
pcd.setXbdk1jg(xbdk1jg);
pcd.setDktj2(1);
if (!pcd.insert()) {
throw new CustomException("打卡明细-新增异常-1");
}
}
atttype = 2;
}
if(isRange) {
dkmxid = pcd.getId();
}else {
throw new CustomException("当前时间,没有考勤异常无需补卡");
}
}
//0:打卡无效:此记录已被更新 1:正常 2:异常 3:迟到 4:早退 5:补卡 6:请假 7:加班 8:调休
//9:管理员改为正常 10:管理员改为迟到 11:管理员改为早退 12:补卡通过/正常 13:补卡通过/迟到 14:补卡通过/早退
int status = 2;
if((atttype)%2 > 0){
type = 1;
if(results == 0) {
status = 12;
}else {
status = 13;
}
}else {
type = 2;
if(results == 0) {
status = 12;
}else {
status = 14;
}
}
Long startDate = DateUtil.getStartTime(0,DateUtil.getStringTime(cardrepltime,"yyyy-MM-dd")).getTime();
String attdate_ = new SimpleDateFormat("yy-MM-dd").format(Double.valueOf(startDate));//转换打卡时间格式
//attime 应打卡时间
double gzsc = 0;
//long rest_time = 0;
/*if(shif.getStartTime() != null && !("").equals(shif.getStartTime()) && shif.getEndTime() != null && !("").equals(shif.getEndTime())) {
long kaishixiuxi = Long.valueOf(ClockInTool.dateToStamp(cardrepltime + " " +shif.getStartTime()+":00"));
long jieshuxiuxi = Long.valueOf(ClockInTool.dateToStamp(cardrepltime + " " +shif.getEndTime()+":00"));
rest_time = (jieshuxiuxi - kaishixiuxi)/1000/60;//休息时间
}*/
//请假时长
//KqglAssoRelationSummary qjsc = kqglassorelationsummarymapper.Businessdayclockin(repaappr.getUserid(), 2, cardrepltime, repaappr.getOrgcode());
//计算工作时长
KqglAssoDkmx dkgzsc = KqglAssoDkmx.builder().id(dkmxid).build().selectById();
if(dkgzsc.getYdkcs() == 2 || dkgzsc.getYdkcs() == 4 || dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk1() != null && dkgzsc.getXbdk1() != null) {
gzsc = gzsc + (dkgzsc.getXbdk1() - dkgzsc.getSbdk1())/1000/60;
}
}
if(dkgzsc.getYdkcs() == 4 || dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk2() != null && dkgzsc.getXbdk2() != null) {
gzsc = gzsc + (dkgzsc.getXbdk2() - dkgzsc.getSbdk2())/1000/60;
}
}
if(dkgzsc.getYdkcs() == 6) {
if(dkgzsc.getSbdk3() != null && dkgzsc.getXbdk3() != null) {
gzsc = gzsc + (dkgzsc.getXbdk3() - dkgzsc.getSbdk3())/1000/60;
}
}
//gzsc = gzsc - rest_time - qjsc.getDuration();
KqglAssoDkmx.builder().id(dkmxid).gzsc(gzsc).build().updateById();
KqglAssoDkjl pre = KqglAssoDkjl.builder().dktime(repaappr.getCardrepltime()).results(results).userId(repaappr.getUserid()).type(type).status(status).sort(atttype)
.cardType(0).qyid(repaappr.getOrgcode()).attdate(attdate_+" "+ClockInTool.dateToWeek2(cardrepltime)).attime(repaappr.getCardrepltime()).dkmxid(dkmxid).bcid(shifid).remarks("审批补卡通过打卡").punchmode(0)
.punchequipment("").commentary("成功打卡").build();
if (!pre.insert()) {
throw new CustomException("打卡记录-新增异常-2");
}
}
//}
}
......
......@@ -2,9 +2,15 @@ package cn.timer.api.dao.disk;
import cn.timer.api.bean.disk.DiskCatalogue;
import cn.timer.api.dto.disk.DiskCatalogueParam;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 云盘-资源目录表
*
......@@ -15,4 +21,7 @@ import org.springframework.stereotype.Repository;
@Repository
public interface DiskCatalogueMapper extends BaseMapper<DiskCatalogue> {
List<Integer> selectIdListById(@Param("id") Integer id);
List<DiskCatalogue> getSubCatalogueList(@Param("ids") String ids,@Param("userId") Integer userId);
}
......@@ -35,4 +35,11 @@ public interface DiskFilesMapper extends BaseMapper<DiskFiles> {
*/
DiskFileCatalogueDto selectFileCount(@Param("userId")Integer userId);
/**
* 删除文件
* @param list
* @return
*/
Integer deleteDiskFile(@Param("list") List<Integer> list);
}
......@@ -23,4 +23,13 @@
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="selectIdListById" resultType="java.lang.Integer">
SELECT id FROM disk_catalogue WHERE delete_flag = 0 AND find_in_set(#{id},parent_ids) OR id = #{id}
</select>
<select id="getSubCatalogueList" resultMap="BaseResultMap">
select d.* from disk_catalogue d
where d.delete_flag = 0 and d.parent_ids like CONCAT(#{ids},'%') and d.create_user_id = #{userId}
</select>
</mapper>
......@@ -20,7 +20,9 @@
SELECT c.*,cdu.id as cloud_disk_user_id,cdu.user_role,cdu.user_power FROM `disk_catalogue` c
LEFT JOIN disk_cloud_disk_user cdu ON c.id=cdu.catalogue_id AND c.id > 0
WHERE c.delete_flag=0 AND cdu.delete_flag = 0
<if test="param.userId!=null">
AND cdu.user_id = #{param.userId}
</if>
AND cdu.org_id = #{param.orgId}
AND c.parent_id = #{param.parentId}
<if test="param.id != null and param.id != ''">
......
......@@ -36,4 +36,12 @@
SELECT COALESCE(sum(file_size),0) as countSize FROM `disk_files` where create_user_id = #{userId} AND delete_flag=0
</select>
<update id="deleteDiskFile" parameterType="java.util.List">
update disk_catalogue_files set delete_flag = 1
where id in
<foreach item="item" index="index" collection="list" open="("
separator="," close=")">#{item}</foreach>
</update>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment