| java110-db/src/main/resources/mapper/fee/FeeServiceDaoImplMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| java110-interface/src/main/java/com/java110/intf/fee/IFeeInnerServiceSMO.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| service-fee/src/main/java/com/java110/fee/api/FeeApi.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| service-fee/src/main/java/com/java110/fee/bmo/IQueryFeeByAttr.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| service-fee/src/main/java/com/java110/fee/bmo/impl/QueryFeeByAttrImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| service-fee/src/main/java/com/java110/fee/dao/IFeeServiceDao.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| service-fee/src/main/java/com/java110/fee/dao/impl/FeeServiceDaoImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| service-fee/src/main/java/com/java110/fee/smo/impl/FeeInnerServiceSMOImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
java110-db/src/main/resources/mapper/fee/FeeServiceDaoImplMapper.xml
@@ -560,4 +560,171 @@ </update> <!-- 查询费用数量 add by wuxw 2018-07-03 --> <select id="queryFeeByAttrCount" parameterType="Map" resultType="Map"> select count(1) count from pay_fee t left join pay_fee_config pfc on t.fee_type_cd = pfc.fee_type_cd and t.config_id = pfc.config_id and pfc.status_cd = '0' left join t_dict td1 on pfc.fee_type_cd = td1.status_cd and td1.table_columns = 'fee_type_cd' and td1.table_name = 'pay_fee_config' left join t_dict td2 on t.state = td2.status_cd and td2.table_name = 'pay_fee' and td2.table_columns = 'state' left join t_dict td3 on t.fee_flag = td3.status_cd and td3.table_name = 'pay_fee' and td3.table_columns = 'fee_flag' left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.status_cd='0' where pfa.spec_cd = #{specCd} and pfa.value = #{value} <if test="amount !=null and amount != ''"> and t.amount= #{amount} </if> <if test="incomeObjId !=null and incomeObjId != ''"> and t.income_obj_id= #{incomeObjId} </if> <if test="feeTypeCd !=null and feeTypeCd != ''"> and t.fee_type_cd= #{feeTypeCd} </if> <if test="feeTypeCds != null "> and t.fee_type_cd in <foreach collection="feeTypeCds" item="item" open="(" close=")" separator=","> #{item} </foreach> </if> <if test="startTime !=null"> and t.start_time= #{startTime} </if> <if test="statusCd !=null and statusCd != ''"> and t.status_cd= #{statusCd} </if> <if test="endTime !=null "> and t.end_time= #{endTime} </if> <if test="arrearsEndTime != null"> and t.end_time < #{arrearsEndTime} </if> <if test="noArrearsEndTime != null"> and t.end_time > #{noArrearsEndTime} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} and pfc.community_id= #{communityId} </if> <if test="bId !=null and bId != ''"> and t.b_id= #{bId} </if> <if test="feeId !=null and feeId != ''"> and t.fee_id= #{feeId} </if> <if test="userId !=null and userId != ''"> and t.user_id= #{userId} </if> <if test="payerObjId !=null and payerObjId != ''"> and t.payer_obj_id= #{payerObjId} </if> <if test="payerObjIds != null "> and t.payer_obj_id in <foreach collection="payerObjIds" item="item" open="(" close=")" separator=","> #{item} </foreach> </if> <if test="state !=null and state != ''"> and t.state= #{state} </if> <if test="feeFlag !=null and feeFlag != ''"> and t.fee_flag= #{feeFlag} </if> <if test="configId !=null and configId != ''"> and t.config_id= #{configId} </if> <if test="payerObjType !=null and payerObjType != ''"> and t.payer_obj_type = #{payerObjType} </if> </select> <!-- 查询费用信息 add by wuxw 2018-07-03 --> <select id="getFeeInfo" parameterType="Map" resultType="Map"> select t.amount,t.income_obj_id,t.income_obj_id incomeObjId,t.fee_type_cd,t.fee_type_cd feeTypeCd,t.start_time,t.start_time startTime,t.status_cd,t.status_cd statusCd,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.fee_id,t.fee_id feeId,t.user_id,t.user_id userId,t.payer_obj_id,t.payer_obj_id payerObjId,pfc.square_price squarePrice,pfc.additional_amount additionalAmount,t.fee_flag,t.fee_flag feeFlag,t.state,t.config_id,t.config_id configId, pfc.fee_name feeName,td1.name feeTypeCdName,td2.name stateName,td3.name feeFlagName,pfc.computing_formula computingFormula, t.payer_obj_type,t.payer_obj_type payerObjType,pfc.is_default isDefault,pfc.start_time configStartTime,pfc.end_time configEndTime,pfc.payment_cd paymentCd,pfc.payment_cycle paymentCycle from pay_fee t left join pay_fee_config pfc on t.fee_type_cd = pfc.fee_type_cd and t.config_id = pfc.config_id and pfc.status_cd = '0' left join t_dict td1 on pfc.fee_type_cd = td1.status_cd and td1.table_columns = 'fee_type_cd' and td1.table_name = 'pay_fee_config' left join t_dict td2 on t.state = td2.status_cd and td2.table_name = 'pay_fee' and td2.table_columns = 'state' left join t_dict td3 on t.fee_flag = td3.status_cd and td3.table_name = 'pay_fee' and td3.table_columns = 'fee_flag' left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.status_cd='0' where pfa.spec_cd = #{specCd} and pfa.value = #{value} <if test="amount !=null and amount != ''"> and t.amount= #{amount} </if> <if test="incomeObjId !=null and incomeObjId != ''"> and t.income_obj_id= #{incomeObjId} </if> <if test="feeTypeCd !=null and feeTypeCd != ''"> and t.fee_type_cd= #{feeTypeCd} </if> <if test="feeTypeCds != null "> and t.fee_type_cd in <foreach collection="feeTypeCds" item="item" open="(" close=")" separator=","> #{item} </foreach> </if> <if test="startTime !=null "> and t.start_time= #{startTime} </if> <if test="statusCd !=null and statusCd != ''"> and t.status_cd= #{statusCd} </if> <if test="endTime !=null "> and t.end_time= #{endTime} </if> <if test="arrearsEndTime != null"> and t.end_time < #{arrearsEndTime} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} and pfc.community_id= #{communityId} </if> <if test="bId !=null and bId != ''"> and t.b_id= #{bId} </if> <if test="feeId !=null and feeId != ''"> and t.fee_id= #{feeId} </if> <if test="userId !=null and userId != ''"> and t.user_id= #{userId} </if> <if test="payerObjId !=null and payerObjId != ''"> and t.payer_obj_id= #{payerObjId} </if> <if test="payerObjIds != null "> and t.payer_obj_id in <foreach collection="payerObjIds" item="item" open="(" close=")" separator=","> #{item} </foreach> </if> <if test="state !=null and state != ''"> and t.state= #{state} </if> <if test="feeFlag !=null and feeFlag != ''"> and t.fee_flag= #{feeFlag} </if> <if test="configId !=null and configId != ''"> and t.config_id= #{configId} </if> <if test="payerObjType !=null and payerObjType != ''"> and t.payer_obj_type = #{payerObjType} </if> order by t.create_time desc <if test="page != -1 and page != null "> limit #{page}, #{row} </if> </select> </mapper> java110-interface/src/main/java/com/java110/intf/fee/IFeeInnerServiceSMO.java
@@ -3,6 +3,7 @@ import com.java110.config.feign.FeignConfiguration; import com.java110.dto.fee.BillDto; import com.java110.dto.fee.BillOweFeeDto; import com.java110.dto.fee.FeeAttrDto; import com.java110.dto.fee.FeeDto; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.RequestBody; @@ -32,6 +33,8 @@ @RequestMapping(value = "/queryFees", method = RequestMethod.POST) List<FeeDto> queryFees(@RequestBody FeeDto feeDto); /** * 查询<p>小区楼</p>总记录数 * @@ -43,6 +46,26 @@ /** * <p>查询费用信息</p> * * @param feeAttrDto 数据对象分享 * @return FeeDto 对象数据 */ @RequestMapping(value = "/queryFeeByAttr", method = RequestMethod.POST) List<FeeDto> queryFeeByAttr(@RequestBody FeeAttrDto feeAttrDto); /** * 查询<p>费用</p>总记录数 * * @param feeAttrDto 数据对象分享 * @return 小区下的小区楼记录数 */ @RequestMapping(value = "/queryFeeByAttrCount", method = RequestMethod.POST) int queryFeeByAttrCount(@RequestBody FeeAttrDto feeAttrDto); /** * 查询 账期信息 总数 * * @param billDto 数据对象分享 service-fee/src/main/java/com/java110/fee/api/FeeApi.java
@@ -4,6 +4,8 @@ import com.java110.core.base.controller.BaseController; import com.java110.core.context.BusinessServiceDataFlow; import com.java110.core.factory.DataTransactionFactory; import com.java110.dto.fee.FeeAttrDto; import com.java110.fee.bmo.IQueryFeeByAttr; import com.java110.fee.bmo.IQueryParkspaceFee; import com.java110.fee.smo.IFeeServiceSMO; import com.java110.utils.constant.ResponseConstant; @@ -14,10 +16,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import java.util.HashMap; @@ -34,6 +33,9 @@ @Autowired IFeeServiceSMO feeServiceSMOImpl; @Autowired private IQueryFeeByAttr queryFeeByAttrImpl; @Autowired private IQueryParkspaceFee queryParkspaceFeeImpl; @@ -124,4 +126,30 @@ Assert.hasKeyAndValue(reqJson, "code", "未包含小区编码"); return queryParkspaceFeeImpl.query(reqJson); } /** * 根据属性查询费用 * * @param communityId * @return * @path /app/feeApi/listFeeByAttr */ @RequestMapping(value = "/listFeeByAttr", method = RequestMethod.GET) public ResponseEntity<String> listFeeByAttr(@RequestParam(value = "communityId") String communityId, @RequestParam(value = "feeId", required = false) String feeId, @RequestParam(value = "specCd") String specCd, @RequestParam(value = "value") String value, @RequestParam(value = "row") int row, @RequestParam(value = "page") int page) { FeeAttrDto feeAttrDto = new FeeAttrDto(); feeAttrDto.setCommunityId(communityId); feeAttrDto.setSpecCd(specCd); feeAttrDto.setValue(value); feeAttrDto.setFeeId(feeId); feeAttrDto.setRow(row); feeAttrDto.setPage(page); return queryFeeByAttrImpl.query(feeAttrDto); } } service-fee/src/main/java/com/java110/fee/bmo/IQueryFeeByAttr.java
New file @@ -0,0 +1,15 @@ package com.java110.fee.bmo; import com.alibaba.fastjson.JSONObject; import com.java110.dto.fee.FeeAttrDto; import org.springframework.http.ResponseEntity; public interface IQueryFeeByAttr { /** * 查询费用 * @param feeAttrDto * @return */ ResponseEntity<String> query(FeeAttrDto feeAttrDto); } service-fee/src/main/java/com/java110/fee/bmo/impl/QueryFeeByAttrImpl.java
New file @@ -0,0 +1,137 @@ package com.java110.fee.bmo.impl; import com.java110.dto.RoomDto; import com.java110.dto.fee.FeeAttrDto; import com.java110.dto.fee.FeeDto; import com.java110.dto.parking.ParkingSpaceDto; import com.java110.fee.bmo.IQueryFeeByAttr; import com.java110.intf.community.IParkingSpaceInnerServiceSMO; import com.java110.intf.community.IRoomInnerServiceSMO; import com.java110.intf.fee.IFeeConfigInnerServiceSMO; import com.java110.intf.fee.IFeeInnerServiceSMO; import com.java110.utils.util.BeanConvertUtil; import com.java110.vo.ResultVo; import com.java110.vo.api.fee.ApiFeeDataVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @Service public class QueryFeeByAttrImpl implements IQueryFeeByAttr { @Autowired private IFeeInnerServiceSMO feeInnerServiceSMOImpl; @Autowired private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl; @Autowired private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl; @Autowired private IRoomInnerServiceSMO roomInnerServiceSMOImpl; @Override public ResponseEntity<String> query(FeeAttrDto feeAttrDto) { int count = feeInnerServiceSMOImpl.queryFeeByAttrCount(feeAttrDto); List<ApiFeeDataVo> fees = null; if (count > 0) { List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFeeByAttr(feeAttrDto); computeFeePrice(feeDtos); fees = BeanConvertUtil.covertBeanList(feeDtos, ApiFeeDataVo.class); } else { fees = new ArrayList<>(); } return ResultVo.createResponseEntity((int) Math.ceil((double) count / (double) feeAttrDto.getRow()), count, fees); } private void computeFeePrice(List<FeeDto> feeDtos) { for (FeeDto feeDto : feeDtos) { if ("3333".equals(feeDto.getPayerObjType())) { //房屋相关 computeFeePriceByRoom(feeDto); } else if ("6666".equals(feeDto.getPayerObjType())) {//车位相关 computeFeePriceByParkingSpace(feeDto); } } } private void computeFeePriceByParkingSpace(FeeDto feeDto) { ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto(); parkingSpaceDto.setCommunityId(feeDto.getCommunityId()); parkingSpaceDto.setPsId(feeDto.getPayerObjId()); List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto); if (parkingSpaceDtos == null || parkingSpaceDtos.size() < 1) { //数据有问题 return; } String computingFormula = feeDto.getComputingFormula(); double feePrice = 0.00; if ("1001".equals(computingFormula)) { //面积*单价+附加费 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice())); BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(parkingSpaceDtos.get(0).getArea())); BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } else if ("2002".equals(computingFormula)) { // 固定费用 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } else if ("4004".equals(computingFormula)) { feePrice = Double.parseDouble(feeDto.getAmount()); } else { feePrice = -1.00; } feeDto.setFeePrice(feePrice); } /** * 根据房屋来算单价 * * @param feeDto */ private void computeFeePriceByRoom(FeeDto feeDto) { RoomDto roomDto = new RoomDto(); roomDto.setCommunityId(feeDto.getCommunityId()); roomDto.setRoomId(feeDto.getPayerObjId()); List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto); if (roomDtos == null || roomDtos.size() < 1) { //数据有问题 return; } String computingFormula = feeDto.getComputingFormula(); double feePrice = 0.00; if ("1001".equals(computingFormula)) { //面积*单价+附加费 BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice())); BigDecimal builtUpArea = new BigDecimal(Double.parseDouble(roomDtos.get(0).getBuiltUpArea())); BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); feePrice = squarePrice.multiply(builtUpArea).add(additionalAmount).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } else if ("2002".equals(computingFormula)) { // 固定费用 BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount())); feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); } else if ("4004".equals(computingFormula)) { feePrice = Double.parseDouble(feeDto.getAmount()); } else { feePrice = -1.00; } feeDto.setFeePrice(feePrice); } } service-fee/src/main/java/com/java110/fee/dao/IFeeServiceDao.java
@@ -73,6 +73,26 @@ */ int queryFeesCount(Map info); /** * 查询费用总数 * * @param info 费用信息 * @return 费用数量 */ int queryFeeByAttrCount(Map info); /** * 查询费用信息(instance过程) * 根据bId 查询费用信息 * * @param info bId 信息 * @return 费用信息 * @throws DAOException DAO异常 */ List<Map> queryFeeByAttr(Map info) throws DAOException; /** * 查询费用账期 * service-fee/src/main/java/com/java110/fee/dao/impl/FeeServiceDaoImpl.java
@@ -130,6 +130,26 @@ return Integer.parseInt(businessFeeInfos.get(0).get("count").toString()); } @Override public int queryFeeByAttrCount(Map info) { logger.debug("查询费用数据 入参 info : {}", info); List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.queryFeeByAttrCount", info); if (businessFeeInfos.size() < 1) { return 0; } return Integer.parseInt(businessFeeInfos.get(0).get("count").toString()); } @Override public List<Map> queryFeeByAttr(Map info) throws DAOException { logger.debug("查询费用信息 入参 info : {}", info); List<Map> businessFeeInfos = sqlSessionTemplate.selectList("feeServiceDaoImpl.queryFeeByAttr", info); return businessFeeInfos; } /** * 查询费用账期 * service-fee/src/main/java/com/java110/fee/smo/impl/FeeInnerServiceSMOImpl.java
@@ -3,6 +3,7 @@ import com.java110.dto.fee.BillDto; import com.java110.dto.fee.BillOweFeeDto; import com.java110.dto.fee.FeeAttrDto; import com.java110.fee.dao.IFeeServiceDao; import com.java110.utils.util.BeanConvertUtil; import com.java110.core.base.smo.BaseServiceSMO; @@ -96,6 +97,26 @@ return feeServiceDaoImpl.queryFeesCount(BeanConvertUtil.beanCovertMap(feeDto)); } @Override public List<FeeDto> queryFeeByAttr(FeeAttrDto feeAttrDto) { //校验是否传了 分页信息 int page = feeAttrDto.getPage(); if (page != PageDto.DEFAULT_PAGE) { feeAttrDto.setPage((page - 1) * feeAttrDto.getRow()); } List<FeeDto> fees = BeanConvertUtil.covertBeanList(feeServiceDaoImpl.queryFeeByAttr(BeanConvertUtil.beanCovertMap(feeAttrDto)), FeeDto.class); return fees; } @Override public int queryFeeByAttrCount(FeeAttrDto feeAttrDto) { return feeServiceDaoImpl.queryFeeByAttrCount(BeanConvertUtil.beanCovertMap(feeAttrDto)); } @Override public int queryBillCount(@RequestBody BillDto billDto) {