1、优化巡检明显导出2、优化房屋房间数量展示3、优化优惠赠送规则 赠送月份4、新增收银台缴费选定结束日期
11个文件已修改
678 ■■■■ 已修改文件
java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java 171 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/fee/PayFeeDetailDiscountNewV1ServiceDaoImplMapper.xml 196 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportReportFeeSMOImpl.java 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/cmd/room/AddRoomBindingCmd.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-community/src/main/java/com/java110/community/cmd/room/UpdateRoomCmd.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-fee/src/main/java/com/java110/fee/api/FeeApi.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-fee/src/main/java/com/java110/fee/bmo/impl/QueryOweFeeImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-fee/src/main/java/com/java110/fee/discount/impl/ReductionMonthFeeRule.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java
@@ -130,6 +130,7 @@
    private String cycle;
    private double feeTotalPrice;
    private String batchId;
    private String custEndTime;
    private String offlinePayFeeSwitch;
@@ -643,4 +644,11 @@
    public String getDeductFrom() { return deductFrom; }
    public void setDeductFrom(String deductFrom) { this.deductFrom = deductFrom; }
    public String getCustEndTime() {
        return custEndTime;
    }
    public void setCustEndTime(String custEndTime) {
        this.custEndTime = custEndTime;
    }
}
java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java
@@ -41,7 +41,12 @@
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.*;
/**
@@ -938,9 +943,49 @@
                BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDto.getBuiltUpArea()));
                BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
                feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(3, BigDecimal.ROUND_HALF_UP);
                if (!StringUtil.isEmpty(feeDto.getCycle())) {
                if (!StringUtil.isEmpty(feeDto.getCycle()) && !"0".equals(feeDto.getCycle())) {
                    BigDecimal cycle = new BigDecimal(feeDto.getCycle());
                    feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP);
                }
                if (!StringUtil.isEmpty(feeDto.getCycle()) && "0".equals(feeDto.getCycle()) && !StringUtil.isEmpty(feeDto.getCustEndTime())) {
                    //计算周期
                    Map<String, Object> cycleResults = dateDiff(feeDto.getEndTime(), feeDto.getCustEndTime());
                    //月份大于0
                    Integer months = Integer.valueOf(cycleResults.get("months").toString());
                    Integer days = Integer.valueOf(cycleResults.get("days").toString());
                    Integer startMonthDays = Integer.valueOf(cycleResults.get("startMonthDays").toString());
                    Integer endMonthDays = Integer.valueOf(cycleResults.get("endMonthDays").toString());
                    String isOneMonth = cycleResults.get("isOneMonth").toString();
                    //整数月
                    if (months > 0 && days == 0) {
                        BigDecimal cycle = new BigDecimal(months);
                        feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP);
                    }
                    //几个月几天   (单价*面积+附加费)*月份+((单价*面积+附加费)/总天数)*实际天数
                    if (months > 0 && days > 0) {
                        BigDecimal cycle = new BigDecimal(months);
                        BigDecimal endMonthDayss = new BigDecimal(endMonthDays);
                        BigDecimal dayss = new BigDecimal(days);
                        BigDecimal monthPrice = squarePrice.multiply(builtUpArea).add(additionalAmount);
                        feeTotalPrice = (monthPrice).multiply(cycle).add(monthPrice.divide(endMonthDayss).multiply(dayss)).setScale(3, BigDecimal.ROUND_HALF_UP);
                    }
                    //跨月份 不足一月  ((单价*面积+附加费)/开始月份总天数)*实际天数+((单价*面积+附加费)/结束月份总天数)*实际天数
                    if (months == 0 && days > 0 && "true".equals(isOneMonth)) {
                        BigDecimal startEndOfMonth = new BigDecimal(cycleResults.get("startEndOfMonth").toString());
                        BigDecimal endBeginningOfMonth = new BigDecimal(cycleResults.get("endBeginningOfMonth").toString());
                        BigDecimal endMonthDayss = new BigDecimal(endMonthDays);
                        BigDecimal startMonthDayss = new BigDecimal(startMonthDays);
                        BigDecimal monthPrice = squarePrice.multiply(builtUpArea).add(additionalAmount);
                        feeTotalPrice = monthPrice.divide(startMonthDayss, 4, BigDecimal.ROUND_HALF_UP).multiply(startEndOfMonth).add(monthPrice.divide(endMonthDayss, 4, BigDecimal.ROUND_HALF_UP).multiply(endBeginningOfMonth)).setScale(3, BigDecimal.ROUND_HALF_UP);
                    }
                    //不跨月份 不足一月  (单价*面积+附加费/开始月份总天数)*实际天数
                    if (months == 0 && days > 0 && "false".equals(isOneMonth)) {
                        BigDecimal cycle = new BigDecimal(days);
                        BigDecimal startMonthDayss = new BigDecimal(startMonthDays);
                        BigDecimal monthPrice = squarePrice.multiply(builtUpArea).add(additionalAmount);
                        feeTotalPrice = monthPrice.divide(startMonthDayss, 4, BigDecimal.ROUND_HALF_UP).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_UP);
                    }
                }
            } else if ("2002".equals(computingFormula)) { // 固定费用
                //feePrice = Double.parseDouble(feeDto.getAdditionalAmount());
@@ -1647,16 +1692,16 @@
    }
    public static void main(String[] args) {
        BigDecimal squarePrice = new BigDecimal(Double.parseDouble("4.50"));
        BigDecimal builtUpArea = new BigDecimal(Double.parseDouble("52.69"));
        BigDecimal additionalAmount = new BigDecimal(Double.parseDouble("0"));
            BigDecimal cycle = new BigDecimal(Double.parseDouble("3"));
        BigDecimal  feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_DOWN);
        System.out.println(feeTotalPrice.doubleValue());
    }
//    public static void main(String[] args) {
//        BigDecimal squarePrice = new BigDecimal(Double.parseDouble("4.50"));
//        BigDecimal builtUpArea = new BigDecimal(Double.parseDouble("52.69"));
//        BigDecimal additionalAmount = new BigDecimal(Double.parseDouble("0"));
//            BigDecimal cycle = new BigDecimal(Double.parseDouble("3"));
//        BigDecimal  feeTotalPrice = (squarePrice.multiply(builtUpArea).add(additionalAmount)).multiply(cycle).setScale(3, BigDecimal.ROUND_HALF_DOWN);
//        System.out.println(feeTotalPrice.doubleValue());
//    }
    //    public static void main(String[] args) {
//        ComputeFeeSMOImpl computeFeeSMO = new ComputeFeeSMOImpl();
//        try {
//            Date startTime = DateUtil.getDateFromString("2020-12-31 00:00:00", DateUtil.DATE_FORMATE_STRING_A);
@@ -1669,4 +1714,110 @@
//            e.printStackTrace();
//        }
//    }
    static int[] getDiff(LocalDate start, LocalDate end) {
        if (!start.isBefore(end)) {
            throw new IllegalArgumentException("Start must not be before end.");
        }
        int year1 = start.getYear();
        int month1 = start.getMonthValue();
        int day1 = start.getDayOfMonth();
        int year2 = end.getYear();
        int month2 = end.getMonthValue();
        int day2 = end.getDayOfMonth();
        int yearDiff = year2 - year1;     // yearDiff >= 0
        int monthDiff = month2 - month1;
        int dayDiff = day2 - day1;
        if (dayDiff < 0) {
            LocalDate endMinusOneMonth = end.minusMonths(1);   // end 的上一个月
            int monthDays = endMinusOneMonth.lengthOfMonth();  // 该月的天数
            dayDiff += monthDays;  // 用上一个月的天数补上这个月差掉的日子
            if (monthDiff > 0) {   // eg. start is 2018-04-03, end is 2018-08-01
                monthDiff--;
            } else {  // eg. start is 2018-04-03, end is 2019-02-01
                monthDiff += 11;
                yearDiff--;
            }
        }
        int[] diff = new int[2];
        diff[0] = yearDiff * 12 + monthDiff;
        diff[1] = dayDiff;
        return diff;
    }
    /**
     * 计算两个日期的时间差
     *
     * @param startDate
     * @param endDate
     * @return
     */
    public Map<String, Object> dateDiff(Date startDate, String endDate) {
        Map<String, Object> cycle = new HashMap<>();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        Date endDates = null;
        try {
            endDates = format.parse(endDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        LocalDate start = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        Calendar calendar = new GregorianCalendar();
        calendar.setTime(endDates);
        calendar.add(calendar.DATE, 1);
        Date date = calendar.getTime();
        LocalDate end = date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        int[] diff = getDiff(start, end);
        cycle.put("months", diff[0]);//几个月
        cycle.put("days", diff[1]);//几天
        String startDateString = format.format(startDate);
        String endDateString = format.format(endDates);
        cycle.put("startMonthDays", getDayOfMonth(startDateString));//开始月份天数
        cycle.put("endMonthDays", getDayOfMonth(endDateString));//结束月份天数
        cycle.put("isOneMonth", false);// false 不跨月 true月份
        if (diff[0] == 0) {
            //判断是否同一个月
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
            String date1 = sdf.format(startDate);
            String date2 = sdf.format(endDates);
            if (!date1.equals(date2)) {
                cycle.put("isOneMonth", true);
                //计算夸月分两个月分别是多少天
                SimpleDateFormat sdfday = new SimpleDateFormat("dd");
                Integer startDate1 = Integer.valueOf(sdfday.format(startDate));
                String endDates2 = sdfday.format(endDates);
                cycle.put("startEndOfMonth", getDayOfMonth(startDateString) - startDate1 + 1);//开始月份天数
                cycle.put("endBeginningOfMonth", Integer.valueOf(endDates2));//结束月份天数
            }
        }
        return cycle;
    }
    /**
     * 获取日期内的天数
     *
     * @param dateStr
     * @return
     */
    public int getDayOfMonth(String dateStr) {
        int year = Integer.parseInt(dateStr.substring(0, 4));
        int month = Integer.parseInt(dateStr.substring(5, 7));
        Calendar c = Calendar.getInstance();
        c.set(year, month, 0); //输入类型为int类型
        return c.get(Calendar.DAY_OF_MONTH);
    }
}
java110-db/src/main/resources/mapper/fee/PayFeeDetailDiscountNewV1ServiceDaoImplMapper.xml
@@ -4,121 +4,111 @@
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="payFeeDetailDiscountNewV1ServiceDaoImpl">
    <!-- 保存费用明细信息 add by wuxw 2018-07-03 -->
    <insert id="savePayFeeDetailDiscountNewInfo" parameterType="Map">
        insert into pay_fee_detail_discount(
detail_discount_id,discount_price,detail_id,remark,community_id,discount_id,fee_id,b_id
) values (
#{detailDiscountId},#{discountPrice},#{detailId},#{remark},#{communityId},#{discountId},#{feeId},#{bId}
)
        insert into pay_fee_detail_discount(detail_discount_id, discount_price, detail_id, remark, community_id,
                                            discount_id, fee_id, b_id)
        values (#{detailDiscountId}, #{discountPrice}, #{detailId}, #{remark}, #{communityId}, #{discountId}, #{feeId},
                #{bId})
    </insert>
    <!-- 查询费用明细信息 add by wuxw 2018-07-03 -->
    <select id="getPayFeeDetailDiscountNewInfo" parameterType="Map" resultType="Map">
        select  t.detail_discount_id,t.detail_discount_id detailDiscountId,t.discount_price,t.discount_price discountPrice,t.detail_id,t.detail_id detailId,t.remark,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId,t.discount_id,t.discount_id discountId,t.fee_id,t.fee_id feeId
from pay_fee_detail_discount t
where 1 =1
<if test="detailDiscountId !=null and detailDiscountId != ''">
   and t.detail_discount_id= #{detailDiscountId}
</if>
<if test="discountPrice !=null and discountPrice != ''">
   and t.discount_price= #{discountPrice}
</if>
<if test="detailId !=null and detailId != ''">
   and t.detail_id= #{detailId}
</if>
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="statusCd !=null and statusCd != ''">
   and t.status_cd= #{statusCd}
</if>
<if test="communityId !=null and communityId != ''">
   and t.community_id= #{communityId}
</if>
<if test="discountId !=null and discountId != ''">
   and t.discount_id= #{discountId}
</if>
<if test="feeId !=null and feeId != ''">
   and t.fee_id= #{feeId}
</if>
order by t.create_time desc
<if test="page != -1 and page != null ">
   limit #{page}, #{row}
</if>
        select t.detail_discount_id,t.detail_discount_id detailDiscountId,t.discount_price,t.discount_price
        discountPrice,t.detail_id,t.detail_id detailId,t.remark,t.status_cd,t.status_cd
        statusCd,t.community_id,t.community_id communityId,t.discount_id,t.discount_id discountId,t.fee_id,t.fee_id
        feeId
        from pay_fee_detail_discount t
        where 1 =1
        <if test="detailDiscountId !=null and detailDiscountId != ''">
            and t.detail_discount_id= #{detailDiscountId}
        </if>
        <if test="discountPrice !=null and discountPrice != ''">
            and t.discount_price= #{discountPrice}
        </if>
        <if test="detailId !=null and detailId != ''">
            and t.detail_id= #{detailId}
        </if>
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="discountId !=null and discountId != ''">
            and t.discount_id= #{discountId}
        </if>
        <if test="feeId !=null and feeId != ''">
            and t.fee_id= #{feeId}
        </if>
        order by t.create_time desc
        <if test="page != -1 and page != null ">
            limit #{page}, #{row}
        </if>
    </select>
    <!-- 修改费用明细信息 add by wuxw 2018-07-03 -->
    <update id="updatePayFeeDetailDiscountNewInfo" parameterType="Map">
        update  pay_fee_detail_discount t set t.status_cd = #{statusCd}
<if test="newBId != null and newBId != ''">
,t.b_id = #{newBId}
</if>
<if test="discountPrice !=null and discountPrice != ''">
, t.discount_price= #{discountPrice}
</if>
<if test="detailId !=null and detailId != ''">
, t.detail_id= #{detailId}
</if>
<if test="remark !=null and remark != ''">
, t.remark= #{remark}
</if>
<if test="communityId !=null and communityId != ''">
, t.community_id= #{communityId}
</if>
<if test="discountId !=null and discountId != ''">
, t.discount_id= #{discountId}
</if>
<if test="feeId !=null and feeId != ''">
, t.fee_id= #{feeId}
</if>
 where 1=1 <if test="detailDiscountId !=null and detailDiscountId != ''">
and t.detail_discount_id= #{detailDiscountId}
</if>
        update pay_fee_detail_discount t set t.status_cd = #{statusCd}
        <if test="newBId != null and newBId != ''">
            ,t.b_id = #{newBId}
        </if>
        <if test="discountPrice !=null and discountPrice != ''">
            , t.discount_price= #{discountPrice}
        </if>
        <if test="detailId !=null and detailId != ''">
            , t.detail_id= #{detailId}
        </if>
        <if test="remark !=null and remark != ''">
            , t.remark= #{remark}
        </if>
        <if test="communityId !=null and communityId != ''">
            , t.community_id= #{communityId}
        </if>
        <if test="discountId !=null and discountId != ''">
            , t.discount_id= #{discountId}
        </if>
        <if test="feeId !=null and feeId != ''">
            , t.fee_id= #{feeId}
        </if>
        where 1=1
        <if test="detailDiscountId !=null and detailDiscountId != ''">
            and t.detail_discount_id= #{detailDiscountId}
        </if>
    </update>
    <!-- 查询费用明细数量 add by wuxw 2018-07-03 -->
     <select id="queryPayFeeDetailDiscountNewsCount" parameterType="Map" resultType="Map">
        select  count(1) count
from pay_fee_detail_discount t
where 1 =1
<if test="detailDiscountId !=null and detailDiscountId != ''">
   and t.detail_discount_id= #{detailDiscountId}
</if>
<if test="discountPrice !=null and discountPrice != ''">
   and t.discount_price= #{discountPrice}
</if>
<if test="detailId !=null and detailId != ''">
   and t.detail_id= #{detailId}
</if>
<if test="remark !=null and remark != ''">
   and t.remark= #{remark}
</if>
<if test="statusCd !=null and statusCd != ''">
   and t.status_cd= #{statusCd}
</if>
<if test="communityId !=null and communityId != ''">
   and t.community_id= #{communityId}
</if>
<if test="discountId !=null and discountId != ''">
   and t.discount_id= #{discountId}
</if>
<if test="feeId !=null and feeId != ''">
   and t.fee_id= #{feeId}
</if>
     </select>
    <select id="queryPayFeeDetailDiscountNewsCount" parameterType="Map" resultType="Map">
        select count(1) count
        from pay_fee_detail_discount t
        where 1 =1
        <if test="detailDiscountId !=null and detailDiscountId != ''">
            and t.detail_discount_id= #{detailDiscountId}
        </if>
        <if test="discountPrice !=null and discountPrice != ''">
            and t.discount_price= #{discountPrice}
        </if>
        <if test="detailId !=null and detailId != ''">
            and t.detail_id= #{detailId}
        </if>
        <if test="remark !=null and remark != ''">
            and t.remark= #{remark}
        </if>
        <if test="statusCd !=null and statusCd != ''">
            and t.status_cd= #{statusCd}
        </if>
        <if test="communityId !=null and communityId != ''">
            and t.community_id= #{communityId}
        </if>
        <if test="discountId !=null and discountId != ''">
            and t.discount_id= #{discountId}
        </if>
        <if test="feeId !=null and feeId != ''">
            and t.fee_id= #{feeId}
        </if>
    </select>
</mapper>
service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportReportFeeSMOImpl.java
@@ -76,6 +76,7 @@
    public static final String RESOURCE_STORE_USE_RECORD_MANAGE = "resourceStoreUseRecordManage";
    public static final String RESOURCE_STAFF_FEE_MANAGE = "staffFeeManage";
    public static final String REPORT_PAY_FEE_DEPOSIT = "reportPayFeeDeposit";
    public static final String INSPECTION_TASK_DETAILS = "inspectionTaskDetails";
    @Autowired
    private RestTemplate restTemplate;
@@ -168,6 +169,8 @@
            case REPORT_PAY_FEE_DEPOSIT:
                reportPayFeeDeposit(pd, result, workbook);
                break;
            case INSPECTION_TASK_DETAILS:
                inspectionTaskDetails(pd, result, workbook);
        }
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        MultiValueMap headers = new HttpHeaders();
@@ -877,6 +880,72 @@
        }
    }
    private void inspectionTaskDetails(IPageData pd, ComponentValidateResult result, Workbook workbook) {
        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("实际签到状态");
        row.createCell(10).setCellValue("计划巡检人");
        row.createCell(11).setCellValue("实际巡检人");
        row.createCell(12).setCellValue("巡检方式");
        row.createCell(13).setCellValue("任务状态");
        row.createCell(14).setCellValue("巡检点状态");
        row.createCell(15).setCellValue("巡检情况");
        JSONArray inspectionTaskDetails = this.getInspectionTaskDetails(pd, result);
        if (inspectionTaskDetails == null || inspectionTaskDetails.size() == 0) {
            return;
        }
        JSONObject dataObj = null;
        for (int roomIndex = 0; roomIndex < inspectionTaskDetails.size(); roomIndex++) {
            row = sheet.createRow(roomIndex + 1);
            dataObj = inspectionTaskDetails.getJSONObject(roomIndex);
            row.createCell(0).setCellValue(dataObj.getString("taskDetailId"));
            row.createCell(1).setCellValue(dataObj.getString("inspectionName"));
            row.createCell(2).setCellValue(dataObj.getString("inspectionPlanName"));
            row.createCell(3).setCellValue(dataObj.getString("routeName"));
            row.createCell(4).setCellValue(dataObj.getString("planInsTime"));
            row.createCell(5).setCellValue(dataObj.getString("planEndTime"));
            if (!StringUtil.isEmpty(dataObj.getString("pointStartTime"))) {
                row.createCell(6).setCellValue(dataObj.getString("pointStartTime"));
            } else {
                row.createCell(6).setCellValue("--");
            }
            if (!StringUtil.isEmpty(dataObj.getString("pointEndTime"))) {
                row.createCell(7).setCellValue(dataObj.getString("pointEndTime"));
            } else {
                row.createCell(7).setCellValue("--");
            }
            if (!StringUtil.isEmpty(dataObj.getString("inspectionTime"))) {
                row.createCell(8).setCellValue(dataObj.getString("inspectionTime"));
            } else {
                row.createCell(8).setCellValue("--");
            }
            row.createCell(9).setCellValue(dataObj.getString("inspectionStateName"));
            row.createCell(10).setCellValue(dataObj.getString("planUserName"));
            if (!StringUtil.isEmpty(dataObj.getString("actUserName"))) {
                row.createCell(11).setCellValue(dataObj.getString("actUserName"));
            } else {
                row.createCell(11).setCellValue("--");
            }
            row.createCell(12).setCellValue(dataObj.getString("signTypeName"));
            row.createCell(13).setCellValue(dataObj.getString("taskStateName"));
            row.createCell(14).setCellValue(dataObj.getString("stateName"));
            if (!StringUtil.isEmpty(dataObj.getString("description"))) {
                row.createCell(15).setCellValue(dataObj.getString("description"));
            } else {
                row.createCell(15).setCellValue("--");
            }
        }
    }
    private void resourceStoreUseRecordManage(IPageData pd, ComponentValidateResult result, Workbook workbook) {
        Sheet sheet = workbook.createSheet("物品使用记录");
        Row row = sheet.createRow(0);
@@ -1385,6 +1454,29 @@
        return savedAllocationUserStorehouses.getJSONArray("data");
    }
    private JSONArray getInspectionTaskDetails(IPageData pd, ComponentValidateResult result) {
        String apiUrl = "";
        ResponseEntity<String> responseEntity = null;
        JSONObject reqJson = JSONObject.parseObject(pd.getReqData());
        reqJson.put("page", 1);
        reqJson.put("row", 10000);
        apiUrl = "inspectionTaskDetail.listInspectionTaskDetails" + mapToUrlParam(reqJson);
        responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
        if (responseEntity.getStatusCode() != HttpStatus.OK) { //跳过 保存单元信息
            return null;
        }
        JSONObject savedInspectionTaskDetails = JSONObject.parseObject(responseEntity.getBody(), Feature.OrderedField);
        //获取限制条数的值
        int number = Integer.parseInt(MappingCache.getValue(DOMAIN_COMMON, EXPORT_NUMBER));
        if (savedInspectionTaskDetails.getJSONArray("inspectionTaskDetails").size() > number) {
            throw new IllegalArgumentException("导出数据超过限制条数" + number + "条,无法继续导出操作!");
        }
        if (!savedInspectionTaskDetails.containsKey("inspectionTaskDetails")) {
            return null;
        }
        return savedInspectionTaskDetails.getJSONArray("inspectionTaskDetails");
    }
    private JSONArray getResourceStoreUseRecordManage(IPageData pd, ComponentValidateResult result) {
        String apiUrl = "";
        ResponseEntity<String> responseEntity = null;
service-community/src/main/java/com/java110/community/cmd/room/AddRoomBindingCmd.java
@@ -177,6 +177,23 @@
            addRoomView.put("unitId", viewUnitInfo.getString("unitId"));
            addRoomView.put("roomType", RoomDto.ROOM_TYPE_ROOM);
            RoomPo roomPo = BeanConvertUtil.covertBean(addRoomView, RoomPo.class);
            if (addRoomView.containsKey("apartment1") && addRoomView.getString("apartment1").equals("10")) {
                roomPo.setSection("1");
            } else if (addRoomView.containsKey("apartment1") && addRoomView.getString("apartment1").equals("20")) {
                roomPo.setSection("2");
            } else if (addRoomView.containsKey("apartment1") && addRoomView.getString("apartment1").equals("30")) {
                roomPo.setSection("3");
            } else if (addRoomView.containsKey("apartment1") && addRoomView.getString("apartment1").equals("40")) {
                roomPo.setSection("4");
            } else if (addRoomView.containsKey("apartment1") && addRoomView.getString("apartment1").equals("50")) {
                roomPo.setSection("5");
            } else if (addRoomView.containsKey("apartment1") && addRoomView.getString("apartment1").equals("60")) {
                roomPo.setSection("6");
            } else if (addRoomView.containsKey("apartment1") && addRoomView.getString("apartment1").equals("70")) {
                roomPo.setSection("7");
            } else if (addRoomView.containsKey("apartment1") && addRoomView.getString("apartment1").equals("80")) {
                roomPo.setSection("8");
            }
            flag = roomV1InnerServiceSMOImpl.saveRoom(roomPo);
            if (flag < 1) {
                throw new CmdException("保存房屋失败");
service-community/src/main/java/com/java110/community/cmd/room/UpdateRoomCmd.java
@@ -161,6 +161,23 @@
        JSONObject businessUnit = new JSONObject();
        businessUnit.putAll(paramInJson);
        RoomPo roomPo = BeanConvertUtil.covertBean(businessUnit, RoomPo.class);
        if (paramInJson.containsKey("apartment1") && paramInJson.getString("apartment1").equals("10")) {
            roomPo.setSection("1");
        } else if (paramInJson.containsKey("apartment1") && paramInJson.getString("apartment1").equals("20")) {
            roomPo.setSection("2");
        } else if (paramInJson.containsKey("apartment1") && paramInJson.getString("apartment1").equals("30")) {
            roomPo.setSection("3");
        } else if (paramInJson.containsKey("apartment1") && paramInJson.getString("apartment1").equals("40")) {
            roomPo.setSection("4");
        } else if (paramInJson.containsKey("apartment1") && paramInJson.getString("apartment1").equals("50")) {
            roomPo.setSection("5");
        } else if (paramInJson.containsKey("apartment1") && paramInJson.getString("apartment1").equals("60")) {
            roomPo.setSection("6");
        } else if (paramInJson.containsKey("apartment1") && paramInJson.getString("apartment1").equals("70")) {
            roomPo.setSection("7");
        } else if (paramInJson.containsKey("apartment1") && paramInJson.getString("apartment1").equals("80")) {
            roomPo.setSection("8");
        }
        int flag = roomV1InnerServiceSMOImpl.updateRoom(roomPo);
        if (flag < 1) {
            throw new CmdException("修改房屋失败");
service-fee/src/main/java/com/java110/fee/api/FeeApi.java
@@ -220,6 +220,7 @@
    public ResponseEntity<String> listFeeObj(
            @RequestParam(value = "feeId") String feeId,
            @RequestParam(value = "cycle", required = false) String cycle,
            @RequestParam(value = "custEndTime", required = false) String custEndTime,
            @RequestParam(value = "communityId") String communityId) {
        FeeDto feeDto = new FeeDto();
        feeDto.setFeeId(feeId);
@@ -227,6 +228,9 @@
        if (!StringUtil.isEmpty(cycle)) {
            feeDto.setCycle(cycle);
        }
        if (!StringUtil.isEmpty(custEndTime)) {
            feeDto.setCustEndTime(custEndTime);
        }
        return queryOweFeeImpl.listFeeObj(feeDto);
    }
service-fee/src/main/java/com/java110/fee/bmo/impl/QueryOweFeeImpl.java
@@ -32,6 +32,8 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
@Service
@@ -129,13 +131,20 @@
            return ResultVo.success();
        }
        String cycel = null;
        String custEndTime = null;
        if (!StringUtil.isEmpty(feeDto.getCycle())) {
            cycel = feeDto.getCycle();
        }
        if (!StringUtil.isEmpty(feeDto.getCustEndTime())) {
            custEndTime = feeDto.getCustEndTime();
        }
        feeDto = feeDtos.get(0);
        if (!StringUtil.isEmpty(cycel)) {
            feeDto.setCycle(cycel);
        }
        if (!StringUtil.isEmpty(custEndTime)) {
            feeDto.setCustEndTime(custEndTime);
        }
        if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(feeDto.getPayerObjType())) { //房屋相关
            RoomDto roomDto = new RoomDto();
service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java
@@ -56,6 +56,7 @@
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@Java110Cmd(serviceCode = "fee.payFee")
@@ -172,6 +173,7 @@
            try {
                maxEndTime = DateUtil.getDateFromString(feeConfigDtos.get(0).getEndTime(), DateUtil.DATE_FORMATE_STRING_A);
            } catch (ParseException e) {
            } catch (Exception e) {
                logger.error("比较费用日期失败", e);
            }
        }
@@ -200,7 +202,37 @@
        try {
            DistributedLock.waitGetDistributedLock(key, requestId);
            JSONObject feeDetail = addFeeDetail(paramObj);
            JSONObject fee = modifyFee(paramObj);
            payFeePo = BeanConvertUtil.covertBean(fee, PayFeePo.class);
            PayFeeDetailPo payFeeDetailPo = BeanConvertUtil.covertBean(feeDetail, PayFeeDetailPo.class);
            //判断是否有赠送规则
            if (paramObj.containsKey("selectDiscount")) {
                JSONArray selectDiscount = paramObj.getJSONArray("selectDiscount");
                if (selectDiscount != null && selectDiscount.size() > 0) {
                    for (int index = 0; index < selectDiscount.size(); index++) {
                        JSONObject paramJson = selectDiscount.getJSONObject(index);
                        if (!StringUtil.isEmpty(paramJson.getString("ruleId")) && paramJson.getString("ruleId").equals("102020008")) { //赠送规则
                            JSONArray feeDiscountSpecs = paramJson.getJSONArray("feeDiscountSpecs");
                            if (feeDiscountSpecs.size() > 0) {
                                for (int specIndex = 0; specIndex < feeDiscountSpecs.size(); specIndex++) {
                                    JSONObject paramIn = feeDiscountSpecs.getJSONObject(specIndex);
                                    if (!StringUtil.isEmpty(paramIn.getString("specId")) && paramIn.getString("specId").equals("89002020980015")) { //赠送月份
                                        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                                        String specValue = paramIn.getString("specValue");
                                        //获取费用结束时间(也就是下次费用开始时间)
                                        Date endTime = df.parse(payFeeDetailPo.getEndTime());
                                        Calendar cal = Calendar.getInstance();
                                        cal.setTime(endTime);
                                        cal.add(Calendar.MONTH, Integer.parseInt(specValue));
                                        payFeeDetailPo.setEndTime(df.format(cal.getTime()));
                                        payFeePo.setEndTime(df.format(cal.getTime()));
                                    }
                                }
                            }
                        }
                    }
                }
            }
            //判断选择的账号
            JSONArray jsonArray = paramObj.getJSONArray("selectUserAccount");
            if (jsonArray == null || jsonArray.size() < 1) {
@@ -297,13 +329,13 @@
            if (flag < 1) {
                throw new CmdException("缴费失败");
            }
            JSONObject fee = modifyFee(paramObj);
            payFeePo = BeanConvertUtil.covertBean(fee, PayFeePo.class);
            flag = payFeeV1InnerServiceSMOImpl.updatePayFee(payFeePo);
            if (flag < 1) {
                throw new CmdException("缴费失败");
            }
        } catch (ParseException e) {
            e.printStackTrace();
        } finally {
            DistributedLock.releaseDistributedLock(requestId, key);
        }
@@ -314,7 +346,11 @@
            JSONObject discountBusiness = null;
            JSONArray selectDiscounts = paramObj.getJSONArray("selectDiscount");
            for (int discountIndex = 0; discountIndex < selectDiscounts.size(); discountIndex++) {
                addPayFeeDetailDiscount(paramObj, selectDiscounts.getJSONObject(discountIndex));
                JSONObject param = selectDiscounts.getJSONObject(discountIndex);
                if (!StringUtil.isEmpty(param.getString("ruleId")) && param.getString("ruleId").equals("102020008")) {
                    return;
                }
                addPayFeeDetailDiscount(paramObj, param);
            }
        }
@@ -559,8 +595,28 @@
            paramInJson.put("tmpCycles", cycles.doubleValue());
            businessFeeDetail.put("cycles", cycles.doubleValue());
            businessFeeDetail.put("receivableAmount", receivedAmount.doubleValue());
        } else if ("-103".equals(paramInJson.getString("cycles"))) {
            String custEndTime = paramInJson.getString("custEndTime");
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            Date endDates = null;
            try {
                endDates = format.parse(custEndTime);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            Calendar c = Calendar.getInstance();
            c.setTime(endDates);
            c.add(Calendar.DAY_OF_MONTH, 1);
            endDates = c.getTime();//这是明天
            targetEndTime = endDates;
            BigDecimal receivedAmount1 = new BigDecimal(Double.parseDouble(paramInJson.getString("receivedAmount")));
            cycles = receivedAmount1.divide(feePrice, 4, BigDecimal.ROUND_HALF_EVEN);
            paramInJson.put("tmpCycles", cycles.doubleValue());
            businessFeeDetail.put("cycles", cycles.doubleValue());
            BigDecimal receivedAmount = new BigDecimal(Double.parseDouble(paramInJson.getString("receivedAmount")));
            businessFeeDetail.put("receivableAmount", receivedAmount.doubleValue());
        } else {
            targetEndTime = computeFeeSMOImpl.getFeeEndTimeByCycles(feeDto, paramInJson.getString("cycles"));
            targetEndTime = computeFeeSMOImpl.getFeeEndTimeByCycles(feeDto, paramInJson.getString("cycles"));//根据缴费周期计算 结束时间
            cycles = new BigDecimal(Double.parseDouble(paramInJson.getString("cycles")));
            double tmpReceivableAmount = cycles.multiply(feePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
            businessFeeDetail.put("receivableAmount", tmpReceivableAmount);
@@ -579,8 +635,24 @@
        Calendar endCalender = Calendar.getInstance();
        endCalender.setTime(endTime);
        int hours = 0;
        //-101自定义金额 -102自定义周期 -103 自定义结束时间
        if ("-101".equals(paramInJson.getString("cycles"))) {
            endCalender = getTargetEndTime(endCalender, Double.parseDouble(paramInJson.getString("tmpCycles")));
            System.out.println(endCalender);
        } else if ("-103".equals(paramInJson.getString("cycles"))) {
            String custEndTime = paramInJson.getString("custEndTime");
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            Date endDates = null;
            try {
                endDates = format.parse(custEndTime);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            Calendar c = Calendar.getInstance();
            c.setTime(endDates);
            c.add(Calendar.DAY_OF_MONTH, 1);
            endDates = c.getTime();//这是明天
            endCalender.setTime(endDates);
        } else {
            endCalender.add(Calendar.MONTH, Integer.parseInt(paramInJson.getString("cycles")));
        }
@@ -599,7 +671,7 @@
        }
        feeInfo.setEndTime(endCalender.getTime());
        Date maxEndTime = feeInfo.getDeadlineTime();
        if(FeeDto.FEE_FLAG_CYCLE.equals(feeInfo.getFeeFlag())){
        if (FeeDto.FEE_FLAG_CYCLE.equals(feeInfo.getFeeFlag())) {
            maxEndTime = feeInfo.getConfigEndTime();
        }
        //判断 结束时间 是否大于 费用项 结束时间,这里 容错一下,如果 费用结束时间大于 费用项结束时间 30天 走报错 属于多缴费
service-fee/src/main/java/com/java110/fee/discount/impl/ReductionMonthFeeRule.java
@@ -15,19 +15,13 @@
 */
package com.java110.fee.discount.impl;
import com.java110.core.smo.IComputeFeeSMO;
import com.java110.dto.fee.FeeDto;
import com.java110.dto.feeDiscount.ComputeDiscountDto;
import com.java110.dto.feeDiscount.FeeDiscountDto;
import com.java110.dto.feeDiscount.FeeDiscountSpecDto;
import com.java110.fee.discount.IComputeDiscount;
import com.java110.intf.fee.IFeeInnerServiceSMO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
 * 缴几个月赠送几个月 规则
@@ -38,21 +32,12 @@
@Component(value = "reductionMonthFeeRule")
public class ReductionMonthFeeRule implements IComputeDiscount {
    /**
     * 89002020980001    102020001    月份
     * 89002020980002    102020001    打折率
     */
    private static final String SPEC_MONTH = "89002020980014"; //月份
    private static final String SPEC_RATE = "89002020980015"; // 赠送月份
    @Autowired
    private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
    @Autowired
    private IComputeFeeSMO computeFeeSMOImpl;
    @Override
    public ComputeDiscountDto compute(FeeDiscountDto feeDiscountDto) {
@@ -72,8 +57,9 @@
                reductionMonth = Double.parseDouble(feeDiscountSpecDto.getSpecValue());
            }
        }
        if (feeDiscountDto.getCycles() < month) {
            return null;
        } else {
            ComputeDiscountDto computeDiscountDto = new ComputeDiscountDto();
            computeDiscountDto.setDiscountId(feeDiscountDto.getDiscountId());
            computeDiscountDto.setDiscountType(FeeDiscountDto.DISCOUNT_TYPE_D);
@@ -84,34 +70,5 @@
            computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos);
            return computeDiscountDto;
        }
        //查询费用
        FeeDto feeDto = new FeeDto();
        feeDto.setCommunityId(feeDiscountDto.getCommunityId());
        feeDto.setFeeId(feeDiscountDto.getFeeId());
        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
        Map feePriceAll=computeFeeSMOImpl.getFeePrice(feeDtos.get(0));
        BigDecimal priceDec = new BigDecimal(feePriceAll.get("feePrice").toString());
        double cycleRate = Math.floor(feeDiscountDto.getCycles()/month);
        BigDecimal cycleRateDec = new BigDecimal(cycleRate);
        BigDecimal reductionMonthDec = new BigDecimal(reductionMonth);
        double discountPrice = priceDec.multiply(cycleRateDec).multiply(reductionMonthDec).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
        ComputeDiscountDto computeDiscountDto = new ComputeDiscountDto();
        computeDiscountDto.setDiscountId(feeDiscountDto.getDiscountId());
        computeDiscountDto.setDiscountType(FeeDiscountDto.DISCOUNT_TYPE_D);
        computeDiscountDto.setRuleId(feeDiscountDto.getRuleId());
        computeDiscountDto.setRuleName(feeDiscountDto.getRuleName());
        computeDiscountDto.setDiscountName(feeDiscountDto.getDiscountName());
        computeDiscountDto.setDiscountPrice(discountPrice);
        computeDiscountDto.setFeeDiscountSpecs(feeDiscountSpecDtos);
        return computeDiscountDto;
    }
}
service-fee/src/main/java/com/java110/fee/smo/impl/FeeDiscountInnerServiceSMOImpl.java
@@ -7,6 +7,7 @@
import com.java110.dto.fee.FeeDto;
import com.java110.dto.feeDiscount.ComputeDiscountDto;
import com.java110.dto.feeDiscount.FeeDiscountDto;
import com.java110.dto.feeDiscount.FeeDiscountRuleDto;
import com.java110.dto.feeDiscount.FeeDiscountSpecDto;
import com.java110.dto.payFeeConfigDiscount.PayFeeConfigDiscountDto;
import com.java110.fee.dao.IFeeDiscountServiceDao;
@@ -23,10 +24,7 @@
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.*;
/**
 * @ClassName FloorInnerServiceSMOImpl
@@ -54,12 +52,16 @@
    @Autowired
    private IApplyRoomDiscountInnerServiceSMO applyRoomDiscountInnerServiceSMOImpl;
    @Autowired
    private IFeeDiscountRuleInnerServiceSMO feeDiscountRuleInnerServiceSMOImpl;
    //域
    public static final String DOMAIN_COMMON = "DOMAIN.COMMON";
    //键
    public static final String DISCOUNT_MODE = "DISCOUNT_MODE";
    private static final String SPEC_RATE = "89002020980015"; // 赠送月份
    @Override
    public int saveFeeDiscount(@RequestBody FeeDiscountPo feeDiscountPo) {
@@ -184,6 +186,30 @@
        for (PayFeeConfigDiscountDto tmpPayFeeConfigDiscountDto : payFeeConfigDiscountDtos) {
            //获取缴费最大截止时间
            Date payMaxEndTime = tmpPayFeeConfigDiscountDto.getPayMaxEndTime();
            FeeDiscountDto feeDiscountDto = new FeeDiscountDto();
            feeDiscountDto.setDiscountId(tmpPayFeeConfigDiscountDto.getDiscountId());
            //查询打折表
            List<FeeDiscountDto> feeDiscountInfo = BeanConvertUtil.covertBeanList(feeDiscountServiceDaoImpl.getFeeDiscountInfo(BeanConvertUtil.beanCovertMap(feeDiscountDto)), FeeDiscountDto.class);
            Assert.listOnlyOne(feeDiscountInfo, "查询打折表错误!");
            FeeDiscountRuleDto feeDiscountRuleDto = new FeeDiscountRuleDto();
            feeDiscountRuleDto.setRuleId(feeDiscountInfo.get(0).getRuleId());
            //查询打折规则表
            List<FeeDiscountRuleDto> feeDiscountRuleDtos = feeDiscountRuleInnerServiceSMOImpl.queryFeeDiscountRules(feeDiscountRuleDto);
            Assert.listOnlyOne(feeDiscountRuleDtos, "查询打折规则表错误!");
            if (!StringUtil.isEmpty(feeDiscountRuleDtos.get(0).getBeanImpl()) && feeDiscountRuleDtos.get(0).getBeanImpl().equals("reductionMonthFeeRule")) { //赠送规则
                FeeDiscountSpecDto feeDiscountSpecDto = new FeeDiscountSpecDto();
                feeDiscountSpecDto.setDiscountId(tmpPayFeeConfigDiscountDto.getDiscountId());
                feeDiscountSpecDto.setSpecId(SPEC_RATE);
                //查询打折规格
                List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountSpecInnerServiceSMOImpl.queryFeeDiscountSpecs(feeDiscountSpecDto);
                Assert.listOnlyOne(feeDiscountSpecDtos, "查询打折规格表错误!");
                //获取赠送月份
                String specValue = feeDiscountSpecDtos.get(0).getSpecValue();
                Calendar cal = Calendar.getInstance();
                cal.setTime(finishTime);
                cal.add(Calendar.MONTH, Integer.parseInt(specValue));
                finishTime = cal.getTime();
            }
            if (payMaxEndTime == null) {
                doCompute(tmpPayFeeConfigDiscountDto, Double.parseDouble(feeDetailDto.getCycles()), computeDiscountDtos, feeDetailDto.getFeeId());
            } else if (payMaxEndTime.getTime() >= finishTime.getTime()) {
@@ -191,6 +217,7 @@
            } else {
                continue;
            }
            finishTime = c.getTime();
        }
        computeApplyRoomDiscount(feeDetailDto, simpleDateFormat, c, computeDiscountDtos);
        //取出开关映射的值