From 573123827763851bba3ac301aba7515ff4ae037b Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期一, 24 二月 2025 17:42:04 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintFlowServiceImpl.java | 67 +++++++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 0 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 new file mode 100644 index 0000000..a97576b --- /dev/null +++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintFlowServiceImpl.java @@ -0,0 +1,67 @@ +package com.panzhihua.sangeshenbian.service.impl; + +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.*; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * <p> + * 诉求流转记录表 服务实现类 + * </p> + * + * @author + * @since 2025-02-22 + */ +@Service +@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +public class ComplaintFlowServiceImpl extends ServiceImpl<ComplaintFlowMapper, ComplaintFlow> implements IComplaintFlowService { + private final 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