From ea5615a5081d675700544e3c834939c18dae543e Mon Sep 17 00:00:00 2001 From: ZQN <364596817@qq.com> Date: 星期四, 27 六月 2024 14:22:18 +0800 Subject: [PATCH] 用户通用列表 --- project-enforce/src/main/java/com/project/enforce/service/impl/EnforceComplaintLogServiceImpl.java | 97 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 96 insertions(+), 1 deletions(-) diff --git a/project-enforce/src/main/java/com/project/enforce/service/impl/EnforceComplaintLogServiceImpl.java b/project-enforce/src/main/java/com/project/enforce/service/impl/EnforceComplaintLogServiceImpl.java index a1083fb..52e6bee 100644 --- a/project-enforce/src/main/java/com/project/enforce/service/impl/EnforceComplaintLogServiceImpl.java +++ b/project-enforce/src/main/java/com/project/enforce/service/impl/EnforceComplaintLogServiceImpl.java @@ -4,18 +4,27 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.project.common.core.domain.entity.SysUser; +import com.project.common.exception.base.BaseException; +import com.project.common.utils.DateUtils; +import com.project.common.utils.SecurityUtils; import com.project.common.utils.StringUtils; import com.project.enforce.domain.EnforceComplaintLog; +import com.project.enforce.domain.bo.editBo.ComplaintResultBo; import com.project.enforce.domain.bo.editBo.EnforceComplaintLogBo; import com.project.enforce.domain.bo.queryBo.EnforceComplaintLogQueryBo; import com.project.enforce.domain.vo.EnforceComplaintLogVo; +import com.project.enforce.domain.vo.OrderNodeVo; import com.project.enforce.mapper.EnforceComplaintLogMapper; import com.project.enforce.service.IEnforceComplaintLogService; +import com.project.system.service.ISysDeptService; +import com.project.system.service.ISysUserService; import lombok.RequiredArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -28,6 +37,8 @@ @RequiredArgsConstructor(onConstructor_ = @Autowired) public class EnforceComplaintLogServiceImpl extends ServiceImpl<EnforceComplaintLogMapper, EnforceComplaintLog> implements IEnforceComplaintLogService { + private final ISysDeptService deptService; + private final ISysUserService userService; @Override//鍒楄〃鏌ヨ @@ -74,13 +85,97 @@ return this.removeByIds(ids); } + @Override//鎶曡瘔鍗曡妭鐐� + public List<OrderNodeVo> orderNodeList(Long id) + { + List<OrderNodeVo> vos = new ArrayList<>(); + EnforceComplaintLog order = this.getById(id); + if (order.getComplaintTime()!=null){ + vos.add(new OrderNodeVo("鍙戣捣鎶曡瘔",order.getCompanyUser(),order.getCompanyName(),order.getComplaintTime(), null)); + } + if (order.getInTime()!=null && StringUtils.isNotEmpty(order.getInUser())){ + + vos.add(new OrderNodeVo("澶勭悊涓�",order.getInUser(), userService.getDeptNameByUserId(order.getInId()), order.getInTime(), null)); + } + if (order.getResultTime()!=null){ + if (order.getComplaintStatus()==-1){ + vos.add(new OrderNodeVo("宸查┏鍥�",order.getResultUser(),userService.getDeptNameByUserId(order.getResultId()),order.getResultTime(), order.getComplaintResult())); + } else { + vos.add(new OrderNodeVo("宸插姙缁�",order.getResultUser(),userService.getDeptNameByUserId(order.getResultId()),order.getResultTime(), order.getComplaintResult())); + } + } + return vos; + } + + @Override//鍝嶅簲鎶曡瘔 + @Transactional + public Boolean inComplaint(ComplaintResultBo bo) + { + SysUser loginUser = userService.selectUserById(SecurityUtils.getUserId()); + return this.update(lu() + .set(EnforceComplaintLog::getInId,loginUser.getUserId()) + .set(EnforceComplaintLog::getInUser,loginUser.getNickName()) + .set(EnforceComplaintLog::getInTime, DateUtils.getNowDate()) + .set(EnforceComplaintLog::getComplaintStatus, 1) + .eq(EnforceComplaintLog::getId, bo.getId()) + ); + } + + @Override//澶勭悊缁撴灉 + @Transactional + public Boolean doComplaint(ComplaintResultBo bo) + { + if (StringUtils.isEmpty(bo.getResult())){ + throw new BaseException("璇峰~鍐欏鐞嗙粨鏋�"); + } + SysUser loginUser = userService.selectUserById(SecurityUtils.getUserId()); + return this.update(lu() + .set(EnforceComplaintLog::getResultId,loginUser.getUserId()) + .set(EnforceComplaintLog::getResultUser,loginUser.getNickName()) + .set(EnforceComplaintLog::getResultTime, DateUtils.getNowDate()) + .set(EnforceComplaintLog::getComplaintStatus, bo.getComplaintStatus()) + .set(EnforceComplaintLog::getComplaintResult, bo.getResult()) + .eq(EnforceComplaintLog::getId, bo.getId()) + ); + } + //------------------------------------------------------------------------------------- //淇濆瓨鍓嶆牎楠� private void validEntityBeforeSave(EnforceComplaintLog entity) { - //鍋氫竴浜涙暟鎹牎楠�,濡傚敮涓�绾︽潫 + if (StringUtils.isEmpty(entity.getExecuteDeptName()) && entity.getExecuteDeptName()!=null){ + entity.setExecuteDeptName(deptService.getDeptAllName(entity.getExecuteDeptId())); + } + if (entity.getId()==null){ + if (entity.getCompanyId()==null + || StringUtils.isEmpty(entity.getCompanyName()) + || StringUtils.isEmpty(entity.getCompanyUser()) + || StringUtils.isEmpty(entity.getCompanyPhone()) + ){ + throw new BaseException("鎶曡瘔浼佷笟涓嶈兘涓虹┖锛�"); + } + if (entity.getExecuteDeptId() == null + || StringUtils.isEmpty(entity.getExecuteDeptName()) + ){ + throw new BaseException("鎶曡瘔鍗曚綅涓嶈兘涓虹┖锛�"); + } + if (StringUtils.isEmpty(entity.getComplaintType())){ + throw new BaseException("璇烽�夋嫨瑕佹姇璇夌被鍨嬶紒"); + } + if (StringUtils.isEmpty(entity.getComplaintReason())){ + throw new BaseException("璇峰~鍐欐姇璇夊唴瀹癸紒"); + } + + if (entity.getOrderId()!=null){ //鎵ф硶鍗曟姇璇� + int count = this.count(lq().eq(EnforceComplaintLog::getOrderId, entity.getOrderId())); + if (count >0){ + throw new BaseException("璇ユ墽娉曞崟宸叉姇璇夛紒"); + } + } + entity.setComplaintTime(DateUtils.getNowDate()); + } } //鑾峰彇鏌ヨ鍙傛暟 -- Gitblit v1.9.1