From 8a0022d75b03edc6070fea46b55c9b63ef533281 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期一, 24 二月 2025 19:05:26 +0800 Subject: [PATCH] 修改管理后台bug --- springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintFlowServiceImpl.java | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 54 insertions(+), 2 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintFlowServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintFlowServiceImpl.java index c2bbbcc..e08bc6a 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintFlowServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintFlowServiceImpl.java @@ -1,10 +1,19 @@ package com.panzhihua.sangeshenbian.service.impl; -import com.panzhihua.sangeshenbian.entity.ComplaintFlow; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.panzhihua.common.exceptions.ServiceException; +import com.panzhihua.sangeshenbian.enums.ReportTypeEnum; +import com.panzhihua.sangeshenbian.model.entity.*; import com.panzhihua.sangeshenbian.dao.ComplaintFlowMapper; -import com.panzhihua.sangeshenbian.service.IComplaintFlowService; +import com.panzhihua.sangeshenbian.service.*; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; /** * <p> @@ -15,6 +24,49 @@ * @since 2025-02-22 */ @Service +@RequiredArgsConstructor public class ComplaintFlowServiceImpl extends ServiceImpl<ComplaintFlowMapper, ComplaintFlow> implements IComplaintFlowService { + @Lazy + @Resource + private IComplaintService complaintService; + private final IBcRegionService bcRegionService; + private final IComStreetService comStreetService; + private final IComActService comActService; + + + @Override + public void createFlow(Long complaintId , Integer type, Long userId) { + Complaint complaint = complaintService.getById(complaintId); + Integer reportType = complaint.getReportType(); + + String name = getFlowName(reportType, complaint); + + ComplaintFlow complaintFlow = new ComplaintFlow(); + complaintFlow.setComplaintId(complaintId); + complaintFlow.setLevel(reportType); + complaintFlow.setName(name); + complaintFlow.setCreateTime(new Date(System.currentTimeMillis())); + complaintFlow.setType(type); + save(complaintFlow); + } + + private String getFlowName(Integer reportType, Complaint complaint) { + String name; + if (reportType == ReportTypeEnum.COMMUNITY.getCode()) { + ComAct byId = comActService.getById(complaint.getSuperiorId()); + name = byId.getName(); + }else if (reportType == ReportTypeEnum.STREET.getCode()) { + ComStreet comStreet = comStreetService.getById(complaint.getSuperiorId()); + name = comStreet.getName(); + } else if (reportType == ReportTypeEnum.CITY.getCode() || reportType == ReportTypeEnum.DISTRICT.getCode()){ + BcRegion bcRegion = bcRegionService.getOne(new LambdaQueryWrapper<BcRegion>() + .eq(BcRegion::getRegionCode, complaint.getSuperiorId())); + name = bcRegion.getRegionName(); + } else { + // 处理未预期的账号等级 + throw new ServiceException("未知的账号等级"); + } + return name; + } } -- Gitblit v1.7.1