java110-db/src/main/resources/mapper/fee/PayFeeDetailMonthServiceDaoImplMapper.xml
@@ -5,147 +5,160 @@ <mapper namespace="payFeeDetailMonthServiceDaoImpl"> <!-- 保存月缴费表信息 add by wuxw 2018-07-03 --> <insert id="savePayFeeDetailMonthInfo" parameterType="Map"> insert into pay_fee_detail_month( detail_month,detail_year,detail_id,receivable_amount,discount_amount,remark,received_amount,community_id,fee_id,month_id ) values ( #{detailMonth},#{detailYear},#{detailId},#{receivableAmount},#{discountAmount},#{remark},#{receivedAmount},#{communityId},#{feeId},#{monthId} ) detail_month,detail_year,detail_id,receivable_amount,discount_amount,remark,received_amount,community_id,fee_id,month_id ) values ( #{detailMonth},#{detailYear},#{detailId},#{receivableAmount},#{discountAmount},#{remark},#{receivedAmount},#{communityId},#{feeId},#{monthId} ) </insert> <!-- 保存月缴费表信息 add by wuxw 2018-07-03 --> <insert id="savePayFeeDetailMonthInfos" parameterType="Map"> insert into pay_fee_detail_month( detail_month,detail_year,detail_id,receivable_amount,discount_amount,remark,received_amount,community_id,fee_id,month_id ) values <foreach collection="payFeeDetailMonthPos" item="item" index="index" separator=","> ( #{item.detailMonth},#{item.detailYear},#{item.detailId},#{item.receivableAmount},#{item.discountAmount}, #{item.remark},#{item.receivedAmount},#{item.communityId},#{item.feeId},#{item.monthId} ) </foreach> </insert> <!-- 查询月缴费表信息 add by wuxw 2018-07-03 --> <select id="getPayFeeDetailMonthInfo" parameterType="Map" resultType="Map"> select t.detail_month,t.detail_month detailMonth,t.detail_year,t.detail_year detailYear,t.detail_id,t.detail_id detailId,t.receivable_amount,t.receivable_amount receivableAmount,t.discount_amount,t.discount_amount discountAmount,t.remark,t.status_cd,t.status_cd statusCd,t.received_amount,t.received_amount receivedAmount,t.community_id,t.community_id communityId,t.fee_id,t.fee_id feeId,t.month_id,t.month_id monthId from pay_fee_detail_month t where 1 =1 <if test="detailMonth !=null and detailMonth != ''"> and t.detail_month= #{detailMonth} </if> <if test="detailYear !=null and detailYear != ''"> and t.detail_year= #{detailYear} </if> <if test="detailId !=null and detailId != ''"> and t.detail_id= #{detailId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> and t.receivable_amount= #{receivableAmount} </if> <if test="discountAmount !=null and discountAmount != ''"> and t.discount_amount= #{discountAmount} </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="receivedAmount !=null and receivedAmount != ''"> and t.received_amount= #{receivedAmount} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> <if test="feeId !=null and feeId != ''"> and t.fee_id= #{feeId} </if> <if test="monthId !=null and monthId != ''"> and t.month_id= #{monthId} </if> order by t.create_time desc <if test="page != -1 and page != null "> limit #{page}, #{row} </if> select t.detail_month,t.detail_month detailMonth,t.detail_year,t.detail_year detailYear,t.detail_id,t.detail_id detailId,t.receivable_amount,t.receivable_amount receivableAmount,t.discount_amount,t.discount_amount discountAmount,t.remark,t.status_cd,t.status_cd statusCd,t.received_amount,t.received_amount receivedAmount,t.community_id,t.community_id communityId,t.fee_id,t.fee_id feeId,t.month_id,t.month_id monthId from pay_fee_detail_month t where 1 =1 <if test="detailMonth !=null and detailMonth != ''"> and t.detail_month= #{detailMonth} </if> <if test="detailYear !=null and detailYear != ''"> and t.detail_year= #{detailYear} </if> <if test="detailId !=null and detailId != ''"> and t.detail_id= #{detailId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> and t.receivable_amount= #{receivableAmount} </if> <if test="discountAmount !=null and discountAmount != ''"> and t.discount_amount= #{discountAmount} </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="receivedAmount !=null and receivedAmount != ''"> and t.received_amount= #{receivedAmount} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> <if test="feeId !=null and feeId != ''"> and t.fee_id= #{feeId} </if> <if test="monthId !=null and monthId != ''"> and t.month_id= #{monthId} </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="updatePayFeeDetailMonthInfo" parameterType="Map"> update pay_fee_detail_month t set t.status_cd = #{statusCd} <if test="newBId != null and newBId != ''"> ,t.b_id = #{newBId} </if> <if test="detailMonth !=null and detailMonth != ''"> , t.detail_month= #{detailMonth} </if> <if test="detailYear !=null and detailYear != ''"> , t.detail_year= #{detailYear} </if> <if test="detailId !=null and detailId != ''"> , t.detail_id= #{detailId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> , t.receivable_amount= #{receivableAmount} </if> <if test="discountAmount !=null and discountAmount != ''"> , t.discount_amount= #{discountAmount} </if> <if test="remark !=null and remark != ''"> , t.remark= #{remark} </if> <if test="receivedAmount !=null and receivedAmount != ''"> , t.received_amount= #{receivedAmount} </if> <if test="communityId !=null and communityId != ''"> , t.community_id= #{communityId} </if> <if test="feeId !=null and feeId != ''"> , t.fee_id= #{feeId} </if> where 1=1 <if test="monthId !=null and monthId != ''"> and t.month_id= #{monthId} </if> update pay_fee_detail_month t set t.status_cd = #{statusCd} <if test="newBId != null and newBId != ''"> ,t.b_id = #{newBId} </if> <if test="detailMonth !=null and detailMonth != ''"> , t.detail_month= #{detailMonth} </if> <if test="detailYear !=null and detailYear != ''"> , t.detail_year= #{detailYear} </if> <if test="detailId !=null and detailId != ''"> , t.detail_id= #{detailId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> , t.receivable_amount= #{receivableAmount} </if> <if test="discountAmount !=null and discountAmount != ''"> , t.discount_amount= #{discountAmount} </if> <if test="remark !=null and remark != ''"> , t.remark= #{remark} </if> <if test="receivedAmount !=null and receivedAmount != ''"> , t.received_amount= #{receivedAmount} </if> <if test="communityId !=null and communityId != ''"> , t.community_id= #{communityId} </if> <if test="feeId !=null and feeId != ''"> , t.fee_id= #{feeId} </if> where 1=1 <if test="monthId !=null and monthId != ''"> and t.month_id= #{monthId} </if> </update> <!-- 查询月缴费表数量 add by wuxw 2018-07-03 --> <select id="queryPayFeeDetailMonthsCount" parameterType="Map" resultType="Map"> select count(1) count from pay_fee_detail_month t where 1 =1 <if test="detailMonth !=null and detailMonth != ''"> and t.detail_month= #{detailMonth} </if> <if test="detailYear !=null and detailYear != ''"> and t.detail_year= #{detailYear} </if> <if test="detailId !=null and detailId != ''"> and t.detail_id= #{detailId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> and t.receivable_amount= #{receivableAmount} </if> <if test="discountAmount !=null and discountAmount != ''"> and t.discount_amount= #{discountAmount} </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="receivedAmount !=null and receivedAmount != ''"> and t.received_amount= #{receivedAmount} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> <if test="feeId !=null and feeId != ''"> and t.fee_id= #{feeId} </if> <if test="monthId !=null and monthId != ''"> and t.month_id= #{monthId} </if> <select id="queryPayFeeDetailMonthsCount" parameterType="Map" resultType="Map"> select count(1) count from pay_fee_detail_month t where 1 =1 <if test="detailMonth !=null and detailMonth != ''"> and t.detail_month= #{detailMonth} </if> <if test="detailYear !=null and detailYear != ''"> and t.detail_year= #{detailYear} </if> <if test="detailId !=null and detailId != ''"> and t.detail_id= #{detailId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> and t.receivable_amount= #{receivableAmount} </if> <if test="discountAmount !=null and discountAmount != ''"> and t.discount_amount= #{discountAmount} </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="receivedAmount !=null and receivedAmount != ''"> and t.received_amount= #{receivedAmount} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> <if test="feeId !=null and feeId != ''"> and t.fee_id= #{feeId} </if> <if test="monthId !=null and monthId != ''"> and t.month_id= #{monthId} </if> </select> </select> </mapper> java110-interface/src/main/java/com/java110/intf/fee/IPayFeeDetailMonthInnerServiceSMO.java
@@ -26,6 +26,10 @@ @RequestMapping(value = "/savePayFeeDetailMonth", method = RequestMethod.POST) public int savePayFeeDetailMonth(@RequestBody PayFeeDetailMonthPo payFeeDetailMonthPo); @RequestMapping(value = "/savePayFeeDetailMonths", method = RequestMethod.POST) public int savePayFeeDetailMonths(@RequestBody List<PayFeeDetailMonthPo> payFeeDetailMonthPos); @RequestMapping(value = "/updatePayFeeDetailMonth", method = RequestMethod.POST) public int updatePayFeeDetailMonth(@RequestBody PayFeeDetailMonthPo payFeeDetailMonthPo); service-fee/src/main/java/com/java110/fee/dao/IPayFeeDetailMonthServiceDao.java
@@ -28,6 +28,8 @@ */ void savePayFeeDetailMonthInfo(Map info) throws DAOException; int savePayFeeDetailMonthInfos(Map info); @@ -58,4 +60,5 @@ */ int queryPayFeeDetailMonthsCount(Map info); } service-fee/src/main/java/com/java110/fee/dao/impl/PayFeeDetailMonthServiceDaoImpl.java
@@ -1,15 +1,13 @@ package com.java110.fee.dao.impl; import com.alibaba.fastjson.JSONObject; import com.java110.utils.constant.ResponseConstant; import com.java110.utils.exception.DAOException; import com.java110.utils.util.DateUtil; import com.java110.core.base.dao.BaseServiceDao; import com.java110.fee.dao.IPayFeeDetailMonthServiceDao; import com.java110.utils.constant.ResponseConstant; import com.java110.utils.exception.DAOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; @@ -25,37 +23,45 @@ private static Logger logger = LoggerFactory.getLogger(PayFeeDetailMonthServiceDaoImpl.class); /** * 保存月缴费表信息 到 instance * @param info bId 信息 * * @param info bId 信息 * @throws DAOException DAO异常 */ @Override public void savePayFeeDetailMonthInfo(Map info) throws DAOException { logger.debug("保存月缴费表信息Instance 入参 info : {}",info); logger.debug("保存月缴费表信息Instance 入参 info : {}", info); int saveFlag = sqlSessionTemplate.insert("payFeeDetailMonthServiceDaoImpl.savePayFeeDetailMonthInfo",info); int saveFlag = sqlSessionTemplate.insert("payFeeDetailMonthServiceDaoImpl.savePayFeeDetailMonthInfo", info); if(saveFlag < 1){ throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存月缴费表信息Instance数据失败:"+ JSONObject.toJSONString(info)); if (saveFlag < 1) { throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存月缴费表信息Instance数据失败:" + JSONObject.toJSONString(info)); } } @Override public int savePayFeeDetailMonthInfos(Map info) { logger.debug("保存月缴费表信息Instance 入参 info : {}", info); int saveFlag = sqlSessionTemplate.insert("payFeeDetailMonthServiceDaoImpl.savePayFeeDetailMonthInfos", info); return saveFlag; } /** * 查询月缴费表信息(instance) * * @param info bId 信息 * @return List<Map> * @throws DAOException DAO异常 */ @Override public List<Map> getPayFeeDetailMonthInfo(Map info) throws DAOException { logger.debug("查询月缴费表信息 入参 info : {}",info); logger.debug("查询月缴费表信息 入参 info : {}", info); List<Map> businessPayFeeDetailMonthInfos = sqlSessionTemplate.selectList("payFeeDetailMonthServiceDaoImpl.getPayFeeDetailMonthInfo",info); List<Map> businessPayFeeDetailMonthInfos = sqlSessionTemplate.selectList("payFeeDetailMonthServiceDaoImpl.getPayFeeDetailMonthInfo", info); return businessPayFeeDetailMonthInfos; } @@ -63,28 +69,30 @@ /** * 修改月缴费表信息 * * @param info 修改信息 * @throws DAOException DAO异常 */ @Override public void updatePayFeeDetailMonthInfo(Map info) throws DAOException { logger.debug("修改月缴费表信息Instance 入参 info : {}",info); logger.debug("修改月缴费表信息Instance 入参 info : {}", info); int saveFlag = sqlSessionTemplate.update("payFeeDetailMonthServiceDaoImpl.updatePayFeeDetailMonthInfo",info); int saveFlag = sqlSessionTemplate.update("payFeeDetailMonthServiceDaoImpl.updatePayFeeDetailMonthInfo", info); if(saveFlag < 1){ throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改月缴费表信息Instance数据失败:"+ JSONObject.toJSONString(info)); if (saveFlag < 1) { throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改月缴费表信息Instance数据失败:" + JSONObject.toJSONString(info)); } } /** /** * 查询月缴费表数量 * * @param info 月缴费表信息 * @return 月缴费表数量 */ @Override public int queryPayFeeDetailMonthsCount(Map info) { logger.debug("查询月缴费表数据 入参 info : {}",info); logger.debug("查询月缴费表数据 入参 info : {}", info); List<Map> businessPayFeeDetailMonthInfos = sqlSessionTemplate.selectList("payFeeDetailMonthServiceDaoImpl.queryPayFeeDetailMonthsCount", info); if (businessPayFeeDetailMonthInfos.size() < 1) { service-fee/src/main/java/com/java110/fee/smo/impl/PayFeeDetailMonthInnerServiceSMOImpl.java
@@ -12,7 +12,9 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @ClassName FloorInnerServiceSMOImpl @@ -37,6 +39,15 @@ } @Override public int savePayFeeDetailMonths(@RequestBody List<PayFeeDetailMonthPo> payFeeDetailMonthPos) { int saveFlag = 1; Map info = new HashMap(); info.put("payFeeDetailMonthPos",payFeeDetailMonthPos); payFeeDetailMonthServiceDaoImpl.savePayFeeDetailMonthInfos(info); return saveFlag; } @Override public int updatePayFeeDetailMonth(@RequestBody PayFeeDetailMonthPo payFeeDetailMonthPo) { int saveFlag = 1; payFeeDetailMonthServiceDaoImpl.updatePayFeeDetailMonthInfo(BeanConvertUtil.beanCovertMap(payFeeDetailMonthPo)); service-job/src/main/java/com/java110/job/adapt/fee/PayFeeDetailToMonthAdapt.java
File was renamed from service-job/src/main/java/com/java110/job/adapt/payment/fee/PayFeeDetailToMonthAdapt.java @@ -1,35 +1,23 @@ package com.java110.job.adapt.payment.fee; package com.java110.job.adapt.fee; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.serializer.SerializerFeature; import com.java110.core.factory.GenerateCodeFactory; import com.java110.core.smo.IComputeFeeSMO; import com.java110.dto.fee.FeeDetailDto; import com.java110.dto.fee.FeeDto; import com.java110.dto.owner.OwnerDto; import com.java110.entity.order.Business; import com.java110.intf.community.ICommunityInnerServiceSMO; import com.java110.intf.fee.IFeeDetailInnerServiceSMO; import com.java110.intf.fee.IFeeInnerServiceSMO; import com.java110.intf.fee.IFeeReceiptDetailInnerServiceSMO; import com.java110.intf.fee.IFeeReceiptInnerServiceSMO; import com.java110.intf.user.IOwnerAppUserInnerServiceSMO; import com.java110.intf.user.IOwnerCarInnerServiceSMO; import com.java110.intf.user.IOwnerInnerServiceSMO; import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO; import com.java110.job.adapt.DatabusAdaptImpl; import com.java110.job.adapt.payment.fee.asyn.IPayFeeDetailToMonth; import com.java110.job.adapt.fee.asyn.IPayFeeDetailToMonth; import com.java110.po.fee.PayFeeDetailPo; import com.java110.po.feeReceipt.FeeReceiptPo; import com.java110.po.feeReceiptDetail.FeeReceiptDetailPo; import com.java110.utils.util.Assert; import com.java110.utils.util.BeanConvertUtil; import com.java110.utils.util.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import java.util.List; service-job/src/main/java/com/java110/job/adapt/fee/asyn/IPayFeeDetailToMonth.java
File was renamed from service-job/src/main/java/com/java110/job/adapt/payment/fee/asyn/IPayFeeDetailToMonth.java @@ -1,4 +1,4 @@ package com.java110.job.adapt.payment.fee.asyn; package com.java110.job.adapt.fee.asyn; import com.alibaba.fastjson.JSONObject; import com.java110.entity.order.Business; service-job/src/main/java/com/java110/job/adapt/fee/asyn/impl/PayFeeDetailToMonthIImpl.java
New file @@ -0,0 +1,101 @@ package com.java110.job.adapt.fee.asyn.impl; import com.alibaba.fastjson.JSONObject; import com.java110.core.factory.GenerateCodeFactory; import com.java110.core.smo.IComputeFeeSMO; import com.java110.dto.fee.FeeDto; import com.java110.entity.order.Business; import com.java110.intf.fee.IFeeInnerServiceSMO; import com.java110.intf.fee.IPayFeeDetailMonthInnerServiceSMO; import com.java110.job.adapt.fee.asyn.IPayFeeDetailToMonth; import com.java110.po.fee.PayFeeDetailPo; import com.java110.po.payFeeDetailMonth.PayFeeDetailMonthPo; import com.java110.utils.util.Assert; import com.java110.utils.util.BeanConvertUtil; import com.java110.utils.util.DateUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.text.ParseException; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; @Service public class PayFeeDetailToMonthIImpl implements IPayFeeDetailToMonth { @Autowired private IFeeInnerServiceSMO feeInnerServiceSMOImpl; @Autowired private IComputeFeeSMO computeFeeSMOImpl; @Autowired private IPayFeeDetailMonthInnerServiceSMO payFeeDetailMonthInnerServiceSMOImpl; @Override @Async public void doPayFeeDetail(Business business, JSONObject businessPayFeeDetail) { //查询缴费明细 PayFeeDetailPo payFeeDetailPo = BeanConvertUtil.covertBean(businessPayFeeDetail, PayFeeDetailPo.class); FeeDto feeDto = new FeeDto(); feeDto.setFeeId(payFeeDetailPo.getFeeId()); feeDto.setCommunityId(payFeeDetailPo.getCommunityId()); List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto); Assert.listOnlyOne(feeDtos, "未查询到费用信息"); feeDto = feeDtos.get(0); Date startTime = null; Date endTime = null; try { startTime = DateUtil.getDateFromString(businessPayFeeDetail.getString("startTime"), DateUtil.DATE_FORMATE_STRING_A); endTime = DateUtil.getDateFromString(businessPayFeeDetail.getString("endTime"), DateUtil.DATE_FORMATE_STRING_A); } catch (ParseException e) { throw new IllegalArgumentException("时间格式错误"); } double maxMonth = Math.ceil(computeFeeSMOImpl.dayCompare(startTime, endTime)); if (maxMonth < 1) { return; } double feePrice = computeFeeSMOImpl.getFeePrice(feeDto); BigDecimal totalRecDec = new BigDecimal(businessPayFeeDetail.getDouble("receivedAmount")); //每月平均值 BigDecimal priRecDec = totalRecDec.divide(new BigDecimal(maxMonth), 2, BigDecimal.ROUND_HALF_EVEN); List<PayFeeDetailMonthPo> payFeeDetailMonthPos = new ArrayList<>(); Calendar calendar = Calendar.getInstance(); PayFeeDetailMonthPo tmpPayFeeDetailMonthPo = null; BigDecimal discountAmount = new BigDecimal(0.0); for (int month = 0; month < maxMonth; month++) { calendar.setTime(startTime); calendar.add(Calendar.MONTH, month); discountAmount = new BigDecimal(feePrice).subtract(priRecDec).setScale(2, BigDecimal.ROUND_HALF_EVEN); tmpPayFeeDetailMonthPo = new PayFeeDetailMonthPo(); tmpPayFeeDetailMonthPo.setFeeId(feeDto.getFeeId()); tmpPayFeeDetailMonthPo.setCommunityId(feeDto.getCommunityId()); tmpPayFeeDetailMonthPo.setDetailId(businessPayFeeDetail.getString("detailId")); tmpPayFeeDetailMonthPo.setDetailMonth((calendar.get(Calendar.MONTH) + 1) + ""); tmpPayFeeDetailMonthPo.setDetailYear(calendar.get(Calendar.YEAR) + ""); tmpPayFeeDetailMonthPo.setDiscountAmount(discountAmount.doubleValue() + ""); tmpPayFeeDetailMonthPo.setMonthId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_monthId)); tmpPayFeeDetailMonthPo.setReceivableAmount(feePrice + ""); tmpPayFeeDetailMonthPo.setReceivedAmount(priRecDec.doubleValue() + ""); tmpPayFeeDetailMonthPo.setRemark("程序计算生成"); payFeeDetailMonthPos.add(tmpPayFeeDetailMonthPo); } payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos); } } service-job/src/main/java/com/java110/job/adapt/payment/fee/asyn/impl/PayFeeDetailToMonthIImpl.java
File was deleted