增加工单看板功能
Some checks are pending
Gitea Actions Demo / Explore-Gitea-Actions (push) Waiting to run

This commit is contained in:
2025-07-23 20:52:32 +08:00
parent a24c9dce47
commit 31291b4413
40 changed files with 593 additions and 130 deletions

View File

@@ -9,6 +9,7 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
@@ -28,8 +29,8 @@ public class EnumFetcherController {
*/
@GetMapping("/enum-values/{name}")
public R<Map<Object, Object>> getEnumValues(@PathVariable("name") String name) {
Map<Object, Object> map = enumFetcherService.getEnumValues(name);
public R<List<Map<Object, Object>>> getEnumValues(@PathVariable("name") String name) {
List<Map<Object, Object>> map = enumFetcherService.getEnumValues(name);
return R.ok(map);
}
}

View File

@@ -0,0 +1,51 @@
package org.dromara.property.domain;
import org.dromara.common.tenant.core.TenantEntity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serial;
/**
* 客户服务-应急预案审核记录对象 customer_contingen_plan_record
*
* @author mocheng
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("customer_contingen_plan_record")
public class CustomerContingenPlanRecord extends TenantEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(value = "id")
private Long id;
/**
* 工单id
*/
private Long contingenPlanId;
/**
* 状态(0.待审核1.待进行2.已完成)
*/
private String status;
/**
* 责任人
*/
private Long dutyPersion;
/**
* 搜索值
*/
private String searchValue;
}

View File

