java110-bean/src/main/java/com/java110/dto/chargeMonthOrder/ChargeMonthOrderDto.java
@@ -1,6 +1,8 @@ package com.java110.dto.chargeMonthOrder; import com.java110.dto.PageDto; import com.java110.dto.chargeMonthCard.ChargeMonthCardDto; import java.io.Serializable; import java.util.Date; @@ -12,19 +14,24 @@ * @Version 1.0 * add by wuxw 2019/4/24 **/ public class ChargeMonthOrderDto extends PageDto implements Serializable { public class ChargeMonthOrderDto extends ChargeMonthCardDto implements Serializable { private String personName; private String primeRate; private String orderId; private String cardId; private String receivableAmount; private String startTime; private String remark; private String receivedAmount; private String endTime; private String personTel; private String communityId; private String primeRate; private String primeRateName; private String orderId; private String cardId; private String receivableAmount; private String startTime; private String remark; private String receivedAmount; private String endTime; private String personTel; private String communityId; private String queryTime; private Date createTime; @@ -35,67 +42,88 @@ public String getPersonName() { return personName; } public void setPersonName(String personName) { public void setPersonName(String personName) { this.personName = personName; } public String getPrimeRate() { public String getPrimeRate() { return primeRate; } public void setPrimeRate(String primeRate) { public void setPrimeRate(String primeRate) { this.primeRate = primeRate; } public String getOrderId() { public String getOrderId() { return orderId; } public void setOrderId(String orderId) { public void setOrderId(String orderId) { this.orderId = orderId; } public String getCardId() { public String getCardId() { return cardId; } public void setCardId(String cardId) { public void setCardId(String cardId) { this.cardId = cardId; } public String getReceivableAmount() { public String getReceivableAmount() { return receivableAmount; } public void setReceivableAmount(String receivableAmount) { public void setReceivableAmount(String receivableAmount) { this.receivableAmount = receivableAmount; } public String getStartTime() { public String getStartTime() { return startTime; } public void setStartTime(String startTime) { public void setStartTime(String startTime) { this.startTime = startTime; } public String getRemark() { public String getRemark() { return remark; } public void setRemark(String remark) { public void setRemark(String remark) { this.remark = remark; } public String getReceivedAmount() { public String getReceivedAmount() { return receivedAmount; } public void setReceivedAmount(String receivedAmount) { public void setReceivedAmount(String receivedAmount) { this.receivedAmount = receivedAmount; } public String getEndTime() { public String getEndTime() { return endTime; } public void setEndTime(String endTime) { public void setEndTime(String endTime) { this.endTime = endTime; } public String getPersonTel() { public String getPersonTel() { return personTel; } public void setPersonTel(String personTel) { public void setPersonTel(String personTel) { this.personTel = personTel; } public String getCommunityId() { public String getCommunityId() { return communityId; } public void setCommunityId(String communityId) { public void setCommunityId(String communityId) { this.communityId = communityId; } @@ -115,4 +143,20 @@ public void setStatusCd(String statusCd) { this.statusCd = statusCd; } public String getQueryTime() { return queryTime; } public void setQueryTime(String queryTime) { this.queryTime = queryTime; } public String getPrimeRateName() { return primeRateName; } public void setPrimeRateName(String primeRateName) { this.primeRateName = primeRateName; } } java110-bean/src/main/java/com/java110/po/chargeMonthOrder/ChargeMonthOrderPo.java
@@ -17,6 +17,7 @@ import java.io.Serializable; import java.util.Date; /** * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体 * add by 吴学文 at 2023-04-24 10:21:05 mail: 928255095@qq.com @@ -28,90 +29,113 @@ public class ChargeMonthOrderPo implements Serializable { private String personName; private String primeRate; private String orderId; private String cardId; private String receivableAmount; private String startTime; private String statusCd = "0"; private String remark; private String receivedAmount; private String endTime; private String personTel; private String communityId; public String getPersonName() { private String primeRate; private String orderId; private String cardId; private String receivableAmount; private String startTime; private String statusCd = "0"; private String remark; private String receivedAmount; private String endTime; private String personTel; private String communityId; public String getPersonName() { return personName; } public void setPersonName(String personName) { public void setPersonName(String personName) { this.personName = personName; } public String getPrimeRate() { public String getPrimeRate() { return primeRate; } public void setPrimeRate(String primeRate) { public void setPrimeRate(String primeRate) { this.primeRate = primeRate; } public String getOrderId() { public String getOrderId() { return orderId; } public void setOrderId(String orderId) { public void setOrderId(String orderId) { this.orderId = orderId; } public String getCardId() { public String getCardId() { return cardId; } public void setCardId(String cardId) { public void setCardId(String cardId) { this.cardId = cardId; } public String getReceivableAmount() { public String getReceivableAmount() { return receivableAmount; } public void setReceivableAmount(String receivableAmount) { public void setReceivableAmount(String receivableAmount) { this.receivableAmount = receivableAmount; } public String getStartTime() { public String getStartTime() { return startTime; } public void setStartTime(String startTime) { public void setStartTime(String startTime) { this.startTime = startTime; } public String getStatusCd() { public String getStatusCd() { return statusCd; } public void setStatusCd(String statusCd) { public void setStatusCd(String statusCd) { this.statusCd = statusCd; } public String getRemark() { public String getRemark() { return remark; } public void setRemark(String remark) { public void setRemark(String remark) { this.remark = remark; } public String getReceivedAmount() { public String getReceivedAmount() { return receivedAmount; } public void setReceivedAmount(String receivedAmount) { public void setReceivedAmount(String receivedAmount) { this.receivedAmount = receivedAmount; } public String getEndTime() { public String getEndTime() { return endTime; } public void setEndTime(String endTime) { public void setEndTime(String endTime) { this.endTime = endTime; } public String getPersonTel() { public String getPersonTel() { return personTel; } public void setPersonTel(String personTel) { public void setPersonTel(String personTel) { this.personTel = personTel; } public String getCommunityId() { public String getCommunityId() { return communityId; } public void setCommunityId(String communityId) { public void setCommunityId(String communityId) { this.communityId = communityId; } } java110-db/src/main/resources/mapper/common/ChargeMonthOrderV1ServiceDaoImplMapper.xml
@@ -5,156 +5,172 @@ <mapper namespace="chargeMonthOrderV1ServiceDaoImpl"> <!-- 保存充电月卡订单信息 add by wuxw 2018-07-03 --> <insert id="saveChargeMonthOrderInfo" parameterType="Map"> insert into charge_month_order( person_name,prime_rate,order_id,card_id,receivable_amount,start_time,remark,received_amount,end_time,person_tel,community_id ) values ( #{personName},#{primeRate},#{orderId},#{cardId},#{receivableAmount},#{startTime},#{remark},#{receivedAmount},#{endTime},#{personTel},#{communityId} ) person_name,prime_rate,order_id,card_id,receivable_amount,start_time,remark,received_amount,end_time,person_tel,community_id ) values ( #{personName},#{primeRate},#{orderId},#{cardId},#{receivableAmount},#{startTime},#{remark},#{receivedAmount},#{endTime},#{personTel},#{communityId} ) </insert> <!-- 查询充电月卡订单信息 add by wuxw 2018-07-03 --> <select id="getChargeMonthOrderInfo" parameterType="Map" resultType="Map"> select t.person_name,t.person_name personName,t.prime_rate,t.prime_rate primeRate,t.order_id,t.order_id orderId,t.card_id,t.card_id cardId,t.receivable_amount,t.receivable_amount receivableAmount,t.start_time,t.start_time startTime,t.status_cd,t.status_cd statusCd,t.remark,t.received_amount,t.received_amount receivedAmount,t.end_time,t.end_time endTime,t.person_tel,t.person_tel personTel,t.community_id,t.community_id communityId from charge_month_order t where 1 =1 <if test="personName !=null and personName != ''"> and t.person_name= #{personName} </if> <if test="primeRate !=null and primeRate != ''"> and t.prime_rate= #{primeRate} </if> <if test="orderId !=null and orderId != ''"> and t.order_id= #{orderId} </if> <if test="cardId !=null and cardId != ''"> and t.card_id= #{cardId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> and t.receivable_amount= #{receivableAmount} </if> <if test="startTime !=null and startTime != ''"> and t.start_time= #{startTime} </if> <if test="statusCd !=null and statusCd != ''"> and t.status_cd= #{statusCd} </if> <if test="remark !=null and remark != ''"> and t.remark= #{remark} </if> <if test="receivedAmount !=null and receivedAmount != ''"> and t.received_amount= #{receivedAmount} </if> <if test="endTime !=null and endTime != ''"> and t.end_time= #{endTime} </if> <if test="personTel !=null and personTel != ''"> and t.person_tel= #{personTel} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> order by t.create_time desc <if test="page != -1 and page != null "> limit #{page}, #{row} </if> select t.person_name,t.person_name personName,t.prime_rate,t.prime_rate primeRate,t.order_id,t.order_id orderId,t.card_id,t.card_id cardId,t.receivable_amount,t.receivable_amount receivableAmount,t.start_time,t.start_time startTime,t.status_cd,t.status_cd statusCd,t.remark,t.received_amount,t.received_amount receivedAmount,t.end_time,t.end_time endTime,t.person_tel,t.person_tel personTel,t.community_id,t.community_id communityId, cmc.card_name cardName,cmc.card_month cardMonth,cmc.card_price cardPrice,cmc.day_hours dayHours, td.`name` primeRateName,t.create_time createTime from charge_month_order t left join charge_month_card cmc on t.card_id = cmc.card_id and cmc.status_cd = '0' left join t_dict td on t.prime_rate = td.status_cd and td.table_name = 'pay_fee_detail' and td.table_columns = 'prime_rate' where 1 =1 <if test="personName !=null and personName != ''"> and t.person_name= #{personName} </if> <if test="primeRate !=null and primeRate != ''"> and t.prime_rate= #{primeRate} </if> <if test="orderId !=null and orderId != ''"> and t.order_id= #{orderId} </if> <if test="cardId !=null and cardId != ''"> and t.card_id= #{cardId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> and t.receivable_amount= #{receivableAmount} </if> <if test="startTime !=null and startTime != ''"> and t.start_time= #{startTime} </if> <if test="statusCd !=null and statusCd != ''"> and t.status_cd= #{statusCd} </if> <if test="remark !=null and remark != ''"> and t.remark= #{remark} </if> <if test="receivedAmount !=null and receivedAmount != ''"> and t.received_amount= #{receivedAmount} </if> <if test="endTime !=null and endTime != ''"> and t.end_time= #{endTime} </if> <if test="queryTime !=null and queryTime != ''"> and t.start_time < #{queryTime} and t.end_time > #{queryTime} </if> <if test="personTel !=null and personTel != ''"> and t.person_tel= #{personTel} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> <if test="queryTime !=null and queryTime != ''"> order by t.end_time desc </if> <if test="queryTime == null || queryTime == ''"> order by t.create_time desc </if> <if test="page != -1 and page != null "> limit #{page}, #{row} </if> </select> <!-- 修改充电月卡订单信息 add by wuxw 2018-07-03 --> <update id="updateChargeMonthOrderInfo" parameterType="Map"> update charge_month_order t set t.status_cd = #{statusCd} <if test="newBId != null and newBId != ''"> ,t.b_id = #{newBId} </if> <if test="personName !=null and personName != ''"> , t.person_name= #{personName} </if> <if test="primeRate !=null and primeRate != ''"> , t.prime_rate= #{primeRate} </if> <if test="cardId !=null and cardId != ''"> , t.card_id= #{cardId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> , t.receivable_amount= #{receivableAmount} </if> <if test="startTime !=null and startTime != ''"> , t.start_time= #{startTime} </if> <if test="remark !=null and remark != ''"> , t.remark= #{remark} </if> <if test="receivedAmount !=null and receivedAmount != ''"> , t.received_amount= #{receivedAmount} </if> <if test="endTime !=null and endTime != ''"> , t.end_time= #{endTime} </if> <if test="personTel !=null and personTel != ''"> , t.person_tel= #{personTel} </if> <if test="communityId !=null and communityId != ''"> , t.community_id= #{communityId} </if> where 1=1 <if test="orderId !=null and orderId != ''"> and t.order_id= #{orderId} </if> update charge_month_order t set t.status_cd = #{statusCd} <if test="newBId != null and newBId != ''"> ,t.b_id = #{newBId} </if> <if test="personName !=null and personName != ''"> , t.person_name= #{personName} </if> <if test="primeRate !=null and primeRate != ''"> , t.prime_rate= #{primeRate} </if> <if test="cardId !=null and cardId != ''"> , t.card_id= #{cardId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> , t.receivable_amount= #{receivableAmount} </if> <if test="startTime !=null and startTime != ''"> , t.start_time= #{startTime} </if> <if test="remark !=null and remark != ''"> , t.remark= #{remark} </if> <if test="receivedAmount !=null and receivedAmount != ''"> , t.received_amount= #{receivedAmount} </if> <if test="endTime !=null and endTime != ''"> , t.end_time= #{endTime} </if> <if test="personTel !=null and personTel != ''"> , t.person_tel= #{personTel} </if> where 1=1 <if test="orderId !=null and orderId != ''"> and t.order_id= #{orderId} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> </update> <!-- 查询充电月卡订单数量 add by wuxw 2018-07-03 --> <select id="queryChargeMonthOrdersCount" parameterType="Map" resultType="Map"> select count(1) count from charge_month_order t where 1 =1 <if test="personName !=null and personName != ''"> and t.person_name= #{personName} </if> <if test="primeRate !=null and primeRate != ''"> and t.prime_rate= #{primeRate} </if> <if test="orderId !=null and orderId != ''"> and t.order_id= #{orderId} </if> <if test="cardId !=null and cardId != ''"> and t.card_id= #{cardId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> and t.receivable_amount= #{receivableAmount} </if> <if test="startTime !=null and startTime != ''"> and t.start_time= #{startTime} </if> <if test="statusCd !=null and statusCd != ''"> and t.status_cd= #{statusCd} </if> <if test="remark !=null and remark != ''"> and t.remark= #{remark} </if> <if test="receivedAmount !=null and receivedAmount != ''"> and t.received_amount= #{receivedAmount} </if> <if test="endTime !=null and endTime != ''"> and t.end_time= #{endTime} </if> <if test="personTel !=null and personTel != ''"> and t.person_tel= #{personTel} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> <select id="queryChargeMonthOrdersCount" parameterType="Map" resultType="Map"> select count(1) count from charge_month_order t where 1 =1 <if test="personName !=null and personName != ''"> and t.person_name= #{personName} </if> <if test="primeRate !=null and primeRate != ''"> and t.prime_rate= #{primeRate} </if> <if test="orderId !=null and orderId != ''"> and t.order_id= #{orderId} </if> <if test="cardId !=null and cardId != ''"> and t.card_id= #{cardId} </if> <if test="receivableAmount !=null and receivableAmount != ''"> and t.receivable_amount= #{receivableAmount} </if> <if test="startTime !=null and startTime != ''"> and t.start_time= #{startTime} </if> <if test="statusCd !=null and statusCd != ''"> and t.status_cd= #{statusCd} </if> <if test="remark !=null and remark != ''"> and t.remark= #{remark} </if> <if test="receivedAmount !=null and receivedAmount != ''"> and t.received_amount= #{receivedAmount} </if> <if test="endTime !=null and endTime != ''"> and t.end_time= #{endTime} </if> <if test="personTel !=null and personTel != ''"> and t.person_tel= #{personTel} </if> <if test="queryTime !=null and queryTime != ''"> and t.start_time < #{queryTime} and t.end_time > #{queryTime} </if> <if test="communityId !=null and communityId != ''"> and t.community_id= #{communityId} </if> </select> </select> </mapper> service-common/src/main/java/com/java110/common/cmd/chargeCard/SaveChargeMonthOrderCmd.java
@@ -22,15 +22,27 @@ import com.java110.core.event.cmd.Cmd; import com.java110.core.event.cmd.CmdEvent; import com.java110.core.factory.GenerateCodeFactory; import com.java110.dto.chargeMonthCard.ChargeMonthCardDto; import com.java110.dto.chargeMonthOrder.ChargeMonthOrderDto; import com.java110.dto.owner.OwnerDto; import com.java110.dto.user.UserDto; import com.java110.intf.acct.IIntegralConfigV1InnerServiceSMO; import com.java110.intf.common.IChargeMonthCardV1InnerServiceSMO; import com.java110.intf.common.IChargeMonthOrderV1InnerServiceSMO; import com.java110.intf.user.IOwnerV1InnerServiceSMO; import com.java110.intf.user.IUserV1InnerServiceSMO; import com.java110.po.chargeMonthOrder.ChargeMonthOrderPo; import com.java110.utils.exception.CmdException; import com.java110.utils.util.Assert; import com.java110.utils.util.BeanConvertUtil; import com.java110.utils.util.DateUtil; import com.java110.vo.ResultVo; import org.springframework.beans.factory.annotation.Autowired; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Date; import java.util.List; /** * 类表述:保存 @@ -52,6 +64,15 @@ @Autowired private IChargeMonthOrderV1InnerServiceSMO chargeMonthOrderV1InnerServiceSMOImpl; @Autowired private IChargeMonthCardV1InnerServiceSMO chargeMonthCardV1InnerServiceSMOImpl; @Autowired private IOwnerV1InnerServiceSMO ownerInnerServiceSMOImpl; @Autowired private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl; @Override public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) { Assert.hasKeyAndValue(reqJson, "cardId", "请求报文中未包含cardId"); @@ -59,17 +80,42 @@ Assert.hasKeyAndValue(reqJson, "personTel", "请求报文中未包含personTel"); Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId"); Assert.hasKeyAndValue(reqJson, "primeRate", "请求报文中未包含primeRate"); Assert.hasKeyAndValue(reqJson, "receivableAmount", "请求报文中未包含receivableAmount"); Assert.hasKeyAndValue(reqJson, "receivedAmount", "请求报文中未包含receivedAmount"); //校验月卡是否 存在 ChargeMonthCardDto chargeMonthCardDto = new ChargeMonthCardDto(); chargeMonthCardDto.setCardId(reqJson.getString("cardId")); chargeMonthCardDto.setCommunityId(reqJson.getString("communityId")); List<ChargeMonthCardDto> chargeMonthCardDtos = chargeMonthCardV1InnerServiceSMOImpl.queryChargeMonthCards(chargeMonthCardDto); Assert.listOnlyOne(chargeMonthCardDtos, "月卡不存在"); reqJson.put("receivableAmount", chargeMonthCardDtos.get(0).getCardPrice()); reqJson.put("cardMonth", chargeMonthCardDtos.get(0).getCardMonth()); } @Override @Java110Transactional public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { ChargeMonthOrderDto chargeMonthOrderDto = new ChargeMonthOrderDto(); chargeMonthOrderDto.setPersonTel(reqJson.getString("personTel")); chargeMonthOrderDto.setQueryTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); List<ChargeMonthOrderDto> chargeMonthOrderDtos = chargeMonthOrderV1InnerServiceSMOImpl.queryChargeMonthOrders(chargeMonthOrderDto); Date startTime = null; if (chargeMonthOrderDtos == null || chargeMonthOrderDtos.size() < 1) { startTime = DateUtil.getCurrentDate(); } else { startTime = DateUtil.getDateFromStringA(chargeMonthOrderDtos.get(0).getEndTime()); } String endDate = DateUtil.getAddMonthStringA(startTime, reqJson.getIntValue("cardMonth")); ChargeMonthOrderPo chargeMonthOrderPo = BeanConvertUtil.covertBean(reqJson, ChargeMonthOrderPo.class); chargeMonthOrderPo.setOrderId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID)); chargeMonthOrderPo.setStartTime(DateUtil.getFormatTimeString(startTime, DateUtil.DATE_FORMATE_STRING_A)); chargeMonthOrderPo.setEndTime(endDate); chargeMonthOrderPo.setPersonTel("personTel"); chargeMonthOrderPo.setPersonName(getPersonName(reqJson)); int flag = chargeMonthOrderV1InnerServiceSMOImpl.saveChargeMonthOrder(chargeMonthOrderPo); if (flag < 1) { @@ -78,4 +124,25 @@ cmdDataFlowContext.setResponseEntity(ResultVo.success()); } private String getPersonName(JSONObject reqJson) { // todo 业主用 手机号查询 OwnerDto tmpOwnerDto = new OwnerDto(); tmpOwnerDto.setLink(reqJson.getString("personTel")); tmpOwnerDto.setCommunityId(reqJson.getString("communityId")); List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(tmpOwnerDto); if (ownerDtos != null && ownerDtos.size() > 0) { return ownerDtos.get(0).getName(); } //todo 非业主是游客 UserDto userDto = new UserDto(); userDto.setTel(reqJson.getString("personTel")); List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto); if (userDtos != null && userDtos.size() > 0) { return userDtos.get(0).getName(); } throw new CmdException("业主不存在"); } }