diff --git a/docs/db/TT.sql b/docs/db/TT.sql index 0d683b61460e380eb4e2c01fa154b5c5c71532f8..7808e812a825aef4477dfbf5ca7c7440a1607681 100644 --- a/docs/db/TT.sql +++ b/docs/db/TT.sql @@ -34013,6 +34013,7 @@ CREATE TABLE `u_org` ( -- Records of u_org -- ---------------------------- INSERT INTO `u_org` VALUES ('842025040735010044', null, '102025040775320034', 'HC演示物业', '1', '-1', null, '2025-04-07 12:51:17', '0', '9999', 'F'); +INSERT INTO `u_org` VALUES ('842024122616450000', NULL, '400000000000000001', 'HC小区运营团队', '1', '-1', NULL, '2024-12-26 23:46:21', '0', '9999', 'F'); -- ---------------------------- -- Table structure for u_org_community diff --git a/java110-core/src/main/java/com/java110/core/client/FtpUploadTemplate.java b/java110-core/src/main/java/com/java110/core/client/FtpUploadTemplate.java index 8e8cd6031080c8921dd30d04d9217aa2131544bf..0d5d2777da5b324c46cb433e6ba6fc48c9fef8d4 100755 --- a/java110-core/src/main/java/com/java110/core/client/FtpUploadTemplate.java +++ b/java110-core/src/main/java/com/java110/core/client/FtpUploadTemplate.java @@ -155,7 +155,8 @@ public class FtpUploadTemplate { throw new IllegalArgumentException("上传文件失败"); } finally { try { - ftpClient.disconnect(); + // 先判空再调用 + if (ftpClient != null) ftpClient.disconnect(); } catch (IOException e) { e.printStackTrace(); } @@ -210,7 +211,8 @@ public class FtpUploadTemplate { throw new IllegalArgumentException("上传文件失败"); } finally { try { - ftpClient.disconnect(); + // 先判空再调用 + if (ftpClient != null) ftpClient.disconnect(); } catch (IOException e) { e.printStackTrace(); } diff --git a/java110-core/src/main/java/com/java110/core/client/OutRestTemplate.java b/java110-core/src/main/java/com/java110/core/client/OutRestTemplate.java index b3e959f76eb82ca897214e7d7794dbbd5a865733..4fafad5697dcb181c6572d8e9b87b012bf7d2a23 100644 --- a/java110-core/src/main/java/com/java110/core/client/OutRestTemplate.java +++ b/java110-core/src/main/java/com/java110/core/client/OutRestTemplate.java @@ -1,18 +1,9 @@ package com.java110.core.client; -import com.java110.core.factory.GenerateCodeFactory; import com.java110.core.factory.LogFactory; import com.java110.core.log.LoggerFactory; -import com.java110.dto.log.TransactionOutLogDto; -import com.java110.intf.common.ITransactionOutLogV1ServiceSMO; -import com.java110.po.log.TransactionOutLogPo; -import com.java110.utils.cache.MappingCache; -import com.java110.utils.constant.MappingConstant; -import com.java110.utils.constant.ServiceConstant; -import com.java110.utils.factory.ApplicationContextFactory; import com.java110.utils.util.DateUtil; import com.java110.utils.util.ExceptionUtil; -import com.java110.utils.util.StringUtil; import org.slf4j.Logger; import org.springframework.http.HttpEntity; import org.springframework.http.HttpMethod; @@ -22,7 +13,6 @@ import org.springframework.lang.Nullable; import org.springframework.web.client.HttpStatusCodeException; import org.springframework.web.client.RestClientException; -import java.net.URI; import java.util.Date; /** @@ -107,7 +97,8 @@ public class OutRestTemplate extends RestTemplate { } // saveLog(url, "POST", null, tmpResponseEntity, DateUtil.getCurrentDate().getTime() - startTime.getTime()); - LogFactory.saveOutLog(url, "POST", DateUtil.getCurrentDate().getTime() - startTime.getTime(), null, request.toString(), tmpResponseEntity); + LogFactory.saveOutLog(url, "POST", DateUtil.getCurrentDate().getTime() - startTime.getTime(), + null, request != null ? request.toString() : "" , tmpResponseEntity); } return responseEntity; } diff --git a/java110-core/src/main/java/com/java110/core/event/app/AppEventPublishing.java b/java110-core/src/main/java/com/java110/core/event/app/AppEventPublishing.java index d0a6949b54388d236b591717b96a19724d2f5d29..525ce7a991d26864135527b21bf21e8330d0cf2a 100755 --- a/java110-core/src/main/java/com/java110/core/event/app/AppEventPublishing.java +++ b/java110-core/src/main/java/com/java110/core/event/app/AppEventPublishing.java @@ -71,7 +71,7 @@ public class AppEventPublishing extends LoggerEngine{ */ public static List> getListeners(String interfaceClassName){ - Assert.isNull(interfaceClassName,"获取需要发布的事件处理侦听时,传递事件为空,请检查"); + Assert.notNull(interfaceClassName, "获取需要发布的事件处理侦听时,传递事件为空,请检查"); //先从缓存中获取,为了提升效率 if(cacheListenersMap.containsKey(interfaceClassName)){ diff --git a/java110-core/src/main/java/com/java110/core/factory/DataFlowFactory.java b/java110-core/src/main/java/com/java110/core/factory/DataFlowFactory.java index cc2c0d09ef9390c63341fadc435c1f41b5fdbab2..2807c05b4c82e39d0119972f29316f4ab85588a8 100755 --- a/java110-core/src/main/java/com/java110/core/factory/DataFlowFactory.java +++ b/java110-core/src/main/java/com/java110/core/factory/DataFlowFactory.java @@ -287,7 +287,11 @@ public class DataFlowFactory { business.setbId(GenerateCodeFactory.getBId()); busiMap = new HashMap(); busiMap.put("oId",dataFlow.getoId()); - busiMap.put("businessTypeCd",getService(dataFlow,business.getServiceCode()).getBusinessTypeCd()); + AppService service = getService(dataFlow, business.getServiceCode()); + if (service == null) { + throw new NullPointerException("getService() returned null, unable to getBusinessTypeCd"); + } + busiMap.put("businessTypeCd", service.getBusinessTypeCd()); busiMap.put("remark",business.getRemark()); busiMap.put("statusCd",StatusConstant.STATUS_CD_SAVE); busiMap.put("bId",business.getbId()); diff --git a/java110-core/src/main/java/com/java110/core/factory/PaymentFactory.java b/java110-core/src/main/java/com/java110/core/factory/PaymentFactory.java index be09103a4b3eed063414b7ffd970cef1dc8241aa..18893456a402038e04db74d453d211e061c7eb18 100755 --- a/java110-core/src/main/java/com/java110/core/factory/PaymentFactory.java +++ b/java110-core/src/main/java/com/java110/core/factory/PaymentFactory.java @@ -49,7 +49,7 @@ public class PaymentFactory { InetAddress ia = null; String localip = null; try { - ia = ia.getLocalHost(); + ia = InetAddress.getLocalHost(); localip = ia.getHostAddress(); } catch (Exception e) { e.printStackTrace(); diff --git a/java110-db/src/main/resources/mapper/report/ReportUserQuestionAnswerValueServiceDaoImplMapper.xml b/java110-db/src/main/resources/mapper/report/ReportUserQuestionAnswerValueServiceDaoImplMapper.xml index a79f715dfe63f57478d3b768f79c25b5fe0b70a3..924bf7d2b797bf82b2cc040c983589f42fa57825 100644 --- a/java110-db/src/main/resources/mapper/report/ReportUserQuestionAnswerValueServiceDaoImplMapper.xml +++ b/java110-db/src/main/resources/mapper/report/ReportUserQuestionAnswerValueServiceDaoImplMapper.xml @@ -11,7 +11,7 @@ from user_question_answer_value t left join question_answer_title uat on t.title_id = uat.title_id and uat.status_cd = '0' left join question_answer qa on uat.qa_id = qa.qa_id and qa.status_cd = '0' - left join u_user uu on t.person_id = uu.user_id and uu.status_cd = '0' + left join u_user uu on t.user_qa_id = uu.user_id and uu.status_cd = '0' left join question_answer_title_value qatv on t.value_id = qatv.value_id and qatv.status_cd = '0' left join t_dict td on qa.qa_type = td.status_cd and td.table_name = 'question_answer' and td.table_columns = 'qa_type' where 1=1 @@ -42,9 +42,6 @@ and t.value_content= #{valueContent} - - and t.person_id= #{personId} - and t.status_cd= #{statusCd} @@ -80,7 +77,7 @@ from user_question_answer_value t left join question_answer_title uat on t.title_id = uat.title_id and uat.status_cd = '0' left join question_answer qa on uat.qa_id = qa.qa_id and qa.status_cd = '0' - left join u_user uu on t.person_id = uu.user_id and uu.status_cd = '0' + left join u_user uu on t.user_qa_id = uu.user_id and uu.status_cd = '0' left join question_answer_title_value qatv on t.value_id = qatv.value_id and qatv.status_cd = '0' left join t_dict td on qa.qa_type = td.status_cd and td.table_name = 'question_answer' and td.table_columns = 'qa_type' where 1=1 @@ -111,9 +108,7 @@ and t.value_content= #{valueContent} - - and t.person_id= #{personId} - + and t.status_cd= #{statusCd} diff --git a/java110-utils/src/main/java/com/java110/utils/util/DateUtil.java b/java110-utils/src/main/java/com/java110/utils/util/DateUtil.java index 8ac38bf009f0bad81183b120d0aa00aa60a727e5..d44d00b51f7253ec717a5b069d32e555be71ab5f 100755 --- a/java110-utils/src/main/java/com/java110/utils/util/DateUtil.java +++ b/java110-utils/src/main/java/com/java110/utils/util/DateUtil.java @@ -619,6 +619,12 @@ public class DateUtil { return calendar.get(Calendar.MONTH) + 1; } + public static int getDay(Date date) { + Calendar a = Calendar.getInstance(); + a.setTime(date); + return a.get(Calendar.DAY_OF_MONTH); + } + /** * 判断时间是否在时间段内 * diff --git a/service-api/pom-boot.xml b/service-api/pom-boot.xml index 933ec5d5bae60fc04bef74f19cc797afbc08e52a..98be7aff20de01c237b1c5c0f757eb7ecc519e86 100644 --- a/service-api/pom-boot.xml +++ b/service-api/pom-boot.xml @@ -12,7 +12,6 @@ service-api service-api - http://www.example.com diff --git a/service-api/pom-cloud.xml b/service-api/pom-cloud.xml index 4f2e7b36b9395e02a1eb2cdefedcff909bd5cddd..35143de9fd8ad219fdec8a31b4e0127134df5d6f 100644 --- a/service-api/pom-cloud.xml +++ b/service-api/pom-cloud.xml @@ -12,7 +12,6 @@ service-api service-api - http://www.example.com diff --git a/service-community/src/main/java/com/java110/community/cmd/ownerRepair/RepairDispatchCmd.java b/service-community/src/main/java/com/java110/community/cmd/ownerRepair/RepairDispatchCmd.java index 7c4ef5d692e789fa963fc03f98c5a7139a7f1762..229d0b6cfc75ff92d2c6b42a739eb5d2acf9ff93 100644 --- a/service-community/src/main/java/com/java110/community/cmd/ownerRepair/RepairDispatchCmd.java +++ b/service-community/src/main/java/com/java110/community/cmd/ownerRepair/RepairDispatchCmd.java @@ -168,7 +168,7 @@ public class RepairDispatchCmd extends Cmd { repairUserDto.setStates(new String[]{RepairUserDto.STATE_DOING,RepairUserDto.STATE_EVALUATE}); repairUserDto.setStaffId(reqJson.getString("userId")); List repairUserDtos = repairUserInnerServiceSMOImpl.queryRepairUsers(repairUserDto); - if (!ListUtil.isNull(repairUserDtos)) { + if (ListUtil.isNull(repairUserDtos)) { ResponseEntity responseEntity = ResultVo.createResponseEntity(ResultVo.CODE_BUSINESS_VERIFICATION, "当前用户没有需要处理订单!"); context.setResponseEntity(responseEntity); return; diff --git a/service-community/src/main/java/com/java110/community/cmd/parkingSpaceApply/ListParkingSpaceApplyCmd.java b/service-community/src/main/java/com/java110/community/cmd/parkingSpaceApply/ListParkingSpaceApplyCmd.java index 327ae36b8b0f26fa549cafc785d198dcead43fd6..031d9b7367424efdb30b89a7fcb26ea533883d6c 100644 --- a/service-community/src/main/java/com/java110/community/cmd/parkingSpaceApply/ListParkingSpaceApplyCmd.java +++ b/service-community/src/main/java/com/java110/community/cmd/parkingSpaceApply/ListParkingSpaceApplyCmd.java @@ -54,7 +54,7 @@ public class ListParkingSpaceApplyCmd extends Cmd { @Override public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { super.validatePageInfo(reqJson); - super.validateProperty(cmdDataFlowContext); + //super.validateProperty(cmdDataFlowContext); } @Override diff --git a/service-community/src/main/java/com/java110/community/cmd/repair/SaveRepairSettingCmd.java b/service-community/src/main/java/com/java110/community/cmd/repair/SaveRepairSettingCmd.java index f9ce60aa0a7a34caea3efda2b27ee55bd0bbd321..01b218ff9bd7b26b906036bda4ef40eb63e72522 100644 --- a/service-community/src/main/java/com/java110/community/cmd/repair/SaveRepairSettingCmd.java +++ b/service-community/src/main/java/com/java110/community/cmd/repair/SaveRepairSettingCmd.java @@ -61,7 +61,7 @@ public class SaveRepairSettingCmd extends Cmd { Assert.hasKeyAndValue(reqJson, "payFeeFlag", "请求报文中未包含收费情况"); Assert.hasKeyAndValue(reqJson, "returnVisitFlag", "请求报文中未包含回访设置"); Assert.hasKeyAndValue(reqJson, "doTime", "请求报文中未包含办理时长"); - Assert.hasKeyAndValue(reqJson, "warning", "请求报文中未包含超时预警"); + Assert.hasKeyAndValue(reqJson, "warningTime", "请求报文中未包含超时预警"); } diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java index c72f574e6fef10b44d29635b17077fcc03261759..8bc41870220381b3e8b3da7ed0b9b8fb17e01f10 100644 --- a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java +++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java @@ -707,17 +707,17 @@ public class PayFeeCmd extends Cmd { return; } // todo 自己是间接性费用 - if (FeeDto.FEE_FLAG_CYCLE_ONCE.equals(feeConfigDto.getFeeFlag())) { + if (FeeDto.FEE_FLAG_CYCLE.equals(feeConfigDto.getFeeFlag())) { return; } FeeConfigDto tmpFeeConfigDto = new FeeConfigDto(); tmpFeeConfigDto.setFeeNameEq(feeConfigDto.getFeeName() + "欠费"); - tmpFeeConfigDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE_ONCE); + tmpFeeConfigDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE); tmpFeeConfigDto.setComputingFormula(feeConfigDto.getComputingFormula()); List feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(tmpFeeConfigDto); - Assert.listOnlyOne(feeConfigDtos, "按自定义时间段缴费时,费用必须为间接性费用,或者存在名称为 " + feeConfigDto.getFeeName() + "欠费 的间接性费用,它的公式计算必须要和" + feeConfigDto.getFeeName() + "一致"); + Assert.listOnlyOne(feeConfigDtos, "按自定义时间段缴费时,费用必须为周期性,或者存在名称为 " + feeConfigDto.getFeeName() + "欠费 的周期性费用,它的公式计算必须要和" + feeConfigDto.getFeeName() + "一致"); } @@ -819,7 +819,7 @@ public class PayFeeCmd extends Cmd { tmpFeeAttrPo = new FeeAttrPo(); tmpFeeAttrPo.setAttrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId, true)); tmpFeeAttrPo.setFeeId(tmpPayFeePo.getFeeId()); - tmpFeeAttrPo.setCommunityId(tmpFeeAttrPo.getCommunityId()); + tmpFeeAttrPo.setCommunityId(tmpPayFeePo.getCommunityId()); tmpFeeAttrPo.setSpecCd(FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME); tmpFeeAttrPo.setValue(reqJson.getString("customStartTime")); tmpFeeAttrPos.add(tmpFeeAttrPo); @@ -841,14 +841,14 @@ public class PayFeeCmd extends Cmd { feeConfigDto.setCommunityId(feeInfo.getCommunityId()); List feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto); Assert.listOnlyOne(feeConfigDtos, "费用项不存在"); - if (FeeDto.FEE_FLAG_CYCLE_ONCE.equals(feeConfigDtos.get(0).getFeeFlag())) { + if (FeeDto.FEE_FLAG_CYCLE.equals(feeConfigDtos.get(0).getFeeFlag())) { return; } FeeConfigDto tmpFeeConfigDto = new FeeConfigDto(); tmpFeeConfigDto.setFeeNameEq(feeConfigDtos.get(0).getFeeName() + "欠费"); - tmpFeeConfigDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE_ONCE); + tmpFeeConfigDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE); tmpFeeConfigDto.setComputingFormula(feeConfigDto.getComputingFormula()); //todo 校验的时候校验过了 所以这里不可能为空 feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(tmpFeeConfigDto); diff --git a/service-fee/src/main/java/com/java110/fee/cmd/meterWater/SaveMeterWaterCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/meterWater/SaveMeterWaterCmd.java index 95cde648781cccafd266c12df032bf360477caa1..4c79dc393b4c14c15b4c568c9cb5175cc5dbce88 100644 --- a/service-fee/src/main/java/com/java110/fee/cmd/meterWater/SaveMeterWaterCmd.java +++ b/service-fee/src/main/java/com/java110/fee/cmd/meterWater/SaveMeterWaterCmd.java @@ -193,17 +193,14 @@ public class SaveMeterWaterCmd extends Cmd { reqJson.put("feeId", payFeePo.getFeeId()); addMeterWater(reqJson, roomList.get(0)); - int flag = payFeeV1InnerServiceSMOImpl.savePayFee(payFeePo); - if (flag < 1) { - throw new CmdException("保存数据失败"); - } + FeeAttrPo feeAttrPo = new FeeAttrPo(); feeAttrPo.setCommunityId(reqJson.getString("communityId")); feeAttrPo.setSpecCd(FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME); feeAttrPo.setValue(reqJson.getString("curReadingTime")); feeAttrPo.setFeeId(payFeePo.getFeeId()); feeAttrPo.setAttrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId)); - flag = feeAttrInnerServiceSMOImpl.saveFeeAttr(feeAttrPo); + int flag = feeAttrInnerServiceSMOImpl.saveFeeAttr(feeAttrPo); if (flag < 1) { throw new CmdException("保存数据失败"); } @@ -215,7 +212,7 @@ public class SaveMeterWaterCmd extends Cmd { feeAttrPo.setValue(roomList.get(0).getFloorNum() + "-" + roomList.get(0).getUnitNum() + "-" + roomList.get(0).getRoomNum()); feeAttrPo.setFeeId(payFeePo.getFeeId()); feeAttrPo.setAttrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId)); - flag = feeAttrInnerServiceSMOImpl.saveFeeAttr(feeAttrPo); + flag = feeAttrInnerServiceSMOImpl.saveFeeAttr(feeAttrPo); if (flag < 1) { throw new CmdException("保存数据失败"); } @@ -225,7 +222,7 @@ public class SaveMeterWaterCmd extends Cmd { ownerDto.setRoomId(reqJson.getString("objId")); List ownerDtos = ownerInnerServiceSMOImpl.queryOwnersByRoom(ownerDto); - if (ownerDtos != null && ownerDtos.size() > 0) { + if (!ListUtil.isNull(ownerDtos)) { feeAttrPo = new FeeAttrPo(); feeAttrPo.setCommunityId(reqJson.getString("communityId")); feeAttrPo.setSpecCd(FeeAttrDto.SPEC_CD_OWNER_ID); @@ -259,7 +256,10 @@ public class SaveMeterWaterCmd extends Cmd { throw new CmdException("保存数据失败"); } } - + flag = payFeeV1InnerServiceSMOImpl.savePayFee(payFeePo); + if (flag < 1) { + throw new CmdException("保存数据失败"); + } } cmdDataFlowContext.setResponseEntity(ResultVo.success()); } diff --git a/service-fee/src/main/java/com/java110/fee/feeMonth/IPayFeeMonthHelp.java b/service-fee/src/main/java/com/java110/fee/feeMonth/IPayFeeMonthHelp.java index 52abb02b83b05f8ca7446a32ab375b25c3889275..15f13d9f639f1e6f9468c0db965eb4ea1bd44759 100644 --- a/service-fee/src/main/java/com/java110/fee/feeMonth/IPayFeeMonthHelp.java +++ b/service-fee/src/main/java/com/java110/fee/feeMonth/IPayFeeMonthHelp.java @@ -30,5 +30,5 @@ public interface IPayFeeMonthHelp { * @param feePrice * @param deadlineTime */ - void waitDispersedOweFee(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto, Double feePrice, Date deadlineTime); + void waitDispersedOweFee(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto, Double feePrice, Date deadlineTime,double oweMonth); } diff --git a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java index 6fe033110329acc32eef4de9d82887c97212e3ab..7244c9dce7a80803bf36f5d9421d33a09b5b0c82 100644 --- a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java +++ b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java @@ -97,17 +97,7 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDto); Double feePrice = Double.parseDouble(feePriceAll.get("feePrice").toString()); - //todo 如果是一次性费用 除以 -// if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getPayerObjType())) { -// return feePrice; -// } -// double maxMonth = Math.ceil(computeFeeSMOImpl.dayCompare(feeDto.getStartTime(), feeDto.getEndTime())); -// if (maxMonth <= 0) { -// return feePrice; -// -// } -// BigDecimal feePriceDec = new BigDecimal(feePrice).divide(new BigDecimal(maxMonth), 2, BigDecimal.ROUND_HALF_UP); -// feePrice = feePriceDec.doubleValue(); + return feePrice; } @@ -145,7 +135,15 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { for (FeeDetailDto feeDetailDto : feeDetailDtos) { // todo 逐条去离散 - doDispersedFeeDetail(feeDetailDto, feeDto, payFeeMonthOwnerDto, feePrice); + try { + // 自然月实收处理 + doDispersedFeeDetailNormalMonth(feeDetailDto, feeDto, payFeeMonthOwnerDto, feePrice); + + //非自然月或者一次性费用处理已经交过费的 + doDispersedFeeDetailUnNormalMonth(feeDetailDto, feeDto, payFeeMonthOwnerDto, feePrice); + }catch (Exception e){ + e.printStackTrace(); + } } } @@ -159,7 +157,7 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { * @param deadlineTime */ @Override - public void waitDispersedOweFee(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto, Double feePrice, Date deadlineTime) { + public void waitDispersedOweFee(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto, Double feePrice, Date deadlineTime, double oweMonth) { // todo 清理 detailId 为-1 的数据 @@ -174,6 +172,31 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { return; } + // 自然月周期性费用计算 + waitDispersedOweFeeCycleNormalMonth(feeDto, payFeeMonthOwnerDto, feePrice, deadlineTime); + + // 一次性或者非自然月处理 + waitDispersedOweFeeOnceUnNormalMonth(feeDto, payFeeMonthOwnerDto, feePrice, deadlineTime, oweMonth); + + } + + /** + * 自然月周期性费用计算 + * + * @param feeDto + * @param payFeeMonthOwnerDto + * @param feePrice + * @param deadlineTime + */ + private void waitDispersedOweFeeCycleNormalMonth(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto, Double feePrice, Date deadlineTime) { + // 一次性费用直接返回 + if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { + return; + } + // 不是自然月 费用直接返回 + if (DateUtil.getDay(feeDto.getStartTime()) != 1) { + return; + } List payFeeDetailMonthPos = new ArrayList<>(); // todo 处理 开始时间和结束时间 Date startTime = DateUtil.timeToDate(feeDto.getEndTime()); @@ -183,15 +206,6 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { BigDecimal dayReceivableAmount = null; - //todo 一次性费用 日应收计算 - if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { - int day = DateUtil.daysBetween(endTime, startTime); - if (day < 1) { - day = 1; - } - dayReceivableAmount = receivableAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 日 应收 - } - // todo 寻找第一个自然月 一日 Calendar firstMonthDayCal = Calendar.getInstance(); firstMonthDayCal.setTime(startTime); @@ -212,11 +226,7 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { calendar.setTime(startMonthDayTime); curMonthMaxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); - - //todo 周期性费用 日应收重新算 - if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { - dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 - } + dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 // todo 计算 应收 curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP); @@ -240,25 +250,111 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { Calendar calendar = Calendar.getInstance(); calendar.setTime(startMonthDayTime); curMonthMaxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); - // todo 如果不是整月,则转换为按天计算 -// if (curDay != curMonthMaxDay) { //todo 周期性费用 日应收重新算 if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 } // todo 计算 应收 curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP); -// } else { // todo 如果是整月 那就按月计算,以免 转换成天再 乘以天数后的误差 -// curMonthReceivableAmount = receivableAmount; -// } + // todo 保存数据到pay_fee_detail_month toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime, deadlineTime); payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos); + } + + + /** + * 一次性或者非自然月处理 + * + * @param feeDto + * @param payFeeMonthOwnerDto + * @param deadlineTime + * @param oweMonth + */ + private void waitDispersedOweFeeOnceUnNormalMonth(FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto, double feePrice, Date deadlineTime, double oweMonth) { + + // 不是一次性费用 并且是 自然月就返回 + if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag()) && DateUtil.getDay(feeDto.getStartTime()) == 1) { + return; + } + List payFeeDetailMonthPos = new ArrayList<>(); + // todo 处理 开始时间和结束时间 + Date startTime = DateUtil.timeToDate(feeDto.getEndTime()); + Date endTime = DateUtil.deadTimeToDate(deadlineTime); + + BigDecimal receivableAmount = new BigDecimal(feePrice).multiply(new BigDecimal(oweMonth)).setScale(8, BigDecimal.ROUND_HALF_UP); + + BigDecimal dayReceivableAmount = null; + + + int day = DateUtil.daysBetween(endTime, startTime); + if (day < 1) { + day = 1; + } + dayReceivableAmount = receivableAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 日 应收 + + // todo 寻找第一个自然月 一日 + Calendar firstMonthDayCal = Calendar.getInstance(); + firstMonthDayCal.setTime(startTime); + firstMonthDayCal.add(Calendar.MONTH, 1); + firstMonthDayCal.set(Calendar.DAY_OF_MONTH, 1); + Date firstMonthDayTime = firstMonthDayCal.getTime(); + + Date startMonthDayTime = startTime; + // todo 循环,只到 firstMonthDayTime 大于 endTime + int curDay = 0; + int curMonthMaxDay = 30; + BigDecimal curMonthReceivableAmount = null; + + while (firstMonthDayTime.getTime() < endTime.getTime()) { + curDay = DateUtil.daysBetween(firstMonthDayTime, startMonthDayTime); + // todo 计算 应收 + curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP); + + // todo 保存数据到pay_fee_detail_month + toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime, deadlineTime); + + // todo 将startTime 修改为 下月1日时间 + startMonthDayTime = firstMonthDayTime; + firstMonthDayCal.add(Calendar.MONTH, 1); + firstMonthDayTime = firstMonthDayCal.getTime(); + } + + //todo 最后处理 最后 startMonthDayTime 到endTime 的 + if (startMonthDayTime.getTime() >= endTime.getTime()) { + payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos); + return; + } + curDay = DateUtil.daysBetween(endTime, startMonthDayTime); + // todo 计算 应收 + curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP); + // todo 保存数据到pay_fee_detail_month + toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), 0, null, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime, deadlineTime); + payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos); } - private void doDispersedFeeDetail(FeeDetailDto feeDetailDto, FeeDto feeDto, PayFeeMonthOwnerDto + + + + /** + * 自然月处理已经交过费的 + * + * @param feeDetailDto + * @param feeDto + * @param payFeeMonthOwnerDto + * @param feePrice + */ + private void doDispersedFeeDetailNormalMonth(FeeDetailDto feeDetailDto, FeeDto feeDto, PayFeeMonthOwnerDto payFeeMonthOwnerDto, Double feePrice) { + // 一次性费用直接返回 + if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { + return; + } + // 不是自然月 费用直接返回 + if (DateUtil.getDay(feeDto.getStartTime()) != 1) { + return; + } List payFeeDetailMonthPos = new ArrayList<>(); // todo 去除 开始时间和 结束时间的 小时 分钟 秒 @@ -273,11 +369,13 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { } double month = DateUtil.dayCompare(feeDetailDto.getStartTime(), feeDetailDto.getEndTime(), true); - BigDecimal receivableAmount = new BigDecimal(feePrice + ""); - BigDecimal receivedAmount = new BigDecimal(Double.parseDouble(feeDetailDto.getReceivedAmount())); + BigDecimal receivableAmount = new BigDecimal(feeDetailDto.getReceivableAmount()); + BigDecimal receivedAmount = new BigDecimal(feeDetailDto.getReceivedAmount()); + BigDecimal monthReceivableAmount = receivableAmount.divide(new BigDecimal(month + ""), 8, BigDecimal.ROUND_HALF_UP); + BigDecimal monthReceivedAmount = receivedAmount.divide(new BigDecimal(month + ""), 8, BigDecimal.ROUND_HALF_UP); - BigDecimal dayReceivableAmount = receivableAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 日 应收 - BigDecimal dayReceivedAmount = receivedAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 + BigDecimal dayReceivableAmount = null; + BigDecimal dayReceivedAmount = null; // todo 寻找第一个自然月 一日 Calendar firstMonthDayCal = Calendar.getInstance(); @@ -298,15 +396,18 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { Calendar calendar = Calendar.getInstance(); calendar.setTime(startMonthDayTime); curMonthMaxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); - if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { - dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 - dayReceivedAmount = receivedAmount.divide(new BigDecimal(month + ""), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 - dayReceivedAmount = dayReceivedAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 - } + dayReceivableAmount = monthReceivableAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 + dayReceivedAmount = monthReceivedAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 // todo 计算 应收 curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP); // todo 计算 实收 curMonthReceivedAmount = new BigDecimal(curDay).multiply(dayReceivedAmount).setScale(4, BigDecimal.ROUND_HALF_UP); + if(curMonthReceivableAmount.doubleValue() > receivableAmount.doubleValue()){ + curMonthReceivableAmount = receivableAmount; + } + if(curMonthReceivedAmount.doubleValue() > receivedAmount.doubleValue()){ + curMonthReceivedAmount = receivedAmount; + } // todo 保存数据到pay_fee_detail_month toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), curMonthReceivedAmount.doubleValue(), feeDetailDto, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime, endTime); @@ -314,6 +415,9 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { startMonthDayTime = firstMonthDayTime; firstMonthDayCal.add(Calendar.MONTH, 1); firstMonthDayTime = firstMonthDayCal.getTime(); + + receivableAmount = receivableAmount.subtract(curMonthReceivableAmount); + receivedAmount = receivedAmount.subtract(curMonthReceivedAmount); } //todo 最后处理 最后 startMonthDayTime 到endTime 的 @@ -327,11 +431,96 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { Calendar calendar = Calendar.getInstance(); calendar.setTime(startMonthDayTime); curMonthMaxDay = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); - if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) { - dayReceivableAmount = receivableAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 - dayReceivedAmount = receivedAmount.divide(new BigDecimal(month + ""), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 - dayReceivedAmount = dayReceivedAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 + dayReceivableAmount = monthReceivableAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 + dayReceivedAmount = monthReceivedAmount.divide(new BigDecimal(curMonthMaxDay), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 + + // todo 计算 应收 + curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP); + // todo 计算 实收 + curMonthReceivedAmount = new BigDecimal(curDay).multiply(dayReceivedAmount).setScale(4, BigDecimal.ROUND_HALF_UP); + + if(curMonthReceivableAmount.doubleValue() > receivableAmount.doubleValue()){ + curMonthReceivableAmount = receivableAmount; + } + if(curMonthReceivedAmount.doubleValue() > receivedAmount.doubleValue()){ + curMonthReceivedAmount = receivedAmount; } + + // todo 保存数据到pay_fee_detail_month + toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), curMonthReceivedAmount.doubleValue(), feeDetailDto, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime, endTime); + payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos); + } + + + /** + * 非自然月或者一次性费用处理已经交过费的 + * + * @param feeDetailDto + * @param feeDto + * @param payFeeMonthOwnerDto + * @param feePrice + */ + private void doDispersedFeeDetailUnNormalMonth(FeeDetailDto feeDetailDto, FeeDto feeDto, PayFeeMonthOwnerDto + payFeeMonthOwnerDto, Double feePrice) { + // 不是一次性费用 并且是 自然月就返回 + if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag()) && DateUtil.getDay(feeDto.getStartTime()) == 1) { + return; + } + + List payFeeDetailMonthPos = new ArrayList<>(); + + // todo 去除 开始时间和 结束时间的 小时 分钟 秒 + Date startTime = DateUtil.timeToDate(feeDetailDto.getStartTime()); + Date endTime = feeDetailDto.getEndTime(); + endTime = DateUtil.getNextSecDateTime(endTime); + endTime = DateUtil.timeToDate(endTime); + + int day = DateUtil.daysBetween(endTime, startTime); + if (day < 1) { + day = 1; + } + + BigDecimal receivableAmount = new BigDecimal(feeDetailDto.getReceivableAmount()); + BigDecimal receivedAmount = new BigDecimal(feeDetailDto.getReceivedAmount()); + + BigDecimal dayReceivableAmount = receivableAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 日 应收 + BigDecimal dayReceivedAmount = receivedAmount.divide(new BigDecimal(day), 8, BigDecimal.ROUND_HALF_UP);// 日 实收 + + // todo 寻找第一个自然月 一日 + Calendar firstMonthDayCal = Calendar.getInstance(); + firstMonthDayCal.setTime(startTime); + firstMonthDayCal.add(Calendar.MONTH, 1); + firstMonthDayCal.set(Calendar.DAY_OF_MONTH, 1); + Date firstMonthDayTime = firstMonthDayCal.getTime(); + + Date startMonthDayTime = startTime; + // todo 循环,只到 firstMonthDayTime 大于 endTime + int curDay = 0; + BigDecimal curMonthReceivableAmount = null; + BigDecimal curMonthReceivedAmount = null; + int curMonthMaxDay = 30; + while (firstMonthDayTime.getTime() < endTime.getTime()) { + curDay = DateUtil.daysBetween(firstMonthDayTime, startMonthDayTime); + // todo 计算 应收 + curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP); + // todo 计算 实收 + curMonthReceivedAmount = new BigDecimal(curDay).multiply(dayReceivedAmount).setScale(4, BigDecimal.ROUND_HALF_UP); + // todo 保存数据到pay_fee_detail_month + toSavePayFeeDetailMonth(curMonthReceivableAmount.doubleValue(), curMonthReceivedAmount.doubleValue(), feeDetailDto, feeDto, payFeeMonthOwnerDto, payFeeDetailMonthPos, startMonthDayTime, endTime); + + // todo 将startTime 修改为 下月1日时间 + startMonthDayTime = firstMonthDayTime; + firstMonthDayCal.add(Calendar.MONTH, 1); + firstMonthDayTime = firstMonthDayCal.getTime(); + } + + //todo 最后处理 最后 startMonthDayTime 到endTime 的 + if (startMonthDayTime.getTime() >= endTime.getTime()) { + payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos); + return; + } + + curDay = DateUtil.daysBetween(endTime, startMonthDayTime); // todo 计算 应收 curMonthReceivableAmount = new BigDecimal(curDay).multiply(dayReceivableAmount).setScale(4, BigDecimal.ROUND_HALF_UP); // todo 计算 实收 @@ -342,7 +531,6 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos); } - /** * 保存数据 * @@ -379,6 +567,9 @@ public class PayFeeMonthHelp implements IPayFeeMonthHelp { getDiscountAmount(Double.parseDouble(tmpPayFeeDetailMonthPo.getReceivableAmount()), Double.parseDouble(tmpPayFeeDetailMonthPo.getReceivedAmount()), calendar.getTime(), feeDto) + ""); + if (feeDetailDto == null) { + tmpPayFeeDetailMonthPo.setDiscountAmount("0"); + } tmpPayFeeDetailMonthPo.setMonthId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_monthId, true)); tmpPayFeeDetailMonthPo.setRemark("程序计算生成"); tmpPayFeeDetailMonthPo.setObjName(payFeeMonthOwnerDto.getObjName()); diff --git a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthImpl.java b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthImpl.java index ce9890d02815583ee505388a3b6c8cd5b8540b43..43808f85fea5d0672eab4c89db8d26b0a40087f3 100644 --- a/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthImpl.java +++ b/service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthImpl.java @@ -230,8 +230,10 @@ public class PayFeeMonthImpl implements IPayFeeMonth { //todo 处理 endTime 到 deadlineTime 的费用 - Date deadlineTime = computeFeeSMOImpl.getDeadlineTime(feeDto); - payFeeMonthHelp.waitDispersedOweFee(feeDto, payFeeMonthOwnerDto, feePrice, deadlineTime); + Map info = computeFeeSMOImpl.getTargetEndDateAndOweMonth(feeDto); + Date deadlineTime = (Date) info.get("targetEndDate"); + double oweMonth = (double)info.get("oweMonth"); + payFeeMonthHelp.waitDispersedOweFee(feeDto, payFeeMonthOwnerDto, feePrice, deadlineTime,oweMonth); } diff --git a/service-job/src/main/java/com/java110/job/export/adapt/ReportListOweFeeAdapt.java b/service-job/src/main/java/com/java110/job/export/adapt/ReportListOweFeeAdapt.java new file mode 100644 index 0000000000000000000000000000000000000000..53380843461cc811866e5adea329459b2a877b72 --- /dev/null +++ b/service-job/src/main/java/com/java110/job/export/adapt/ReportListOweFeeAdapt.java @@ -0,0 +1,356 @@ +package com.java110.job.export.adapt; + +import com.alibaba.fastjson.JSONObject; +import com.java110.dto.data.ExportDataDto; +import com.java110.dto.fee.FeeConfigDto; +import com.java110.dto.reportFee.ReportOweFeeDto; +import com.java110.dto.reportFee.ReportOweFeeItemDto; +import com.java110.intf.fee.IPayFeeConfigV1InnerServiceSMO; +import com.java110.intf.report.IReportOweFeeInnerServiceSMO; +import com.java110.job.export.IExportDataAdapt; +import com.java110.utils.util.DateUtil; +import com.java110.utils.util.ListUtil; +import com.java110.utils.util.StringUtil; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.math.BigDecimal; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@Service("reportListOweFee") +public class ReportListOweFeeAdapt implements IExportDataAdapt { + + @Autowired + private IReportOweFeeInnerServiceSMO reportOweFeeInnerServiceSMOImpl; + + @Autowired + private IPayFeeConfigV1InnerServiceSMO payFeeConfigV1InnerServiceSMOImpl; + + + @Override + public SXSSFWorkbook exportData(ExportDataDto exportDataDto) throws ParseException { + SXSSFWorkbook workbook = null; //工作簿 + String userId = ""; + //工作表 + workbook = new SXSSFWorkbook(); + workbook.setCompressTempFiles(false); + + JSONObject reqJson = exportDataDto.getReqJson(); + String configIds = reqJson.getString("configIds"); + //查询楼栋信息 + List oweFees = this.getReportListOweFees(reqJson); + if (ListUtil.isNull(oweFees)) { + return workbook; + } + //获取费用项 + List feeConfigDtos = getFeeConfigs(oweFees); + Sheet sheet = workbook.createSheet("欠费清单"); + Row row = sheet.createRow(0); + row.createCell(0).setCellValue("收费对象"); + row.createCell(1).setCellValue("业主名称"); + row.createCell(2).setCellValue("手机号"); + row.createCell(3).setCellValue("开始时间"); + row.createCell(4).setCellValue("结束时间"); + if (!StringUtil.isEmpty(configIds)) { + for (int feeConfigIndex = 0; feeConfigIndex < feeConfigDtos.size(); feeConfigIndex++) { + row.createCell(5 + feeConfigIndex).setCellValue(feeConfigDtos.get(feeConfigIndex).getFeeName()); + } + row.createCell(5 + feeConfigDtos.size()).setCellValue("合计"); + } else { + row.createCell(5).setCellValue("合计"); + } + + + ReportOweFeeDto reportOweFeeDto = null; + for (int roomIndex = 0; roomIndex < oweFees.size(); roomIndex++) { + row = sheet.createRow(roomIndex + 1); + reportOweFeeDto = oweFees.get(roomIndex); + row.createCell(0).setCellValue(reportOweFeeDto.getPayerObjName()); + row.createCell(1).setCellValue(reportOweFeeDto.getOwnerName()); + row.createCell(2).setCellValue(reportOweFeeDto.getOwnerTel()); + row.createCell(3).setCellValue(reportOweFeeDto.getEndTime()); + row.createCell(4).setCellValue(reportOweFeeDto.getDeadlineTime()); + if (!StringUtil.isEmpty(configIds)) { + for (int feeConfigIndex = 0; feeConfigIndex < feeConfigDtos.size(); feeConfigIndex++) { + row.createCell(5 + feeConfigIndex).setCellValue(getFeeConfigAmount(feeConfigDtos.get(feeConfigIndex), reportOweFeeDto)); + } + row.createCell(5 + feeConfigDtos.size()).setCellValue(getAllFeeOweAmount(feeConfigDtos, reportOweFeeDto)); + } else { + row.createCell(5).setCellValue(getAllFeeOweAmount(feeConfigDtos, reportOweFeeDto)); + } + + } + return workbook; + } + + private List getReportListOweFees(JSONObject reqJson) { + + ReportOweFeeDto reportOweFeeDto = new ReportOweFeeDto(); + reportOweFeeDto.setPage(1); + reportOweFeeDto.setRow(10000); + reportOweFeeDto.setHasOweFee("Y"); + + List allReportOweFeeDtos = reportOweFeeInnerServiceSMOImpl.queryReportAllOweFees(reportOweFeeDto); + if (ListUtil.isNull(allReportOweFeeDtos)) { + return allReportOweFeeDtos; + } + + //get old report owe fee + List oldReportOweFeeDtos = new ArrayList<>(); + ReportOweFeeDto oldReportOweFeeDto = null; + for (ReportOweFeeDto tmpReportOweFeeDto : allReportOweFeeDtos) { + if (existsOweFee(oldReportOweFeeDtos, tmpReportOweFeeDto.getPayerObjId())) { + continue; + } + oldReportOweFeeDto = new ReportOweFeeDto(); + oldReportOweFeeDto.setPayerObjId(tmpReportOweFeeDto.getPayerObjId()); + + oldReportOweFeeDtos.add(oldReportOweFeeDto); + } + + for (ReportOweFeeDto tmpReportOweFeeDto : oldReportOweFeeDtos) { + dealItem(tmpReportOweFeeDto, allReportOweFeeDtos); + } + + if (reportOweFeeDto.getConfigIds() == null || reportOweFeeDto.getConfigIds().length < 1) { + return oldReportOweFeeDtos; + } + + //如果费用对象上没有这个费用项时默认写零 + FeeConfigDto feeConfigDto = null; + feeConfigDto = new FeeConfigDto(); + feeConfigDto.setConfigIds(reportOweFeeDto.getConfigIds()); + List feeConfigDtos = payFeeConfigV1InnerServiceSMOImpl.queryPayFeeConfigs(feeConfigDto); + for (ReportOweFeeDto tmpReportOweFeeDto : oldReportOweFeeDtos) { + for (String configId : reportOweFeeDto.getConfigIds()) { + if (hasItem(tmpReportOweFeeDto.getItems(), configId) != null) { + continue; + } + ReportOweFeeItemDto reportOweFeeItemDto = new ReportOweFeeItemDto(); + reportOweFeeItemDto.setConfigId(configId); + reportOweFeeItemDto.setConfigName(getFeeConfigName(feeConfigDtos, configId)); + reportOweFeeItemDto.setAmountOwed("0"); + reportOweFeeItemDto.setPayerObjId(""); + reportOweFeeItemDto.setPayerObjName(""); + tmpReportOweFeeDto.getItems().add(reportOweFeeItemDto); + } + } + return oldReportOweFeeDtos; + } + + private ReportOweFeeItemDto hasItem(List reportOweFeeItemDtos, String configId) { + if (ListUtil.isNull(reportOweFeeItemDtos)) { + return null; + } + for (ReportOweFeeItemDto reportOweFeeItemDto : reportOweFeeItemDtos) { + if (reportOweFeeItemDto.getConfigId().equals(configId)) { + return reportOweFeeItemDto; + } + } + + return null; + } + + private void dealItem(ReportOweFeeDto oldReportOweFeeDto, List allReportOweFeeDtos) { + List items = new ArrayList<>(); + if (ListUtil.isNull(allReportOweFeeDtos)) { + return; + } + + ReportOweFeeItemDto reportOweFeeItemDto = null; + for (ReportOweFeeDto reportOweFeeDto : allReportOweFeeDtos) { + if (!oldReportOweFeeDto.getPayerObjId().equals(reportOweFeeDto.getPayerObjId())) { + continue; + } + reportOweFeeItemDto = hasItem(items, reportOweFeeDto.getConfigId()); + if (reportOweFeeItemDto == null) { + reportOweFeeItemDto = new ReportOweFeeItemDto(); + reportOweFeeItemDto.setConfigId(reportOweFeeDto.getConfigId()); + reportOweFeeItemDto.setFeeName(reportOweFeeDto.getFeeName()); + reportOweFeeItemDto.setAmountOwed(reportOweFeeDto.getAmountOwed()); + reportOweFeeItemDto.setPayerObjId(reportOweFeeDto.getPayerObjId()); + reportOweFeeItemDto.setPayerObjName(reportOweFeeDto.getPayerObjName()); + reportOweFeeItemDto.setConfigName(reportOweFeeDto.getConfigName()); + try { + reportOweFeeItemDto.setStartTime(DateUtil.getDateFromString(reportOweFeeDto.getEndTime(), DateUtil.DATE_FORMATE_STRING_A)); + reportOweFeeItemDto.setEndTime(DateUtil.getDateFromString(reportOweFeeDto.getDeadlineTime(), DateUtil.DATE_FORMATE_STRING_A)); + } catch (ParseException e) { + e.printStackTrace(); + } + items.add(reportOweFeeItemDto); + } else { + BigDecimal oldAmount = new BigDecimal(Double.parseDouble(reportOweFeeItemDto.getAmountOwed())); + oldAmount = oldAmount.add(new BigDecimal(Double.parseDouble(reportOweFeeDto.getAmountOwed()))).setScale(2, BigDecimal.ROUND_HALF_EVEN); + reportOweFeeItemDto.setAmountOwed(oldAmount.doubleValue() + ""); + } + if (!StringUtil.isEmpty(reportOweFeeDto.getOwnerName()) && StringUtil.isEmpty(oldReportOweFeeDto.getOwnerName())) { + oldReportOweFeeDto.setOwnerName(reportOweFeeDto.getOwnerName()); + } + if (!StringUtil.isEmpty(reportOweFeeDto.getOwnerTel()) && StringUtil.isEmpty(oldReportOweFeeDto.getOwnerTel())) { + oldReportOweFeeDto.setOwnerTel(reportOweFeeDto.getOwnerTel()); + } + oldReportOweFeeDto.setUpdateTime(reportOweFeeDto.getUpdateTime()); + oldReportOweFeeDto.setConfigName(reportOweFeeDto.getConfigName()); + } + + //计算总金额 + BigDecimal totalAmount = new BigDecimal(0); + Date startTime = null; + Date endTime = null; + for (ReportOweFeeItemDto tempReportOweFeeItemDto : items) { + if (startTime == null) { + startTime = tempReportOweFeeItemDto.getStartTime(); + } + if (startTime.getTime() > tempReportOweFeeItemDto.getStartTime().getTime()) { + startTime = tempReportOweFeeItemDto.getStartTime(); + } + if (endTime == null) { + endTime = tempReportOweFeeItemDto.getEndTime(); + } + if (endTime.getTime() < tempReportOweFeeItemDto.getEndTime().getTime()) { + endTime = tempReportOweFeeItemDto.getEndTime(); + } + totalAmount = totalAmount.add(new BigDecimal(Double.parseDouble(tempReportOweFeeItemDto.getAmountOwed()))).setScale(2, BigDecimal.ROUND_HALF_EVEN); + } + oldReportOweFeeDto.setEndTime(DateUtil.getFormatTimeString(startTime, DateUtil.DATE_FORMATE_STRING_A)); + oldReportOweFeeDto.setDeadlineTime(DateUtil.getFormatTimeString(endTime, DateUtil.DATE_FORMATE_STRING_A)); + oldReportOweFeeDto.setItems(items); + oldReportOweFeeDto.setPayerObjName(items.get(0).getPayerObjName()); + oldReportOweFeeDto.setAmountOwed(totalAmount.doubleValue() + ""); + + } + + private String getFeeConfigName(List feeConfigDtos, String configId) { + + if (ListUtil.isNull(feeConfigDtos)) { + return "无"; + } + + for (FeeConfigDto feeConfigDto : feeConfigDtos) { + if (feeConfigDto.getConfigId().equals(configId)) { + return feeConfigDto.getFeeName(); + } + } + + return "无"; + } + + /** + * exists owe fee in oldReportOweFeeDtos + * true is exists false is not + * + * @param oldReportOweFeeDtos + * @param payerObjId + * @return + */ + private boolean existsOweFee(List oldReportOweFeeDtos, String payerObjId) { + for (ReportOweFeeDto tmpReportOweFeeDto : oldReportOweFeeDtos) { + // if equal return true + if (tmpReportOweFeeDto.getPayerObjId().equals(payerObjId)) { + return true; + } + + } + //default return false + return false; + } + + private List getFeeConfigs(List oweFees) { + List feeConfigDtos = new ArrayList<>(); + FeeConfigDto feeConfigDto = null; + for (int oweFeeIndex = 0; oweFeeIndex < oweFees.size(); oweFeeIndex++) { + List items = oweFees.get(oweFeeIndex).getItems(); + for (int itemIndex = 0; itemIndex < items.size(); itemIndex++) { + if (existsFeeConfig(feeConfigDtos, items.get(itemIndex))) { + continue; + } + feeConfigDto = new FeeConfigDto(); + feeConfigDto.setConfigId(items.get(itemIndex).getConfigId()); + feeConfigDto.setFeeName(items.get(itemIndex).getConfigName()); + feeConfigDtos.add(feeConfigDto); + } + } + + return feeConfigDtos; + } + + private boolean existsFeeConfig(List feeConfigDtos, ReportOweFeeItemDto reportOweFeeItemDto) { + if (ListUtil.isNull(feeConfigDtos)) { + return false; + } + for (FeeConfigDto feeConfigDto : feeConfigDtos) { + if (feeConfigDto.getConfigId().equals(reportOweFeeItemDto.getConfigId())) { + return true; + } + } + + return false; + } + + /** + * _getAllFeeOweAmount: function (_fee) { + * let _feeConfigNames = $that.listOweFeeInfo.feeConfigNames; + * if (_feeConfigNames.length < 1) { + * return _fee.amountOwed; + * } + *

+ * let _amountOwed = 0.0; + * let _items = _fee.items; + * _feeConfigNames.forEach(_feeItem =>{ + * _items.forEach(_item=>{ + * if(_feeItem.configId == _item.configId){ + * _amountOwed += parseFloat(_item.amountOwed); + * } + * }) + * }) + * return _amountOwed; + * } + * + * @param reportOweFeeDto + * @return + */ + private double getAllFeeOweAmount(List feeConfigDtos, ReportOweFeeDto reportOweFeeDto) { + if (ListUtil.isNull(feeConfigDtos)) { + return Double.parseDouble(reportOweFeeDto.getAmountOwed()); + } + List items = reportOweFeeDto.getItems(); + if (ListUtil.isNull(items)) { + return Double.parseDouble(reportOweFeeDto.getAmountOwed()); + } + + BigDecimal oweAmount = new BigDecimal(0); + for (FeeConfigDto feeConfigDto : feeConfigDtos) { + for (int itemIndex = 0; itemIndex < items.size(); itemIndex++) { + if (feeConfigDto.getConfigId().equals(items.get(itemIndex).getConfigId())) { + oweAmount = oweAmount.add(new BigDecimal(items.get(itemIndex).getAmountOwed())); + } + } + } + + return oweAmount.doubleValue(); + } + + private double getFeeConfigAmount(FeeConfigDto feeConfigDto, ReportOweFeeDto reportOweFeeDto) { + List items = reportOweFeeDto.getItems(); + double oweAmount = 0; + + if (ListUtil.isNull(items)) { + return oweAmount; + } + + for (int itemIndex = 0; itemIndex < items.size(); itemIndex++) { + if (feeConfigDto.getConfigId().equals(items.get(itemIndex).getConfigId())) { + oweAmount = Double.parseDouble(items.get(itemIndex).getAmountOwed()); + break; + } + } + return oweAmount; + } + +} diff --git a/service-job/src/main/java/com/java110/job/export/adapt/ReportOweFeeDetailAdapt.java b/service-job/src/main/java/com/java110/job/export/adapt/ReportOweFeeDetailAdapt.java new file mode 100644 index 0000000000000000000000000000000000000000..3aeaf0f4ddb6b4a228973560965fff11351871f0 --- /dev/null +++ b/service-job/src/main/java/com/java110/job/export/adapt/ReportOweFeeDetailAdapt.java @@ -0,0 +1,115 @@ +package com.java110.job.export.adapt; + +import com.alibaba.fastjson.JSONObject; +import com.java110.dto.data.ExportDataDto; +import com.java110.dto.reportFee.ReportFeeMonthStatisticsDto; +import com.java110.intf.report.IReportFeeMonthStatisticsInnerServiceSMO; +import com.java110.job.export.IExportDataAdapt; +import com.java110.utils.util.BeanConvertUtil; +import com.java110.utils.util.DateUtil; +import com.java110.utils.util.ListUtil; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.math.BigDecimal; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.List; + +@Component("reportOweFeeDetail") +public class ReportOweFeeDetailAdapt implements IExportDataAdapt { + + @Autowired + private IReportFeeMonthStatisticsInnerServiceSMO reportFeeMonthStatisticsInnerServiceSMOImpl; + + @Override + public SXSSFWorkbook exportData(ExportDataDto exportDataDto) throws ParseException { + + JSONObject paramIn = exportDataDto.getReqJson(); + SXSSFWorkbook workbook = null; //工作簿 + //工作表 + workbook = new SXSSFWorkbook(); + workbook.setCompressTempFiles(false); + Sheet sheet = workbook.createSheet("欠费明细表"); + Row row = sheet.createRow(0); + row.createCell(0).setCellValue("费用编号"); + row.createCell(1).setCellValue("房号"); + row.createCell(2).setCellValue("业主"); + row.createCell(3).setCellValue("业主电话"); + row.createCell(4).setCellValue("面积"); + row.createCell(5).setCellValue("费用项"); + row.createCell(6).setCellValue("开始时间"); + row.createCell(7).setCellValue("结束时间"); + row.createCell(8).setCellValue("欠费时长(天)"); + row.createCell(9).setCellValue("欠费时长(月)"); + row.createCell(10).setCellValue("欠费金额"); + + List rooms = this.getReportOweFeeDetail(paramIn); + if (ListUtil.isNull(rooms)) { + return workbook; + } + ReportFeeMonthStatisticsDto dataObj = null; + BigDecimal monthDec = null; + for (int roomIndex = 0; roomIndex < rooms.size(); roomIndex++) { + row = sheet.createRow(roomIndex + 1); + dataObj = rooms.get(roomIndex); + row.createCell(0).setCellValue(roomIndex + 1); + row.createCell(1).setCellValue(dataObj.getObjName()); + row.createCell(2).setCellValue(dataObj.getOwnerName()); + row.createCell(3).setCellValue(dataObj.getOwnerTel()); + row.createCell(4).setCellValue(dataObj.getBuiltUpArea()); + row.createCell(5).setCellValue(dataObj.getFeeName()); + row.createCell(6).setCellValue(dataObj.getStartTime()); + row.createCell(7).setCellValue(dataObj.getEndTime()); + row.createCell(8).setCellValue(dataObj.getOweDay()); + monthDec = new BigDecimal(dataObj.getOweDay()); + monthDec = monthDec.divide(new BigDecimal("30"), 2, BigDecimal.ROUND_HALF_UP); + row.createCell(9).setCellValue(monthDec.doubleValue()); + row.createCell(10).setCellValue(dataObj.getOweAmount()); + } + return workbook; + } + + private List getReportOweFeeDetail(JSONObject paramIn) { + + ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = BeanConvertUtil.covertBean(paramIn, ReportFeeMonthStatisticsDto.class); + reportFeeMonthStatisticsDto.setPage(1); + reportFeeMonthStatisticsDto.setRow(10000); + int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryOweFeeDetailCount(reportFeeMonthStatisticsDto); + List reportFeeMonthStatisticsDtos = null; + if (count > 0) { + reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryOweFeeDetail(reportFeeMonthStatisticsDto); + ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = reportFeeMonthStatisticsInnerServiceSMOImpl.queryOweFeeDetailMajor(reportFeeMonthStatisticsDto); + if (!ListUtil.isNull(reportFeeMonthStatisticsDtos)) { + for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsDtos) { +// reportFeeMonthStatisticsDto1.setAllReceivableAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount()); +// reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivedAmount()); + reportFeeMonthStatisticsDto1.setAllOweAmount(tmpReportFeeMonthStatisticsDto.getOweAmount()); + } + } + freshReportOweDay(reportFeeMonthStatisticsDtos); + } else { + reportFeeMonthStatisticsDtos = new ArrayList<>(); + } + + return reportFeeMonthStatisticsDtos; + + + } + + private void freshReportOweDay(List reportFeeMonthStatisticsDtos) { + int day = 0; + for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) { + try { + day = DateUtil.daysBetween(DateUtil.getDateFromStringB(reportFeeMonthStatisticsDto.getEndTime()), + DateUtil.getDateFromStringB(reportFeeMonthStatisticsDto.getStartTime())); + reportFeeMonthStatisticsDto.setOweDay(day); + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} diff --git a/service-job/src/main/java/com/java110/job/export/adapt/ReportPayFeeDepositAdapt.java b/service-job/src/main/java/com/java110/job/export/adapt/ReportPayFeeDepositAdapt.java new file mode 100644 index 0000000000000000000000000000000000000000..aef6184aa5cc0e32bbf19829492c618cd7778c99 --- /dev/null +++ b/service-job/src/main/java/com/java110/job/export/adapt/ReportPayFeeDepositAdapt.java @@ -0,0 +1,114 @@ +package com.java110.job.export.adapt; + +import com.alibaba.fastjson.JSONObject; +import com.java110.dto.data.ExportDataDto; +import com.java110.dto.fee.FeeConfigDto; +import com.java110.dto.fee.FeeDto; +import com.java110.dto.report.ReportDeposit; +import com.java110.intf.fee.IFeeConfigInnerServiceSMO; +import com.java110.intf.report.IReportFeeMonthStatisticsInnerServiceSMO; +import com.java110.job.export.IExportDataAdapt; +import com.java110.utils.util.BeanConvertUtil; +import com.java110.utils.util.ListUtil; +import com.java110.utils.util.StringUtil; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.util.List; + +@Service("reportPayFeeDeposit") +public class ReportPayFeeDepositAdapt implements IExportDataAdapt { + + @Autowired + private IReportFeeMonthStatisticsInnerServiceSMO reportFeeMonthStatisticsInnerServiceSMOImpl; + + @Autowired + private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl; + @Override + public SXSSFWorkbook exportData(ExportDataDto exportDataDto) throws ParseException { + + JSONObject reqJson = exportDataDto.getReqJson(); + SXSSFWorkbook workbook = null; //工作簿 + //工作表 + workbook = new SXSSFWorkbook(); + workbook.setCompressTempFiles(false); + Sheet sheet = workbook.createSheet("押金报表"); + Row row = sheet.createRow(0); + row.createCell(0).setCellValue("费用ID"); + row.createCell(1).setCellValue("房号"); + row.createCell(2).setCellValue("业主"); + row.createCell(3).setCellValue("费用类型"); + row.createCell(4).setCellValue("费用项"); + row.createCell(5).setCellValue("费用开始时间"); + row.createCell(6).setCellValue("费用结束时间"); + row.createCell(7).setCellValue("创建时间"); + row.createCell(8).setCellValue("付费对象类型"); + row.createCell(9).setCellValue("付款方ID"); + row.createCell(10).setCellValue("应收金额"); + row.createCell(11).setCellValue("状态"); + row.createCell(12).setCellValue("退费状态"); + + List reportPayFeeDeposits = this.getReportPayFeeDeposit(reqJson); + if (ListUtil.isNull(reportPayFeeDeposits)) { + return workbook; + } + ReportDeposit dataObj = null; + for (int roomIndex = 0; roomIndex < reportPayFeeDeposits.size(); roomIndex++) { + row = sheet.createRow(roomIndex + 1); + dataObj = reportPayFeeDeposits.get(roomIndex); + row.createCell(0).setCellValue(dataObj.getFeeId()); + if (!StringUtil.isEmpty(dataObj.getPayerObjType()) && dataObj.getPayerObjType().equals("3333")) { //房屋 + row.createCell(1).setCellValue(dataObj.getFloorNum() + "-" + dataObj.getUnitNum() + "-" + dataObj.getRoomNum()); + } else { + row.createCell(1).setCellValue(dataObj.getObjName()); + } + row.createCell(2).setCellValue(dataObj.getOwnerName()); + row.createCell(3).setCellValue(dataObj.getFeeTypeCdName()); + row.createCell(4).setCellValue(dataObj.getFeeName()); + row.createCell(5).setCellValue(dataObj.getStartTime()); + row.createCell(6).setCellValue(dataObj.getDeadlineTime()); + row.createCell(7).setCellValue(dataObj.getCreateTime()); + row.createCell(8).setCellValue(dataObj.getPayerObjTypeName()); + row.createCell(9).setCellValue(dataObj.getPayerObjId()); + row.createCell(10).setCellValue(dataObj.getAdditionalAmount()); + row.createCell(11).setCellValue(dataObj.getStateName()); + if (dataObj.getState().equals("2009001")) { + row.createCell(12).setCellValue(dataObj.getDetailStateName()); + } else { + row.createCell(12).setCellValue("未缴费"); + } + } + return workbook; + } + + private List getReportPayFeeDeposit(JSONObject reqJson) { + + ReportDeposit reportDeposit = BeanConvertUtil.covertBean(reqJson,ReportDeposit.class); + reportDeposit.setPage(1); + reportDeposit.setRow(10000); + List reportDeposits = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDeposit(reportDeposit); + //查询押金费用项 + FeeConfigDto feeConfigDto = new FeeConfigDto(); + feeConfigDto.setCommunityId(reportDeposit.getCommunityId()); + feeConfigDto.setFeeTypeCd("888800010006"); + List feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto); + + + for (ReportDeposit deposit : reportDeposits) { + deposit.setFeeConfigDtos(feeConfigDtos); + if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(deposit.getPayerObjType())) { + deposit.setObjName(deposit.getFloorNum() + + "栋" + deposit.getUnitNum() + + "单元" + deposit.getRoomNum() + "室"); + } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(deposit.getPayerObjType())) { + deposit.setObjName(deposit.getCarNum()); + } + } + + return reportDeposits; + } +} diff --git a/service-job/src/main/java/com/java110/job/export/adapt/ReportQuestionAnswerDetailAdapt.java b/service-job/src/main/java/com/java110/job/export/adapt/ReportQuestionAnswerDetailAdapt.java new file mode 100644 index 0000000000000000000000000000000000000000..4f23c6b8dfc7cbaa948ddcde051723399f792fed --- /dev/null +++ b/service-job/src/main/java/com/java110/job/export/adapt/ReportQuestionAnswerDetailAdapt.java @@ -0,0 +1,94 @@ +package com.java110.job.export.adapt; + +import com.alibaba.fastjson.JSONObject; +import com.java110.dto.data.ExportDataDto; +import com.java110.dto.user.UserQuestionAnswerValueDto; +import com.java110.intf.report.IReportUserQuestionAnswerValueInnerServiceSMO; +import com.java110.job.export.IExportDataAdapt; +import com.java110.utils.util.BeanConvertUtil; +import com.java110.utils.util.ListUtil; +import com.java110.utils.util.StringUtil; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.text.ParseException; +import java.util.ArrayList; +import java.util.List; + +@Service("reportQuestionAnswerDetail") +public class ReportQuestionAnswerDetailAdapt implements IExportDataAdapt { + + @Autowired + private IReportUserQuestionAnswerValueInnerServiceSMO reportUserQuestionAnswerValueInnerServiceSMOImpl; + + + @Override + public SXSSFWorkbook exportData(ExportDataDto exportDataDto) throws ParseException { + JSONObject reqJson = exportDataDto.getReqJson(); + SXSSFWorkbook workbook = null; //工作簿 + //工作表 + workbook = new SXSSFWorkbook(); + workbook.setCompressTempFiles(false); + Sheet sheet = workbook.createSheet("问卷明细表"); + Row row = sheet.createRow(0); + row.createCell(0).setCellValue("问卷人"); + row.createCell(1).setCellValue("问卷类型"); + row.createCell(2).setCellValue("问卷名称"); + row.createCell(3).setCellValue("问卷题目"); + row.createCell(4).setCellValue("答案"); + row.createCell(5).setCellValue("时间"); + + List questionAnswers = this.getReportQuestionAnswerDetail(reqJson); + if (ListUtil.isNull(questionAnswers)) { + return workbook; + } + UserQuestionAnswerValueDto dataObj = null; + for (int roomIndex = 0; roomIndex < questionAnswers.size(); roomIndex++) { + row = sheet.createRow(roomIndex + 1); + dataObj = questionAnswers.get(roomIndex); + row.createCell(0).setCellValue(dataObj.getUserName()); + row.createCell(1).setCellValue(dataObj.getQaTypeName()); + row.createCell(2).setCellValue(dataObj.getQaName()); + row.createCell(3).setCellValue(dataObj.getQaTitle()); + row.createCell(4).setCellValue(dataObj.getQaValue()); + row.createCell(5).setCellValue(dataObj.getCreateTime()); + } + return workbook; + } + + private List getReportQuestionAnswerDetail(JSONObject reqJson) { + + UserQuestionAnswerValueDto userQuestionAnswerValueDto = BeanConvertUtil.covertBean(reqJson, UserQuestionAnswerValueDto.class); + userQuestionAnswerValueDto.setPage(1); + userQuestionAnswerValueDto.setRow(10000); + + int count = reportUserQuestionAnswerValueInnerServiceSMOImpl.queryUserQuestionAnswerValuesCount(userQuestionAnswerValueDto); + + List userQuestionAnswerValueDtos = null; + if (count > 0) { + userQuestionAnswerValueDtos = reportUserQuestionAnswerValueInnerServiceSMOImpl.queryUserQuestionAnswerValues(userQuestionAnswerValueDto); + + refreshQuestionAnswerValue(userQuestionAnswerValueDtos); + } else { + userQuestionAnswerValueDtos = new ArrayList<>(); + } + + return userQuestionAnswerValueDtos; + } + + private void refreshQuestionAnswerValue(List userQuestionAnswerValueDtos) { + + if (userQuestionAnswerValueDtos == null || userQuestionAnswerValueDtos.size() < 1) { + return; + } + + for (UserQuestionAnswerValueDto userQuestionAnswerValueDto : userQuestionAnswerValueDtos) { + if (StringUtil.isEmpty(userQuestionAnswerValueDto.getValueContent())) { + userQuestionAnswerValueDto.setValueContent(userQuestionAnswerValueDto.getValueContent()); + } + } + } +} diff --git a/service-job/src/main/java/com/java110/job/export/adapt/ReportRepairDetailAdapt.java b/service-job/src/main/java/com/java110/job/export/adapt/ReportRepairDetailAdapt.java new file mode 100644 index 0000000000000000000000000000000000000000..030d75ea2ff1de50df8626fb8d84c8c15afc9560 --- /dev/null +++ b/service-job/src/main/java/com/java110/job/export/adapt/ReportRepairDetailAdapt.java @@ -0,0 +1,213 @@ +package com.java110.job.export.adapt; + +import com.alibaba.fastjson.JSONObject; +import com.java110.dto.data.ExportDataDto; +import com.java110.dto.repair.RepairUserDto; +import com.java110.intf.report.IReportFeeMonthStatisticsInnerServiceSMO; +import com.java110.job.export.IExportDataAdapt; +import com.java110.utils.util.BeanConvertUtil; +import com.java110.utils.util.ListUtil; +import com.java110.utils.util.StringUtil; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.text.ParseException; +import java.util.ArrayList; +import java.util.List; + +@Component("reportRepairDetail") +public class ReportRepairDetailAdapt implements IExportDataAdapt { + + @Autowired + private IReportFeeMonthStatisticsInnerServiceSMO reportFeeMonthStatisticsInnerServiceSMOImpl; + + @Override + public SXSSFWorkbook exportData(ExportDataDto exportDataDto) throws ParseException { + JSONObject paramIn = exportDataDto.getReqJson(); + SXSSFWorkbook workbook = null; //工作簿 + //工作表 + workbook = new SXSSFWorkbook(); + workbook.setCompressTempFiles(false); + Sheet sheet = workbook.createSheet("报修汇总表"); + Row row = sheet.createRow(0); + row.createCell(0).setCellValue("员工ID"); + row.createCell(1).setCellValue("员工姓名"); + row.createCell(2).setCellValue("处理中条数"); + row.createCell(3).setCellValue("派单条数"); + row.createCell(4).setCellValue("转单条数"); + row.createCell(5).setCellValue("退单条数"); + row.createCell(6).setCellValue("已回访条数"); + row.createCell(7).setCellValue("已完结条数"); + row.createCell(8).setCellValue("员工评分"); + RepairUserDto repairUserDto = BeanConvertUtil.covertBean(paramIn,RepairUserDto.class); + if (!StringUtil.isEmpty(repairUserDto.getBeginStartTime())) { + repairUserDto.setBeginStartTime(repairUserDto.getBeginStartTime() + " 00:00:00"); + } + if (!StringUtil.isEmpty(repairUserDto.getBeginEndTime())) { + repairUserDto.setBeginEndTime(repairUserDto.getBeginEndTime() + " 23:59:59"); + } + if (!StringUtil.isEmpty(repairUserDto.getFinishStartTime())) { + repairUserDto.setFinishStartTime(repairUserDto.getFinishStartTime() + " 00:00:00"); + } + if (!StringUtil.isEmpty(repairUserDto.getFinishEndTime())) { + repairUserDto.setFinishEndTime(repairUserDto.getFinishEndTime() + " 23:59:59"); + } + List repairs = this.queryRepair(repairUserDto); + if (ListUtil.isNull(repairs)) { + return workbook; + } + RepairUserDto dataObj = null; + for (int roomIndex = 0; roomIndex < repairs.size(); roomIndex++) { + row = sheet.createRow(roomIndex + 1); + dataObj = repairs.get(roomIndex); + row.createCell(0).setCellValue(dataObj.getStaffId()); + row.createCell(1).setCellValue(dataObj.getStaffName()); + row.createCell(2).setCellValue(dataObj.getDealAmount()); + row.createCell(3).setCellValue(dataObj.getDispatchAmount()); + row.createCell(4).setCellValue(dataObj.getTransferOrderAmount()); + row.createCell(5).setCellValue(dataObj.getChargebackAmount()); + row.createCell(6).setCellValue(dataObj.getReturnAmount()); + row.createCell(7).setCellValue(dataObj.getStatementAmount()); + row.createCell(8).setCellValue(dataObj.getScore()); + } + return workbook; + } + + public List queryRepair(RepairUserDto repairUserDto) { + //查询员工报修表员工信息 + List repairUsers = reportFeeMonthStatisticsInnerServiceSMOImpl.queryRepairForStaff(repairUserDto); + int count = repairUsers.size(); + //获取员工id和姓名集合 + List staffs; + if (StringUtil.isEmpty(repairUserDto.getStaffId())) { + repairUserDto.setPage(-1); + staffs = reportFeeMonthStatisticsInnerServiceSMOImpl.queryRepairForStaff(repairUserDto); + } else { + repairUserDto.setPage(-1); + repairUserDto.setStaffId(null); + staffs = reportFeeMonthStatisticsInnerServiceSMOImpl.queryRepairForStaff(repairUserDto); + } + List repairUserList = new ArrayList<>(); + //处理中总数量 + int dealNumber = 0; + //结单总数量 + int statementNumber = 0; + //退单总数量 + int chargebackNumber = 0; + //转单总数量 + int transferOrderNumber = 0; + //派单总数量 + int dispatchNumber = 0; + //已回访总数量 + int returnNumber = 0; + if (count > 0) { + for (RepairUserDto repairUser : repairUsers) { + RepairUserDto repairUserInfo = new RepairUserDto(); + //员工id + repairUserDto.setStaffId(repairUser.getStaffId()); + List repairUserDtoList = reportFeeMonthStatisticsInnerServiceSMOImpl.queryRepairWithOutPage(repairUserDto); + if (ListUtil.isNull(repairUserDtoList)) { + continue; + } + //处理中数量 + int dealAmount = 0; + //结单数量 + int statementAmount = 0; + //退单数量 + int chargebackAmount = 0; + //转单数量 + int transferOrderAmount = 0; + //派单数量 + int dispatchAmount = 0; + //回访数量 + int returnAmount = 0; + //评分 + String score = ""; + for (RepairUserDto repair : repairUserDtoList) { + //处理中状态 + if (repair.getState().equals("10001")) { + //获取数量 + int amount = Integer.parseInt(repair.getAmount()); + dealAmount = dealAmount + amount; + } else if (repair.getState().equals("10002")) { //结单状态 + //获取数量 + int amount = Integer.parseInt(repair.getAmount()); + statementAmount = statementAmount + amount; + } else if (repair.getState().equals("10003")) { //退单状态 + //获取数量 + int amount = Integer.parseInt(repair.getAmount()); + chargebackAmount = chargebackAmount + amount; + } else if (repair.getState().equals("10004")) { //转单状态 + //获取数量 + int amount = Integer.parseInt(repair.getAmount()); + transferOrderAmount = transferOrderAmount + amount; + } else if (repair.getState().equals("10006")) { //派单状态 + int amount = Integer.parseInt(repair.getAmount()); + dispatchAmount = dispatchAmount + amount; + } else if (repair.getState().equals("10008")) { //已回访状态 + int amount = Integer.parseInt(repair.getAmount()); + returnAmount = returnAmount + amount; + } + if (!StringUtil.isEmpty(repair.getScore())) { + score = repair.getScore(); + } + } + //员工id + repairUserInfo.setStaffId(repairUser.getStaffId()); + //员工姓名 + repairUserInfo.setStaffName(repairUser.getStaffName()); + //处理中报修数量 + repairUserInfo.setDealAmount(Integer.toString(dealAmount)); + //处理中报修总数量 + repairUserInfo.setDealNumber(Integer.toString(dealNumber)); + //结单报修数量 + repairUserInfo.setStatementAmount(Integer.toString(statementAmount)); + //结单报修总数量 + repairUserInfo.setStatementNumber(Integer.toString(statementNumber)); + //退单报修数量 + repairUserInfo.setChargebackAmount(Integer.toString(chargebackAmount)); + //退单报修总数量 + repairUserInfo.setChargebackNumber(Integer.toString(chargebackNumber)); + //转单报修数量 + repairUserInfo.setTransferOrderAmount(Integer.toString(transferOrderAmount)); + //转单报修总数量 + repairUserInfo.setTransferOrderNumber(Integer.toString(transferOrderNumber)); + //派单报修数量 + repairUserInfo.setDispatchAmount(Integer.toString(dispatchAmount)); + //派单报修总数量 + repairUserInfo.setDispatchNumber(Integer.toString(dispatchNumber)); + //回访数量 + repairUserInfo.setReturnAmount(Integer.toString(returnAmount)); + //回访总数量 + repairUserInfo.setReturnNumber(Integer.toString(returnNumber)); + //员工id和姓名信息集合 + repairUserInfo.setRepairList(staffs); + //员工评分 + repairUserInfo.setScore(score); + repairUserList.add(repairUserInfo); + + dealNumber = Integer.parseInt(repairUserInfo.getDealAmount()) + dealNumber; + statementNumber = Integer.parseInt(repairUserInfo.getStatementAmount()) + statementNumber; + chargebackNumber = Integer.parseInt(repairUserInfo.getChargebackAmount()) + chargebackNumber; + transferOrderNumber = Integer.parseInt(repairUserInfo.getTransferOrderAmount()) + transferOrderNumber; + dispatchNumber = Integer.parseInt(repairUserInfo.getDispatchAmount()) + dispatchNumber; + returnNumber = Integer.parseInt(repairUserInfo.getReturnAmount()) + returnNumber; + } + } else { + repairUserList = new ArrayList<>(); + } + + RepairUserDto repairUser = new RepairUserDto(); + repairUser.setDealNumber(Integer.toString(dealNumber)); + repairUser.setStatementNumber(Integer.toString(statementNumber)); + repairUser.setChargebackNumber(Integer.toString(chargebackNumber)); + repairUser.setTransferOrderNumber(Integer.toString(transferOrderNumber)); + repairUser.setDispatchNumber(Integer.toString(dispatchNumber)); + repairUser.setReturnNumber(Integer.toString(returnNumber)); + + return repairUserList; + } +} diff --git a/service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomFeeQueueDataAdapt.java b/service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomFeeQueueDataAdapt.java index b7c035831a462a0bea6a6b6e7f2bfd2608ab9c62..a36f85e3f48352fca3b1e9fde0ced0d9c51a66ea 100644 --- a/service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomFeeQueueDataAdapt.java +++ b/service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomFeeQueueDataAdapt.java @@ -213,7 +213,7 @@ public class ImportRoomFeeQueueDataAdapt extends DefaultImportData implements II payFeePo.setAmount(importRoomFee.getAmount()); payFeePo.setBatchId(batchId); payFeePo.setEndTime(importRoomFee.getStartTime()); - payFeePo.setStartTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); + payFeePo.setStartTime(importRoomFee.getStartTime()); payFeePos.add(payFeePo); diff --git a/service-job/src/main/java/com/java110/job/task/noticeStaff/NoticeStaffTaskTemplate.java b/service-job/src/main/java/com/java110/job/task/noticeStaff/NoticeStaffTaskTemplate.java index b5c4d7b88176ad65d0127dcc97f8eb8fe4d1f64f..735d6fa20551104e891755f5d68f41f4ac3f70d3 100644 --- a/service-job/src/main/java/com/java110/job/task/noticeStaff/NoticeStaffTaskTemplate.java +++ b/service-job/src/main/java/com/java110/job/task/noticeStaff/NoticeStaffTaskTemplate.java @@ -224,7 +224,7 @@ public class NoticeStaffTaskTemplate extends TaskSystemQuartz { InspectionTaskDetailDto inspectionTaskDetailDto = new InspectionTaskDetailDto(); inspectionTaskDetailDto.setCommunityId(communityDto.getCommunityId()); inspectionTaskDetailDto.setState(InspectionTaskDto.STATE_NO_START); - inspectionTaskDetailDto.setQrCodeTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B)); + inspectionTaskDetailDto.setQrCodeTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); inspectionTaskDetailDto.setSendFlag(InspectionTaskDetailDto.SEND_FLAG_N); List inspectionTaskDetailDtos = inspectionTaskDetailInnerServiceSMOImpl.queryInspectionTaskDetails(inspectionTaskDetailDto); for (InspectionTaskDetailDto tInspectionTaskDetailDto : inspectionTaskDetailDtos) { diff --git a/service-user/src/main/java/com/java110/user/cmd/owner/QueryAppOwnerMembersCmd.java b/service-user/src/main/java/com/java110/user/cmd/owner/QueryAppOwnerMembersCmd.java index a4eeb6b0278cf2f7eb3eb996722082a16936e9ec..2684cfa80483c45f084b13f95e7be9d2e8103c83 100644 --- a/service-user/src/main/java/com/java110/user/cmd/owner/QueryAppOwnerMembersCmd.java +++ b/service-user/src/main/java/com/java110/user/cmd/owner/QueryAppOwnerMembersCmd.java @@ -21,6 +21,7 @@ import com.java110.utils.util.Assert; import com.java110.utils.util.BeanConvertUtil; import com.java110.utils.util.ListUtil; import com.java110.utils.util.StringUtil; +import com.java110.vo.ResultVo; import com.java110.vo.api.ApiOwnerDataVo; import com.java110.vo.api.ApiOwnerVo; import org.springframework.beans.factory.annotation.Autowired; @@ -112,13 +113,7 @@ public class QueryAppOwnerMembersCmd extends Cmd { ownerDtoList = new ArrayList<>(); } - - ApiOwnerVo apiOwnerVo = new ApiOwnerVo(); - apiOwnerVo.setOwners(BeanConvertUtil.covertBeanList(ownerDtoList, ApiOwnerDataVo.class)); - apiOwnerVo.setTotal(total); - apiOwnerVo.setRecords((int) Math.ceil((double) total / (double) row)); - - ResponseEntity responseEntity = new ResponseEntity(JSONObject.toJSONString(apiOwnerVo), HttpStatus.OK); + ResponseEntity responseEntity = ResultVo.createResponseEntity((int) Math.ceil((double) total / (double) row), total, ownerDtoList); context.setResponseEntity(responseEntity); } } diff --git a/springboot/src/main/resources/application.yml b/springboot/src/main/resources/application.yml index bfa50977b3ac93049f8ebc31bb1da1b1101692db..caf4dfcd647483863672818bd860d4ec4767e8de 100644 --- a/springboot/src/main/resources/application.yml +++ b/springboot/src/main/resources/application.yml @@ -1,3 +1,3 @@ spring: profiles: - active: debug \ No newline at end of file + active: dev \ No newline at end of file