@@ -42,6 +42,14 @@ public class ResidentPerson extends TenantEntity {
* 联系电话
*/
private String phone;
/**
* 身份证号
*/
private String idCard;
/**
* 邮箱
*/
private String email;
/**
* 性别

View File

@@ -0,0 +1,53 @@
package org.dromara.property.domain.bo;
import org.dromara.property.domain.CustomerContingenPlanRecord;
import org.dromara.common.mybatis.core.domain.BaseEntity;
import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import lombok.EqualsAndHashCode;
import jakarta.validation.constraints.*;
/**
* 客户服务-应急预案审核记录业务对象 customer_contingen_plan_record
*
* @author mocheng
* @date 2025-07-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = CustomerContingenPlanRecord.class, reverseConvertGenerate = false)
public class CustomerContingenPlanRecordBo extends BaseEntity {
/**
* id
*/
@NotNull(message = "id不能为空", groups = { EditGroup.class })
private Long id;
/**
* 工单id
*/
@NotNull(message = "工单id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long contingenPlanId;
/**
* 状态(0.待审核1.待进行2.已完成)
*/
@NotBlank(message = "状态(0.待审核1.待进行2.已完成)不能为空", groups = { AddGroup.class, EditGroup.class })
private String status;
/**
* 责任人
*/
@NotNull(message = "责任人不能为空", groups = { AddGroup.class, EditGroup.class })
private Long dutyPersion;
/**
* 搜索值
*/
private String searchValue;
}

View File

@@ -30,7 +30,7 @@ public class ResidentPersonBo extends BaseEntity {
/**
* 用户id
*/
@NotNull(message = "用户id不能为空", groups = { AddGroup.class, EditGroup.class })
private Long userId;
/**
@@ -44,7 +44,10 @@ public class ResidentPersonBo extends BaseEntity {
*/
@NotBlank(message = "联系电话不能为空", groups = { AddGroup.class, EditGroup.class })
private String phone;
/**
* 邮箱
*/
private String email;
/**
* 性别
*/

View File

@@ -0,0 +1,67 @@
package org.dromara.property.domain.vo;
import org.dromara.property.domain.CustomerContingenPlanRecord;
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import org.dromara.common.excel.annotation.ExcelDictFormat;
import org.dromara.common.excel.convert.ExcelDictConvert;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
/**
* 客户服务-应急预案审核记录视图对象 customer_contingen_plan_record
*
* @author mocheng
* @date 2025-07-23
*/
@Data
@ExcelIgnoreUnannotated
@AutoMapper(target = CustomerContingenPlanRecord.class)
public class CustomerContingenPlanRecordVo implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
/**
* id
*/
@ExcelProperty(value = "id")
private Long id;
/**
* 工单id
*/
@ExcelProperty(value = "工单id")
private Long contingenPlanId;
/**
* 状态(0.待审核1.待进行2.已完成)
*/
@ExcelProperty(value = "状态(0.待审核1.待进行2.已完成)")
private String status;
/**
* 责任人
*/
@ExcelProperty(value = "责任人")
private Long dutyPersion;
/**
* 责任人姓名
*/
@ExcelProperty(value = "责任人姓名")
private String dutyPersionName;
/**
* 创建时间
*/
@ExcelProperty(value = "创建时间")
private Date createTime;
}

View File

@@ -9,7 +9,7 @@ import org.dromara.property.domain.CustomerContingenPlan;
import java.io.Serial;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@@ -98,6 +98,9 @@ public class CustomerContingenPlanVo implements Serializable {
*/
@ExcelProperty(value = "最后更新时间")
private Date updateTime;
/**
* 预案记录列表
*/
List<CustomerContingenPlanRecordVo> contingenPlanRecordVos;
}

View File

@@ -52,6 +52,11 @@ public class CustomerNoticesVo implements Serializable {
*/
@ExcelProperty(value = "通知人")
private String noticePersion;
/**
* 通知人姓名
*/
@ExcelProperty(value = "通知人姓名")
private String noticePersionName;
/**
* 备注
@@ -88,6 +93,11 @@ public class CustomerNoticesVo implements Serializable {
*/
@ExcelProperty(value = "发布人")
private Long issuers;
/**
* 发布人姓名
*/
@ExcelProperty(value = "发布人姓名")
private String issuersName;
/**
* 搜索值

View File

@@ -49,7 +49,10 @@ public class ResidentPersonVo implements Serializable {
*/
@ExcelProperty(value = "联系电话")
private String phone;
/**
* 邮箱
*/
private String email;
/**
* 性别
*/

View File

@@ -5,9 +5,10 @@ import lombok.experimental.Accessors;
import java.util.List;
@Accessors(chain = true)
@Data
@Accessors(chain = true)
public class ServiceWorkOrderAnalysisVo {
/**
* 工单看板当前周折线图
*/
@@ -18,12 +19,29 @@ public class ServiceWorkOrderAnalysisVo {
private String dayOfWeek;
private long count;
public LineChartVo() {}
public LineChartVo(String date, String dayOfWeek, long count) {
this.date = date;
this.dayOfWeek = dayOfWeek;
this.count = count;
}
}
@Data
@Accessors(chain = true)
public static class BarChartVo {
private String month; // 月份,如 "2025-02"
private int orderCount; // 工单数量
}
/**
* 满意度图表数据对象
*/
@Data
@Accessors(chain = true)
public static class SatisfactionChartVo {
private String name; // 满意度名称:如“满意”
private Long value; // 数量
private Double rate; // 占比(百分比)
}
/**
@@ -33,18 +51,30 @@ public class ServiceWorkOrderAnalysisVo {
@Accessors(chain = true)
public static class PieChartVo {
private String type; // 工单类型
private Long quantity; // 工单类型
private Long quantity; // 工单数量
private double percentage; // 占比
public PieChartVo(String type, Long quantity, double percentage) {
this.type = type;
this.quantity = quantity;
this.percentage = percentage;
public PieChartVo(String string, Long count, double percentage) {
}
// Getters and Setters
}
private int workOrdersTotal;
private int notWorkOrdersTotal;
private int novertimeOrdersTotal;
private int inHandOrdersTotal;
private double novertimeOrdersRate;
private int monthOrdersTotal;
private int outTimeOrdersTotal;
private double monthoSatisfaction;
private int satisfaction;
private List<LineChartVo> recentWeekWorkOrders;
private List<SatisfactionChartVo> satisfactionRateList;
private List<PieChartVo> satisfactionChartList;
private List<BarChartVo> recentSixMonthWorkOrders;
// 私有构造函数确保使用Builder模式构建对象
private ServiceWorkOrderAnalysisVo() {}
// Builder Pattern for ServiceWorkOrderAnalysisVo
@Data
@Accessors(chain = true)
@@ -59,24 +89,9 @@ public class ServiceWorkOrderAnalysisVo {
private double monthoSatisfaction;
private int satisfaction;
private List<LineChartVo> recentWeekWorkOrders;
private List<PieChartVo> workOrderTypeDistribution;
// Setters
public ServiceWorkOrderCount setWorkOrdersTotal(int workOrdersTotal) {
this.workOrdersTotal = workOrdersTotal;
return this;
}
// ...其他Setter...
public ServiceWorkOrderCount setRecentWeekWorkOrders(List<LineChartVo> recentWeekWorkOrders) {
this.recentWeekWorkOrders = recentWeekWorkOrders;
return this;
}
public ServiceWorkOrderCount setWorkOrderTypeDistribution(List<PieChartVo> workOrderTypeDistribution) {
this.workOrderTypeDistribution = workOrderTypeDistribution;
return this;
}
private List<SatisfactionChartVo> satisfactionRateList;
private List<PieChartVo> satisfactionChartList;
private List<BarChartVo> recentSixMonthWorkOrders;
public ServiceWorkOrderAnalysisVo build() {
ServiceWorkOrderAnalysisVo vo = new ServiceWorkOrderAnalysisVo();
@@ -90,26 +105,10 @@ public class ServiceWorkOrderAnalysisVo {
vo.monthoSatisfaction = this.monthoSatisfaction;
vo.satisfaction = this.satisfaction;
vo.recentWeekWorkOrders = this.recentWeekWorkOrders;
vo.workOrderTypeDistribution = this.workOrderTypeDistribution;
vo.satisfactionRateList = this.satisfactionRateList;
vo.satisfactionChartList = this.satisfactionChartList;
vo.recentSixMonthWorkOrders = this.recentSixMonthWorkOrders;
return vo;
}
}
private int workOrdersTotal;
private int notWorkOrdersTotal;
private int novertimeOrdersTotal;
private int inHandOrdersTotal;
private double novertimeOrdersRate;
private int monthOrdersTotal;
private int outTimeOrdersTotal;
private double monthoSatisfaction;
private int satisfaction;
private List<LineChartVo> recentWeekWorkOrders;
private List<PieChartVo> workOrderTypeDistribution;
// Constructor is private to enforce use of builder pattern
public ServiceWorkOrderAnalysisVo() {
}
// Getters...
}

View File

@@ -0,0 +1,17 @@
package org.dromara.property.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.dromara.property.domain.CustomerContingenPlanRecord;
import org.dromara.property.domain.vo.CustomerContingenPlanRecordVo;
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
/**
* 客户服务-应急预案审核记录Mapper接口
*
* @author mocheng
* @date 2025-07-23
*/
@Mapper
public interface CustomerContingenPlanRecordMapper extends BaseMapperPlus<CustomerContingenPlanRecord, CustomerContingenPlanRecordVo> {
}

View File

@@ -1,5 +1,6 @@
package org.dromara.property.service;
import java.util.List;
import java.util.Map;
/**
@@ -13,5 +14,5 @@ public interface EnumFetcherService {
* @param type 大驼峰格式
* @return
*/
Map<Object, Object>getEnumValues(String type);
List<Map<Object, Object>> getEnumValues(String type);
}

View File

@@ -65,4 +65,5 @@ public interface ICustomerContingenPlanService {
* @return 是否删除成功
*/
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
}

View File

@@ -72,5 +72,5 @@ public interface IMeetAttachService {
* 获取下拉接口数据
* @param type
*/
Map<Object, Object> getMeetAttachSelectDate(String type);
List<Map<Object, Object>> getMeetAttachSelectDate(String type);
}

View File

@@ -84,6 +84,6 @@ public interface IMeetBookingService {
* @param type
* @return
*/
Map<Object, Object> getMeetBooking(String type);
List<Map<Object, Object>> getMeetBooking(String type);
}

View File

@@ -72,5 +72,5 @@ public interface IMeetService {
* 获取下拉接口数据
* @param type
*/
Map<Object,Object> getMeetSelectDate(String type);
List<Map<Object, Object>> getMeetSelectDate(String type);
}

View File

@@ -171,6 +171,7 @@ public class CostCarChargeServiceImpl implements ICostCarChargeService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(CostCarChargeBo bo) {
CostCarCharge update = MapstructUtils.convert(bo, CostCarCharge.class);
validEntityBeforeSave(update);
@@ -192,6 +193,7 @@ public class CostCarChargeServiceImpl implements ICostCarChargeService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -211,7 +211,6 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -16,6 +16,7 @@ import org.dromara.property.domain.vo.CostItemsVo;
import org.dromara.property.domain.CostItems;
import org.dromara.property.mapper.CostItemsMapper;
import org.dromara.property.service.ICostItemsService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -98,6 +99,7 @@ public class CostItemsServiceImpl implements ICostItemsService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(CostItemsBo bo) {
CostItems add = MapstructUtils.convert(bo, CostItems.class);
add.setChargeNo( RandomUtil.randomNumbers(11));
@@ -116,6 +118,7 @@ public class CostItemsServiceImpl implements ICostItemsService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(CostItemsBo bo) {
CostItems update = MapstructUtils.convert(bo, CostItems.class);
validEntityBeforeSave(update);
@@ -137,6 +140,7 @@ public class CostItemsServiceImpl implements ICostItemsService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.CostMeterTypeVo;
import org.dromara.property.domain.CostMeterType;
import org.dromara.property.mapper.CostMeterTypeMapper;
import org.dromara.property.service.ICostMeterTypeService;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -87,6 +88,7 @@ public class CostMeterTypeServiceImpl implements ICostMeterTypeService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(CostMeterTypeBo bo) {
CostMeterType add = MapstructUtils.convert(bo, CostMeterType.class);
validEntityBeforeSave(add);
@@ -104,6 +106,7 @@ public class CostMeterTypeServiceImpl implements ICostMeterTypeService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(CostMeterTypeBo bo) {
CostMeterType update = MapstructUtils.convert(bo, CostMeterType.class);
validEntityBeforeSave(update);
@@ -125,6 +128,7 @@ public class CostMeterTypeServiceImpl implements ICostMeterTypeService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -16,6 +16,7 @@ import org.dromara.property.domain.vo.CostMeterWaterVo;
import org.dromara.property.domain.CostMeterWater;
import org.dromara.property.mapper.CostMeterWaterMapper;
import org.dromara.property.service.ICostMeterWaterService;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
@@ -94,6 +95,7 @@ public class CostMeterWaterServiceImpl implements ICostMeterWaterService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(CostMeterWaterBo bo) {
CostMeterWater add = MapstructUtils.convert(bo, CostMeterWater.class);
add.setCurReadingTime(new Date());
@@ -112,6 +114,7 @@ public class CostMeterWaterServiceImpl implements ICostMeterWaterService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(CostMeterWaterBo bo) {
CostMeterWater update = MapstructUtils.convert(bo, CostMeterWater.class);
validEntityBeforeSave(update);
@@ -133,6 +136,7 @@ public class CostMeterWaterServiceImpl implements ICostMeterWaterService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -21,6 +21,7 @@ import org.dromara.property.domain.vo.*;
import org.dromara.property.mapper.*;
import org.dromara.property.service.ICostPayFeeAuditService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@@ -135,6 +136,7 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(CostPayFeeAuditBo bo) {
CostPayFeeAudit add = MapstructUtils.convert(bo, CostPayFeeAudit.class);
validEntityBeforeSave(add);
@@ -152,6 +154,7 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(CostPayFeeAuditBo bo) {
CostPayFeeAudit update = MapstructUtils.convert(bo, CostPayFeeAudit.class);
validEntityBeforeUpdate(update);
@@ -204,6 +207,7 @@ public class CostPayFeeAuditServiceImpl implements ICostPayFeeAuditService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -20,6 +20,7 @@ import org.dromara.property.mapper.CostHouseChargeMapper;
import org.dromara.property.mapper.CostReturnPayFeeMapper;
import org.dromara.property.service.ICostReturnPayFeeService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -100,6 +101,7 @@ public class CostReturnPayFeeServiceImpl implements ICostReturnPayFeeService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(CostReturnPayFeeBo bo) {
CostReturnPayFee add = MapstructUtils.convert(bo, CostReturnPayFee.class);
validEntityBeforeSave(add);
@@ -117,6 +119,7 @@ public class CostReturnPayFeeServiceImpl implements ICostReturnPayFeeService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(CostReturnPayFeeBo bo) {
CostReturnPayFee update = MapstructUtils.convert(bo, CostReturnPayFee.class);
validEntityBeforeUpdate(update);

View File

@@ -11,15 +11,20 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.property.domain.CustomerContingenPlan;
import org.dromara.property.domain.CustomerContingenPlanRecord;
import org.dromara.property.domain.ResidentPerson;
import org.dromara.property.domain.bo.CustomerContingenPlanBo;
import org.dromara.property.domain.vo.CustomerContingenPlanRecordVo;
import org.dromara.property.domain.vo.CustomerContingenPlanVo;
import org.dromara.property.domain.vo.ResidentUnitVo;
import org.dromara.property.mapper.CustomerContingenPlanMapper;
import org.dromara.property.mapper.CustomerContingenPlanRecordMapper;
import org.dromara.property.mapper.ResidentPersonMapper;
import org.dromara.property.service.ICustomerContingenPlanService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -38,6 +43,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
private final CustomerContingenPlanMapper baseMapper;
private final ResidentPersonMapper residentPersonMapper;
private final CustomerContingenPlanRecordMapper customerContingenPlanRecordMapper;
/**
* 查询客户服务-应急预案
@@ -49,9 +55,18 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
public CustomerContingenPlanVo queryById(Long id) {
CustomerContingenPlanVo customerContingenPlanVo = baseMapper.selectVoById(id);
ResidentPerson residentPerson = residentPersonMapper.selectById(customerContingenPlanVo.getInitiat());
customerContingenPlanVo.setInitiatName(ObjectUtil.isNotEmpty(residentPerson)?residentPerson.getUserName():null);
customerContingenPlanVo.setInitiatName(ObjectUtil.isNotEmpty(residentPerson) ? residentPerson.getUserName() : null);
ResidentPerson dutyPerson = residentPersonMapper.selectById(customerContingenPlanVo.getDutyPersion());
customerContingenPlanVo.setDutyPersionName(ObjectUtil.isNotEmpty(residentPerson)?dutyPerson.getUserName():null);
customerContingenPlanVo.setDutyPersionName(ObjectUtil.isNotEmpty(residentPerson) ? dutyPerson.getUserName() : null);
LambdaQueryWrapper<CustomerContingenPlanRecord> recordQueryWrapper = new LambdaQueryWrapper<>();
recordQueryWrapper.eq(CustomerContingenPlanRecord::getContingenPlanId, id);
List<CustomerContingenPlanRecordVo> contingenPlanRecordVos = customerContingenPlanRecordMapper.selectVoList(recordQueryWrapper);
if (CollUtil.isNotEmpty(contingenPlanRecordVos)) {
contingenPlanRecordVos.stream().forEach(s -> {
s.setDutyPersionName(customerContingenPlanVo.getDutyPersionName());
});
customerContingenPlanVo.setContingenPlanRecordVos(contingenPlanRecordVos);
}
return customerContingenPlanVo;
}
@@ -71,10 +86,10 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
result.getRecords().stream().forEach(s -> {
ResidentPerson residentInitiatVo = residentPeoplelist.stream()
.filter(vo -> vo.getId() != null && vo.getId().equals(s.getInitiat())).findFirst().orElse(null);
s.setInitiatName(ObjectUtil.isNotEmpty(residentInitiatVo)?residentInitiatVo.getUserName():null);
s.setInitiatName(ObjectUtil.isNotEmpty(residentInitiatVo) ? residentInitiatVo.getUserName() : null);
ResidentPerson residentDutyVo = residentPeoplelist.stream()
.filter(vo -> vo.getId() != null && vo.getId().equals(s.getDutyPersion())).findFirst().orElse(null);
s.setDutyPersionName(ObjectUtil.isNotEmpty(residentDutyVo)?residentDutyVo.getUserName():null);
s.setDutyPersionName(ObjectUtil.isNotEmpty(residentDutyVo) ? residentDutyVo.getUserName() : null);
});
}
return TableDataInfo.build(result);
@@ -97,6 +112,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
LambdaQueryWrapper<CustomerContingenPlan> lqw = Wrappers.lambdaQuery();
lqw.orderByAsc(CustomerContingenPlan::getId);
lqw.eq(StringUtils.isNotBlank(bo.getContingenPlanType()), CustomerContingenPlan::getContingenPlanType, bo.getContingenPlanType());
lqw.eq(ObjectUtil.isNotEmpty(bo.getDutyPersion()), CustomerContingenPlan::getDutyPersion, bo.getDutyPersion());
lqw.like(StringUtils.isNotBlank(bo.getContingenPlanName()), CustomerContingenPlan::getContingenPlanName, bo.getContingenPlanName());
lqw.eq(StringUtils.isNotBlank(bo.getContingenPlanContent()), CustomerContingenPlan::getContingenPlanContent, bo.getContingenPlanContent());
lqw.eq(ObjectUtil.isNotEmpty(bo.getInitiat()), CustomerContingenPlan::getInitiat, bo.getInitiat());
@@ -112,6 +128,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(CustomerContingenPlanBo bo) {
CustomerContingenPlan add = MapstructUtils.convert(bo, CustomerContingenPlan.class);
add.setStatus("0");
@@ -119,6 +136,11 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
CustomerContingenPlanRecord customerContingenPlanRecord = new CustomerContingenPlanRecord();
customerContingenPlanRecord.setStatus(add.getStatus());
customerContingenPlanRecord.setContingenPlanId(add.getId());
customerContingenPlanRecord.setDutyPersion(add.getDutyPersion());
customerContingenPlanRecordMapper.insert(customerContingenPlanRecord);
}
return flag;
}
@@ -130,9 +152,10 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(CustomerContingenPlanBo bo) {
CustomerContingenPlan update = MapstructUtils.convert(bo, CustomerContingenPlan.class);
validEntityBeforeSave(update);
validEntityBeforeUpdate(update);
return baseMapper.updateById(update) > 0;
}
@@ -143,6 +166,23 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
//TODO 做一些数据校验,如唯一约束
}
/**
* 保存前的数据校验
*/
private void validEntityBeforeUpdate(CustomerContingenPlan entity) {
//TODO 做一些数据校验,如唯一约束
boolean exists = customerContingenPlanRecordMapper.exists(new LambdaQueryWrapper<CustomerContingenPlanRecord>()
.eq(CustomerContingenPlanRecord::getContingenPlanId, entity.getId())
.eq(CustomerContingenPlanRecord::getStatus, entity.getStatus()));
if (!exists) {
CustomerContingenPlanRecord customerContingenPlanRecord = new CustomerContingenPlanRecord();
customerContingenPlanRecord.setStatus(entity.getStatus());
customerContingenPlanRecord.setContingenPlanId(entity.getId());
customerContingenPlanRecord.setDutyPersion(entity.getDutyPersion());
customerContingenPlanRecordMapper.insert(customerContingenPlanRecord);
}
}
/**
* 校验并批量删除客户服务-应急预案信息
*
@@ -151,6 +191,7 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.CustomerFeedbacksVo;
import org.dromara.property.mapper.CustomerFeedbacksMapper;
import org.dromara.property.service.ICustomerFeedbacksService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -94,6 +95,7 @@ public class CustomerFeedbacksServiceImpl implements ICustomerFeedbacksService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(CustomerFeedbacksBo bo) {
CustomerFeedbacks add = MapstructUtils.convert(bo, CustomerFeedbacks.class);
validEntityBeforeSave(add);
@@ -111,6 +113,7 @@ public class CustomerFeedbacksServiceImpl implements ICustomerFeedbacksService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(CustomerFeedbacksBo bo) {
CustomerFeedbacks update = MapstructUtils.convert(bo, CustomerFeedbacks.class);
validEntityBeforeSave(update);

View File

@@ -1,7 +1,10 @@
package org.dromara.property.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.ObjectUtil;
import org.apache.dubbo.config.annotation.DubboReference;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.utils.MapstructUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -11,14 +14,19 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.property.domain.ResidentPerson;
import org.dromara.property.domain.vo.ResidentUnitVo;
import org.dromara.property.mapper.ResidentPersonMapper;
import org.dromara.resource.api.RemoteMessageService;
import org.dromara.system.api.model.LoginUser;
import org.springframework.stereotype.Service;
import org.dromara.property.domain.bo.CustomerNoticesBo;
import org.dromara.property.domain.vo.CustomerNoticesVo;
import org.dromara.property.domain.CustomerNotices;
import org.dromara.property.mapper.CustomerNoticesMapper;
import org.dromara.property.service.ICustomerNoticesService;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
@@ -49,7 +57,7 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
* @return 客户服务-通知公告
*/
@Override
public CustomerNoticesVo queryById(Long id){
public CustomerNoticesVo queryById(Long id) {
return baseMapper.selectVoById(id);
}
@@ -64,6 +72,28 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
public TableDataInfo<CustomerNoticesVo> queryPageList(CustomerNoticesBo bo, PageQuery pageQuery) {
LambdaQueryWrapper<CustomerNotices> lqw = buildQueryWrapper(bo);
Page<CustomerNoticesVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
if (CollUtil.isNotEmpty(result.getRecords())) {
List<ResidentPerson> residentPeople = residentPersonMapper.selectList();
if (CollUtil.isNotEmpty(residentPeople)) {
result.getRecords().stream().forEach(s -> {
ResidentPerson residentPerson = residentPeople.stream()
.filter(vo -> vo.getId() != null && vo.getId().equals(s.getIssuers())).findFirst().orElse(null);
s.setIssuersName(residentPerson.getUserName());
if (ObjectUtil.isNotEmpty(s.getNoticePersion())) {
List<String> list = Arrays.asList(s.getNoticePersion().split(","));
List<ResidentPerson> filteredList = residentPeople.stream()
.filter(person -> list.contains(person.getId().toString()))
.collect(Collectors.toList());
String usernames = filteredList.stream()
.map(ResidentPerson::getUserName) // 假设ResidentPerson类有一个getUserName方法
.collect(Collectors.joining(","));
s.setIssuersName(usernames);
}
});
}
}
return TableDataInfo.build(result);
}
@@ -100,21 +130,22 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(CustomerNoticesBo bo) {
CustomerNotices add = MapstructUtils.convert(bo, CustomerNotices.class);
validEntityBeforeSave(add);
boolean flag = baseMapper.insert(add) > 0;
if (flag) {
bo.setId(add.getId());
if(bo.getIsAll().equals("0")){
if (bo.getIsAll().equals("0")) {
remoteMessageService.publishAll(bo.getTitle());
}
if(bo.getIsAll().equals("1") && ObjectUtil.isNotEmpty(bo.getNoticePersion())){
if (bo.getIsAll().equals("1") && ObjectUtil.isNotEmpty(bo.getNoticePersion())) {
String[] noticePersion = bo.getNoticePersion().split(",");
List<Long> userIdList = Arrays.stream(noticePersion)
.map(Long::valueOf)
.collect(Collectors.toList());
remoteMessageService.publishMessage(userIdList,bo.getTitle());
remoteMessageService.publishMessage(userIdList, bo.getTitle());
}
}
return flag;
@@ -127,6 +158,7 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(CustomerNoticesBo bo) {
CustomerNotices update = MapstructUtils.convert(bo, CustomerNotices.class);
validEntityBeforeUpdate(update);
@@ -136,15 +168,22 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
/**
* 保存前的数据校验
*/
private void validEntityBeforeSave(CustomerNotices entity){
private void validEntityBeforeSave(CustomerNotices entity) {
//TODO 做一些数据校验,如唯一约束
LoginUser user = LoginHelper.getLoginUser();
ResidentPerson residentPerson = residentPersonMapper.selectOne(new LambdaQueryWrapper<ResidentPerson>()
.eq(ResidentPerson::getUserId, user.getUserId()));
Assert.isTrue(ObjectUtil.isNotEmpty(residentPerson), "该发布人未入住");
entity.setIssuers(residentPerson.getId());
}
/**
* 修改前的数据校验
*/
private void validEntityBeforeUpdate(CustomerNotices entity){
private void validEntityBeforeUpdate(CustomerNotices entity) {
//TODO 做一些数据校验,如唯一约束
}
/**
* 校验并批量删除客户服务-通知公告信息
*
@@ -154,7 +193,7 @@ public class CustomerNoticesServiceImpl implements ICustomerNoticesService {
*/
@Override
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验
}
return baseMapper.deleteByIds(ids) > 0;

View File

@@ -12,6 +12,9 @@ import org.dromara.property.service.IMeetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@@ -31,7 +34,7 @@ public class EnumFetcherServiceImpl implements EnumFetcherService {
private IMeetBookingService meetBookingService;
@Override
public Map<Object, Object> getEnumValues(String type) {
public List<Map<Object, Object>> getEnumValues(String type) {
switch (type) {
case "getMeetName":
return meetService.getMeetSelectDate(type);
@@ -56,23 +59,48 @@ public class EnumFetcherServiceImpl implements EnumFetcherService {
}
}
Map<Object, Object> getMeetStatus() {
return java.util.Arrays.stream(MeetStatusEnum.values())
.collect(Collectors.toMap(MeetStatusEnum::getValue, MeetStatusEnum::getName));
List<Map<Object, Object>> getMeetStatus() {
return Arrays.stream(MeetStatusEnum.values())
.map(e -> {
Map<Object, Object> map = new HashMap<>();
map.put("value", e.getValue());
map.put("name", e.getName());
return map;
})
.collect(Collectors.toList());
}
Map<Object, Object> getMeetAttachStatus() {
return java.util.Arrays.stream(MeetAttachStatusEnum.values())
.collect(Collectors.toMap(MeetAttachStatusEnum::getValue, MeetAttachStatusEnum::getName));
List<Map<Object, Object>> getMeetAttachStatus() {
return Arrays.stream(MeetAttachStatusEnum.values())
.map(e -> {
Map<Object, Object> map = new HashMap<>();
map.put("value", e.getValue());
map.put("name", e.getName());
return map;
})
.collect(Collectors.toList());
}
Map<Object, Object> getMeetBookingPayStatus() {
return java.util.Arrays.stream(BookingPayStatusEnum.values())
.collect(Collectors.toMap(BookingPayStatusEnum::getValue, BookingPayStatusEnum::getName));
List<Map<Object, Object>> getMeetBookingPayStatus() {
return Arrays.stream(BookingPayStatusEnum.values())
.map(e -> {
Map<Object, Object> map = new HashMap<>();
map.put("value", e.getValue());
map.put("name", e.getName());
return map;
})
.collect(Collectors.toList());
}
Map<Object, Object> getMeetBookingStatus() {
return java.util.Arrays.stream(BookingStatusEnum.values())
.collect(Collectors.toMap(BookingStatusEnum::getValue, BookingStatusEnum::getName));
List<Map<Object, Object>> getMeetBookingStatus() {
return Arrays.stream(BookingStatusEnum.values())
.map(e -> {
Map<Object, Object> map = new HashMap<>();
map.put("value", e.getValue());
map.put("name", e.getName());
return map;
})
.collect(Collectors.toList());
}
}

View File

@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionItemVo;
import org.dromara.property.mapper.InspectionItemMapper;
import org.dromara.property.service.IInspectionItemService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -86,6 +87,7 @@ public class InspectionItemServiceImpl implements IInspectionItemService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(InspectionItemBo bo) {
InspectionItem add = MapstructUtils.convert(bo, InspectionItem.class);
validEntityBeforeSave(add);
@@ -103,6 +105,7 @@ public class InspectionItemServiceImpl implements IInspectionItemService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(InspectionItemBo bo) {
InspectionItem update = MapstructUtils.convert(bo, InspectionItem.class);
validEntityBeforeSave(update);
@@ -124,6 +127,7 @@ public class InspectionItemServiceImpl implements IInspectionItemService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -161,6 +161,7 @@ public class InspectionPlanServiceImpl implements IInspectionPlanService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(InspectionPlanBo bo) {
InspectionPlan update = MapstructUtils.convert(bo, InspectionPlan.class);
validEntityBeforeSave(update);
@@ -182,6 +183,7 @@ public class InspectionPlanServiceImpl implements IInspectionPlanService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if (isValid) {
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionPlanStaffVo;
import org.dromara.property.mapper.InspectionPlanStaffMapper;
import org.dromara.property.service.IInspectionPlanStaffService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -89,6 +90,7 @@ public class InspectionPlanStaffServiceImpl implements IInspectionPlanStaffServi
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(InspectionPlanStaffBo bo) {
InspectionPlanStaff add = MapstructUtils.convert(bo, InspectionPlanStaff.class);
validEntityBeforeSave(add);
@@ -106,6 +108,7 @@ public class InspectionPlanStaffServiceImpl implements IInspectionPlanStaffServi
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(InspectionPlanStaffBo bo) {
InspectionPlanStaff update = MapstructUtils.convert(bo, InspectionPlanStaff.class);
validEntityBeforeSave(update);
@@ -127,6 +130,7 @@ public class InspectionPlanStaffServiceImpl implements IInspectionPlanStaffServi
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -18,6 +18,7 @@ import org.dromara.property.mapper.InspectionPlanMapper;
import org.dromara.property.mapper.InspectionPointMapper;
import org.dromara.property.service.IInspectionPointService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@@ -104,6 +105,7 @@ public class InspectionPointServiceImpl implements IInspectionPointService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(InspectionPointBo bo) {
InspectionPoint add = MapstructUtils.convert(bo, InspectionPoint.class);
validEntityBeforeSave(add);
@@ -121,6 +123,7 @@ public class InspectionPointServiceImpl implements IInspectionPointService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(InspectionPointBo bo) {
InspectionPoint update = MapstructUtils.convert(bo, InspectionPoint.class);
validEntityBeforeSave(update);
@@ -142,6 +145,7 @@ public class InspectionPointServiceImpl implements IInspectionPointService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionRouteVo;
import org.dromara.property.mapper.InspectionRouteMapper;
import org.dromara.property.service.IInspectionRouteService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -86,6 +87,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(InspectionRouteBo bo) {
InspectionRoute add = MapstructUtils.convert(bo, InspectionRoute.class);
validEntityBeforeSave(add);
@@ -103,6 +105,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(InspectionRouteBo bo) {
InspectionRoute update = MapstructUtils.convert(bo, InspectionRoute.class);
validEntityBeforeSave(update);
@@ -124,6 +127,7 @@ public class InspectionRouteServiceImpl implements IInspectionRouteService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionStaffVo;
import org.dromara.property.mapper.InspectionStaffMapper;
import org.dromara.property.service.IInspectionStaffService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -89,6 +90,7 @@ public class InspectionStaffServiceImpl implements IInspectionStaffService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(InspectionStaffBo bo) {
InspectionStaff add = MapstructUtils.convert(bo, InspectionStaff.class);
validEntityBeforeSave(add);
@@ -106,6 +108,7 @@ public class InspectionStaffServiceImpl implements IInspectionStaffService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(InspectionStaffBo bo) {
InspectionStaff update = MapstructUtils.convert(bo, InspectionStaff.class);
validEntityBeforeSave(update);
@@ -127,6 +130,7 @@ public class InspectionStaffServiceImpl implements IInspectionStaffService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -15,6 +15,7 @@ import org.dromara.property.domain.vo.InspectionTaskDetailVo;
import org.dromara.property.mapper.InspectionTaskDetailMapper;
import org.dromara.property.service.IInspectionTaskDetailService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
@@ -95,6 +96,7 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(InspectionTaskDetailBo bo) {
InspectionTaskDetail add = MapstructUtils.convert(bo, InspectionTaskDetail.class);
validEntityBeforeSave(add);
@@ -112,6 +114,7 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(InspectionTaskDetailBo bo) {
InspectionTaskDetail update = MapstructUtils.convert(bo, InspectionTaskDetail.class);
validEntityBeforeSave(update);
@@ -133,6 +136,7 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -19,6 +19,7 @@ import org.dromara.property.mapper.InspectionTaskMapper;
import org.dromara.property.service.IInspectionTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Collection;
import java.util.List;
@@ -116,6 +117,7 @@ public class InspectionTaskServiceImpl implements IInspectionTaskService {
* @return 是否新增成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean insertByBo(InspectionTaskBo bo) {
InspectionTask add = MapstructUtils.convert(bo, InspectionTask.class);
validEntityBeforeSave(add);
@@ -133,6 +135,7 @@ public class InspectionTaskServiceImpl implements IInspectionTaskService {
* @return 是否修改成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean updateByBo(InspectionTaskBo bo) {
InspectionTask update = MapstructUtils.convert(bo, InspectionTask.class);
validEntityBeforeSave(update);
@@ -154,6 +157,8 @@ public class InspectionTaskServiceImpl implements IInspectionTaskService {
* @return 是否删除成功
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
if(isValid){
//TODO 做一些业务上的校验,判断是否需要校验

View File

@@ -145,18 +145,17 @@ public class MeetAttachServiceImpl implements IMeetAttachService {
* 下拉接口数据
*/
@Override
public Map<Object, Object> getMeetAttachSelectDate(String type){
public List<Map<Object, Object>> getMeetAttachSelectDate(String type){
switch (type) {
case "getMeetAttachName":
return getList().stream()
return (List<Map<Object, Object>>) getList().stream()
.collect(Collectors.toMap(
MeetAttach::getProjectName,
MeetAttach::getProjectName,
(oldValue, newValue) -> oldValue
));
case "getMeetAttachType":
return getList().stream()
return (List<Map<Object, Object>>) getList().stream()
.collect(Collectors.toMap(
MeetAttach::getType,
MeetAttach::getType,

View File

@@ -62,7 +62,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService {
meetBookingDetailVo.setLocationName(ObjectUtil.isNotEmpty(locationName)?locationName:null);
ResidentPersonVo residentPersonVo = residentPersonMapper.selectVoById(Long.valueOf(meetBookingVo.getPerson()));
meetBookingDetailVo.setPersonName(ObjectUtil.isNotEmpty(residentPersonVo)?residentPersonVo.getUserName():null);
meetBookingDetailVo.setPhone(residentPersonVo.getPhone());
meetBookingDetailVo.setPhone(ObjectUtil.isNotEmpty(residentPersonVo)?residentPersonVo.getPhone():null);
ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(Long.valueOf(meetBookingVo.getUnit()));
meetBookingDetailVo.setUnitName(ObjectUtil.isNotEmpty(residentPersonVo)?residentUnitVo.getName():null);
return meetBookingDetailVo;
@@ -119,7 +119,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService {
if (CollectionUtil.isEmpty(meetBookings)) {
return new ArrayList<>();
}
List<MeetBookingAppointmentVo> meetBookingAppointmentVoList = MapstructUtils.convert(meetBookings, MeetBookingAppointmentVo.class);
List<MeetBookingAppointmentVo> meetBookingAppointmentVoList = BeanUtil.copyToList(meetBookings, MeetBookingAppointmentVo.class);
SimpleDateFormat df = new SimpleDateFormat("HH");
List<ResidentUnitVo> residentUnitVolist = residentUnitMapper.selectVoList();
List<ResidentPersonVo> residentPersonsVolist = residentPersonMapper.selectVoList();
@@ -176,7 +176,7 @@ public class MeetBookingServiceImpl implements IMeetBookingService {
if (CollectionUtil.isEmpty(meetBookingVoList)) {
return new ArrayList<>();
}
List<MeetBookingWeekVo> meetBookingWeekVoList = MapstructUtils.convert(meetBookingVoList, MeetBookingWeekVo.class);
List<MeetBookingWeekVo> meetBookingWeekVoList = BeanUtil.copyToList(meetBookingVoList, MeetBookingWeekVo.class);
String[] weekStr = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
List<MeetBookingWeekVo> meetBookingWeekList = new ArrayList<>();
SimpleDateFormat df = new SimpleDateFormat("HH");
@@ -283,18 +283,22 @@ public class MeetBookingServiceImpl implements IMeetBookingService {
}
@Override
public Map<Object, Object> getMeetBooking(String type) {
switch (type) {
case "getMeetBookingPerson()":
return getList().stream()
.collect(Collectors.toMap(
MeetBooking::getPerson,
MeetBooking::getPerson,
(oldValue, newValue) -> oldValue
));
default:
throw new IllegalArgumentException("Unknown type: " + type);
}
public List<Map<Object, Object>> getMeetBooking(String type) {
return switch (type) {
case "getMeetBookingPerson" -> getList().stream()
.map(MeetBooking::getPerson)
.filter(Objects::nonNull)
.distinct()
.map(person -> {
Map<Object, Object> map = new HashMap<>();
map.put("value", person);
map.put("name", person);
return map;
})
.collect(Collectors.toList());
default -> throw new IllegalArgumentException("Unknown type: " + type);
};
}
public List<MeetBooking> getList() {

View File

@@ -212,23 +212,29 @@ public class MeetServiceImpl implements IMeetService {
* 下拉接口数据
*/
@Override
public Map<Object, Object> getMeetSelectDate(String type){
public List<Map<Object, Object>> getMeetSelectDate(String type){
switch (type) {
case "getMeetName":
Map<Object, Object> meetMap = new HashMap<>();
List<Map<Object, Object>> result = new ArrayList<>();
for (Meet meet : getList()) {
// 如果键不存在,则直接放入;如果存在,则保留第一个遇到的值
meetMap.putIfAbsent("value", meet.getId());
meetMap.putIfAbsent("name", meet.getName());
Map<Object, Object> map = new HashMap<>();
map.put("value", meet.getId());
map.put("name", meet.getName());
result.add(map);
}
return meetMap;
return result;
case "getMeetPrincipals":
// 提取所有不同的 principals并包装成 List<Map<String, Object>>
return getList().stream()
.collect(Collectors.toMap(
Meet::getPrincipals,
Meet::getPrincipals,
(oldValue, newValue) -> oldValue
));
.map(Meet::getPrincipals)
.distinct()
.map(principal -> {
Map<Object, Object> map = new HashMap<>();
map.put("value", principal);
map.put("name", principal);
return map;
})
.collect(Collectors.toList());
default:
throw new IllegalArgumentException("Unknown type: " + type);
}

View File

@@ -255,7 +255,10 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
public ServiceWorkOrderAnalysisVo counts() {
List<ServiceWorkOrders> serviceWorkOrdersList = baseMapper.selectList(new QueryWrapper<>());
// 原有逻辑不变...
// 当前时间
LocalDate today = LocalDate.now();
String currentMonth = today.format(DateTimeFormatter.ofPattern("yyyy-MM"));
// 总工单数
int workOrdersTotal = serviceWorkOrdersList.size();
@@ -263,6 +266,7 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
int notWorkOrdersTotal = (int) serviceWorkOrdersList.stream()
.filter(order -> "0".equals(order.getStatus()))
.count();
// 未闭环且超时的工单status ≠ "4" 且 isTimeOut = "1"
int novertimeOrdersTotal = (int) serviceWorkOrdersList.stream()
.filter(order -> !"4".equals(order.getStatus()) && "1".equals(order.getIsTimeOut()))
@@ -273,9 +277,6 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
.filter(order -> "3".equals(order.getStatus()))
.count();
// 当前月份格式2025-07
String currentMonth = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
// 当月工单数(创建时间在当月)
int monthOrdersTotal = (int) serviceWorkOrdersList.stream()
.filter(order -> currentMonth.equals(order.getCreateTime()))
@@ -286,13 +287,13 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
.filter(order -> "1".equals(order.getIsTimeOut()) && currentMonth.equals(order.getCreateTime()))
.count();
// 计算当月工单超时率(保留两位小数)
// 当月工单超时率(保留两位小数)
double novertimeOrdersRate = monthOrdersTotal == 0 ? 0.0 :
(double) outTimeOrdersTotal / monthOrdersTotal * 100;
Math.round(((double) outTimeOrdersTotal / monthOrdersTotal) * 10000) / 100.0;
// 满意数(假设 satisfactionLevel >= 4 表示满意
// 满意数(serviceEvalua >= 4
int satisfaction = (int) serviceWorkOrdersList.stream()
.filter(order -> order.getServiceEvalua() != null && order.getServiceEvalua()>= 4)
.filter(order -> order.getServiceEvalua() != null && order.getServiceEvalua() >= 4)
.count();
// 当月满意度(当月工单中满意的占比)
@@ -303,14 +304,19 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
.count();
double monthoSatisfaction = monthOrdersTotal == 0 ? 0.0 :
(double) monthSatisfactionCount / monthOrdersTotal * 100;
ServiceWorkOrderAnalysisVo serviceWorkOrderAnalysisVo =new ServiceWorkOrderAnalysisVo();
Math.round(((double) monthSatisfactionCount / monthOrdersTotal) * 10000) / 100.0;
// 获取近一周的工单统计
List<ServiceWorkOrderAnalysisVo.LineChartVo> recentWeekData = getRecentWeekWorkOrders(serviceWorkOrdersList);
List<ServiceWorkOrderAnalysisVo.LineChartVo> recentWeekWorkOrders = getRecentWeekWorkOrders(serviceWorkOrdersList);
// 计算工单类型分布
List<ServiceWorkOrderAnalysisVo.PieChartVo> workOrderTypeDistribution = calculateWorkOrderTypeDistribution(serviceWorkOrdersList);
// 获取工单类型分布
List<ServiceWorkOrderAnalysisVo.PieChartVo> satisfactionChartList = calculateWorkOrderTypeDistribution(serviceWorkOrdersList);
// 获取满意度分布
List<ServiceWorkOrderAnalysisVo.SatisfactionChartVo> satisfactionRateList = calculateSatisfactionRate(serviceWorkOrdersList);
// 获取近半年工单柱状图数据
List<ServiceWorkOrderAnalysisVo.BarChartVo> recentSixMonthWorkOrders = getRecentSixMonthsWorkOrders(serviceWorkOrdersList);
// 构建 VO 并返回
return new ServiceWorkOrderAnalysisVo.ServiceWorkOrderCount()
.setWorkOrdersTotal(workOrdersTotal)
.setNotWorkOrdersTotal(notWorkOrdersTotal)
@@ -321,11 +327,50 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
.setOutTimeOrdersTotal(outTimeOrdersTotal)
.setMonthoSatisfaction(monthoSatisfaction)
.setSatisfaction(satisfaction)
.setRecentWeekWorkOrders(recentWeekData)
.setWorkOrderTypeDistribution(workOrderTypeDistribution)
.setRecentWeekWorkOrders(recentWeekWorkOrders)
.setSatisfactionRateList(satisfactionRateList)
.setSatisfactionChartList(satisfactionChartList)
.setRecentSixMonthWorkOrders(recentSixMonthWorkOrders)
.build();
}
} /**
* 计算满意度指数占比
*
* @return 满意度比例列表
*/
private List<ServiceWorkOrderAnalysisVo.SatisfactionChartVo> calculateSatisfactionRate(List<ServiceWorkOrders> ordersList) {
List<ServiceWorkOrders> evaluatedOrders = ordersList.stream()
.filter(order -> order.getServiceEvalua() != null)
.collect(Collectors.toList());
int totalSatisfactionCount = evaluatedOrders.size();
Map<Integer, Long> satisfactionCounts = evaluatedOrders.stream()
.collect(Collectors.groupingBy(ServiceWorkOrders::getServiceEvalua, Collectors.counting()));
List<ServiceWorkOrderAnalysisVo.SatisfactionChartVo> satisfactionRateList = new ArrayList<>();
for (int level = 1; level <= 5; level++) {
long count = satisfactionCounts.getOrDefault(level, 0L);
double rate = totalSatisfactionCount == 0 ? 0.0 :
Math.round(((double) count / totalSatisfactionCount) * 10000) / 100.0;
String name = switch (level) {
case 1 -> "非常不满意";
case 2 -> "不满意";
case 3 -> "一般";
case 4 -> "满意";
case 5 -> "非常满意";
default -> "未知";
};
satisfactionRateList.add(new ServiceWorkOrderAnalysisVo.SatisfactionChartVo()
.setName(name)
.setValue((long) count)
.setRate(rate));
}
return satisfactionRateList;
}
// 近一周工单统计方法
private List<ServiceWorkOrderAnalysisVo.LineChartVo> getRecentWeekWorkOrders(List<ServiceWorkOrders> serviceWorkOrdersList) {
LocalDate today = LocalDate.now();
@@ -378,8 +423,31 @@ public class ServiceWorkOrdersServiceImpl implements IServiceWorkOrdersService {
String typeName = serviceWorkOrdersType != null ? serviceWorkOrdersType.getOrderTypeName() : "未知类型";
// 计算占比(保留两位小数)
double percentage = Math.round(((double) count / total) * 10000) / 100.0;
result.add(new ServiceWorkOrderAnalysisVo.PieChartVo(typeName, count, percentage));
result.add(new ServiceWorkOrderAnalysisVo.PieChartVo(typeName.toString(), count, percentage));
}
return result;
}
private List<ServiceWorkOrderAnalysisVo.BarChartVo> getRecentSixMonthsWorkOrders(List<ServiceWorkOrders> ordersList) {
LocalDate today = LocalDate.now();
// 获取近6个月的日期范围含当月
List<String> months = new ArrayList<>();
for (int i = 5; i >= 0; i--) {
months.add(today.minusMonths(i).format(DateTimeFormatter.ofPattern("yyyy-MM")));
}
Map<Date, Long> orderCountMap = ordersList.stream()
.filter(order -> order.getCreateTime() != null)
.collect(Collectors.groupingBy(
ServiceWorkOrders::getCreateTime,
Collectors.counting()
));
// 构建柱状图数据
return months.stream()
.map(month -> new ServiceWorkOrderAnalysisVo.BarChartVo()
.setMonth(month)
.setOrderCount(Math.toIntExact(orderCountMap.getOrDefault(month, 0L)))
)
.collect(Collectors.toList());
}
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.property.mapper.CustomerContingenPlanRecordMapper">
</mapper>