Merge branch 'master' of http://47.109.37.87:3000/by2025/SmartParks
This commit is contained in:
@@ -95,5 +95,7 @@ public class CostHouseChargeBo extends BaseEntity {
|
||||
private String remark;
|
||||
|
||||
|
||||
private String chargeTime;
|
||||
|
||||
|
||||
}
|
||||
|
@@ -9,6 +9,8 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
@@ -60,7 +62,7 @@ public class InspectionTaskDetailBo extends BaseEntity {
|
||||
/**
|
||||
* 实际巡检时间
|
||||
*/
|
||||
private Date actualInspectionTime;
|
||||
private LocalDateTime actualInspectionTime;
|
||||
|
||||
/**
|
||||
* 实际签到状态(1已签到2.未签到)
|
||||
@@ -106,7 +108,7 @@ public class InspectionTaskDetailBo extends BaseEntity {
|
||||
/**
|
||||
* 实际巡检时间
|
||||
*/
|
||||
private Date inspectionTime;
|
||||
private LocalDateTime inspectionTime;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
|
@@ -1,6 +1,8 @@
|
||||
package org.dromara.property.domain.vo;
|
||||
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
@@ -94,7 +96,7 @@ public class InspectionTaskDetailVo implements Serializable {
|
||||
* 实际巡检时间
|
||||
*/
|
||||
@ExcelProperty(value = "实际巡检时间")
|
||||
private Date actualInspectionTime;
|
||||
private LocalDateTime actualInspectionTime;
|
||||
|
||||
/**
|
||||
* 实际签到状态(1已签到2.未签到)
|
||||
|
@@ -2,7 +2,9 @@ package org.dromara.property.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
@@ -25,6 +27,9 @@ import org.dromara.property.domain.vo.*;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentPersonVo;
|
||||
import org.dromara.property.domain.vo.residentVo.ResidentUnitVo;
|
||||
import org.dromara.property.mapper.*;
|
||||
import org.dromara.property.service.ITbFloorService;
|
||||
import org.dromara.property.service.ITbRoomService;
|
||||
import org.dromara.property.service.smartDevicesService.ITbMeterRecordService;
|
||||
import org.dromara.system.api.RemoteDictService;
|
||||
import org.dromara.system.api.RemoteUserService;
|
||||
import org.dromara.system.api.domain.vo.RemoteDictDataVo;
|
||||
@@ -62,6 +67,10 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
|
||||
@DubboReference
|
||||
private RemoteDictService remoteDictService;
|
||||
|
||||
private final ITbRoomService tbRoomService;
|
||||
private final ITbFloorService tbFloorService;
|
||||
private final ITbMeterRecordService tbMeterRecordService;
|
||||
|
||||
/**
|
||||
* 查询房屋收费
|
||||
*
|
||||
@@ -185,7 +194,7 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
|
||||
ResidentUnitVo residentUnitVo = residentUnitMapper.selectVoById(add.getResidentUnitId());
|
||||
add.setResidentUnitId(residentUnitVo.getId());
|
||||
add.setArea(residentUnitVo.getArea());
|
||||
BigDecimal area = new BigDecimal(add.getArea());
|
||||
BigDecimal area = BigDecimal.valueOf(add.getArea());
|
||||
CostItemsVo costItemsVo = costItemsMapper.selectVoById(add.getCostItemsId());
|
||||
BigDecimal unitPrice = costItemsVo.getUnitPrice();
|
||||
// //向上取整
|
||||
@@ -214,11 +223,11 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
|
||||
}
|
||||
//类型为5,则为水费
|
||||
if (Objects.equals(remoteDictDataVo.getDictValue(), "5")) {
|
||||
|
||||
|
||||
add.setAmountReceivable(meterCharge(residentUnitVo.getLocation(), area, 2L, bo));
|
||||
}
|
||||
//类型为6,则为电费
|
||||
if (Objects.equals(remoteDictDataVo.getDictValue(), "6")) {
|
||||
add.setAmountReceivable(meterCharge(residentUnitVo.getLocation(), area, 1L, bo));
|
||||
}
|
||||
//类型为8,则为气费
|
||||
if (Objects.equals(remoteDictDataVo.getDictValue(), "8")) {
|
||||
@@ -250,8 +259,44 @@ public class CostHouseChargeServiceImpl implements ICostHouseChargeService {
|
||||
/**
|
||||
* 水电气费计算
|
||||
*/
|
||||
private void meterCharge(){
|
||||
private BigDecimal meterCharge(String location, BigDecimal roomArea, Long meterType, CostHouseChargeBo bo) {
|
||||
if (StringUtils.isNotBlank(location)) {
|
||||
String[] roomIds = location.split(",");
|
||||
Map<Long, TbFloorVo> floorData = new HashMap<>(); // 存储去重的楼层数据
|
||||
|
||||
for (String item : roomIds) {
|
||||
TbRoomVo roomVo = tbRoomService.queryById(Long.valueOf(item));
|
||||
if (roomVo != null) {
|
||||
Long floorId = roomVo.getFloorId();
|
||||
// 保存楼层数据(如果尚未存在)
|
||||
if (!floorData.containsKey(floorId)) {
|
||||
// 假设您有获取楼层信息的方法,这里需要根据实际情况调整
|
||||
TbFloorVo floorVo = tbFloorService.queryById(floorId);
|
||||
if (floorVo != null) {
|
||||
floorData.put(floorId, floorVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Float floorArea = 0f;
|
||||
Float meterEnergy = 0f;
|
||||
for (Map.Entry<Long, TbFloorVo> entry : floorData.entrySet()) {
|
||||
floorArea += entry.getValue().getArea();
|
||||
Map<String, Object> meterRecord = tbMeterRecordService.getEnergyTrend(entry.getKey().toString(), null, meterType, null, bo.getChargeTime(), null);
|
||||
Map<String, Object> resultMap = Convert.convert(new TypeReference<>() {
|
||||
}, meterRecord.get("nowMonth"));
|
||||
meterEnergy += Convert.convert(Float.class, resultMap.get("total"));
|
||||
}
|
||||
|
||||
BigDecimal floorAreaBD = Convert.toBigDecimal(floorArea);
|
||||
BigDecimal meterEnergyBD = Convert.toBigDecimal(meterEnergy);
|
||||
|
||||
return roomArea.divide(floorAreaBD, 10, RoundingMode.HALF_UP)
|
||||
.multiply(meterEnergyBD)
|
||||
.multiply(Convert.toBigDecimal(0.9));
|
||||
}
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -11,6 +11,7 @@ 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.CustomerContingenPlan;
|
||||
import org.dromara.property.domain.CustomerContingenPlanRecord;
|
||||
import org.dromara.property.domain.entity.resident.ResidentPerson;
|
||||
@@ -21,12 +22,14 @@ 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.dromara.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 客户服务-应急预案Service业务层处理
|
||||
@@ -102,7 +105,23 @@ public class CustomerContingenPlanServiceImpl implements ICustomerContingenPlanS
|
||||
@Override
|
||||
public List<CustomerContingenPlanVo> queryList(CustomerContingenPlanBo bo) {
|
||||
LambdaQueryWrapper<CustomerContingenPlan> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
List<CustomerContingenPlanVo> customerContingenPlanVos = baseMapper.selectVoList(lqw);
|
||||
customerContingenPlanVos.forEach(s -> {
|
||||
if (Objects.equals(s.getContingenPlanType(), "0")) {
|
||||
s.setContingenPlanType("自然灾害");
|
||||
}
|
||||
if (Objects.equals(s.getContingenPlanType(), "1")) {
|
||||
s.setContingenPlanType("事故灾难");
|
||||
}
|
||||
if (Objects.equals(s.getContingenPlanType(), "2")) {
|
||||
s.setContingenPlanType("公共卫生");
|
||||
}
|
||||
if (Objects.equals(s.getContingenPlanType(), "3")) {
|
||||
s.setContingenPlanType("社会安全");
|
||||
}
|
||||
});
|
||||
|
||||
return customerContingenPlanVos;
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<CustomerContingenPlan> buildQueryWrapper(CustomerContingenPlanBo bo) {
|
||||
|
@@ -26,6 +26,7 @@ import org.dromara.property.domain.enums.OrderReportingTypeEnum;
|
||||
import org.dromara.property.domain.enums.OrderTypeOperationEnum;
|
||||
import org.dromara.property.domain.enums.WorkOrderStatusEnum;
|
||||
import org.dromara.property.domain.vo.*;
|
||||
import org.dromara.property.domain.vo.attendanceVo.AttendanceArrangementVo;
|
||||
import org.dromara.property.domain.vo.mobile.MInspectionTaskDetailVo;
|
||||
import org.dromara.property.domain.vo.mobile.MServiceWorkOrdersRecordVo;
|
||||
import org.dromara.property.domain.vo.mobile.MServiceWorkOrdersVo;
|
||||
@@ -39,6 +40,7 @@ import org.dromara.property.service.IInspectionTaskDetailService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -113,7 +115,17 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer
|
||||
});
|
||||
}
|
||||
|
||||
return TableDataInfo.build(result);
|
||||
Page<InspectionTaskDetailVo> inspectionTaskDetailVoPage = result.setRecords(result.getRecords().stream().map(vo -> {
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
vo.setActualInspectionPerson(loginUser.getNickname());
|
||||
vo.setPlanInspectionPerson(loginUser.getNickname());
|
||||
vo.setActualInspectionTime(LocalDateTime.now());
|
||||
// vo.setSignType();
|
||||
|
||||
return vo;
|
||||
}).collect(Collectors.toList()));
|
||||
|
||||
return TableDataInfo.build(inspectionTaskDetailVoPage);
|
||||
}
|
||||
|
||||
private void disposeData(InspectionTaskDetailVo vo, Map<Long, String> taskNameMap, Map<Long, String> routeNameMap, Map<Long, String> planNameMap, Map<Long, String> pointNameMap) {
|
||||
@@ -311,7 +323,9 @@ public class InspectionTaskDetailServiceImpl implements IInspectionTaskDetailSer
|
||||
//当前登录用户id
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
Assert.isTrue(planInspectionPersonIds.contains(loginUser.getUserId()), "当前签到人不在计划巡检人列表内");
|
||||
bo.setActualInspectionPerson(loginUser.getUserId().toString());
|
||||
bo.setActualInspectionPerson(loginUser.getNickname());
|
||||
// bo.setActualInspectionTime(LocalDateTime.now());
|
||||
bo.setInspectionTime(LocalDateTime.now());
|
||||
InspectionTaskDetail update = MapstructUtils.convert(bo, InspectionTaskDetail.class);
|
||||
boolean flag = baseMapper.updateById(update) > 0;
|
||||
if (flag) {
|
||||
|
@@ -14,7 +14,7 @@ import java.util.Map;
|
||||
* 抄记录Service接口
|
||||
*
|
||||
* @author lsm
|
||||
* @date 2025-07-19
|
||||
* @since 2025-07-19
|
||||
*/
|
||||
public interface ITbMeterRecordService {
|
||||
|
||||
|
Reference in New Issue
Block a user